@internetarchive/collection-browser 4.9.1-webdev-9670.1 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/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 -36
- 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 -44
- package/dist/src/tiles/preview/tile-preview-media.js +0 -151
- 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
|
@@ -12,7 +12,6 @@ import { RestorationStateHandlerInterface } from './restoration-state-handler';
|
|
|
12
12
|
import type { CollectionBrowserQueryState, CollectionBrowserSearchInterface } from './data-source/collection-browser-query-state';
|
|
13
13
|
import type { CollectionBrowserDataSourceInterface } from './data-source/collection-browser-data-source-interface';
|
|
14
14
|
import type { LayoutType, TileAction } from './tiles/models';
|
|
15
|
-
import type { TilePreviewOptions } from './tiles/preview/tile-preview-media';
|
|
16
15
|
import '@internetarchive/elements/ia-combo-box/ia-combo-box';
|
|
17
16
|
import './empty-placeholder';
|
|
18
17
|
import './tiles/tile-dispatcher';
|
|
@@ -25,13 +24,6 @@ import './collection-facets/smart-facets/smart-facet-bar';
|
|
|
25
24
|
export declare class CollectionBrowser extends LitElement implements InfiniteScrollerCellProviderInterface, SharedResizeObserverResizeHandlerInterface, CollectionBrowserSearchInterface {
|
|
26
25
|
baseNavigationUrl?: string;
|
|
27
26
|
baseImageUrl: string;
|
|
28
|
-
/**
|
|
29
|
-
* Prototype: show a live preview of an item when its tile is hovered,
|
|
30
|
-
* focused with the keyboard or long-pressed. Off by default.
|
|
31
|
-
*/
|
|
32
|
-
enableTilePreviews: boolean;
|
|
33
|
-
/** Prototype: what tile previews may fetch and play (video clips, audio sound). */
|
|
34
|
-
tilePreviewOptions: TilePreviewOptions;
|
|
35
27
|
searchService?: SearchServiceInterface;
|
|
36
28
|
/**
|
|
37
29
|
* Which backend should be targeted by searches (e.g., metadata or FTS)
|
|
@@ -180,12 +172,8 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
|
|
|
180
172
|
* `LayoutType` for available options. Has no effect on list display modes.
|
|
181
173
|
*/
|
|
182
174
|
tileLayoutType: LayoutType;
|
|
183
|
-
/**
|
|
184
|
-
|
|
185
|
-
* or a slider next to the display mode buttons. Off by default.
|
|
186
|
-
*/
|
|
187
|
-
enablePinchZoom: boolean;
|
|
188
|
-
manageViewLabel: string;
|
|
175
|
+
/** Label for the manage bar. Defaults to the manage bar's own localized label. */
|
|
176
|
+
manageViewLabel?: string;
|
|
189
177
|
/** Whether to replace the default sort options with a slot for customization (default: false) */
|
|
190
178
|
enableSortOptionsSlot: boolean;
|
|
191
179
|
/** Whether to expose a slot for a smart results carousel above the full results */
|
|
@@ -221,13 +209,6 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
|
|
|
221
209
|
private facetsLoading;
|
|
222
210
|
private totalResults?;
|
|
223
211
|
private mobileView;
|
|
224
|
-
/** The zoom level the viewer has chosen, if any (an index into `GRID_ZOOM_COLUMNS`). */
|
|
225
|
-
private gridZoomLevel?;
|
|
226
|
-
/** The zoom level closest to the layout the grid has when no zoom level is chosen. */
|
|
227
|
-
private defaultGridZoomLevel;
|
|
228
|
-
/** Identifies the latest zoom, so that an earlier one stops lining up its tile. */
|
|
229
|
-
private gridZoomAlignment;
|
|
230
|
-
private gridZoomController;
|
|
231
212
|
/**
|
|
232
213
|
* Any temporarily overridden `on`/`off` state for the user's tile blurring preference if they
|
|
233
214
|
* have chosen to override it, or `no-override` if they have not.
|
|
@@ -407,28 +388,6 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
|
|
|
407
388
|
* Template for the infinite scroller widget that contains the result tiles.
|
|
408
389
|
*/
|
|
409
390
|
private get infiniteScrollerTemplate();
|
|
410
|
-
/** Whether the grid zoom prototype is on and applies to what's showing. */
|
|
411
|
-
private get pinchZoomActive();
|
|
412
|
-
private get effectiveGridZoomLevel();
|
|
413
|
-
/** Inline CSS variables for the chosen zoom level, if the viewer has chosen one. */
|
|
414
|
-
private get gridZoomStyles();
|
|
415
|
-
private get effectiveTileLayoutType();
|
|
416
|
-
/** How many columns the scroller's grid currently has. */
|
|
417
|
-
private measureGridColumns;
|
|
418
|
-
/** Connects/disconnects the gesture handling and tracks the default zoom level. */
|
|
419
|
-
private updateGridZoom;
|
|
420
|
-
private gridZoomSliderChanged;
|
|
421
|
-
/**
|
|
422
|
-
* Switches the grid to `level`, then scrolls so that the tile that was under
|
|
423
|
-
* `focal` (viewport coordinates) is still under it.
|
|
424
|
-
*/
|
|
425
|
-
private commitGridZoomLevel;
|
|
426
|
-
/** Keeps `anchor`'s tile lined up with `focal` for `duration` ms. */
|
|
427
|
-
private alignTile;
|
|
428
|
-
/** Scrolls the nearest scrolling ancestor of `el` (or the page) by `delta` px. */
|
|
429
|
-
private scrollByWithin;
|
|
430
|
-
/** Finds the tile under a viewport point and where in the tile the point falls. */
|
|
431
|
-
private tileAtPoint;
|
|
432
391
|
/**
|
|
433
392
|
* Produces a `classMap` indicating which classes the infinite scroller should have
|
|
434
393
|
* given the current display mode & placeholder case.
|
|
@@ -3,21 +3,19 @@ import { __decorate } from "tslib";
|
|
|
3
3
|
import { html, css, LitElement, nothing, } from 'lit';
|
|
4
4
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
5
5
|
import { classMap } from 'lit/directives/class-map.js';
|
|
6
|
-
import {
|
|
7
|
-
import { msg } from '@lit/localize';
|
|
6
|
+
import { localized, msg } from '@lit/localize';
|
|
8
7
|
import { SearchType, } from '@internetarchive/search-service';
|
|
9
8
|
import '@internetarchive/infinite-scroller';
|
|
10
9
|
import { SortField, getDefaultSelectedFacets, sortOptionFromAPIString, SORT_OPTIONS, defaultProfileElementSorts, defaultFacetDisplayOrder, tvFacetDisplayOrder, defaultSortAvailability, favoritesSortAvailability, tvSortAvailability, } from './models';
|
|
11
10
|
import { RestorationStateHandler, } from './restoration-state-handler';
|
|
12
11
|
import { CollectionBrowserDataSource } from './data-source/collection-browser-data-source';
|
|
13
12
|
import { FACETLESS_PAGE_ELEMENTS } from './data-source/models';
|
|
14
|
-
import { GRID_ZOOM_COLUMNS, loadStoredZoomLevel, nearestZoomLevel, storeZoomLevel, zoomLayoutType, zoomLevelStyles, } from './utils/grid-zoom';
|
|
15
|
-
import { GridZoomController } from './utils/grid-zoom-controller';
|
|
16
13
|
import { analyticsActions, analyticsCategories, } from './utils/analytics-events';
|
|
17
14
|
import { updateSelectedFacetBucket } from './utils/facet-utils';
|
|
18
15
|
import chevronIcon from './assets/img/icons/chevron';
|
|
19
16
|
import { srOnlyStyle } from './styles/sr-only';
|
|
20
17
|
import { sha1 } from './utils/sha1';
|
|
18
|
+
import { getLocale } from './utils/get-locale';
|
|
21
19
|
import '@internetarchive/elements/ia-combo-box/ia-combo-box';
|
|
22
20
|
import './empty-placeholder';
|
|
23
21
|
import './tiles/tile-dispatcher';
|
|
@@ -27,22 +25,11 @@ import './manage/manage-bar';
|
|
|
27
25
|
import './collection-facets';
|
|
28
26
|
import './circular-activity-indicator';
|
|
29
27
|
import './collection-facets/smart-facets/smart-facet-bar';
|
|
30
|
-
/** How long to keep a zoomed tile lined up with the focal point after a layout change. */
|
|
31
|
-
const GRID_ZOOM_SETTLE_MS = 600;
|
|
32
|
-
/** How long the grid stays hidden while the tile is lined up after a layout change. */
|
|
33
|
-
const GRID_ZOOM_HIDDEN_MS = 250;
|
|
34
28
|
let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
35
29
|
static { CollectionBrowser_1 = this; }
|
|
36
30
|
constructor() {
|
|
37
31
|
super();
|
|
38
32
|
this.baseImageUrl = 'https://archive.org';
|
|
39
|
-
/**
|
|
40
|
-
* Prototype: show a live preview of an item when its tile is hovered,
|
|
41
|
-
* focused with the keyboard or long-pressed. Off by default.
|
|
42
|
-
*/
|
|
43
|
-
this.enableTilePreviews = false;
|
|
44
|
-
/** Prototype: what tile previews may fetch and play (video clips, audio sound). */
|
|
45
|
-
this.tilePreviewOptions = {};
|
|
46
33
|
/**
|
|
47
34
|
* Which backend should be targeted by searches (e.g., metadata or FTS)
|
|
48
35
|
*/
|
|
@@ -145,12 +132,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
145
132
|
* `LayoutType` for available options. Has no effect on list display modes.
|
|
146
133
|
*/
|
|
147
134
|
this.tileLayoutType = 'default';
|
|
148
|
-
/**
|
|
149
|
-
* Prototype: lets viewers zoom the tile grid with a pinch, ctrl/cmd +/-,
|
|
150
|
-
* or a slider next to the display mode buttons. Off by default.
|
|
151
|
-
*/
|
|
152
|
-
this.enablePinchZoom = false;
|
|
153
|
-
this.manageViewLabel = 'Select items to remove';
|
|
154
135
|
/** Whether to replace the default sort options with a slot for customization (default: false) */
|
|
155
136
|
this.enableSortOptionsSlot = false;
|
|
156
137
|
/** Whether to expose a slot for a smart results carousel above the full results */
|
|
@@ -185,17 +166,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
185
166
|
this.searchResultsLoading = false;
|
|
186
167
|
this.facetsLoading = false;
|
|
187
168
|
this.mobileView = false;
|
|
188
|
-
/** The zoom level closest to the layout the grid has when no zoom level is chosen. */
|
|
189
|
-
this.defaultGridZoomLevel = nearestZoomLevel(4);
|
|
190
|
-
/** Identifies the latest zoom, so that an earlier one stops lining up its tile. */
|
|
191
|
-
this.gridZoomAlignment = 0;
|
|
192
|
-
this.gridZoomController = new GridZoomController({
|
|
193
|
-
getSurface: () => this.infiniteScroller,
|
|
194
|
-
getColumns: () => this.measureGridColumns(),
|
|
195
|
-
getLevel: () => this.effectiveGridZoomLevel,
|
|
196
|
-
captureAnchor: focal => this.tileAtPoint(focal),
|
|
197
|
-
commitLevel: (level, focal, anchor) => this.commitGridZoomLevel(level, focal, anchor),
|
|
198
|
-
});
|
|
199
169
|
/**
|
|
200
170
|
* Any temporarily overridden `on`/`off` state for the user's tile blurring preference if they
|
|
201
171
|
* have chosen to override it, or `no-override` if they have not.
|
|
@@ -639,13 +609,15 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
639
609
|
return nothing;
|
|
640
610
|
const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
|
|
641
611
|
const classes = classMap({ filtered: this.hasActiveFilters });
|
|
642
|
-
const resultsCount = this.totalResults
|
|
643
|
-
|
|
612
|
+
const resultsCount = this.totalResults === undefined
|
|
613
|
+
? undefined
|
|
614
|
+
: new Intl.NumberFormat(getLocale()).format(this.totalResults);
|
|
615
|
+
const resultsLabel = this.totalResults === 1 ? msg('Result') : msg('Results');
|
|
644
616
|
// Added data-testid for Playwright testing
|
|
645
617
|
return html `
|
|
646
618
|
<div id="results-total" class=${classes} data-testid="results-total">
|
|
647
619
|
<span id="big-results-count">
|
|
648
|
-
${shouldShowSearching ?
|
|
620
|
+
${shouldShowSearching ? msg('Searching…') : resultsCount}
|
|
649
621
|
</span>
|
|
650
622
|
<span id="big-results-label">
|
|
651
623
|
${shouldShowSearching ? nothing : resultsLabel}
|
|
@@ -701,9 +673,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
701
673
|
return html `<infinite-scroller
|
|
702
674
|
class=${this.infiniteScrollerClasses}
|
|
703
675
|
itemCount=${this.placeholderType ? 0 : nothing}
|
|
704
|
-
ariaLandmarkLabel
|
|
676
|
+
ariaLandmarkLabel=${msg('Search results')}
|
|
705
677
|
.estimatedCellHeight=${this.estimatedTileHeight}
|
|
706
|
-
style=${styleMap(this.gridZoomStyles)}
|
|
707
678
|
.minBufferMarginCells=${this.pageSize}
|
|
708
679
|
.cellProvider=${this}
|
|
709
680
|
.placeholderCellTemplate=${this.placeholderCellTemplate}
|
|
@@ -714,127 +685,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
714
685
|
: nothing}
|
|
715
686
|
</infinite-scroller>`;
|
|
716
687
|
}
|
|
717
|
-
/** Whether the grid zoom prototype is on and applies to what's showing. */
|
|
718
|
-
get pinchZoomActive() {
|
|
719
|
-
return this.enablePinchZoom && this.displayMode === 'grid';
|
|
720
|
-
}
|
|
721
|
-
get effectiveGridZoomLevel() {
|
|
722
|
-
return this.gridZoomLevel ?? this.defaultGridZoomLevel;
|
|
723
|
-
}
|
|
724
|
-
/** Inline CSS variables for the chosen zoom level, if the viewer has chosen one. */
|
|
725
|
-
get gridZoomStyles() {
|
|
726
|
-
if (!this.pinchZoomActive || this.gridZoomLevel === undefined)
|
|
727
|
-
return {};
|
|
728
|
-
return zoomLevelStyles(this.gridZoomLevel, this.infiniteScroller?.clientWidth ?? 0);
|
|
729
|
-
}
|
|
730
|
-
get effectiveTileLayoutType() {
|
|
731
|
-
if (!this.pinchZoomActive || this.gridZoomLevel === undefined) {
|
|
732
|
-
return this.tileLayoutType;
|
|
733
|
-
}
|
|
734
|
-
return zoomLayoutType(this.gridZoomLevel) ?? this.tileLayoutType;
|
|
735
|
-
}
|
|
736
|
-
/** How many columns the scroller's grid currently has. */
|
|
737
|
-
measureGridColumns() {
|
|
738
|
-
const cells = this.infiniteScroller?.shadowRoot?.querySelectorAll('.cell-container');
|
|
739
|
-
if (!cells?.length)
|
|
740
|
-
return GRID_ZOOM_COLUMNS[this.effectiveGridZoomLevel];
|
|
741
|
-
const firstTop = cells[0].getBoundingClientRect().top;
|
|
742
|
-
let columns = 0;
|
|
743
|
-
for (const cell of cells) {
|
|
744
|
-
if (cell.getBoundingClientRect().top !== firstTop)
|
|
745
|
-
break;
|
|
746
|
-
columns += 1;
|
|
747
|
-
}
|
|
748
|
-
return columns;
|
|
749
|
-
}
|
|
750
|
-
/** Connects/disconnects the gesture handling and tracks the default zoom level. */
|
|
751
|
-
updateGridZoom(changed) {
|
|
752
|
-
if (changed.has('enablePinchZoom') && this.enablePinchZoom) {
|
|
753
|
-
this.gridZoomLevel ??= loadStoredZoomLevel();
|
|
754
|
-
}
|
|
755
|
-
if (this.pinchZoomActive && this.infiniteScroller) {
|
|
756
|
-
this.gridZoomController.connect();
|
|
757
|
-
if (this.gridZoomLevel === undefined) {
|
|
758
|
-
this.defaultGridZoomLevel = nearestZoomLevel(this.measureGridColumns());
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
else {
|
|
762
|
-
this.gridZoomAlignment += 1;
|
|
763
|
-
this.gridZoomController.disconnect();
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
gridZoomSliderChanged(e) {
|
|
767
|
-
this.gridZoomController.zoomToLevel(e.detail.level);
|
|
768
|
-
}
|
|
769
|
-
/**
|
|
770
|
-
* Switches the grid to `level`, then scrolls so that the tile that was under
|
|
771
|
-
* `focal` (viewport coordinates) is still under it.
|
|
772
|
-
*/
|
|
773
|
-
async commitGridZoomLevel(level, focal, anchor) {
|
|
774
|
-
const scroller = this.infiniteScroller;
|
|
775
|
-
if (!scroller)
|
|
776
|
-
return;
|
|
777
|
-
this.gridZoomLevel = level;
|
|
778
|
-
storeZoomLevel(level);
|
|
779
|
-
await this.updateComplete;
|
|
780
|
-
await scroller.bufferStabilized;
|
|
781
|
-
if (!anchor)
|
|
782
|
-
return;
|
|
783
|
-
// The scroller keeps re-measuring rows for a moment after a layout change.
|
|
784
|
-
// The grid stays hidden for the first part of that, and the rest is corrected
|
|
785
|
-
// in the background.
|
|
786
|
-
this.gridZoomAlignment += 1;
|
|
787
|
-
const alignment = this.gridZoomAlignment;
|
|
788
|
-
await this.alignTile(scroller, anchor, focal, GRID_ZOOM_HIDDEN_MS, alignment);
|
|
789
|
-
this.alignTile(scroller, anchor, focal, GRID_ZOOM_SETTLE_MS, alignment).catch(() => { });
|
|
790
|
-
}
|
|
791
|
-
/** Keeps `anchor`'s tile lined up with `focal` for `duration` ms. */
|
|
792
|
-
async alignTile(scroller, anchor, focal, duration, alignment) {
|
|
793
|
-
const deadline = performance.now() + duration;
|
|
794
|
-
while (performance.now() < deadline &&
|
|
795
|
-
alignment === this.gridZoomAlignment) {
|
|
796
|
-
const cell = scroller.shadowRoot?.querySelector(`[data-cell-index="${anchor.index}"]`);
|
|
797
|
-
if (cell) {
|
|
798
|
-
const rect = cell.getBoundingClientRect();
|
|
799
|
-
const delta = rect.top + rect.height * anchor.fractionY - focal.y;
|
|
800
|
-
if (Math.abs(delta) > 1)
|
|
801
|
-
this.scrollByWithin(scroller, delta);
|
|
802
|
-
}
|
|
803
|
-
else {
|
|
804
|
-
await scroller.scrollToCell(anchor.index, false);
|
|
805
|
-
}
|
|
806
|
-
await new Promise(requestAnimationFrame);
|
|
807
|
-
}
|
|
808
|
-
}
|
|
809
|
-
/** Scrolls the nearest scrolling ancestor of `el` (or the page) by `delta` px. */
|
|
810
|
-
scrollByWithin(el, delta) {
|
|
811
|
-
let node = el;
|
|
812
|
-
while (node) {
|
|
813
|
-
const parent = node.parentElement ?? node.getRootNode().host ?? null;
|
|
814
|
-
if (!parent)
|
|
815
|
-
break;
|
|
816
|
-
const { overflowY } = getComputedStyle(parent);
|
|
817
|
-
if (overflowY === 'auto' || overflowY === 'scroll') {
|
|
818
|
-
parent.scrollTop += delta;
|
|
819
|
-
return;
|
|
820
|
-
}
|
|
821
|
-
node = parent;
|
|
822
|
-
}
|
|
823
|
-
window.scrollBy(0, delta);
|
|
824
|
-
}
|
|
825
|
-
/** Finds the tile under a viewport point and where in the tile the point falls. */
|
|
826
|
-
tileAtPoint(point) {
|
|
827
|
-
const cell = this.infiniteScroller?.shadowRoot
|
|
828
|
-
?.elementsFromPoint(point.x, point.y)
|
|
829
|
-
.find(el => el.classList.contains('cell-container'));
|
|
830
|
-
if (!cell)
|
|
831
|
-
return undefined;
|
|
832
|
-
const rect = cell.getBoundingClientRect();
|
|
833
|
-
return {
|
|
834
|
-
index: Number(cell.dataset.cellIndex),
|
|
835
|
-
fractionY: (point.y - rect.top) / rect.height,
|
|
836
|
-
};
|
|
837
|
-
}
|
|
838
688
|
/**
|
|
839
689
|
* Produces a `classMap` indicating which classes the infinite scroller should have
|
|
840
690
|
* given the current display mode & placeholder case.
|
|
@@ -897,9 +747,6 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
897
747
|
.prefixFilterCountMap=${this.dataSource.prefixFilterCountMap}
|
|
898
748
|
.enableSortOptionsSlot=${this.enableSortOptionsSlot}
|
|
899
749
|
.suppressDisplayModes=${this.suppressDisplayModes}
|
|
900
|
-
.showGridZoomSlider=${this.pinchZoomActive}
|
|
901
|
-
.gridZoomLevel=${this.effectiveGridZoomLevel}
|
|
902
|
-
@gridZoomLevelChanged=${this.gridZoomSliderChanged}
|
|
903
750
|
@sortChanged=${this.userChangedSort}
|
|
904
751
|
@displayModeChanged=${this.displayModeChanged}
|
|
905
752
|
@titleLetterChanged=${this.titleLetterSelected}
|
|
@@ -1433,7 +1280,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1433
1280
|
'clear-filters-btn': true,
|
|
1434
1281
|
mobile,
|
|
1435
1282
|
});
|
|
1436
|
-
const buttonText = mobile ? 'Clear all' : 'Clear all filters';
|
|
1283
|
+
const buttonText = mobile ? msg('Clear all') : msg('Clear all filters');
|
|
1437
1284
|
return html `
|
|
1438
1285
|
<div class="clear-filters-btn-row">
|
|
1439
1286
|
${mobile
|
|
@@ -1575,18 +1422,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1575
1422
|
changed.has('baseImageUrl') ||
|
|
1576
1423
|
changed.has('loggedIn') ||
|
|
1577
1424
|
changed.has('tileActions') ||
|
|
1578
|
-
changed.has('tileLayoutType')
|
|
1579
|
-
changed.has('gridZoomLevel') ||
|
|
1580
|
-
changed.has('enableTilePreviews') ||
|
|
1581
|
-
changed.has('tilePreviewOptions')) {
|
|
1425
|
+
changed.has('tileLayoutType')) {
|
|
1582
1426
|
this.infiniteScroller?.reload();
|
|
1583
1427
|
}
|
|
1584
|
-
this.updateGridZoom(changed);
|
|
1585
|
-
if (changed.has('contentWidth') &&
|
|
1586
|
-
this.gridZoomStyles['--imgBlockHeight']) {
|
|
1587
|
-
// Thumbnail sizes come from the scroller's width, which has only just changed.
|
|
1588
|
-
requestAnimationFrame(() => this.requestUpdate());
|
|
1589
|
-
}
|
|
1590
1428
|
if (changed.has('profileElement')) {
|
|
1591
1429
|
this.applyDefaultProfileSort();
|
|
1592
1430
|
}
|
|
@@ -1687,11 +1525,8 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
1687
1525
|
super.connectedCallback?.();
|
|
1688
1526
|
this.setupStateRestorationObserver();
|
|
1689
1527
|
this.setupResizeObserver();
|
|
1690
|
-
if (this.hasUpdated)
|
|
1691
|
-
this.updateGridZoom(new Map());
|
|
1692
1528
|
}
|
|
1693
1529
|
disconnectedCallback() {
|
|
1694
|
-
this.gridZoomController.disconnect();
|
|
1695
1530
|
if (this.resizeObserver) {
|
|
1696
1531
|
this.disconnectResizeObserver(this.resizeObserver);
|
|
1697
1532
|
}
|
|
@@ -2242,11 +2077,9 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
|
|
|
2242
2077
|
.suppressBlurring=${this.shouldSuppressTileBlurring}
|
|
2243
2078
|
.isManageView=${this.isManageView}
|
|
2244
2079
|
.tileActions=${this.tileActions}
|
|
2245
|
-
.layoutType=${this.
|
|
2080
|
+
.layoutType=${this.tileLayoutType}
|
|
2246
2081
|
?showTvClips=${isTVSearch || isTVCollection}
|
|
2247
2082
|
?enableHoverPane=${true}
|
|
2248
|
-
?enableTilePreview=${this.enableTilePreviews}
|
|
2249
|
-
.tilePreviewOptions=${this.tilePreviewOptions}
|
|
2250
2083
|
?useLocalTime=${shouldUseLocalTime}
|
|
2251
2084
|
@resultSelected=${(e) => this.resultSelected(e)}
|
|
2252
2085
|
>
|
|
@@ -2785,12 +2618,6 @@ __decorate([
|
|
|
2785
2618
|
__decorate([
|
|
2786
2619
|
property({ type: String })
|
|
2787
2620
|
], CollectionBrowser.prototype, "baseImageUrl", void 0);
|
|
2788
|
-
__decorate([
|
|
2789
|
-
property({ type: Boolean })
|
|
2790
|
-
], CollectionBrowser.prototype, "enableTilePreviews", void 0);
|
|
2791
|
-
__decorate([
|
|
2792
|
-
property({ type: Object })
|
|
2793
|
-
], CollectionBrowser.prototype, "tilePreviewOptions", void 0);
|
|
2794
2621
|
__decorate([
|
|
2795
2622
|
property({ type: Object })
|
|
2796
2623
|
], CollectionBrowser.prototype, "searchService", void 0);
|
|
@@ -2935,9 +2762,6 @@ __decorate([
|
|
|
2935
2762
|
__decorate([
|
|
2936
2763
|
property({ type: String })
|
|
2937
2764
|
], CollectionBrowser.prototype, "tileLayoutType", void 0);
|
|
2938
|
-
__decorate([
|
|
2939
|
-
property({ type: Boolean, attribute: 'enable-pinch-zoom' })
|
|
2940
|
-
], CollectionBrowser.prototype, "enablePinchZoom", void 0);
|
|
2941
2765
|
__decorate([
|
|
2942
2766
|
property({ type: String })
|
|
2943
2767
|
], CollectionBrowser.prototype, "manageViewLabel", void 0);
|
|
@@ -2968,12 +2792,6 @@ __decorate([
|
|
|
2968
2792
|
__decorate([
|
|
2969
2793
|
state()
|
|
2970
2794
|
], CollectionBrowser.prototype, "mobileView", void 0);
|
|
2971
|
-
__decorate([
|
|
2972
|
-
state()
|
|
2973
|
-
], CollectionBrowser.prototype, "gridZoomLevel", void 0);
|
|
2974
|
-
__decorate([
|
|
2975
|
-
state()
|
|
2976
|
-
], CollectionBrowser.prototype, "defaultGridZoomLevel", void 0);
|
|
2977
2795
|
__decorate([
|
|
2978
2796
|
state()
|
|
2979
2797
|
], CollectionBrowser.prototype, "tileBlurOverrideState", void 0);
|
|
@@ -3029,7 +2847,8 @@ __decorate([
|
|
|
3029
2847
|
query('infinite-scroller')
|
|
3030
2848
|
], CollectionBrowser.prototype, "infiniteScroller", void 0);
|
|
3031
2849
|
CollectionBrowser = CollectionBrowser_1 = __decorate([
|
|
3032
|
-
customElement('collection-browser')
|
|
2850
|
+
customElement('collection-browser'),
|
|
2851
|
+
localized()
|
|
3033
2852
|
], CollectionBrowser);
|
|
3034
2853
|
export { CollectionBrowser };
|
|
3035
2854
|
//# sourceMappingURL=collection-browser.js.map
|