@internetarchive/collection-browser 2.2.1-alpha.3 → 2.2.2-alpha.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.
@@ -157,6 +157,8 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
157
157
  private leftColumn?;
158
158
  private collectionFacets?;
159
159
  analyticsHandler?: AnalyticsManagerInterface;
160
+ /** Whether layout size analytics have been sent already. */
161
+ private layoutSizeAnalyticsSent;
160
162
  /**
161
163
  * When we're animated scrolling to the page, we don't want to fetch
162
164
  * all of the pages as it scrolls so this lets us know if we're scrolling
@@ -348,6 +350,7 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
348
350
  installDataSourceAndQueryState(dataSource: CollectionBrowserDataSourceInterface, queryState: CollectionBrowserQueryState): Promise<void>;
349
351
  firstUpdated(): void;
350
352
  setInitialSize(): void;
353
+ private sendLayoutSizeAnalytics;
351
354
  updated(changed: PropertyValues): void;
352
355
  connectedCallback(): void;
353
356
  disconnectedCallback(): void;
@@ -130,6 +130,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
130
130
  this.defaultSortField = SortField.relevance;
131
131
  this.defaultSortDirection = null;
132
132
  this.placeholderType = null;
133
+ /** Whether layout size analytics have been sent already. */
134
+ this.layoutSizeAnalyticsSent = false;
133
135
  /**
134
136
  * When we're animated scrolling to the page, we don't want to fetch
135
137
  * all of the pages as it scrolls so this lets us know if we're scrolling
@@ -235,7 +237,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
235
237
  * @param pageNumber
236
238
  */
237
239
  goToPage(pageNumber) {
238
- console.log('goToPage', pageNumber);
239
240
  this.initialPageNumber = pageNumber;
240
241
  this.pagesToRender = pageNumber;
241
242
  return this.scrollToPage(pageNumber);
@@ -862,6 +863,18 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
862
863
  this.contentWidth = this.contentContainer.getBoundingClientRect().width;
863
864
  this.mobileView =
864
865
  this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
866
+ this.sendLayoutSizeAnalytics();
867
+ }
868
+ sendLayoutSizeAnalytics() {
869
+ if (this.analyticsHandler) {
870
+ this.layoutSizeAnalyticsSent = true;
871
+ this.analyticsHandler.sendEvent({
872
+ category: this.searchContext,
873
+ action: this.mobileView
874
+ ? analyticsActions.loadMobileView
875
+ : analyticsActions.loadDesktopView,
876
+ });
877
+ }
865
878
  }
866
879
  updated(changed) {
867
880
  var _a, _b;
@@ -874,6 +887,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
874
887
  }
875
888
  this.updateLeftColumnHeight();
876
889
  }
890
+ if (changed.has('analyticsHandler') && !this.layoutSizeAnalyticsSent) {
891
+ this.sendLayoutSizeAnalytics();
892
+ }
877
893
  if (changed.has('displayMode') ||
878
894
  changed.has('baseNavigationUrl') ||
879
895
  changed.has('baseImageUrl') ||
@@ -1103,7 +1119,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1103
1119
  * @returns
1104
1120
  */
1105
1121
  visibleCellsChanged(e) {
1106
- console.log('visible cells changed', this.isScrollingToCell, e.detail);
1107
1122
  if (this.isScrollingToCell)
1108
1123
  return;
1109
1124
  const { visibleCellIndices } = e.detail;
@@ -1200,11 +1215,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1200
1215
  this.minSelectedDate = restorationState.minSelectedDate;
1201
1216
  this.maxSelectedDate = restorationState.maxSelectedDate;
1202
1217
  if (this.currentPage > 1) {
1203
- console.log('state restored w/ page number, going to page', this.currentPage);
1204
- setTimeout(() => {
1205
- var _a;
1206
- this.goToPage((_a = this.currentPage) !== null && _a !== void 0 ? _a : 1);
1207
- }, 100);
1218
+ this.goToPage(this.currentPage);
1208
1219
  }
1209
1220
  }
1210
1221
  persistState() {
@@ -1258,30 +1269,25 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1258
1269
  });
1259
1270
  }
1260
1271
  scrollToPage(pageNumber) {
1261
- console.log('scrolling to page', pageNumber);
1262
1272
  return new Promise(resolve => {
1263
1273
  const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
1264
- console.log('cell index', cellIndexToScrollTo);
1265
1274
  // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1266
1275
  // then scrolls to the cell
1267
1276
  setTimeout(() => {
1268
1277
  var _a;
1269
- console.log('requesting infinite scroller to scroll to cell', cellIndexToScrollTo);
1270
1278
  this.isScrollingToCell = true;
1271
- const scrollResult = (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1272
- console.log('scroll result:', scrollResult);
1279
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.scrollToCell(cellIndexToScrollTo, true);
1273
1280
  // This timeout is to give the scroll animation time to finish
1274
1281
  // then updating the infinite scroller once we're done scrolling
1275
1282
  // There's no scroll animation completion callback so we're
1276
1283
  // giving it 0.5s to finish.
1277
1284
  setTimeout(() => {
1278
1285
  var _a;
1279
- console.log('marking scroll finished, refreshing visible cells');
1280
1286
  this.isScrollingToCell = false;
1281
1287
  (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
1282
1288
  resolve();
1283
- }, 750);
1284
- }, 100);
1289
+ }, 500);
1290
+ }, 0);
1285
1291
  });
1286
1292
  }
