@internetarchive/collection-browser 3.5.3-alpha-webdev8156.0 → 4.0.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.
Files changed (34) hide show
  1. package/dist/src/app-root.d.ts +1 -0
  2. package/dist/src/app-root.js +21 -0
  3. package/dist/src/app-root.js.map +1 -1
  4. package/dist/src/collection-browser.js +772 -772
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/more-facets-content.d.ts +0 -1
  7. package/dist/src/collection-facets/more-facets-content.js +127 -126
  8. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  9. package/dist/src/data-source/collection-browser-query-state.d.ts +1 -2
  10. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  11. package/dist/src/models.d.ts +4 -0
  12. package/dist/src/models.js +8 -0
  13. package/dist/src/models.js.map +1 -1
  14. package/dist/src/tiles/grid/collection-tile.d.ts +2 -0
  15. package/dist/src/tiles/grid/collection-tile.js +22 -1
  16. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  17. package/dist/src/tiles/grid/item-tile.d.ts +2 -2
  18. package/dist/src/tiles/grid/item-tile.js +14 -8
  19. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  20. package/dist/src/tiles/models.d.ts +8 -1
  21. package/dist/src/tiles/models.js.map +1 -1
  22. package/dist/src/tiles/tile-dispatcher.d.ts +3 -3
  23. package/dist/src/tiles/tile-dispatcher.js +5 -4
  24. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  25. package/package.json +1 -1
  26. package/src/app-root.ts +26 -0
  27. package/src/collection-browser.ts +3075 -3077
  28. package/src/collection-facets/more-facets-content.ts +644 -642
  29. package/src/data-source/collection-browser-query-state.ts +59 -60
  30. package/src/models.ts +873 -864
  31. package/src/tiles/grid/collection-tile.ts +22 -1
  32. package/src/tiles/grid/item-tile.ts +14 -8
  33. package/src/tiles/models.ts +8 -1
  34. package/src/tiles/tile-dispatcher.ts +5 -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,IAAI,EAAE,mBAAmB,CAAC,OAAO,EAAE,iGAAiG;IACpI,SAAS,EAAE,mBAAmB,CAAC,YAAY;IAC3C,OAAO,EAAE,mBAAmB,CAAC,YAAY;IACzC,MAAM,EAAE,mBAAmB,CAAC,YAAY;IACxC,OAAO,EAAE,mBAAmB,CAAC,YAAY;CAC1C,CAAC;AAWF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAqC;IAC1E,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,KAAK;IACpB,mBAAmB,EAAE,IAAI;IACzB,YAAY,EAAE,KAAK;IACnB,mBAAmB,EAAE,KAAK;IAC1B,WAAW,EAAE,IAAI;IACjB,qBAAqB,EAAE,KAAK;CAC7B,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAEjC;IACF,WAAW,EAAE,iBAAiB;IAC9B,mBAAmB,EAAE,gBAAgB;IACrC,WAAW,EAAE,kBAAkB;CAChC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA4B;IAC5D,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,IAAI;IACtB,wBAAwB,EAAE,IAAI;IAC9B,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;CACd,CAAC","sourcesContent":["import type { TemplateResult } from 'lit';\nimport { msg } from '@lit/localize';\nimport type { MediaType } from '@internetarchive/field-parsers';\nimport {\n AggregationSortType,\n HitType,\n SearchReview,\n SearchResult,\n SortDirection,\n} from '@internetarchive/search-service';\nimport { collapseRepeatedQuotes } from './utils/collapse-repeated-quotes';\nimport { resolveMediatype } from './utils/resolve-mediatype';\n\nimport { loginRequiredIcon } from './assets/img/icons/login-required';\nimport { restrictedIcon } from './assets/img/icons/restricted';\n\n/**\n * Flags that can affect the visibility of content on a tile\n */\ninterface TileFlags {\n loginRequired: boolean;\n contentWarning: boolean;\n}\n\n/**\n * Different types of tile overlays, corresponding to the above flags.\n */\nexport type TileOverlayType = 'login-required' | 'content-warning';\n\nexport const TILE_OVERLAY_TEXT: Record<TileOverlayType, string> = {\n 'login-required': msg('Log in to view this item'),\n 'content-warning': msg('Content may be inappropriate'),\n};\n\nexport const TILE_OVERLAY_ICONS: Record<TileOverlayType, TemplateResult> = {\n 'login-required': loginRequiredIcon,\n 'content-warning': restrictedIcon,\n};\n\n/**\n * What type of request produced a given set of hits:\n * - `search_query`: Hits produced by an explicit user query and/or applied filters on any page\n * - `collection_members`: Hits produced for a collection page without any query or filters\n * - `profile_tab`: Hits produced for a tab of the profile page without any query or filters\n * - `unknown`: Hits produced via any other means\n */\nexport type HitRequestSource =\n | 'search_query'\n | 'collection_members'\n | 'profile_tab'\n | 'unknown';\n\n/**\n * Class for converting & storing raw search results in the correct format for UI tiles.\n */\nexport class TileModel {\n /** For TV hits. List of identifiers for any commercials contained. */\n adIds?: string[];\n\n averageRating?: number;\n\n /** For Web Archive hits on profile pages. List of capture dates for the current URL. */\n captureDates?: Date[];\n\n /** Whether this tile is currently checked for item management functions */\n checked: boolean;\n\n collectionIdentifier?: string;\n\n collectionName?: string;\n\n collectionFilesCount: number;\n\n collections: string[];\n\n collectionSize: number;\n\n commentCount: number;\n\n creator?: string;\n\n creators: string[];\n\n /** A string representation of the publication date, used strictly for passing preformatted dates to the parent */\n dateStr?: string;\n\n /** Date added to public search (software-defined) [from MD field: addeddate] */\n dateAdded?: Date;\n\n /** Date archived (software-defined) item created on archive.org [from MD field: publicdate] */\n dateArchived?: Date;\n\n /** Date work published in the world (user-defined) [from MD field: date] */\n datePublished?: Date;\n\n /** Date reviewed (user-created) most recent review [from MD field: reviewdate] */\n dateReviewed?: Date;\n\n description?: string;\n\n /** For TV hits. List of URLs for any fact-checks of the contained clips. */\n factChecks?: string[];\n\n favCount: number;\n\n hitRequestSource: HitRequestSource;\n\n hitType?: HitType;\n\n href?: string;\n\n identifier?: string;\n\n /** Whether this model represents a TV clip */\n isClip?: boolean;\n\n issue?: string;\n\n itemCount: number;\n\n mediatype: MediaType;\n\n review?: SearchReview;\n\n source?: string;\n\n snippets?: string[];\n\n subjects: string[];\n\n thumbnailUrl?: string;\n\n title: string;\n\n tvClipCount?: number;\n\n viewCount?: number;\n\n volume?: string;\n\n weeklyViewCount?: number;\n\n loginRequired: boolean;\n\n contentWarning: boolean;\n\n constructor(\n result: SearchResult,\n hitRequestSource: HitRequestSource = 'unknown',\n ) {\n const flags = this.getFlags(result);\n\n this.adIds = result.ad_id?.values;\n this.averageRating = result.avg_rating?.value;\n this.captureDates = result.capture_dates?.values;\n this.checked = false;\n this.collections = result.collection?.values ?? [];\n this.collectionFilesCount = result.collection_files_count?.value ?? 0;\n this.collectionSize = result.collection_size?.value ?? 0;\n this.commentCount = result.num_reviews?.value ?? 0;\n this.creator = result.creator?.value;\n this.creators = result.creator?.values ?? [];\n this.dateAdded = result.addeddate?.value;\n this.dateArchived = result.publicdate?.value;\n this.datePublished = result.date?.value;\n this.dateReviewed = result.reviewdate?.value;\n this.description = result.description?.values.join('\\n');\n this.factChecks = result.factcheck?.values;\n this.favCount = result.num_favorites?.value ?? 0;\n this.hitRequestSource = hitRequestSource;\n this.hitType = result.rawMetadata?.hit_type;\n this.href = collapseRepeatedQuotes(\n result.review?.__href__ ?? result.__href__?.value,\n );\n this.identifier = TileModel.cleanIdentifier(result.identifier);\n this.isClip = result.is_clip?.value;\n this.issue = result.issue?.value;\n this.itemCount = result.item_count?.value ?? 0;\n this.mediatype = resolveMediatype(result);\n this.review = result.review;\n this.snippets = result.highlight?.values ?? [];\n this.source = result.source?.value;\n this.subjects = result.subject?.values ?? [];\n this.thumbnailUrl = result.__img__?.value;\n this.title = result.title?.value ?? '';\n this.tvClipCount = result.num_clips?.value ?? 0;\n this.volume = result.volume?.value;\n this.viewCount = result.downloads?.value;\n this.weeklyViewCount = result.week?.value;\n this.loginRequired = flags.loginRequired;\n this.contentWarning = flags.contentWarning;\n }\n\n /**\n * Copies the contents of this TileModel onto a new instance\n */\n clone(): TileModel {\n const cloned = new TileModel({});\n cloned.adIds = this.adIds;\n cloned.averageRating = this.averageRating;\n cloned.captureDates = this.captureDates;\n cloned.checked = this.checked;\n cloned.collections = this.collections;\n cloned.collectionFilesCount = this.collectionFilesCount;\n cloned.collectionSize = this.collectionSize;\n cloned.commentCount = this.commentCount;\n cloned.creator = this.creator;\n cloned.creators = this.creators;\n cloned.dateStr = this.dateStr;\n cloned.dateAdded = this.dateAdded;\n cloned.dateArchived = this.dateArchived;\n cloned.datePublished = this.datePublished;\n cloned.dateReviewed = this.dateReviewed;\n cloned.description = this.description;\n cloned.factChecks = this.factChecks;\n cloned.favCount = this.favCount;\n cloned.hitRequestSource = this.hitRequestSource;\n cloned.hitType = this.hitType;\n cloned.href = this.href;\n cloned.identifier = this.identifier;\n cloned.isClip = this.isClip;\n cloned.issue = this.issue;\n cloned.itemCount = this.itemCount;\n cloned.mediatype = this.mediatype;\n cloned.snippets = this.snippets;\n cloned.source = this.source;\n cloned.subjects = this.subjects;\n cloned.thumbnailUrl = this.thumbnailUrl;\n cloned.title = this.title;\n cloned.tvClipCount = this.tvClipCount;\n cloned.volume = this.volume;\n cloned.viewCount = this.viewCount;\n cloned.weeklyViewCount = this.weeklyViewCount;\n cloned.loginRequired = this.loginRequired;\n cloned.contentWarning = this.contentWarning;\n return cloned;\n }\n\n /**\n * Whether this model represents the result of a TV search query.\n */\n get isTvSearchResult(): boolean {\n return (\n this.hitType === 'tv_clip' && this.hitRequestSource === 'search_query'\n );\n }\n\n /**\n * Determines the appropriate tile flags for the given search result\n * (login required and/or content warning)\n */\n private getFlags(result: SearchResult): TileFlags {\n const flags: TileFlags = {\n loginRequired: false,\n contentWarning: false,\n };\n\n // Check if item and item in \"modifying\" collection, setting above flags\n if (\n result.collection?.values.length &&\n result.mediatype?.value !== 'collection'\n ) {\n for (const collection of result.collection?.values ?? []) {\n if (collection === 'loggedin') {\n flags.loginRequired = true;\n if (flags.contentWarning) break;\n }\n if (collection === 'no-preview') {\n flags.contentWarning = true;\n if (flags.loginRequired) break;\n }\n }\n }\n\n return flags;\n }\n\n private static cleanIdentifier(\n identifier: string | undefined,\n ): string | undefined {\n // Some identifiers (e.g., from Whisper) represent documents rather than items, and\n // are suffixed with values that need to be stripped. Those values are separated\n // from the item identifier itself with '|'.\n const barIndex = identifier?.indexOf('|') ?? -1;\n const cleaned = barIndex > 0 ? identifier?.slice(0, barIndex) : identifier;\n return cleaned;\n }\n}\n\nexport type RequestKind = 'full' | 'hits' | 'aggregations';\n\nexport type CollectionDisplayMode = 'grid' | 'list-compact' | 'list-detail';\n\nexport type TileDisplayMode =\n | 'grid'\n | 'list-compact'\n | 'list-detail'\n | 'list-header';\n\n/**\n * This is mainly used to set the cookies for the collection display mode.\n *\n * It allows the user to set different modes for different contexts (collection page, search page, profile page etc).\n */\nexport type CollectionBrowserContext = 'collection' | 'search' | 'profile';\n\n/**\n * The sort fields shown in the sort filter bar\n */\nexport enum SortField {\n 'default' = 'default',\n 'unrecognized' = 'unrecognized',\n 'relevance' = 'relevance',\n 'alltimeview' = 'alltimeview',\n 'weeklyview' = 'weeklyview',\n 'title' = 'title',\n 'date' = 'date',\n 'datearchived' = 'datearchived',\n 'datereviewed' = 'datereviewed',\n 'dateadded' = 'dateadded',\n 'datefavorited' = 'datefavorited',\n 'creator' = 'creator',\n}\n\n/**\n * Views-related sort fields\n */\nexport const ALL_VIEWS_SORT_FIELDS = [\n SortField.weeklyview,\n SortField.alltimeview,\n] as const;\nexport type ViewsSortField = (typeof ALL_VIEWS_SORT_FIELDS)[number];\n\n/**\n * Date-related sort fields\n */\nexport const ALL_DATE_SORT_FIELDS = [\n SortField.datefavorited,\n SortField.date,\n SortField.datearchived,\n SortField.datereviewed,\n SortField.dateadded,\n] as const;\nexport type DateSortField = (typeof ALL_DATE_SORT_FIELDS)[number];\n\nexport interface SortOption {\n /**\n * The SortField enum member corresponding to this option.\n */\n field: SortField;\n\n /**\n * The default sort direction to apply when this sort option is first selected.\n */\n defaultSortDirection: SortDirection | null;\n\n /**\n * Whether this sort option allows its sort direction to be changed from the default.\n */\n canSetDirection: boolean;\n\n /**\n * Whether this sort option may appear in the sort bar.\n */\n shownInSortBar: boolean;\n\n /**\n * Whether this sort option should be saved to the URL.\n * If false, then no `sort` param will be added to the URL when this sort option\n * is selected.\n */\n shownInURL: boolean;\n\n /**\n * Whether this sort option is passed to the search service.\n * If false, then no sort param will be passed to the search service at all when\n * this sort option is selected.\n */\n handledBySearchService: boolean;\n\n /**\n * The string identifying this sort field to the search service & backend API.\n */\n searchServiceKey?: string;\n\n /**\n * The human-readable name to use for this option in the sort bar (if applicable).\n */\n displayName: string;\n\n /**\n * A list of URL param keys that should be mapped to this sort option.\n * E.g., both `title` and `titleSorter` in the URL map to the `SortField.title` option.\n */\n urlNames: (string | null | undefined)[];\n}\n\nexport const SORT_OPTIONS: Record<SortField, SortOption> = {\n // Default sort is the case where the user has not specified a sort option via the sort bar or URL.\n // In these cases, we defer to whatever sort the backend chooses.\n // For the search page, the default is always relevance sort.\n // For collection pages _without a query_, the default is usually weekly views, but this can be\n // overridden by the collection's `sort-by` metadata entry. If a query _is_ specified, then the\n // default is again relevance sort.\n // For fav-* collections only, the default is instead sorting by date favorited.\n [SortField.default]: {\n field: SortField.default,\n defaultSortDirection: null,\n canSetDirection: false,\n shownInSortBar: false,\n shownInURL: false,\n handledBySearchService: false, // We rely on the PPS default sort handling in these cases\n displayName: '',\n urlNames: ['', null, undefined], // Empty or nullish sort params result in default sorting\n },\n // Unrecognized sort is the case where the user has specified a sort in the URL, but it is not\n // one of the options listed in this map. We still want these unrecognized sorts to be applied\n // when searching, but they are not displayed in the sort bar and we do not actively manage\n // their URL param beyond flipping the direction as needed.\n [SortField.unrecognized]: {\n field: SortField.unrecognized,\n defaultSortDirection: null,\n canSetDirection: true,\n shownInSortBar: false,\n shownInURL: false,\n handledBySearchService: true, // The unrecognized sort param is passed along as-is\n displayName: '',\n urlNames: [],\n },\n // Relevance sort is unique in that it does not produce a URL param when it is set.\n // It is only available when there is a user-specified query that relevancy can be scored against.\n // Therefore, it does not appear as a sort bar option when browsing a collection with no query set.\n [SortField.relevance]: {\n field: SortField.relevance,\n defaultSortDirection: null,\n canSetDirection: false,\n shownInSortBar: true,\n shownInURL: false,\n handledBySearchService: false,\n displayName: 'Relevance',\n urlNames: ['_score'],\n },\n [SortField.alltimeview]: {\n field: SortField.alltimeview,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'downloads',\n displayName: 'All-time views',\n urlNames: ['downloads'],\n },\n [SortField.weeklyview]: {\n field: SortField.weeklyview,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'week',\n displayName: 'Weekly views',\n urlNames: ['week'],\n },\n [SortField.title]: {\n field: SortField.title,\n defaultSortDirection: 'asc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'titleSorter',\n displayName: 'Title',\n urlNames: ['title', 'titleSorter'],\n },\n [SortField.date]: {\n field: SortField.date,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'date',\n displayName: 'Date published',\n urlNames: ['date'],\n },\n [SortField.datearchived]: {\n field: SortField.datearchived,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'publicdate',\n displayName: 'Date archived',\n urlNames: ['publicdate'],\n },\n [SortField.datereviewed]: {\n field: SortField.datereviewed,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'reviewdate',\n displayName: 'Date reviewed',\n urlNames: ['reviewdate'],\n },\n [SortField.dateadded]: {\n field: SortField.dateadded,\n defaultSortDirection: 'desc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'addeddate',\n displayName: 'Date added',\n urlNames: ['addeddate'],\n },\n [SortField.datefavorited]: {\n field: SortField.datefavorited,\n defaultSortDirection: 'desc',\n canSetDirection: false,\n shownInSortBar: true, // But only when viewing fav-* collections\n shownInURL: false,\n handledBySearchService: false,\n searchServiceKey: 'favoritedate',\n displayName: 'Date favorited',\n urlNames: ['favoritedate'],\n },\n [SortField.creator]: {\n field: SortField.creator,\n defaultSortDirection: 'asc',\n canSetDirection: true,\n shownInSortBar: true,\n shownInURL: true,\n handledBySearchService: true,\n searchServiceKey: 'creatorSorter',\n displayName: 'Creator',\n urlNames: ['creator', 'creatorSorter'],\n },\n};\n\n/**\n * Returns the SortOption corresponding to the given API sort name, or\n * the \"unrecognized\" SortOption if none matches.\n */\nexport function sortOptionFromAPIString(sortName?: string | null): SortOption {\n return (\n Object.values(SORT_OPTIONS).find(opt =>\n opt.urlNames.some(name => sortName === name),\n ) ?? SORT_OPTIONS[SortField.unrecognized]\n );\n}\n\nexport const defaultSortAvailability: Record<SortField, boolean> = {\n [SortField.relevance]: true,\n [SortField.weeklyview]: true,\n [SortField.alltimeview]: true,\n [SortField.title]: true,\n [SortField.datefavorited]: false,\n [SortField.date]: true,\n [SortField.datearchived]: true,\n [SortField.datereviewed]: true,\n [SortField.dateadded]: true,\n [SortField.creator]: true,\n [SortField.default]: false,\n [SortField.unrecognized]: false,\n};\n\nexport const favoritesSortAvailability: Record<SortField, boolean> = {\n ...defaultSortAvailability,\n [SortField.datefavorited]: true,\n};\n\nexport const tvSortAvailability: Record<SortField, boolean> = {\n ...defaultSortAvailability,\n [SortField.date]: false,\n [SortField.datereviewed]: false,\n [SortField.dateadded]: false,\n};\n\nexport const defaultProfileElementSorts: Record<\n string,\n Exclude<SortField, SortField.default>\n> = {\n uploads: SortField.datearchived,\n reviews: SortField.datereviewed,\n collections: SortField.datearchived,\n web_archives: SortField.datearchived,\n};\n\n/** A union of the fields that permit prefix filtering (e.g., alphabetical filtering) */\nexport type PrefixFilterType = 'title' | 'creator';\n\n/** A map from prefixes (e.g., initial letters) to the number of items matching that prefix */\nexport type PrefixFilterCounts = Record<string, number>;\n\n/**\n * A map from prefix filter types to the corresponding aggregation keys\n * that are needed to fetch the filter counts from the backend.\n */\nexport const prefixFilterAggregationKeys: Record<PrefixFilterType, string> = {\n title: 'firstTitle',\n creator: 'firstCreator',\n};\n\n/**\n * Different facet loading strategies that can be used with collection browser.\n * - `eager`: Facet data is always loaded as soon as a search is performed\n * - `lazy-mobile`: In the desktop layout, functions exactly as `eager`.\n * In the mobile layout, facet data will only be loaded once the \"Filters\" accordion is opened.\n * - `opt-in-or-login`: Same as `opt-in` for guest users not logged into an account, but same as `eager` for\n * any logged in user.\n * - `opt-in`: In the desktop layout, facet data will only be loaded after the user presses a \"Load Facets\" button.\n * In the mobile layout, functions exactly as `lazy-mobile`.\n * - `off`: Facet data will never be loaded, and a message will be displayed in place of facets\n * indicating that they are unavailable.\n */\nexport type FacetLoadStrategy =\n | 'eager'\n | 'lazy-mobile'\n | 'opt-in-or-login'\n | 'opt-in'\n | 'off';\n\n/**\n * Union of the facet types that are available in the sidebar.\n */\nexport type FacetOption =\n | 'subject'\n | 'lending'\n | 'mediatype'\n | 'language'\n | 'creator'\n | 'collection'\n | 'year'\n // TV-specific facet options:\n | 'clip_type'\n | 'program'\n | 'person'\n | 'sponsor';\n\nexport type SelectedFacetState = 'selected' | 'hidden';\n\nexport type FacetState = SelectedFacetState | 'none';\n\nexport interface FacetBucket {\n key: string;\n count: number;\n state: FacetState;\n // for some facets, we augment the key with a display value\n displayText?: string;\n // for TV channel facets, we add a parenthesized secondary name\n extraNote?: string;\n}\n\nexport interface FacetGroup {\n title: string;\n key: FacetOption;\n buckets: FacetBucket[];\n}\n\n/**\n * Information about a user interaction event on a facet.\n */\nexport type FacetEventDetails = {\n /**\n * The type of facet that was interacted with (e.g., 'mediatype', 'language', ...).\n */\n facetType: FacetOption;\n /**\n * The bucket corresponding to the facet that was interacted with, including the\n * updated state of the facet after the interaction.\n */\n bucket: FacetBucket;\n /**\n * Whether the interaction occurred on a negative facet.\n */\n negative: boolean;\n};\n\nexport type FacetValue = string;\n\nexport type SelectedFacets = Partial<\n Record<FacetOption, Record<FacetValue, FacetBucket>>\n>;\n\nexport const getDefaultSelectedFacets = (): Required<SelectedFacets> => ({\n subject: {},\n lending: {},\n mediatype: {},\n language: {},\n creator: {},\n collection: {},\n year: {},\n clip_type: {},\n program: {},\n person: {},\n sponsor: {},\n});\n\n/**\n * For TV search results, what types of TV clips to restrict the results to.\n */\nexport type TvClipFilterType = 'commercial' | 'fact check' | 'quote';\n\n/**\n * Map from allowed TV filtering parameters in the URL to their corresponding filter type\n */\nexport const tvClipURLParamsToFilters: Record<string, TvClipFilterType> = {\n only_commercials: 'commercial',\n only_factchecks: 'fact check',\n only_quotes: 'quote',\n};\n\n/**\n * Facet display order when presenting results for all search types *except* TV (see below).\n */\nexport const defaultFacetDisplayOrder: FacetOption[] = [\n 'mediatype',\n // 'lending', Commenting this out removes the lending facet from the sidebar for now\n 'year',\n 'subject',\n 'collection',\n 'creator',\n 'language',\n];\n\n/**\n * Specialized facet ordering when displaying TV search results\n */\nexport const tvFacetDisplayOrder: FacetOption[] = [\n 'program',\n 'creator',\n 'year',\n 'subject',\n 'person',\n 'language',\n 'clip_type',\n];\n\n/**\n * Human-readable titles for each facet group.\n */\nexport const facetTitles: Record<FacetOption, string> = {\n subject: 'Subject',\n lending: 'Availability',\n mediatype: 'Media Type',\n language: 'Language',\n creator: 'Creator',\n collection: 'Collection',\n year: 'Year',\n clip_type: 'Clip Type',\n program: 'Program',\n person: 'Person',\n sponsor: 'Sponsor',\n};\n\n/**\n * The default sort type to use for each facet type\n */\nexport const defaultFacetSort: Record<FacetOption, AggregationSortType> = {\n subject: AggregationSortType.COUNT,\n lending: AggregationSortType.COUNT,\n mediatype: AggregationSortType.COUNT,\n language: AggregationSortType.COUNT,\n creator: AggregationSortType.COUNT,\n collection: AggregationSortType.COUNT,\n year: AggregationSortType.NUMERIC, // Year facets are ordered by their numeric value by default\n clip_type: AggregationSortType.COUNT,\n program: AggregationSortType.COUNT,\n person: AggregationSortType.COUNT,\n sponsor: AggregationSortType.COUNT,\n};\n\n/**\n * The sort type corresponding to facet bucket values, for each facet type\n * (i.e., the opposite of \"sort by count\" for that type).\n */\nexport const valueFacetSort: Record<FacetOption, AggregationSortType> = {\n subject: AggregationSortType.ALPHABETICAL,\n lending: AggregationSortType.ALPHABETICAL,\n mediatype: AggregationSortType.ALPHABETICAL,\n language: AggregationSortType.ALPHABETICAL,\n creator: AggregationSortType.ALPHABETICAL,\n collection: AggregationSortType.ALPHABETICAL,\n year: AggregationSortType.NUMERIC, // Year facets' values should be compared numerically, not lexicographically (year 2001 > year 3)\n clip_type: AggregationSortType.ALPHABETICAL,\n program: AggregationSortType.ALPHABETICAL,\n person: AggregationSortType.ALPHABETICAL,\n sponsor: AggregationSortType.ALPHABETICAL,\n};\n\nexport type LendingFacetKey =\n | 'is_lendable'\n | 'is_borrowable'\n | 'available_to_borrow'\n | 'is_browsable'\n | 'available_to_browse'\n | 'is_readable'\n | 'available_to_waitlist';\n\n/**\n * Maps valid lending keys to whether they should be visible in the facet sidebar\n */\nexport const lendingFacetKeysVisibility: Record<LendingFacetKey, boolean> = {\n is_lendable: true,\n is_borrowable: false,\n available_to_borrow: true,\n is_browsable: false,\n available_to_browse: false,\n is_readable: true,\n available_to_waitlist: false,\n};\n\n/**\n * Maps valid, visible lending keys to their facet sidebar display text\n */\nexport const lendingFacetDisplayNames: Partial<\n Record<LendingFacetKey, string>\n> = {\n is_lendable: 'Lending Library',\n available_to_borrow: 'Borrow 14 Days',\n is_readable: 'Always Available',\n};\n\n/**\n * A record of which admin-only collections should be suppressed from being displayed\n * as facets or in an item's list of collections.\n */\nexport const suppressedCollections: Record<string, boolean> = {\n deemphasize: true,\n community: true,\n stream_only: true,\n samples_only: true,\n test_collection: true,\n printdisabled: true,\n 'openlibrary-ol': true,\n nationalemergencylibrary: true,\n china: true,\n americana: true,\n toronto: true,\n};\n\n/**\n * A record of manageable item\n */\nexport interface ManageableItem {\n identifier: string;\n title?: string;\n dateStr?: string;\n date?: string;\n}\n\n/**\n * Possible states for whether & how the user has overridden their user preference\n * for blurring behavior on tiles with sensitive content.\n * - `no-override`: The user has not overridden their user preference, so simply\n * respect the preference as given.\n * - `on`: The user has overridden their preference and wants tile blurring enabled.\n * - `off`: The user has overridden their preference and wants tile blurring disabled.\n */\nexport type TileBlurOverrideState = 'no-override' | 'on' | 'off';\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC,OAAO,EACL,mBAAmB,GAKpB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAe/D,MAAM,CAAC,MAAM,iBAAiB,GAAoC;IAChE,gBAAgB,EAAE,GAAG,CAAC,0BAA0B,CAAC;IACjD,iBAAiB,EAAE,GAAG,CAAC,8BAA8B,CAAC;CACvD,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAA4C;IACzE,gBAAgB,EAAE,iBAAiB;IACnC,iBAAiB,EAAE,cAAc;CAClC,CAAC;AAeF;;GAEG;AACH,MAAM,OAAO,SAAS;IA2FpB,YACE,MAAoB,EACpB,mBAAqC,SAAS;QAE9C,MAAM,KAAK,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AE,kBAAkB;CAChC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAA4B;IAC5D,WAAW,EAAE,IAAI;IACjB,SAAS,EAAE,IAAI;IACf,WAAW,EAAE,IAAI;IACjB,YAAY,EAAE,IAAI;IAClB,eAAe,EAAE,IAAI;IACrB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,IAAI;IACtB,wBAAwB,EAAE,IAAI;IAC9B,KAAK,EAAE,IAAI;IACX,SAAS,EAAE,IAAI;IACf,OAAO,EAAE,IAAI;CACd,CAAC","sourcesContent":["import type { TemplateResult } from 'lit';\r\nimport { msg } from '@lit/localize';\r\nimport type { MediaType } from '@internetarchive/field-parsers';\r\nimport {\r\n AggregationSortType,\r\n HitType,\r\n SearchReview,\r\n SearchResult,\r\n SortDirection,\r\n} from '@internetarchive/search-service';\r\nimport { collapseRepeatedQuotes } from './utils/collapse-repeated-quotes';\r\nimport { resolveMediatype } from './utils/resolve-mediatype';\r\n\r\nimport { loginRequiredIcon } from './assets/img/icons/login-required';\r\nimport { restrictedIcon } from './assets/img/icons/restricted';\r\n\r\n/**\r\n * Flags that can affect the visibility of content on a tile\r\n */\r\ninterface TileFlags {\r\n loginRequired: boolean;\r\n contentWarning: boolean;\r\n}\r\n\r\n/**\r\n * Different types of tile overlays, corresponding to the above flags.\r\n */\r\nexport type TileOverlayType = 'login-required' | 'content-warning';\r\n\r\nexport const TILE_OVERLAY_TEXT: Record<TileOverlayType, string> = {\r\n 'login-required': msg('Log in to view this item'),\r\n 'content-warning': msg('Content may be inappropriate'),\r\n};\r\n\r\nexport const TILE_OVERLAY_ICONS: Record<TileOverlayType, TemplateResult> = {\r\n 'login-required': loginRequiredIcon,\r\n 'content-warning': restrictedIcon,\r\n};\r\n\r\n/**\r\n * What type of request produced a given set of hits:\r\n * - `search_query`: Hits produced by an explicit user query and/or applied filters on any page\r\n * - `collection_members`: Hits produced for a collection page without any query or filters\r\n * - `profile_tab`: Hits produced for a tab of the profile page without any query or filters\r\n * - `unknown`: Hits produced via any other means\r\n */\r\nexport type HitRequestSource =\r\n | 'search_query'\r\n | 'collection_members'\r\n | 'profile_tab'\r\n | 'unknown';\r\n\r\n/**\r\n * Class for converting & storing raw search results in the correct format for UI tiles.\r\n */\r\nexport class TileModel {\r\n /** For TV hits. List of identifiers for any commercials contained. */\r\n adIds?: string[];\r\n\r\n averageRating?: number;\r\n\r\n /** For Web Archive hits on profile pages. List of capture dates for the current URL. */\r\n captureDates?: Date[];\r\n\r\n /** Whether this tile is currently checked for item management functions */\r\n checked: boolean;\r\n\r\n collectionIdentifier?: string;\r\n\r\n collectionName?: string;\r\n\r\n collectionFilesCount: number;\r\n\r\n collections: string[];\r\n\r\n collectionSize: number;\r\n\r\n commentCount: number;\r\n\r\n creator?: string;\r\n\r\n creators: string[];\r\n\r\n /** A string representation of the publication date, used strictly for passing preformatted dates to the parent */\r\n dateStr?: string;\r\n\r\n /** Date added to public search (software-defined) [from MD field: addeddate] */\r\n dateAdded?: Date;\r\n\r\n /** Date archived (software-defined) item created on archive.org [from MD field: publicdate] */\r\n dateArchived?: Date;\r\n\r\n /** Date work published in the world (user-defined) [from MD field: date] */\r\n datePublished?: Date;\r\n\r\n /** Date reviewed (user-created) most recent review [from MD field: reviewdate] */\r\n dateReviewed?: Date;\r\n\r\n description?: string;\r\n\r\n /** For TV hits. List of URLs for any fact-checks of the contained clips. */\r\n factChecks?: string[];\r\n\r\n favCount: number;\r\n\r\n hitRequestSource: HitRequestSource;\r\n\r\n hitType?: HitType;\r\n\r\n href?: string;\r\n\r\n identifier?: string;\r\n\r\n /** Whether this model represents a TV clip */\r\n isClip?: boolean;\r\n\r\n issue?: string;\r\n\r\n itemCount: number;\r\n\r\n mediatype: MediaType;\r\n\r\n review?: SearchReview;\r\n\r\n source?: string;\r\n\r\n snippets?: string[];\r\n\r\n subjects: string[];\r\n\r\n thumbnailUrl?: string;\r\n\r\n title: string;\r\n\r\n tvClipCount?: number;\r\n\r\n viewCount?: number;\r\n\r\n volume?: string;\r\n\r\n weeklyViewCount?: number;\r\n\r\n loginRequired: boolean;\r\n\r\n contentWarning: boolean;\r\n\r\n constructor(\r\n result: SearchResult,\r\n hitRequestSource: HitRequestSource = 'unknown',\r\n ) {\r\n const flags = this.getFlags(result);\r\n\r\n this.adIds = result.ad_id?.values;\r\n this.averageRating = result.avg_rating?.value;\r\n this.captureDates = result.capture_dates?.values;\r\n this.checked = false;\r\n this.collections = result.collection?.values ?? [];\r\n this.collectionFilesCount = result.collection_files_count?.value ?? 0;\r\n this.collectionSize = result.collection_size?.value ?? 0;\r\n this.commentCount = result.num_reviews?.value ?? 0;\r\n this.creator = result.creator?.value;\r\n this.creators = result.creator?.values ?? [];\r\n this.dateAdded = result.addeddate?.value;\r\n this.dateArchived = result.publicdate?.value;\r\n this.datePublished = result.date?.value;\r\n this.dateReviewed = result.reviewdate?.value;\r\n this.description = result.description?.values.join('\\n');\r\n this.factChecks = result.factcheck?.values;\r\n this.favCount = result.num_favorites?.value ?? 0;\r\n this.hitRequestSource = hitRequestSource;\r\n this.hitType = result.rawMetadata?.hit_type;\r\n this.href = collapseRepeatedQuotes(\r\n result.review?.__href__ ?? result.__href__?.value,\r\n );\r\n this.identifier = TileModel.cleanIdentifier(result.identifier);\r\n this.isClip = result.is_clip?.value;\r\n this.issue = result.issue?.value;\r\n this.itemCount = result.item_count?.value ?? 0;\r\n this.mediatype = resolveMediatype(result);\r\n this.review = result.review;\r\n this.snippets = result.highlight?.values ?? [];\r\n this.source = result.source?.value;\r\n this.subjects = result.subject?.values ?? [];\r\n this.thumbnailUrl = result.__img__?.value;\r\n this.title = result.title?.value ?? '';\r\n this.tvClipCount = result.num_clips?.value ?? 0;\r\n this.volume = result.volume?.value;\r\n this.viewCount = result.downloads?.value;\r\n this.weeklyViewCount = result.week?.value;\r\n this.loginRequired = flags.loginRequired;\r\n this.contentWarning = flags.contentWarning;\r\n }\r\n\r\n /**\r\n * Copies the contents of this TileModel onto a new instance\r\n */\r\n clone(): TileModel {\r\n const cloned = new TileModel({});\r\n cloned.adIds = this.adIds;\r\n cloned.averageRating = this.averageRating;\r\n cloned.captureDates = this.captureDates;\r\n cloned.checked = this.checked;\r\n cloned.collections = this.collections;\r\n cloned.collectionFilesCount = this.collectionFilesCount;\r\n cloned.collectionSize = this.collectionSize;\r\n cloned.commentCount = this.commentCount;\r\n cloned.creator = this.creator;\r\n cloned.creators = this.creators;\r\n cloned.dateStr = this.dateStr;\r\n cloned.dateAdded = this.dateAdded;\r\n cloned.dateArchived = this.dateArchived;\r\n cloned.datePublished = this.datePublished;\r\n cloned.dateReviewed = this.dateReviewed;\r\n cloned.description = this.description;\r\n cloned.factChecks = this.factChecks;\r\n cloned.favCount = this.favCount;\r\n cloned.hitRequestSource = this.hitRequestSource;\r\n cloned.hitType = this.hitType;\r\n cloned.href = this.href;\r\n cloned.identifier = this.identifier;\r\n cloned.isClip = this.isClip;\r\n cloned.issue = this.issue;\r\n cloned.itemCount = this.itemCount;\r\n cloned.mediatype = this.mediatype;\r\n cloned.snippets = this.snippets;\r\n cloned.source = this.source;\r\n cloned.subjects = this.subjects;\r\n cloned.thumbnailUrl = this.thumbnailUrl;\r\n cloned.title = this.title;\r\n cloned.tvClipCount = this.tvClipCount;\r\n cloned.volume = this.volume;\r\n cloned.viewCount = this.viewCount;\r\n cloned.weeklyViewCount = this.weeklyViewCount;\r\n cloned.loginRequired = this.loginRequired;\r\n cloned.contentWarning = this.contentWarning;\r\n return cloned;\r\n }\r\n\r\n /**\r\n * Whether this model represents the result of a TV search query.\r\n */\r\n get isTvSearchResult(): boolean {\r\n return (\r\n this.hitType === 'tv_clip' && this.hitRequestSource === 'search_query'\r\n );\r\n }\r\n\r\n /**\r\n * Determines the appropriate tile flags for the given search result\r\n * (login required and/or content warning)\r\n */\r\n private getFlags(result: SearchResult): TileFlags {\r\n const flags: TileFlags = {\r\n loginRequired: false,\r\n contentWarning: false,\r\n };\r\n\r\n // Check if item and item in \"modifying\" collection, setting above flags\r\n if (\r\n result.collection?.values.length &&\r\n result.mediatype?.value !== 'collection'\r\n ) {\r\n for (const collection of result.collection?.values ?? []) {\r\n if (collection === 'loggedin') {\r\n flags.loginRequired = true;\r\n if (flags.contentWarning) break;\r\n }\r\n if (collection === 'no-preview') {\r\n flags.contentWarning = true;\r\n if (flags.loginRequired) break;\r\n }\r\n }\r\n }\r\n\r\n return flags;\r\n }\r\n\r\n private static cleanIdentifier(\r\n identifier: string | undefined,\r\n ): string | undefined {\r\n // Some identifiers (e.g., from Whisper) represent documents rather than items, and\r\n // are suffixed with values that need to be stripped. Those values are separated\r\n // from the item identifier itself with '|'.\r\n const barIndex = identifier?.indexOf('|') ?? -1;\r\n const cleaned = barIndex > 0 ? identifier?.slice(0, barIndex) : identifier;\r\n return cleaned;\r\n }\r\n}\r\n\r\nexport type RequestKind = 'full' | 'hits' | 'aggregations';\r\n\r\nexport type CollectionDisplayMode = 'grid' | 'list-compact' | 'list-detail';\r\n\r\nexport type TileDisplayMode =\r\n | 'grid'\r\n | 'list-compact'\r\n | 'list-detail'\r\n | 'list-header';\r\n\r\n/**\r\n * This is mainly used to set the cookies for the collection display mode.\r\n *\r\n * It allows the user to set different modes for different contexts (collection page, search page, profile page etc).\r\n */\r\nexport type CollectionBrowserContext = 'collection' | 'search' | 'profile';\r\n\r\n/**\r\n * The sort fields shown in the sort filter bar\r\n */\r\nexport enum SortField {\r\n 'default' = 'default',\r\n 'unrecognized' = 'unrecognized',\r\n 'relevance' = 'relevance',\r\n 'alltimeview' = 'alltimeview',\r\n 'weeklyview' = 'weeklyview',\r\n 'title' = 'title',\r\n 'date' = 'date',\r\n 'datearchived' = 'datearchived',\r\n 'datereviewed' = 'datereviewed',\r\n 'dateadded' = 'dateadded',\r\n 'datefavorited' = 'datefavorited',\r\n 'creator' = 'creator',\r\n}\r\n\r\n/**\r\n * Views-related sort fields\r\n */\r\nexport const ALL_VIEWS_SORT_FIELDS = [\r\n SortField.weeklyview,\r\n SortField.alltimeview,\r\n] as const;\r\nexport type ViewsSortField = (typeof ALL_VIEWS_SORT_FIELDS)[number];\r\n\r\n/**\r\n * Date-related sort fields\r\n */\r\nexport const ALL_DATE_SORT_FIELDS = [\r\n SortField.datefavorited,\r\n SortField.date,\r\n SortField.datearchived,\r\n SortField.datereviewed,\r\n SortField.dateadded,\r\n] as const;\r\nexport type DateSortField = (typeof ALL_DATE_SORT_FIELDS)[number];\r\n\r\nexport interface SortOption {\r\n /**\r\n * The SortField enum member corresponding to this option.\r\n */\r\n field: SortField;\r\n\r\n /**\r\n * The default sort direction to apply when this sort option is first selected.\r\n */\r\n defaultSortDirection: SortDirection | null;\r\n\r\n /**\r\n * Whether this sort option allows its sort direction to be changed from the default.\r\n */\r\n canSetDirection: boolean;\r\n\r\n /**\r\n * Whether this sort option may appear in the sort bar.\r\n */\r\n shownInSortBar: boolean;\r\n\r\n /**\r\n * Whether this sort option should be saved to the URL.\r\n * If false, then no `sort` param will be added to the URL when this sort option\r\n * is selected.\r\n */\r\n shownInURL: boolean;\r\n\r\n /**\r\n * Whether this sort option is passed to the search service.\r\n * If false, then no sort param will be passed to the search service at all when\r\n * this sort option is selected.\r\n */\r\n handledBySearchService: boolean;\r\n\r\n /**\r\n * The string identifying this sort field to the search service & backend API.\r\n */\r\n searchServiceKey?: string;\r\n\r\n /**\r\n * The human-readable name to use for this option in the sort bar (if applicable).\r\n */\r\n displayName: string;\r\n\r\n /**\r\n * A list of URL param keys that should be mapped to this sort option.\r\n * E.g., both `title` and `titleSorter` in the URL map to the `SortField.title` option.\r\n */\r\n urlNames: (string | null | undefined)[];\r\n}\r\n\r\nexport const SORT_OPTIONS: Record<SortField, SortOption> = {\r\n // Default sort is the case where the user has not specified a sort option via the sort bar or URL.\r\n // In these cases, we defer to whatever sort the backend chooses.\r\n // For the search page, the default is always relevance sort.\r\n // For collection pages _without a query_, the default is usually weekly views, but this can be\r\n // overridden by the collection's `sort-by` metadata entry. If a query _is_ specified, then the\r\n // default is again relevance sort.\r\n // For fav-* collections only, the default is instead sorting by date favorited.\r\n [SortField.default]: {\r\n field: SortField.default,\r\n defaultSortDirection: null,\r\n canSetDirection: false,\r\n shownInSortBar: false,\r\n shownInURL: false,\r\n handledBySearchService: false, // We rely on the PPS default sort handling in these cases\r\n displayName: '',\r\n urlNames: ['', null, undefined], // Empty or nullish sort params result in default sorting\r\n },\r\n // Unrecognized sort is the case where the user has specified a sort in the URL, but it is not\r\n // one of the options listed in this map. We still want these unrecognized sorts to be applied\r\n // when searching, but they are not displayed in the sort bar and we do not actively manage\r\n // their URL param beyond flipping the direction as needed.\r\n [SortField.unrecognized]: {\r\n field: SortField.unrecognized,\r\n defaultSortDirection: null,\r\n canSetDirection: true,\r\n shownInSortBar: false,\r\n shownInURL: false,\r\n handledBySearchService: true, // The unrecognized sort param is passed along as-is\r\n displayName: '',\r\n urlNames: [],\r\n },\r\n // Relevance sort is unique in that it does not produce a URL param when it is set.\r\n // It is only available when there is a user-specified query that relevancy can be scored against.\r\n // Therefore, it does not appear as a sort bar option when browsing a collection with no query set.\r\n [SortField.relevance]: {\r\n field: SortField.relevance,\r\n defaultSortDirection: null,\r\n canSetDirection: false,\r\n shownInSortBar: true,\r\n shownInURL: false,\r\n handledBySearchService: false,\r\n displayName: 'Relevance',\r\n urlNames: ['_score'],\r\n },\r\n [SortField.alltimeview]: {\r\n field: SortField.alltimeview,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'downloads',\r\n displayName: 'All-time views',\r\n urlNames: ['downloads'],\r\n },\r\n [SortField.weeklyview]: {\r\n field: SortField.weeklyview,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'week',\r\n displayName: 'Weekly views',\r\n urlNames: ['week'],\r\n },\r\n [SortField.title]: {\r\n field: SortField.title,\r\n defaultSortDirection: 'asc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'titleSorter',\r\n displayName: 'Title',\r\n urlNames: ['title', 'titleSorter'],\r\n },\r\n [SortField.date]: {\r\n field: SortField.date,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'date',\r\n displayName: 'Date published',\r\n urlNames: ['date'],\r\n },\r\n [SortField.datearchived]: {\r\n field: SortField.datearchived,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'publicdate',\r\n displayName: 'Date archived',\r\n urlNames: ['publicdate'],\r\n },\r\n [SortField.datereviewed]: {\r\n field: SortField.datereviewed,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'reviewdate',\r\n displayName: 'Date reviewed',\r\n urlNames: ['reviewdate'],\r\n },\r\n [SortField.dateadded]: {\r\n field: SortField.dateadded,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'addeddate',\r\n displayName: 'Date added',\r\n urlNames: ['addeddate'],\r\n },\r\n [SortField.datefavorited]: {\r\n field: SortField.datefavorited,\r\n defaultSortDirection: 'desc',\r\n canSetDirection: false,\r\n shownInSortBar: true, // But only when viewing fav-* collections\r\n shownInURL: false,\r\n handledBySearchService: false,\r\n searchServiceKey: 'favoritedate',\r\n displayName: 'Date favorited',\r\n urlNames: ['favoritedate'],\r\n },\r\n [SortField.creator]: {\r\n field: SortField.creator,\r\n defaultSortDirection: 'asc',\r\n canSetDirection: true,\r\n shownInSortBar: true,\r\n shownInURL: true,\r\n handledBySearchService: true,\r\n searchServiceKey: 'creatorSorter',\r\n displayName: 'Creator',\r\n urlNames: ['creator', 'creatorSorter'],\r\n },\r\n};\r\n\r\n/**\r\n * Returns the SortOption corresponding to the given API sort name, or\r\n * the \"unrecognized\" SortOption if none matches.\r\n */\r\nexport function sortOptionFromAPIString(sortName?: string | null): SortOption {\r\n return (\r\n Object.values(SORT_OPTIONS).find(opt =>\r\n opt.urlNames.some(name => sortName === name),\r\n ) ?? SORT_OPTIONS[SortField.unrecognized]\r\n );\r\n}\r\n\r\nexport const defaultSortAvailability: Record<SortField, boolean> = {\r\n [SortField.relevance]: true,\r\n [SortField.weeklyview]: true,\r\n [SortField.alltimeview]: true,\r\n [SortField.title]: true,\r\n [SortField.datefavorited]: false,\r\n [SortField.date]: true,\r\n [SortField.datearchived]: true,\r\n [SortField.datereviewed]: true,\r\n [SortField.dateadded]: true,\r\n [SortField.creator]: true,\r\n [SortField.default]: false,\r\n [SortField.unrecognized]: false,\r\n};\r\n\r\nexport const favoritesSortAvailability: Record<SortField, boolean> = {\r\n ...defaultSortAvailability,\r\n [SortField.datefavorited]: true,\r\n};\r\n\r\nexport const tvSortAvailability: Record<SortField, boolean> = {\r\n ...defaultSortAvailability,\r\n [SortField.date]: false,\r\n [SortField.datereviewed]: false,\r\n [SortField.dateadded]: false,\r\n};\r\n\r\nexport const defaultProfileElementSorts: Record<\r\n string,\r\n Exclude<SortField, SortField.default>\r\n> = {\r\n uploads: SortField.datearchived,\r\n reviews: SortField.datereviewed,\r\n collections: SortField.datearchived,\r\n web_archives: SortField.datearchived,\r\n};\r\n\r\n/** A union of the fields that permit prefix filtering (e.g., alphabetical filtering) */\r\nexport type PrefixFilterType = 'title' | 'creator';\r\n\r\n/** A map from prefixes (e.g., initial letters) to the number of items matching that prefix */\r\nexport type PrefixFilterCounts = Record<string, number>;\r\n\r\n/**\r\n * A map from prefix filter types to the corresponding aggregation keys\r\n * that are needed to fetch the filter counts from the backend.\r\n */\r\nexport const prefixFilterAggregationKeys: Record<PrefixFilterType, string> = {\r\n title: 'firstTitle',\r\n creator: 'firstCreator',\r\n};\r\n\r\n/**\r\n * Different facet loading strategies that can be used with collection browser.\r\n * - `eager`: Facet data is always loaded as soon as a search is performed\r\n * - `lazy-mobile`: In the desktop layout, functions exactly as `eager`.\r\n * In the mobile layout, facet data will only be loaded once the \"Filters\" accordion is opened.\r\n * - `opt-in-or-login`: Same as `opt-in` for guest users not logged into an account, but same as `eager` for\r\n * any logged in user.\r\n * - `opt-in`: In the desktop layout, facet data will only be loaded after the user presses a \"Load Facets\" button.\r\n * In the mobile layout, functions exactly as `lazy-mobile`.\r\n * - `off`: Facet data will never be loaded, and a message will be displayed in place of facets\r\n * indicating that they are unavailable.\r\n */\r\nexport type FacetLoadStrategy =\r\n | 'eager'\r\n | 'lazy-mobile'\r\n | 'opt-in-or-login'\r\n | 'opt-in'\r\n | 'off';\r\n\r\n/**\r\n * Union of the facet types that are available in the sidebar.\r\n */\r\nexport type FacetOption =\r\n | 'subject'\r\n | 'lending'\r\n | 'mediatype'\r\n | 'language'\r\n | 'creator'\r\n | 'collection'\r\n | 'year'\r\n // TV-specific facet options:\r\n | 'clip_type'\r\n | 'program'\r\n | 'person'\r\n | 'sponsor';\r\n\r\nexport type SelectedFacetState = 'selected' | 'hidden';\r\n\r\nexport type FacetState = SelectedFacetState | 'none';\r\n\r\nexport interface FacetBucket {\r\n key: string;\r\n count: number;\r\n state: FacetState;\r\n // for some facets, we augment the key with a display value\r\n displayText?: string;\r\n // for TV channel facets, we add a parenthesized secondary name\r\n extraNote?: string;\r\n}\r\n\r\nexport interface FacetGroup {\r\n title: string;\r\n key: FacetOption;\r\n buckets: FacetBucket[];\r\n}\r\n\r\n/**\r\n * Information about a user interaction event on a facet.\r\n */\r\nexport type FacetEventDetails = {\r\n /**\r\n * The type of facet that was interacted with (e.g., 'mediatype', 'language', ...).\r\n */\r\n facetType: FacetOption;\r\n /**\r\n * The bucket corresponding to the facet that was interacted with, including the\r\n * updated state of the facet after the interaction.\r\n */\r\n bucket: FacetBucket;\r\n /**\r\n * Whether the interaction occurred on a negative facet.\r\n */\r\n negative: boolean;\r\n};\r\n\r\nexport type FacetValue = string;\r\n\r\nexport type SelectedFacets = Partial<\r\n Record<FacetOption, Record<FacetValue, FacetBucket>>\r\n>;\r\n\r\nexport const getDefaultSelectedFacets = (): Required<SelectedFacets> => ({\r\n subject: {},\r\n lending: {},\r\n mediatype: {},\r\n language: {},\r\n creator: {},\r\n collection: {},\r\n year: {},\r\n clip_type: {},\r\n program: {},\r\n person: {},\r\n sponsor: {},\r\n});\r\n\r\n/**\r\n * For TV search results, what types of TV clips to restrict the results to.\r\n */\r\nexport type TvClipFilterType = 'commercial' | 'fact check' | 'quote';\r\n\r\n/**\r\n * Map from allowed TV filtering parameters in the URL to their corresponding filter type\r\n */\r\nexport const tvClipURLParamsToFilters: Record<string, TvClipFilterType> = {\r\n only_commercials: 'commercial',\r\n only_factchecks: 'fact check',\r\n only_quotes: 'quote',\r\n};\r\n\r\n/**\r\n * Facet display order when presenting results for all search types *except* TV (see below).\r\n */\r\nexport const defaultFacetDisplayOrder: FacetOption[] = [\r\n 'mediatype',\r\n // 'lending', Commenting this out removes the lending facet from the sidebar for now\r\n 'year',\r\n 'subject',\r\n 'collection',\r\n 'creator',\r\n 'language',\r\n];\r\n\r\n/**\r\n * Specialized facet ordering when displaying TV search results\r\n */\r\nexport const tvFacetDisplayOrder: FacetOption[] = [\r\n 'program',\r\n 'creator',\r\n 'year',\r\n 'subject',\r\n 'person',\r\n 'language',\r\n 'clip_type',\r\n];\r\n\r\n/**\r\n * Human-readable titles for each facet group.\r\n */\r\nexport const facetTitles: Record<FacetOption, string> = {\r\n subject: 'Subject',\r\n lending: 'Availability',\r\n mediatype: 'Media Type',\r\n language: 'Language',\r\n creator: 'Creator',\r\n collection: 'Collection',\r\n year: 'Year',\r\n clip_type: 'Clip Type',\r\n program: 'Program',\r\n person: 'Person',\r\n sponsor: 'Sponsor',\r\n};\r\n\r\n/**\r\n * The default sort type to use for each facet type\r\n */\r\nexport const defaultFacetSort: Record<FacetOption, AggregationSortType> = {\r\n subject: AggregationSortType.COUNT,\r\n lending: AggregationSortType.COUNT,\r\n mediatype: AggregationSortType.COUNT,\r\n language: AggregationSortType.COUNT,\r\n creator: AggregationSortType.COUNT,\r\n collection: AggregationSortType.COUNT,\r\n year: AggregationSortType.NUMERIC, // Year facets are ordered by their numeric value by default\r\n clip_type: AggregationSortType.COUNT,\r\n program: AggregationSortType.COUNT,\r\n person: AggregationSortType.COUNT,\r\n sponsor: AggregationSortType.COUNT,\r\n};\r\n\r\n/**\r\n * The default sort type to use for each facet type in TV search More... dialogs only\r\n */\r\nexport const tvMoreFacetSort: Record<FacetOption, AggregationSortType> = {\r\n ...defaultFacetSort,\r\n creator: AggregationSortType.ALPHABETICAL,\r\n program: AggregationSortType.ALPHABETICAL,\r\n};\r\n\r\n/**\r\n * The sort type corresponding to facet bucket values, for each facet type\r\n * (i.e., the opposite of \"sort by count\" for that type).\r\n */\r\nexport const valueFacetSort: Record<FacetOption, AggregationSortType> = {\r\n subject: AggregationSortType.ALPHABETICAL,\r\n lending: AggregationSortType.ALPHABETICAL,\r\n mediatype: AggregationSortType.ALPHABETICAL,\r\n language: AggregationSortType.ALPHABETICAL,\r\n creator: AggregationSortType.ALPHABETICAL,\r\n collection: AggregationSortType.ALPHABETICAL,\r\n year: AggregationSortType.NUMERIC, // Year facets' values should be compared numerically, not lexicographically (year 2001 > year 3)\r\n clip_type: AggregationSortType.ALPHABETICAL,\r\n program: AggregationSortType.ALPHABETICAL,\r\n person: AggregationSortType.ALPHABETICAL,\r\n sponsor: AggregationSortType.ALPHABETICAL,\r\n};\r\n\r\nexport type LendingFacetKey =\r\n | 'is_lendable'\r\n | 'is_borrowable'\r\n | 'available_to_borrow'\r\n | 'is_browsable'\r\n | 'available_to_browse'\r\n | 'is_readable'\r\n | 'available_to_waitlist';\r\n\r\n/**\r\n * Maps valid lending keys to whether they should be visible in the facet sidebar\r\n */\r\nexport const lendingFacetKeysVisibility: Record<LendingFacetKey, boolean> = {\r\n is_lendable: true,\r\n is_borrowable: false,\r\n available_to_borrow: true,\r\n is_browsable: false,\r\n available_to_browse: false,\r\n is_readable: true,\r\n available_to_waitlist: false,\r\n};\r\n\r\n/**\r\n * Maps valid, visible lending keys to their facet sidebar display text\r\n */\r\nexport const lendingFacetDisplayNames: Partial<\r\n Record<LendingFacetKey, string>\r\n> = {\r\n is_lendable: 'Lending Library',\r\n available_to_borrow: 'Borrow 14 Days',\r\n is_readable: 'Always Available',\r\n};\r\n\r\n/**\r\n * A record of which admin-only collections should be suppressed from being displayed\r\n * as facets or in an item's list of collections.\r\n */\r\nexport const suppressedCollections: Record<string, boolean> = {\r\n deemphasize: true,\r\n community: true,\r\n stream_only: true,\r\n samples_only: true,\r\n test_collection: true,\r\n printdisabled: true,\r\n 'openlibrary-ol': true,\r\n nationalemergencylibrary: true,\r\n china: true,\r\n americana: true,\r\n toronto: true,\r\n};\r\n\r\n/**\r\n * A record of manageable item\r\n */\r\nexport interface ManageableItem {\r\n identifier: string;\r\n title?: string;\r\n dateStr?: string;\r\n date?: string;\r\n}\r\n\r\n/**\r\n * Possible states for whether & how the user has overridden their user preference\r\n * for blurring behavior on tiles with sensitive content.\r\n * - `no-override`: The user has not overridden their user preference, so simply\r\n * respect the preference as given.\r\n * - `on`: The user has overridden their preference and wants tile blurring enabled.\r\n * - `off`: The user has overridden their preference and wants tile blurring disabled.\r\n */\r\nexport type TileBlurOverrideState = 'no-override' | 'on' | 'off';\r\n"]}
@@ -1,8 +1,10 @@
1
1
  import { CSSResultGroup, TemplateResult } from 'lit';
2
2
  import { BaseTileComponent } from '../base-tile-component';
3
+ import { LayoutType } from '../models';
3
4
  import '../image-block';
4
5
  export declare class CollectionTile extends BaseTileComponent {
5
6
  showInfoButton: boolean;
7
+ layoutType: LayoutType;
6
8
  render(): TemplateResult<1>;
7
9
  private get getImageBlockTemplate();
8
10
  private get getTitleTemplate();
@@ -1,6 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  import { css, html, nothing } from 'lit';
3
3
  import { customElement, property } from 'lit/decorators.js';
4
+ import { classMap } from 'lit/directives/class-map.js';
4
5
  import { msg } from '@lit/localize';
5
6
  import { collectionIcon } from '../../assets/img/icons/mediatype/collection';
6
7
  import { formatUnitSize } from '../../utils/format-unit-size';
@@ -26,10 +27,15 @@ let CollectionTile = class CollectionTile extends BaseTileComponent {
26
27
  */
27
28
  super(...arguments);
28
29
  this.showInfoButton = false;
30
+ this.layoutType = 'default';
29
31
  }
30
32
  render() {
33
+ const containerClasses = classMap({
34
+ container: true,
35
+ minimal: this.layoutType === 'minimal',
36
+ });
31
37
  return html `
32
- <div class="container">
38
+ <div class=${containerClasses}>
33
39
  ${this.infoButtonTemplate}
34
40
  <div class="tile-details">
35
41
  <div class="item-info">
@@ -143,6 +149,18 @@ let CollectionTile = class CollectionTile extends BaseTileComponent {
143
149
  flex-direction: column;
144
150
  margin-left: 10px;
145
151
  }
152
+
153
+ .minimal #item-stats {
154
+ display: none;
155
+ }
156
+
157
+ .minimal .truncated {
158
+ -webkit-line-clamp: initial;
159
+ }
160
+
161
+ .minimal .item-info {
162
+ padding-bottom: 5px;
163
+ }
146
164
  `,
147
165
  ];
148
166
  }
@@ -150,6 +168,9 @@ let CollectionTile = class CollectionTile extends BaseTileComponent {
150
168
  __decorate([
151
169
  property({ type: Boolean })
152
170
  ], CollectionTile.prototype, "showInfoButton", void 0);
171
+ __decorate([
172
+ property({ type: String })
173
+ ], CollectionTile.prototype, "layoutType", void 0);
153
174
  CollectionTile = __decorate([
154
175
  customElement('collection-tile')
155
176
  ], CollectionTile);
@@ -1 +1 @@
1
- {"version":3,"file":"collection-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/collection-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EA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AAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAwJ1B","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\nimport { msg } from '@lit/localize';\r\nimport { collectionIcon } from '../../assets/img/icons/mediatype/collection';\r\nimport { formatUnitSize } from '../../utils/format-unit-size';\r\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\r\nimport { BaseTileComponent } from '../base-tile-component';\r\nimport '../image-block';\r\n\r\n@customElement('collection-tile')\r\nexport class CollectionTile extends BaseTileComponent {\r\n /*\r\n * Reactive properties inherited from BaseTileComponent:\r\n * - model?: TileModel;\r\n * - currentWidth?: number;\r\n * - currentHeight?: number;\r\n * - baseNavigationUrl?: string;\r\n * - baseImageUrl?: string;\r\n * - collectionPagePath?: string;\r\n * - sortParam: SortParam | null = null;\r\n * - creatorFilter?: string;\r\n * - mobileBreakpoint?: number;\r\n * - loggedIn = false;\r\n * - suppressBlurring = false;\r\n * - useLocalTime = false;\r\n */\r\n\r\n @property({ type: Boolean }) showInfoButton = false;\r\n\r\n render() {\r\n return html`\r\n <div class=\"container\">\r\n ${this.infoButtonTemplate}\r\n <div class=\"tile-details\">\r\n <div class=\"item-info\">\r\n ${this.getImageBlockTemplate} ${this.getTitleTemplate}\r\n </div>\r\n </div>\r\n\r\n ${this.getTileStatsTemplate}\r\n </div>\r\n `;\r\n }\r\n\r\n private get getImageBlockTemplate(): TemplateResult {\r\n return html`\r\n <image-block\r\n .model=${this.model}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .viewSize=${'grid'}\r\n .suppressBlurring=${this.suppressBlurring}\r\n >\r\n </image-block>\r\n `;\r\n }\r\n\r\n private get getTitleTemplate() {\r\n return html`<div id=\"title\">\r\n <h3 class=\"truncated\">${this.model?.title}</h3>\r\n </div>`;\r\n }\r\n\r\n private get getTileStatsTemplate() {\r\n return html`\r\n <div id=\"item-stats\">\r\n <div id=\"item-mediatype\">${collectionIcon}</div>\r\n\r\n <div id=\"stats-row\">\r\n ${this.getItemsTemplate} ${this.getSizeTemplate}\r\n </div>\r\n </div>\r\n `;\r\n }\r\n\r\n private get getItemsTemplate() {\r\n const collectionItems = this.model?.itemCount?.toLocaleString();\r\n\r\n return html`<span id=\"item-count\"\r\n >${collectionItems} item${Number(collectionItems) !== 1 ? 's' : ''}</span\r\n >`;\r\n }\r\n\r\n private get getSizeTemplate() {\r\n const collectionSize = this.model?.collectionSize ?? 0;\r\n\r\n return collectionSize\r\n ? html`<span id=\"item-size\">${formatUnitSize(collectionSize, 1)}</span>`\r\n : ``;\r\n }\r\n\r\n private get infoButtonTemplate(): TemplateResult | typeof nothing {\r\n // &#9432; is an information icon\r\n return this.showInfoButton\r\n ? html`<button class=\"info-button\" @click=${this.infoButtonPressed}>\r\n &#9432;\r\n <span class=\"sr-only\">${msg('More info')}</span>\r\n </button>`\r\n : nothing;\r\n }\r\n\r\n private infoButtonPressed(e: PointerEvent) {\r\n e.preventDefault();\r\n const event = new CustomEvent<{ x: number; y: number }>(\r\n 'infoButtonPressed',\r\n { detail: { x: e.clientX, y: e.clientY } },\r\n );\r\n this.dispatchEvent(event);\r\n }\r\n\r\n static get styles(): CSSResultGroup {\r\n const tileBorderColor = css`var(--tileBorderColor, #555555)`;\r\n const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;\r\n const whiteColor = css`#fff`;\r\n\r\n return [\r\n baseTileStyles,\r\n css`\r\n .container {\r\n background-color: ${tileBackgroundColor};\r\n border: 1px solid ${tileBorderColor};\r\n }\r\n\r\n .item-info {\r\n flex-grow: initial;\r\n }\r\n\r\n h4.truncated,\r\n h3.truncated {\r\n color: ${whiteColor};\r\n }\r\n\r\n #item-mediatype svg {\r\n filter: invert(100%);\r\n height: 2.5rem;\r\n align-items: baseline;\r\n }\r\n\r\n .container:hover > #title {\r\n text-decoration: underline;\r\n }\r\n\r\n /* this is a workaround for Safari 15 where the hover effects are not working */\r\n image-block:hover > #title {\r\n text-decoration: underline;\r\n }\r\n\r\n #item-stats {\r\n display: flex;\r\n padding: 0 5px 5px;\r\n align-items: center;\r\n }\r\n\r\n #stats-row {\r\n display: flex;\r\n align-items: baseline;\r\n color: ${whiteColor};\r\n flex-direction: column;\r\n margin-left: 10px;\r\n }\r\n `,\r\n ];\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"collection-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/collection-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,gBAAgB,CAAC;AAGjB,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,iBAAiB;IAA9C;QACL;;;;;;;;;;;;;;WAcG;;QAE0B,mBAAc,GAAG,KAAK,CAAC;QAExB,eAAU,GAAe,SAAS,CAAC;IAwJjE,CAAC;IAtJC,MAAM;QACJ,MAAM,gBAAgB,GAAG,QAAQ,CAAC;YAChC,SAAS,EAAE,IAAI;YACf,OAAO,EAAE,IAAI,CAAC,UAAU,KAAK,SAAS;SACvC,CAAC,CAAC;QAEH,OAAO,IAAI,CAAA;mBACI,gBAAgB;UACzB,IAAI,CAAC,kBAAkB;;;cAGnB,IAAI,CAAC,qBAAqB,IAAI,IAAI,CAAC,gBAAgB;;;;UAIvD,IAAI,CAAC,oBAAoB;;KAE9B,CA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E,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAC3C,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED,MAAM,KAAK,MAAM;QACf,MAAM,eAAe,GAAG,GAAG,CAAA,iCAAiC,CAAC;QAC7D,MAAM,mBAAmB,GAAG,GAAG,CAAA,qCAAqC,CAAC;QACrE,MAAM,UAAU,GAAG,GAAG,CAAA,MAAM,CAAC;QAE7B,OAAO;YACL,cAAc;YACd,GAAG,CAAA;;8BAEqB,mBAAmB;8BACnB,eAAe;;;;;;;;;mBAS1B,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;mBA2BV,UAAU;;;;;;;;;;;;;;;;OAgBtB;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA1J8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;sDAAwB;AAExB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAoC;AAnBpD,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA2K1B","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\nimport { classMap } from 'lit/directives/class-map.js';\r\nimport { msg } from '@lit/localize';\r\nimport { collectionIcon } from '../../assets/img/icons/mediatype/collection';\r\nimport { formatUnitSize } from '../../utils/format-unit-size';\r\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\r\nimport { BaseTileComponent } from '../base-tile-component';\r\nimport { LayoutType } from '../models';\r\nimport '../image-block';\r\n\r\n@customElement('collection-tile')\r\nexport class CollectionTile extends BaseTileComponent {\r\n /*\r\n * Reactive properties inherited from BaseTileComponent:\r\n * - model?: TileModel;\r\n * - currentWidth?: number;\r\n * - currentHeight?: number;\r\n * - baseNavigationUrl?: string;\r\n * - baseImageUrl?: string;\r\n * - collectionPagePath?: string;\r\n * - sortParam: SortParam | null = null;\r\n * - creatorFilter?: string;\r\n * - mobileBreakpoint?: number;\r\n * - loggedIn = false;\r\n * - suppressBlurring = false;\r\n * - useLocalTime = false;\r\n */\r\n\r\n @property({ type: Boolean }) showInfoButton = false;\r\n\r\n @property({ type: String }) layoutType: LayoutType = 'default';\r\n\r\n render() {\r\n const containerClasses = classMap({\r\n container: true,\r\n minimal: this.layoutType === 'minimal',\r\n });\r\n\r\n return html`\r\n <div class=${containerClasses}>\r\n ${this.infoButtonTemplate}\r\n <div class=\"tile-details\">\r\n <div class=\"item-info\">\r\n ${this.getImageBlockTemplate} ${this.getTitleTemplate}\r\n </div>\r\n </div>\r\n\r\n ${this.getTileStatsTemplate}\r\n </div>\r\n `;\r\n }\r\n\r\n private get getImageBlockTemplate(): TemplateResult {\r\n return html`\r\n <image-block\r\n .model=${this.model}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .viewSize=${'grid'}\r\n .suppressBlurring=${this.suppressBlurring}\r\n >\r\n </image-block>\r\n `;\r\n }\r\n\r\n private get getTitleTemplate() {\r\n return html`<div id=\"title\">\r\n <h3 class=\"truncated\">${this.model?.title}</h3>\r\n </div>`;\r\n }\r\n\r\n private get getTileStatsTemplate() {\r\n return html`\r\n <div id=\"item-stats\">\r\n <div id=\"item-mediatype\">${collectionIcon}</div>\r\n\r\n <div id=\"stats-row\">\r\n ${this.getItemsTemplate} ${this.getSizeTemplate}\r\n </div>\r\n </div>\r\n `;\r\n }\r\n\r\n private get getItemsTemplate() {\r\n const collectionItems = this.model?.itemCount?.toLocaleString();\r\n\r\n return html`<span id=\"item-count\"\r\n >${collectionItems} item${Number(collectionItems) !== 1 ? 's' : ''}</span\r\n >`;\r\n }\r\n\r\n private get getSizeTemplate() {\r\n const collectionSize = this.model?.collectionSize ?? 0;\r\n\r\n return collectionSize\r\n ? html`<span id=\"item-size\">${formatUnitSize(collectionSize, 1)}</span>`\r\n : ``;\r\n }\r\n\r\n private get infoButtonTemplate(): TemplateResult | typeof nothing {\r\n // &#9432; is an information icon\r\n return this.showInfoButton\r\n ? html`<button class=\"info-button\" @click=${this.infoButtonPressed}>\r\n &#9432;\r\n <span class=\"sr-only\">${msg('More info')}</span>\r\n </button>`\r\n : nothing;\r\n }\r\n\r\n private infoButtonPressed(e: PointerEvent) {\r\n e.preventDefault();\r\n const event = new CustomEvent<{ x: number; y: number }>(\r\n 'infoButtonPressed',\r\n { detail: { x: e.clientX, y: e.clientY } },\r\n );\r\n this.dispatchEvent(event);\r\n }\r\n\r\n static get styles(): CSSResultGroup {\r\n const tileBorderColor = css`var(--tileBorderColor, #555555)`;\r\n const tileBackgroundColor = css`var(--tileBackgroundColor, #666666)`;\r\n const whiteColor = css`#fff`;\r\n\r\n return [\r\n baseTileStyles,\r\n css`\r\n .container {\r\n background-color: ${tileBackgroundColor};\r\n border: 1px solid ${tileBorderColor};\r\n }\r\n\r\n .item-info {\r\n flex-grow: initial;\r\n }\r\n\r\n h4.truncated,\r\n h3.truncated {\r\n color: ${whiteColor};\r\n }\r\n\r\n #item-mediatype svg {\r\n filter: invert(100%);\r\n height: 2.5rem;\r\n align-items: baseline;\r\n }\r\n\r\n .container:hover > #title {\r\n text-decoration: underline;\r\n }\r\n\r\n /* this is a workaround for Safari 15 where the hover effects are not working */\r\n image-block:hover > #title {\r\n text-decoration: underline;\r\n }\r\n\r\n #item-stats {\r\n display: flex;\r\n padding: 0 5px 5px;\r\n align-items: center;\r\n }\r\n\r\n #stats-row {\r\n display: flex;\r\n align-items: baseline;\r\n color: ${whiteColor};\r\n flex-direction: column;\r\n margin-left: 10px;\r\n }\r\n\r\n .minimal #item-stats {\r\n display: none;\r\n }\r\n\r\n .minimal .truncated {\r\n -webkit-line-clamp: initial;\r\n }\r\n\r\n .minimal .item-info {\r\n padding-bottom: 5px;\r\n }\r\n `,\r\n ];\r\n }\r\n}\r\n"]}
@@ -1,6 +1,6 @@
1
1
  import { CSSResultGroup, TemplateResult } from 'lit';
2
2
  import { BaseTileComponent } from '../base-tile-component';
3
- import { SimpleLayoutType } from '../models';
3
+ import { LayoutType } from '../models';
4
4
  import '../image-block';
5
5
  import '../review-block';
6
6
  import '../text-snippet-block';
@@ -10,7 +10,7 @@ import './tile-stats';
10
10
  export declare class ItemTile extends BaseTileComponent {
11
11
  showInfoButton: boolean;
12
12
  showTvClips: boolean;
13
- simpleLayoutType: SimpleLayoutType;
13
+ layoutType: LayoutType;
14
14
  render(): TemplateResult<1>;
15
15
  /**
16
16
  * Templates
@@ -35,15 +35,16 @@ let ItemTile = class ItemTile extends BaseTileComponent {
35
35
  super(...arguments);
36
36
  this.showInfoButton = false;
37
37
  this.showTvClips = false;
38
- this.simpleLayoutType = 'none';
38
+ this.layoutType = 'default';
39
39
  }
40
40
  render() {
41
41
  const itemTitle = this.model?.title;
42
42
  const containerClasses = classMap({
43
43
  container: true,
44
- simple: this.simpleLayoutType !== 'none',
45
- 'stats-only': this.simpleLayoutType === 'stats-only',
46
- 'snippets-only': this.simpleLayoutType === 'snippets-only',
44
+ simple: this.layoutType !== 'default',
45
+ 'stats-only': this.layoutType === 'stats-only',
46
+ 'snippets-only': this.layoutType === 'snippets-only',
47
+ minimal: this.layoutType === 'minimal',
47
48
  });
48
49
  return html `
49
50
  <div class=${containerClasses}>
@@ -158,8 +159,11 @@ let ItemTile = class ItemTile extends BaseTileComponent {
158
159
  `;
159
160
  }
160
161
  get textSnippetsTemplate() {
161
- if (!this.hasSnippets || this.simpleLayoutType === 'stats-only')
162
+ if (!this.hasSnippets)
162
163
  return nothing;
164
+ if (['stats-only', 'minimal'].includes(this.layoutType)) {
165
+ return nothing;
166
+ }
163
167
  return html `
164
168
  <text-snippet-block viewsize="grid" .snippets=${this.model?.snippets}>
165
169
  </text-snippet-block>
@@ -191,8 +195,9 @@ let ItemTile = class ItemTile extends BaseTileComponent {
191
195
  * Template for the stats row along the bottom of the tile.
192
196
  */
193
197
  get tileStatsTemplate() {
194
- if (this.simpleLayoutType === 'snippets-only')
198
+ if (['snippets-only', 'minimal'].includes(this.layoutType)) {
195
199
  return nothing;
200
+ }
196
201
  const effectiveSort = this.sortParam ?? this.defaultSortParam;
197
202
  const [viewCount, viewLabel] = effectiveSort?.field === 'week'
198
203
  ? [this.model?.weeklyViewCount, 'weekly views']
@@ -258,7 +263,8 @@ let ItemTile = class ItemTile extends BaseTileComponent {
258
263
  -webkit-line-clamp: 1;
259
264
  }
260
265
 
261
- .simple.snippets-only .item-info {
266
+ .simple.snippets-only .item-info,
267
+ .simple.minimal .item-info {
262
268
  padding-bottom: 5px;
263
269
  }
264
270
 
@@ -303,7 +309,7 @@ __decorate([
303
309
  ], ItemTile.prototype, "showTvClips", void 0);
304
310
  __decorate([
305
311
  property({ type: String })
306
- ], ItemTile.prototype, "simpleLayoutType", void 0);
312
+ ], ItemTile.prototype, "layoutType", void 0);
307
313
  ItemTile = __decorate([
308
314
  customElement('item-tile')
309
315
  ], ItemTile);
@@ -1 +1 @@
1
- {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,gBAA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,IAAI,IAAI,CAAC,gBAAgB,CAAC;IACjD,CAAC;IAED,IAAY,WAAW;QACrB,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC;IACxC,CAAC;IAEO,iBAAiB,CAAC,CAAe;QACvC,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,IAAI,WAAW,CAC3B,mBAAmB,EACnB,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAC3C,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,MAAM;QACf,MAAM,eAAe,GAAG,GAAG,CAAA,iCAAiC,CAAC;QAE7D,OAAO;YACL,cAAc;YACd,GAAG,CAAA;;;;;;;;;;8BAUqB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CtC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AA3S8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAwB;AAEvB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAqB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAA6C;AAtB7D,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CA6TpB","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\nimport { ifDefined } from 'lit/directives/if-defined.js';\r\nimport { map } from 'lit/directives/map.js';\r\nimport { classMap } from 'lit/directives/class-map.js';\r\nimport { msg } from '@lit/localize';\r\n\r\nimport type { SortParam } from '@internetarchive/search-service';\r\nimport type { DateFormat } from '../../utils/format-date';\r\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\r\nimport { BaseTileComponent } from '../base-tile-component';\r\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\r\nimport { SimpleLayoutType } from '../models';\r\n\r\nimport '../image-block';\r\nimport '../review-block';\r\nimport '../text-snippet-block';\r\nimport '../item-image';\r\nimport '../tile-mediatype-icon';\r\nimport './tile-stats';\r\n\r\n@customElement('item-tile')\r\nexport class ItemTile extends BaseTileComponent {\r\n /*\r\n * Reactive properties inherited from BaseTileComponent:\r\n * - model?: TileModel;\r\n * - currentWidth?: number;\r\n * - currentHeight?: number;\r\n * - baseNavigationUrl?: string;\r\n * - baseImageUrl?: string;\r\n * - collectionPagePath?: string;\r\n * - sortParam: SortParam | null = null;\r\n * - defaultSortParam: SortParam | null = null;\r\n * - creatorFilter?: string;\r\n * - mobileBreakpoint?: number;\r\n * - loggedIn = false;\r\n * - suppressBlurring = false;\r\n * - useLocalTime = false;\r\n */\r\n\r\n @property({ type: Boolean }) showInfoButton = false;\r\n\r\n @property({ type: Boolean }) showTvClips = false;\r\n\r\n @property({ type: String }) simpleLayoutType: SimpleLayoutType = 'none';\r\n\r\n render() {\r\n const itemTitle = this.model?.title;\r\n const containerClasses = classMap({\r\n container: true,\r\n simple: this.simpleLayoutType !== 'none',\r\n 'stats-only': this.simpleLayoutType === 'stats-only',\r\n 'snippets-only': this.simpleLayoutType === 'snippets-only',\r\n });\r\n\r\n return html`\r\n <div class=${containerClasses}>\r\n ${this.infoButtonTemplate}\r\n <div class=\"tile-details\">\r\n <div class=\"item-info\">\r\n ${this.imageBlockTemplate}\r\n\r\n <div id=\"title\">\r\n <h3 class=\"truncated\" title=${ifDefined(itemTitle)}>\r\n ${itemTitle}\r\n </h3>\r\n </div>\r\n\r\n ${this.volumeIssueTemplate}\r\n ${this.isSortedByDate\r\n ? this.sortedDateInfoTemplate\r\n : this.creatorTemplate}\r\n ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}\r\n ${this.reviewBlockTemplate}\r\n </div>\r\n\r\n ${this.tileStatsTemplate}\r\n </div>\r\n </div>\r\n `;\r\n }\r\n\r\n /**\r\n * Templates\r\n */\r\n private get creatorTemplate(): TemplateResult | typeof nothing {\r\n const displayedCreator =\r\n this.displayValueProvider.firstCreatorMatchingFilter;\r\n if (!displayedCreator) return nothing;\r\n\r\n return html`\r\n <div class=\"created-by\">\r\n <span class=\"truncated\" title=${displayedCreator}>\r\n by&nbsp;${displayedCreator}\r\n </span>\r\n </div>\r\n `;\r\n }\r\n\r\n private get imageBlockTemplate(): TemplateResult {\r\n return html`\r\n <image-block\r\n .model=${this.model}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .loggedIn=${this.loggedIn}\r\n .suppressBlurring=${this.suppressBlurring}\r\n .isCompactTile=${false}\r\n .isListTile=${false}\r\n .viewSize=${'grid'}\r\n >\r\n </image-block>\r\n `;\r\n }\r\n\r\n private get sortedDateInfoTemplate() {\r\n let sortedValue;\r\n let format: DateFormat = 'long';\r\n switch (this.effectiveSort?.field) {\r\n case 'date': {\r\n const datePublished = this.model?.datePublished;\r\n sortedValue = { field: 'published', value: datePublished };\r\n if (isFirstMillisecondOfUTCYear(datePublished)) {\r\n format = 'year-only';\r\n }\r\n break;\r\n }\r\n case 'reviewdate':\r\n sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };\r\n break;\r\n case 'addeddate':\r\n sortedValue = { field: 'added', value: this.model?.dateAdded };\r\n break;\r\n case 'publicdate':\r\n sortedValue = { field: 'archived', value: this.model?.dateArchived };\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n if (!sortedValue?.value) {\r\n return nothing;\r\n }\r\n\r\n const formattedDate = this.getFormattedDate(sortedValue.value, format);\r\n return html`\r\n <div class=\"date-sorted-by truncated\">\r\n <span>${sortedValue.field} ${formattedDate}</span>\r\n </div>\r\n `;\r\n }\r\n\r\n private get infoButtonTemplate(): TemplateResult | typeof nothing {\r\n // &#9432; is an information icon\r\n return this.showInfoButton\r\n ? html`<button class=\"info-button\" @click=${this.infoButtonPressed}>\r\n &#9432;\r\n <span class=\"sr-only\">${msg('More info')}</span>\r\n </button>`\r\n : nothing;\r\n }\r\n\r\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\r\n if (!this.model?.review) return nothing;\r\n\r\n const { reviewtitle, reviewbody, stars } = this.model.review;\r\n return html`\r\n <review-block\r\n viewsize=\"grid\"\r\n title=${ifDefined(reviewtitle)}\r\n body=${ifDefined(reviewbody)}\r\n starRating=${ifDefined(stars)}\r\n >\r\n </review-block>\r\n `;\r\n }\r\n\r\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\r\n if (!this.hasSnippets || this.simpleLayoutType === 'stats-only')\r\n return nothing;\r\n\r\n return html`\r\n <text-snippet-block viewsize=\"grid\" .snippets=${this.model?.snippets}>\r\n </text-snippet-block>\r\n `;\r\n }\r\n\r\n private get volumeIssueTemplate(): TemplateResult | typeof nothing {\r\n if (!this.model?.volume || !this.model?.issue) return nothing;\r\n\r\n return html`\r\n <div class=\"volume-issue\">\r\n <span class=\"truncated\" title=\"volume|issue\">\r\n Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}\r\n </span>\r\n </div>\r\n `;\r\n }\r\n\r\n private get webArchivesCaptureDatesTemplate():\r\n | TemplateResult\r\n | typeof nothing {\r\n if (!this.model?.captureDates || !this.model.title) return nothing;\r\n\r\n return html`\r\n <ul class=\"capture-dates\">\r\n ${map(\r\n this.model.captureDates,\r\n date =>\r\n html`<li>\r\n ${this.displayValueProvider.webArchivesCaptureLink(\r\n this.model!.title,\r\n date,\r\n )}\r\n </li>`,\r\n )}\r\n </ul>\r\n `;\r\n }\r\n\r\n /**\r\n * Template for the stats row along the bottom of the tile.\r\n */\r\n private get tileStatsTemplate(): TemplateResult | typeof nothing {\r\n if (this.simpleLayoutType === 'snippets-only') return nothing;\r\n\r\n const effectiveSort = this.sortParam ?? this.defaultSortParam;\r\n const [viewCount, viewLabel] =\r\n effectiveSort?.field === 'week'\r\n ? [this.model?.weeklyViewCount, 'weekly views']\r\n : [this.model?.viewCount, 'all-time views'];\r\n\r\n return html`\r\n <tile-stats\r\n .model=${this.model}\r\n .mediatype=${this.model?.mediatype}\r\n .viewCount=${viewCount}\r\n .viewLabel=${viewLabel}\r\n .favCount=${this.model?.favCount}\r\n .commentCount=${this.model?.commentCount}\r\n .tvClipCount=${this.model?.tvClipCount}\r\n .showTvClips=${this.showTvClips}\r\n >\r\n </tile-stats>\r\n `;\r\n }\r\n\r\n private get isSortedByDate(): boolean {\r\n return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(\r\n this.effectiveSort?.field as string,\r\n );\r\n }\r\n\r\n /**\r\n * Returns the active sort param if one is set, or the default sort param otherwise.\r\n */\r\n private get effectiveSort(): SortParam | null {\r\n return this.sortParam ?? this.defaultSortParam;\r\n }\r\n\r\n private get hasSnippets(): boolean {\r\n return !!this.model?.snippets?.length;\r\n }\r\n\r\n private infoButtonPressed(e: PointerEvent): void {\r\n e.preventDefault();\r\n const event = new CustomEvent<{ x: number; y: number }>(\r\n 'infoButtonPressed',\r\n { detail: { x: e.clientX, y: e.clientY } },\r\n );\r\n this.dispatchEvent(event);\r\n }\r\n\r\n /**\r\n * CSS\r\n */\r\n static get styles(): CSSResultGroup {\r\n const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;\r\n\r\n return [\r\n baseTileStyles,\r\n css`\r\n a:link {\r\n text-decoration: none;\r\n color: var(--ia-theme-link-color, #4b64ff);\r\n }\r\n a:hover {\r\n text-decoration: underline;\r\n }\r\n\r\n .container {\r\n border: 1px solid ${tileBorderColor};\r\n }\r\n\r\n .simple #title > .truncated {\r\n -webkit-line-clamp: 2;\r\n }\r\n\r\n .simple .created-by > .truncated,\r\n .simple .date-sorted-by > .truncated,\r\n .simple .volume-issue > .truncated {\r\n -webkit-line-clamp: 1;\r\n }\r\n\r\n .simple.snippets-only .item-info {\r\n padding-bottom: 5px;\r\n }\r\n\r\n .simple.snippets-only text-snippet-block {\r\n margin-top: auto; /* Force the snippets to the bottom of the tile */\r\n }\r\n\r\n .capture-dates {\r\n margin: 0;\r\n padding: 0 5px;\r\n list-style-type: none;\r\n }\r\n\r\n review-block,\r\n text-snippet-block {\r\n --containerLeftMargin: 5px;\r\n --containerTopMargin: 5px;\r\n }\r\n\r\n /**\r\n * iOS Safari long-press on tiles (to bring up hover pane)\r\n * gets messy without this\r\n */\r\n @media screen and (pointer: coarse) and (hover: none) {\r\n .container {\r\n -webkit-touch-callout: none;\r\n }\r\n\r\n .truncated {\r\n -webkit-touch-callout: default;\r\n }\r\n }\r\n `,\r\n ];\r\n }\r\n}\r\n"]}
1
+ {"version":3,"file":"item-tile.js","sourceRoot":"","sources":["../../../../src/tiles/grid/item-tile.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAIpC,OAAO,EAAE,2BAA2B,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAGlE,OAAO,gBAAgB,CAAC;AACxB,OAAO,iBAAiB,CAAC;AACzB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,eAAe,CAAC;AACvB,OAAO,wBAAwB,CAAC;AAChC,OAAO,cAAc,CAAC;AAGf,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,iBAAiB;IAAxC;QACL;;;;;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AAC,gBAAgB,CAAC;IACjD,CAAC;IAED,IAAY,WAAW;QACrB,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,CAAC;IACxC,CAAC;IAEO,iBAAiB,CAAC,CAAe;QACvC,CAAC,CAAC,cAAc,EAAE,CAAC;QACnB,MAAM,KAAK,GAAG,IAAI,WAAW,CAC3B,mBAAmB,EACnB,EAAE,MAAM,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,OAAO,EAAE,EAAE,CAC3C,CAAC;QACF,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,MAAM,KAAK,MAAM;QACf,MAAM,eAAe,GAAG,GAAG,CAAA,iCAAiC,CAAC;QAE7D,OAAO;YACL,cAAc;YACd,GAAG,CAAA;;;;;;;;;;8BAUqB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+CtC;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAjT8B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAwB;AAEvB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;6CAAqB;AAErB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoC;AAtBpD,QAAQ;IADpB,aAAa,CAAC,WAAW,CAAC;GACd,QAAQ,CAmUpB","sourcesContent":["import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';\r\nimport { customElement, property } from 'lit/decorators.js';\r\nimport { ifDefined } from 'lit/directives/if-defined.js';\r\nimport { map } from 'lit/directives/map.js';\r\nimport { classMap } from 'lit/directives/class-map.js';\r\nimport { msg } from '@lit/localize';\r\n\r\nimport type { SortParam } from '@internetarchive/search-service';\r\nimport type { DateFormat } from '../../utils/format-date';\r\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\r\nimport { BaseTileComponent } from '../base-tile-component';\r\nimport { baseTileStyles } from './styles/tile-grid-shared-styles';\r\nimport { LayoutType } from '../models';\r\n\r\nimport '../image-block';\r\nimport '../review-block';\r\nimport '../text-snippet-block';\r\nimport '../item-image';\r\nimport '../tile-mediatype-icon';\r\nimport './tile-stats';\r\n\r\n@customElement('item-tile')\r\nexport class ItemTile extends BaseTileComponent {\r\n /*\r\n * Reactive properties inherited from BaseTileComponent:\r\n * - model?: TileModel;\r\n * - currentWidth?: number;\r\n * - currentHeight?: number;\r\n * - baseNavigationUrl?: string;\r\n * - baseImageUrl?: string;\r\n * - collectionPagePath?: string;\r\n * - sortParam: SortParam | null = null;\r\n * - defaultSortParam: SortParam | null = null;\r\n * - creatorFilter?: string;\r\n * - mobileBreakpoint?: number;\r\n * - loggedIn = false;\r\n * - suppressBlurring = false;\r\n * - useLocalTime = false;\r\n */\r\n\r\n @property({ type: Boolean }) showInfoButton = false;\r\n\r\n @property({ type: Boolean }) showTvClips = false;\r\n\r\n @property({ type: String }) layoutType: LayoutType = 'default';\r\n\r\n render() {\r\n const itemTitle = this.model?.title;\r\n const containerClasses = classMap({\r\n container: true,\r\n simple: this.layoutType !== 'default',\r\n 'stats-only': this.layoutType === 'stats-only',\r\n 'snippets-only': this.layoutType === 'snippets-only',\r\n minimal: this.layoutType === 'minimal',\r\n });\r\n\r\n return html`\r\n <div class=${containerClasses}>\r\n ${this.infoButtonTemplate}\r\n <div class=\"tile-details\">\r\n <div class=\"item-info\">\r\n ${this.imageBlockTemplate}\r\n\r\n <div id=\"title\">\r\n <h3 class=\"truncated\" title=${ifDefined(itemTitle)}>\r\n ${itemTitle}\r\n </h3>\r\n </div>\r\n\r\n ${this.volumeIssueTemplate}\r\n ${this.isSortedByDate\r\n ? this.sortedDateInfoTemplate\r\n : this.creatorTemplate}\r\n ${this.webArchivesCaptureDatesTemplate} ${this.textSnippetsTemplate}\r\n ${this.reviewBlockTemplate}\r\n </div>\r\n\r\n ${this.tileStatsTemplate}\r\n </div>\r\n </div>\r\n `;\r\n }\r\n\r\n /**\r\n * Templates\r\n */\r\n private get creatorTemplate(): TemplateResult | typeof nothing {\r\n const displayedCreator =\r\n this.displayValueProvider.firstCreatorMatchingFilter;\r\n if (!displayedCreator) return nothing;\r\n\r\n return html`\r\n <div class=\"created-by\">\r\n <span class=\"truncated\" title=${displayedCreator}>\r\n by&nbsp;${displayedCreator}\r\n </span>\r\n </div>\r\n `;\r\n }\r\n\r\n private get imageBlockTemplate(): TemplateResult {\r\n return html`\r\n <image-block\r\n .model=${this.model}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .loggedIn=${this.loggedIn}\r\n .suppressBlurring=${this.suppressBlurring}\r\n .isCompactTile=${false}\r\n .isListTile=${false}\r\n .viewSize=${'grid'}\r\n >\r\n </image-block>\r\n `;\r\n }\r\n\r\n private get sortedDateInfoTemplate() {\r\n let sortedValue;\r\n let format: DateFormat = 'long';\r\n switch (this.effectiveSort?.field) {\r\n case 'date': {\r\n const datePublished = this.model?.datePublished;\r\n sortedValue = { field: 'published', value: datePublished };\r\n if (isFirstMillisecondOfUTCYear(datePublished)) {\r\n format = 'year-only';\r\n }\r\n break;\r\n }\r\n case 'reviewdate':\r\n sortedValue = { field: 'reviewed', value: this.model?.dateReviewed };\r\n break;\r\n case 'addeddate':\r\n sortedValue = { field: 'added', value: this.model?.dateAdded };\r\n break;\r\n case 'publicdate':\r\n sortedValue = { field: 'archived', value: this.model?.dateArchived };\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n if (!sortedValue?.value) {\r\n return nothing;\r\n }\r\n\r\n const formattedDate = this.getFormattedDate(sortedValue.value, format);\r\n return html`\r\n <div class=\"date-sorted-by truncated\">\r\n <span>${sortedValue.field} ${formattedDate}</span>\r\n </div>\r\n `;\r\n }\r\n\r\n private get infoButtonTemplate(): TemplateResult | typeof nothing {\r\n // &#9432; is an information icon\r\n return this.showInfoButton\r\n ? html`<button class=\"info-button\" @click=${this.infoButtonPressed}>\r\n &#9432;\r\n <span class=\"sr-only\">${msg('More info')}</span>\r\n </button>`\r\n : nothing;\r\n }\r\n\r\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\r\n if (!this.model?.review) return nothing;\r\n\r\n const { reviewtitle, reviewbody, stars } = this.model.review;\r\n return html`\r\n <review-block\r\n viewsize=\"grid\"\r\n title=${ifDefined(reviewtitle)}\r\n body=${ifDefined(reviewbody)}\r\n starRating=${ifDefined(stars)}\r\n >\r\n </review-block>\r\n `;\r\n }\r\n\r\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\r\n if (!this.hasSnippets) return nothing;\r\n if (['stats-only', 'minimal'].includes(this.layoutType)) {\r\n return nothing;\r\n }\r\n\r\n return html`\r\n <text-snippet-block viewsize=\"grid\" .snippets=${this.model?.snippets}>\r\n </text-snippet-block>\r\n `;\r\n }\r\n\r\n private get volumeIssueTemplate(): TemplateResult | typeof nothing {\r\n if (!this.model?.volume || !this.model?.issue) return nothing;\r\n\r\n return html`\r\n <div class=\"volume-issue\">\r\n <span class=\"truncated\" title=\"volume|issue\">\r\n Volume&nbsp;${this.model?.volume}, Issue&nbsp;${this.model?.issue}\r\n </span>\r\n </div>\r\n `;\r\n }\r\n\r\n private get webArchivesCaptureDatesTemplate():\r\n | TemplateResult\r\n | typeof nothing {\r\n if (!this.model?.captureDates || !this.model.title) return nothing;\r\n\r\n return html`\r\n <ul class=\"capture-dates\">\r\n ${map(\r\n this.model.captureDates,\r\n date =>\r\n html`<li>\r\n ${this.displayValueProvider.webArchivesCaptureLink(\r\n this.model!.title,\r\n date,\r\n )}\r\n </li>`,\r\n )}\r\n </ul>\r\n `;\r\n }\r\n\r\n /**\r\n * Template for the stats row along the bottom of the tile.\r\n */\r\n private get tileStatsTemplate(): TemplateResult | typeof nothing {\r\n if (['snippets-only', 'minimal'].includes(this.layoutType)) {\r\n return nothing;\r\n }\r\n\r\n const effectiveSort = this.sortParam ?? this.defaultSortParam;\r\n const [viewCount, viewLabel] =\r\n effectiveSort?.field === 'week'\r\n ? [this.model?.weeklyViewCount, 'weekly views']\r\n : [this.model?.viewCount, 'all-time views'];\r\n\r\n return html`\r\n <tile-stats\r\n .model=${this.model}\r\n .mediatype=${this.model?.mediatype}\r\n .viewCount=${viewCount}\r\n .viewLabel=${viewLabel}\r\n .favCount=${this.model?.favCount}\r\n .commentCount=${this.model?.commentCount}\r\n .tvClipCount=${this.model?.tvClipCount}\r\n .showTvClips=${this.showTvClips}\r\n >\r\n </tile-stats>\r\n `;\r\n }\r\n\r\n private get isSortedByDate(): boolean {\r\n return ['date', 'reviewdate', 'addeddate', 'publicdate'].includes(\r\n this.effectiveSort?.field as string,\r\n );\r\n }\r\n\r\n /**\r\n * Returns the active sort param if one is set, or the default sort param otherwise.\r\n */\r\n private get effectiveSort(): SortParam | null {\r\n return this.sortParam ?? this.defaultSortParam;\r\n }\r\n\r\n private get hasSnippets(): boolean {\r\n return !!this.model?.snippets?.length;\r\n }\r\n\r\n private infoButtonPressed(e: PointerEvent): void {\r\n e.preventDefault();\r\n const event = new CustomEvent<{ x: number; y: number }>(\r\n 'infoButtonPressed',\r\n { detail: { x: e.clientX, y: e.clientY } },\r\n );\r\n this.dispatchEvent(event);\r\n }\r\n\r\n /**\r\n * CSS\r\n */\r\n static get styles(): CSSResultGroup {\r\n const tileBorderColor = css`var(--tileBorderColor, #dddddd)`;\r\n\r\n return [\r\n baseTileStyles,\r\n css`\r\n a:link {\r\n text-decoration: none;\r\n color: var(--ia-theme-link-color, #4b64ff);\r\n }\r\n a:hover {\r\n text-decoration: underline;\r\n }\r\n\r\n .container {\r\n border: 1px solid ${tileBorderColor};\r\n }\r\n\r\n .simple #title > .truncated {\r\n -webkit-line-clamp: 2;\r\n }\r\n\r\n .simple .created-by > .truncated,\r\n .simple .date-sorted-by > .truncated,\r\n .simple .volume-issue > .truncated {\r\n -webkit-line-clamp: 1;\r\n }\r\n\r\n .simple.snippets-only .item-info,\r\n .simple.minimal .item-info {\r\n padding-bottom: 5px;\r\n }\r\n\r\n .simple.snippets-only text-snippet-block {\r\n margin-top: auto; /* Force the snippets to the bottom of the tile */\r\n }\r\n\r\n .capture-dates {\r\n margin: 0;\r\n padding: 0 5px;\r\n list-style-type: none;\r\n }\r\n\r\n review-block,\r\n text-snippet-block {\r\n --containerLeftMargin: 5px;\r\n --containerTopMargin: 5px;\r\n }\r\n\r\n /**\r\n * iOS Safari long-press on tiles (to bring up hover pane)\r\n * gets messy without this\r\n */\r\n @media screen and (pointer: coarse) and (hover: none) {\r\n .container {\r\n -webkit-touch-callout: none;\r\n }\r\n\r\n .truncated {\r\n -webkit-touch-callout: default;\r\n }\r\n }\r\n `,\r\n ];\r\n }\r\n}\r\n"]}
@@ -1 +1,8 @@
1
- export type SimpleLayoutType = 'none' | 'stats-only' | 'snippets-only';
1
+ /**
2
+ * What type of simplified tile layout to use.
3
+ * - `default`: Do not apply any layout simplifications.
4
+ * - `stats-only`: Only show the tile stats row, but not text snippets.
5
+ * - `snippets-only`: Only show the text snippets row (if snippets exist), but not tile stats.
6
+ * - `minimal`: Show neither tile stats nor the text snippets.
7
+ */
8
+ export type LayoutType = 'default' | 'stats-only' | 'snippets-only' | 'minimal';
@@ -1 +1 @@
1
- {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/tiles/models.ts"],"names":[],"mappings":"","sourcesContent":["export type SimpleLayoutType = 'none' | 'stats-only' | 'snippets-only';\r\n"]}
1
+ {"version":3,"file":"models.js","sourceRoot":"","sources":["../../../src/tiles/models.ts"],"names":[],"mappings":"","sourcesContent":["/**\r\n * What type of simplified tile layout to use.\r\n * - `default`: Do not apply any layout simplifications.\r\n * - `stats-only`: Only show the tile stats row, but not text snippets.\r\n * - `snippets-only`: Only show the text snippets row (if snippets exist), but not tile stats.\r\n * - `minimal`: Show neither tile stats nor the text snippets.\r\n */\r\nexport type LayoutType = 'default' | 'stats-only' | 'snippets-only' | 'minimal';\r\n"]}
@@ -12,7 +12,7 @@ import './list/tile-list-compact';
12
12
  import './list/tile-list-compact-header';
13
13
  import type { TileHoverPane } from './hover/tile-hover-pane';
14
14
  import { BaseTileComponent } from './base-tile-component';
15
- import { SimpleLayoutType } from './models';
15
+ import { LayoutType } from './models';
16
16
  import { HoverPaneProperties, HoverPaneProviderInterface } from './hover/hover-pane-controller';
17
17
  export declare class TileDispatcher extends BaseTileComponent implements SharedResizeObserverResizeHandlerInterface, HoverPaneProviderInterface {
18
18
  tileDisplayMode?: TileDisplayMode;
@@ -20,8 +20,8 @@ export declare class TileDispatcher extends BaseTileComponent implements SharedR
20
20
  resizeObserver?: SharedResizeObserverInterface;
21
21
  collectionTitles?: CollectionTitles;
22
22
  showTvClips: boolean;
23
- /** What type of simple layout to use in grid mode, if any */
24
- simpleLayoutType: SimpleLayoutType;
23
+ /** What type of simplified layout to use in grid mode, if any */
24
+ layoutType: LayoutType;
25
25
  /** Whether this tile should include a hover pane at all (for applicable tile modes) */
26
26
  enableHoverPane: boolean;
27
27
  manageCheckTitle: string;
@@ -36,8 +36,8 @@ let TileDispatcher = class TileDispatcher extends BaseTileComponent {
36
36
  super(...arguments);
37
37
  this.isManageView = false;
38
38
  this.showTvClips = false;
39
- /** What type of simple layout to use in grid mode, if any */
40
- this.simpleLayoutType = 'none';
39
+ /** What type of simplified layout to use in grid mode, if any */
40
+ this.layoutType = 'default';
41
41
  /** Whether this tile should include a hover pane at all (for applicable tile modes) */
42
42
  this.enableHoverPane = false;
43
43
  this.manageCheckTitle = msg('Remove this item from the list');
@@ -235,6 +235,7 @@ let TileDispatcher = class TileDispatcher extends BaseTileComponent {
235
235
  .creatorFilter=${creatorFilter}
236
236
  .suppressBlurring=${this.suppressBlurring}
237
237
  .isManageView=${this.isManageView}
238
+ .layoutType=${this.layoutType}
238
239
  ?showInfoButton=${!this.isHoverEnabled}
239
240
  @infoButtonPressed=${this.tileInfoButtonPressed}
240
241
  >
@@ -280,7 +281,7 @@ let TileDispatcher = class TileDispatcher extends BaseTileComponent {
280
281
  .loggedIn=${this.loggedIn}
281
282
  .suppressBlurring=${this.suppressBlurring}
282
283
  .isManageView=${this.isManageView}
283
- .simpleLayoutType=${this.simpleLayoutType}
284
+ .layoutType=${this.layoutType}
284
285
  ?showTvClips=${this.showTvClips}
285
286
  ?showInfoButton=${!this.isHoverEnabled}
286
287
  ?useLocalTime=${this.useLocalTime}
@@ -441,7 +442,7 @@ __decorate([
441
442
  ], TileDispatcher.prototype, "showTvClips", void 0);
442
443
  __decorate([
443
444
  property({ type: String })
444
- ], TileDispatcher.prototype, "simpleLayoutType", void 0);
445
+ ], TileDispatcher.prototype, "layoutType", void 0);
445
446
  __decorate([
446
447
  property({ type: Boolean })
447
448
  ], TileDispatcher.prototype, "enableHoverPane", void 0);