@internetarchive/collection-browser 4.9.1-webdev-9670.2 → 4.10.1
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/README.md +33 -11
- package/dist/src/app-root.d.ts +0 -11
- package/dist/src/app-root.js +1 -95
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +2 -43
- package/dist/src/collection-browser.js +13 -194
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row-template.d.ts +1 -1
- package/dist/src/collection-facets/facet-row-template.js +14 -7
- package/dist/src/collection-facets/facet-row-template.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +3 -1
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.js +6 -5
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-scroller.js +3 -2
- package/dist/src/collection-facets/more-facets-scroller.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js +13 -4
- package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js.map +1 -1
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +6 -2
- package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
- package/dist/src/collection-facets.js +6 -5
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/empty-placeholder.d.ts +7 -7
- package/dist/src/empty-placeholder.js +29 -15
- package/dist/src/empty-placeholder.js.map +1 -1
- package/dist/src/expanded-date-picker.js +3 -2
- package/dist/src/expanded-date-picker.js.map +1 -1
- package/dist/src/locales/es.d.ts +200 -0
- package/dist/src/locales/es.js +215 -0
- package/dist/src/locales/es.js.map +1 -0
- package/dist/src/manage/manage-bar.d.ts +3 -2
- package/dist/src/manage/manage-bar.js +15 -16
- package/dist/src/manage/manage-bar.js.map +1 -1
- package/dist/src/manage/remove-items-modal-content.js +3 -2
- package/dist/src/manage/remove-items-modal-content.js.map +1 -1
- package/dist/src/mediatype/mediatype-config.js +55 -18
- package/dist/src/mediatype/mediatype-config.js.map +1 -1
- package/dist/src/models.js +120 -40
- package/dist/src/models.js.map +1 -1
- package/dist/src/restoration-state-handler.js +11 -2
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +8 -2
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js +7 -2
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +0 -12
- package/dist/src/sort-filter-bar/sort-filter-bar.js +9 -72
- package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +3 -2
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +12 -11
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +0 -4
- package/dist/src/tiles/grid/item-tile.js +8 -23
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/tile-stats.js +6 -3
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +1 -2
- package/dist/src/tiles/hover/hover-pane-controller.js +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/image-block.d.ts +0 -5
- package/dist/src/tiles/image-block.js +0 -29
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.js +3 -2
- package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +3 -1
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +15 -5
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/models.d.ts +1 -2
- package/dist/src/tiles/models.js.map +1 -1
- package/dist/src/tiles/overlay/text-overlay.js +3 -1
- package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
- package/dist/src/tiles/review-block.js +3 -2
- package/dist/src/tiles/review-block.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +2 -8
- package/dist/src/tiles/tile-dispatcher.js +6 -44
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/tiles/tile-mediatype-icon.js +3 -1
- package/dist/src/tiles/tile-mediatype-icon.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 +21 -18
- 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 +20 -0
- package/dist/src/utils/get-locale.js.map +1 -0
- package/locales/es.d.ts +1 -0
- package/locales/es.js +1 -0
- package/package.json +6 -2
- package/dist/src/tiles/preview/tile-preview-controller.d.ts +0 -61
- package/dist/src/tiles/preview/tile-preview-controller.js +0 -216
- package/dist/src/tiles/preview/tile-preview-controller.js.map +0 -1
- package/dist/src/tiles/preview/tile-preview-media.d.ts +0 -65
- package/dist/src/tiles/preview/tile-preview-media.js +0 -178
- package/dist/src/tiles/preview/tile-preview-media.js.map +0 -1
- package/dist/src/tiles/preview/tile-preview.d.ts +0 -66
- package/dist/src/tiles/preview/tile-preview.js +0 -494
- package/dist/src/tiles/preview/tile-preview.js.map +0 -1
- package/dist/src/utils/grid-zoom-controller.d.ts +0 -69
- package/dist/src/utils/grid-zoom-controller.js +0 -261
- package/dist/src/utils/grid-zoom-controller.js.map +0 -1
- package/dist/src/utils/grid-zoom.d.ts +0 -31
- package/dist/src/utils/grid-zoom.js +0 -109
- package/dist/src/utils/grid-zoom.js.map +0 -1
|
@@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AAI,EAAE,OAAO,EAAE,CAAC;mDAAqB;AAGrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;kDAAoC;AAGlC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAGxB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yDAA2B;AAE3B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAA6C;AAM5C;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAEzB;AAKM;IADP,KAAK,CAAC,YAAY,CAAC;iDACe;AAG3B;IADP,KAAK,CAAC,iBAAiB,CAAC;iDACS;AAG1B;IADP,KAAK,CAAC,YAAY,CAAC;uDACwB;AA/DjC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAkoB1B","sourcesContent":["import { css, html, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { msg } from '@lit/localize';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { TileDisplayMode } from '../models';\nimport type { CollectionTitles } from '../data-source/models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './grid/search-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport { BaseTileComponent } from './base-tile-component';\nimport { LayoutType } from './models';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\nimport { srOnlyStyle } from '../styles/sr-only';\nimport { tileActionStyles } from '../styles/tile-action-styles';\nimport {\n PREVIEW_PANE_DELAY_MS,\n TilePreviewController,\n} from './preview/tile-preview-controller';\nimport type { TilePreviewOptions } from './preview/tile-preview-media';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends BaseTileComponent\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\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 * - suppressTileBlurring = false;\n * - useLocalTime = false;\n */\n\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Boolean }) isManageView = false;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n @property({ type: Boolean }) showTvClips = false;\n\n /** What type of simplified layout to use in grid mode, if any */\n @property({ type: String }) layoutType: LayoutType = 'default';\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n /** Whether hovering, focusing or long-pressing this tile starts a live preview */\n @property({ type: Boolean }) enableTilePreview = false;\n\n @property({ type: Object }) tilePreviewOptions: TilePreviewOptions = {};\n\n private previewController = new TilePreviewController(this, {\n enabled: () => this.shouldPreview,\n });\n\n @property({ type: String }) manageCheckTitle = msg(\n 'Remove this item from the list',\n );\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n @query('.tile-link')\n private tileLinkElement?: HTMLAnchorElement;\n\n acquireFocus(): void {\n this.tileLinkElement?.focus();\n }\n\n releaseFocus(): void {\n this.tileLinkElement?.blur();\n }\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hasTileActions = isGridMode && this.showGridTileActions;\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n const containerClasses = classMap({\n hoverable: isGridMode,\n previewable: this.shouldPreview,\n 'has-tile-actions': hasTileActions,\n });\n return html`\n <div id=\"container\" class=${containerClasses}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${this.gridTileActionsTemplate} ${this.manageCheckTemplate}\n ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n // A playing preview gets the tile to itself; the info pane follows later.\n showDelay: () => (this.shouldPreview ? PREVIEW_PANE_DELAY_MS : 300),\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, defaultSortParam, mobileBreakpoint } =\n this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam ?? defaultSortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .tileActions=${this.tileActions}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=${this.linkTileHref}\n aria-label=${this.model?.title ?? 'Untitled item'}\n aria-describedby=\"link-aria-description\"\n aria-haspopup=${this.shouldPrepareHoverPane ? 'dialog' : 'false'}\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${this.handleLinkClicked}\n @contextmenu=${this.handleLinkContextMenu}\n class=\"tile-link\"\n >\n ${this.tile}\n </a>\n <div id=\"link-aria-description\" class=\"sr-only\">\n ${msg('Press Down Arrow to preview item details')}\n </div>\n `;\n }\n\n private get linkTileHref(): string | typeof nothing {\n if (!this.model?.identifier || this.baseNavigationUrl == null)\n return nothing;\n\n // Use the server-specified href if available.\n // Otherwise, construct a details page URL from the item identifier.\n if (this.model.href) {\n return `${this.baseNavigationUrl}${this.model.href}`;\n }\n\n return this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n this.model.mediatype === 'collection',\n );\n }\n\n private get manageCheckTemplate() {\n if (!this.isManageView || this.tileDisplayMode !== 'grid') return nothing;\n\n return html`\n <div class=\"manage-check\">\n <input\n type=\"checkbox\"\n title=${this.manageCheckTitle}\n ?checked=${this.model?.checked}\n @change=${this.handleLinkClicked}\n />\n </div>\n `;\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode] &&\n this.model?.mediatype !== 'search' && // don't show hover panes on search tiles\n !this.model?.captureDates // don't show hover panes on web archive tiles\n );\n }\n\n /** Only plain item tiles preview: not collections, accounts, searches or gated items. */\n private get shouldPreview(): boolean {\n const { model } = this;\n return (\n this.enableTilePreview &&\n this.tileDisplayMode === 'grid' &&\n !this.isManageView &&\n !!model?.identifier &&\n !['collection', 'account', 'search'].includes(model.mediatype) &&\n !model.captureDates &&\n (this.suppressBlurring ||\n (!model.contentWarning && !(model.loginRequired && !this.loggedIn)))\n );\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n /**\n * Whether the info button should be shown on this tile.\n * Only shown on touch/non-hover devices where a hover pane is available,\n * so the button always has something to toggle.\n */\n private get shouldShowInfoButton(): boolean {\n return !this.isHoverEnabled && this.shouldPrepareHoverPane;\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (!this.shouldPreview) this.previewController.deactivate();\n\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver',\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n /**\n * Handler for when the tile link is left-clicked. Emits the `resultSelected` event.\n * In manage view, it also checks/unchecks the tile.\n */\n private handleLinkClicked(e: Event): void {\n if (this.isManageView) {\n e.preventDefault();\n if (this.model) this.model.checked = !this.model.checked;\n }\n\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model }),\n );\n }\n\n /**\n * Handler for when the tile link is right-clicked.\n * In manage view, it opens the item in a new tab. Otherwise, does nothing.\n */\n private handleLinkContextMenu(e: Event): void {\n if (this.isManageView && this.linkTileHref !== nothing) {\n e.preventDefault();\n window.open(this.linkTileHref, '_blank');\n }\n }\n\n private tileInfoButtonPressed(\n e: CustomEvent<{ x: number; y: number }>,\n ): void {\n this.hoverPaneController?.toggleHoverPane({\n coords: e.detail,\n enableTouchBackdrop: true,\n });\n }\n\n /** Whether tile action buttons should be rendered in grid mode */\n private get showGridTileActions(): boolean {\n return (\n this.tileActions.length > 0 &&\n !this.isManageView &&\n this.tileDisplayMode === 'grid'\n );\n }\n\n /**\n * Template for the grid-mode action buttons. Rendered alongside the inner\n * tile link inside the dispatcher's shadow root so the action buttons can\n * suppress the hover pane on hover.\n */\n private get gridTileActionsTemplate() {\n if (!this.showGridTileActions) return nothing;\n\n return html`\n <div\n class=\"tile-actions grid-tile-actions\"\n @mouseenter=${this.handleGridActionsMouseEnter}\n @mousemove=${(e: Event) => e.stopPropagation()}\n >\n ${this.tileActions.map(\n action => html`\n <button\n class=\"tile-action-btn\"\n @click=${(e: Event) => this.handleTileActionClick(e, action)}\n >\n ${action.label}\n </button>\n `,\n )}\n </div>\n `;\n }\n\n /**\n * When the mouse enters the grid-mode tile actions area, dispatch a\n * synthetic mouseleave on the host to cancel the hover pane's show timer\n * and hide any visible pane.\n */\n private handleGridActionsMouseEnter = (): void => {\n this.dispatchEvent(new MouseEvent('mouseleave', { bubbles: false }));\n };\n\n private get tile() {\n const {\n model,\n collectionPagePath,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n creatorFilter,\n mobileBreakpoint,\n defaultSortParam,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n .layoutType=${this.layoutType}\n ?showInfoButton=${this.shouldShowInfoButton}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n ?showInfoButton=${this.shouldShowInfoButton}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </account-tile>`;\n case 'search':\n return html`<search-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n ?showInfoButton=${false}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </search-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .defaultSortParam=${defaultSortParam}\n .creatorFilter=${creatorFilter}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n .layoutType=${this.layoutType}\n ?showTvClips=${this.showTvClips}\n ?showInfoButton=${this.shouldShowInfoButton}\n ?useLocalTime=${this.useLocalTime}\n ?previewActive=${this.previewController.active}\n .previewOptions=${this.tilePreviewOptions}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .defaultSortParam=${defaultSortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .tileActions=${this.isManageView ? [] : this.tileActions}\n ?useLocalTime=${this.useLocalTime}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .collectionTitles=${this.collectionTitles}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .defaultSortParam=${defaultSortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .tileActions=${this.isManageView ? [] : this.tileActions}\n ?useLocalTime=${this.useLocalTime}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return [\n srOnlyStyle,\n tileActionStyles,\n css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n search-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n --iconFillColor: #2c2c2c;\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n /*\n * When tile actions are present, the container takes on the role of\n * the tile's visual card so the tile content and action row appear\n * as a single unified element. The inner tile's own shadow/radius\n * are disabled via CSS variable overrides to avoid visual\n * duplication, and the action row sits as a footer inside the same\n * card.\n */\n #container.has-tile-actions {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n box-shadow: var(--tileShadow, 1px 1px 2px 0);\n --tileBoxShadow: none;\n --tileCornerRadius: 0;\n }\n\n #container.has-tile-actions .tile-link {\n flex: 1;\n min-height: 0;\n overflow: hidden;\n border-radius: 0;\n }\n\n /* A long-press starts a preview, so it must not open the iOS link menu or select text */\n #container.previewable a {\n -webkit-touch-callout: none;\n -webkit-user-select: none;\n user-select: none;\n }\n\n /* Normal hover shadow lives on the inner anchor for plain tiles */\n #container.hoverable:not(.has-tile-actions) a:focus,\n #container.hoverable:not(.has-tile-actions) a:hover {\n box-shadow: var(\n --tileHoverBoxShadow,\n 0 0 6px 2px rgba(8, 8, 32, 0.8)\n );\n transition: box-shadow 0.1s ease;\n }\n\n /*\n * When the container owns the card visuals, the hover shadow needs\n * to move up to the container so it wraps the action row too.\n */\n #container.hoverable.has-tile-actions:hover {\n box-shadow: var(\n --tileHoverBoxShadow,\n 0 0 6px 2px rgba(8, 8, 32, 0.8)\n );\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n border-radius: 4px;\n outline: none;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n .manage-check {\n position: absolute;\n right: 0;\n top: 0;\n border: 5px solid #2c2c2c;\n border-radius: 3px;\n background-color: #2c2c2c;\n z-index: 1;\n }\n\n .manage-check > input[type='checkbox'] {\n display: block;\n margin: 0;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 2;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n\n /*\n * Grid-mode action row sits flush against the bottom of the card —\n * the buttons' own borders form the visible bottom edge. The outer\n * buttons get rounded bottom corners to match the container so the\n * red border traces cleanly around the card's bottom corners.\n */\n .grid-tile-actions .tile-action-btn:first-child {\n border-bottom-left-radius: 4px;\n }\n\n .grid-tile-actions .tile-action-btn:last-child {\n border-bottom-right-radius: 4px;\n }\n `,\n ];\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,QAAQ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B;AAGzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA2B;AAK9C;IADP,KAAK,CAAC,YAAY,CAAC;iDACe;AAG3B;IADP,KAAK,CAAC,iBAAiB,CAAC;iDACS;AAG1B;IADP,KAAK,CAAC,YAAY,CAAC;uDACwB;AArDjC,cAAc;IAF1B,aAAa,CAAC,iBAAiB,CAAC;IAChC,SAAS,EAAE;GACC,cAAc,CA4lB1B","sourcesContent":["import { css, html, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { localized, msg } from '@lit/localize';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { TileDisplayMode } from '../models';\nimport type { CollectionTitles } from '../data-source/models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './grid/search-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport { BaseTileComponent } from './base-tile-component';\nimport { LayoutType } from './models';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\nimport { srOnlyStyle } from '../styles/sr-only';\nimport { tileActionStyles } from '../styles/tile-action-styles';\n\n@customElement('tile-dispatcher')\n@localized()\nexport class TileDispatcher\n extends BaseTileComponent\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\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 * - suppressTileBlurring = false;\n * - useLocalTime = false;\n */\n\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Boolean }) isManageView = false;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n @property({ type: Boolean }) showTvClips = false;\n\n /** What type of simplified layout to use in grid mode, if any */\n @property({ type: String }) layoutType: LayoutType = 'default';\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n /** Title for the manage checkbox. Defaults to a localized \"Remove this item from the list\". */\n @property({ type: String }) manageCheckTitle?: string;\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n @query('.tile-link')\n private tileLinkElement?: HTMLAnchorElement;\n\n acquireFocus(): void {\n this.tileLinkElement?.focus();\n }\n\n releaseFocus(): void {\n this.tileLinkElement?.blur();\n }\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hasTileActions = isGridMode && this.showGridTileActions;\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n const containerClasses = classMap({\n hoverable: isGridMode,\n 'has-tile-actions': hasTileActions,\n });\n return html`\n <div id=\"container\" class=${containerClasses}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${this.gridTileActionsTemplate} ${this.manageCheckTemplate}\n ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, defaultSortParam, mobileBreakpoint } =\n this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam ?? defaultSortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .tileActions=${this.tileActions}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=${this.linkTileHref}\n aria-label=${this.model?.title ?? msg('Untitled item')}\n aria-describedby=\"link-aria-description\"\n aria-haspopup=${this.shouldPrepareHoverPane ? 'dialog' : 'false'}\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${this.handleLinkClicked}\n @contextmenu=${this.handleLinkContextMenu}\n class=\"tile-link\"\n >\n ${this.tile}\n </a>\n <div id=\"link-aria-description\" class=\"sr-only\">\n ${msg('Press Down Arrow to preview item details')}\n </div>\n `;\n }\n\n private get linkTileHref(): string | typeof nothing {\n if (!this.model?.identifier || this.baseNavigationUrl == null)\n return nothing;\n\n // Use the server-specified href if available.\n // Otherwise, construct a details page URL from the item identifier.\n if (this.model.href) {\n return `${this.baseNavigationUrl}${this.model.href}`;\n }\n\n return this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n this.model.mediatype === 'collection',\n );\n }\n\n private get manageCheckTemplate() {\n if (!this.isManageView || this.tileDisplayMode !== 'grid') return nothing;\n\n return html`\n <div class=\"manage-check\">\n <input\n type=\"checkbox\"\n title=${this.manageCheckTitle ??\n msg('Remove this item from the list')}\n ?checked=${this.model?.checked}\n @change=${this.handleLinkClicked}\n />\n </div>\n `;\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode] &&\n this.model?.mediatype !== 'search' && // don't show hover panes on search tiles\n !this.model?.captureDates // don't show hover panes on web archive tiles\n );\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n /**\n * Whether the info button should be shown on this tile.\n * Only shown on touch/non-hover devices where a hover pane is available,\n * so the button always has something to toggle.\n */\n private get shouldShowInfoButton(): boolean {\n return !this.isHoverEnabled && this.shouldPrepareHoverPane;\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver',\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n /**\n * Handler for when the tile link is left-clicked. Emits the `resultSelected` event.\n * In manage view, it also checks/unchecks the tile.\n */\n private handleLinkClicked(e: Event): void {\n if (this.isManageView) {\n e.preventDefault();\n if (this.model) this.model.checked = !this.model.checked;\n }\n\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model }),\n );\n }\n\n /**\n * Handler for when the tile link is right-clicked.\n * In manage view, it opens the item in a new tab. Otherwise, does nothing.\n */\n private handleLinkContextMenu(e: Event): void {\n if (this.isManageView && this.linkTileHref !== nothing) {\n e.preventDefault();\n window.open(this.linkTileHref, '_blank');\n }\n }\n\n private tileInfoButtonPressed(\n e: CustomEvent<{ x: number; y: number }>,\n ): void {\n this.hoverPaneController?.toggleHoverPane({\n coords: e.detail,\n enableTouchBackdrop: true,\n });\n }\n\n /** Whether tile action buttons should be rendered in grid mode */\n private get showGridTileActions(): boolean {\n return (\n this.tileActions.length > 0 &&\n !this.isManageView &&\n this.tileDisplayMode === 'grid'\n );\n }\n\n /**\n * Template for the grid-mode action buttons. Rendered alongside the inner\n * tile link inside the dispatcher's shadow root so the action buttons can\n * suppress the hover pane on hover.\n */\n private get gridTileActionsTemplate() {\n if (!this.showGridTileActions) return nothing;\n\n return html`\n <div\n class=\"tile-actions grid-tile-actions\"\n @mouseenter=${this.handleGridActionsMouseEnter}\n @mousemove=${(e: Event) => e.stopPropagation()}\n >\n ${this.tileActions.map(\n action => html`\n <button\n class=\"tile-action-btn\"\n @click=${(e: Event) => this.handleTileActionClick(e, action)}\n >\n ${action.label}\n </button>\n `,\n )}\n </div>\n `;\n }\n\n /**\n * When the mouse enters the grid-mode tile actions area, dispatch a\n * synthetic mouseleave on the host to cancel the hover pane's show timer\n * and hide any visible pane.\n */\n private handleGridActionsMouseEnter = (): void => {\n this.dispatchEvent(new MouseEvent('mouseleave', { bubbles: false }));\n };\n\n private get tile() {\n const {\n model,\n collectionPagePath,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n creatorFilter,\n mobileBreakpoint,\n defaultSortParam,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n .layoutType=${this.layoutType}\n ?showInfoButton=${this.shouldShowInfoButton}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n ?showInfoButton=${this.shouldShowInfoButton}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </account-tile>`;\n case 'search':\n return html`<search-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n ?showInfoButton=${false}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </search-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .defaultSortParam=${defaultSortParam}\n .creatorFilter=${creatorFilter}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n .layoutType=${this.layoutType}\n ?showTvClips=${this.showTvClips}\n ?showInfoButton=${this.shouldShowInfoButton}\n ?useLocalTime=${this.useLocalTime}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .defaultSortParam=${defaultSortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .tileActions=${this.isManageView ? [] : this.tileActions}\n ?useLocalTime=${this.useLocalTime}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .collectionTitles=${this.collectionTitles}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .defaultSortParam=${defaultSortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .tileActions=${this.isManageView ? [] : this.tileActions}\n ?useLocalTime=${this.useLocalTime}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return [\n srOnlyStyle,\n tileActionStyles,\n css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n search-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n --iconFillColor: #2c2c2c;\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n /*\n * When tile actions are present, the container takes on the role of\n * the tile's visual card so the tile content and action row appear\n * as a single unified element. The inner tile's own shadow/radius\n * are disabled via CSS variable overrides to avoid visual\n * duplication, and the action row sits as a footer inside the same\n * card.\n */\n #container.has-tile-actions {\n display: flex;\n flex-direction: column;\n overflow: hidden;\n box-shadow: var(--tileShadow, 1px 1px 2px 0);\n --tileBoxShadow: none;\n --tileCornerRadius: 0;\n }\n\n #container.has-tile-actions .tile-link {\n flex: 1;\n min-height: 0;\n overflow: hidden;\n border-radius: 0;\n }\n\n /* Normal hover shadow lives on the inner anchor for plain tiles */\n #container.hoverable:not(.has-tile-actions) a:focus,\n #container.hoverable:not(.has-tile-actions) a:hover {\n box-shadow: var(\n --tileHoverBoxShadow,\n 0 0 6px 2px rgba(8, 8, 32, 0.8)\n );\n transition: box-shadow 0.1s ease;\n }\n\n /*\n * When the container owns the card visuals, the hover shadow needs\n * to move up to the container so it wraps the action row too.\n */\n #container.hoverable.has-tile-actions:hover {\n box-shadow: var(\n --tileHoverBoxShadow,\n 0 0 6px 2px rgba(8, 8, 32, 0.8)\n );\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n border-radius: 4px;\n outline: none;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n .manage-check {\n position: absolute;\n right: 0;\n top: 0;\n border: 5px solid #2c2c2c;\n border-radius: 3px;\n background-color: #2c2c2c;\n z-index: 1;\n }\n\n .manage-check > input[type='checkbox'] {\n display: block;\n margin: 0;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 2;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n\n /*\n * Grid-mode action row sits flush against the bottom of the card —\n * the buttons' own borders form the visible bottom edge. The outer\n * buttons get rounded bottom corners to match the container so the\n * red border traces cleanly around the card's bottom corners.\n */\n .grid-tile-actions .tile-action-btn:first-child {\n border-bottom-left-radius: 4px;\n }\n\n .grid-tile-actions .tile-action-btn:last-child {\n border-bottom-right-radius: 4px;\n }\n `,\n ];\n }\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { __decorate } from "tslib";
|
|
2
2
|
import { css, html, LitElement } from 'lit';
|
|
3
3
|
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { localized } from '@lit/localize';
|
|
4
5
|
import { mediatypeConfig, } from '../mediatype/mediatype-config';
|
|
5
6
|
const TV_COMMERCIAL_COLLECTION = 'tv_ads';
|
|
6
7
|
const TV_FACT_CHECK_COLLECTION = 'factchecked';
|
|
@@ -117,7 +118,8 @@ __decorate([
|
|
|
117
118
|
property({ type: Boolean })
|
|
118
119
|
], TileMediatypeIcon.prototype, "showText", void 0);
|
|
119
120
|
TileMediatypeIcon = __decorate([
|
|
120
|
-
customElement('tile-mediatype-icon')
|
|
121
|
+
customElement('tile-mediatype-icon'),
|
|
122
|
+
localized()
|
|
121
123
|
], TileMediatypeIcon);
|
|
122
124
|
export { TileMediatypeIcon };
|
|
123
125
|
//# sourceMappingURL=tile-mediatype-icon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-mediatype-icon.js","sourceRoot":"","sources":["../../../src/tiles/tile-mediatype-icon.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;
|
|
1
|
+
{"version":3,"file":"tile-mediatype-icon.js","sourceRoot":"","sources":["../../../src/tiles/tile-mediatype-icon.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;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAE1C,OAAO,EACL,eAAe,GAEhB,MAAM,+BAA+B,CAAC;AAGvC,MAAM,wBAAwB,GAAG,QAAQ,CAAC;AAC1C,MAAM,wBAAwB,GAAG,aAAa,CAAC;AAC/C,MAAM,cAAc,G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,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAkB;AAHnC,iBAAiB;IAF7B,aAAa,CAAC,qBAAqB,CAAC;IACpC,SAAS,EAAE;GACC,iBAAiB,CAqH7B","sourcesContent":["import { css, CSSResultGroup, html, LitElement } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { localized } from '@lit/localize';\n\nimport {\n mediatypeConfig,\n MediatypeConfigKey,\n} from '../mediatype/mediatype-config';\nimport type { TileModel } from '../models';\n\nconst TV_COMMERCIAL_COLLECTION = 'tv_ads';\nconst TV_FACT_CHECK_COLLECTION = 'factchecked';\nconst TV_COLLECTIONS = new Set(['tvnews', 'tvarchive', 'television']);\nconst RADIO_COLLECTIONS = new Set(['radio', 'radioprogram']);\n\n@customElement('tile-mediatype-icon')\n@localized()\nexport class TileMediatypeIcon extends LitElement {\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: Boolean }) showText = false;\n\n /**\n * Returns the appropriate mediatype config key for the current mediatype/collections.\n */\n private get displayMediatype(): MediatypeConfigKey {\n if (this.isTvItem) return this.tvDisplayMediatype;\n if (this.isRadioItem) return 'radio';\n return this.model?.mediatype ?? 'none';\n }\n\n /**\n * Returns the appropriate TV mediatype, depending on the current collections.\n */\n private get tvDisplayMediatype(): MediatypeConfigKey {\n if (this.isTvCommercial) {\n return 'tvCommercial';\n } else if (this.model?.isTvSearchResult && this.isTvFactCheck) {\n return 'tvFactCheck';\n } else if (this.model?.isTvSearchResult && this.isTvQuote) {\n return 'tvQuote';\n }\n\n return 'tv';\n }\n\n /**\n * Whether this represents a TV item\n */\n private get isTvItem(): boolean {\n return !!(\n this.model?.mediatype === 'movies' &&\n this.model?.collections.some(id => TV_COLLECTIONS.has(id))\n );\n }\n\n private get isTvCommercial(): boolean {\n // Contains one or more TV ad identifiers or is in the tv_ads collection\n return !!(\n this.model?.adIds?.length ||\n this.model?.collections.includes(TV_COMMERCIAL_COLLECTION)\n );\n }\n\n private get isTvFactCheck(): boolean {\n // Contains one or more fact-check URLs or is in the factchecked collection\n return !!(\n this.model?.factChecks?.length ||\n this.model?.collections.includes(TV_FACT_CHECK_COLLECTION)\n );\n }\n\n private get isTvQuote(): boolean {\n return !!this.model?.isClip;\n }\n\n /**\n * Whether this represents a radio item\n */\n private get isRadioItem(): boolean {\n return !!(\n this.model?.mediatype === 'audio' &&\n this.model?.collections.some(id => RADIO_COLLECTIONS.has(id))\n );\n }\n\n render() {\n const config = mediatypeConfig[this.displayMediatype];\n if (!config) {\n return html``;\n }\n\n return html`\n <div\n id=\"icon\"\n class=\"${this.showText ? 'show-text' : 'hide-text'}\"\n title=\"${config.text}\"\n style=\"--iconFillColor: ${config.color}\"\n >\n ${config.icon}\n <p class=\"status-text\">${config.text}</p>\n </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return css`\n #icon {\n height: var(--iconHeight, 25px);\n }\n\n .status-text {\n font-size: 14px;\n color: #2c2c2c;\n margin: auto;\n display: block;\n text-align: var(--iconTextAlign, center);\n }\n\n #icon.hide-text p {\n display: none;\n }\n\n svg {\n height: var(--iconHeight, 10px);\n width: var(--iconWidth, 10px);\n pointer-events: none;\n }\n\n .fill-color {\n fill: var(--iconFillColor, '#000000');\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,
|
|
2
|
+
export declare function formatUnitSize(size: number | undefined, nDecimals: number, locale?: string): string | typeof nothing;
|
|
@@ -2,33 +2,36 @@
|
|
|
2
2
|
* Replaces Petabox www/common/Util::humanSize()
|
|
3
3
|
*/
|
|
4
4
|
import { nothing } from 'lit';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
5
|
+
import { msg, str } from '@lit/localize';
|
|
6
|
+
import { getLocale } from './get-locale';
|
|
7
|
+
/**
|
|
8
|
+
* Labels a formatted size with its unit, one entry per power of 1024 starting
|
|
9
|
+
* at bytes. Each entry is a function so the label is read in the current
|
|
10
|
+
* locale at call time.
|
|
11
|
+
*/
|
|
12
|
+
const unitLabels = [
|
|
13
|
+
(size, singular) => singular ? msg(str `${size} byte`) : msg(str `${size} bytes`),
|
|
14
|
+
(size, singular) => singular ? msg(str `${size} kilobyte`) : msg(str `${size} kilobytes`),
|
|
15
|
+
(size, singular) => singular ? msg(str `${size} megabyte`) : msg(str `${size} megabytes`),
|
|
16
|
+
(size, singular) => singular ? msg(str `${size} gigabyte`) : msg(str `${size} gigabytes`),
|
|
17
|
+
(size, singular) => singular ? msg(str `${size} terabyte`) : msg(str `${size} terabytes`),
|
|
18
|
+
(size, singular) => singular ? msg(str `${size} petabyte`) : msg(str `${size} petabytes`),
|
|
19
|
+
(size, singular) => singular ? msg(str `${size} exabyte`) : msg(str `${size} exabytes`),
|
|
20
|
+
(size, singular) => singular ? msg(str `${size} zettabyte`) : msg(str `${size} zettabytes`),
|
|
21
|
+
(size, singular) => singular ? msg(str `${size} yottabyte`) : msg(str `${size} yottabytes`),
|
|
22
|
+
];
|
|
23
|
+
export function formatUnitSize(size, nDecimals, locale = getLocale()) {
|
|
18
24
|
let itemSize = size;
|
|
19
25
|
if (itemSize === undefined)
|
|
20
26
|
return nothing; // early return.
|
|
21
27
|
let unitIndex = 0;
|
|
22
28
|
// convert byte to highest possible unit
|
|
23
|
-
while (itemSize > 1024) {
|
|
29
|
+
while (itemSize > 1024 && unitIndex < unitLabels.length - 1) {
|
|
24
30
|
itemSize /= 1024;
|
|
25
31
|
unitIndex += 1;
|
|
26
32
|
}
|
|
27
33
|
const magnitude = 10 ** nDecimals;
|
|
28
34
|
itemSize = Math.round(itemSize * magnitude) / magnitude;
|
|
29
|
-
|
|
30
|
-
// convert plural to singular.
|
|
31
|
-
unitText = itemSize === 1 ? unitText.slice(0, -1) : unitText;
|
|
32
|
-
return `${itemSize.toLocaleString() + separator + unitText}`;
|
|
35
|
+
return unitLabels[unitIndex](new Intl.NumberFormat(locale).format(itemSize), itemSize === 1);
|
|
33
36
|
}
|
|
34
37
|
//# sourceMappingURL=format-unit-size.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-unit-size.js","sourceRoot":"","sources":["../../../src/utils/format-unit-size.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"format-unit-size.js","sourceRoot":"","sources":["../../../src/utils/format-unit-size.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;GAIG;AACH,MAAM,UAAU,GAAoD;IAClE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CACjB,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,QAAQ,CAAC;IAC7D,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CACjB,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,YAAY,CAAC;IACrE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CACjB,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,YAAY,CAAC;IACrE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CACjB,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAA,GAAG,IAAI,YAAY,CAAC;IACrE,CAAC,IAAI,EAAE,QAAQ,EAAE,EAAE,CACjB,QAAQ,CAAC,C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Q,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,20 @@
|
|
|
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
|
+
desc: 'Not shown to users. Reports the active locale: translators should translate this to the ISO code of the locale they are translating into.',
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
//# 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,EAAE;QACf,IAAI,EAAE,2IAA2I;KAClJ,CAAC,CAAC;AACL,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 desc: 'Not shown to users. Reports the active locale: translators should translate this to the ISO code of the locale they are translating into.',\n });\n}\n"]}
|
package/locales/es.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { templates } from '../dist/src/locales/es.js';
|
package/locales/es.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { templates } from '../dist/src/locales/es.js';
|
package/package.json
CHANGED
|
@@ -7,12 +7,13 @@
|
|
|
7
7
|
"type": "git",
|
|
8
8
|
"url": "git+https://github.com/internetarchive/iaux-collection-browser.git"
|
|
9
9
|
},
|
|
10
|
-
"version": "4.
|
|
10
|
+
"version": "4.10.1",
|
|
11
11
|
"main": "dist/index.js",
|
|
12
12
|
"module": "dist/index.js",
|
|
13
13
|
"files": [
|
|
14
14
|
"dist",
|
|
15
|
-
"!dist/test"
|
|
15
|
+
"!dist/test",
|
|
16
|
+
"locales"
|
|
16
17
|
],
|
|
17
18
|
"packageManager": "pnpm@11.27.1",
|
|
18
19
|
"engines": {
|
|
@@ -26,6 +27,8 @@
|
|
|
26
27
|
"lint": "eslint . && prettier \"**/*.ts\" --check",
|
|
27
28
|
"format": "eslint . --fix && prettier \"**/*.ts\" --write",
|
|
28
29
|
"circular": "madge --circular --extensions ts .",
|
|
30
|
+
"strings:extract": "lit-localize extract",
|
|
31
|
+
"strings:build": "node scripts/build-locales.mts && prettier --write \"src/locales/*.ts\"",
|
|
29
32
|
"test": "tsc && pnpm run lint && pnpm run circular && wtr --coverage",
|
|
30
33
|
"test:fast": "tsc && wtr --coverage",
|
|
31
34
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
|
|
@@ -58,6 +61,7 @@
|
|
|
58
61
|
"@eslint/eslintrc": "^3.3.7",
|
|
59
62
|
"@eslint/js": "^9.22.0",
|
|
60
63
|
"@internetarchive/result-type": "^0.0.1",
|
|
64
|
+
"@lit/localize-tools": "^0.8.2",
|
|
61
65
|
"@open-wc/eslint-config": "^13.0.0",
|
|
62
66
|
"@open-wc/testing": "^4.0.0",
|
|
63
67
|
"@rollup/plugin-image": "^3.0.3",
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { ReactiveController, ReactiveControllerHost } from 'lit';
|
|
2
|
-
/** How long the pointer must rest on a tile before its preview starts. */
|
|
3
|
-
export declare const HOVER_INTENT_MS = 300;
|
|
4
|
-
/** Keyboard focus waits a little longer, so tabbing through tiles stays quiet. */
|
|
5
|
-
export declare const FOCUS_INTENT_MS = 600;
|
|
6
|
-
export declare const LONG_PRESS_MS = 500;
|
|
7
|
-
/** How long the hover info pane waits on a tile that shows previews (a bit longer than one preview cycle). */
|
|
8
|
-
export declare const PREVIEW_PANE_DELAY_MS = 5000;
|
|
9
|
-
/** Whether this user and connection should see animated previews at all. */
|
|
10
|
-
export declare function previewsAllowed(): boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Decides when a tile's preview is active: after a hover-intent delay for a
|
|
13
|
-
* mouse, on keyboard focus, and on long-press for touch. Starting one preview
|
|
14
|
-
* stops whichever was active before.
|
|
15
|
-
*/
|
|
16
|
-
export declare class TilePreviewController implements ReactiveController {
|
|
17
|
-
private host;
|
|
18
|
-
private options;
|
|
19
|
-
active: boolean;
|
|
20
|
-
private timer?;
|
|
21
|
-
private pressOrigin?;
|
|
22
|
-
private suppressClick;
|
|
23
|
-
private suppressTimer?;
|
|
24
|
-
/** Whether the press in progress is the one that started the preview. */
|
|
25
|
-
private pressStartedPreview;
|
|
26
|
-
constructor(host: ReactiveControllerHost & HTMLElement, options: {
|
|
27
|
-
enabled: () => boolean;
|
|
28
|
-
});
|
|
29
|
-
hostConnected(): void;
|
|
30
|
-
hostDisconnected(): void;
|
|
31
|
-
/** Stops this tile's preview and any pending start. */
|
|
32
|
-
deactivate(): void;
|
|
33
|
-
private schedule;
|
|
34
|
-
/**
|
|
35
|
-
* A pinch (a second finger, a Safari gesture or a trackpad ctrl+wheel) is a
|
|
36
|
-
* zoom, not a request for a preview, so it cancels a pending or active one.
|
|
37
|
-
* The listeners only exist while a preview is pending or showing.
|
|
38
|
-
*/
|
|
39
|
-
private addZoomGuards;
|
|
40
|
-
private removeZoomGuards;
|
|
41
|
-
private onAnyPointerDown;
|
|
42
|
-
private onZoomGesture;
|
|
43
|
-
private onWheel;
|
|
44
|
-
private activate;
|
|
45
|
-
private onPointerEnter;
|
|
46
|
-
private onPointerLeave;
|
|
47
|
-
private onPointerDown;
|
|
48
|
-
private onPointerMove;
|
|
49
|
-
/** Ends a press. If it started the preview, the click that follows is swallowed. */
|
|
50
|
-
private onPointerUp;
|
|
51
|
-
/** A cancelled or moved press never produces a click. */
|
|
52
|
-
private onPointerCancel;
|
|
53
|
-
private onClick;
|
|
54
|
-
/** Keeps the long-press from opening the browser's link menu. */
|
|
55
|
-
private onContextMenu;
|
|
56
|
-
private onFocusIn;
|
|
57
|
-
private onFocusOut;
|
|
58
|
-
private onKeyDown;
|
|
59
|
-
private onOutsidePointerDown;
|
|
60
|
-
private onScroll;
|
|
61
|
-
}
|