1287
1293
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"collection-browser.js","sourceRoot":"","sources":["../../src/collection-browser.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,OAAO,EACL,IAAI,EACJ,GAAG,EACH,UAAU,EAGV,OAAO,GACR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,EAIL,UAAU,GAGX,MAAM,iCAAi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E,IAAI,EAAE,MAAM,EAAE,CAAC;iEAC8B;AAE7B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAA8C;AAK5C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAsB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAA4C;AAG1C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gEAA+B;AAS/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAC4B;AAa9C;IAAR,KAAK,EAAE;wDAAgD;AAK/C;IAAR,KAAK,EAAE;+DAAsC;AAErC;IAAR,KAAK,EAAE;wDAA+B;AAE9B;IAAR,KAAK,EAAE;uDAA+B;AAE9B;IAAR,KAAK,EAAE;qDAA4B;AAE3B;IAAR,KAAK,EAAE;8DAAqC;AAEpC;IAAR,KAAK,EAAE;uDAA+B;AAE9B;IAAR,KAAK,EAAE;2DACc;AAEb;IAAR,KAAK,EAAE;+DAA2D;AAE1D;IAAR,KAAK,EAAE;0DAAiD;AAE5B;IAA5B,KAAK,CAAC,oBAAoB,CAAC;2DAA2C;AAEhD;IAAtB,KAAK,CAAC,cAAc,CAAC;qDAAqC;AAE/B;IAA3B,KAAK,CAAC,mBAAmB,CAAC;2DAA6C;AAGxE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2DACA;AA8D7C;IADC,KAAK,CAAC,mBAAmB,CAAC;2DACiB;AAjRjC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA4lE7B;SA5lEY,iBAAiB","sourcesContent":["/* eslint-disable import/no-duplicates */\nimport {\n html,\n css,\n LitElement,\n PropertyValues,\n TemplateResult,\n nothing,\n} from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { msg } from '@lit/localize';\n\nimport type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';\nimport type {\n InfiniteScroller,\n InfiniteScrollerCellProviderInterface,\n} from '@internetarchive/infinite-scroller';\nimport {\n CollectionExtraInfo,\n PageElementName,\n SearchServiceInterface,\n SearchType,\n SortDirection,\n SortParam,\n} from '@internetarchive/search-service';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport '@internetarchive/infinite-scroller';\nimport type { ModalManagerInterface } from '@internetarchive/modal-manager';\nimport type { FeatureFeedbackServiceInterface } from '@internetarchive/feature-feedback';\nimport type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager';\nimport {\n SelectedFacets,\n SortField,\n CollectionBrowserContext,\n getDefaultSelectedFacets,\n TileModel,\n CollectionDisplayMode,\n FacetEventDetails,\n sortOptionFromAPIString,\n SORT_OPTIONS,\n defaultProfileElementSorts,\n} from './models';\nimport {\n RestorationStateHandlerInterface,\n RestorationStateHandler,\n RestorationState,\n} from './restoration-state-handler';\nimport { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';\nimport type {\n CollectionBrowserQueryState,\n CollectionBrowserSearchInterface,\n} from './data-source/collection-browser-query-state';\nimport type { CollectionFacets } from './collection-facets';\nimport type { ManageableItem } from './manage/manage-bar';\nimport type { CollectionBrowserDataSourceInterface } from './data-source/collection-browser-data-source-interface';\nimport {\n analyticsActions,\n analyticsCategories,\n} from './utils/analytics-events';\nimport chevronIcon from './assets/img/icons/chevron';\nimport { srOnlyStyle } from './styles/sr-only';\nimport { sha1 } from './utils/sha1';\nimport { formatDate } from './utils/format-date';\nimport { log } from './utils/log';\nimport type { PlaceholderType } from './empty-placeholder';\n\nimport './empty-placeholder';\nimport './tiles/tile-dispatcher';\nimport './tiles/collection-browser-loading-tile';\nimport './sort-filter-bar/sort-filter-bar';\nimport './manage/manage-bar';\nimport './collection-facets';\nimport './circular-activity-indicator';\n\n@customElement('collection-browser')\nexport class CollectionBrowser\n extends LitElement\n implements\n InfiniteScrollerCellProviderInterface,\n SharedResizeObserverResizeHandlerInterface,\n CollectionBrowserSearchInterface\n{\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) baseImageUrl: string = 'https://archive.org';\n\n @property({ type: Object }) searchService?: SearchServiceInterface;\n\n /**\n * Which backend should be targeted by searches (e.g., metadata or FTS)\n */\n @property({ type: String }) searchType: SearchType = SearchType.METADATA;\n\n /**\n * The identifier of the collection that searches should be performed within\n */\n @property({ type: String }) withinCollection?: string;\n\n /**\n * The identifier (e.g., @person) of the user whose profile is being searched within\n */\n @property({ type: String }) withinProfile?: string;\n\n /**\n * Which section of the profile page searches are for (e.g., uploads, reviews, ...)\n */\n @property({ type: String }) profileElement?: PageElementName;\n\n /**\n * The base query to use for all searches, updated to match the current user query.\n */\n @property({ type: String }) baseQuery?: string;\n\n /**\n * Which mode to display result tiles in (grid, extended list, or compact list)\n */\n @property({ type: String }) displayMode?: CollectionDisplayMode;\n\n @property({ type: Object }) defaultSortParam: SortParam | null = null;\n\n @property({ type: String }) selectedSort: SortField = SortField.default;\n\n @property({ type: String }) selectedTitleFilter: string | null = null;\n\n @property({ type: String }) selectedCreatorFilter: string | null = null;\n\n @property({ type: String }) sortDirection: SortDirection | null = null;\n\n @property({ type: Number }) pageSize = 50;\n\n @property({ type: Number }) currentPage?: number;\n\n @property({ type: String }) minSelectedDate?: string;\n\n @property({ type: String }) maxSelectedDate?: string;\n\n @property({ type: Object }) selectedFacets?: SelectedFacets;\n\n /**\n * Whether to show the date picker (above the facets)\n */\n @property({ type: Boolean }) showHistogramDatePicker = false;\n\n /**\n * Whether placeholder views should be suppressed. If true, searches that produce an\n * error or empty result set will simply show a blank results view instead of a placeholder.\n */\n @property({ type: Boolean }) suppressPlaceholders = false;\n\n /**\n * Whether the result count text should be suppressed.\n * If true, no \"X Results\" message will be shown.\n */\n @property({ type: Boolean }) suppressResultCount = false;\n\n /**\n * Whether the scrolling result view should be suppressed entirely.\n * If true, no infinite scroller (and thus no result tiles) will be rendered.\n */\n @property({ type: Boolean }) suppressResultTiles = false;\n\n /**\n * Whether to suppress persistence of the query to the URL.\n * If true, the `query` param will not be added to the URL or updated on query changes.\n */\n @property({ type: Boolean }) suppressURLQuery = false;\n\n /**\n * Whether to suppress the display of facets entirely.\n * If true, the facet sidebar content will be replaced by a message that facets are\n * temporarily unavailable.\n */\n @property({ type: Boolean }) suppressFacets = false;\n\n /**\n * Whether to suppress display of the sort bar.\n * If true, the entire sort bar (incl. display modes) will be omitted from rendering.\n */\n @property({ type: Boolean }) suppressSortBar = false;\n\n /**\n * Whether to suppress showing the display mode options in the sort bar.\n * If true, those options will be omitted (though the rest of the sort bar may still render).\n */\n @property({ type: Boolean }) suppressDisplayModes = false;\n\n /**\n * Whether facets should be lazy-loaded.\n * If false (default), facet data will be loaded eagerly along with search hits.\n * If true, facet data will only be requested once the facet pane actually becomes visible,\n * either by displaying in desktop mode or by the mobile facet dropdown being opened.\n */\n @property({ type: Boolean }) lazyLoadFacets = false;\n\n @property({ type: Boolean }) clearResultsOnEmptyQuery = false;\n\n @property({ type: String }) collectionPagePath: string = '/details/';\n\n /** describes where this component is being used */\n @property({ type: String, reflect: true }) searchContext: string =\n analyticsCategories.default;\n\n @property({ type: String }) pageContext: CollectionBrowserContext = 'search';\n\n @property({ type: Object })\n restorationStateHandler: RestorationStateHandlerInterface = new RestorationStateHandler(\n {\n context: this.pageContext,\n }\n );\n\n @property({ type: Number }) mobileBreakpoint = 600;\n\n @property({ type: Boolean }) loggedIn = false;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object }) modalManager?: ModalManagerInterface = undefined;\n\n @property({ type: Object })\n featureFeedbackService?: FeatureFeedbackServiceInterface;\n\n @property({ type: Object }) recaptchaManager?: RecaptchaManagerInterface;\n\n /**\n * If item management UI active\n */\n @property({ type: Boolean }) isManageView = false;\n\n @property({ type: String }) manageViewLabel = 'Select items to remove';\n\n /** Whether to replace the default sort options with a slot for customization (default: false) */\n @property({ type: Boolean }) enableSortOptionsSlot = false;\n\n /**\n * The results per page so we can paginate.\n *\n * This allows us to start in the middle of the search results and\n * fetch data before or after the current page. If we don't have a key\n * for the previous/next page, we'll fetch the next/previous page to populate it\n */\n @property({ type: Object }) dataSource: CollectionBrowserDataSourceInterface =\n new CollectionBrowserDataSource(this, this.pageSize);\n\n /**\n * The page that the consumer wants to load.\n */\n initialPageNumber = 1;\n\n /**\n * This the the number of pages that we want to show.\n *\n * The data isn't necessarily loaded for all of the pages, but this lets us\n * know how many cells we should render.\n */\n @state() private pagesToRender = this.initialPageNumber;\n\n /**\n * Whether the initial page fetch for a new query is currently in progress.\n */\n @state() private searchResultsLoading = false;\n\n @state() private facetsLoading = false;\n\n @state() private totalResults?: number;\n\n @state() private mobileView = false;\n\n @state() private mobileFacetsVisible = false;\n\n @state() private contentWidth?: number;\n\n @state() private defaultSortField: Exclude<SortField, SortField.default> =\n SortField.relevance;\n\n @state() private defaultSortDirection: SortDirection | null = null;\n\n @state() private placeholderType: PlaceholderType = null;\n\n @query('#content-container') private contentContainer!: HTMLDivElement;\n\n @query('#left-column') private leftColumn?: HTMLDivElement;\n\n @query('collection-facets') private collectionFacets?: CollectionFacets;\n\n @property({ type: Object, attribute: false })\n analyticsHandler?: AnalyticsManagerInterface;\n\n /**\n * When we're animated scrolling to the page, we don't want to fetch\n * all of the pages as it scrolls so this lets us know if we're scrolling\n */\n private isScrollingToCell = false;\n\n /**\n * When page width resizes from desktop to mobile, set true to\n * disable expand/collapse transition when loading.\n */\n private isResizeToMobile = false;\n\n /**\n * Flag indicating that a new data source is currently being installed.\n * During the install, any URL persistence operation should replace the current entry\n * instead of creating a new one.\n */\n private dataSourceInstallInProgress = false;\n\n private leftColIntersectionObserver?: IntersectionObserver;\n\n private facetsIntersectionObserver?: IntersectionObserver;\n\n private placeholderCellTemplate = html`<collection-browser-loading-tile></collection-browser-loading-tile>`;\n\n constructor() {\n super();\n this.addController(this.dataSource);\n }\n\n private tileModelAtCellIndex(index: number): TileModel | undefined {\n const model = this.dataSource.getTileModelAt(index);\n /**\n * If we encounter a model we don't have yet and we're not in the middle of an\n * automated scroll, fetch the page and just return undefined.\n * The datasource will be updated once the page is loaded and the cell will be rendered.\n *\n * We disable it during the automated scroll since we don't want to fetch pages for intervening cells the\n * user may never see.\n */\n if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {\n const pageNumber = Math.floor(index / this.pageSize) + 1;\n this.dataSource.fetchPage(pageNumber);\n }\n return model;\n }\n\n // this is the total number of tiles we expect if\n // the data returned is a full page worth\n // this is useful for putting in placeholders for the expected number of tiles\n private get estimatedTileCount(): number {\n return this.pagesToRender * this.pageSize;\n }\n\n /**\n * How many tiles to offset the data source by, to account for any removed tiles.\n */\n private tileModelOffset = 0;\n\n @query('infinite-scroller')\n private infiniteScroller?: InfiniteScroller;\n\n private sessionIdGenPromise?: Promise<string>;\n\n /**\n * Returns a promise resolving to a unique string that persists for the current browser session.\n * Used in generating unique IDs for search requests, so that multiple requests coming from the\n * same browser session can be identified.\n */\n async getSessionId(): Promise<string> {\n try {\n const storedSessionId = sessionStorage?.getItem('cb-session');\n if (storedSessionId) {\n return storedSessionId;\n }\n\n // If we enter this method a second time while a first session ID is already being generated,\n // ensure we produce the same ID from both calls instead of generating another one.\n if (this.sessionIdGenPromise) {\n return this.sessionIdGenPromise;\n }\n\n this.sessionIdGenPromise = sha1(Math.random().toString());\n const newSessionId = await this.sessionIdGenPromise;\n\n sessionStorage?.setItem('cb-session', newSessionId);\n return newSessionId;\n } catch (err) {\n // Either we can't generate the hash or we're restricted from accessing sessionStorage\n return '';\n }\n }\n\n /**\n * Go to the given page of results\n *\n * @param pageNumber\n */\n goToPage(pageNumber: number) {\n console.log('goToPage', pageNumber);\n this.initialPageNumber = pageNumber;\n this.pagesToRender = pageNumber;\n return this.scrollToPage(pageNumber);\n }\n\n /**\n * Sets the state for whether the initial set of search results is loading in.\n */\n setSearchResultsLoading(loading: boolean): void {\n this.searchResultsLoading = loading;\n }\n\n /**\n * Sets the state for whether facet data is loading in\n */\n setFacetsLoading(loading: boolean): void {\n this.facetsLoading = loading;\n }\n\n /**\n * Sets the total number of results to be displayed for the current search\n */\n setTotalResultCount(totalResults: number): void {\n this.totalResults = totalResults;\n }\n\n /**\n * Clears all selected/negated facets, date ranges, and letter filters.\n *\n * By default, the current sort field/direction are not cleared,\n * but this can be overridden by setting the `sort` option to `true`.\n *\n * Similarly, it is possible to finely control what is cleared by\n * setting any of the `facets`, `dateRange`, or `letterFilters` flags\n * in the options object.\n */\n clearFilters({\n facets = true,\n dateRange = true,\n letterFilters = true,\n sort = false,\n } = {}): void {\n // Don't bother clearing facets if none are checked, so that we don't\n // trigger unnecessary update cycles.\n if (facets && this.hasCheckedFacets) {\n this.selectedFacets = getDefaultSelectedFacets();\n }\n\n if (dateRange) {\n this.minSelectedDate = undefined;\n this.maxSelectedDate = undefined;\n }\n\n if (letterFilters) {\n this.selectedTitleFilter = null;\n this.selectedCreatorFilter = null;\n }\n\n if (sort) {\n this.sortDirection = null;\n this.selectedSort = SortField.default;\n }\n }\n\n /**\n * Returns true if the current value of `this.selectedFacets` contains\n * any facet buckets than have been selected or negated, or false otherwise.\n */\n private get hasCheckedFacets(): boolean {\n if (!this.selectedFacets) return false;\n\n for (const facetGroup of Object.values(this.selectedFacets)) {\n for (const bucket of Object.values(facetGroup)) {\n if (bucket.state !== 'none') return true;\n }\n }\n\n return false;\n }\n\n /**\n * Returns true if there are any currently selected/negated facet buckets,\n * any selected date range, or any selected letter filters. False otherwise.\n *\n * Ignores sorting options.\n */\n private get hasActiveFilters(): boolean {\n return !!(\n this.hasCheckedFacets ||\n this.minSelectedDate ||\n this.maxSelectedDate ||\n this.selectedTitleFilter ||\n this.selectedCreatorFilter\n );\n }\n\n render() {\n this.setPlaceholderType();\n return html`\n <div\n id=\"content-container\"\n class=${this.mobileView ? 'mobile' : 'desktop'}\n >\n ${this.placeholderType\n ? this.emptyPlaceholderTemplate\n : this.collectionBrowserTemplate}\n </div>\n `;\n }\n\n private setPlaceholderType() {\n const hasQuery = !!this.baseQuery?.trim();\n const isCollection = !!this.withinCollection;\n const isProfile = !!this.withinProfile;\n const noResults =\n !this.searchResultsLoading &&\n (this.dataSource.size === 0 || !this.searchService);\n\n this.placeholderType = null;\n if (this.suppressPlaceholders) return;\n\n if (!hasQuery && !isCollection && !isProfile) {\n this.placeholderType = 'empty-query';\n } else if (noResults) {\n // Within a collection, no query + no results means the collection simply has no viewable items.\n // Otherwise, we must have a user query that produced 0 results.\n this.placeholderType =\n !hasQuery && isCollection ? 'empty-collection' : 'no-results';\n }\n\n if (this.dataSource.queryErrorMessage) {\n this.placeholderType =\n !hasQuery && isCollection ? 'collection-error' : 'query-error';\n }\n }\n\n private get emptyPlaceholderTemplate() {\n return html`\n <empty-placeholder\n .placeholderType=${this.placeholderType}\n ?isMobileView=${this.mobileView}\n ?isCollection=${!!this.withinCollection}\n .detailMessage=${this.dataSource.queryErrorMessage ?? ''}\n .baseNavigationUrl=${this.baseNavigationUrl}\n ></empty-placeholder>\n `;\n }\n\n /**\n * Top-level template for rendering the left (facets) and right (results) columns.\n */\n private get collectionBrowserTemplate() {\n return html`\n <div id=\"left-column-scroll-sentinel\"></div>\n ${this.leftColumnTemplate} ${this.rightColumnTemplate}\n `;\n }\n\n /**\n * Template for either the mobile or desktop version of the left column, depending\n * on current component state.\n */\n private get leftColumnTemplate(): TemplateResult {\n if (this.mobileView) {\n return this.mobileLeftColumnTemplate;\n }\n return this.desktopLeftColumnTemplate;\n }\n\n /**\n * Template for the mobile version of the \"left column\" (which in this case, appears\n * *above* the search results rather than beside them), for rendering the\n * accordion-style facets.\n */\n private get mobileLeftColumnTemplate(): TemplateResult {\n return html`\n <div\n id=\"left-column\"\n class=\"column${this.isResizeToMobile ? ' preload' : ''}\"\n >\n ${this.facetTopViewSlot} ${this.resultsCountTemplate}\n <div id=\"facets-header-container\">${this.mobileFacetsTemplate}</div>\n </div>\n `;\n }\n\n /**\n * Template for the desktop version of the left column, displaying the facets sidebar.\n */\n private get desktopLeftColumnTemplate(): TemplateResult {\n return html`\n <div id=\"left-column\" class=\"column\">\n ${this.facetTopViewSlot}\n <div id=\"facets-header-container\">\n <h2 id=\"facets-header\" class=\"sr-only\">Filters</h2>\n ${this.resultsCountTemplate} ${this.clearFiltersBtnTemplate(false)}\n </div>\n <div id=\"facets-container\" aria-labelledby=\"facets-header\">\n ${this.facetsTemplate}\n <div id=\"facets-scroll-sentinel\"></div>\n </div>\n <div id=\"facets-bottom-fade\"></div>\n </div>\n `;\n }\n\n /**\n * Slot which is placed at top of the facets area for user-profile page\n * - mainly used to render userlists\n */\n private get facetTopViewSlot(): TemplateResult {\n return html`<div id=\"facet-top-view\">\n <slot name=\"facet-top-slot\"></slot>\n </div>`;\n }\n\n /**\n * Template for the \"X Results\" count at the top of the search results.\n * Changes to the \"Searching...\" label if the search results are still loading.\n */\n private get resultsCountTemplate(): TemplateResult | typeof nothing {\n if (this.suppressResultCount) return nothing;\n\n const shouldShowSearching =\n this.searchResultsLoading || this.totalResults === undefined;\n const resultsCount = this.totalResults?.toLocaleString();\n const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';\n\n return html`\n <div id=\"results-total\">\n <span id=\"big-results-count\">\n ${shouldShowSearching ? html`Searching&hellip;` : resultsCount}\n </span>\n <span id=\"big-results-label\">\n ${shouldShowSearching ? nothing : resultsLabel}\n </span>\n </div>\n `;\n }\n\n /**\n * Template for the right column of the collection browser, where the result\n * tiles and sort/filter bar are shown.\n */\n private get rightColumnTemplate(): TemplateResult {\n return html`\n <div id=\"right-column\" class=\"column\">\n <div id=\"cb-top-view\">\n <slot name=\"cb-top-slot\"></slot>\n </div>\n ${this.isManageView\n ? this.manageBarTemplate\n : this.sortFilterBarTemplate}\n <slot name=\"cb-results\"></slot>\n ${this.displayMode === `list-compact` && this.totalResults\n ? this.listHeaderTemplate\n : nothing}\n ${this.suppressResultTiles ? nothing : this.infiniteScrollerTemplate}\n </div>\n `;\n }\n\n private get infiniteScrollerTemplate() {\n return html`<infinite-scroller\n class=${this.infiniteScrollerClasses}\n itemCount=${this.placeholderType ? 0 : nothing}\n ariaLandmarkLabel=\"Search results\"\n .cellProvider=${this}\n .placeholderCellTemplate=${this.placeholderCellTemplate}\n @scrollThresholdReached=${this.scrollThresholdReached}\n @visibleCellsChanged=${this.visibleCellsChanged}\n >${this.displayMode === 'grid'\n ? html`<slot name=\"result-last-tile\" slot=\"result-last-tile\"></slot>`\n : nothing}\n </infinite-scroller>`;\n }\n\n private get infiniteScrollerClasses() {\n return classMap({\n [this.displayMode ?? '']: !!this.displayMode,\n hidden: !!this.placeholderType,\n });\n }\n\n private get sortFilterBarTemplate(): TemplateResult | typeof nothing {\n if (this.suppressSortBar) return nothing;\n\n return html`\n <sort-filter-bar\n .defaultSortField=${this.defaultSortField}\n .defaultSortDirection=${this.defaultSortDirection}\n .selectedSort=${this.selectedSort}\n .sortDirection=${this.sortDirection}\n .showRelevance=${this.isRelevanceSortAvailable}\n .showDateFavorited=${this.withinCollection?.startsWith('fav-')}\n .displayMode=${this.displayMode}\n .selectedTitleFilter=${this.selectedTitleFilter}\n .selectedCreatorFilter=${this.selectedCreatorFilter}\n .prefixFilterCountMap=${this.dataSource.prefixFilterCountMap}\n .resizeObserver=${this.resizeObserver}\n .enableSortOptionsSlot=${this.enableSortOptionsSlot}\n .suppressDisplayModes=${this.suppressDisplayModes}\n @sortChanged=${this.userChangedSort}\n @displayModeChanged=${this.displayModeChanged}\n @titleLetterChanged=${this.titleLetterSelected}\n @creatorLetterChanged=${this.creatorLetterSelected}\n >\n <slot name=\"sort-options-left\" slot=\"sort-options-left\"></slot>\n <slot name=\"sort-options\" slot=\"sort-options\"></slot>\n <slot name=\"sort-options-right\" slot=\"sort-options-right\"></slot>\n </sort-filter-bar>\n `;\n }\n\n private get manageBarTemplate(): TemplateResult {\n return html`\n <manage-bar\n .label=${this.manageViewLabel}\n showSelectAll\n showUnselectAll\n ?removeAllowed=${this.dataSource.checkedTileModels.length !== 0}\n @removeItems=${this.handleRemoveItems}\n @selectAll=${() => this.dataSource.checkAllTiles()}\n @unselectAll=${() => this.dataSource.uncheckAllTiles()}\n @cancel=${() => {\n this.isManageView = false;\n this.dataSource.uncheckAllTiles();\n }}\n ></manage-bar>\n `;\n }\n\n /**\n * Handler for when the user requests to remove all checked items via the manage bar.\n * Emits an `itemRemovalRequested` event with all checked tile models.\n */\n private handleRemoveItems(): void {\n this.dispatchEvent(\n new CustomEvent<{ items: ManageableItem[] }>('itemRemovalRequested', {\n detail: {\n items: this.dataSource.checkedTileModels.map(model => {\n const cloned = model.clone();\n cloned.dateStr = formatDate(model.datePublished, 'long');\n return cloned as ManageableItem;\n }),\n },\n })\n );\n }\n\n /**\n * Removes all tile models that are currently checked & adjusts the paging\n * of the data source to account for any new gaps in the data.\n */\n removeCheckedTiles(): void {\n this.dataSource.removeCheckedTiles();\n }\n\n private userChangedSort(\n e: CustomEvent<{\n selectedSort: SortField;\n sortDirection: SortDirection | null;\n }>\n ) {\n const { selectedSort, sortDirection } = e.detail;\n this.selectedSort = selectedSort;\n this.sortDirection = sortDirection;\n\n if ((this.currentPage ?? 1) > 1) {\n this.goToPage(1);\n }\n this.currentPage = 1;\n }\n\n private sendSortByAnalytics(prevSortDirection: SortDirection | null): void {\n const directionCleared = prevSortDirection && !this.sortDirection;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.sortBy,\n label: `${this.selectedSort}${\n this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''\n }`,\n });\n }\n\n private selectedSortChanged(): void {\n // Lazy-load the alphabet counts for title/creator sort bar as needed\n this.dataSource.updatePrefixFiltersForCurrentSort();\n }\n\n get sortParam(): SortParam | null {\n const sortOption = SORT_OPTIONS[this.selectedSort];\n if (!sortOption?.handledBySearchService) {\n return null;\n }\n\n // If the sort option specified in the URL is unrecognized, we just use it as-is\n const urlSortParam = new URL(window.location.href).searchParams.get('sort');\n const sortField =\n sortOption.searchServiceKey ?? urlSortParam?.replace(/^-/, '');\n\n // If the sort direction is still null at this point, then we assume ascending\n // (i.e., it was unrecognized and had no directional flag)\n if (!this.sortDirection) this.sortDirection = 'asc';\n\n if (!sortField) return null;\n return { field: sortField, direction: this.sortDirection };\n }\n\n private displayModeChanged(\n e: CustomEvent<{ displayMode?: CollectionDisplayMode }>\n ): void {\n this.displayMode = e.detail.displayMode;\n\n if (this.displayMode) {\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.displayMode,\n label: this.displayMode,\n });\n }\n }\n\n /**\n * Returns a query clause identifying the currently selected title filter,\n * e.g., `firstTitle:X`.\n */\n private get titleQuery(): string | undefined {\n return this.selectedTitleFilter\n ? `firstTitle:${this.selectedTitleFilter}`\n : undefined;\n }\n\n /**\n * Returns a query clause identifying the currently selected creator filter,\n * e.g., `firstCreator:X`.\n */\n private get creatorQuery(): string | undefined {\n return this.selectedCreatorFilter\n ? `firstCreator:${this.selectedCreatorFilter}`\n : undefined;\n }\n\n /**\n * Send Analytics when sorting by title's first letter\n * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'\n */\n private sendFilterByTitleAnalytics(prevSelectedLetter: string | null): void {\n if (!prevSelectedLetter && !this.selectedTitleFilter) {\n return;\n }\n const cleared = prevSelectedLetter && !this.selectedTitleFilter;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.filterByTitle,\n label: cleared\n ? `clear-${prevSelectedLetter}`\n : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,\n });\n }\n\n /**\n * Send Analytics when filtering by creator's first letter\n * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'\n */\n private sendFilterByCreatorAnalytics(\n prevSelectedLetter: string | null\n ): void {\n if (!prevSelectedLetter && !this.selectedCreatorFilter) {\n return;\n }\n const cleared = prevSelectedLetter && !this.selectedCreatorFilter;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.filterByCreator,\n label: cleared\n ? `clear-${prevSelectedLetter}`\n : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,\n });\n }\n\n /**\n * Handler for changes to which letter is selected in the title alphabet bar.\n */\n private titleLetterSelected(\n e: CustomEvent<{ selectedLetter: string | null }>\n ): void {\n this.selectedCreatorFilter = null;\n this.selectedTitleFilter = e.detail.selectedLetter;\n }\n\n /**\n * Handler for changes to which letter is selected in the creator alphabet bar.\n */\n private creatorLetterSelected(\n e: CustomEvent<{ selectedLetter: string | null }>\n ): void {\n this.selectedTitleFilter = null;\n this.selectedCreatorFilter = e.detail.selectedLetter;\n }\n\n /**\n * The full template for how the facets should be structured in mobile view,\n * including the collapsible container (with header) and the facets themselves.\n */\n private get mobileFacetsTemplate(): TemplateResult {\n const toggleFacetsVisible = (e: Event) => {\n this.isResizeToMobile = false;\n this.mobileFacetsVisible = !this.mobileFacetsVisible;\n\n const target = e.target as HTMLDetailsElement;\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.mobileFacetsToggled,\n label: target.open ? 'open' : 'closed',\n });\n };\n\n return html`\n <details id=\"mobile-filter-collapse\" @toggle=${toggleFacetsVisible}>\n <summary>\n <span class=\"collapser-icon\">${chevronIcon}</span>\n <h2>${msg('Filters')}</h2>\n ${this.clearFiltersBtnTemplate(true)}\n </summary>\n ${this.facetsTemplate}\n </details>\n `;\n }\n\n /**\n * The template for the facets component alone, without any surrounding wrappers.\n */\n private get facetsTemplate() {\n if (this.suppressFacets) {\n return html`\n <p class=\"facets-message\">\n ${msg('Facets are temporarily unavailable.')}\n </p>\n `;\n }\n\n return html`\n <collection-facets\n @facetsChanged=${this.facetsChanged}\n @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}\n .collectionPagePath=${this.collectionPagePath}\n .parentCollections=${this.dataSource.parentCollections}\n .pageSpecifierParams=${this.dataSource.pageSpecifierParams}\n .searchService=${this.searchService}\n .featureFeedbackService=${this.featureFeedbackService}\n .recaptchaManager=${this.recaptchaManager}\n .resizeObserver=${this.resizeObserver}\n .searchType=${this.searchType}\n .aggregations=${this.dataSource.aggregations}\n .fullYearsHistogramAggregation=${this.dataSource\n .yearHistogramAggregation}\n .minSelectedDate=${this.minSelectedDate}\n .maxSelectedDate=${this.maxSelectedDate}\n .selectedFacets=${this.selectedFacets}\n .baseNavigationUrl=${this.baseNavigationUrl}\n .collectionTitles=${this.dataSource.collectionTitles}\n .showHistogramDatePicker=${this.showHistogramDatePicker}\n .allowExpandingDatePicker=${!this.mobileView}\n .contentWidth=${this.contentWidth}\n .query=${this.baseQuery}\n .filterMap=${this.dataSource.filterMap}\n .isManageView=${this.isManageView}\n .modalManager=${this.modalManager}\n ?collapsableFacets=${this.mobileView}\n ?facetsLoading=${this.facetsLoading}\n ?fullYearAggregationLoading=${this.facetsLoading}\n @facetClick=${this.facetClickHandler}\n .analyticsHandler=${this.analyticsHandler}\n >\n </collection-facets>\n `;\n }\n\n /**\n * The HTML template for the \"Clear all filters\" button, or `nothing` if no\n * filters are currently active.\n *\n * @param mobile Whether to style/shorten the button for mobile view\n */\n private clearFiltersBtnTemplate(\n mobile: boolean\n ): TemplateResult | typeof nothing {\n if (!this.hasActiveFilters) return nothing;\n\n const buttonClasses = classMap({\n 'clear-filters-btn': true,\n mobile,\n });\n\n const buttonText = mobile ? 'Clear all' : 'Clear all filters';\n\n return html`\n <div class=\"clear-filters-btn-row\">\n ${mobile\n ? html`<span class=\"clear-filters-btn-separator\">&nbsp;</span>`\n : nothing}\n <button class=${buttonClasses} @click=${this.clearFilters}>\n ${buttonText}\n </button>\n </div>\n `;\n }\n\n private get loadingTemplate() {\n return html`\n <div class=\"loading-cover\">\n <circular-activity-indicator></circular-activity-indicator>\n </div>\n `;\n }\n\n private get listHeaderTemplate() {\n return html`\n <div id=\"list-header\">\n <tile-dispatcher\n .tileDisplayMode=${'list-header'}\n .resizeObserver=${this.resizeObserver}\n .sortParam=${this.sortParam}\n .defaultSortParam=${this.defaultSortParam}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .loggedIn=${this.loggedIn}\n >\n </tile-dispatcher>\n </div>\n `;\n }\n\n private histogramDateRangeUpdated(\n e: CustomEvent<{\n minDate: string;\n maxDate: string;\n }>\n ) {\n const { minDate, maxDate } = e.detail;\n [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.histogramChanged,\n label: this.dateRangeQueryClause,\n });\n }\n\n private get dateRangeQueryClause() {\n if (!this.minSelectedDate || !this.maxSelectedDate) {\n return undefined;\n }\n\n return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;\n }\n\n /**\n * Emits an event indicating a change in whether the manage mode is shown.\n */\n private emitManageModeChangedEvent(): void {\n this.dispatchEvent(\n new CustomEvent<boolean>('manageModeChanged', {\n detail: this.isManageView,\n })\n );\n }\n\n async installDataSourceAndQueryState(\n dataSource: CollectionBrowserDataSourceInterface,\n queryState: CollectionBrowserQueryState\n ): Promise<void> {\n log('Installing data source & query state in CB:', dataSource, queryState);\n if (this.dataSource) this.removeController(this.dataSource);\n this.dataSource = dataSource;\n this.addController(this.dataSource);\n\n this.baseQuery = queryState.baseQuery;\n this.profileElement = queryState.profileElement;\n this.searchType = queryState.searchType;\n this.selectedFacets =\n queryState.selectedFacets ?? getDefaultSelectedFacets();\n this.minSelectedDate = queryState.minSelectedDate;\n this.maxSelectedDate = queryState.maxSelectedDate;\n this.selectedSort = queryState.selectedSort ?? SortField.default;\n this.sortDirection = queryState.sortDirection;\n this.selectedTitleFilter = queryState.selectedTitleFilter;\n this.selectedCreatorFilter = queryState.selectedCreatorFilter;\n\n // We set this flag during the update to prevent the URL state persistence\n // from creating an unwanted extra history entry.\n this.dataSourceInstallInProgress = true;\n this.requestUpdate();\n await this.updateComplete;\n this.dataSourceInstallInProgress = false;\n\n if (!this.searchResultsLoading) {\n this.setTotalResultCount(this.dataSource.totalResults);\n this.setTileCount(this.dataSource.size);\n }\n\n this.refreshVisibleResults();\n }\n\n firstUpdated(): void {\n this.restoreState();\n this.setInitialSize();\n }\n\n setInitialSize(): void {\n this.contentWidth = this.contentContainer.getBoundingClientRect().width;\n this.mobileView =\n this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('placeholderType') && this.placeholderType === null) {\n if (!this.leftColIntersectionObserver) {\n this.setupLeftColumnScrollListeners();\n }\n if (!this.facetsIntersectionObserver) {\n this.setupFacetsScrollListeners();\n }\n this.updateLeftColumnHeight();\n }\n\n if (\n changed.has('displayMode') ||\n changed.has('baseNavigationUrl') ||\n changed.has('baseImageUrl') ||\n changed.has('loggedIn')\n ) {\n this.infiniteScroller?.reload();\n }\n\n if (\n changed.has('baseQuery') ||\n changed.has('searchType') ||\n changed.has('withinCollection')\n ) {\n // Unless this query/search type update is from the initial page load or the\n // result of hitting the back button,\n // we need to clear any existing filters since they may no longer be valid for\n // the new set of search results.\n if (!this.historyPopOccurred && this.initialQueryChangeHappened) {\n // Ordinarily, we leave the sort param unchanged between searches.\n // However, if we are changing the target collection itself, we want the sort cleared too,\n // since different collections may have different sorting options available.\n const shouldClearSort =\n changed.has('withinCollection') &&\n !changed.has('selectedSort') &&\n !changed.has('sortDirection');\n\n // Otherwise, only clear filters that haven't been simultaneously applied in this update\n this.clearFilters({\n sort: shouldClearSort,\n facets: !changed.has('selectedFacets'),\n dateRange: !(\n changed.has('minSelectedDate') || changed.has('maxSelectedDate')\n ),\n letterFilters: !(\n changed.has('selectedTitleFilter') ||\n changed.has('selectedCreatorFilter')\n ),\n });\n }\n }\n\n if (changed.has('profileElement')) {\n this.applyDefaultProfileSort();\n }\n\n if (changed.has('baseQuery')) {\n this.emitBaseQueryChanged();\n }\n if (changed.has('searchType')) {\n this.emitSearchTypeChanged();\n }\n\n if (changed.has('currentPage') || changed.has('displayMode')) {\n this.persistState();\n }\n\n if (\n changed.has('baseQuery') ||\n changed.has('minSelectedDate') ||\n changed.has('maxSelectedDate') ||\n changed.has('selectedFacets') ||\n changed.has('searchService') ||\n changed.has('withinCollection') ||\n changed.has('withinProfile') ||\n changed.has('profileElement')\n ) {\n this.dataSource.refreshLetterCounts();\n }\n\n if (changed.has('selectedSort') || changed.has('sortDirection')) {\n const prevSortDirection = changed.get('sortDirection') as SortDirection;\n this.sendSortByAnalytics(prevSortDirection);\n this.selectedSortChanged();\n }\n\n if (changed.has('selectedTitleFilter')) {\n this.sendFilterByTitleAnalytics(\n changed.get('selectedTitleFilter') as string\n );\n }\n if (changed.has('selectedCreatorFilter')) {\n this.sendFilterByCreatorAnalytics(\n changed.get('selectedCreatorFilter') as string\n );\n }\n\n // Facets are always visible in the desktop view.\n // But in the mobile view, their visibility state can be toggled by the user.\n // In either case, inform the data source so that it can determine whether/when to fetch facets.\n this.dataSource.handleFacetVisibilityChange(\n !this.mobileView || this.mobileFacetsVisible\n );\n\n if (\n changed.has('baseQuery') ||\n changed.has('searchType') ||\n changed.has('selectedTitleFilter') ||\n changed.has('selectedCreatorFilter') ||\n changed.has('minSelectedDate') ||\n changed.has('maxSelectedDate') ||\n changed.has('selectedSort') ||\n changed.has('sortDirection') ||\n changed.has('selectedFacets') ||\n changed.has('searchService') ||\n changed.has('withinCollection') ||\n changed.has('withinProfile') ||\n changed.has('profileElement')\n ) {\n this.handleQueryChange();\n }\n\n if (changed.has('searchResultsLoading')) {\n this.emitSearchResultsLoadingChanged();\n }\n\n if (\n changed.has('facetsLoading') &&\n this.facetsLoading &&\n this.collectionFacets\n ) {\n this.collectionFacets.moreLinksVisible =\n this.searchType !== SearchType.FULLTEXT;\n }\n\n if (changed.has('pagesToRender')) {\n if (!this.dataSource.endOfDataReached && this.infiniteScroller) {\n this.infiniteScroller.itemCount = this.estimatedTileCount;\n }\n }\n\n if (changed.has('isManageView')) {\n if (this.isManageView) this.displayMode = 'grid';\n this.infiniteScroller?.refreshAllVisibleCells();\n this.emitManageModeChangedEvent();\n }\n\n if (changed.has('resizeObserver')) {\n const oldObserver = changed.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n if (oldObserver) this.disconnectResizeObserver(oldObserver);\n this.setupResizeObserver();\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback?.();\n this.setupStateRestorationObserver();\n this.setupResizeObserver();\n }\n\n disconnectedCallback(): void {\n if (this.resizeObserver) {\n this.disconnectResizeObserver(this.resizeObserver);\n }\n if (this.boundNavigationHandler) {\n window.removeEventListener('popstate', this.boundNavigationHandler);\n }\n\n this.leftColIntersectionObserver?.disconnect();\n this.facetsIntersectionObserver?.disconnect();\n window.removeEventListener('resize', this.updateLeftColumnHeight);\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n const previousView = this.mobileView;\n if (entry.target === this.contentContainer) {\n this.contentWidth = entry.contentRect.width;\n this.mobileView =\n this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;\n // If changing from desktop to mobile disable transition\n if (this.mobileView && !previousView) {\n this.isResizeToMobile = true;\n }\n }\n\n // Ensure the facet sidebar remains sized correctly\n this.updateLeftColumnHeight();\n }\n\n /**\n * Sets up listeners for events that may require updating the left column height.\n */\n private setupLeftColumnScrollListeners(): void {\n // We observe intersections between the left column's scroll sentinel and\n // the viewport, so that we can ensure the left column is always sized to\n // match the _available_ viewport height. This should generally be more\n // performant than listening to scroll events on the page or column.\n const leftColumnSentinel = this.shadowRoot?.querySelector(\n '#left-column-scroll-sentinel'\n );\n if (leftColumnSentinel) {\n this.leftColIntersectionObserver = new IntersectionObserver(\n this.updateLeftColumnHeight,\n {\n threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%\n }\n );\n this.leftColIntersectionObserver.observe(leftColumnSentinel);\n }\n\n // We also listen for window resize events, as they are not always captured\n // by the resize observer and can affect the desired height of the left column.\n window.addEventListener('resize', this.updateLeftColumnHeight);\n }\n\n /**\n * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.\n * Note this uses a separate IntersectionObserver from the left column, because we\n * don't need granular intersection thresholds for this.\n */\n private setupFacetsScrollListeners(): void {\n const facetsSentinel = this.shadowRoot?.querySelector(\n '#facets-scroll-sentinel'\n );\n if (facetsSentinel) {\n this.facetsIntersectionObserver = new IntersectionObserver(\n this.updateFacetFadeOut\n );\n this.facetsIntersectionObserver.observe(facetsSentinel);\n }\n }\n\n /**\n * Updates the height of the left column according to its position on the page.\n * Arrow function ensures proper `this` binding.\n */\n private updateLeftColumnHeight = (): void => {\n if (this.mobileView) {\n this.leftColumn?.style?.removeProperty('height');\n } else {\n const clientTop = this.leftColumn?.getBoundingClientRect().top;\n this.leftColumn?.style?.setProperty(\n 'height',\n `${window.innerHeight - (clientTop ?? 0) - 3}px`\n );\n }\n };\n\n /**\n * Toggles whether the fade-out is visible at the bottom of the facets.\n * It should only be visible if the facets are not scrolled to the bottom.\n * Arrow function ensures proper `this` binding.\n */\n private updateFacetFadeOut = (entries: IntersectionObserverEntry[]): void => {\n const fadeElmt = this.shadowRoot?.getElementById('facets-bottom-fade');\n fadeElmt?.classList.toggle('hidden', entries?.[0]?.isIntersecting);\n };\n\n private emitBaseQueryChanged() {\n this.dispatchEvent(\n new CustomEvent<{ baseQuery?: string }>('baseQueryChanged', {\n detail: {\n baseQuery: this.baseQuery,\n },\n })\n );\n }\n\n private emitSearchTypeChanged() {\n this.dispatchEvent(\n new CustomEvent<SearchType>('searchTypeChanged', {\n detail: this.searchType,\n })\n );\n }\n\n emitQueryStateChanged() {\n this.dispatchEvent(\n new CustomEvent<CollectionBrowserQueryState>('queryStateChanged', {\n detail: {\n baseQuery: this.baseQuery,\n withinCollection: this.withinCollection,\n withinProfile: this.withinProfile,\n profileElement: this.profileElement,\n searchType: this.searchType,\n selectedFacets: this.selectedFacets,\n minSelectedDate: this.minSelectedDate,\n maxSelectedDate: this.maxSelectedDate,\n selectedSort: this.selectedSort,\n sortDirection: this.sortDirection,\n selectedTitleFilter: this.selectedTitleFilter,\n selectedCreatorFilter: this.selectedCreatorFilter,\n },\n })\n );\n }\n\n emitEmptyResults() {\n this.dispatchEvent(new Event('emptyResults'));\n }\n\n private disconnectResizeObserver(\n resizeObserver: SharedResizeObserverInterface\n ) {\n resizeObserver.removeObserver({\n target: this.contentContainer,\n handler: this,\n });\n }\n\n private setupResizeObserver() {\n if (!this.resizeObserver || !this.contentContainer) return;\n this.resizeObserver.addObserver({\n target: this.contentContainer,\n handler: this,\n });\n }\n\n /**\n * When the visible cells change from the infinite scroller, we want to emit\n * which page is currently visible so the consumer can update its UI or the URL\n *\n * @param e\n * @returns\n */\n private visibleCellsChanged(\n e: CustomEvent<{ visibleCellIndices: number[] }>\n ) {\n console.log('visible cells changed', this.isScrollingToCell, e.detail);\n if (this.isScrollingToCell) return;\n const { visibleCellIndices } = e.detail;\n if (visibleCellIndices.length === 0) return;\n const lastVisibleCellIndex =\n visibleCellIndices[visibleCellIndices.length - 1];\n const lastVisibleCellPage =\n Math.floor(lastVisibleCellIndex / this.pageSize) + 1;\n if (this.currentPage !== lastVisibleCellPage) {\n this.currentPage = lastVisibleCellPage;\n }\n const event = new CustomEvent('visiblePageChanged', {\n detail: {\n pageNumber: lastVisibleCellPage,\n },\n });\n this.dispatchEvent(event);\n }\n\n // we only want to scroll on the very first query change\n // so this keeps track of whether we've already set the initial query\n private initialQueryChangeHappened = false;\n\n private historyPopOccurred = false;\n\n // this lets us store the query key so we know if it's actually changed or not\n private previousQueryKey?: string;\n\n /**\n * A Promise which, after each query change, resolves once the fetches for the initial\n * search have completed. Waits for *both* the hits and aggregations fetches to finish.\n *\n * Ensure you await this component's `updateComplete` promise before awaiting this\n * one, to ensure you do not await an obsolete promise from the previous update.\n */\n get initialSearchComplete(): Promise<boolean> {\n return this.dataSource.initialSearchComplete;\n }\n\n private async handleQueryChange() {\n // only reset if the query has actually changed\n if (\n !this.searchService ||\n this.dataSource.pageFetchQueryKey === this.previousQueryKey\n )\n return;\n\n // If the new state prevents us from updating the search results, don't reset\n if (\n !this.dataSource.canPerformSearch &&\n !(this.clearResultsOnEmptyQuery && this.baseQuery === '')\n )\n return;\n\n this.previousQueryKey = this.dataSource.pageFetchQueryKey;\n // this.emitQueryStateChanged();\n\n this.tileModelOffset = 0;\n this.totalResults = undefined;\n this.pagesToRender =\n this.initialPageNumber === 1\n ? 2 // First two pages are batched into one request when starting from page 1\n : this.initialPageNumber;\n\n // Reset the infinite scroller's item count, so that it\n // shows tile placeholders until the new query's results load in\n if (this.infiniteScroller) {\n this.infiniteScroller.itemCount = this.estimatedTileCount;\n this.infiniteScroller.reload();\n }\n\n if (this.withinCollection && this.baseQuery?.trim()) {\n this.defaultSortField = SortField.relevance;\n this.defaultSortDirection = null;\n }\n\n if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {\n this.scrollToPage(this.initialPageNumber);\n }\n this.initialQueryChangeHappened = true;\n\n // if the query changed as part of a window.history pop event, we don't want to\n // persist the state because it overwrites the forward history\n if (!this.historyPopOccurred) {\n this.persistState();\n }\n this.historyPopOccurred = false;\n\n // Fire the initial page and facets requests\n // await this.dataSource.handleQueryChange();\n }\n\n private setupStateRestorationObserver() {\n if (!this.boundNavigationHandler) {\n this.boundNavigationHandler = this.historyNavigationHandler.bind(this);\n }\n // when the user navigates back, we want to update the UI to match the URL\n window.addEventListener('popstate', this.boundNavigationHandler);\n }\n\n private boundNavigationHandler?: () => void;\n\n private historyNavigationHandler() {\n this.historyPopOccurred = true;\n this.restoreState();\n }\n\n private restoreState() {\n const restorationState = this.restorationStateHandler.getRestorationState();\n this.displayMode = restorationState.displayMode;\n if (restorationState.searchType != null)\n this.searchType = restorationState.searchType;\n this.selectedSort = restorationState.selectedSort ?? SortField.default;\n this.sortDirection = restorationState.sortDirection ?? null;\n this.selectedTitleFilter = restorationState.selectedTitleFilter ?? null;\n this.selectedCreatorFilter = restorationState.selectedCreatorFilter ?? null;\n this.selectedFacets = restorationState.selectedFacets;\n if (!this.suppressURLQuery) this.baseQuery = restorationState.baseQuery;\n this.currentPage = restorationState.currentPage ?? 1;\n this.minSelectedDate = restorationState.minSelectedDate;\n this.maxSelectedDate = restorationState.maxSelectedDate;\n if (this.currentPage > 1) {\n console.log(\n 'state restored w/ page number, going to page',\n this.currentPage\n );\n setTimeout(() => {\n this.goToPage(this.currentPage ?? 1);\n }, 100);\n }\n }\n\n private persistState() {\n const restorationState: RestorationState = {\n displayMode: this.displayMode,\n searchType: this.searchType,\n selectedSort: this.selectedSort,\n sortDirection: this.sortDirection ?? undefined,\n selectedFacets: this.selectedFacets ?? getDefaultSelectedFacets(),\n baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,\n currentPage: this.currentPage,\n titleQuery: this.titleQuery,\n creatorQuery: this.creatorQuery,\n minSelectedDate: this.minSelectedDate,\n maxSelectedDate: this.maxSelectedDate,\n selectedTitleFilter: this.selectedTitleFilter ?? undefined,\n selectedCreatorFilter: this.selectedCreatorFilter ?? undefined,\n };\n this.restorationStateHandler.persistState(\n restorationState,\n this.dataSourceInstallInProgress\n );\n }\n\n private emitSearchResultsLoadingChanged(): void {\n this.dispatchEvent(\n new CustomEvent<{ loading: boolean }>('searchResultsLoadingChanged', {\n detail: {\n loading: this.searchResultsLoading,\n },\n })\n );\n }\n\n facetsChanged(e: CustomEvent<SelectedFacets>) {\n this.selectedFacets = e.detail;\n }\n\n facetClickHandler({\n detail: { facetType, bucket, negative },\n }: CustomEvent<FacetEventDetails>): void {\n let action: analyticsActions;\n if (negative) {\n action =\n bucket.state !== 'none'\n ? analyticsActions.facetNegativeSelected\n : analyticsActions.facetNegativeDeselected;\n } else {\n action =\n bucket.state !== 'none'\n ? analyticsActions.facetSelected\n : analyticsActions.facetDeselected;\n }\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action,\n label: facetType,\n });\n }\n\n private scrollToPage(pageNumber: number): Promise<void> {\n console.log('scrolling to page', pageNumber);\n return new Promise(resolve => {\n const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);\n console.log('cell index', cellIndexToScrollTo);\n // without this setTimeout, Safari just pauses until the `fetchPage` is complete\n // then scrolls to the cell\n setTimeout(() => {\n console.log(\n 'requesting infinite scroller to scroll to cell',\n cellIndexToScrollTo\n );\n this.isScrollingToCell = true;\n const scrollResult = this.infiniteScroller?.scrollToCell(\n cellIndexToScrollTo,\n true\n );\n console.log('scroll result:', scrollResult);\n // This timeout is to give the scroll animation time to finish\n // then updating the infinite scroller once we're done scrolling\n // There's no scroll animation completion callback so we're\n // giving it 0.5s to finish.\n setTimeout(() => {\n console.log('marking scroll finished, refreshing visible cells');\n this.isScrollingToCell = false;\n this.infiniteScroller?.refreshAllVisibleCells();\n resolve();\n }, 750);\n }, 100);\n });\n }\n\n /**\n * Whether sorting by relevance makes sense for the current state.\n * Currently equivalent to having a non-empty query.\n */\n private get isRelevanceSortAvailable(): boolean {\n return !!this.baseQuery?.trim();\n }\n\n /**\n * Sets the total number of tiles displayed in the infinite scroller.\n */\n setTileCount(count: number): void {\n if (this.infiniteScroller) {\n this.infiniteScroller.itemCount = count;\n }\n }\n\n /**\n * Applies any default sort option for the current collection, by checking\n * for one in the collection's metadata. If none is found, defaults to sorting\n * descending by:\n * - Date Favorited for fav-* collections\n * - Weekly views for all other collections\n */\n applyDefaultCollectionSort(collectionInfo?: CollectionExtraInfo): void {\n if (this.baseQuery) {\n // If there's a query set, then we default to relevance sorting regardless of\n // the collection metadata-specified sort.\n this.defaultSortField = SortField.relevance;\n this.defaultSortDirection = null;\n return;\n }\n\n // Favorite collections sort on Date Favorited by default.\n // Other collections fall back to sorting on weekly views.\n const baseDefaultSort: string =\n collectionInfo?.public_metadata?.identifier?.startsWith('fav-')\n ? '-favoritedate'\n : '-week';\n\n // The collection metadata may override the default sorting with something else\n const metadataSort: string | undefined =\n collectionInfo?.public_metadata?.['sort-by'];\n\n // Prefer the metadata-specified sort if one exists\n const defaultSortToApply = metadataSort ?? baseDefaultSort;\n\n // Account for both -field and field:dir formats\n let [field, dir] = defaultSortToApply.split(':');\n if (field.startsWith('-')) {\n field = field.slice(1);\n dir = 'desc';\n } else if (!['asc', 'desc'].includes(dir)) {\n dir = 'asc';\n }\n\n const sortOption = sortOptionFromAPIString(field);\n const sortField = sortOption.field;\n if (sortField && sortField !== SortField.default) {\n this.defaultSortField = sortField;\n this.defaultSortDirection = dir as SortDirection;\n this.defaultSortParam = {\n field: this.defaultSortField,\n direction: this.defaultSortDirection,\n };\n }\n }\n\n /**\n * Applies the default sort option for the current profile element\n */\n applyDefaultProfileSort(): void {\n if (this.profileElement) {\n const defaultSortField = defaultProfileElementSorts[this.profileElement];\n this.defaultSortField = defaultSortField ?? SortField.weeklyview;\n } else {\n this.defaultSortField = SortField.weeklyview;\n }\n\n this.defaultSortDirection = 'desc';\n this.defaultSortParam = {\n field: this.defaultSortField,\n direction: this.defaultSortDirection,\n };\n }\n\n /**\n * This is useful for determining whether we need to reload the scroller.\n *\n * When the fetch completes, we need to reload the scroller if the cells for that\n * page are visible, but if the page is not currenlty visible, we don't need to reload\n */\n get currentVisiblePageNumbers(): number[] {\n const visibleCells = this.infiniteScroller?.getVisibleCellIndices() ?? [];\n const visiblePages = new Set<number>();\n visibleCells.forEach(cellIndex => {\n const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;\n visiblePages.add(visiblePage);\n });\n return Array.from(visiblePages);\n }\n\n /**\n * Refreshes all visible result cells in the infinite scroller.\n */\n refreshVisibleResults(): void {\n this.infiniteScroller?.refreshAllVisibleCells();\n }\n\n /**\n * Callback when a result is selected\n */\n resultSelected(event: CustomEvent<TileModel>): void {\n if (this.isManageView) {\n // Checked/unchecked state change -- rerender to ensure it propagates\n // this.mapDataSource(model => ({ ...model }));\n const cellIndex = this.dataSource.indexOf(event.detail);\n if (cellIndex >= 0) this.infiniteScroller?.refreshCell(cellIndex);\n\n this.requestUpdate();\n }\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.resultSelected,\n label: event.detail.mediatype,\n });\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.resultSelected,\n label: `page-${this.currentPage}`,\n });\n }\n\n cellForIndex(index: number): TemplateResult | undefined {\n const model = this.tileModelAtCellIndex(index);\n if (!model) return undefined;\n\n return html`\n <tile-dispatcher\n .collectionPagePath=${this.collectionPagePath}\n .baseNavigationUrl=${this.baseNavigationUrl}\n .baseImageUrl=${this.baseImageUrl}\n .model=${model}\n .tileDisplayMode=${this.displayMode}\n .resizeObserver=${this.resizeObserver}\n .collectionTitles=${this.dataSource.collectionTitles}\n .sortParam=${this.sortParam}\n .defaultSortParam=${this.defaultSortParam}\n .creatorFilter=${this.selectedCreatorFilter}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .loggedIn=${this.loggedIn}\n .isManageView=${this.isManageView}\n ?enableHoverPane=${true}\n @resultSelected=${(e: CustomEvent) => this.resultSelected(e)}\n >\n </tile-dispatcher>\n `;\n }\n\n /**\n * When the user scrolls near to the bottom of the page, fetch the next page\n * increase the number of pages to render and start fetching data for the new page\n */\n private scrollThresholdReached() {\n if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {\n this.pagesToRender += 1;\n this.dataSource.fetchPage(this.pagesToRender);\n }\n }\n\n static get styles() {\n return [\n srOnlyStyle,\n css`\n :host {\n display: block;\n --leftColumnWidth: 18rem;\n --leftColumnPaddingRight: 2.5rem;\n }\n\n #facet-top-view {\n display: flex;\n }\n\n /**\n * When page width resizes from desktop to mobile, use this class to\n * disable expand/collapse transition when loading.\n */\n .preload * {\n transition: none !important;\n -webkit-transition: none !important;\n -moz-transition: none !important;\n -ms-transition: none !important;\n -o-transition: none !important;\n }\n\n #content-container {\n display: flex;\n }\n\n empty-placeholder {\n margin-top: var(--placeholderMarginTop, 0);\n }\n\n .collapser-icon {\n display: inline-block;\n }\n\n .collapser-icon svg {\n display: inline-block;\n width: 12px;\n height: 12px;\n transition: transform 0.2s ease-out;\n }\n\n #mobile-filter-collapse {\n width: 100%;\n }\n\n #mobile-filter-collapse > summary {\n cursor: pointer;\n list-style: none;\n }\n\n #mobile-filter-collapse[open] > summary {\n margin-bottom: 10px;\n }\n\n #mobile-filter-collapse h2 {\n display: inline-block;\n margin: 0;\n font-size: 2rem;\n }\n\n #mobile-filter-collapse[open] svg {\n transform: rotate(90deg);\n }\n\n #content-container.mobile {\n display: block;\n }\n\n .column {\n padding-top: 2rem;\n }\n\n #right-column {\n flex: 1;\n position: relative;\n min-height: 90vh;\n border-left: 1px solid rgb(232, 232, 232);\n border-right: 1px solid rgb(232, 232, 232);\n padding-left: 1rem;\n padding-right: 1rem;\n margin-top: var(--rightColumnMarginTop, 0);\n background: #fff;\n }\n\n .mobile #right-column {\n border-left: none;\n padding: 5px 5px 0;\n }\n\n #left-column {\n width: var(--leftColumnWidth, 18rem);\n /* Prevents Safari from shrinking col at first draw */\n min-width: var(--leftColumnWidth, 18rem);\n /* Reduced padding by 0.2rem to add the invisible border in the rule below */\n padding-right: calc(var(--leftColumnPaddingRight, 2.5rem) - 0.2rem);\n border-right: 0.2rem solid transparent; /* Pads to the right of the scrollbar a bit */\n z-index: 1;\n }\n\n .desktop #left-column {\n top: 0;\n position: sticky;\n height: calc(100vh - 2rem);\n max-height: calc(100vh - 2rem);\n overflow-x: hidden;\n overflow-y: scroll;\n\n /*\n * Firefox doesn't support any of the -webkit-scrollbar stuff below, but\n * does at least give us a tiny bit of control over width & color.\n */\n scrollbar-width: thin;\n scrollbar-color: transparent transparent;\n }\n .desktop #left-column:hover {\n scrollbar-color: auto;\n }\n .desktop #left-column::-webkit-scrollbar {\n appearance: none;\n width: 6px;\n }\n .desktop #left-column::-webkit-scrollbar-button {\n height: 3px;\n background: transparent;\n }\n .desktop #left-column::-webkit-scrollbar-corner {\n background: transparent;\n }\n .desktop #left-column::-webkit-scrollbar-thumb {\n border-radius: 4px;\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, 0.15);\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb:hover {\n background: rgba(0, 0, 0, 0.2);\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb:active {\n background: rgba(0, 0, 0, 0.3);\n }\n\n #facets-bottom-fade {\n background: linear-gradient(\n to bottom,\n #f5f5f700 0%,\n #f5f5f7c0 50%,\n #f5f5f7 80%,\n #f5f5f7 100%\n );\n position: fixed;\n bottom: 0;\n height: 50px;\n /* Wide enough to cover the content, but leave the scrollbar uncovered */\n width: calc(\n var(--leftColumnWidth) + var(--leftColumnPaddingRight) - 10px\n );\n z-index: 2;\n pointer-events: none;\n transition: height 0.1s ease;\n }\n #facets-bottom-fade.hidden {\n height: 0;\n }\n\n .facets-message {\n font-size: 1.4rem;\n }\n\n .desktop #left-column-scroll-sentinel {\n width: 1px;\n height: 100vh;\n background: transparent;\n }\n\n .desktop #facets-scroll-sentinel {\n width: 1px;\n height: 1px;\n background: transparent;\n }\n\n #facets-header-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .desktop #facets-header-container {\n flex-wrap: wrap;\n }\n\n .mobile #left-column {\n width: 100%;\n min-width: 0;\n padding: 0;\n border: 0;\n }\n\n .clear-filters-btn-row {\n display: inline-block;\n }\n\n .desktop .clear-filters-btn-row {\n width: 100%;\n }\n\n .clear-filters-btn {\n display: inline-block;\n appearance: none;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n color: var(--ia-theme-link-color);\n font-size: 1.4rem;\n font-family: inherit;\n cursor: pointer;\n }\n\n .clear-filters-btn:hover {\n text-decoration: underline;\n }\n\n .clear-filters-btn-separator {\n display: inline-block;\n margin-left: 5px;\n border-left: 1px solid #2c2c2c;\n font-size: 1.4rem;\n line-height: 1.3rem;\n }\n\n #facets-container {\n position: relative;\n max-height: 0;\n transition: max-height 0.2s ease-in-out;\n z-index: 1;\n margin-top: 5rem;\n padding-bottom: 2rem;\n }\n\n .desktop #facets-container {\n width: 18rem;\n }\n\n .mobile #facets-container {\n overflow: hidden;\n padding-bottom: 0;\n padding-left: 10px;\n padding-right: 10px;\n }\n\n #facets-container.expanded {\n max-height: 2000px;\n }\n\n #results-total {\n display: flex;\n align-items: baseline;\n }\n\n .mobile #results-total {\n float: right;\n margin-bottom: 0;\n margin-right: 5px;\n }\n\n #big-results-count {\n font-size: 2.4rem;\n font-weight: 500;\n margin-right: 5px;\n }\n\n .mobile #big-results-count {\n font-size: 2rem;\n }\n\n #big-results-label {\n font-size: 1.4rem;\n font-weight: 200;\n }\n\n #list-header {\n max-height: 4.2rem;\n }\n\n .loading-cover {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n z-index: 1;\n padding-top: 50px;\n }\n\n circular-activity-indicator {\n width: 30px;\n height: 30px;\n }\n\n sort-filter-bar {\n display: block;\n margin-bottom: 4rem;\n }\n\n infinite-scroller {\n display: block;\n --infiniteScrollerRowGap: var(--collectionBrowserRowGap, 1.7rem);\n --infiniteScrollerColGap: var(--collectionBrowserColGap, 1.7rem);\n }\n\n infinite-scroller.list-compact {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 100%\n );\n --infiniteScrollerCellMinHeight: 45px; /* override infinite scroller component */\n --infiniteScrollerCellMaxHeight: 56px;\n --infiniteScrollerRowGap: 10px;\n }\n\n infinite-scroller.list-detail {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 100%\n );\n --infiniteScrollerCellMinHeight: var(\n --collectionBrowserCellMinHeight,\n 5rem\n );\n /*\n 30px in spec, compensating for a -4px margin\n to align title with top of item image\n src/tiles/list/tile-list.ts\n */\n --infiniteScrollerRowGap: 34px;\n }\n\n .mobile infinite-scroller.list-detail {\n --infiniteScrollerRowGap: 24px;\n }\n\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 17rem\n );\n --infiniteScrollerCellMaxWidth: var(\n --collectionBrowserCellMaxWidth,\n 1fr\n );\n }\n\n /* Allow tiles to shrink a bit further at smaller viewport widths */\n @media screen and (max-width: 880px) {\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 15rem\n );\n }\n }\n /* At very small widths, maintain a 2-tile layout as far as it can reasonably go */\n @media screen and (max-width: 360px) {\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 12rem\n );\n }\n }\n\n infinite-scroller.hidden {\n display: none;\n }\n `,\n ];\n }\n}\n"]}
1
+ {"version":3,"file":"collection-browser.js","sourceRoot":"","sources":["../../src/collection-browser.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,OAAO,EACL,IAAI,EACJ,GAAG,EACH,UAAU,EAGV,OAAO,GACR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,EAIL,UAAU,GAGX,MAAM,iCAAiC,CAAC;AAKzC,OAAO,oCAAoC,CAAC;AAI5C,OAAO,EAEL,SAAS,EAET,wBAAwB,EAIxB,uBAAuB,EACvB,YAAY,EACZ,0BAA0B,GAC3B,MAAM,UAAU,CAAC;AAClB,OAAO,EAEL,uBAAuB,GAExB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,2BAA2B,EAAE,MAAM,8CAA8C,CAAC;AAQ3F,OAAO,EACL,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,WAAW,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAA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AAE;8DAAqC;AAEpC;IAAR,KAAK,EAAE;uDAA+B;AAE9B;IAAR,KAAK,EAAE;2DACc;AAEb;IAAR,KAAK,EAAE;+DAA2D;AAE1D;IAAR,KAAK,EAAE;0DAAiD;AAE5B;IAA5B,KAAK,CAAC,oBAAoB,CAAC;2DAA2C;AAEhD;IAAtB,KAAK,CAAC,cAAc,CAAC;qDAAqC;AAE/B;IAA3B,KAAK,CAAC,mBAAmB,CAAC;2DAA6C;AAGxE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;2DACA;AAiE7C;IADC,KAAK,CAAC,mBAAmB,CAAC;2DACiB;AApRjC,iBAAiB;IAD7B,aAAa,CAAC,oBAAoB,CAAC;GACvB,iBAAiB,CA6lE7B;SA7lEY,iBAAiB","sourcesContent":["/* eslint-disable import/no-duplicates */\nimport {\n html,\n css,\n LitElement,\n PropertyValues,\n TemplateResult,\n nothing,\n} from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { msg } from '@lit/localize';\n\nimport type { AnalyticsManagerInterface } from '@internetarchive/analytics-manager';\nimport type {\n InfiniteScroller,\n InfiniteScrollerCellProviderInterface,\n} from '@internetarchive/infinite-scroller';\nimport {\n CollectionExtraInfo,\n PageElementName,\n SearchServiceInterface,\n SearchType,\n SortDirection,\n SortParam,\n} from '@internetarchive/search-service';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport '@internetarchive/infinite-scroller';\nimport type { ModalManagerInterface } from '@internetarchive/modal-manager';\nimport type { FeatureFeedbackServiceInterface } from '@internetarchive/feature-feedback';\nimport type { RecaptchaManagerInterface } from '@internetarchive/recaptcha-manager';\nimport {\n SelectedFacets,\n SortField,\n CollectionBrowserContext,\n getDefaultSelectedFacets,\n TileModel,\n CollectionDisplayMode,\n FacetEventDetails,\n sortOptionFromAPIString,\n SORT_OPTIONS,\n defaultProfileElementSorts,\n} from './models';\nimport {\n RestorationStateHandlerInterface,\n RestorationStateHandler,\n RestorationState,\n} from './restoration-state-handler';\nimport { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';\nimport type {\n CollectionBrowserQueryState,\n CollectionBrowserSearchInterface,\n} from './data-source/collection-browser-query-state';\nimport type { CollectionFacets } from './collection-facets';\nimport type { ManageableItem } from './manage/manage-bar';\nimport type { CollectionBrowserDataSourceInterface } from './data-source/collection-browser-data-source-interface';\nimport {\n analyticsActions,\n analyticsCategories,\n} from './utils/analytics-events';\nimport chevronIcon from './assets/img/icons/chevron';\nimport { srOnlyStyle } from './styles/sr-only';\nimport { sha1 } from './utils/sha1';\nimport { formatDate } from './utils/format-date';\nimport { log } from './utils/log';\nimport type { PlaceholderType } from './empty-placeholder';\n\nimport './empty-placeholder';\nimport './tiles/tile-dispatcher';\nimport './tiles/collection-browser-loading-tile';\nimport './sort-filter-bar/sort-filter-bar';\nimport './manage/manage-bar';\nimport './collection-facets';\nimport './circular-activity-indicator';\n\n@customElement('collection-browser')\nexport class CollectionBrowser\n extends LitElement\n implements\n InfiniteScrollerCellProviderInterface,\n SharedResizeObserverResizeHandlerInterface,\n CollectionBrowserSearchInterface\n{\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: String }) baseImageUrl: string = 'https://archive.org';\n\n @property({ type: Object }) searchService?: SearchServiceInterface;\n\n /**\n * Which backend should be targeted by searches (e.g., metadata or FTS)\n */\n @property({ type: String }) searchType: SearchType = SearchType.METADATA;\n\n /**\n * The identifier of the collection that searches should be performed within\n */\n @property({ type: String }) withinCollection?: string;\n\n /**\n * The identifier (e.g., @person) of the user whose profile is being searched within\n */\n @property({ type: String }) withinProfile?: string;\n\n /**\n * Which section of the profile page searches are for (e.g., uploads, reviews, ...)\n */\n @property({ type: String }) profileElement?: PageElementName;\n\n /**\n * The base query to use for all searches, updated to match the current user query.\n */\n @property({ type: String }) baseQuery?: string;\n\n /**\n * Which mode to display result tiles in (grid, extended list, or compact list)\n */\n @property({ type: String }) displayMode?: CollectionDisplayMode;\n\n @property({ type: Object }) defaultSortParam: SortParam | null = null;\n\n @property({ type: String }) selectedSort: SortField = SortField.default;\n\n @property({ type: String }) selectedTitleFilter: string | null = null;\n\n @property({ type: String }) selectedCreatorFilter: string | null = null;\n\n @property({ type: String }) sortDirection: SortDirection | null = null;\n\n @property({ type: Number }) pageSize = 50;\n\n @property({ type: Number }) currentPage?: number;\n\n @property({ type: String }) minSelectedDate?: string;\n\n @property({ type: String }) maxSelectedDate?: string;\n\n @property({ type: Object }) selectedFacets?: SelectedFacets;\n\n /**\n * Whether to show the date picker (above the facets)\n */\n @property({ type: Boolean }) showHistogramDatePicker = false;\n\n /**\n * Whether placeholder views should be suppressed. If true, searches that produce an\n * error or empty result set will simply show a blank results view instead of a placeholder.\n */\n @property({ type: Boolean }) suppressPlaceholders = false;\n\n /**\n * Whether the result count text should be suppressed.\n * If true, no \"X Results\" message will be shown.\n */\n @property({ type: Boolean }) suppressResultCount = false;\n\n /**\n * Whether the scrolling result view should be suppressed entirely.\n * If true, no infinite scroller (and thus no result tiles) will be rendered.\n */\n @property({ type: Boolean }) suppressResultTiles = false;\n\n /**\n * Whether to suppress persistence of the query to the URL.\n * If true, the `query` param will not be added to the URL or updated on query changes.\n */\n @property({ type: Boolean }) suppressURLQuery = false;\n\n /**\n * Whether to suppress the display of facets entirely.\n * If true, the facet sidebar content will be replaced by a message that facets are\n * temporarily unavailable.\n */\n @property({ type: Boolean }) suppressFacets = false;\n\n /**\n * Whether to suppress display of the sort bar.\n * If true, the entire sort bar (incl. display modes) will be omitted from rendering.\n */\n @property({ type: Boolean }) suppressSortBar = false;\n\n /**\n * Whether to suppress showing the display mode options in the sort bar.\n * If true, those options will be omitted (though the rest of the sort bar may still render).\n */\n @property({ type: Boolean }) suppressDisplayModes = false;\n\n /**\n * Whether facets should be lazy-loaded.\n * If false (default), facet data will be loaded eagerly along with search hits.\n * If true, facet data will only be requested once the facet pane actually becomes visible,\n * either by displaying in desktop mode or by the mobile facet dropdown being opened.\n */\n @property({ type: Boolean }) lazyLoadFacets = false;\n\n @property({ type: Boolean }) clearResultsOnEmptyQuery = false;\n\n @property({ type: String }) collectionPagePath: string = '/details/';\n\n /** describes where this component is being used */\n @property({ type: String, reflect: true }) searchContext: string =\n analyticsCategories.default;\n\n @property({ type: String }) pageContext: CollectionBrowserContext = 'search';\n\n @property({ type: Object })\n restorationStateHandler: RestorationStateHandlerInterface = new RestorationStateHandler(\n {\n context: this.pageContext,\n }\n );\n\n @property({ type: Number }) mobileBreakpoint = 600;\n\n @property({ type: Boolean }) loggedIn = false;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object }) modalManager?: ModalManagerInterface = undefined;\n\n @property({ type: Object })\n featureFeedbackService?: FeatureFeedbackServiceInterface;\n\n @property({ type: Object }) recaptchaManager?: RecaptchaManagerInterface;\n\n /**\n * If item management UI active\n */\n @property({ type: Boolean }) isManageView = false;\n\n @property({ type: String }) manageViewLabel = 'Select items to remove';\n\n /** Whether to replace the default sort options with a slot for customization (default: false) */\n @property({ type: Boolean }) enableSortOptionsSlot = false;\n\n /**\n * The results per page so we can paginate.\n *\n * This allows us to start in the middle of the search results and\n * fetch data before or after the current page. If we don't have a key\n * for the previous/next page, we'll fetch the next/previous page to populate it\n */\n @property({ type: Object }) dataSource: CollectionBrowserDataSourceInterface =\n new CollectionBrowserDataSource(this, this.pageSize);\n\n /**\n * The page that the consumer wants to load.\n */\n initialPageNumber = 1;\n\n /**\n * This the the number of pages that we want to show.\n *\n * The data isn't necessarily loaded for all of the pages, but this lets us\n * know how many cells we should render.\n */\n @state() private pagesToRender = this.initialPageNumber;\n\n /**\n * Whether the initial page fetch for a new query is currently in progress.\n */\n @state() private searchResultsLoading = false;\n\n @state() private facetsLoading = false;\n\n @state() private totalResults?: number;\n\n @state() private mobileView = false;\n\n @state() private mobileFacetsVisible = false;\n\n @state() private contentWidth?: number;\n\n @state() private defaultSortField: Exclude<SortField, SortField.default> =\n SortField.relevance;\n\n @state() private defaultSortDirection: SortDirection | null = null;\n\n @state() private placeholderType: PlaceholderType = null;\n\n @query('#content-container') private contentContainer!: HTMLDivElement;\n\n @query('#left-column') private leftColumn?: HTMLDivElement;\n\n @query('collection-facets') private collectionFacets?: CollectionFacets;\n\n @property({ type: Object, attribute: false })\n analyticsHandler?: AnalyticsManagerInterface;\n\n /** Whether layout size analytics have been sent already. */\n private layoutSizeAnalyticsSent = false;\n\n /**\n * When we're animated scrolling to the page, we don't want to fetch\n * all of the pages as it scrolls so this lets us know if we're scrolling\n */\n private isScrollingToCell = false;\n\n /**\n * When page width resizes from desktop to mobile, set true to\n * disable expand/collapse transition when loading.\n */\n private isResizeToMobile = false;\n\n /**\n * Flag indicating that a new data source is currently being installed.\n * During the install, any URL persistence operation should replace the current entry\n * instead of creating a new one.\n */\n private dataSourceInstallInProgress = false;\n\n private leftColIntersectionObserver?: IntersectionObserver;\n\n private facetsIntersectionObserver?: IntersectionObserver;\n\n private placeholderCellTemplate = html`<collection-browser-loading-tile></collection-browser-loading-tile>`;\n\n constructor() {\n super();\n this.addController(this.dataSource);\n }\n\n private tileModelAtCellIndex(index: number): TileModel | undefined {\n const model = this.dataSource.getTileModelAt(index);\n /**\n * If we encounter a model we don't have yet and we're not in the middle of an\n * automated scroll, fetch the page and just return undefined.\n * The datasource will be updated once the page is loaded and the cell will be rendered.\n *\n * We disable it during the automated scroll since we don't want to fetch pages for intervening cells the\n * user may never see.\n */\n if (!model && !this.isScrollingToCell && this.dataSource.queryInitialized) {\n const pageNumber = Math.floor(index / this.pageSize) + 1;\n this.dataSource.fetchPage(pageNumber);\n }\n return model;\n }\n\n // this is the total number of tiles we expect if\n // the data returned is a full page worth\n // this is useful for putting in placeholders for the expected number of tiles\n private get estimatedTileCount(): number {\n return this.pagesToRender * this.pageSize;\n }\n\n /**\n * How many tiles to offset the data source by, to account for any removed tiles.\n */\n private tileModelOffset = 0;\n\n @query('infinite-scroller')\n private infiniteScroller?: InfiniteScroller;\n\n private sessionIdGenPromise?: Promise<string>;\n\n /**\n * Returns a promise resolving to a unique string that persists for the current browser session.\n * Used in generating unique IDs for search requests, so that multiple requests coming from the\n * same browser session can be identified.\n */\n async getSessionId(): Promise<string> {\n try {\n const storedSessionId = sessionStorage?.getItem('cb-session');\n if (storedSessionId) {\n return storedSessionId;\n }\n\n // If we enter this method a second time while a first session ID is already being generated,\n // ensure we produce the same ID from both calls instead of generating another one.\n if (this.sessionIdGenPromise) {\n return this.sessionIdGenPromise;\n }\n\n this.sessionIdGenPromise = sha1(Math.random().toString());\n const newSessionId = await this.sessionIdGenPromise;\n\n sessionStorage?.setItem('cb-session', newSessionId);\n return newSessionId;\n } catch (err) {\n // Either we can't generate the hash or we're restricted from accessing sessionStorage\n return '';\n }\n }\n\n /**\n * Go to the given page of results\n *\n * @param pageNumber\n */\n goToPage(pageNumber: number) {\n this.initialPageNumber = pageNumber;\n this.pagesToRender = pageNumber;\n return this.scrollToPage(pageNumber);\n }\n\n /**\n * Sets the state for whether the initial set of search results is loading in.\n */\n setSearchResultsLoading(loading: boolean): void {\n this.searchResultsLoading = loading;\n }\n\n /**\n * Sets the state for whether facet data is loading in\n */\n setFacetsLoading(loading: boolean): void {\n this.facetsLoading = loading;\n }\n\n /**\n * Sets the total number of results to be displayed for the current search\n */\n setTotalResultCount(totalResults: number): void {\n this.totalResults = totalResults;\n }\n\n /**\n * Clears all selected/negated facets, date ranges, and letter filters.\n *\n * By default, the current sort field/direction are not cleared,\n * but this can be overridden by setting the `sort` option to `true`.\n *\n * Similarly, it is possible to finely control what is cleared by\n * setting any of the `facets`, `dateRange`, or `letterFilters` flags\n * in the options object.\n */\n clearFilters({\n facets = true,\n dateRange = true,\n letterFilters = true,\n sort = false,\n } = {}): void {\n // Don't bother clearing facets if none are checked, so that we don't\n // trigger unnecessary update cycles.\n if (facets && this.hasCheckedFacets) {\n this.selectedFacets = getDefaultSelectedFacets();\n }\n\n if (dateRange) {\n this.minSelectedDate = undefined;\n this.maxSelectedDate = undefined;\n }\n\n if (letterFilters) {\n this.selectedTitleFilter = null;\n this.selectedCreatorFilter = null;\n }\n\n if (sort) {\n this.sortDirection = null;\n this.selectedSort = SortField.default;\n }\n }\n\n /**\n * Returns true if the current value of `this.selectedFacets` contains\n * any facet buckets than have been selected or negated, or false otherwise.\n */\n private get hasCheckedFacets(): boolean {\n if (!this.selectedFacets) return false;\n\n for (const facetGroup of Object.values(this.selectedFacets)) {\n for (const bucket of Object.values(facetGroup)) {\n if (bucket.state !== 'none') return true;\n }\n }\n\n return false;\n }\n\n /**\n * Returns true if there are any currently selected/negated facet buckets,\n * any selected date range, or any selected letter filters. False otherwise.\n *\n * Ignores sorting options.\n */\n private get hasActiveFilters(): boolean {\n return !!(\n this.hasCheckedFacets ||\n this.minSelectedDate ||\n this.maxSelectedDate ||\n this.selectedTitleFilter ||\n this.selectedCreatorFilter\n );\n }\n\n render() {\n this.setPlaceholderType();\n return html`\n <div\n id=\"content-container\"\n class=${this.mobileView ? 'mobile' : 'desktop'}\n >\n ${this.placeholderType\n ? this.emptyPlaceholderTemplate\n : this.collectionBrowserTemplate}\n </div>\n `;\n }\n\n private setPlaceholderType() {\n const hasQuery = !!this.baseQuery?.trim();\n const isCollection = !!this.withinCollection;\n const isProfile = !!this.withinProfile;\n const noResults =\n !this.searchResultsLoading &&\n (this.dataSource.size === 0 || !this.searchService);\n\n this.placeholderType = null;\n if (this.suppressPlaceholders) return;\n\n if (!hasQuery && !isCollection && !isProfile) {\n this.placeholderType = 'empty-query';\n } else if (noResults) {\n // Within a collection, no query + no results means the collection simply has no viewable items.\n // Otherwise, we must have a user query that produced 0 results.\n this.placeholderType =\n !hasQuery && isCollection ? 'empty-collection' : 'no-results';\n }\n\n if (this.dataSource.queryErrorMessage) {\n this.placeholderType =\n !hasQuery && isCollection ? 'collection-error' : 'query-error';\n }\n }\n\n private get emptyPlaceholderTemplate() {\n return html`\n <empty-placeholder\n .placeholderType=${this.placeholderType}\n ?isMobileView=${this.mobileView}\n ?isCollection=${!!this.withinCollection}\n .detailMessage=${this.dataSource.queryErrorMessage ?? ''}\n .baseNavigationUrl=${this.baseNavigationUrl}\n ></empty-placeholder>\n `;\n }\n\n /**\n * Top-level template for rendering the left (facets) and right (results) columns.\n */\n private get collectionBrowserTemplate() {\n return html`\n <div id=\"left-column-scroll-sentinel\"></div>\n ${this.leftColumnTemplate} ${this.rightColumnTemplate}\n `;\n }\n\n /**\n * Template for either the mobile or desktop version of the left column, depending\n * on current component state.\n */\n private get leftColumnTemplate(): TemplateResult {\n if (this.mobileView) {\n return this.mobileLeftColumnTemplate;\n }\n return this.desktopLeftColumnTemplate;\n }\n\n /**\n * Template for the mobile version of the \"left column\" (which in this case, appears\n * *above* the search results rather than beside them), for rendering the\n * accordion-style facets.\n */\n private get mobileLeftColumnTemplate(): TemplateResult {\n return html`\n <div\n id=\"left-column\"\n class=\"column${this.isResizeToMobile ? ' preload' : ''}\"\n >\n ${this.facetTopViewSlot} ${this.resultsCountTemplate}\n <div id=\"facets-header-container\">${this.mobileFacetsTemplate}</div>\n </div>\n `;\n }\n\n /**\n * Template for the desktop version of the left column, displaying the facets sidebar.\n */\n private get desktopLeftColumnTemplate(): TemplateResult {\n return html`\n <div id=\"left-column\" class=\"column\">\n ${this.facetTopViewSlot}\n <div id=\"facets-header-container\">\n <h2 id=\"facets-header\" class=\"sr-only\">Filters</h2>\n ${this.resultsCountTemplate} ${this.clearFiltersBtnTemplate(false)}\n </div>\n <div id=\"facets-container\" aria-labelledby=\"facets-header\">\n ${this.facetsTemplate}\n <div id=\"facets-scroll-sentinel\"></div>\n </div>\n <div id=\"facets-bottom-fade\"></div>\n </div>\n `;\n }\n\n /**\n * Slot which is placed at top of the facets area for user-profile page\n * - mainly used to render userlists\n */\n private get facetTopViewSlot(): TemplateResult {\n return html`<div id=\"facet-top-view\">\n <slot name=\"facet-top-slot\"></slot>\n </div>`;\n }\n\n /**\n * Template for the \"X Results\" count at the top of the search results.\n * Changes to the \"Searching...\" label if the search results are still loading.\n */\n private get resultsCountTemplate(): TemplateResult | typeof nothing {\n if (this.suppressResultCount) return nothing;\n\n const shouldShowSearching =\n this.searchResultsLoading || this.totalResults === undefined;\n const resultsCount = this.totalResults?.toLocaleString();\n const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';\n\n return html`\n <div id=\"results-total\">\n <span id=\"big-results-count\">\n ${shouldShowSearching ? html`Searching&hellip;` : resultsCount}\n </span>\n <span id=\"big-results-label\">\n ${shouldShowSearching ? nothing : resultsLabel}\n </span>\n </div>\n `;\n }\n\n /**\n * Template for the right column of the collection browser, where the result\n * tiles and sort/filter bar are shown.\n */\n private get rightColumnTemplate(): TemplateResult {\n return html`\n <div id=\"right-column\" class=\"column\">\n <div id=\"cb-top-view\">\n <slot name=\"cb-top-slot\"></slot>\n </div>\n ${this.isManageView\n ? this.manageBarTemplate\n : this.sortFilterBarTemplate}\n <slot name=\"cb-results\"></slot>\n ${this.displayMode === `list-compact` && this.totalResults\n ? this.listHeaderTemplate\n : nothing}\n ${this.suppressResultTiles ? nothing : this.infiniteScrollerTemplate}\n </div>\n `;\n }\n\n private get infiniteScrollerTemplate() {\n return html`<infinite-scroller\n class=${this.infiniteScrollerClasses}\n itemCount=${this.placeholderType ? 0 : nothing}\n ariaLandmarkLabel=\"Search results\"\n .cellProvider=${this}\n .placeholderCellTemplate=${this.placeholderCellTemplate}\n @scrollThresholdReached=${this.scrollThresholdReached}\n @visibleCellsChanged=${this.visibleCellsChanged}\n >${this.displayMode === 'grid'\n ? html`<slot name=\"result-last-tile\" slot=\"result-last-tile\"></slot>`\n : nothing}\n </infinite-scroller>`;\n }\n\n private get infiniteScrollerClasses() {\n return classMap({\n [this.displayMode ?? '']: !!this.displayMode,\n hidden: !!this.placeholderType,\n });\n }\n\n private get sortFilterBarTemplate(): TemplateResult | typeof nothing {\n if (this.suppressSortBar) return nothing;\n\n return html`\n <sort-filter-bar\n .defaultSortField=${this.defaultSortField}\n .defaultSortDirection=${this.defaultSortDirection}\n .selectedSort=${this.selectedSort}\n .sortDirection=${this.sortDirection}\n .showRelevance=${this.isRelevanceSortAvailable}\n .showDateFavorited=${this.withinCollection?.startsWith('fav-')}\n .displayMode=${this.displayMode}\n .selectedTitleFilter=${this.selectedTitleFilter}\n .selectedCreatorFilter=${this.selectedCreatorFilter}\n .prefixFilterCountMap=${this.dataSource.prefixFilterCountMap}\n .resizeObserver=${this.resizeObserver}\n .enableSortOptionsSlot=${this.enableSortOptionsSlot}\n .suppressDisplayModes=${this.suppressDisplayModes}\n @sortChanged=${this.userChangedSort}\n @displayModeChanged=${this.displayModeChanged}\n @titleLetterChanged=${this.titleLetterSelected}\n @creatorLetterChanged=${this.creatorLetterSelected}\n >\n <slot name=\"sort-options-left\" slot=\"sort-options-left\"></slot>\n <slot name=\"sort-options\" slot=\"sort-options\"></slot>\n <slot name=\"sort-options-right\" slot=\"sort-options-right\"></slot>\n </sort-filter-bar>\n `;\n }\n\n private get manageBarTemplate(): TemplateResult {\n return html`\n <manage-bar\n .label=${this.manageViewLabel}\n showSelectAll\n showUnselectAll\n ?removeAllowed=${this.dataSource.checkedTileModels.length !== 0}\n @removeItems=${this.handleRemoveItems}\n @selectAll=${() => this.dataSource.checkAllTiles()}\n @unselectAll=${() => this.dataSource.uncheckAllTiles()}\n @cancel=${() => {\n this.isManageView = false;\n this.dataSource.uncheckAllTiles();\n }}\n ></manage-bar>\n `;\n }\n\n /**\n * Handler for when the user requests to remove all checked items via the manage bar.\n * Emits an `itemRemovalRequested` event with all checked tile models.\n */\n private handleRemoveItems(): void {\n this.dispatchEvent(\n new CustomEvent<{ items: ManageableItem[] }>('itemRemovalRequested', {\n detail: {\n items: this.dataSource.checkedTileModels.map(model => {\n const cloned = model.clone();\n cloned.dateStr = formatDate(model.datePublished, 'long');\n return cloned as ManageableItem;\n }),\n },\n })\n );\n }\n\n /**\n * Removes all tile models that are currently checked & adjusts the paging\n * of the data source to account for any new gaps in the data.\n */\n removeCheckedTiles(): void {\n this.dataSource.removeCheckedTiles();\n }\n\n private userChangedSort(\n e: CustomEvent<{\n selectedSort: SortField;\n sortDirection: SortDirection | null;\n }>\n ) {\n const { selectedSort, sortDirection } = e.detail;\n this.selectedSort = selectedSort;\n this.sortDirection = sortDirection;\n\n if ((this.currentPage ?? 1) > 1) {\n this.goToPage(1);\n }\n this.currentPage = 1;\n }\n\n private sendSortByAnalytics(prevSortDirection: SortDirection | null): void {\n const directionCleared = prevSortDirection && !this.sortDirection;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.sortBy,\n label: `${this.selectedSort}${\n this.sortDirection || directionCleared ? `-${this.sortDirection}` : ''\n }`,\n });\n }\n\n private selectedSortChanged(): void {\n // Lazy-load the alphabet counts for title/creator sort bar as needed\n this.dataSource.updatePrefixFiltersForCurrentSort();\n }\n\n get sortParam(): SortParam | null {\n const sortOption = SORT_OPTIONS[this.selectedSort];\n if (!sortOption?.handledBySearchService) {\n return null;\n }\n\n // If the sort option specified in the URL is unrecognized, we just use it as-is\n const urlSortParam = new URL(window.location.href).searchParams.get('sort');\n const sortField =\n sortOption.searchServiceKey ?? urlSortParam?.replace(/^-/, '');\n\n // If the sort direction is still null at this point, then we assume ascending\n // (i.e., it was unrecognized and had no directional flag)\n if (!this.sortDirection) this.sortDirection = 'asc';\n\n if (!sortField) return null;\n return { field: sortField, direction: this.sortDirection };\n }\n\n private displayModeChanged(\n e: CustomEvent<{ displayMode?: CollectionDisplayMode }>\n ): void {\n this.displayMode = e.detail.displayMode;\n\n if (this.displayMode) {\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.displayMode,\n label: this.displayMode,\n });\n }\n }\n\n /**\n * Returns a query clause identifying the currently selected title filter,\n * e.g., `firstTitle:X`.\n */\n private get titleQuery(): string | undefined {\n return this.selectedTitleFilter\n ? `firstTitle:${this.selectedTitleFilter}`\n : undefined;\n }\n\n /**\n * Returns a query clause identifying the currently selected creator filter,\n * e.g., `firstCreator:X`.\n */\n private get creatorQuery(): string | undefined {\n return this.selectedCreatorFilter\n ? `firstCreator:${this.selectedCreatorFilter}`\n : undefined;\n }\n\n /**\n * Send Analytics when sorting by title's first letter\n * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'\n */\n private sendFilterByTitleAnalytics(prevSelectedLetter: string | null): void {\n if (!prevSelectedLetter && !this.selectedTitleFilter) {\n return;\n }\n const cleared = prevSelectedLetter && !this.selectedTitleFilter;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.filterByTitle,\n label: cleared\n ? `clear-${prevSelectedLetter}`\n : `${prevSelectedLetter || 'start'}-${this.selectedTitleFilter}`,\n });\n }\n\n /**\n * Send Analytics when filtering by creator's first letter\n * labels: 'start-<ToLetter>' | 'clear-<FromLetter>' | '<FromLetter>-<ToLetter>'\n */\n private sendFilterByCreatorAnalytics(\n prevSelectedLetter: string | null\n ): void {\n if (!prevSelectedLetter && !this.selectedCreatorFilter) {\n return;\n }\n const cleared = prevSelectedLetter && !this.selectedCreatorFilter;\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.filterByCreator,\n label: cleared\n ? `clear-${prevSelectedLetter}`\n : `${prevSelectedLetter || 'start'}-${this.selectedCreatorFilter}`,\n });\n }\n\n /**\n * Handler for changes to which letter is selected in the title alphabet bar.\n */\n private titleLetterSelected(\n e: CustomEvent<{ selectedLetter: string | null }>\n ): void {\n this.selectedCreatorFilter = null;\n this.selectedTitleFilter = e.detail.selectedLetter;\n }\n\n /**\n * Handler for changes to which letter is selected in the creator alphabet bar.\n */\n private creatorLetterSelected(\n e: CustomEvent<{ selectedLetter: string | null }>\n ): void {\n this.selectedTitleFilter = null;\n this.selectedCreatorFilter = e.detail.selectedLetter;\n }\n\n /**\n * The full template for how the facets should be structured in mobile view,\n * including the collapsible container (with header) and the facets themselves.\n */\n private get mobileFacetsTemplate(): TemplateResult {\n const toggleFacetsVisible = (e: Event) => {\n this.isResizeToMobile = false;\n this.mobileFacetsVisible = !this.mobileFacetsVisible;\n\n const target = e.target as HTMLDetailsElement;\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.mobileFacetsToggled,\n label: target.open ? 'open' : 'closed',\n });\n };\n\n return html`\n <details id=\"mobile-filter-collapse\" @toggle=${toggleFacetsVisible}>\n <summary>\n <span class=\"collapser-icon\">${chevronIcon}</span>\n <h2>${msg('Filters')}</h2>\n ${this.clearFiltersBtnTemplate(true)}\n </summary>\n ${this.facetsTemplate}\n </details>\n `;\n }\n\n /**\n * The template for the facets component alone, without any surrounding wrappers.\n */\n private get facetsTemplate() {\n if (this.suppressFacets) {\n return html`\n <p class=\"facets-message\">\n ${msg('Facets are temporarily unavailable.')}\n </p>\n `;\n }\n\n return html`\n <collection-facets\n @facetsChanged=${this.facetsChanged}\n @histogramDateRangeUpdated=${this.histogramDateRangeUpdated}\n .collectionPagePath=${this.collectionPagePath}\n .parentCollections=${this.dataSource.parentCollections}\n .pageSpecifierParams=${this.dataSource.pageSpecifierParams}\n .searchService=${this.searchService}\n .featureFeedbackService=${this.featureFeedbackService}\n .recaptchaManager=${this.recaptchaManager}\n .resizeObserver=${this.resizeObserver}\n .searchType=${this.searchType}\n .aggregations=${this.dataSource.aggregations}\n .fullYearsHistogramAggregation=${this.dataSource\n .yearHistogramAggregation}\n .minSelectedDate=${this.minSelectedDate}\n .maxSelectedDate=${this.maxSelectedDate}\n .selectedFacets=${this.selectedFacets}\n .baseNavigationUrl=${this.baseNavigationUrl}\n .collectionTitles=${this.dataSource.collectionTitles}\n .showHistogramDatePicker=${this.showHistogramDatePicker}\n .allowExpandingDatePicker=${!this.mobileView}\n .contentWidth=${this.contentWidth}\n .query=${this.baseQuery}\n .filterMap=${this.dataSource.filterMap}\n .isManageView=${this.isManageView}\n .modalManager=${this.modalManager}\n ?collapsableFacets=${this.mobileView}\n ?facetsLoading=${this.facetsLoading}\n ?fullYearAggregationLoading=${this.facetsLoading}\n @facetClick=${this.facetClickHandler}\n .analyticsHandler=${this.analyticsHandler}\n >\n </collection-facets>\n `;\n }\n\n /**\n * The HTML template for the \"Clear all filters\" button, or `nothing` if no\n * filters are currently active.\n *\n * @param mobile Whether to style/shorten the button for mobile view\n */\n private clearFiltersBtnTemplate(\n mobile: boolean\n ): TemplateResult | typeof nothing {\n if (!this.hasActiveFilters) return nothing;\n\n const buttonClasses = classMap({\n 'clear-filters-btn': true,\n mobile,\n });\n\n const buttonText = mobile ? 'Clear all' : 'Clear all filters';\n\n return html`\n <div class=\"clear-filters-btn-row\">\n ${mobile\n ? html`<span class=\"clear-filters-btn-separator\">&nbsp;</span>`\n : nothing}\n <button class=${buttonClasses} @click=${this.clearFilters}>\n ${buttonText}\n </button>\n </div>\n `;\n }\n\n private get loadingTemplate() {\n return html`\n <div class=\"loading-cover\">\n <circular-activity-indicator></circular-activity-indicator>\n </div>\n `;\n }\n\n private get listHeaderTemplate() {\n return html`\n <div id=\"list-header\">\n <tile-dispatcher\n .tileDisplayMode=${'list-header'}\n .resizeObserver=${this.resizeObserver}\n .sortParam=${this.sortParam}\n .defaultSortParam=${this.defaultSortParam}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .loggedIn=${this.loggedIn}\n >\n </tile-dispatcher>\n </div>\n `;\n }\n\n private histogramDateRangeUpdated(\n e: CustomEvent<{\n minDate: string;\n maxDate: string;\n }>\n ) {\n const { minDate, maxDate } = e.detail;\n [this.minSelectedDate, this.maxSelectedDate] = [minDate, maxDate];\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.histogramChanged,\n label: this.dateRangeQueryClause,\n });\n }\n\n private get dateRangeQueryClause() {\n if (!this.minSelectedDate || !this.maxSelectedDate) {\n return undefined;\n }\n\n return `year:[${this.minSelectedDate} TO ${this.maxSelectedDate}]`;\n }\n\n /**\n * Emits an event indicating a change in whether the manage mode is shown.\n */\n private emitManageModeChangedEvent(): void {\n this.dispatchEvent(\n new CustomEvent<boolean>('manageModeChanged', {\n detail: this.isManageView,\n })\n );\n }\n\n async installDataSourceAndQueryState(\n dataSource: CollectionBrowserDataSourceInterface,\n queryState: CollectionBrowserQueryState\n ): Promise<void> {\n log('Installing data source & query state in CB:', dataSource, queryState);\n if (this.dataSource) this.removeController(this.dataSource);\n this.dataSource = dataSource;\n this.addController(this.dataSource);\n\n this.baseQuery = queryState.baseQuery;\n this.profileElement = queryState.profileElement;\n this.searchType = queryState.searchType;\n this.selectedFacets =\n queryState.selectedFacets ?? getDefaultSelectedFacets();\n this.minSelectedDate = queryState.minSelectedDate;\n this.maxSelectedDate = queryState.maxSelectedDate;\n this.selectedSort = queryState.selectedSort ?? SortField.default;\n this.sortDirection = queryState.sortDirection;\n this.selectedTitleFilter = queryState.selectedTitleFilter;\n this.selectedCreatorFilter = queryState.selectedCreatorFilter;\n\n // We set this flag during the update to prevent the URL state persistence\n // from creating an unwanted extra history entry.\n this.dataSourceInstallInProgress = true;\n this.requestUpdate();\n await this.updateComplete;\n this.dataSourceInstallInProgress = false;\n\n if (!this.searchResultsLoading) {\n this.setTotalResultCount(this.dataSource.totalResults);\n this.setTileCount(this.dataSource.size);\n }\n\n this.refreshVisibleResults();\n }\n\n firstUpdated(): void {\n this.restoreState();\n this.setInitialSize();\n }\n\n setInitialSize(): void {\n this.contentWidth = this.contentContainer.getBoundingClientRect().width;\n this.mobileView =\n this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;\n this.sendLayoutSizeAnalytics();\n }\n\n private sendLayoutSizeAnalytics(): void {\n if (this.analyticsHandler) {\n this.layoutSizeAnalyticsSent = true;\n this.analyticsHandler.sendEvent({\n category: this.searchContext,\n action: this.mobileView\n ? analyticsActions.loadMobileView\n : analyticsActions.loadDesktopView,\n });\n }\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('placeholderType') && this.placeholderType === null) {\n if (!this.leftColIntersectionObserver) {\n this.setupLeftColumnScrollListeners();\n }\n if (!this.facetsIntersectionObserver) {\n this.setupFacetsScrollListeners();\n }\n this.updateLeftColumnHeight();\n }\n\n if (changed.has('analyticsHandler') && !this.layoutSizeAnalyticsSent) {\n this.sendLayoutSizeAnalytics();\n }\n\n if (\n changed.has('displayMode') ||\n changed.has('baseNavigationUrl') ||\n changed.has('baseImageUrl') ||\n changed.has('loggedIn')\n ) {\n this.infiniteScroller?.reload();\n }\n\n if (\n changed.has('baseQuery') ||\n changed.has('searchType') ||\n changed.has('withinCollection')\n ) {\n // Unless this query/search type update is from the initial page load or the\n // result of hitting the back button,\n // we need to clear any existing filters since they may no longer be valid for\n // the new set of search results.\n if (!this.historyPopOccurred && this.initialQueryChangeHappened) {\n // Ordinarily, we leave the sort param unchanged between searches.\n // However, if we are changing the target collection itself, we want the sort cleared too,\n // since different collections may have different sorting options available.\n const shouldClearSort =\n changed.has('withinCollection') &&\n !changed.has('selectedSort') &&\n !changed.has('sortDirection');\n\n // Otherwise, only clear filters that haven't been simultaneously applied in this update\n this.clearFilters({\n sort: shouldClearSort,\n facets: !changed.has('selectedFacets'),\n dateRange: !(\n changed.has('minSelectedDate') || changed.has('maxSelectedDate')\n ),\n letterFilters: !(\n changed.has('selectedTitleFilter') ||\n changed.has('selectedCreatorFilter')\n ),\n });\n }\n }\n\n if (changed.has('profileElement')) {\n this.applyDefaultProfileSort();\n }\n\n if (changed.has('baseQuery')) {\n this.emitBaseQueryChanged();\n }\n if (changed.has('searchType')) {\n this.emitSearchTypeChanged();\n }\n\n if (changed.has('currentPage') || changed.has('displayMode')) {\n this.persistState();\n }\n\n if (\n changed.has('baseQuery') ||\n changed.has('minSelectedDate') ||\n changed.has('maxSelectedDate') ||\n changed.has('selectedFacets') ||\n changed.has('searchService') ||\n changed.has('withinCollection') ||\n changed.has('withinProfile') ||\n changed.has('profileElement')\n ) {\n this.dataSource.refreshLetterCounts();\n }\n\n if (changed.has('selectedSort') || changed.has('sortDirection')) {\n const prevSortDirection = changed.get('sortDirection') as SortDirection;\n this.sendSortByAnalytics(prevSortDirection);\n this.selectedSortChanged();\n }\n\n if (changed.has('selectedTitleFilter')) {\n this.sendFilterByTitleAnalytics(\n changed.get('selectedTitleFilter') as string\n );\n }\n if (changed.has('selectedCreatorFilter')) {\n this.sendFilterByCreatorAnalytics(\n changed.get('selectedCreatorFilter') as string\n );\n }\n\n // Facets are always visible in the desktop view.\n // But in the mobile view, their visibility state can be toggled by the user.\n // In either case, inform the data source so that it can determine whether/when to fetch facets.\n this.dataSource.handleFacetVisibilityChange(\n !this.mobileView || this.mobileFacetsVisible\n );\n\n if (\n changed.has('baseQuery') ||\n changed.has('searchType') ||\n changed.has('selectedTitleFilter') ||\n changed.has('selectedCreatorFilter') ||\n changed.has('minSelectedDate') ||\n changed.has('maxSelectedDate') ||\n changed.has('selectedSort') ||\n changed.has('sortDirection') ||\n changed.has('selectedFacets') ||\n changed.has('searchService') ||\n changed.has('withinCollection') ||\n changed.has('withinProfile') ||\n changed.has('profileElement')\n ) {\n this.handleQueryChange();\n }\n\n if (changed.has('searchResultsLoading')) {\n this.emitSearchResultsLoadingChanged();\n }\n\n if (\n changed.has('facetsLoading') &&\n this.facetsLoading &&\n this.collectionFacets\n ) {\n this.collectionFacets.moreLinksVisible =\n this.searchType !== SearchType.FULLTEXT;\n }\n\n if (changed.has('pagesToRender')) {\n if (!this.dataSource.endOfDataReached && this.infiniteScroller) {\n this.infiniteScroller.itemCount = this.estimatedTileCount;\n }\n }\n\n if (changed.has('isManageView')) {\n if (this.isManageView) this.displayMode = 'grid';\n this.infiniteScroller?.refreshAllVisibleCells();\n this.emitManageModeChangedEvent();\n }\n\n if (changed.has('resizeObserver')) {\n const oldObserver = changed.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n if (oldObserver) this.disconnectResizeObserver(oldObserver);\n this.setupResizeObserver();\n }\n }\n\n connectedCallback(): void {\n super.connectedCallback?.();\n this.setupStateRestorationObserver();\n this.setupResizeObserver();\n }\n\n disconnectedCallback(): void {\n if (this.resizeObserver) {\n this.disconnectResizeObserver(this.resizeObserver);\n }\n if (this.boundNavigationHandler) {\n window.removeEventListener('popstate', this.boundNavigationHandler);\n }\n\n this.leftColIntersectionObserver?.disconnect();\n this.facetsIntersectionObserver?.disconnect();\n window.removeEventListener('resize', this.updateLeftColumnHeight);\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n const previousView = this.mobileView;\n if (entry.target === this.contentContainer) {\n this.contentWidth = entry.contentRect.width;\n this.mobileView =\n this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;\n // If changing from desktop to mobile disable transition\n if (this.mobileView && !previousView) {\n this.isResizeToMobile = true;\n }\n }\n\n // Ensure the facet sidebar remains sized correctly\n this.updateLeftColumnHeight();\n }\n\n /**\n * Sets up listeners for events that may require updating the left column height.\n */\n private setupLeftColumnScrollListeners(): void {\n // We observe intersections between the left column's scroll sentinel and\n // the viewport, so that we can ensure the left column is always sized to\n // match the _available_ viewport height. This should generally be more\n // performant than listening to scroll events on the page or column.\n const leftColumnSentinel = this.shadowRoot?.querySelector(\n '#left-column-scroll-sentinel'\n );\n if (leftColumnSentinel) {\n this.leftColIntersectionObserver = new IntersectionObserver(\n this.updateLeftColumnHeight,\n {\n threshold: [...Array(101).keys()].map(n => n / 100), // Threshold every 1%\n }\n );\n this.leftColIntersectionObserver.observe(leftColumnSentinel);\n }\n\n // We also listen for window resize events, as they are not always captured\n // by the resize observer and can affect the desired height of the left column.\n window.addEventListener('resize', this.updateLeftColumnHeight);\n }\n\n /**\n * Sets up listeners to control whether the facet sidebar shows its bottom fade-out.\n * Note this uses a separate IntersectionObserver from the left column, because we\n * don't need granular intersection thresholds for this.\n */\n private setupFacetsScrollListeners(): void {\n const facetsSentinel = this.shadowRoot?.querySelector(\n '#facets-scroll-sentinel'\n );\n if (facetsSentinel) {\n this.facetsIntersectionObserver = new IntersectionObserver(\n this.updateFacetFadeOut\n );\n this.facetsIntersectionObserver.observe(facetsSentinel);\n }\n }\n\n /**\n * Updates the height of the left column according to its position on the page.\n * Arrow function ensures proper `this` binding.\n */\n private updateLeftColumnHeight = (): void => {\n if (this.mobileView) {\n this.leftColumn?.style?.removeProperty('height');\n } else {\n const clientTop = this.leftColumn?.getBoundingClientRect().top;\n this.leftColumn?.style?.setProperty(\n 'height',\n `${window.innerHeight - (clientTop ?? 0) - 3}px`\n );\n }\n };\n\n /**\n * Toggles whether the fade-out is visible at the bottom of the facets.\n * It should only be visible if the facets are not scrolled to the bottom.\n * Arrow function ensures proper `this` binding.\n */\n private updateFacetFadeOut = (entries: IntersectionObserverEntry[]): void => {\n const fadeElmt = this.shadowRoot?.getElementById('facets-bottom-fade');\n fadeElmt?.classList.toggle('hidden', entries?.[0]?.isIntersecting);\n };\n\n private emitBaseQueryChanged() {\n this.dispatchEvent(\n new CustomEvent<{ baseQuery?: string }>('baseQueryChanged', {\n detail: {\n baseQuery: this.baseQuery,\n },\n })\n );\n }\n\n private emitSearchTypeChanged() {\n this.dispatchEvent(\n new CustomEvent<SearchType>('searchTypeChanged', {\n detail: this.searchType,\n })\n );\n }\n\n emitQueryStateChanged() {\n this.dispatchEvent(\n new CustomEvent<CollectionBrowserQueryState>('queryStateChanged', {\n detail: {\n baseQuery: this.baseQuery,\n withinCollection: this.withinCollection,\n withinProfile: this.withinProfile,\n profileElement: this.profileElement,\n searchType: this.searchType,\n selectedFacets: this.selectedFacets,\n minSelectedDate: this.minSelectedDate,\n maxSelectedDate: this.maxSelectedDate,\n selectedSort: this.selectedSort,\n sortDirection: this.sortDirection,\n selectedTitleFilter: this.selectedTitleFilter,\n selectedCreatorFilter: this.selectedCreatorFilter,\n },\n })\n );\n }\n\n emitEmptyResults() {\n this.dispatchEvent(new Event('emptyResults'));\n }\n\n private disconnectResizeObserver(\n resizeObserver: SharedResizeObserverInterface\n ) {\n resizeObserver.removeObserver({\n target: this.contentContainer,\n handler: this,\n });\n }\n\n private setupResizeObserver() {\n if (!this.resizeObserver || !this.contentContainer) return;\n this.resizeObserver.addObserver({\n target: this.contentContainer,\n handler: this,\n });\n }\n\n /**\n * When the visible cells change from the infinite scroller, we want to emit\n * which page is currently visible so the consumer can update its UI or the URL\n *\n * @param e\n * @returns\n */\n private visibleCellsChanged(\n e: CustomEvent<{ visibleCellIndices: number[] }>\n ) {\n if (this.isScrollingToCell) return;\n const { visibleCellIndices } = e.detail;\n if (visibleCellIndices.length === 0) return;\n const lastVisibleCellIndex =\n visibleCellIndices[visibleCellIndices.length - 1];\n const lastVisibleCellPage =\n Math.floor(lastVisibleCellIndex / this.pageSize) + 1;\n if (this.currentPage !== lastVisibleCellPage) {\n this.currentPage = lastVisibleCellPage;\n }\n const event = new CustomEvent('visiblePageChanged', {\n detail: {\n pageNumber: lastVisibleCellPage,\n },\n });\n this.dispatchEvent(event);\n }\n\n // we only want to scroll on the very first query change\n // so this keeps track of whether we've already set the initial query\n private initialQueryChangeHappened = false;\n\n private historyPopOccurred = false;\n\n // this lets us store the query key so we know if it's actually changed or not\n private previousQueryKey?: string;\n\n /**\n * A Promise which, after each query change, resolves once the fetches for the initial\n * search have completed. Waits for *both* the hits and aggregations fetches to finish.\n *\n * Ensure you await this component's `updateComplete` promise before awaiting this\n * one, to ensure you do not await an obsolete promise from the previous update.\n */\n get initialSearchComplete(): Promise<boolean> {\n return this.dataSource.initialSearchComplete;\n }\n\n private async handleQueryChange() {\n // only reset if the query has actually changed\n if (\n !this.searchService ||\n this.dataSource.pageFetchQueryKey === this.previousQueryKey\n )\n return;\n\n // If the new state prevents us from updating the search results, don't reset\n if (\n !this.dataSource.canPerformSearch &&\n !(this.clearResultsOnEmptyQuery && this.baseQuery === '')\n )\n return;\n\n this.previousQueryKey = this.dataSource.pageFetchQueryKey;\n // this.emitQueryStateChanged();\n\n this.tileModelOffset = 0;\n this.totalResults = undefined;\n this.pagesToRender =\n this.initialPageNumber === 1\n ? 2 // First two pages are batched into one request when starting from page 1\n : this.initialPageNumber;\n\n // Reset the infinite scroller's item count, so that it\n // shows tile placeholders until the new query's results load in\n if (this.infiniteScroller) {\n this.infiniteScroller.itemCount = this.estimatedTileCount;\n this.infiniteScroller.reload();\n }\n\n if (this.withinCollection && this.baseQuery?.trim()) {\n this.defaultSortField = SortField.relevance;\n this.defaultSortDirection = null;\n }\n\n if (!this.initialQueryChangeHappened && this.initialPageNumber > 1) {\n this.scrollToPage(this.initialPageNumber);\n }\n this.initialQueryChangeHappened = true;\n\n // if the query changed as part of a window.history pop event, we don't want to\n // persist the state because it overwrites the forward history\n if (!this.historyPopOccurred) {\n this.persistState();\n }\n this.historyPopOccurred = false;\n\n // Fire the initial page and facets requests\n // await this.dataSource.handleQueryChange();\n }\n\n private setupStateRestorationObserver() {\n if (!this.boundNavigationHandler) {\n this.boundNavigationHandler = this.historyNavigationHandler.bind(this);\n }\n // when the user navigates back, we want to update the UI to match the URL\n window.addEventListener('popstate', this.boundNavigationHandler);\n }\n\n private boundNavigationHandler?: () => void;\n\n private historyNavigationHandler() {\n this.historyPopOccurred = true;\n this.restoreState();\n }\n\n private restoreState() {\n const restorationState = this.restorationStateHandler.getRestorationState();\n this.displayMode = restorationState.displayMode;\n if (restorationState.searchType != null)\n this.searchType = restorationState.searchType;\n this.selectedSort = restorationState.selectedSort ?? SortField.default;\n this.sortDirection = restorationState.sortDirection ?? null;\n this.selectedTitleFilter = restorationState.selectedTitleFilter ?? null;\n this.selectedCreatorFilter = restorationState.selectedCreatorFilter ?? null;\n this.selectedFacets = restorationState.selectedFacets;\n if (!this.suppressURLQuery) this.baseQuery = restorationState.baseQuery;\n this.currentPage = restorationState.currentPage ?? 1;\n this.minSelectedDate = restorationState.minSelectedDate;\n this.maxSelectedDate = restorationState.maxSelectedDate;\n if (this.currentPage > 1) {\n this.goToPage(this.currentPage);\n }\n }\n\n private persistState() {\n const restorationState: RestorationState = {\n displayMode: this.displayMode,\n searchType: this.searchType,\n selectedSort: this.selectedSort,\n sortDirection: this.sortDirection ?? undefined,\n selectedFacets: this.selectedFacets ?? getDefaultSelectedFacets(),\n baseQuery: this.suppressURLQuery ? undefined : this.baseQuery,\n currentPage: this.currentPage,\n titleQuery: this.titleQuery,\n creatorQuery: this.creatorQuery,\n minSelectedDate: this.minSelectedDate,\n maxSelectedDate: this.maxSelectedDate,\n selectedTitleFilter: this.selectedTitleFilter ?? undefined,\n selectedCreatorFilter: this.selectedCreatorFilter ?? undefined,\n };\n this.restorationStateHandler.persistState(\n restorationState,\n this.dataSourceInstallInProgress\n );\n }\n\n private emitSearchResultsLoadingChanged(): void {\n this.dispatchEvent(\n new CustomEvent<{ loading: boolean }>('searchResultsLoadingChanged', {\n detail: {\n loading: this.searchResultsLoading,\n },\n })\n );\n }\n\n facetsChanged(e: CustomEvent<SelectedFacets>) {\n this.selectedFacets = e.detail;\n }\n\n facetClickHandler({\n detail: { facetType, bucket, negative },\n }: CustomEvent<FacetEventDetails>): void {\n let action: analyticsActions;\n if (negative) {\n action =\n bucket.state !== 'none'\n ? analyticsActions.facetNegativeSelected\n : analyticsActions.facetNegativeDeselected;\n } else {\n action =\n bucket.state !== 'none'\n ? analyticsActions.facetSelected\n : analyticsActions.facetDeselected;\n }\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action,\n label: facetType,\n });\n }\n\n private scrollToPage(pageNumber: number): Promise<void> {\n return new Promise(resolve => {\n const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);\n // without this setTimeout, Safari just pauses until the `fetchPage` is complete\n // then scrolls to the cell\n setTimeout(() => {\n this.isScrollingToCell = true;\n this.infiniteScroller?.scrollToCell(cellIndexToScrollTo, true);\n // This timeout is to give the scroll animation time to finish\n // then updating the infinite scroller once we're done scrolling\n // There's no scroll animation completion callback so we're\n // giving it 0.5s to finish.\n setTimeout(() => {\n this.isScrollingToCell = false;\n this.infiniteScroller?.refreshAllVisibleCells();\n resolve();\n }, 500);\n }, 0);\n });\n }\n\n /**\n * Whether sorting by relevance makes sense for the current state.\n * Currently equivalent to having a non-empty query.\n */\n private get isRelevanceSortAvailable(): boolean {\n return !!this.baseQuery?.trim();\n }\n\n /**\n * Sets the total number of tiles displayed in the infinite scroller.\n */\n setTileCount(count: number): void {\n if (this.infiniteScroller) {\n this.infiniteScroller.itemCount = count;\n }\n }\n\n /**\n * Applies any default sort option for the current collection, by checking\n * for one in the collection's metadata. If none is found, defaults to sorting\n * descending by:\n * - Date Favorited for fav-* collections\n * - Weekly views for all other collections\n */\n applyDefaultCollectionSort(collectionInfo?: CollectionExtraInfo): void {\n if (this.baseQuery) {\n // If there's a query set, then we default to relevance sorting regardless of\n // the collection metadata-specified sort.\n this.defaultSortField = SortField.relevance;\n this.defaultSortDirection = null;\n return;\n }\n\n // Favorite collections sort on Date Favorited by default.\n // Other collections fall back to sorting on weekly views.\n const baseDefaultSort: string =\n collectionInfo?.public_metadata?.identifier?.startsWith('fav-')\n ? '-favoritedate'\n : '-week';\n\n // The collection metadata may override the default sorting with something else\n const metadataSort: string | undefined =\n collectionInfo?.public_metadata?.['sort-by'];\n\n // Prefer the metadata-specified sort if one exists\n const defaultSortToApply = metadataSort ?? baseDefaultSort;\n\n // Account for both -field and field:dir formats\n let [field, dir] = defaultSortToApply.split(':');\n if (field.startsWith('-')) {\n field = field.slice(1);\n dir = 'desc';\n } else if (!['asc', 'desc'].includes(dir)) {\n dir = 'asc';\n }\n\n const sortOption = sortOptionFromAPIString(field);\n const sortField = sortOption.field;\n if (sortField && sortField !== SortField.default) {\n this.defaultSortField = sortField;\n this.defaultSortDirection = dir as SortDirection;\n this.defaultSortParam = {\n field: this.defaultSortField,\n direction: this.defaultSortDirection,\n };\n }\n }\n\n /**\n * Applies the default sort option for the current profile element\n */\n applyDefaultProfileSort(): void {\n if (this.profileElement) {\n const defaultSortField = defaultProfileElementSorts[this.profileElement];\n this.defaultSortField = defaultSortField ?? SortField.weeklyview;\n } else {\n this.defaultSortField = SortField.weeklyview;\n }\n\n this.defaultSortDirection = 'desc';\n this.defaultSortParam = {\n field: this.defaultSortField,\n direction: this.defaultSortDirection,\n };\n }\n\n /**\n * This is useful for determining whether we need to reload the scroller.\n *\n * When the fetch completes, we need to reload the scroller if the cells for that\n * page are visible, but if the page is not currenlty visible, we don't need to reload\n */\n get currentVisiblePageNumbers(): number[] {\n const visibleCells = this.infiniteScroller?.getVisibleCellIndices() ?? [];\n const visiblePages = new Set<number>();\n visibleCells.forEach(cellIndex => {\n const visiblePage = Math.floor(cellIndex / this.pageSize) + 1;\n visiblePages.add(visiblePage);\n });\n return Array.from(visiblePages);\n }\n\n /**\n * Refreshes all visible result cells in the infinite scroller.\n */\n refreshVisibleResults(): void {\n this.infiniteScroller?.refreshAllVisibleCells();\n }\n\n /**\n * Callback when a result is selected\n */\n resultSelected(event: CustomEvent<TileModel>): void {\n if (this.isManageView) {\n // Checked/unchecked state change -- rerender to ensure it propagates\n // this.mapDataSource(model => ({ ...model }));\n const cellIndex = this.dataSource.indexOf(event.detail);\n if (cellIndex >= 0) this.infiniteScroller?.refreshCell(cellIndex);\n\n this.requestUpdate();\n }\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.resultSelected,\n label: event.detail.mediatype,\n });\n\n this.analyticsHandler?.sendEvent({\n category: this.searchContext,\n action: analyticsActions.resultSelected,\n label: `page-${this.currentPage}`,\n });\n }\n\n cellForIndex(index: number): TemplateResult | undefined {\n const model = this.tileModelAtCellIndex(index);\n if (!model) return undefined;\n\n return html`\n <tile-dispatcher\n .collectionPagePath=${this.collectionPagePath}\n .baseNavigationUrl=${this.baseNavigationUrl}\n .baseImageUrl=${this.baseImageUrl}\n .model=${model}\n .tileDisplayMode=${this.displayMode}\n .resizeObserver=${this.resizeObserver}\n .collectionTitles=${this.dataSource.collectionTitles}\n .sortParam=${this.sortParam}\n .defaultSortParam=${this.defaultSortParam}\n .creatorFilter=${this.selectedCreatorFilter}\n .mobileBreakpoint=${this.mobileBreakpoint}\n .loggedIn=${this.loggedIn}\n .isManageView=${this.isManageView}\n ?enableHoverPane=${true}\n @resultSelected=${(e: CustomEvent) => this.resultSelected(e)}\n >\n </tile-dispatcher>\n `;\n }\n\n /**\n * When the user scrolls near to the bottom of the page, fetch the next page\n * increase the number of pages to render and start fetching data for the new page\n */\n private scrollThresholdReached() {\n if (!this.dataSource.endOfDataReached && this.dataSource.queryInitialized) {\n this.pagesToRender += 1;\n this.dataSource.fetchPage(this.pagesToRender);\n }\n }\n\n static get styles() {\n return [\n srOnlyStyle,\n css`\n :host {\n display: block;\n --leftColumnWidth: 18rem;\n --leftColumnPaddingRight: 2.5rem;\n }\n\n #facet-top-view {\n display: flex;\n }\n\n /**\n * When page width resizes from desktop to mobile, use this class to\n * disable expand/collapse transition when loading.\n */\n .preload * {\n transition: none !important;\n -webkit-transition: none !important;\n -moz-transition: none !important;\n -ms-transition: none !important;\n -o-transition: none !important;\n }\n\n #content-container {\n display: flex;\n }\n\n empty-placeholder {\n margin-top: var(--placeholderMarginTop, 0);\n }\n\n .collapser-icon {\n display: inline-block;\n }\n\n .collapser-icon svg {\n display: inline-block;\n width: 12px;\n height: 12px;\n transition: transform 0.2s ease-out;\n }\n\n #mobile-filter-collapse {\n width: 100%;\n }\n\n #mobile-filter-collapse > summary {\n cursor: pointer;\n list-style: none;\n }\n\n #mobile-filter-collapse[open] > summary {\n margin-bottom: 10px;\n }\n\n #mobile-filter-collapse h2 {\n display: inline-block;\n margin: 0;\n font-size: 2rem;\n }\n\n #mobile-filter-collapse[open] svg {\n transform: rotate(90deg);\n }\n\n #content-container.mobile {\n display: block;\n }\n\n .column {\n padding-top: 2rem;\n }\n\n #right-column {\n flex: 1;\n position: relative;\n min-height: 90vh;\n border-left: 1px solid rgb(232, 232, 232);\n border-right: 1px solid rgb(232, 232, 232);\n padding-left: 1rem;\n padding-right: 1rem;\n margin-top: var(--rightColumnMarginTop, 0);\n background: #fff;\n }\n\n .mobile #right-column {\n border-left: none;\n padding: 5px 5px 0;\n }\n\n #left-column {\n width: var(--leftColumnWidth, 18rem);\n /* Prevents Safari from shrinking col at first draw */\n min-width: var(--leftColumnWidth, 18rem);\n /* Reduced padding by 0.2rem to add the invisible border in the rule below */\n padding-right: calc(var(--leftColumnPaddingRight, 2.5rem) - 0.2rem);\n border-right: 0.2rem solid transparent; /* Pads to the right of the scrollbar a bit */\n z-index: 1;\n }\n\n .desktop #left-column {\n top: 0;\n position: sticky;\n height: calc(100vh - 2rem);\n max-height: calc(100vh - 2rem);\n overflow-x: hidden;\n overflow-y: scroll;\n\n /*\n * Firefox doesn't support any of the -webkit-scrollbar stuff below, but\n * does at least give us a tiny bit of control over width & color.\n */\n scrollbar-width: thin;\n scrollbar-color: transparent transparent;\n }\n .desktop #left-column:hover {\n scrollbar-color: auto;\n }\n .desktop #left-column::-webkit-scrollbar {\n appearance: none;\n width: 6px;\n }\n .desktop #left-column::-webkit-scrollbar-button {\n height: 3px;\n background: transparent;\n }\n .desktop #left-column::-webkit-scrollbar-corner {\n background: transparent;\n }\n .desktop #left-column::-webkit-scrollbar-thumb {\n border-radius: 4px;\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb {\n background: rgba(0, 0, 0, 0.15);\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb:hover {\n background: rgba(0, 0, 0, 0.2);\n }\n .desktop #left-column:hover::-webkit-scrollbar-thumb:active {\n background: rgba(0, 0, 0, 0.3);\n }\n\n #facets-bottom-fade {\n background: linear-gradient(\n to bottom,\n #f5f5f700 0%,\n #f5f5f7c0 50%,\n #f5f5f7 80%,\n #f5f5f7 100%\n );\n position: fixed;\n bottom: 0;\n height: 50px;\n /* Wide enough to cover the content, but leave the scrollbar uncovered */\n width: calc(\n var(--leftColumnWidth) + var(--leftColumnPaddingRight) - 10px\n );\n z-index: 2;\n pointer-events: none;\n transition: height 0.1s ease;\n }\n #facets-bottom-fade.hidden {\n height: 0;\n }\n\n .facets-message {\n font-size: 1.4rem;\n }\n\n .desktop #left-column-scroll-sentinel {\n width: 1px;\n height: 100vh;\n background: transparent;\n }\n\n .desktop #facets-scroll-sentinel {\n width: 1px;\n height: 1px;\n background: transparent;\n }\n\n #facets-header-container {\n display: flex;\n justify-content: space-between;\n align-items: flex-start;\n }\n\n .desktop #facets-header-container {\n flex-wrap: wrap;\n }\n\n .mobile #left-column {\n width: 100%;\n min-width: 0;\n padding: 0;\n border: 0;\n }\n\n .clear-filters-btn-row {\n display: inline-block;\n }\n\n .desktop .clear-filters-btn-row {\n width: 100%;\n }\n\n .clear-filters-btn {\n display: inline-block;\n appearance: none;\n margin: 0;\n padding: 0;\n border: 0;\n background: none;\n color: var(--ia-theme-link-color);\n font-size: 1.4rem;\n font-family: inherit;\n cursor: pointer;\n }\n\n .clear-filters-btn:hover {\n text-decoration: underline;\n }\n\n .clear-filters-btn-separator {\n display: inline-block;\n margin-left: 5px;\n border-left: 1px solid #2c2c2c;\n font-size: 1.4rem;\n line-height: 1.3rem;\n }\n\n #facets-container {\n position: relative;\n max-height: 0;\n transition: max-height 0.2s ease-in-out;\n z-index: 1;\n margin-top: 5rem;\n padding-bottom: 2rem;\n }\n\n .desktop #facets-container {\n width: 18rem;\n }\n\n .mobile #facets-container {\n overflow: hidden;\n padding-bottom: 0;\n padding-left: 10px;\n padding-right: 10px;\n }\n\n #facets-container.expanded {\n max-height: 2000px;\n }\n\n #results-total {\n display: flex;\n align-items: baseline;\n }\n\n .mobile #results-total {\n float: right;\n margin-bottom: 0;\n margin-right: 5px;\n }\n\n #big-results-count {\n font-size: 2.4rem;\n font-weight: 500;\n margin-right: 5px;\n }\n\n .mobile #big-results-count {\n font-size: 2rem;\n }\n\n #big-results-label {\n font-size: 1.4rem;\n font-weight: 200;\n }\n\n #list-header {\n max-height: 4.2rem;\n }\n\n .loading-cover {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: flex;\n justify-content: center;\n z-index: 1;\n padding-top: 50px;\n }\n\n circular-activity-indicator {\n width: 30px;\n height: 30px;\n }\n\n sort-filter-bar {\n display: block;\n margin-bottom: 4rem;\n }\n\n infinite-scroller {\n display: block;\n --infiniteScrollerRowGap: var(--collectionBrowserRowGap, 1.7rem);\n --infiniteScrollerColGap: var(--collectionBrowserColGap, 1.7rem);\n }\n\n infinite-scroller.list-compact {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 100%\n );\n --infiniteScrollerCellMinHeight: 45px; /* override infinite scroller component */\n --infiniteScrollerCellMaxHeight: 56px;\n --infiniteScrollerRowGap: 10px;\n }\n\n infinite-scroller.list-detail {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 100%\n );\n --infiniteScrollerCellMinHeight: var(\n --collectionBrowserCellMinHeight,\n 5rem\n );\n /*\n 30px in spec, compensating for a -4px margin\n to align title with top of item image\n src/tiles/list/tile-list.ts\n */\n --infiniteScrollerRowGap: 34px;\n }\n\n .mobile infinite-scroller.list-detail {\n --infiniteScrollerRowGap: 24px;\n }\n\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 17rem\n );\n --infiniteScrollerCellMaxWidth: var(\n --collectionBrowserCellMaxWidth,\n 1fr\n );\n }\n\n /* Allow tiles to shrink a bit further at smaller viewport widths */\n @media screen and (max-width: 880px) {\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 15rem\n );\n }\n }\n /* At very small widths, maintain a 2-tile layout as far as it can reasonably go */\n @media screen and (max-width: 360px) {\n infinite-scroller.grid {\n --infiniteScrollerCellMinWidth: var(\n --collectionBrowserCellMinWidth,\n 12rem\n );\n }\n }\n\n infinite-scroller.hidden {\n display: none;\n }\n `,\n ];\n }\n}\n"]}
@@ -9,6 +9,8 @@ export declare enum analyticsActions {
9
9
  filterByCreator = "filterByCreator",
10
10
  filterByTitle = "filterByTitle",
11
11
  displayMode = "displayMode",
12
+ loadDesktopView = "loadDesktopView",
13
+ loadMobileView = "loadMobileView",
12
14
  facetSelected = "facetSelected",
13
15
  facetDeselected = "facetDeselected",
14
16
  facetNegativeSelected = "facetNegativeSelected",
@@ -11,6 +11,8 @@ export var analyticsActions;
11
11
  analyticsActions["filterByCreator"] = "filterByCreator";
12
12
  analyticsActions["filterByTitle"] = "filterByTitle";
13
13
  analyticsActions["displayMode"] = "displayMode";
14
+ analyticsActions["loadDesktopView"] = "loadDesktopView";
15
+ analyticsActions["loadMobileView"] = "loadMobileView";
14
16
  analyticsActions["facetSelected"] = "facetSelected";
15
17
  analyticsActions["facetDeselected"] = "facetDeselected";
16
18
  analyticsActions["facetNegativeSelected"] = "facetNegativeSelected";
@@ -1 +1 @@
1
- {"version":3,"file":"analytics-events.js","sourceRoot":"","sources":["../../../src/utils/analytics-events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAEX;AAFD,WAAY,mBAAmB;IAC7B,qDAA8B,CAAA;AAChC,CAAC,EAFW,mBAAmB,KAAnB,mBAAmB,QAE9B;AAED,MAAM,CAAN,IAAY,gBAmBX;AAnBD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,uDAAmC,CAAA;IACnC,mDAA+B,CAAA;IAC/B,+CAA2B,CAAA;IAC3B,mDAA+B,CAAA;IAC/B,uDAAmC,CAAA;IACnC,mEAA+C,CAAA;IAC/C,uEAAmD,CAAA;IACnD,+DAA2C,CAAA;IAC3C,uEAAmD,CAAA;IACnD,yDAAqC,CAAA;IACrC,2EAAuD,CAAA;IACvD,2DAAuC,CAAA;IACvC,qDAAiC,CAAA;IACjC,iEAA6C,CAAA;IAC7C,+DAA2C,CAAA;IAC3C,iEAA6C,CAAA;IAC7C,iEAA6C,CAAA;AAC/C,CAAC,EAnBW,gBAAgB,KAAhB,gBAAgB,QAmB3B","sourcesContent":["/**\n * Analytics categories and events. Used when building actions in\n */\nexport enum analyticsCategories {\n default = 'collection-browser',\n}\n\nexport enum analyticsActions {\n sortBy = 'sortBy',\n filterByCreator = 'filterByCreator',\n filterByTitle = 'filterByTitle',\n displayMode = 'displayMode',\n facetSelected = 'facetSelected',\n facetDeselected = 'facetDeselected',\n facetNegativeSelected = 'facetNegativeSelected',\n facetNegativeDeselected = 'facetNegativeDeselected',\n mobileFacetsToggled = 'mobileFacetsToggled',\n partOfCollectionClicked = 'partOfCollectionClicked',\n histogramChanged = 'histogramChanged',\n histogramChangedFromModal = 'histogramChangedFromModal',\n histogramExpanded = 'histogramExpanded',\n resultSelected = 'resultSelected',\n moreFacetsPageChange = 'moreFacetsPageChange',\n showMoreFacetsModal = 'showMoreFacetsModal',\n closeMoreFacetsModal = 'closeMoreFacetsModal',\n applyMoreFacetsModal = 'applyMoreFacetsModal',\n}\n"]}
1
+ {"version":3,"file":"analytics-events.js","sourceRoot":"","sources":["../../../src/utils/analytics-events.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAN,IAAY,mBAEX;AAFD,WAAY,mBAAmB;IAC7B,qDAA8B,CAAA;AAChC,CAAC,EAFW,mBAAmB,KAAnB,mBAAmB,QAE9B;AAED,MAAM,CAAN,IAAY,gBAqBX;AArBD,WAAY,gBAAgB;IAC1B,qCAAiB,CAAA;IACjB,uDAAmC,CAAA;IACnC,mDAA+B,CAAA;IAC/B,+CAA2B,CAAA;IAC3B,uDAAmC,CAAA;IACnC,qDAAiC,CAAA;IACjC,mDAA+B,CAAA;IAC/B,uDAAmC,CAAA;IACnC,mEAA+C,CAAA;IAC/C,uEAAmD,CAAA;IACnD,+DAA2C,CAAA;IAC3C,uEAAmD,CAAA;IACnD,yDAAqC,CAAA;IACrC,2EAAuD,CAAA;IACvD,2DAAuC,CAAA;IACvC,qDAAiC,CAAA;IACjC,iEAA6C,CAAA;IAC7C,+DAA2C,CAAA;IAC3C,iEAA6C,CAAA;IAC7C,iEAA6C,CAAA;AAC/C,CAAC,EArBW,gBAAgB,KAAhB,gBAAgB,QAqB3B","sourcesContent":["/**\n * Analytics categories and events. Used when building actions in\n */\nexport enum analyticsCategories {\n default = 'collection-browser',\n}\n\nexport enum analyticsActions {\n sortBy = 'sortBy',\n filterByCreator = 'filterByCreator',\n filterByTitle = 'filterByTitle',\n displayMode = 'displayMode',\n loadDesktopView = 'loadDesktopView',\n loadMobileView = 'loadMobileView',\n facetSelected = 'facetSelected',\n facetDeselected = 'facetDeselected',\n facetNegativeSelected = 'facetNegativeSelected',\n facetNegativeDeselected = 'facetNegativeDeselected',\n mobileFacetsToggled = 'mobileFacetsToggled',\n partOfCollectionClicked = 'partOfCollectionClicked',\n histogramChanged = 'histogramChanged',\n histogramChangedFromModal = 'histogramChangedFromModal',\n histogramExpanded = 'histogramExpanded',\n resultSelected = 'resultSelected',\n moreFacetsPageChange = 'moreFacetsPageChange',\n showMoreFacetsModal = 'showMoreFacetsModal',\n closeMoreFacetsModal = 'closeMoreFacetsModal',\n applyMoreFacetsModal = 'applyMoreFacetsModal',\n}\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "2.2.1-alpha.3",
6
+ "version": "2.2.2-alpha.0",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -290,6 +290,9 @@ export class CollectionBrowser
290
290
  @property({ type: Object, attribute: false })
291
291
  analyticsHandler?: AnalyticsManagerInterface;
292
292
 
293
+ /** Whether layout size analytics have been sent already. */
294
+ private layoutSizeAnalyticsSent = false;
295
+
293
296
  /**
294
297
  * When we're animated scrolling to the page, we don't want to fetch
295
298
  * all of the pages as it scrolls so this lets us know if we're scrolling
@@ -389,7 +392,6 @@ export class CollectionBrowser
389
392
  * @param pageNumber
390
393
  */
391
394
  goToPage(pageNumber: number) {
392
- console.log('goToPage', pageNumber);
393
395
  this.initialPageNumber = pageNumber;
394
396
  this.pagesToRender = pageNumber;
395
397
  return this.scrollToPage(pageNumber);
@@ -1106,6 +1108,19 @@ export class CollectionBrowser
1106
1108
  this.contentWidth = this.contentContainer.getBoundingClientRect().width;
1107
1109
  this.mobileView =
1108
1110
  this.contentWidth > 0 && this.contentWidth < this.mobileBreakpoint;
1111
+ this.sendLayoutSizeAnalytics();
1112
+ }
1113
+
1114
+ private sendLayoutSizeAnalytics(): void {
1115
+ if (this.analyticsHandler) {
1116
+ this.layoutSizeAnalyticsSent = true;
1117
+ this.analyticsHandler.sendEvent({
1118
+ category: this.searchContext,
1119
+ action: this.mobileView
1120
+ ? analyticsActions.loadMobileView
1121
+ : analyticsActions.loadDesktopView,
1122
+ });
1123
+ }
1109
1124
  }
1110
1125
 
1111
1126
  updated(changed: PropertyValues) {
@@ -1119,6 +1134,10 @@ export class CollectionBrowser
1119
1134
  this.updateLeftColumnHeight();
1120
1135
  }
1121
1136
 
1137
+ if (changed.has('analyticsHandler') && !this.layoutSizeAnalyticsSent) {
1138
+ this.sendLayoutSizeAnalytics();
1139
+ }
1140
+
1122
1141
  if (
1123
1142
  changed.has('displayMode') ||
1124
1143
  changed.has('baseNavigationUrl') ||
@@ -1439,7 +1458,6 @@ export class CollectionBrowser
1439
1458
  private visibleCellsChanged(
1440
1459
  e: CustomEvent<{ visibleCellIndices: number[] }>
1441
1460
  ) {
1442
- console.log('visible cells changed', this.isScrollingToCell, e.detail);
1443
1461
  if (this.isScrollingToCell) return;
1444
1462
  const { visibleCellIndices } = e.detail;
1445
1463
  if (visibleCellIndices.length === 0) return;
@@ -1561,13 +1579,7 @@ export class CollectionBrowser
1561
1579
  this.minSelectedDate = restorationState.minSelectedDate;
1562
1580
  this.maxSelectedDate = restorationState.maxSelectedDate;
1563
1581
  if (this.currentPage > 1) {
1564
- console.log(
1565
- 'state restored w/ page number, going to page',
1566
- this.currentPage
1567
- );
1568
- setTimeout(() => {
1569
- this.goToPage(this.currentPage ?? 1);
1570
- }, 100);
1582
+ this.goToPage(this.currentPage);
1571
1583
  }
1572
1584
  }
1573
1585
 
@@ -1631,34 +1643,23 @@ export class CollectionBrowser
1631
1643
  }
1632
1644
 
1633
1645
  private scrollToPage(pageNumber: number): Promise<void> {
1634
- console.log('scrolling to page', pageNumber);
1635
1646
  return new Promise(resolve => {
1636
1647
  const cellIndexToScrollTo = this.pageSize * (pageNumber - 1);
1637
- console.log('cell index', cellIndexToScrollTo);
1638
1648
  // without this setTimeout, Safari just pauses until the `fetchPage` is complete
1639
1649
  // then scrolls to the cell
1640
1650
  setTimeout(() => {
1641
- console.log(
1642
- 'requesting infinite scroller to scroll to cell',
1643
- cellIndexToScrollTo
1644
- );
1645
1651
  this.isScrollingToCell = true;
1646
- const scrollResult = this.infiniteScroller?.scrollToCell(
1647
- cellIndexToScrollTo,
1648
- true
1649
- );
1650
- console.log('scroll result:', scrollResult);
1652
+ this.infiniteScroller?.scrollToCell(cellIndexToScrollTo, true);
1651
1653
  // This timeout is to give the scroll animation time to finish
1652
1654
  // then updating the infinite scroller once we're done scrolling
1653
1655
  // There's no scroll animation completion callback so we're
1654
1656
  // giving it 0.5s to finish.
1655
1657
  setTimeout(() => {
1656
- console.log('marking scroll finished, refreshing visible cells');
1657
1658
  this.isScrollingToCell = false;
1658
1659
  this.infiniteScroller?.refreshAllVisibleCells();
1659
1660
  resolve();
1660
- }, 750);
1661
- }, 100);
1661
+ }, 500);
1662
+ }, 0);
1662
1663
  });
1663
1664
  }
1664
1665
 
@@ -10,6 +10,8 @@ export enum analyticsActions {
10
10
  filterByCreator = 'filterByCreator',
11
11
  filterByTitle = 'filterByTitle',
12
12
  displayMode = 'displayMode',
13
+ loadDesktopView = 'loadDesktopView',
14
+ loadMobileView = 'loadMobileView',
13
15
  facetSelected = 'facetSelected',
14
16
  facetDeselected = 'facetDeselected',
15
17
  facetNegativeSelected = 'facetNegativeSelected',