@internetarchive/collection-browser 1.9.1-alpha.2 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/src/collection-browser.d.ts +3 -1
- package/dist/src/collection-browser.js +26 -14
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/models.d.ts +1 -0
- package/dist/src/models.js +13 -0
- package/dist/src/models.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +7 -0
- package/dist/src/sort-filter-bar/sort-filter-bar.js +21 -4
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +1 -1
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +1 -5
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/collection-browser.test.js +19 -0
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/mocks/mock-search-responses.d.ts +1 -0
- package/dist/test/mocks/mock-search-responses.js +42 -0
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/dist/test/mocks/mock-search-service.js +2 -1
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/package.json +1 -1
- package/src/collection-browser.ts +29 -14
- package/src/models.ts +13 -0
- package/src/sort-filter-bar/sort-filter-bar.ts +22 -4
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +1 -1
- package/src/tiles/grid/tile-stats.ts +1 -1
- package/src/tiles/tile-dispatcher.ts +1 -5
- package/test/collection-browser.test.ts +25 -0
- package/test/mocks/mock-search-responses.ts +46 -0
- package/test/mocks/mock-search-service.ts +2 -0
package/dist/src/models.d.ts
CHANGED
package/dist/src/models.js
CHANGED
|
@@ -14,6 +14,7 @@ export var SortField;
|
|
|
14
14
|
SortField["datearchived"] = "datearchived";
|
|
15
15
|
SortField["datereviewed"] = "datereviewed";
|
|
16
16
|
SortField["dateadded"] = "dateadded";
|
|
17
|
+
SortField["datefavorited"] = "datefavorited";
|
|
17
18
|
SortField["creator"] = "creator";
|
|
18
19
|
})(SortField || (SortField = {}));
|
|
19
20
|
export const SORT_OPTIONS = {
|
|
@@ -23,6 +24,7 @@ export const SORT_OPTIONS = {
|
|
|
23
24
|
// For collection pages _without a query_, the default is usually weekly views, but this can be
|
|
24
25
|
// overridden by the collection's `sort-by` metadata entry. If a query _is_ specified, then the
|
|
25
26
|
// default is again relevance sort.
|
|
27
|
+
// For fav-* collections only, the default is instead sorting by date favorited.
|
|
26
28
|
[SortField.default]: {
|
|
27
29
|
field: SortField.default,
|
|
28
30
|
defaultSortDirection: null,
|
|
@@ -137,6 +139,17 @@ export const SORT_OPTIONS = {
|
|
|
137
139
|
displayName: 'Date added',
|
|
138
140
|
urlNames: ['addeddate'],
|
|
139
141
|
},
|
|
142
|
+
[SortField.datefavorited]: {
|
|
143
|
+
field: SortField.datefavorited,
|
|
144
|
+
defaultSortDirection: 'desc',
|
|
145
|
+
canSetDirection: false,
|
|
146
|
+
shownInSortBar: true,
|
|
147
|
+
shownInURL: false,
|
|
148
|
+
handledBySearchService: false,
|
|
149
|
+
searchServiceKey: 'favoritedate',
|
|
150
|
+
displayName: 'Date favorited',
|
|
151
|
+
urlNames: ['favoritedate'],
|
|
152
|
+
},
|
|
140
153
|
[SortField.creator]: {
|
|
141
154
|
field: SortField.creator,
|
|
142
155
|
defaultSortDirection: 'asc',
|
package/dist/src/models.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,GAEpB,MAAM,iCAAiC,CAAC;AAiDzC;;GAEG;AACH,MAAM,CAAN,IAAY,SAYX;AAZD,WAAY,SAAS;IACnB,gCAAqB,CAAA;IACrB,0CA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O,EAAE,IAAI;CACd,CAAC","sourcesContent":["import type { MediaType } from '@internetarchive/field-parsers';\nimport {\n AggregationSortType,\n SortDirection,\n} from '@internetarchive/search-service';\n\nexport interface TileModel {\n averageRating?: number;\n collectionIdentifier?: string;\n collectionName?: string;\n collectionFilesCount: number;\n collections: string[];\n collectionSize: number;\n commentCount: number;\n creator?: string;\n creators: string[];\n dateAdded?: Date; // Date added to public search (software-defined) [from: addeddate]\n dateArchived?: Date; // Date archived (software-defined) item created on archive.org [from: publicdate]\n datePublished?: Date; // Date work published in the world (user-defined) [from: date]\n dateReviewed?: Date; // Date reviewed (user-created) most recent review [from: reviewdate]\n description?: string;\n favCount: number;\n href?: string;\n identifier: string;\n issue?: string;\n itemCount: number;\n mediatype: MediaType;\n source?: string;\n snippets?: string[];\n subjects: string[];\n title: string;\n viewCount: number;\n volume?: string;\n weeklyViewCount?: number;\n loginRequired: boolean;\n contentWarning: boolean;\n}\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, etc).\n */\nexport type CollectionBrowserContext = 'collection' | 'search';\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 'creator' = 'creator',\n}\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 [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.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\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\nexport type FacetOption =\n | 'subject'\n | 'lending'\n | 'mediatype'\n | 'language'\n | 'creator'\n | 'collection'\n | 'year';\n\nexport type SelectedFacetState = 'selected' | 'hidden';\n\nexport type FacetState = SelectedFacetState | 'none';\n\nexport interface FacetBucket {\n // for some facets, we augment the key with a display value\n displayText?: string;\n key: string;\n count: number;\n state: FacetState;\n}\n\nexport interface FacetGroup {\n title: string;\n key: FacetOption;\n buckets: FacetBucket[];\n}\n\nexport type FacetEventDetails = {\n key: FacetOption;\n state: FacetState;\n negative: boolean;\n};\n\nexport type FacetValue = string;\n\nexport type SelectedFacets = Record<\n FacetOption,\n Record<FacetValue, FacetBucket>\n>;\n\nexport const getDefaultSelectedFacets = (): SelectedFacets => ({\n subject: {},\n lending: {},\n mediatype: {},\n language: {},\n creator: {},\n collection: {},\n year: {},\n});\n\nexport const facetDisplayOrder: FacetOption[] = [\n 'mediatype',\n 'lending',\n 'year',\n 'subject',\n 'collection',\n 'creator',\n 'language',\n];\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};\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,\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,\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"]}
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/models.ts"],"names":[],"mappings":"AACA,OAAO,EACL,mBAAmB,GAEpB,MAAM,iCAAiC,CAAC;AAiDzC;;GAEG;AACH,MAAM,CAAN,IAAY,SAaX;AAbD,WAAY,SAAS;IACnB,gCAAqB,CAAA;IACrB,0CAA+B,CAAA;IAC/B,oCAAyB,CAAA;IACzB,wCAA6B,CAAA;IAC7B,sCAA2B,CAAA;IAC3B,4BAAiB,CAAA;IACjB,0BAAe,CAAA;IACf,0CAA+B,CAAA;IAC/B,0CAA+B,CAAA;IAC/B,oCAAyB,CAAA;IACzB,4CAAiC,CAAA;IACjC,gCAAqB,CAAA;AACvB,CAAC,EAbW,SAAS,KAAT,SAAS,QAapB;AAsDD,MAAM,CAAC,MAAM,YAAY,GAAkC;IACzD,mGAAmG;IACnG,iEAAiE;IACjE,6DAA6D;IAC7D,+FAA+F;IAC/F,+FAA+F;IAC/F,mCAAmC;IACnC,gFAAgF;IAChF,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE;QACnB,KAAK,EAAE,SAAS,CAAC,OAAO;QACxB,oBAAoB,EAAE,IAAI;QAC1B,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,KAAK;QACrB,UAAU,EAAE,KAAK;QACjB,sBAAsB,EAAE,KAAK;QAC7B,WAAW,EAAE,EAAE;QACf,QAAQ,EAAE,CAAC,EAAE,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,yDAAyD;KAC3F;IACD,8FAA8F;IAC9F,8FAA8F;IAC9F,2FAA2F;IAC3F,2DAA2D;IAC3D,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE;QACxB,KAAK,EAAE,SAAS,CAAC,YAAY;QAC7B,oBAAoB,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AC;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 { MediaType } from '@internetarchive/field-parsers';\nimport {\n AggregationSortType,\n SortDirection,\n} from '@internetarchive/search-service';\n\nexport interface TileModel {\n averageRating?: number;\n collectionIdentifier?: string;\n collectionName?: string;\n collectionFilesCount: number;\n collections: string[];\n collectionSize: number;\n commentCount: number;\n creator?: string;\n creators: string[];\n dateAdded?: Date; // Date added to public search (software-defined) [from: addeddate]\n dateArchived?: Date; // Date archived (software-defined) item created on archive.org [from: publicdate]\n datePublished?: Date; // Date work published in the world (user-defined) [from: date]\n dateReviewed?: Date; // Date reviewed (user-created) most recent review [from: reviewdate]\n description?: string;\n favCount: number;\n href?: string;\n identifier: string;\n issue?: string;\n itemCount: number;\n mediatype: MediaType;\n source?: string;\n snippets?: string[];\n subjects: string[];\n title: string;\n viewCount: number;\n volume?: string;\n weeklyViewCount?: number;\n loginRequired: boolean;\n contentWarning: boolean;\n}\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, etc).\n */\nexport type CollectionBrowserContext = 'collection' | 'search';\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\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\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\nexport type FacetOption =\n | 'subject'\n | 'lending'\n | 'mediatype'\n | 'language'\n | 'creator'\n | 'collection'\n | 'year';\n\nexport type SelectedFacetState = 'selected' | 'hidden';\n\nexport type FacetState = SelectedFacetState | 'none';\n\nexport interface FacetBucket {\n // for some facets, we augment the key with a display value\n displayText?: string;\n key: string;\n count: number;\n state: FacetState;\n}\n\nexport interface FacetGroup {\n title: string;\n key: FacetOption;\n buckets: FacetBucket[];\n}\n\nexport type FacetEventDetails = {\n key: FacetOption;\n state: FacetState;\n negative: boolean;\n};\n\nexport type FacetValue = string;\n\nexport type SelectedFacets = Record<\n FacetOption,\n Record<FacetValue, FacetBucket>\n>;\n\nexport const getDefaultSelectedFacets = (): SelectedFacets => ({\n subject: {},\n lending: {},\n mediatype: {},\n language: {},\n creator: {},\n collection: {},\n year: {},\n});\n\nexport const facetDisplayOrder: FacetOption[] = [\n 'mediatype',\n 'lending',\n 'year',\n 'subject',\n 'collection',\n 'creator',\n 'language',\n];\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};\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,\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,\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"]}
|
|
@@ -22,6 +22,8 @@ export declare class SortFilterBar extends LitElement implements SharedResizeObs
|
|
|
22
22
|
selectedCreatorFilter: string | null;
|
|
23
23
|
/** Whether to show the Relevance sort option (default `true`) */
|
|
24
24
|
showRelevance: boolean;
|
|
25
|
+
/** Whether to show the Date Favorited sort option instead of Date Published/Archived/Reviewed (default `false`) */
|
|
26
|
+
showDateFavorited: boolean;
|
|
25
27
|
/** Maps of result counts for letters on the alphabet bar, for each letter filter type */
|
|
26
28
|
prefixFilterCountMap?: Record<PrefixFilterType, PrefixFilterCounts>;
|
|
27
29
|
resizeObserver?: SharedResizeObserverInterface;
|
|
@@ -170,6 +172,11 @@ export declare class SortFilterBar extends LitElement implements SharedResizeObs
|
|
|
170
172
|
* @memberof SortFilterBar
|
|
171
173
|
*/
|
|
172
174
|
private get viewOptionSelected();
|
|
175
|
+
/**
|
|
176
|
+
* The default field for the date sort dropdown.
|
|
177
|
+
* This is Date Favorited when that option is available, or Date Published otherwise.
|
|
178
|
+
*/
|
|
179
|
+
private get defaultDateSortField();
|
|
173
180
|
/**
|
|
174
181
|
* The display name of the current date field
|
|
175
182
|
*
|
|
@@ -28,6 +28,8 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
28
28
|
this.selectedCreatorFilter = null;
|
|
29
29
|
/** Whether to show the Relevance sort option (default `true`) */
|
|
30
30
|
this.showRelevance = true;
|
|
31
|
+
/** Whether to show the Date Favorited sort option instead of Date Published/Archived/Reviewed (default `false`) */
|
|
32
|
+
this.showDateFavorited = false;
|
|
31
33
|
/**
|
|
32
34
|
* Which of the alphabet bars (title/creator) should be shown, or null if one
|
|
33
35
|
* should not currently be rendered.
|
|
@@ -255,7 +257,8 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
255
257
|
get mobileSortSelectorTemplate() {
|
|
256
258
|
const displayedOptions = Object.values(SORT_OPTIONS)
|
|
257
259
|
.filter(opt => opt.shownInSortBar)
|
|
258
|
-
.filter(opt => this.showRelevance || opt.field !== SortField.relevance)
|
|
260
|
+
.filter(opt => this.showRelevance || opt.field !== SortField.relevance)
|
|
261
|
+
.filter(opt => this.showDateFavorited || opt.field !== SortField.datefavorited);
|
|
259
262
|
return html `
|
|
260
263
|
<div
|
|
261
264
|
id="mobile-sort-container"
|
|
@@ -409,6 +412,9 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
409
412
|
id: 'date-dropdown',
|
|
410
413
|
selected: this.dateOptionSelected,
|
|
411
414
|
dropdownOptions: [
|
|
415
|
+
...(this.showDateFavorited
|
|
416
|
+
? [this.getDropdownOption(SortField.datefavorited)]
|
|
417
|
+
: []),
|
|
412
418
|
this.getDropdownOption(SortField.date),
|
|
413
419
|
this.getDropdownOption(SortField.datearchived),
|
|
414
420
|
this.getDropdownOption(SortField.datereviewed),
|
|
@@ -425,7 +431,7 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
425
431
|
if (!this.dateDropdown.open && !this.dateOptionSelected) {
|
|
426
432
|
e.stopPropagation();
|
|
427
433
|
this.clearAlphaBarFilters();
|
|
428
|
-
this.setSelectedSort(
|
|
434
|
+
this.setSelectedSort(this.defaultDateSortField);
|
|
429
435
|
}
|
|
430
436
|
},
|
|
431
437
|
});
|
|
@@ -581,6 +587,7 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
581
587
|
*/
|
|
582
588
|
get dateOptionSelected() {
|
|
583
589
|
const dateSortFields = [
|
|
590
|
+
SortField.datefavorited,
|
|
584
591
|
SortField.datearchived,
|
|
585
592
|
SortField.date,
|
|
586
593
|
SortField.datereviewed,
|
|
@@ -605,6 +612,13 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
605
612
|
];
|
|
606
613
|
return viewSortFields.includes(this.finalizedSortField);
|
|
607
614
|
}
|
|
615
|
+
/**
|
|
616
|
+
* The default field for the date sort dropdown.
|
|
617
|
+
* This is Date Favorited when that option is available, or Date Published otherwise.
|
|
618
|
+
*/
|
|
619
|
+
get defaultDateSortField() {
|
|
620
|
+
return this.showDateFavorited ? SortField.datefavorited : SortField.date;
|
|
621
|
+
}
|
|
608
622
|
/**
|
|
609
623
|
* The display name of the current date field
|
|
610
624
|
*
|
|
@@ -615,7 +629,7 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
615
629
|
*/
|
|
616
630
|
get dateSortField() {
|
|
617
631
|
var _a;
|
|
618
|
-
const defaultDateSort = SORT_OPTIONS[
|
|
632
|
+
const defaultDateSort = SORT_OPTIONS[this.defaultDateSortField];
|
|
619
633
|
const currentDateSort = this.dateOptionSelected
|
|
620
634
|
? (_a = SORT_OPTIONS[this.finalizedSortField]) !== null && _a !== void 0 ? _a : defaultDateSort
|
|
621
635
|
: defaultDateSort;
|
|
@@ -839,7 +853,7 @@ let SortFilterBar = class SortFilterBar extends LitElement {
|
|
|
839
853
|
background: none;
|
|
840
854
|
font-family: inherit;
|
|
841
855
|
font-size: inherit;
|
|
842
|
-
color:
|
|
856
|
+
color: #333;
|
|
843
857
|
line-height: 2;
|
|
844
858
|
cursor: pointer;
|
|
845
859
|
appearance: none;
|
|
@@ -946,6 +960,9 @@ __decorate([
|
|
|
946
960
|
__decorate([
|
|
947
961
|
property({ type: Boolean })
|
|
948
962
|
], SortFilterBar.prototype, "showRelevance", void 0);
|
|
963
|
+
__decorate([
|
|
964
|
+
property({ type: Boolean })
|
|
965
|
+
], SortFilterBar.prototype, "showDateFavorited", void 0);
|
|
949
966
|
__decorate([
|
|
950
967
|
property({ type: Object })
|
|
951
968
|
], SortFilterBar.prototype, "prefixFilterCountMap", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sort-filter-bar.js","sourceRoot":"","sources":["../../../src/sort-filter-bar/sort-filter-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,GAAG,EACH,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAK1E,OAAO,8BAA8B,CAAC;AAGtC,OAAO,EAIL,YAAY,EACZ,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,aAAa,CAAC;AA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,CAAC;0DAA2C;AAG1C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAA6C;AAG3C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAA+B;AAG/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAGzB;AAE0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAgD;AAMlE;IAAR,KAAK,EAAE;2DAAmD;AAMlD;IAAR,KAAK,EAAE;8DAAiC;AAMhC;IAAR,KAAK,EAAE;gEAA+B;AAM9B;IAAR,KAAK,EAAE;gEAA+B;AAOvC;IADC,KAAK,CAAC,yBAAyB,CAAC;2DACe;AAOhD;IADC,KAAK,CAAC,0BAA0B,CAAC;4DACa;AAI/C;IADC,KAAK,CAAC,iBAAiB,CAAC;oDACU;AAInC;IADC,KAAK,CAAC,gBAAgB,CAAC;mDACU;AAIlC;IADC,KAAK,CAAC,kBAAkB,CAAC;qDACU;AAvFzB,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAgiCzB;SAhiCY,aAAa","sourcesContent":["import {\n LitElement,\n html,\n css,\n nothing,\n PropertyValues,\n TemplateResult,\n} from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport '@internetarchive/ia-dropdown';\nimport type { IaDropdown, optionInterface } from '@internetarchive/ia-dropdown';\nimport type { SortDirection } from '@internetarchive/search-service';\nimport {\n CollectionDisplayMode,\n PrefixFilterCounts,\n PrefixFilterType,\n SORT_OPTIONS,\n SortField,\n} from '../models';\nimport './alpha-bar';\n\nimport { sortUpIcon } from './img/sort-toggle-up';\nimport { sortDownIcon } from './img/sort-toggle-down';\nimport { sortDisabledIcon } from './img/sort-toggle-disabled';\nimport { tileIcon } from './img/tile';\nimport { listIcon } from './img/list';\nimport { compactIcon } from './img/compact';\nimport { srOnlyStyle } from '../styles/sr-only';\n\ntype AlphaSelector = 'creator' | 'title';\n\n@customElement('sort-filter-bar')\nexport class SortFilterBar\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface\n{\n /** Which display mode the tiles are being rendered with (grid/list-detail/list-compact) */\n @property({ type: String }) displayMode?: CollectionDisplayMode;\n\n /** The default sort direction to use if none is set */\n @property({ type: String }) defaultSortDirection: SortDirection | null = null;\n\n /** The default sort field to use if none is set */\n @property({ type: String }) defaultSortField: Exclude<\n SortField,\n SortField.default\n > = SortField.relevance;\n\n /** The current sort direction (asc/desc), or null if none is set */\n @property({ type: String }) sortDirection: SortDirection | null = null;\n\n /** The field currently being sorted on (e.g., 'title'). Defaults to relevance. */\n @property({ type: String }) selectedSort: SortField = SortField.default;\n\n /** The currently selected title letter filter, or null if none is set */\n @property({ type: String }) selectedTitleFilter: string | null = null;\n\n /** The currently selected creator letter filter, or null if none is set */\n @property({ type: String }) selectedCreatorFilter: string | null = null;\n\n /** Whether to show the Relevance sort option (default `true`) */\n @property({ type: Boolean }) showRelevance: boolean = true;\n\n /** Maps of result counts for letters on the alphabet bar, for each letter filter type */\n @property({ type: Object }) prefixFilterCountMap?: Record<\n PrefixFilterType,\n PrefixFilterCounts\n >;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n /**\n * Which of the alphabet bars (title/creator) should be shown, or null if one\n * should not currently be rendered.\n */\n @state() alphaSelectorVisible: AlphaSelector | null = null;\n\n /**\n * Whether the transparent backdrop to catch clicks outside the dropdown menu\n * should be rendered.\n */\n @state() dropdownBackdropVisible = false;\n\n /**\n * The width of the desktop view sort option container, updated upon each resize.\n * Used for dynamically determining whether to use desktop or mobile view.\n */\n @state() desktopSortContainerWidth = 0;\n\n /**\n * The width of the full sort bar, updated upon each resize.\n * Used for dynamically determining whether to use desktop or mobile view.\n */\n @state() selectorBarContainerWidth = 0;\n\n /**\n * The container for all the desktop view's sort options.\n * Used for dynamically determining whether to use desktop or mobile view.\n */\n @query('#desktop-sort-container')\n private desktopSortContainer!: HTMLUListElement;\n\n /**\n * The container for the full sort bar.\n * Used for dynamically determining whether to use desktop or mobile view.\n */\n @query('#sort-selector-container')\n private sortSelectorContainer!: HTMLDivElement;\n\n /** The dropdown component containing options for weekly and all-time views */\n @query('#views-dropdown')\n private viewsDropdown!: IaDropdown;\n\n /** The dropdown component containing the four date options */\n @query('#date-dropdown')\n private dateDropdown!: IaDropdown;\n\n /** The single, consolidated dropdown component shown in mobile view */\n @query('#mobile-dropdown')\n private mobileDropdown!: IaDropdown;\n\n render() {\n return html`\n <div id=\"container\">\n <section id=\"sort-bar\" aria-label=\"Sorting options\">\n <div class=\"sort-direction-container\">\n ${this.sortDirectionSelectorTemplate}\n </div>\n <span class=\"sort-by-text\">Sort by:</span>\n\n <div id=\"sort-selector-container\">\n ${this.mobileSortSelectorTemplate}\n ${this.desktopSortSelectorTemplate}\n </div>\n\n <div id=\"display-style-selector\">${this.displayOptionTemplate}</div>\n </section>\n\n ${this.dropdownBackdropVisible ? this.dropdownBackdrop : nothing}\n ${this.alphaBarTemplate}\n </div>\n `;\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('displayMode')) {\n this.displayModeChanged();\n }\n\n if (changed.has('selectedSort') && this.sortDirection === null) {\n const sortOption = SORT_OPTIONS[this.finalizedSortField];\n this.sortDirection = sortOption.defaultSortDirection;\n }\n\n if (changed.has('selectedTitleFilter') && this.selectedTitleFilter) {\n this.alphaSelectorVisible = 'title';\n }\n\n if (changed.has('selectedCreatorFilter') && this.selectedCreatorFilter) {\n this.alphaSelectorVisible = 'creator';\n }\n\n if (changed.has('dropdownBackdropVisible')) {\n this.setupEscapeListeners();\n }\n\n if (changed.has('resizeObserver')) {\n const oldObserver = changed.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n if (oldObserver) this.disconnectResizeObserver(oldObserver);\n this.setupResizeObserver();\n }\n }\n\n private setupEscapeListeners() {\n if (this.dropdownBackdropVisible) {\n document.addEventListener(\n 'keydown',\n this.boundSortBarSelectorEscapeListener\n );\n } else {\n document.removeEventListener(\n 'keydown',\n this.boundSortBarSelectorEscapeListener\n );\n }\n }\n\n private boundSortBarSelectorEscapeListener = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n this.closeDropdowns();\n }\n };\n\n disconnectedCallback(): void {\n if (this.resizeObserver) {\n this.disconnectResizeObserver(this.resizeObserver);\n }\n }\n\n private disconnectResizeObserver(\n resizeObserver: SharedResizeObserverInterface\n ) {\n resizeObserver.removeObserver({\n target: this.sortSelectorContainer,\n handler: this,\n });\n\n resizeObserver.removeObserver({\n target: this.desktopSortContainer,\n handler: this,\n });\n }\n\n private setupResizeObserver() {\n if (!this.resizeObserver) return;\n this.resizeObserver.addObserver({\n target: this.sortSelectorContainer,\n handler: this,\n });\n\n this.resizeObserver.addObserver({\n target: this.desktopSortContainer,\n handler: this,\n });\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n if (entry.target === this.desktopSortContainer) {\n this.desktopSortContainerWidth = entry.contentRect.width;\n } else if (entry.target === this.sortSelectorContainer) {\n this.selectorBarContainerWidth = entry.contentRect.width;\n }\n }\n\n /**\n * Whether to show the mobile sort bar because there is not enough space\n * for the desktop sort bar.\n */\n private get mobileSelectorVisible() {\n return this.selectorBarContainerWidth - 10 < this.desktopSortContainerWidth;\n }\n\n /**\n * Template to render the alphabet bar, or `nothing` if it should not be rendered\n * for the current sort\n */\n private get alphaBarTemplate(): TemplateResult | typeof nothing {\n if (!['title', 'creator'].includes(this.selectedSort)) return nothing;\n\n if (this.alphaSelectorVisible === null) {\n if (this.selectedSort === 'creator') return this.creatorSelectorBar;\n if (this.selectedSort === 'title') return this.titleSelectorBar;\n } else {\n return this.alphaSelectorVisible === 'creator'\n ? this.creatorSelectorBar\n : this.titleSelectorBar;\n }\n\n return nothing;\n }\n\n /** Template to render the sort direction toggle button */\n private get sortDirectionSelectorTemplate(): TemplateResult {\n const oppositeSortDirectionReadable =\n this.sortDirection === 'asc' ? 'descending' : 'ascending';\n const srLabel = `Change to ${oppositeSortDirectionReadable} sort`;\n\n return html`\n <button\n class=\"sort-direction-selector\"\n ?disabled=${!this.canChangeSortDirection}\n @click=${this.handleSortDirectionClicked}\n >\n <span class=\"sr-only\">${srLabel}</span>\n ${this.sortDirectionIcon}\n </button>\n `;\n }\n\n /** Template to render the sort direction button's icon in the correct current state */\n private get sortDirectionIcon(): TemplateResult {\n // Show a fully disabled icon for sort options without direction support\n if (!this.canChangeSortDirection) {\n return html`<div class=\"sort-direction-icon\">${sortDisabledIcon}</div>`;\n }\n\n // For all other sorts, show the ascending/descending direction\n return html`\n <div class=\"sort-direction-icon\">\n ${this.finalizedSortDirection === 'asc' ? sortUpIcon : sortDownIcon}\n </div>\n `;\n }\n\n /** The template to render all the sort options in desktop view */\n private get desktopSortSelectorTemplate() {\n return html`\n <div\n id=\"desktop-sort-container\"\n class=${this.mobileSelectorVisible ? 'hidden' : 'visible'}\n >\n <ul id=\"desktop-sort-selector\">\n ${this.showRelevance\n ? html`<li>\n ${this.getSortDisplayOption(SortField.relevance, {\n onClick: () => {\n this.dropdownBackdropVisible = false;\n if (this.finalizedSortField !== SortField.relevance) {\n this.clearAlphaBarFilters();\n this.setSelectedSort(SortField.relevance);\n }\n },\n })}\n </li>`\n : nothing}\n <li>${this.viewsDropdownTemplate}</li>\n <li>\n ${this.getSortDisplayOption(SortField.title, {\n onClick: () => {\n this.dropdownBackdropVisible = false;\n if (this.finalizedSortField !== SortField.title) {\n this.alphaSelectorVisible = 'title';\n this.selectedCreatorFilter = null;\n this.setSelectedSort(SortField.title);\n this.emitCreatorLetterChangedEvent();\n }\n },\n })}\n </li>\n <li>${this.dateDropdownTemplate}</li>\n <li>\n ${this.getSortDisplayOption(SortField.creator, {\n onClick: () => {\n this.dropdownBackdropVisible = false;\n if (this.finalizedSortField !== SortField.creator) {\n this.alphaSelectorVisible = 'creator';\n this.selectedTitleFilter = null;\n this.setSelectedSort(SortField.creator);\n this.emitTitleLetterChangedEvent();\n }\n },\n })}\n </li>\n </ul>\n </div>\n `;\n }\n\n /** The template to render all the sort options in mobile view */\n private get mobileSortSelectorTemplate() {\n const displayedOptions = Object.values(SORT_OPTIONS)\n .filter(opt => opt.shownInSortBar)\n .filter(opt => this.showRelevance || opt.field !== SortField.relevance);\n\n return html`\n <div\n id=\"mobile-sort-container\"\n class=${this.mobileSelectorVisible ? 'visible' : 'hidden'}\n >\n ${this.getSortDropdown({\n displayName: html`${SORT_OPTIONS[this.finalizedSortField]\n .displayName}`,\n id: 'mobile-dropdown',\n selected: true,\n dropdownOptions: displayedOptions.map(opt =>\n this.getDropdownOption(opt.field)\n ),\n selectedOption: this.finalizedSortField,\n onOptionSelected: this.mobileSortChanged,\n onDropdownClick: () => {\n this.dropdownBackdropVisible = this.mobileDropdown.open;\n this.mobileDropdown.classList.toggle(\n 'open',\n this.mobileDropdown.open\n );\n },\n })}\n </div>\n `;\n }\n\n /**\n * This generates each of the non-dropdown sort option links.\n *\n * It manages the display value and the selected state of the option.\n *\n * @param sortField\n * @param options {\n * onClick?: (e: Event) => void; If this is provided, it will also be called when the option is clicked.\n * displayName?: TemplateResult; The name to display for the option. Defaults to the sortField display name.\n * selected?: boolean; true if the option is selected. Defaults to the selectedSort === sortField.\n * }\n * @returns\n */\n private getSortDisplayOption(\n sortField: SortField,\n options?: {\n displayName?: TemplateResult;\n selected?: boolean;\n onClick?: (e: Event) => void;\n }\n ): TemplateResult {\n const isSelected =\n options?.selected ?? this.finalizedSortField === sortField;\n const displayName =\n options?.displayName ?? SORT_OPTIONS[sortField].displayName;\n return html`\n <button\n class=${isSelected ? 'selected' : nothing}\n data-title=\"${displayName}\"\n @click=${(e: Event) => {\n e.preventDefault();\n options?.onClick?.(e);\n }}\n >\n ${displayName}\n </button>\n `;\n }\n\n /**\n * Generates a dropdown component containing multiple grouped sort options.\n *\n * @param options.displayName The name to use for the dropdown's visible label\n * @param options.id The id to apply to the dropdown element\n * @param options.dropdownOptions An array of option objects used to populate the dropdown\n * @param options.selectedOption The id of the option that should be initially selected\n * @param options.selected A boolean indicating whether this dropdown should use its\n * selected appearance\n * @param options.onOptionSelected A handler for optionSelected events coming from the dropdown\n * @param options.onDropdownClick A handler for click events on the dropdown\n * @param options.onLabelInteraction A handler for click events and Enter/Space keydown events\n * on the dropdown's label\n */\n private getSortDropdown(options: {\n displayName: TemplateResult;\n id?: string;\n dropdownOptions: optionInterface[];\n selectedOption?: string;\n selected: boolean;\n onOptionSelected?: (e: CustomEvent<{ option: optionInterface }>) => void;\n onDropdownClick?: (e: PointerEvent) => void;\n onLabelInteraction?: (e: Event) => void;\n }): TemplateResult {\n return html`\n <ia-dropdown\n id=${options.id ?? nothing}\n class=${options.selected ? 'selected' : nothing}\n displayCaret\n closeOnSelect\n includeSelectedOption\n .openViaButton=${options.selected}\n .options=${options.dropdownOptions}\n .selectedOption=${options.selectedOption ?? ''}\n @optionSelected=${options.onOptionSelected ?? nothing}\n @click=${options.onDropdownClick ?? nothing}\n >\n <span\n class=\"dropdown-label\"\n slot=\"dropdown-label\"\n data-title=\"${options.displayName.values}\"\n @click=${options.onLabelInteraction ?? nothing}\n @keydown=${options.onLabelInteraction\n ? (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n options.onLabelInteraction?.(e);\n }\n }\n : nothing}\n >\n ${options.displayName}\n </span>\n </ia-dropdown>\n `;\n }\n\n /** Generates a single dropdown option object for the given sort field */\n private getDropdownOption(sortField: SortField): optionInterface {\n return {\n id: sortField,\n selectedHandler: () => {\n this.selectDropdownSortField(sortField);\n },\n label: html`\n <span class=\"dropdown-option-label\">\n ${SORT_OPTIONS[sortField].displayName}\n </span>\n `,\n };\n }\n\n /** Handler for when any sort dropdown option is selected */\n private dropdownOptionSelected(e: CustomEvent<{ option: optionInterface }>) {\n this.dropdownBackdropVisible = false;\n this.clearAlphaBarFilters();\n this.setSelectedSort(e.detail.option.id as SortField);\n }\n\n /** The template to render for the views dropdown */\n private get viewsDropdownTemplate(): TemplateResult {\n return this.getSortDropdown({\n displayName: html`${this.viewSortField}`,\n id: 'views-dropdown',\n selected: this.viewOptionSelected,\n dropdownOptions: [\n this.getDropdownOption(SortField.weeklyview),\n this.getDropdownOption(SortField.alltimeview),\n ],\n selectedOption: this.viewOptionSelected ? this.selectedSort : '',\n onOptionSelected: this.dropdownOptionSelected,\n onDropdownClick: () => {\n this.dateDropdown.open = false;\n this.dropdownBackdropVisible = this.viewsDropdown.open;\n this.viewsDropdown.classList.toggle('open', this.viewsDropdown.open);\n },\n onLabelInteraction: (e: Event) => {\n if (!this.viewsDropdown.open && !this.viewOptionSelected) {\n e.stopPropagation();\n this.clearAlphaBarFilters();\n this.setSelectedSort(SortField.weeklyview);\n }\n },\n });\n }\n\n /** The template to render for the date dropdown */\n private get dateDropdownTemplate(): TemplateResult {\n return this.getSortDropdown({\n displayName: html`${this.dateSortField}`,\n id: 'date-dropdown',\n selected: this.dateOptionSelected,\n dropdownOptions: [\n this.getDropdownOption(SortField.date),\n this.getDropdownOption(SortField.datearchived),\n this.getDropdownOption(SortField.datereviewed),\n this.getDropdownOption(SortField.dateadded),\n ],\n selectedOption: this.dateOptionSelected ? this.selectedSort : '',\n onOptionSelected: this.dropdownOptionSelected,\n onDropdownClick: () => {\n this.viewsDropdown.open = false;\n this.dropdownBackdropVisible = this.dateDropdown.open;\n this.dateDropdown.classList.toggle('open', this.dateDropdown.open);\n },\n onLabelInteraction: (e: Event) => {\n if (!this.dateDropdown.open && !this.dateOptionSelected) {\n e.stopPropagation();\n this.clearAlphaBarFilters();\n this.setSelectedSort(SortField.date);\n }\n },\n });\n }\n\n /** Handler for when a new mobile sort dropdown option is selected */\n private mobileSortChanged(e: CustomEvent<{ option: optionInterface }>) {\n this.dropdownBackdropVisible = false;\n\n const sortField = e.detail.option.id as SortField;\n this.setSelectedSort(sortField);\n\n this.alphaSelectorVisible = null;\n if (sortField !== 'title' && this.selectedTitleFilter) {\n this.selectedTitleFilter = null;\n this.emitTitleLetterChangedEvent();\n }\n if (sortField !== 'creator' && this.selectedCreatorFilter) {\n this.selectedCreatorFilter = null;\n this.emitCreatorLetterChangedEvent();\n }\n }\n\n /** Template for rendering the three display mode options */\n private get displayOptionTemplate() {\n return html`\n <ul>\n <li>\n <button\n id=\"grid-button\"\n @click=${() => {\n this.displayMode = 'grid';\n }}\n class=${this.displayMode === 'grid' ? 'active' : ''}\n title=\"Tile view\"\n >\n ${tileIcon}\n </button>\n </li>\n <li>\n <button\n id=\"list-detail-button\"\n @click=${() => {\n this.displayMode = 'list-detail';\n }}\n class=${this.displayMode === 'list-detail' ? 'active' : ''}\n title=\"List view\"\n >\n ${listIcon}\n </button>\n </li>\n <li>\n <button\n id=\"list-compact-button\"\n @click=${() => {\n this.displayMode = 'list-compact';\n }}\n class=${this.displayMode === 'list-compact' ? 'active' : ''}\n title=\"Compact list view\"\n >\n ${compactIcon}\n </button>\n </li>\n </ul>\n `;\n }\n\n /**\n * Template for rendering the transparent backdrop to capture clicks outside the\n * dropdown menu while it is open.\n */\n private get dropdownBackdrop() {\n return html`\n <div\n id=\"sort-selector-backdrop\"\n @keyup=${this.closeDropdowns}\n @click=${this.closeDropdowns}\n ></div>\n `;\n }\n\n /** Closes all of the sorting dropdown components' menus */\n private closeDropdowns() {\n this.dropdownBackdropVisible = false;\n const allDropdowns = [\n this.viewsDropdown,\n this.dateDropdown,\n this.mobileDropdown,\n ];\n for (const dropdown of allDropdowns) {\n dropdown.open = false;\n dropdown.classList.remove('open');\n }\n }\n\n private selectDropdownSortField(sortField: SortField) {\n // When a dropdown sort option is selected, we additionally need to clear the backdrop\n this.dropdownBackdropVisible = false;\n this.setSelectedSort(sortField);\n }\n\n private clearAlphaBarFilters() {\n this.alphaSelectorVisible = null;\n this.selectedTitleFilter = null;\n this.selectedCreatorFilter = null;\n this.emitTitleLetterChangedEvent();\n this.emitCreatorLetterChangedEvent();\n }\n\n private setSortDirection(sortDirection: SortDirection) {\n this.sortDirection = sortDirection;\n this.emitSortChangedEvent();\n }\n\n /** Toggles the current sort direction between 'asc' and 'desc' */\n private toggleSortDirection() {\n this.setSortDirection(\n this.finalizedSortDirection === 'desc' ? 'asc' : 'desc'\n );\n }\n\n private handleSortDirectionClicked(): void {\n if (\n !this.sortDirection &&\n this.defaultSortField &&\n this.defaultSortDirection\n ) {\n // When the sort direction is merely defaulted (not set by the user), clicking\n // the toggled button should \"promote\" the default sort to an explicitly-set one\n // and then toggle it as usual.\n this.selectedSort = this.defaultSortField;\n this.sortDirection = this.defaultSortDirection;\n }\n\n this.toggleSortDirection();\n }\n\n private setSelectedSort(sort: SortField) {\n this.selectedSort = sort;\n // Apply this field's default sort direction\n const sortOption = SORT_OPTIONS[sort];\n this.sortDirection = sortOption.defaultSortDirection;\n this.emitSortChangedEvent();\n }\n\n /** The current sort field, or the default one if no explicit sort is set */\n private get finalizedSortField(): SortField {\n return this.selectedSort === SortField.default\n ? this.defaultSortField\n : this.selectedSort;\n }\n\n /** The current sort direction, or the default one if no explicit direction is set */\n private get finalizedSortDirection(): SortDirection | null {\n return this.sortDirection === null\n ? this.defaultSortDirection\n : this.sortDirection;\n }\n\n /** Whether the sort direction button should be enabled for the current sort */\n private get canChangeSortDirection(): boolean {\n return SORT_OPTIONS[this.finalizedSortField].canSetDirection;\n }\n\n /**\n * There are four date sort options.\n *\n * This checks to see if the current sort is one of them.\n *\n * @readonly\n * @private\n * @type {boolean}\n * @memberof SortFilterBar\n */\n private get dateOptionSelected(): boolean {\n const dateSortFields: SortField[] = [\n SortField.datearchived,\n SortField.date,\n SortField.datereviewed,\n SortField.dateadded,\n ];\n return dateSortFields.includes(this.finalizedSortField);\n }\n\n /**\n * There are two view sort options.\n *\n * This checks to see if the current sort is one of them.\n *\n * @readonly\n * @private\n * @type {boolean}\n * @memberof SortFilterBar\n */\n private get viewOptionSelected(): boolean {\n const viewSortFields: SortField[] = [\n SortField.alltimeview,\n SortField.weeklyview,\n ];\n return viewSortFields.includes(this.finalizedSortField);\n }\n\n /**\n * The display name of the current date field\n *\n * @readonly\n * @private\n * @type {string}\n * @memberof SortFilterBar\n */\n private get dateSortField(): string {\n const defaultDateSort = SORT_OPTIONS[SortField.date];\n const currentDateSort = this.dateOptionSelected\n ? SORT_OPTIONS[this.finalizedSortField] ?? defaultDateSort\n : defaultDateSort;\n return currentDateSort.displayName;\n }\n\n /**\n * The display name of the current view field\n *\n * @readonly\n * @private\n * @type {string}\n * @memberof SortFilterBar\n */\n private get viewSortField(): string {\n const defaultViewSort = SORT_OPTIONS[SortField.weeklyview];\n const currentViewSort = this.viewOptionSelected\n ? SORT_OPTIONS[this.finalizedSortField] ?? defaultViewSort\n : defaultViewSort;\n return currentViewSort.displayName;\n }\n\n private get titleSelectorBar() {\n return html` <alpha-bar\n .selectedLetter=${this.selectedTitleFilter}\n .letterCounts=${this.prefixFilterCountMap?.title}\n ariaLandmarkLabel=\"Filter by title letter\"\n @letterChanged=${this.titleLetterChanged}\n ></alpha-bar>`;\n }\n\n private get creatorSelectorBar() {\n return html` <alpha-bar\n .selectedLetter=${this.selectedCreatorFilter}\n .letterCounts=${this.prefixFilterCountMap?.creator}\n ariaLandmarkLabel=\"Filter by creator letter\"\n @letterChanged=${this.creatorLetterChanged}\n ></alpha-bar>`;\n }\n\n private titleLetterChanged(\n e: CustomEvent<{ selectedLetter: string | undefined }>\n ) {\n this.selectedTitleFilter = e.detail.selectedLetter ?? null;\n this.emitTitleLetterChangedEvent();\n }\n\n private creatorLetterChanged(\n e: CustomEvent<{ selectedLetter: string | undefined }>\n ) {\n this.selectedCreatorFilter = e.detail.selectedLetter ?? null;\n this.emitCreatorLetterChangedEvent();\n }\n\n private emitTitleLetterChangedEvent() {\n const event = new CustomEvent<{ selectedLetter: string | null }>(\n 'titleLetterChanged',\n {\n detail: { selectedLetter: this.selectedTitleFilter },\n }\n );\n this.dispatchEvent(event);\n }\n\n private emitCreatorLetterChangedEvent() {\n const event = new CustomEvent<{ selectedLetter: string | null }>(\n 'creatorLetterChanged',\n {\n detail: { selectedLetter: this.selectedCreatorFilter },\n }\n );\n this.dispatchEvent(event);\n }\n\n private displayModeChanged() {\n const event = new CustomEvent<{\n displayMode?: CollectionDisplayMode;\n }>('displayModeChanged', {\n detail: { displayMode: this.displayMode },\n });\n this.dispatchEvent(event);\n }\n\n private emitSortChangedEvent() {\n const event = new CustomEvent<{\n selectedSort: SortField;\n sortDirection: SortDirection | null;\n }>('sortChanged', {\n detail: {\n selectedSort: this.selectedSort,\n sortDirection: this.sortDirection,\n },\n });\n this.dispatchEvent(event);\n }\n\n static get styles() {\n return [\n srOnlyStyle,\n css`\n #container {\n position: relative;\n }\n\n #sort-bar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid #2c2c2c;\n font-size: 1.4rem;\n }\n\n ul {\n list-style: none;\n display: flex;\n align-items: center;\n margin: 0;\n padding: 0;\n }\n\n li {\n padding: 0;\n }\n\n .sort-by-text {\n margin-right: 5px;\n font-weight: bold;\n white-space: nowrap;\n }\n\n .sort-direction-container {\n display: flex;\n align-self: stretch;\n flex: 0;\n margin: 0 5px;\n }\n\n .sort-direction-selector {\n padding: 0;\n border: none;\n appearance: none;\n background: transparent;\n cursor: pointer;\n }\n\n .sort-direction-selector:disabled {\n cursor: default;\n }\n\n .sort-direction-icon {\n display: flex;\n align-items: center;\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n outline: inherit;\n width: 14px;\n height: 14px;\n }\n\n .sort-direction-icon > svg {\n flex: 1;\n }\n\n #date-sort-selector,\n #view-sort-selector {\n position: absolute;\n left: 150px;\n top: 45px;\n\n z-index: 1;\n padding: 1rem;\n background-color: white;\n border-radius: 2.5rem;\n border: 1px solid #404142;\n }\n\n #sort-selector-container {\n flex: 1;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n }\n\n #desktop-sort-container,\n #mobile-sort-container {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n }\n\n /*\n we move the desktop sort selector offscreen instead of display: none\n because we need to observe the width of it vs its container to determine\n if it's wide enough to display the desktop version and if you display: none,\n the width becomes 0\n */\n #desktop-sort-container.hidden {\n position: absolute;\n top: -9999px;\n left: -9999px;\n visibility: hidden;\n }\n\n #mobile-sort-container.hidden {\n display: none;\n }\n\n #sort-selector-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n z-index: 1;\n background-color: transparent;\n }\n\n #desktop-sort-selector {\n display: inline-flex;\n }\n\n #desktop-sort-selector li {\n display: flex;\n align-items: center;\n padding-left: 5px;\n padding-right: 5px;\n }\n\n #desktop-sort-selector li a {\n padding: 0 5px;\n text-decoration: none;\n color: #333;\n line-height: 2;\n }\n\n #desktop-sort-selector li button {\n padding: 0px 5px;\n border: none;\n background: none;\n font-family: inherit;\n font-size: inherit;\n color: var(--ia-theme-primary-text-color, #2c2c2c);\n line-height: 2;\n cursor: pointer;\n appearance: none;\n }\n\n #desktop-sort-selector li button.selected {\n font-weight: bold;\n }\n\n /**\n * Fix to not shift the sort-bar options when get selected\n */\n #desktop-sort-selector li button::before,\n #desktop-sort-selector .dropdown-label::before {\n display: block;\n content: attr(data-title);\n font-weight: bold;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n #display-style-selector {\n flex: 0;\n }\n\n #display-style-selector button {\n background: none;\n color: inherit;\n border: none;\n appearance: none;\n cursor: pointer;\n -webkit-appearance: none;\n fill: #bbbbbb;\n }\n\n #display-style-selector button.active {\n fill: var(--ia-theme-primary-text-color, #2c2c2c);\n }\n\n #display-style-selector button svg {\n width: 24px;\n height: 24px;\n }\n\n ia-dropdown {\n --dropdownTextColor: white;\n --dropdownOffsetTop: 0;\n --dropdownBorderTopWidth: 0;\n --dropdownBorderTopLeftRadius: 0;\n --dropdownBorderTopRightRadius: 0;\n --dropdownWhiteSpace: nowrap;\n --dropdownListZIndex: 2;\n --dropdownCaretColor: var(--ia-theme-primary-text-color, #2c2c2c);\n --dropdownSelectedTextColor: white;\n --dropdownSelectedBgColor: rgba(255, 255, 255, 0.3);\n --dropdownHoverBgColor: rgba(255, 255, 255, 0.3);\n --caretHeight: 9px;\n --caretWidth: 12px;\n --caretPadding: 0 5px 0 0;\n }\n ia-dropdown.selected .dropdown-label {\n font-weight: bold;\n }\n ia-dropdown.open {\n z-index: 2;\n }\n\n .dropdown-label {\n display: inline-block;\n height: 100%;\n padding-left: 5px;\n font-size: 1.4rem;\n line-height: 2;\n color: var(--ia-theme-primary-text-color, #2c2c2c);\n white-space: nowrap;\n user-select: none;\n }\n `,\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sort-filter-bar.js","sourceRoot":"","sources":["../../../src/sort-filter-bar/sort-filter-bar.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EACJ,GAAG,EACH,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAK1E,OAAO,8BAA8B,CAAC;AAGtC,OAAO,EAIL,YAAY,EACZ,SAAS,GACV,MAAM,WAAW,CAAC;AACnB,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAKhD,IAAa,aAAa,GAA1B,MAAa,aACX,SAAQ,UAAU;IADpB;;QAOE,uDAAuD;QAC3B,yBAAoB,GAAyB,IAAI,CAAC;QAE9E,mDAAmD;QACvB,qBA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EAAE,MAAM,EAAE,CAAC;0DAA2C;AAG1C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4DAA6C;AAG3C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAA+B;AAG9B;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAoC;AAGpC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DAGzB;AAE0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAgD;AAMlE;IAAR,KAAK,EAAE;2DAAmD;AAMlD;IAAR,KAAK,EAAE;8DAAiC;AAMhC;IAAR,KAAK,EAAE;gEAA+B;AAM9B;IAAR,KAAK,EAAE;gEAA+B;AAOvC;IADC,KAAK,CAAC,yBAAyB,CAAC;2DACe;AAOhD;IADC,KAAK,CAAC,0BAA0B,CAAC;4DACa;AAI/C;IADC,KAAK,CAAC,iBAAiB,CAAC;oDACU;AAInC;IADC,KAAK,CAAC,gBAAgB,CAAC;mDACU;AAIlC;IADC,KAAK,CAAC,kBAAkB,CAAC;qDACU;AA1FzB,aAAa;IADzB,aAAa,CAAC,iBAAiB,CAAC;GACpB,aAAa,CAkjCzB;SAljCY,aAAa","sourcesContent":["import {\n LitElement,\n html,\n css,\n nothing,\n PropertyValues,\n TemplateResult,\n} from 'lit';\nimport { customElement, property, query, state } from 'lit/decorators.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport '@internetarchive/ia-dropdown';\nimport type { IaDropdown, optionInterface } from '@internetarchive/ia-dropdown';\nimport type { SortDirection } from '@internetarchive/search-service';\nimport {\n CollectionDisplayMode,\n PrefixFilterCounts,\n PrefixFilterType,\n SORT_OPTIONS,\n SortField,\n} from '../models';\nimport './alpha-bar';\n\nimport { sortUpIcon } from './img/sort-toggle-up';\nimport { sortDownIcon } from './img/sort-toggle-down';\nimport { sortDisabledIcon } from './img/sort-toggle-disabled';\nimport { tileIcon } from './img/tile';\nimport { listIcon } from './img/list';\nimport { compactIcon } from './img/compact';\nimport { srOnlyStyle } from '../styles/sr-only';\n\ntype AlphaSelector = 'creator' | 'title';\n\n@customElement('sort-filter-bar')\nexport class SortFilterBar\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface\n{\n /** Which display mode the tiles are being rendered with (grid/list-detail/list-compact) */\n @property({ type: String }) displayMode?: CollectionDisplayMode;\n\n /** The default sort direction to use if none is set */\n @property({ type: String }) defaultSortDirection: SortDirection | null = null;\n\n /** The default sort field to use if none is set */\n @property({ type: String }) defaultSortField: Exclude<\n SortField,\n SortField.default\n > = SortField.relevance;\n\n /** The current sort direction (asc/desc), or null if none is set */\n @property({ type: String }) sortDirection: SortDirection | null = null;\n\n /** The field currently being sorted on (e.g., 'title'). Defaults to relevance. */\n @property({ type: String }) selectedSort: SortField = SortField.default;\n\n /** The currently selected title letter filter, or null if none is set */\n @property({ type: String }) selectedTitleFilter: string | null = null;\n\n /** The currently selected creator letter filter, or null if none is set */\n @property({ type: String }) selectedCreatorFilter: string | null = null;\n\n /** Whether to show the Relevance sort option (default `true`) */\n @property({ type: Boolean }) showRelevance: boolean = true;\n\n /** Whether to show the Date Favorited sort option instead of Date Published/Archived/Reviewed (default `false`) */\n @property({ type: Boolean }) showDateFavorited: boolean = false;\n\n /** Maps of result counts for letters on the alphabet bar, for each letter filter type */\n @property({ type: Object }) prefixFilterCountMap?: Record<\n PrefixFilterType,\n PrefixFilterCounts\n >;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n /**\n * Which of the alphabet bars (title/creator) should be shown, or null if one\n * should not currently be rendered.\n */\n @state() alphaSelectorVisible: AlphaSelector | null = null;\n\n /**\n * Whether the transparent backdrop to catch clicks outside the dropdown menu\n * should be rendered.\n */\n @state() dropdownBackdropVisible = false;\n\n /**\n * The width of the desktop view sort option container, updated upon each resize.\n * Used for dynamically determining whether to use desktop or mobile view.\n */\n @state() desktopSortContainerWidth = 0;\n\n /**\n * The width of the full sort bar, updated upon each resize.\n * Used for dynamically determining whether to use desktop or mobile view.\n */\n @state() selectorBarContainerWidth = 0;\n\n /**\n * The container for all the desktop view's sort options.\n * Used for dynamically determining whether to use desktop or mobile view.\n */\n @query('#desktop-sort-container')\n private desktopSortContainer!: HTMLUListElement;\n\n /**\n * The container for the full sort bar.\n * Used for dynamically determining whether to use desktop or mobile view.\n */\n @query('#sort-selector-container')\n private sortSelectorContainer!: HTMLDivElement;\n\n /** The dropdown component containing options for weekly and all-time views */\n @query('#views-dropdown')\n private viewsDropdown!: IaDropdown;\n\n /** The dropdown component containing the four date options */\n @query('#date-dropdown')\n private dateDropdown!: IaDropdown;\n\n /** The single, consolidated dropdown component shown in mobile view */\n @query('#mobile-dropdown')\n private mobileDropdown!: IaDropdown;\n\n render() {\n return html`\n <div id=\"container\">\n <section id=\"sort-bar\" aria-label=\"Sorting options\">\n <div class=\"sort-direction-container\">\n ${this.sortDirectionSelectorTemplate}\n </div>\n <span class=\"sort-by-text\">Sort by:</span>\n\n <div id=\"sort-selector-container\">\n ${this.mobileSortSelectorTemplate}\n ${this.desktopSortSelectorTemplate}\n </div>\n\n <div id=\"display-style-selector\">${this.displayOptionTemplate}</div>\n </section>\n\n ${this.dropdownBackdropVisible ? this.dropdownBackdrop : nothing}\n ${this.alphaBarTemplate}\n </div>\n `;\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('displayMode')) {\n this.displayModeChanged();\n }\n\n if (changed.has('selectedSort') && this.sortDirection === null) {\n const sortOption = SORT_OPTIONS[this.finalizedSortField];\n this.sortDirection = sortOption.defaultSortDirection;\n }\n\n if (changed.has('selectedTitleFilter') && this.selectedTitleFilter) {\n this.alphaSelectorVisible = 'title';\n }\n\n if (changed.has('selectedCreatorFilter') && this.selectedCreatorFilter) {\n this.alphaSelectorVisible = 'creator';\n }\n\n if (changed.has('dropdownBackdropVisible')) {\n this.setupEscapeListeners();\n }\n\n if (changed.has('resizeObserver')) {\n const oldObserver = changed.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n if (oldObserver) this.disconnectResizeObserver(oldObserver);\n this.setupResizeObserver();\n }\n }\n\n private setupEscapeListeners() {\n if (this.dropdownBackdropVisible) {\n document.addEventListener(\n 'keydown',\n this.boundSortBarSelectorEscapeListener\n );\n } else {\n document.removeEventListener(\n 'keydown',\n this.boundSortBarSelectorEscapeListener\n );\n }\n }\n\n private boundSortBarSelectorEscapeListener = (e: KeyboardEvent) => {\n if (e.key === 'Escape') {\n this.closeDropdowns();\n }\n };\n\n disconnectedCallback(): void {\n if (this.resizeObserver) {\n this.disconnectResizeObserver(this.resizeObserver);\n }\n }\n\n private disconnectResizeObserver(\n resizeObserver: SharedResizeObserverInterface\n ) {\n resizeObserver.removeObserver({\n target: this.sortSelectorContainer,\n handler: this,\n });\n\n resizeObserver.removeObserver({\n target: this.desktopSortContainer,\n handler: this,\n });\n }\n\n private setupResizeObserver() {\n if (!this.resizeObserver) return;\n this.resizeObserver.addObserver({\n target: this.sortSelectorContainer,\n handler: this,\n });\n\n this.resizeObserver.addObserver({\n target: this.desktopSortContainer,\n handler: this,\n });\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n if (entry.target === this.desktopSortContainer) {\n this.desktopSortContainerWidth = entry.contentRect.width;\n } else if (entry.target === this.sortSelectorContainer) {\n this.selectorBarContainerWidth = entry.contentRect.width;\n }\n }\n\n /**\n * Whether to show the mobile sort bar because there is not enough space\n * for the desktop sort bar.\n */\n private get mobileSelectorVisible() {\n return this.selectorBarContainerWidth - 10 < this.desktopSortContainerWidth;\n }\n\n /**\n * Template to render the alphabet bar, or `nothing` if it should not be rendered\n * for the current sort\n */\n private get alphaBarTemplate(): TemplateResult | typeof nothing {\n if (!['title', 'creator'].includes(this.selectedSort)) return nothing;\n\n if (this.alphaSelectorVisible === null) {\n if (this.selectedSort === 'creator') return this.creatorSelectorBar;\n if (this.selectedSort === 'title') return this.titleSelectorBar;\n } else {\n return this.alphaSelectorVisible === 'creator'\n ? this.creatorSelectorBar\n : this.titleSelectorBar;\n }\n\n return nothing;\n }\n\n /** Template to render the sort direction toggle button */\n private get sortDirectionSelectorTemplate(): TemplateResult {\n const oppositeSortDirectionReadable =\n this.sortDirection === 'asc' ? 'descending' : 'ascending';\n const srLabel = `Change to ${oppositeSortDirectionReadable} sort`;\n\n return html`\n <button\n class=\"sort-direction-selector\"\n ?disabled=${!this.canChangeSortDirection}\n @click=${this.handleSortDirectionClicked}\n >\n <span class=\"sr-only\">${srLabel}</span>\n ${this.sortDirectionIcon}\n </button>\n `;\n }\n\n /** Template to render the sort direction button's icon in the correct current state */\n private get sortDirectionIcon(): TemplateResult {\n // Show a fully disabled icon for sort options without direction support\n if (!this.canChangeSortDirection) {\n return html`<div class=\"sort-direction-icon\">${sortDisabledIcon}</div>`;\n }\n\n // For all other sorts, show the ascending/descending direction\n return html`\n <div class=\"sort-direction-icon\">\n ${this.finalizedSortDirection === 'asc' ? sortUpIcon : sortDownIcon}\n </div>\n `;\n }\n\n /** The template to render all the sort options in desktop view */\n private get desktopSortSelectorTemplate() {\n return html`\n <div\n id=\"desktop-sort-container\"\n class=${this.mobileSelectorVisible ? 'hidden' : 'visible'}\n >\n <ul id=\"desktop-sort-selector\">\n ${this.showRelevance\n ? html`<li>\n ${this.getSortDisplayOption(SortField.relevance, {\n onClick: () => {\n this.dropdownBackdropVisible = false;\n if (this.finalizedSortField !== SortField.relevance) {\n this.clearAlphaBarFilters();\n this.setSelectedSort(SortField.relevance);\n }\n },\n })}\n </li>`\n : nothing}\n <li>${this.viewsDropdownTemplate}</li>\n <li>\n ${this.getSortDisplayOption(SortField.title, {\n onClick: () => {\n this.dropdownBackdropVisible = false;\n if (this.finalizedSortField !== SortField.title) {\n this.alphaSelectorVisible = 'title';\n this.selectedCreatorFilter = null;\n this.setSelectedSort(SortField.title);\n this.emitCreatorLetterChangedEvent();\n }\n },\n })}\n </li>\n <li>${this.dateDropdownTemplate}</li>\n <li>\n ${this.getSortDisplayOption(SortField.creator, {\n onClick: () => {\n this.dropdownBackdropVisible = false;\n if (this.finalizedSortField !== SortField.creator) {\n this.alphaSelectorVisible = 'creator';\n this.selectedTitleFilter = null;\n this.setSelectedSort(SortField.creator);\n this.emitTitleLetterChangedEvent();\n }\n },\n })}\n </li>\n </ul>\n </div>\n `;\n }\n\n /** The template to render all the sort options in mobile view */\n private get mobileSortSelectorTemplate() {\n const displayedOptions = Object.values(SORT_OPTIONS)\n .filter(opt => opt.shownInSortBar)\n .filter(opt => this.showRelevance || opt.field !== SortField.relevance)\n .filter(\n opt => this.showDateFavorited || opt.field !== SortField.datefavorited\n );\n\n return html`\n <div\n id=\"mobile-sort-container\"\n class=${this.mobileSelectorVisible ? 'visible' : 'hidden'}\n >\n ${this.getSortDropdown({\n displayName: html`${SORT_OPTIONS[this.finalizedSortField]\n .displayName}`,\n id: 'mobile-dropdown',\n selected: true,\n dropdownOptions: displayedOptions.map(opt =>\n this.getDropdownOption(opt.field)\n ),\n selectedOption: this.finalizedSortField,\n onOptionSelected: this.mobileSortChanged,\n onDropdownClick: () => {\n this.dropdownBackdropVisible = this.mobileDropdown.open;\n this.mobileDropdown.classList.toggle(\n 'open',\n this.mobileDropdown.open\n );\n },\n })}\n </div>\n `;\n }\n\n /**\n * This generates each of the non-dropdown sort option links.\n *\n * It manages the display value and the selected state of the option.\n *\n * @param sortField\n * @param options {\n * onClick?: (e: Event) => void; If this is provided, it will also be called when the option is clicked.\n * displayName?: TemplateResult; The name to display for the option. Defaults to the sortField display name.\n * selected?: boolean; true if the option is selected. Defaults to the selectedSort === sortField.\n * }\n * @returns\n */\n private getSortDisplayOption(\n sortField: SortField,\n options?: {\n displayName?: TemplateResult;\n selected?: boolean;\n onClick?: (e: Event) => void;\n }\n ): TemplateResult {\n const isSelected =\n options?.selected ?? this.finalizedSortField === sortField;\n const displayName =\n options?.displayName ?? SORT_OPTIONS[sortField].displayName;\n return html`\n <button\n class=${isSelected ? 'selected' : nothing}\n data-title=\"${displayName}\"\n @click=${(e: Event) => {\n e.preventDefault();\n options?.onClick?.(e);\n }}\n >\n ${displayName}\n </button>\n `;\n }\n\n /**\n * Generates a dropdown component containing multiple grouped sort options.\n *\n * @param options.displayName The name to use for the dropdown's visible label\n * @param options.id The id to apply to the dropdown element\n * @param options.dropdownOptions An array of option objects used to populate the dropdown\n * @param options.selectedOption The id of the option that should be initially selected\n * @param options.selected A boolean indicating whether this dropdown should use its\n * selected appearance\n * @param options.onOptionSelected A handler for optionSelected events coming from the dropdown\n * @param options.onDropdownClick A handler for click events on the dropdown\n * @param options.onLabelInteraction A handler for click events and Enter/Space keydown events\n * on the dropdown's label\n */\n private getSortDropdown(options: {\n displayName: TemplateResult;\n id?: string;\n dropdownOptions: optionInterface[];\n selectedOption?: string;\n selected: boolean;\n onOptionSelected?: (e: CustomEvent<{ option: optionInterface }>) => void;\n onDropdownClick?: (e: PointerEvent) => void;\n onLabelInteraction?: (e: Event) => void;\n }): TemplateResult {\n return html`\n <ia-dropdown\n id=${options.id ?? nothing}\n class=${options.selected ? 'selected' : nothing}\n displayCaret\n closeOnSelect\n includeSelectedOption\n .openViaButton=${options.selected}\n .options=${options.dropdownOptions}\n .selectedOption=${options.selectedOption ?? ''}\n @optionSelected=${options.onOptionSelected ?? nothing}\n @click=${options.onDropdownClick ?? nothing}\n >\n <span\n class=\"dropdown-label\"\n slot=\"dropdown-label\"\n data-title=\"${options.displayName.values}\"\n @click=${options.onLabelInteraction ?? nothing}\n @keydown=${options.onLabelInteraction\n ? (e: KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n options.onLabelInteraction?.(e);\n }\n }\n : nothing}\n >\n ${options.displayName}\n </span>\n </ia-dropdown>\n `;\n }\n\n /** Generates a single dropdown option object for the given sort field */\n private getDropdownOption(sortField: SortField): optionInterface {\n return {\n id: sortField,\n selectedHandler: () => {\n this.selectDropdownSortField(sortField);\n },\n label: html`\n <span class=\"dropdown-option-label\">\n ${SORT_OPTIONS[sortField].displayName}\n </span>\n `,\n };\n }\n\n /** Handler for when any sort dropdown option is selected */\n private dropdownOptionSelected(e: CustomEvent<{ option: optionInterface }>) {\n this.dropdownBackdropVisible = false;\n this.clearAlphaBarFilters();\n this.setSelectedSort(e.detail.option.id as SortField);\n }\n\n /** The template to render for the views dropdown */\n private get viewsDropdownTemplate(): TemplateResult {\n return this.getSortDropdown({\n displayName: html`${this.viewSortField}`,\n id: 'views-dropdown',\n selected: this.viewOptionSelected,\n dropdownOptions: [\n this.getDropdownOption(SortField.weeklyview),\n this.getDropdownOption(SortField.alltimeview),\n ],\n selectedOption: this.viewOptionSelected ? this.selectedSort : '',\n onOptionSelected: this.dropdownOptionSelected,\n onDropdownClick: () => {\n this.dateDropdown.open = false;\n this.dropdownBackdropVisible = this.viewsDropdown.open;\n this.viewsDropdown.classList.toggle('open', this.viewsDropdown.open);\n },\n onLabelInteraction: (e: Event) => {\n if (!this.viewsDropdown.open && !this.viewOptionSelected) {\n e.stopPropagation();\n this.clearAlphaBarFilters();\n this.setSelectedSort(SortField.weeklyview);\n }\n },\n });\n }\n\n /** The template to render for the date dropdown */\n private get dateDropdownTemplate(): TemplateResult {\n return this.getSortDropdown({\n displayName: html`${this.dateSortField}`,\n id: 'date-dropdown',\n selected: this.dateOptionSelected,\n dropdownOptions: [\n ...(this.showDateFavorited\n ? [this.getDropdownOption(SortField.datefavorited)]\n : []),\n this.getDropdownOption(SortField.date),\n this.getDropdownOption(SortField.datearchived),\n this.getDropdownOption(SortField.datereviewed),\n this.getDropdownOption(SortField.dateadded),\n ],\n selectedOption: this.dateOptionSelected ? this.selectedSort : '',\n onOptionSelected: this.dropdownOptionSelected,\n onDropdownClick: () => {\n this.viewsDropdown.open = false;\n this.dropdownBackdropVisible = this.dateDropdown.open;\n this.dateDropdown.classList.toggle('open', this.dateDropdown.open);\n },\n onLabelInteraction: (e: Event) => {\n if (!this.dateDropdown.open && !this.dateOptionSelected) {\n e.stopPropagation();\n this.clearAlphaBarFilters();\n this.setSelectedSort(this.defaultDateSortField);\n }\n },\n });\n }\n\n /** Handler for when a new mobile sort dropdown option is selected */\n private mobileSortChanged(e: CustomEvent<{ option: optionInterface }>) {\n this.dropdownBackdropVisible = false;\n\n const sortField = e.detail.option.id as SortField;\n this.setSelectedSort(sortField);\n\n this.alphaSelectorVisible = null;\n if (sortField !== 'title' && this.selectedTitleFilter) {\n this.selectedTitleFilter = null;\n this.emitTitleLetterChangedEvent();\n }\n if (sortField !== 'creator' && this.selectedCreatorFilter) {\n this.selectedCreatorFilter = null;\n this.emitCreatorLetterChangedEvent();\n }\n }\n\n /** Template for rendering the three display mode options */\n private get displayOptionTemplate() {\n return html`\n <ul>\n <li>\n <button\n id=\"grid-button\"\n @click=${() => {\n this.displayMode = 'grid';\n }}\n class=${this.displayMode === 'grid' ? 'active' : ''}\n title=\"Tile view\"\n >\n ${tileIcon}\n </button>\n </li>\n <li>\n <button\n id=\"list-detail-button\"\n @click=${() => {\n this.displayMode = 'list-detail';\n }}\n class=${this.displayMode === 'list-detail' ? 'active' : ''}\n title=\"List view\"\n >\n ${listIcon}\n </button>\n </li>\n <li>\n <button\n id=\"list-compact-button\"\n @click=${() => {\n this.displayMode = 'list-compact';\n }}\n class=${this.displayMode === 'list-compact' ? 'active' : ''}\n title=\"Compact list view\"\n >\n ${compactIcon}\n </button>\n </li>\n </ul>\n `;\n }\n\n /**\n * Template for rendering the transparent backdrop to capture clicks outside the\n * dropdown menu while it is open.\n */\n private get dropdownBackdrop() {\n return html`\n <div\n id=\"sort-selector-backdrop\"\n @keyup=${this.closeDropdowns}\n @click=${this.closeDropdowns}\n ></div>\n `;\n }\n\n /** Closes all of the sorting dropdown components' menus */\n private closeDropdowns() {\n this.dropdownBackdropVisible = false;\n const allDropdowns = [\n this.viewsDropdown,\n this.dateDropdown,\n this.mobileDropdown,\n ];\n for (const dropdown of allDropdowns) {\n dropdown.open = false;\n dropdown.classList.remove('open');\n }\n }\n\n private selectDropdownSortField(sortField: SortField) {\n // When a dropdown sort option is selected, we additionally need to clear the backdrop\n this.dropdownBackdropVisible = false;\n this.setSelectedSort(sortField);\n }\n\n private clearAlphaBarFilters() {\n this.alphaSelectorVisible = null;\n this.selectedTitleFilter = null;\n this.selectedCreatorFilter = null;\n this.emitTitleLetterChangedEvent();\n this.emitCreatorLetterChangedEvent();\n }\n\n private setSortDirection(sortDirection: SortDirection) {\n this.sortDirection = sortDirection;\n this.emitSortChangedEvent();\n }\n\n /** Toggles the current sort direction between 'asc' and 'desc' */\n private toggleSortDirection() {\n this.setSortDirection(\n this.finalizedSortDirection === 'desc' ? 'asc' : 'desc'\n );\n }\n\n private handleSortDirectionClicked(): void {\n if (\n !this.sortDirection &&\n this.defaultSortField &&\n this.defaultSortDirection\n ) {\n // When the sort direction is merely defaulted (not set by the user), clicking\n // the toggled button should \"promote\" the default sort to an explicitly-set one\n // and then toggle it as usual.\n this.selectedSort = this.defaultSortField;\n this.sortDirection = this.defaultSortDirection;\n }\n\n this.toggleSortDirection();\n }\n\n private setSelectedSort(sort: SortField) {\n this.selectedSort = sort;\n // Apply this field's default sort direction\n const sortOption = SORT_OPTIONS[sort];\n this.sortDirection = sortOption.defaultSortDirection;\n this.emitSortChangedEvent();\n }\n\n /** The current sort field, or the default one if no explicit sort is set */\n private get finalizedSortField(): SortField {\n return this.selectedSort === SortField.default\n ? this.defaultSortField\n : this.selectedSort;\n }\n\n /** The current sort direction, or the default one if no explicit direction is set */\n private get finalizedSortDirection(): SortDirection | null {\n return this.sortDirection === null\n ? this.defaultSortDirection\n : this.sortDirection;\n }\n\n /** Whether the sort direction button should be enabled for the current sort */\n private get canChangeSortDirection(): boolean {\n return SORT_OPTIONS[this.finalizedSortField].canSetDirection;\n }\n\n /**\n * There are four date sort options.\n *\n * This checks to see if the current sort is one of them.\n *\n * @readonly\n * @private\n * @type {boolean}\n * @memberof SortFilterBar\n */\n private get dateOptionSelected(): boolean {\n const dateSortFields: SortField[] = [\n SortField.datefavorited,\n SortField.datearchived,\n SortField.date,\n SortField.datereviewed,\n SortField.dateadded,\n ];\n return dateSortFields.includes(this.finalizedSortField);\n }\n\n /**\n * There are two view sort options.\n *\n * This checks to see if the current sort is one of them.\n *\n * @readonly\n * @private\n * @type {boolean}\n * @memberof SortFilterBar\n */\n private get viewOptionSelected(): boolean {\n const viewSortFields: SortField[] = [\n SortField.alltimeview,\n SortField.weeklyview,\n ];\n return viewSortFields.includes(this.finalizedSortField);\n }\n\n /**\n * The default field for the date sort dropdown.\n * This is Date Favorited when that option is available, or Date Published otherwise.\n */\n private get defaultDateSortField(): SortField {\n return this.showDateFavorited ? SortField.datefavorited : SortField.date;\n }\n\n /**\n * The display name of the current date field\n *\n * @readonly\n * @private\n * @type {string}\n * @memberof SortFilterBar\n */\n private get dateSortField(): string {\n const defaultDateSort = SORT_OPTIONS[this.defaultDateSortField];\n const currentDateSort = this.dateOptionSelected\n ? SORT_OPTIONS[this.finalizedSortField] ?? defaultDateSort\n : defaultDateSort;\n return currentDateSort.displayName;\n }\n\n /**\n * The display name of the current view field\n *\n * @readonly\n * @private\n * @type {string}\n * @memberof SortFilterBar\n */\n private get viewSortField(): string {\n const defaultViewSort = SORT_OPTIONS[SortField.weeklyview];\n const currentViewSort = this.viewOptionSelected\n ? SORT_OPTIONS[this.finalizedSortField] ?? defaultViewSort\n : defaultViewSort;\n return currentViewSort.displayName;\n }\n\n private get titleSelectorBar() {\n return html` <alpha-bar\n .selectedLetter=${this.selectedTitleFilter}\n .letterCounts=${this.prefixFilterCountMap?.title}\n ariaLandmarkLabel=\"Filter by title letter\"\n @letterChanged=${this.titleLetterChanged}\n ></alpha-bar>`;\n }\n\n private get creatorSelectorBar() {\n return html` <alpha-bar\n .selectedLetter=${this.selectedCreatorFilter}\n .letterCounts=${this.prefixFilterCountMap?.creator}\n ariaLandmarkLabel=\"Filter by creator letter\"\n @letterChanged=${this.creatorLetterChanged}\n ></alpha-bar>`;\n }\n\n private titleLetterChanged(\n e: CustomEvent<{ selectedLetter: string | undefined }>\n ) {\n this.selectedTitleFilter = e.detail.selectedLetter ?? null;\n this.emitTitleLetterChangedEvent();\n }\n\n private creatorLetterChanged(\n e: CustomEvent<{ selectedLetter: string | undefined }>\n ) {\n this.selectedCreatorFilter = e.detail.selectedLetter ?? null;\n this.emitCreatorLetterChangedEvent();\n }\n\n private emitTitleLetterChangedEvent() {\n const event = new CustomEvent<{ selectedLetter: string | null }>(\n 'titleLetterChanged',\n {\n detail: { selectedLetter: this.selectedTitleFilter },\n }\n );\n this.dispatchEvent(event);\n }\n\n private emitCreatorLetterChangedEvent() {\n const event = new CustomEvent<{ selectedLetter: string | null }>(\n 'creatorLetterChanged',\n {\n detail: { selectedLetter: this.selectedCreatorFilter },\n }\n );\n this.dispatchEvent(event);\n }\n\n private displayModeChanged() {\n const event = new CustomEvent<{\n displayMode?: CollectionDisplayMode;\n }>('displayModeChanged', {\n detail: { displayMode: this.displayMode },\n });\n this.dispatchEvent(event);\n }\n\n private emitSortChangedEvent() {\n const event = new CustomEvent<{\n selectedSort: SortField;\n sortDirection: SortDirection | null;\n }>('sortChanged', {\n detail: {\n selectedSort: this.selectedSort,\n sortDirection: this.sortDirection,\n },\n });\n this.dispatchEvent(event);\n }\n\n static get styles() {\n return [\n srOnlyStyle,\n css`\n #container {\n position: relative;\n }\n\n #sort-bar {\n display: flex;\n justify-content: space-between;\n align-items: center;\n border-bottom: 1px solid #2c2c2c;\n font-size: 1.4rem;\n }\n\n ul {\n list-style: none;\n display: flex;\n align-items: center;\n margin: 0;\n padding: 0;\n }\n\n li {\n padding: 0;\n }\n\n .sort-by-text {\n margin-right: 5px;\n font-weight: bold;\n white-space: nowrap;\n }\n\n .sort-direction-container {\n display: flex;\n align-self: stretch;\n flex: 0;\n margin: 0 5px;\n }\n\n .sort-direction-selector {\n padding: 0;\n border: none;\n appearance: none;\n background: transparent;\n cursor: pointer;\n }\n\n .sort-direction-selector:disabled {\n cursor: default;\n }\n\n .sort-direction-icon {\n display: flex;\n align-items: center;\n background: none;\n color: inherit;\n border: none;\n padding: 0;\n outline: inherit;\n width: 14px;\n height: 14px;\n }\n\n .sort-direction-icon > svg {\n flex: 1;\n }\n\n #date-sort-selector,\n #view-sort-selector {\n position: absolute;\n left: 150px;\n top: 45px;\n\n z-index: 1;\n padding: 1rem;\n background-color: white;\n border-radius: 2.5rem;\n border: 1px solid #404142;\n }\n\n #sort-selector-container {\n flex: 1;\n display: flex;\n justify-content: flex-start;\n align-items: center;\n }\n\n #desktop-sort-container,\n #mobile-sort-container {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n }\n\n /*\n we move the desktop sort selector offscreen instead of display: none\n because we need to observe the width of it vs its container to determine\n if it's wide enough to display the desktop version and if you display: none,\n the width becomes 0\n */\n #desktop-sort-container.hidden {\n position: absolute;\n top: -9999px;\n left: -9999px;\n visibility: hidden;\n }\n\n #mobile-sort-container.hidden {\n display: none;\n }\n\n #sort-selector-backdrop {\n position: fixed;\n top: 0;\n left: 0;\n width: 100vw;\n height: 100vh;\n z-index: 1;\n background-color: transparent;\n }\n\n #desktop-sort-selector {\n display: inline-flex;\n }\n\n #desktop-sort-selector li {\n display: flex;\n align-items: center;\n padding-left: 5px;\n padding-right: 5px;\n }\n\n #desktop-sort-selector li a {\n padding: 0 5px;\n text-decoration: none;\n color: #333;\n line-height: 2;\n }\n\n #desktop-sort-selector li button {\n padding: 0px 5px;\n border: none;\n background: none;\n font-family: inherit;\n font-size: inherit;\n color: #333;\n line-height: 2;\n cursor: pointer;\n appearance: none;\n }\n\n #desktop-sort-selector li button.selected {\n font-weight: bold;\n }\n\n /**\n * Fix to not shift the sort-bar options when get selected\n */\n #desktop-sort-selector li button::before,\n #desktop-sort-selector .dropdown-label::before {\n display: block;\n content: attr(data-title);\n font-weight: bold;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n #display-style-selector {\n flex: 0;\n }\n\n #display-style-selector button {\n background: none;\n color: inherit;\n border: none;\n appearance: none;\n cursor: pointer;\n -webkit-appearance: none;\n fill: #bbbbbb;\n }\n\n #display-style-selector button.active {\n fill: var(--ia-theme-primary-text-color, #2c2c2c);\n }\n\n #display-style-selector button svg {\n width: 24px;\n height: 24px;\n }\n\n ia-dropdown {\n --dropdownTextColor: white;\n --dropdownOffsetTop: 0;\n --dropdownBorderTopWidth: 0;\n --dropdownBorderTopLeftRadius: 0;\n --dropdownBorderTopRightRadius: 0;\n --dropdownWhiteSpace: nowrap;\n --dropdownListZIndex: 2;\n --dropdownCaretColor: var(--ia-theme-primary-text-color, #2c2c2c);\n --dropdownSelectedTextColor: white;\n --dropdownSelectedBgColor: rgba(255, 255, 255, 0.3);\n --dropdownHoverBgColor: rgba(255, 255, 255, 0.3);\n --caretHeight: 9px;\n --caretWidth: 12px;\n --caretPadding: 0 5px 0 0;\n }\n ia-dropdown.selected .dropdown-label {\n font-weight: bold;\n }\n ia-dropdown.open {\n z-index: 2;\n }\n\n .dropdown-label {\n display: inline-block;\n height: 100%;\n padding-left: 5px;\n font-size: 1.4rem;\n line-height: 2;\n color: var(--ia-theme-primary-text-color, #2c2c2c);\n white-space: nowrap;\n user-select: none;\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-grid-shared-styles.js","sourceRoot":"","sources":["../../../../../src/tiles/grid/styles/tile-grid-shared-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD;;GAEG;AAEH,MAAM,mBAAmB,GAAG,GAAG,CAAA,qCAAqC,CAAC;AACrE,MAAM,gBAAgB,GAAG,GAAG,CAAA,8BAA8B,CAAC;AAE3D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;IAE7B,WAAW;;;wBAGS,mBAAmB;;qBAEtB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GpC,CAAC","sourcesContent":["import { css } from 'lit';\nimport { srOnlyStyle } from '../../../styles/sr-only';\n\n/**\n * Base tile styles\n */\n\nconst tileBackgroundColor = css`var(--tileBackgroundColor, #ffffff)`;\nconst tileCornerRadius = css`var(--tileCornerRadius, 4px)`;\n\nexport const baseTileStyles = css`\n /* Include .sr-only styles for all tiles */\n ${srOnlyStyle}\n\n .container {\n background-color: ${tileBackgroundColor};\n border: 1px #2c2c2c;\n border-radius: ${tileCornerRadius};\n box-shadow: 1px 1px 2px 0;\n box-sizing: border-box;\n height: 100%;\n display: flex;\n flex-direction: column;\n width: 100%;\n }\n\n image-block {\n display: block;\n position: relative;\n text-align: center;\n }\n\n .tile-details {\n display: flex;\n flex-direction: column;\n height: 100%;\n row-gap: 10px;\n font-family: 'Helvetica Neue', ui-sans-serif, system-ui, sans-serif;\n }\n\n .item-info {\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n flex-grow: 1;\n }\n\n #title {\n padding: 0 5px;\n }\n\n .created-by,\n .date-sorted-by,\n .volume-issue,\n .archivist-since {\n display: flex;\n justify-content: left;\n align-items: flex-start;\n padding: 0 5px;\n }\n\n .truncated {\n flex: 1;\n color:
|
|
1
|
+
{"version":3,"file":"tile-grid-shared-styles.js","sourceRoot":"","sources":["../../../../../src/tiles/grid/styles/tile-grid-shared-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAEtD;;GAEG;AAEH,MAAM,mBAAmB,GAAG,GAAG,CAAA,qCAAqC,CAAC;AACrE,MAAM,gBAAgB,GAAG,GAAG,CAAA,8BAA8B,CAAC;AAE3D,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;IAE7B,WAAW;;;wBAGS,mBAAmB;;qBAEtB,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GpC,CAAC","sourcesContent":["import { css } from 'lit';\nimport { srOnlyStyle } from '../../../styles/sr-only';\n\n/**\n * Base tile styles\n */\n\nconst tileBackgroundColor = css`var(--tileBackgroundColor, #ffffff)`;\nconst tileCornerRadius = css`var(--tileCornerRadius, 4px)`;\n\nexport const baseTileStyles = css`\n /* Include .sr-only styles for all tiles */\n ${srOnlyStyle}\n\n .container {\n background-color: ${tileBackgroundColor};\n border: 1px #2c2c2c;\n border-radius: ${tileCornerRadius};\n box-shadow: 1px 1px 2px 0;\n box-sizing: border-box;\n height: 100%;\n display: flex;\n flex-direction: column;\n width: 100%;\n }\n\n image-block {\n display: block;\n position: relative;\n text-align: center;\n }\n\n .tile-details {\n display: flex;\n flex-direction: column;\n height: 100%;\n row-gap: 10px;\n font-family: 'Helvetica Neue', ui-sans-serif, system-ui, sans-serif;\n }\n\n .item-info {\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n flex-grow: 1;\n }\n\n #title {\n padding: 0 5px;\n }\n\n .created-by,\n .date-sorted-by,\n .volume-issue,\n .archivist-since {\n display: flex;\n justify-content: left;\n align-items: flex-start;\n padding: 0 5px;\n }\n\n .truncated {\n flex: 1;\n color: #2c2c2c;\n min-width: 0; /* Important for long words! */\n text-align: left;\n line-height: 15px;\n text-overflow: ellipsis;\n overflow: hidden;\n word-wrap: break-word;\n -webkit-line-clamp: 3;\n -webkit-box-orient: vertical;\n }\n\n h4.truncated {\n display: -webkit-box;\n margin: 0px;\n line-height: 15px;\n font-size: 14px;\n font-weight: 500;\n padding-bottom: 1px;\n }\n\n span {\n display: -webkit-box;\n font-size: 1.4rem;\n line-height: 15px;\n overflow: hidden;\n word-wrap: break-word;\n -webkit-line-clamp: 1;\n -webkit-box-orient: vertical;\n padding-bottom: 1px;\n }\n\n .container:hover > .tile-details > .item-info > #title > .truncated {\n text-decoration: underline;\n }\n\n /** this is a workaround for Safari 15 where the hover effects are not working */\n #title:hover > .truncated {\n text-decoration: underline;\n }\n\n .info-button {\n position: absolute;\n right: 10px;\n top: 10px;\n margin: 0;\n padding: 0;\n border: none;\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n background: rgba(220, 220, 220, 0.5);\n color: white;\n font-size: 2rem;\n font-weight: bold;\n line-height: 1;\n text-shadow: black 1px 1px 3px;\n overflow: visible;\n aspect-ratio: 1 / 1;\n z-index: 1;\n }\n\n .hidden {\n display: none;\n }\n`;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-stats.js","sourceRoot":"","sources":["../../../../src/tiles/grid/tile-stats.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAE5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAGvD,IAAa,SAAS,GAAtB,MAAa,SAAU,SAAQ,UAAU;IAavC,MAAM;;QACJ,MAAM,iBAAiB,GAAG,WAAW,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;QACvE,MAAM,oBAAoB,GAAG,WAAW,CACtC,IAAI,CAAC,YAAY,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AAE,CAAC;4CAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAuB;AAXvC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAuIrB;SAvIY,SAAS","sourcesContent":["import { css, CSSResultGroup, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { favoriteFilledIcon } from '../../assets/img/icons/favorite-filled';\nimport { reviewsIcon } from '../../assets/img/icons/reviews';\nimport { uploadIcon } from '../../assets/img/icons/upload';\nimport { viewsIcon } from '../../assets/img/icons/views';\nimport { srOnlyStyle } from '../../styles/sr-only';\n\nimport { formatCount } from '../../utils/format-count';\n\n@customElement('tile-stats')\nexport class TileStats extends LitElement {\n @property({ type: String }) mediatype?: string;\n\n @property({ type: Number }) itemCount?: number;\n\n @property({ type: Number }) viewCount?: number;\n\n @property({ type: String }) viewLabel?: number;\n\n @property({ type: Number }) favCount?: number;\n\n @property({ type: Number }) commentCount?: number;\n\n render() {\n const formattedFavCount = formatCount(this.favCount, 'short', 'short');\n const formattedReviewCount = formatCount(\n this.commentCount,\n 'short',\n 'short'\n );\n\n const uploadsOrViewsTitle =\n this.mediatype === 'account'\n ? `${this.itemCount} uploads`\n : `${this.viewCount} ${this.viewLabel ?? 'all-time views'}`;\n\n return html`\n <div class=\"item-stats\">\n <p class=\"sr-only\">\n ${this.mediatype === 'account' ? 'Account Stats' : 'Item Stats'}\n </p>\n <ul id=\"stats-row\">\n <li class=\"col\">\n <p class=\"sr-only\">Mediatype:</p>\n <mediatype-icon .mediatype=${this.mediatype}></mediatype-icon>\n </li>\n <li class=\"col\" title=\"${uploadsOrViewsTitle}\">\n ${this.mediatype === 'account' ? uploadIcon : viewsIcon}\n <p class=\"status-text\">\n <span class=\"sr-only\">\n ${this.mediatype === 'account' ? 'Uploads:' : 'Views:'}\n </span>\n ${formatCount(\n this.mediatype === 'account' ? this.itemCount : this.viewCount,\n 'short',\n 'short'\n )}\n </p>\n </li>\n <li class=\"col\" title=\"${formattedFavCount} favorites\">\n ${favoriteFilledIcon}\n <p class=\"status-text\">\n <span class=\"sr-only\">Favorites:</span>\n ${formattedFavCount}\n </p>\n </li>\n <li class=\"col reviews\" title=\"${formattedReviewCount} reviews\">\n ${reviewsIcon}\n <p class=\"status-text\">\n <span class=\"sr-only\">Reviews:</span>\n ${formattedReviewCount}\n </p>\n </li>\n </ul>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return [\n srOnlyStyle,\n css`\n mediatype-icon {\n --iconHeight: 25px;\n --iconWidth: 25px;\n }\n\n ul {\n all: unset; // unset all property values\n list-style-type: none; // remove default list-style\n }\n\n li {\n list-style-type: none; // remove default list-style\n }\n\n svg {\n height: 13px;\n width: 13px;\n display: block;\n margin: auto;\n pointer-events: none;\n }\n\n /* Make the reviews icon slightly smaller/lower, for even visual weight */\n .reviews svg {\n height: 11px;\n width: 11px;\n margin-top: 2px;\n }\n\n .item-stats {\n height: 30px;\n padding-left: 5px;\n padding-right: 5px;\n font-family: 'Helvetica Neue', ui-sans-serif, system-ui, sans-serif;\n text-align: center;\n }\n\n #stats-row {\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n padding-bottom: 5px;\n }\n\n .col {\n min-width: 15px;\n max-width: 25%;\n height: 25px;\n }\n\n .status-text {\n font-size: 14px;\n height: 15px;\n color:
|
|
1
|
+
{"version":3,"file":"tile-stats.js","sourceRoot":"","sources":["../../../../src/tiles/grid/tile-stats.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,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EAC9D,OAAO,EACP,OAAO,CACR;;;mCAGoB,iBAAiB;cACtC,kBAAkB;;;gBAGhB,iBAAiB;;;2CAGU,oBAAoB;cACjD,WAAW;;;gBAGT,oBAAoB;;;;;KAK/B,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,WAAW;YACX,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA6DF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAtI6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAoB;AAEnB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CAAmB;AAElB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAuB;AAXvC,SAAS;IADrB,aAAa,CAAC,YAAY,CAAC;GACf,SAAS,CAuIrB;SAvIY,SAAS","sourcesContent":["import { css, CSSResultGroup, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\nimport { favoriteFilledIcon } from '../../assets/img/icons/favorite-filled';\nimport { reviewsIcon } from '../../assets/img/icons/reviews';\nimport { uploadIcon } from '../../assets/img/icons/upload';\nimport { viewsIcon } from '../../assets/img/icons/views';\nimport { srOnlyStyle } from '../../styles/sr-only';\n\nimport { formatCount } from '../../utils/format-count';\n\n@customElement('tile-stats')\nexport class TileStats extends LitElement {\n @property({ type: String }) mediatype?: string;\n\n @property({ type: Number }) itemCount?: number;\n\n @property({ type: Number }) viewCount?: number;\n\n @property({ type: String }) viewLabel?: number;\n\n @property({ type: Number }) favCount?: number;\n\n @property({ type: Number }) commentCount?: number;\n\n render() {\n const formattedFavCount = formatCount(this.favCount, 'short', 'short');\n const formattedReviewCount = formatCount(\n this.commentCount,\n 'short',\n 'short'\n );\n\n const uploadsOrViewsTitle =\n this.mediatype === 'account'\n ? `${this.itemCount} uploads`\n : `${this.viewCount} ${this.viewLabel ?? 'all-time views'}`;\n\n return html`\n <div class=\"item-stats\">\n <p class=\"sr-only\">\n ${this.mediatype === 'account' ? 'Account Stats' : 'Item Stats'}\n </p>\n <ul id=\"stats-row\">\n <li class=\"col\">\n <p class=\"sr-only\">Mediatype:</p>\n <mediatype-icon .mediatype=${this.mediatype}></mediatype-icon>\n </li>\n <li class=\"col\" title=\"${uploadsOrViewsTitle}\">\n ${this.mediatype === 'account' ? uploadIcon : viewsIcon}\n <p class=\"status-text\">\n <span class=\"sr-only\">\n ${this.mediatype === 'account' ? 'Uploads:' : 'Views:'}\n </span>\n ${formatCount(\n this.mediatype === 'account' ? this.itemCount : this.viewCount,\n 'short',\n 'short'\n )}\n </p>\n </li>\n <li class=\"col\" title=\"${formattedFavCount} favorites\">\n ${favoriteFilledIcon}\n <p class=\"status-text\">\n <span class=\"sr-only\">Favorites:</span>\n ${formattedFavCount}\n </p>\n </li>\n <li class=\"col reviews\" title=\"${formattedReviewCount} reviews\">\n ${reviewsIcon}\n <p class=\"status-text\">\n <span class=\"sr-only\">Reviews:</span>\n ${formattedReviewCount}\n </p>\n </li>\n </ul>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return [\n srOnlyStyle,\n css`\n mediatype-icon {\n --iconHeight: 25px;\n --iconWidth: 25px;\n }\n\n ul {\n all: unset; // unset all property values\n list-style-type: none; // remove default list-style\n }\n\n li {\n list-style-type: none; // remove default list-style\n }\n\n svg {\n height: 13px;\n width: 13px;\n display: block;\n margin: auto;\n pointer-events: none;\n }\n\n /* Make the reviews icon slightly smaller/lower, for even visual weight */\n .reviews svg {\n height: 11px;\n width: 11px;\n margin-top: 2px;\n }\n\n .item-stats {\n height: 30px;\n padding-left: 5px;\n padding-right: 5px;\n font-family: 'Helvetica Neue', ui-sans-serif, system-ui, sans-serif;\n text-align: center;\n }\n\n #stats-row {\n display: flex;\n justify-content: space-between;\n flex-wrap: wrap;\n width: 100%;\n padding-bottom: 5px;\n }\n\n .col {\n min-width: 15px;\n max-width: 25%;\n height: 25px;\n }\n\n .status-text {\n font-size: 14px;\n height: 15px;\n color: #2c2c2c;\n line-height: 17px;\n margin: auto;\n display: block;\n text-align: center;\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -252,11 +252,7 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
252
252
|
|
|
253
253
|
item-tile {
|
|
254
254
|
--tileBorderColor: #dddddd;
|
|
255
|
-
--
|
|
256
|
-
--imageBlockBackgroundColor: var(
|
|
257
|
-
--ia-theme-primary-background-color,
|
|
258
|
-
#f1f1f4
|
|
259
|
-
);
|
|
255
|
+
--imageBlockBackgroundColor: #f1f1f4;
|
|
260
256
|
}
|
|
261
257
|
|
|
262
258
|
#container {
|