@internetarchive/collection-browser 4.8.1-webdev-9227.2 → 4.8.1-webdev-9227.3
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.js +4 -1
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row-template.js +5 -2
- package/dist/src/collection-facets/facet-row-template.js.map +1 -1
- package/dist/src/locales/es.d.ts +1 -6
- package/dist/src/locales/es.js +1 -6
- package/dist/src/locales/es.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +4 -2
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js +3 -1
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +4 -1
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +11 -2
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/utils/format-count.d.ts +3 -1
- package/dist/src/utils/format-count.js +19 -59
- package/dist/src/utils/format-count.js.map +1 -1
- package/dist/src/utils/format-unit-size.d.ts +1 -1
- package/dist/src/utils/format-unit-size.js +3 -2
- package/dist/src/utils/format-unit-size.js.map +1 -1
- package/dist/src/utils/get-locale.d.ts +14 -0
- package/dist/src/utils/get-locale.js +18 -0
- package/dist/src/utils/get-locale.js.map +1 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-list.js","sourceRoot":"","sources":["../../../../src/tiles/list/tile-list.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkC,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EAAE,GAAG,EA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qBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACS;AAEnB;IAAhB,KAAK,EAAE;iDAAmE;AAtBhE,QAAQ;IAFpB,aAAa,CAAC,WAAW,CAAC;IAC1B,SAAS,EAAE;GACC,QAAQ,CAorBpB","sourcesContent":["import { css, html, nothing, PropertyValues, TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { join } from 'lit/directives/join.js';\nimport { map } from 'lit/directives/map.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { localized, msg, str } from '@lit/localize';\nimport DOMPurify from 'dompurify';\n\nimport type { SortParam } from '@internetarchive/search-service';\nimport { suppressedCollections } from '../../models';\nimport type { CollectionTitles } from '../../data-source/models';\nimport { BaseTileComponent } from '../base-tile-component';\n\nimport { formatCount, NumberFormat } from '../../utils/format-count';\nimport type { DateFormat } from '../../utils/format-date';\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\nimport { tileActionStyles } from '../../styles/tile-action-styles';\n\nimport '../image-block';\nimport '../review-block';\nimport '../text-snippet-block';\nimport '../tile-mediatype-icon';\n\n@customElement('tile-list')\n@localized()\nexport class TileList extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - tileActions: TileAction[] = [];\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - defaultSortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n * - useLocalTime = false;\n */\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n @state() private collectionLinks: (TemplateResult | typeof nothing)[] = [];\n\n render() {\n return html`\n <div id=\"list-line\" class=\"${this.classSize}\">\n ${this.classSize === 'mobile'\n ? this.mobileTemplate\n : this.desktopTemplate}\n </div>\n `;\n }\n\n /**\n * Templates\n */\n private get mobileTemplate() {\n return html`\n <div id=\"list-line-top\">\n <div id=\"list-line-left\">\n ${this.imageBlockTemplate} ${this.renderTileActions('list-detail')}\n </div>\n <div id=\"list-line-right\">\n <div id=\"title-line\">\n <div id=\"title\">${this.titleTemplate}</div>\n ${this.iconRightTemplate}\n </div>\n </div>\n </div>\n <div id=\"list-line-bottom\">${this.detailsTemplate}</div>\n `;\n }\n\n private get desktopTemplate() {\n return html`\n <div id=\"list-line-left\">\n ${this.imageBlockTemplate} ${this.renderTileActions('list-detail')}\n </div>\n <div id=\"list-line-right\">\n <div id=\"title-line\">\n <div id=\"title\">${this.titleTemplate}</div>\n ${this.iconRightTemplate}\n </div>\n ${this.detailsTemplate}\n </div>\n `;\n }\n\n private get imageBlockTemplate() {\n if (!this.model) return nothing;\n\n const isCollection = this.model.mediatype === 'collection';\n const href = this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n isCollection,\n );\n\n return html`<a\n id=\"image-link\"\n title=${msg(str`View ${this.model?.title}`)}\n href=${href}\n >\n <image-block\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .isCompactTile=${false}\n .isListTile=${true}\n .viewSize=${this.classSize}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n >\n </image-block>\n </a> `;\n }\n\n private get detailsTemplate() {\n return html`\n ${this.itemLineTemplate} ${this.creatorTemplate}\n <div id=\"dates-line\">\n ${this.datePublishedTemplate} ${this.dateSortByTemplate}\n ${this.webArchivesCaptureDatesTemplate}\n </div>\n <div id=\"views-line\">\n ${this.viewsTemplate} ${this.ratingTemplate} ${this.reviewsTemplate}\n </div>\n ${this.topicsTemplate} ${this.collectionsTemplate}\n ${this.descriptionTemplate} ${this.textSnippetsTemplate}\n ${this.reviewBlockTemplate}\n `;\n }\n\n // Data templates\n private get iconRightTemplate() {\n return html`\n <a\n id=\"icon-right\"\n href=${this.mediatypeURL}\n title=${msg(str`See more: ${this.model?.mediatype}`)}\n >\n <tile-mediatype-icon .model=${this.model}> </tile-mediatype-icon>\n </a>\n `;\n }\n\n private get titleTemplate() {\n if (!this.model?.title) {\n return nothing;\n }\n\n // If the model has a server-specified href, use it\n // Otherwise construct a details link using the identifier\n return this.model?.href\n ? html`<a href=\"${this.baseNavigationUrl}${this.model.href}\"\n >${this.model.title ?? this.model.identifier}</a\n >`\n : this.detailsLink(\n this.model.identifier,\n this.model.title,\n this.model.mediatype === 'collection',\n );\n }\n\n private get itemLineTemplate() {\n const source = this.sourceTemplate;\n const volume = this.volumeTemplate;\n const issue = this.issueTemplate;\n if (!source && !volume && !issue) {\n return nothing;\n }\n return html` <div id=\"item-line\">${source} ${volume} ${issue}</div> `;\n }\n\n private get sourceTemplate() {\n if (!this.model?.source) {\n return nothing;\n }\n return html`\n <div id=\"source\" class=\"metadata\">\n ${this.labelTemplate(msg('Source'))}\n ${this.searchLink('source', this.model.source)}\n </div>\n `;\n }\n\n private get volumeTemplate() {\n return this.metadataTemplate(this.model?.volume, msg('Volume'));\n }\n\n private get issueTemplate() {\n return this.metadataTemplate(this.model?.issue, msg('Issue'));\n }\n\n private get creatorTemplate() {\n // \"Archivist since\" if account\n if (this.model?.mediatype === 'account') {\n return html`\n <div id=\"creator\" class=\"metadata\">\n <span class=\"label\"\n >${this.displayValueProvider.accountLabel ?? nothing}</span\n >\n </div>\n `;\n }\n // \"Creator\" if not account tile\n if (!this.model?.creators || this.model.creators.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"creator\" class=\"metadata\">\n ${this.labelTemplate(msg('By'))}\n ${join(\n map(this.model.creators, id => this.searchLink('creator', id)),\n ', ',\n )}\n </div>\n `;\n }\n\n private get datePublishedTemplate() {\n // If we're showing a date published of Jan 1 at midnight, only show the year.\n // This is because items with only a year for their publication date are normalized to\n // Jan 1 at midnight timestamps in the search engine documents.\n const date: Date | undefined = this.model?.datePublished;\n let format: DateFormat = 'long';\n if (isFirstMillisecondOfUTCYear(date)) {\n format = 'year-only';\n }\n\n return this.metadataTemplate(\n this.getFormattedDate(date, format),\n msg('Published'),\n );\n }\n\n // Show date label/value when sorted by date type\n // Except datePublished which is always shown\n private get dateSortByTemplate() {\n if (\n this.effectiveSort &&\n (this.effectiveSort.field === 'addeddate' ||\n this.effectiveSort.field === 'reviewdate' ||\n this.effectiveSort.field === 'publicdate')\n ) {\n return this.metadataTemplate(\n this.getFormattedDate(this.date, 'long'),\n this.displayValueProvider.dateLabel,\n );\n }\n return nothing;\n }\n\n private get viewsTemplate() {\n const isWeeklySort = this.effectiveSort?.field === 'week';\n const viewCount = isWeeklySort\n ? this.model?.weeklyViewCount // weekly views\n : this.model?.viewCount; // all-time views\n if (viewCount == null) return nothing;\n\n // when its a search-tile, we don't have any stats to show\n if (this.model?.mediatype === 'search') {\n return this.metadataTemplate(msg('(Favorited search query)'), '');\n }\n\n return this.metadataTemplate(\n `${formatCount(viewCount, this.formatSize)}`,\n this.displayValueProvider.viewsLabel,\n );\n }\n\n private get ratingTemplate() {\n return this.metadataTemplate(this.model?.averageRating, msg('Avg Rating'));\n }\n\n private get reviewsTemplate() {\n return this.metadataTemplate(this.model?.commentCount, msg('Reviews'));\n }\n\n private get topicsTemplate() {\n if (!this.model?.subjects || this.model.subjects.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"topics\" class=\"metadata\">\n ${this.labelTemplate(msg('Topics'))}\n ${join(\n map(this.model.subjects, id => this.searchLink('subject', id)),\n ', ',\n )}\n </div>\n `;\n }\n\n private get collectionsTemplate() {\n if (!this.collectionLinks || this.collectionLinks.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"collections\" class=\"metadata\">\n ${this.labelTemplate(msg('Collections'))}\n ${join(this.collectionLinks, ', ')}\n </div>\n `;\n }\n\n private get descriptionTemplate() {\n return this.metadataTemplate(\n // Sanitize away any HTML tags and convert line breaks to spaces.\n unsafeHTML(\n DOMPurify.sanitize(this.model?.description?.replace(/\\n/g, ' ') ?? ''),\n ),\n '',\n 'description',\n );\n }\n\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.review) return nothing;\n\n const { reviewtitle, reviewbody, stars } = this.model.review;\n return html`\n <review-block\n viewsize=\"list\"\n title=${ifDefined(reviewtitle)}\n body=${ifDefined(reviewbody)}\n starRating=${ifDefined(stars)}\n >\n </review-block>\n `;\n }\n\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\n if (!this.hasSnippets) return nothing;\n\n return html`<text-snippet-block\n viewsize=\"list\"\n .snippets=${this.model?.snippets}\n ></text-snippet-block>`;\n }\n\n private get hasSnippets(): boolean {\n return !!this.model?.snippets?.length;\n }\n\n private get webArchivesCaptureDatesTemplate():\n | TemplateResult\n | typeof nothing {\n if (!this.model?.captureDates || !this.model.title) return nothing;\n\n return html`\n <ul class=\"capture-dates\">\n ${map(\n this.model.captureDates,\n date =>\n html`<li>\n ${this.displayValueProvider.webArchivesCaptureLink(\n this.model!.title,\n date,\n )}\n </li>`,\n )}\n </ul>\n `;\n }\n\n // Utility functions\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private metadataTemplate(text: any, label = '', id?: string) {\n if (!text) return nothing;\n return html`\n <div id=${ifDefined(id)} class=\"metadata\">\n ${this.labelTemplate(label)} ${text}\n </div>\n `;\n }\n\n private labelTemplate(label: string) {\n return html` ${label\n ? html`<span class=\"label\">${label}: </span>`\n : nothing}`;\n }\n\n private searchLink(field: string, searchTerm: string) {\n if (!field || !searchTerm) {\n return nothing;\n }\n const query = encodeURIComponent(`${field}:\"${searchTerm}\"`);\n // No whitespace after closing tag\n // Note: single ' for href='' to wrap \" in query var gets changed back by yarn format\n return html`<a\n href=\"${this.baseNavigationUrl}/search?query=${query}\"\n rel=\"nofollow\"\n >\n ${DOMPurify.sanitize(searchTerm)}</a\n >`;\n }\n\n private detailsLink(\n identifier?: string,\n text?: string,\n isCollection = false,\n ): TemplateResult | typeof nothing {\n if (!identifier) return nothing;\n\n const linkText = text ?? identifier;\n const linkHref = this.displayValueProvider.itemPageUrl(\n identifier,\n isCollection,\n );\n\n return html`<a href=${linkHref}> ${DOMPurify.sanitize(linkText)} </a>`;\n }\n\n /** The URL of this item's mediatype collection, if defined. */\n private get mediatypeURL(): string | typeof nothing {\n // NB: baseNavigationUrl can be an empty string\n if (this.baseNavigationUrl === undefined || !this.model?.mediatype)\n return nothing;\n\n // Need special handling for certain mediatypes that don't have a top-level collection page\n switch (this.model.mediatype) {\n case 'collection':\n return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;\n case 'account':\n return nothing;\n default:\n return this.displayValueProvider.itemPageUrl(\n this.model.mediatype,\n true,\n );\n }\n }\n\n protected updated(changed: PropertyValues): void {\n if (changed.has('model') || changed.has('collectionTitles')) {\n this.buildCollectionLinks();\n }\n }\n\n private async buildCollectionLinks() {\n if (!this.model?.collections || this.model.collections.length === 0) {\n return;\n }\n\n // Note: quirk of Lit: need to replace collectionLinks array,\n // otherwise it will not re-render. Can't simply alter the array.\n this.collectionLinks = [];\n const newCollectionLinks: (TemplateResult | typeof nothing)[] = [];\n for (const collection of this.model.collections) {\n // Don't include favorites or collections that are meant to be suppressed\n if (\n !suppressedCollections[collection] &&\n !collection.startsWith('fav-')\n ) {\n newCollectionLinks.push(\n this.detailsLink(\n collection,\n this.collectionTitles?.get(collection) ?? collection,\n true,\n ),\n );\n }\n }\n this.collectionLinks = newCollectionLinks;\n }\n\n /*\n * TODO: fix field names to match model in src/collection-browser.ts\n * private get dateSortSelector()\n * @see src/models.ts\n */\n private get date(): Date | undefined {\n switch (this.effectiveSort?.field) {\n case 'date':\n return this.model?.datePublished;\n case 'reviewdate':\n return this.model?.dateReviewed;\n case 'addeddate':\n return this.model?.dateAdded;\n default:\n return this.model?.dateArchived; // publicdate\n }\n }\n\n /**\n * Returns the active sort param if one is set, or the default sort param otherwise.\n */\n private get effectiveSort(): SortParam | null {\n return this.sortParam ?? this.defaultSortParam;\n }\n\n private get classSize(): string {\n if (\n this.mobileBreakpoint &&\n this.currentWidth &&\n this.currentWidth < this.mobileBreakpoint\n ) {\n return 'mobile';\n }\n return 'desktop';\n }\n\n private get formatSize(): NumberFormat {\n if (\n this.mobileBreakpoint &&\n this.currentWidth &&\n this.currentWidth < this.mobileBreakpoint\n ) {\n return 'short';\n }\n return 'long';\n }\n\n static get styles() {\n return [\n tileActionStyles,\n css`\n html {\n font-size: unset;\n }\n\n div {\n font-size: 14px;\n }\n\n div a {\n text-decoration: none;\n }\n\n div a:link {\n color: var(--ia-theme-link-color, #4b64ff);\n }\n\n .label {\n font-weight: bold;\n }\n\n #list-line.mobile {\n --infiniteScrollerRowGap: 20px;\n --infiniteScrollerRowHeight: auto;\n }\n\n #list-line.desktop {\n --infiniteScrollerRowGap: 30px;\n --infiniteScrollerRowHeight: auto;\n }\n\n /* fields */\n #icon-right {\n width: 20px;\n padding-top: 5px;\n --iconHeight: 20px;\n --iconWidth: 20px;\n --iconTextAlign: right;\n margin-top: -8px;\n text-align: right;\n }\n\n #title {\n color: #4b64ff;\n text-decoration: none;\n font-size: 22px;\n font-weight: bold;\n /* align top of text with image */\n line-height: 25px;\n margin-top: -4px;\n padding-bottom: 2px;\n flex-grow: 1;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n overflow-wrap: anywhere;\n }\n\n .metadata {\n line-height: 20px;\n }\n\n #description,\n #creator,\n #topics,\n #source {\n text-align: left;\n overflow: hidden;\n text-overflow: ellipsis;\n -webkit-box-orient: vertical;\n display: -webkit-box;\n word-break: break-word;\n -webkit-line-clamp: 3; /* number of lines to show */\n line-clamp: 3;\n\n /*\n * Safari doesn't always respect the line-clamping rules above,\n * so we add this to ensure these fields still get truncated\n */\n max-height: 60px;\n }\n\n #collections {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n overflow-wrap: anywhere;\n }\n\n #collections > a {\n display: inline-block;\n }\n\n #icon {\n padding-top: 5px;\n }\n\n #description {\n padding-top: 10px;\n }\n\n /* Top level container */\n #list-line {\n display: flex;\n }\n\n #list-line.mobile {\n flex-direction: column;\n }\n\n #list-line.desktop {\n column-gap: 10px;\n }\n\n #list-line-top {\n display: flex;\n column-gap: 7px;\n }\n\n #list-line-bottom {\n padding-top: 4px;\n }\n\n #list-line-right,\n #list-line-top,\n #list-line-bottom {\n width: 100%;\n }\n\n /*\n * If the container becomes very tiny, don't let the thumbnail side take\n * up too much space. Shouldn't make a difference on ordinary viewport sizes.\n */\n #list-line-left {\n max-width: 25%;\n\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n }\n\n div a:hover {\n text-decoration: underline;\n }\n\n /* Lines containing multiple div as row */\n #item-line,\n #dates-line,\n #views-line,\n #title-line {\n display: flex;\n flex-direction: row;\n column-gap: 10px;\n }\n\n /*\n * With the exception of the title line, allow these to wrap if\n * the space becomes too small to accommodate them together.\n *\n * The title line is excluded because it contains the mediatype icon\n * which we don't want to wrap.\n */\n #item-line,\n #dates-line,\n #views-line {\n flex-wrap: wrap;\n }\n\n .capture-dates {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n\n .capture-dates a:link {\n text-decoration: none;\n color: var(--ia-theme-link-color, #4b64ff);\n }\n .capture-dates a:hover {\n text-decoration: underline;\n }\n\n /*\n * Tile-list (extended) action row sits under the thumbnail in the left\n * column. The image-block above already has its own bottom padding via\n * the parent's row-gap, so we don't need extra spacing here.\n */\n .tile-actions.list-detail {\n width: 100%;\n }\n `,\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tile-list.js","sourceRoot":"","sources":["../../../../src/tiles/list/tile-list.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkC,MAAM,KAAK,CAAC;AACzE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAC9C,OAAO,EA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Y;YACjB,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC,gBAAgB,EACzC,CAAC;YACD,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO;YACL,gBAAgB;YAChB,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAiMF;SACF,CAAC;IACJ,CAAC;CACF,CAAA;AAxqBC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDACS;AAEnB;IAAhB,KAAK,EAAE;iDAAmE;AAtBhE,QAAQ;IAFpB,aAAa,CAAC,WAAW,CAAC;IAC1B,SAAS,EAAE;GACC,QAAQ,CA4rBpB","sourcesContent":["import { css, html, nothing, PropertyValues, TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { join } from 'lit/directives/join.js';\nimport { map } from 'lit/directives/map.js';\nimport { unsafeHTML } from 'lit/directives/unsafe-html.js';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { localized, msg, str } from '@lit/localize';\nimport DOMPurify from 'dompurify';\n\nimport type { SortParam } from '@internetarchive/search-service';\nimport { suppressedCollections } from '../../models';\nimport type { CollectionTitles } from '../../data-source/models';\nimport { BaseTileComponent } from '../base-tile-component';\n\nimport { formatCount, NumberFormat } from '../../utils/format-count';\nimport { getLocale } from '../../utils/get-locale';\nimport type { DateFormat } from '../../utils/format-date';\nimport { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';\nimport { tileActionStyles } from '../../styles/tile-action-styles';\n\nimport '../image-block';\nimport '../review-block';\nimport '../text-snippet-block';\nimport '../tile-mediatype-icon';\n\n@customElement('tile-list')\n@localized()\nexport class TileList extends BaseTileComponent {\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - tileActions: TileAction[] = [];\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - defaultSortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressBlurring = false;\n * - useLocalTime = false;\n */\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n @state() private collectionLinks: (TemplateResult | typeof nothing)[] = [];\n\n render() {\n return html`\n <div id=\"list-line\" class=\"${this.classSize}\">\n ${this.classSize === 'mobile'\n ? this.mobileTemplate\n : this.desktopTemplate}\n </div>\n `;\n }\n\n /**\n * Templates\n */\n private get mobileTemplate() {\n return html`\n <div id=\"list-line-top\">\n <div id=\"list-line-left\">\n ${this.imageBlockTemplate} ${this.renderTileActions('list-detail')}\n </div>\n <div id=\"list-line-right\">\n <div id=\"title-line\">\n <div id=\"title\">${this.titleTemplate}</div>\n ${this.iconRightTemplate}\n </div>\n </div>\n </div>\n <div id=\"list-line-bottom\">${this.detailsTemplate}</div>\n `;\n }\n\n private get desktopTemplate() {\n return html`\n <div id=\"list-line-left\">\n ${this.imageBlockTemplate} ${this.renderTileActions('list-detail')}\n </div>\n <div id=\"list-line-right\">\n <div id=\"title-line\">\n <div id=\"title\">${this.titleTemplate}</div>\n ${this.iconRightTemplate}\n </div>\n ${this.detailsTemplate}\n </div>\n `;\n }\n\n private get imageBlockTemplate() {\n if (!this.model) return nothing;\n\n const isCollection = this.model.mediatype === 'collection';\n const href = this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n isCollection,\n );\n\n return html`<a\n id=\"image-link\"\n title=${msg(str`View ${this.model?.title}`)}\n href=${href}\n >\n <image-block\n .model=${this.model}\n .baseImageUrl=${this.baseImageUrl}\n .isCompactTile=${false}\n .isListTile=${true}\n .viewSize=${this.classSize}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n >\n </image-block>\n </a> `;\n }\n\n private get detailsTemplate() {\n return html`\n ${this.itemLineTemplate} ${this.creatorTemplate}\n <div id=\"dates-line\">\n ${this.datePublishedTemplate} ${this.dateSortByTemplate}\n ${this.webArchivesCaptureDatesTemplate}\n </div>\n <div id=\"views-line\">\n ${this.viewsTemplate} ${this.ratingTemplate} ${this.reviewsTemplate}\n </div>\n ${this.topicsTemplate} ${this.collectionsTemplate}\n ${this.descriptionTemplate} ${this.textSnippetsTemplate}\n ${this.reviewBlockTemplate}\n `;\n }\n\n // Data templates\n private get iconRightTemplate() {\n return html`\n <a\n id=\"icon-right\"\n href=${this.mediatypeURL}\n title=${msg(str`See more: ${this.model?.mediatype}`)}\n >\n <tile-mediatype-icon .model=${this.model}> </tile-mediatype-icon>\n </a>\n `;\n }\n\n private get titleTemplate() {\n if (!this.model?.title) {\n return nothing;\n }\n\n // If the model has a server-specified href, use it\n // Otherwise construct a details link using the identifier\n return this.model?.href\n ? html`<a href=\"${this.baseNavigationUrl}${this.model.href}\"\n >${this.model.title ?? this.model.identifier}</a\n >`\n : this.detailsLink(\n this.model.identifier,\n this.model.title,\n this.model.mediatype === 'collection',\n );\n }\n\n private get itemLineTemplate() {\n const source = this.sourceTemplate;\n const volume = this.volumeTemplate;\n const issue = this.issueTemplate;\n if (!source && !volume && !issue) {\n return nothing;\n }\n return html` <div id=\"item-line\">${source} ${volume} ${issue}</div> `;\n }\n\n private get sourceTemplate() {\n if (!this.model?.source) {\n return nothing;\n }\n return html`\n <div id=\"source\" class=\"metadata\">\n ${this.labelTemplate(msg('Source'))}\n ${this.searchLink('source', this.model.source)}\n </div>\n `;\n }\n\n private get volumeTemplate() {\n return this.metadataTemplate(this.model?.volume, msg('Volume'));\n }\n\n private get issueTemplate() {\n return this.metadataTemplate(this.model?.issue, msg('Issue'));\n }\n\n private get creatorTemplate() {\n // \"Archivist since\" if account\n if (this.model?.mediatype === 'account') {\n return html`\n <div id=\"creator\" class=\"metadata\">\n <span class=\"label\"\n >${this.displayValueProvider.accountLabel ?? nothing}</span\n >\n </div>\n `;\n }\n // \"Creator\" if not account tile\n if (!this.model?.creators || this.model.creators.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"creator\" class=\"metadata\">\n ${this.labelTemplate(msg('By'))}\n ${join(\n map(this.model.creators, id => this.searchLink('creator', id)),\n ', ',\n )}\n </div>\n `;\n }\n\n private get datePublishedTemplate() {\n // If we're showing a date published of Jan 1 at midnight, only show the year.\n // This is because items with only a year for their publication date are normalized to\n // Jan 1 at midnight timestamps in the search engine documents.\n const date: Date | undefined = this.model?.datePublished;\n let format: DateFormat = 'long';\n if (isFirstMillisecondOfUTCYear(date)) {\n format = 'year-only';\n }\n\n return this.metadataTemplate(\n this.getFormattedDate(date, format),\n msg('Published'),\n );\n }\n\n // Show date label/value when sorted by date type\n // Except datePublished which is always shown\n private get dateSortByTemplate() {\n if (\n this.effectiveSort &&\n (this.effectiveSort.field === 'addeddate' ||\n this.effectiveSort.field === 'reviewdate' ||\n this.effectiveSort.field === 'publicdate')\n ) {\n return this.metadataTemplate(\n this.getFormattedDate(this.date, 'long'),\n this.displayValueProvider.dateLabel,\n );\n }\n return nothing;\n }\n\n private get viewsTemplate() {\n const isWeeklySort = this.effectiveSort?.field === 'week';\n const viewCount = isWeeklySort\n ? this.model?.weeklyViewCount // weekly views\n : this.model?.viewCount; // all-time views\n if (viewCount == null) return nothing;\n\n // when its a search-tile, we don't have any stats to show\n if (this.model?.mediatype === 'search') {\n return this.metadataTemplate(msg('(Favorited search query)'), '');\n }\n\n return this.metadataTemplate(\n `${formatCount(viewCount, this.formatSize)}`,\n this.displayValueProvider.viewsLabel,\n );\n }\n\n private get ratingTemplate() {\n const { averageRating } = this.model ?? {};\n const formattedRating = averageRating\n ? new Intl.NumberFormat(getLocale()).format(averageRating)\n : averageRating;\n return this.metadataTemplate(formattedRating, msg('Avg Rating'));\n }\n\n private get reviewsTemplate() {\n const { commentCount } = this.model ?? {};\n const formattedCount = commentCount\n ? new Intl.NumberFormat(getLocale()).format(commentCount)\n : commentCount;\n return this.metadataTemplate(formattedCount, msg('Reviews'));\n }\n\n private get topicsTemplate() {\n if (!this.model?.subjects || this.model.subjects.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"topics\" class=\"metadata\">\n ${this.labelTemplate(msg('Topics'))}\n ${join(\n map(this.model.subjects, id => this.searchLink('subject', id)),\n ', ',\n )}\n </div>\n `;\n }\n\n private get collectionsTemplate() {\n if (!this.collectionLinks || this.collectionLinks.length === 0) {\n return nothing;\n }\n return html`\n <div id=\"collections\" class=\"metadata\">\n ${this.labelTemplate(msg('Collections'))}\n ${join(this.collectionLinks, ', ')}\n </div>\n `;\n }\n\n private get descriptionTemplate() {\n return this.metadataTemplate(\n // Sanitize away any HTML tags and convert line breaks to spaces.\n unsafeHTML(\n DOMPurify.sanitize(this.model?.description?.replace(/\\n/g, ' ') ?? ''),\n ),\n '',\n 'description',\n );\n }\n\n private get reviewBlockTemplate(): TemplateResult | typeof nothing {\n if (!this.model?.review) return nothing;\n\n const { reviewtitle, reviewbody, stars } = this.model.review;\n return html`\n <review-block\n viewsize=\"list\"\n title=${ifDefined(reviewtitle)}\n body=${ifDefined(reviewbody)}\n starRating=${ifDefined(stars)}\n >\n </review-block>\n `;\n }\n\n private get textSnippetsTemplate(): TemplateResult | typeof nothing {\n if (!this.hasSnippets) return nothing;\n\n return html`<text-snippet-block\n viewsize=\"list\"\n .snippets=${this.model?.snippets}\n ></text-snippet-block>`;\n }\n\n private get hasSnippets(): boolean {\n return !!this.model?.snippets?.length;\n }\n\n private get webArchivesCaptureDatesTemplate():\n | TemplateResult\n | typeof nothing {\n if (!this.model?.captureDates || !this.model.title) return nothing;\n\n return html`\n <ul class=\"capture-dates\">\n ${map(\n this.model.captureDates,\n date =>\n html`<li>\n ${this.displayValueProvider.webArchivesCaptureLink(\n this.model!.title,\n date,\n )}\n </li>`,\n )}\n </ul>\n `;\n }\n\n // Utility functions\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n private metadataTemplate(text: any, label = '', id?: string) {\n if (!text) return nothing;\n return html`\n <div id=${ifDefined(id)} class=\"metadata\">\n ${this.labelTemplate(label)} ${text}\n </div>\n `;\n }\n\n private labelTemplate(label: string) {\n return html` ${label\n ? html`<span class=\"label\">${label}: </span>`\n : nothing}`;\n }\n\n private searchLink(field: string, searchTerm: string) {\n if (!field || !searchTerm) {\n return nothing;\n }\n const query = encodeURIComponent(`${field}:\"${searchTerm}\"`);\n // No whitespace after closing tag\n // Note: single ' for href='' to wrap \" in query var gets changed back by yarn format\n return html`<a\n href=\"${this.baseNavigationUrl}/search?query=${query}\"\n rel=\"nofollow\"\n >\n ${DOMPurify.sanitize(searchTerm)}</a\n >`;\n }\n\n private detailsLink(\n identifier?: string,\n text?: string,\n isCollection = false,\n ): TemplateResult | typeof nothing {\n if (!identifier) return nothing;\n\n const linkText = text ?? identifier;\n const linkHref = this.displayValueProvider.itemPageUrl(\n identifier,\n isCollection,\n );\n\n return html`<a href=${linkHref}> ${DOMPurify.sanitize(linkText)} </a>`;\n }\n\n /** The URL of this item's mediatype collection, if defined. */\n private get mediatypeURL(): string | typeof nothing {\n // NB: baseNavigationUrl can be an empty string\n if (this.baseNavigationUrl === undefined || !this.model?.mediatype)\n return nothing;\n\n // Need special handling for certain mediatypes that don't have a top-level collection page\n switch (this.model.mediatype) {\n case 'collection':\n return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;\n case 'account':\n return nothing;\n default:\n return this.displayValueProvider.itemPageUrl(\n this.model.mediatype,\n true,\n );\n }\n }\n\n protected updated(changed: PropertyValues): void {\n if (changed.has('model') || changed.has('collectionTitles')) {\n this.buildCollectionLinks();\n }\n }\n\n private async buildCollectionLinks() {\n if (!this.model?.collections || this.model.collections.length === 0) {\n return;\n }\n\n // Note: quirk of Lit: need to replace collectionLinks array,\n // otherwise it will not re-render. Can't simply alter the array.\n this.collectionLinks = [];\n const newCollectionLinks: (TemplateResult | typeof nothing)[] = [];\n for (const collection of this.model.collections) {\n // Don't include favorites or collections that are meant to be suppressed\n if (\n !suppressedCollections[collection] &&\n !collection.startsWith('fav-')\n ) {\n newCollectionLinks.push(\n this.detailsLink(\n collection,\n this.collectionTitles?.get(collection) ?? collection,\n true,\n ),\n );\n }\n }\n this.collectionLinks = newCollectionLinks;\n }\n\n /*\n * TODO: fix field names to match model in src/collection-browser.ts\n * private get dateSortSelector()\n * @see src/models.ts\n */\n private get date(): Date | undefined {\n switch (this.effectiveSort?.field) {\n case 'date':\n return this.model?.datePublished;\n case 'reviewdate':\n return this.model?.dateReviewed;\n case 'addeddate':\n return this.model?.dateAdded;\n default:\n return this.model?.dateArchived; // publicdate\n }\n }\n\n /**\n * Returns the active sort param if one is set, or the default sort param otherwise.\n */\n private get effectiveSort(): SortParam | null {\n return this.sortParam ?? this.defaultSortParam;\n }\n\n private get classSize(): string {\n if (\n this.mobileBreakpoint &&\n this.currentWidth &&\n this.currentWidth < this.mobileBreakpoint\n ) {\n return 'mobile';\n }\n return 'desktop';\n }\n\n private get formatSize(): NumberFormat {\n if (\n this.mobileBreakpoint &&\n this.currentWidth &&\n this.currentWidth < this.mobileBreakpoint\n ) {\n return 'short';\n }\n return 'long';\n }\n\n static get styles() {\n return [\n tileActionStyles,\n css`\n html {\n font-size: unset;\n }\n\n div {\n font-size: 14px;\n }\n\n div a {\n text-decoration: none;\n }\n\n div a:link {\n color: var(--ia-theme-link-color, #4b64ff);\n }\n\n .label {\n font-weight: bold;\n }\n\n #list-line.mobile {\n --infiniteScrollerRowGap: 20px;\n --infiniteScrollerRowHeight: auto;\n }\n\n #list-line.desktop {\n --infiniteScrollerRowGap: 30px;\n --infiniteScrollerRowHeight: auto;\n }\n\n /* fields */\n #icon-right {\n width: 20px;\n padding-top: 5px;\n --iconHeight: 20px;\n --iconWidth: 20px;\n --iconTextAlign: right;\n margin-top: -8px;\n text-align: right;\n }\n\n #title {\n color: #4b64ff;\n text-decoration: none;\n font-size: 22px;\n font-weight: bold;\n /* align top of text with image */\n line-height: 25px;\n margin-top: -4px;\n padding-bottom: 2px;\n flex-grow: 1;\n\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n overflow-wrap: anywhere;\n }\n\n .metadata {\n line-height: 20px;\n }\n\n #description,\n #creator,\n #topics,\n #source {\n text-align: left;\n overflow: hidden;\n text-overflow: ellipsis;\n -webkit-box-orient: vertical;\n display: -webkit-box;\n word-break: break-word;\n -webkit-line-clamp: 3; /* number of lines to show */\n line-clamp: 3;\n\n /*\n * Safari doesn't always respect the line-clamping rules above,\n * so we add this to ensure these fields still get truncated\n */\n max-height: 60px;\n }\n\n #collections {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: 3;\n overflow: hidden;\n overflow-wrap: anywhere;\n }\n\n #collections > a {\n display: inline-block;\n }\n\n #icon {\n padding-top: 5px;\n }\n\n #description {\n padding-top: 10px;\n }\n\n /* Top level container */\n #list-line {\n display: flex;\n }\n\n #list-line.mobile {\n flex-direction: column;\n }\n\n #list-line.desktop {\n column-gap: 10px;\n }\n\n #list-line-top {\n display: flex;\n column-gap: 7px;\n }\n\n #list-line-bottom {\n padding-top: 4px;\n }\n\n #list-line-right,\n #list-line-top,\n #list-line-bottom {\n width: 100%;\n }\n\n /*\n * If the container becomes very tiny, don't let the thumbnail side take\n * up too much space. Shouldn't make a difference on ordinary viewport sizes.\n */\n #list-line-left {\n max-width: 25%;\n\n display: flex;\n flex-direction: column;\n row-gap: 5px;\n }\n\n div a:hover {\n text-decoration: underline;\n }\n\n /* Lines containing multiple div as row */\n #item-line,\n #dates-line,\n #views-line,\n #title-line {\n display: flex;\n flex-direction: row;\n column-gap: 10px;\n }\n\n /*\n * With the exception of the title line, allow these to wrap if\n * the space becomes too small to accommodate them together.\n *\n * The title line is excluded because it contains the mediatype icon\n * which we don't want to wrap.\n */\n #item-line,\n #dates-line,\n #views-line {\n flex-wrap: wrap;\n }\n\n .capture-dates {\n margin: 0;\n padding: 0;\n list-style-type: none;\n }\n\n .capture-dates a:link {\n text-decoration: none;\n color: var(--ia-theme-link-color, #4b64ff);\n }\n .capture-dates a:hover {\n text-decoration: underline;\n }\n\n /*\n * Tile-list (extended) action row sits under the thumbnail in the left\n * column. The image-block above already has its own bottom padding via\n * the parent's row-gap, so we don't need extra spacing here.\n */\n .tile-actions.list-detail {\n width: 100%;\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -2,6 +2,8 @@ export type NumberFormat = 'short' | 'long';
|
|
|
2
2
|
export type LabelFormat = 'short' | 'long';
|
|
3
3
|
/**
|
|
4
4
|
* Format a "count" number into short "icon" or longer text string.
|
|
5
|
-
* For positive numbers only.
|
|
5
|
+
* For positive numbers only. Uses `Intl.NumberFormat` so both the digit
|
|
6
|
+
* grouping and the abbreviation word/letter (e.g. "K" vs "mil") follow the
|
|
7
|
+
* given locale's conventions.
|
|
6
8
|
*/
|
|
7
9
|
export declare function formatCount(count: number | undefined, numberFormat?: NumberFormat, labelFormat?: LabelFormat, locale?: string): string;
|
|
@@ -2,75 +2,35 @@
|
|
|
2
2
|
* Replaces Petabox www/common/Util::number_format()
|
|
3
3
|
* For positive numbers only.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { getLocale } from './get-locale';
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
7
|
+
* Whether a number should be abbreviated to a compact form (e.g. "77K")
|
|
8
|
+
* rather than shown in full. Millions and up always abbreviate; thousands
|
|
9
|
+
* only abbreviate when the caller asked for the short NumberFormat.
|
|
8
10
|
*/
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
14
|
-
else if (number >= 1_000_000) {
|
|
15
|
-
divisor = 1_000_000;
|
|
16
|
-
}
|
|
17
|
-
else if (number >= 1_000 && numberFormat === 'short') {
|
|
18
|
-
divisor = 1_000;
|
|
19
|
-
}
|
|
20
|
-
return divisor;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Round a number given passed magnitude.
|
|
24
|
-
* Significant digits of value less than 10 get a decimal.
|
|
25
|
-
*/
|
|
26
|
-
function round(number = 0, divisor) {
|
|
27
|
-
const result = number / divisor;
|
|
28
|
-
const roundToOne = result < 10;
|
|
29
|
-
let rounded = 0;
|
|
30
|
-
if (roundToOne) {
|
|
31
|
-
rounded = Math.round((result + Number.EPSILON) * 10) / 10;
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
rounded = Math.round(result);
|
|
35
|
-
}
|
|
36
|
-
return rounded;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Return a label for a number and format.
|
|
40
|
-
*/
|
|
41
|
-
function labelize(rounded, divisor, format, locale) {
|
|
42
|
-
switch (divisor) {
|
|
43
|
-
case 1_000_000_000:
|
|
44
|
-
if (format === 'short') {
|
|
45
|
-
return msg(str `${rounded}B`);
|
|
46
|
-
}
|
|
47
|
-
return msg(str `${rounded} billion`);
|
|
48
|
-
case 1_000_000:
|
|
49
|
-
if (format === 'short') {
|
|
50
|
-
return msg(str `${rounded}M`);
|
|
51
|
-
}
|
|
52
|
-
return msg(str `${rounded} million`);
|
|
53
|
-
case 1_000:
|
|
54
|
-
if (format === 'short') {
|
|
55
|
-
return msg(str `${rounded}K`);
|
|
56
|
-
}
|
|
57
|
-
return msg(str `${rounded} thousand`);
|
|
58
|
-
default:
|
|
59
|
-
return new Intl.NumberFormat(locale).format(rounded);
|
|
60
|
-
}
|
|
11
|
+
function shouldAbbreviate(number, numberFormat) {
|
|
12
|
+
if (number >= 1_000_000)
|
|
13
|
+
return true;
|
|
14
|
+
return numberFormat === 'short' && number >= 1_000;
|
|
61
15
|
}
|
|
62
16
|
/**
|
|
63
17
|
* Format a "count" number into short "icon" or longer text string.
|
|
64
|
-
* For positive numbers only.
|
|
18
|
+
* For positive numbers only. Uses `Intl.NumberFormat` so both the digit
|
|
19
|
+
* grouping and the abbreviation word/letter (e.g. "K" vs "mil") follow the
|
|
20
|
+
* given locale's conventions.
|
|
65
21
|
*/
|
|
66
|
-
export function formatCount(count, numberFormat = 'long', labelFormat = 'short', locale =
|
|
22
|
+
export function formatCount(count, numberFormat = 'long', labelFormat = 'short', locale = getLocale()) {
|
|
67
23
|
// Return blank if undefined
|
|
68
24
|
const number = count ?? -1;
|
|
69
25
|
if (number < 0) {
|
|
70
26
|
return '';
|
|
71
27
|
}
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
28
|
+
if (shouldAbbreviate(number, numberFormat)) {
|
|
29
|
+
return new Intl.NumberFormat(locale, {
|
|
30
|
+
notation: 'compact',
|
|
31
|
+
compactDisplay: labelFormat === 'short' ? 'short' : 'long',
|
|
32
|
+
}).format(number);
|
|
33
|
+
}
|
|
34
|
+
return new Intl.NumberFormat(locale).format(number);
|
|
75
35
|
}
|
|
76
36
|
//# sourceMappingURL=format-count.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-count.js","sourceRoot":"","sources":["../../../src/utils/format-count.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"format-count.js","sourceRoot":"","sources":["../../../src/utils/format-count.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AASzC;;;;GAIG;AACH,SAAS,gBAAgB,CAAC,MAAc,EAAE,YAA0B;IAClE,IAAI,MAAM,IAAI,SAAS;QAAE,OAAO,IAAI,CAAC;IACrC,OAAO,YAAY,KAAK,OAAO,IAAI,MAAM,IAAI,KAAK,CAAC;AACrD,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CACzB,KAAyB,EACzB,eAA6B,MAAM,EACnC,cAA2B,OAAO,EAClC,SAAiB,SAAS,EAAE;IAE5B,4BAA4B;IAC5B,MAAM,MAAM,GAAG,KAAK,IAAI,CAAC,CAAC,CAAC;IAC3B,IAAI,MAAM,GAAG,CAAC,EAAE,CAAC;QACf,OAAO,EAAE,CAAC;IACZ,CAAC;IACD,IAAI,gBAAgB,CAAC,MAAM,EAAE,YAAY,CAAC,EAAE,CAAC;QAC3C,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;YACnC,QAAQ,EAAE,SAAS;YACnB,cAAc,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;SAC3D,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACtD,CAAC","sourcesContent":["/*\n * Replaces Petabox www/common/Util::number_format()\n * For positive numbers only.\n */\nimport { getLocale } from './get-locale';\n\nexport type NumberFormat =\n | 'short' // 1.2 [K | thousand]\n | 'long'; // 1,200 [No label for numbers < 1,000,000]\nexport type LabelFormat =\n | 'short' // [1.2]K\n | 'long'; // [1.2] thousand\n\n/**\n * Whether a number should be abbreviated to a compact form (e.g. \"77K\")\n * rather than shown in full. Millions and up always abbreviate; thousands\n * only abbreviate when the caller asked for the short NumberFormat.\n */\nfunction shouldAbbreviate(number: number, numberFormat: NumberFormat): boolean {\n if (number >= 1_000_000) return true;\n return numberFormat === 'short' && number >= 1_000;\n}\n\n/**\n * Format a \"count\" number into short \"icon\" or longer text string.\n * For positive numbers only. Uses `Intl.NumberFormat` so both the digit\n * grouping and the abbreviation word/letter (e.g. \"K\" vs \"mil\") follow the\n * given locale's conventions.\n */\nexport function formatCount(\n count: number | undefined,\n numberFormat: NumberFormat = 'long',\n labelFormat: LabelFormat = 'short',\n locale: string = getLocale(),\n): string {\n // Return blank if undefined\n const number = count ?? -1;\n if (number < 0) {\n return '';\n }\n if (shouldAbbreviate(number, numberFormat)) {\n return new Intl.NumberFormat(locale, {\n notation: 'compact',\n compactDisplay: labelFormat === 'short' ? 'short' : 'long',\n }).format(number);\n }\n return new Intl.NumberFormat(locale).format(number);\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { nothing } from 'lit';
|
|
2
|
-
export declare function formatUnitSize(size: number | undefined, nDecimals: number): string | typeof nothing;
|
|
2
|
+
export declare function formatUnitSize(size: number | undefined, nDecimals: number, locale?: string): string | typeof nothing;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { nothing } from 'lit';
|
|
5
5
|
import { msg, str } from '@lit/localize';
|
|
6
|
+
import { getLocale } from './get-locale';
|
|
6
7
|
/**
|
|
7
8
|
* Labels a formatted size with its unit, one entry per power of 1024 starting
|
|
8
9
|
* at bytes. Each entry is a function so the label is read in the current
|
|
@@ -19,7 +20,7 @@ const unitLabels = [
|
|
|
19
20
|
(size, singular) => singular ? msg(str `${size} zettabyte`) : msg(str `${size} zettabytes`),
|
|
20
21
|
(size, singular) => singular ? msg(str `${size} yottabyte`) : msg(str `${size} yottabytes`),
|
|
21
22
|
];
|
|
22
|
-
export function formatUnitSize(size, nDecimals) {
|
|
23
|
+
export function formatUnitSize(size, nDecimals, locale = getLocale()) {
|
|
23
24
|
let itemSize = size;
|
|
24
25
|
if (itemSize === undefined)
|
|
25
26
|
return nothing; // early return.
|
|
@@ -31,6 +32,6 @@ export function formatUnitSize(size, nDecimals) {
|
|
|
31
32
|
}
|
|
32
33
|
const magnitude = 10 ** nDecimals;
|
|
33
34
|
itemSize = Math.round(itemSize * magnitude) / magnitude;
|
|
34
|
-
return unitLabels[unitIndex](
|
|
35
|
+
return unitLabels[unitIndex](new Intl.NumberFormat(locale).format(itemSize), itemSize === 1);
|
|
35
36
|
}
|
|
36
37
|
//# sourceMappingURL=format-unit-size.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-un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AY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,aAAa,CAAC;IACvE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CACjB,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,aAAa,CAAC;CACxE,CAAC;AAEF,MAAM,UAAU,cAAc,CAC5B,IAAwB,EACxB,SAAiB,EACjB,SAAiB,SAAS,EAAE;IAE5B,IAAI,QAAQ,GAAG,IAAI,CAAC;IACpB,IAAI,QAAQ,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,CAAC,gBAAgB;IAE5D,IAAI,SAAS,GAAG,CAAC,CAAC;IAElB,wCAAwC;IACxC,OAAO,QAAQ,GAAG,IAAI,IAAI,SAAS,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5D,QAAQ,IAAI,IAAI,CAAC;QACjB,SAAS,IAAI,CAAC,CAAC;IACjB,CAAC;IAED,MAAM,SAAS,GAAG,EAAE,IAAI,SAAS,CAAC;IAClC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,GAAG,SAAS,CAAC,GAAG,SAAS,CAAC;IAExD,OAAO,UAAU,CAAC,SAAS,CAAC,CAC1B,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAC9C,QAAQ,KAAK,CAAC,CACf,CAAC;AACJ,CAAC","sourcesContent":["/*\n * Replaces Petabox www/common/Util::humanSize()\n */\nimport { nothing } from 'lit';\nimport { msg, str } from '@lit/localize';\nimport { getLocale } from './get-locale';\n\n/**\n * Labels a formatted size with its unit, one entry per power of 1024 starting\n * at bytes. Each entry is a function so the label is read in the current\n * locale at call time.\n */\nconst unitLabels: ((size: string, singular: boolean) => string)[] = [\n (size, singular) =>\n singular ? msg(str`${size} byte`) : msg(str`${size} bytes`),\n (size, singular) =>\n singular ? msg(str`${size} kilobyte`) : msg(str`${size} kilobytes`),\n (size, singular) =>\n singular ? msg(str`${size} megabyte`) : msg(str`${size} megabytes`),\n (size, singular) =>\n singular ? msg(str`${size} gigabyte`) : msg(str`${size} gigabytes`),\n (size, singular) =>\n singular ? msg(str`${size} terabyte`) : msg(str`${size} terabytes`),\n (size, singular) =>\n singular ? msg(str`${size} petabyte`) : msg(str`${size} petabytes`),\n (size, singular) =>\n singular ? msg(str`${size} exabyte`) : msg(str`${size} exabytes`),\n (size, singular) =>\n singular ? msg(str`${size} zettabyte`) : msg(str`${size} zettabytes`),\n (size, singular) =>\n singular ? msg(str`${size} yottabyte`) : msg(str`${size} yottabytes`),\n];\n\nexport function formatUnitSize(\n size: number | undefined,\n nDecimals: number,\n locale: string = getLocale(),\n) {\n let itemSize = size;\n if (itemSize === undefined) return nothing; // early return.\n\n let unitIndex = 0;\n\n // convert byte to highest possible unit\n while (itemSize > 1024 && unitIndex < unitLabels.length - 1) {\n itemSize /= 1024;\n unitIndex += 1;\n }\n\n const magnitude = 10 ** nDecimals;\n itemSize = Math.round(itemSize * magnitude) / magnitude;\n\n return unitLabels[unitIndex](\n new Intl.NumberFormat(locale).format(itemSize),\n itemSize === 1,\n );\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns the locale code currently active in the host app.
|
|
3
|
+
*
|
|
4
|
+
* This package never sets up `@lit/localize` itself (the host app owns that,
|
|
5
|
+
* once), so `@lit/localize`'s own `getLocale()` isn't available here — it's
|
|
6
|
+
* only returned from the host's one setup call. `msg()` always reflects the
|
|
7
|
+
* host app's current locale, read fresh on every call, with no dependency on
|
|
8
|
+
* when this package happened to load relative to the host setting its
|
|
9
|
+
* locale. This probes a string whose only translation is the ISO code of
|
|
10
|
+
* the locale it was translated into, and reads the locale off whichever
|
|
11
|
+
* string comes back: the untranslated source for the source locale, or the
|
|
12
|
+
* code itself once a target locale's translation is in place.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getLocale(): string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { msg } from '@lit/localize';
|
|
2
|
+
/**
|
|
3
|
+
* Returns the locale code currently active in the host app.
|
|
4
|
+
*
|
|
5
|
+
* This package never sets up `@lit/localize` itself (the host app owns that,
|
|
6
|
+
* once), so `@lit/localize`'s own `getLocale()` isn't available here — it's
|
|
7
|
+
* only returned from the host's one setup call. `msg()` always reflects the
|
|
8
|
+
* host app's current locale, read fresh on every call, with no dependency on
|
|
9
|
+
* when this package happened to load relative to the host setting its
|
|
10
|
+
* locale. This probes a string whose only translation is the ISO code of
|
|
11
|
+
* the locale it was translated into, and reads the locale off whichever
|
|
12
|
+
* string comes back: the untranslated source for the source locale, or the
|
|
13
|
+
* code itself once a target locale's translation is in place.
|
|
14
|
+
*/
|
|
15
|
+
export function getLocale() {
|
|
16
|
+
return msg('en');
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=get-locale.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-locale.js","sourceRoot":"","sources":["../../../src/utils/get-locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,GAAG,CAAC,IAAI,CAAC,CAAC;AACnB,CAAC","sourcesContent":["import { msg } from '@lit/localize';\n\n/**\n * Returns the locale code currently active in the host app.\n *\n * This package never sets up `@lit/localize` itself (the host app owns that,\n * once), so `@lit/localize`'s own `getLocale()` isn't available here — it's\n * only returned from the host's one setup call. `msg()` always reflects the\n * host app's current locale, read fresh on every call, with no dependency on\n * when this package happened to load relative to the host setting its\n * locale. This probes a string whose only translation is the ISO code of\n * the locale it was translated into, and reads the locale off whichever\n * string comes back: the untranslated source for the source locale, or the\n * code itself once a target locale's translation is in place.\n */\nexport function getLocale(): string {\n return msg('en');\n}\n"]}
|
package/package.json
CHANGED