@internetarchive/collection-browser 1.14.9-alpha.2 → 1.14.9
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/.editorconfig +29 -29
- package/.husky/pre-commit +4 -4
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +9 -9
- package/dist/index.js +9 -9
- package/dist/src/app-root.d.ts +72 -72
- package/dist/src/app-root.js +347 -347
- package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
- package/dist/src/assets/img/icons/arrow-left.js +2 -2
- package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
- package/dist/src/assets/img/icons/arrow-right.js +2 -2
- package/dist/src/assets/img/icons/chevron.d.ts +2 -2
- package/dist/src/assets/img/icons/chevron.js +2 -2
- package/dist/src/assets/img/icons/contract.d.ts +2 -2
- package/dist/src/assets/img/icons/contract.js +2 -2
- package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
- package/dist/src/assets/img/icons/empty-query.js +2 -2
- package/dist/src/assets/img/icons/expand.d.ts +2 -2
- package/dist/src/assets/img/icons/expand.js +2 -2
- package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
- package/dist/src/assets/img/icons/eye-closed.js +2 -2
- package/dist/src/assets/img/icons/eye.d.ts +2 -2
- package/dist/src/assets/img/icons/eye.js +2 -2
- package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
- package/dist/src/assets/img/icons/favorite-filled.js +2 -2
- package/dist/src/assets/img/icons/login-required.d.ts +1 -1
- package/dist/src/assets/img/icons/login-required.js +2 -2
- package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/account.js +2 -2
- package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
- package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/data.js +2 -2
- package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
- package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/film.js +2 -2
- package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/images.js +2 -2
- package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
- package/dist/src/assets/img/icons/mediatype/search.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/search.js +2 -2
- package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/software.js +2 -2
- package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
- package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
- package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/video.js +2 -2
- package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
- package/dist/src/assets/img/icons/mediatype/web.js +2 -2
- package/dist/src/assets/img/icons/null-result.d.ts +2 -2
- package/dist/src/assets/img/icons/null-result.js +2 -2
- package/dist/src/assets/img/icons/restricted.d.ts +1 -1
- package/dist/src/assets/img/icons/restricted.js +2 -2
- package/dist/src/assets/img/icons/reviews.d.ts +1 -1
- package/dist/src/assets/img/icons/reviews.js +2 -2
- package/dist/src/assets/img/icons/upload.d.ts +1 -1
- package/dist/src/assets/img/icons/upload.js +2 -2
- package/dist/src/assets/img/icons/views.d.ts +1 -1
- package/dist/src/assets/img/icons/views.js +2 -2
- package/dist/src/circular-activity-indicator.d.ts +5 -5
- package/dist/src/circular-activity-indicator.js +17 -17
- package/dist/src/collection-browser.d.ts +533 -533
- package/dist/src/collection-browser.js +1891 -1893
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
- package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
- package/dist/src/collection-facets/facets-template.d.ts +20 -20
- package/dist/src/collection-facets/facets-template.js +152 -152
- package/dist/src/collection-facets/more-facets-content.d.ts +77 -77
- package/dist/src/collection-facets/more-facets-content.js +359 -359
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
- package/dist/src/collection-facets/more-facets-pagination.js +196 -196
- package/dist/src/collection-facets/toggle-switch.d.ts +41 -41
- package/dist/src/collection-facets/toggle-switch.js +94 -94
- package/dist/src/collection-facets.d.ts +104 -104
- package/dist/src/collection-facets.js +506 -506
- package/dist/src/empty-placeholder.d.ts +23 -23
- package/dist/src/empty-placeholder.js +74 -74
- package/dist/src/expanded-date-picker.d.ts +43 -43
- package/dist/src/expanded-date-picker.js +109 -109
- package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
- package/dist/src/language-code-handler/language-code-handler.js +26 -26
- package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
- package/dist/src/language-code-handler/language-code-mapping.js +562 -562
- package/dist/src/manage/manage-bar.d.ts +26 -26
- package/dist/src/manage/manage-bar.js +53 -53
- package/dist/src/mediatype/mediatype-config.d.ts +3 -3
- package/dist/src/mediatype/mediatype-config.js +91 -91
- package/dist/src/models.d.ts +164 -164
- package/dist/src/models.js +269 -269
- package/dist/src/restoration-state-handler.d.ts +70 -70
- package/dist/src/restoration-state-handler.js +355 -355
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.d.ts +6 -6
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +24 -24
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +21 -21
- package/dist/src/sort-filter-bar/alpha-bar.js +128 -128
- package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/compact.js +2 -2
- package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/list.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-disabled.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-down.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-down.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-toggle-up.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-toggle-up.js +2 -2
- package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
- package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
- package/dist/src/sort-filter-bar/img/tile.js +2 -2
- package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +208 -208
- package/dist/src/sort-filter-bar/sort-filter-bar.js +637 -637
- package/dist/src/styles/item-image-styles.d.ts +8 -8
- package/dist/src/styles/item-image-styles.js +9 -9
- package/dist/src/styles/sr-only.d.ts +1 -1
- package/dist/src/styles/sr-only.js +2 -2
- package/dist/src/tiles/base-tile-component.d.ts +19 -19
- package/dist/src/tiles/base-tile-component.js +63 -63
- package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
- package/dist/src/tiles/collection-browser-loading-tile.js +15 -15
- package/dist/src/tiles/grid/account-tile.d.ts +18 -18
- package/dist/src/tiles/grid/account-tile.js +72 -72
- package/dist/src/tiles/grid/collection-tile.d.ts +15 -15
- package/dist/src/tiles/grid/collection-tile.js +80 -80
- package/dist/src/tiles/grid/item-tile.d.ts +27 -27
- package/dist/src/tiles/grid/item-tile.js +134 -134
- package/dist/src/tiles/grid/search-tile.d.ts +10 -10
- package/dist/src/tiles/grid/search-tile.js +51 -51
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +8 -8
- package/dist/src/tiles/grid/tile-stats.d.ts +11 -11
- package/dist/src/tiles/grid/tile-stats.js +48 -48
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +219 -219
- package/dist/src/tiles/hover/hover-pane-controller.js +352 -352
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +15 -15
- package/dist/src/tiles/hover/tile-hover-pane.js +38 -38
- package/dist/src/tiles/image-block.d.ts +17 -17
- package/dist/src/tiles/image-block.js +73 -73
- package/dist/src/tiles/item-image.d.ts +36 -36
- package/dist/src/tiles/item-image.js +127 -127
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +6 -6
- package/dist/src/tiles/list/tile-list-compact-header.js +38 -38
- package/dist/src/tiles/list/tile-list-compact.d.ts +15 -15
- package/dist/src/tiles/list/tile-list-compact.js +114 -114
- package/dist/src/tiles/list/tile-list.d.ts +46 -46
- package/dist/src/tiles/list/tile-list.js +302 -302
- package/dist/src/tiles/mediatype-icon.d.ts +9 -9
- package/dist/src/tiles/mediatype-icon.js +47 -47
- package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
- package/dist/src/tiles/overlay/icon-overlay.js +40 -40
- package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
- package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
- package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
- package/dist/src/tiles/overlay/text-overlay.js +42 -42
- package/dist/src/tiles/text-snippet-block.d.ts +27 -27
- package/dist/src/tiles/text-snippet-block.js +73 -73
- package/dist/src/tiles/tile-dispatcher.d.ts +64 -64
- package/dist/src/tiles/tile-dispatcher.js +231 -231
- package/dist/src/tiles/tile-display-value-provider.d.ts +43 -43
- package/dist/src/tiles/tile-display-value-provider.js +80 -80
- package/dist/src/utils/analytics-events.d.ts +25 -25
- package/dist/src/utils/analytics-events.js +27 -27
- package/dist/src/utils/array-equals.d.ts +4 -4
- package/dist/src/utils/array-equals.js +10 -10
- package/dist/src/utils/format-count.d.ts +7 -7
- package/dist/src/utils/format-count.js +76 -76
- package/dist/src/utils/format-date.d.ts +2 -2
- package/dist/src/utils/format-date.js +25 -25
- package/dist/src/utils/format-unit-size.d.ts +2 -2
- package/dist/src/utils/format-unit-size.js +33 -33
- package/dist/src/utils/local-date-from-utc.d.ts +9 -9
- package/dist/src/utils/local-date-from-utc.js +15 -15
- package/dist/src/utils/sha1.d.ts +2 -2
- package/dist/src/utils/sha1.js +8 -8
- package/dist/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +1098 -1098
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +134 -134
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +133 -133
- package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
- package/dist/test/collection-facets/toggle-switch.test.d.ts +1 -1
- package/dist/test/collection-facets/toggle-switch.test.js +73 -73
- package/dist/test/collection-facets.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +682 -682
- package/dist/test/empty-placeholder.test.d.ts +1 -1
- package/dist/test/empty-placeholder.test.js +63 -63
- package/dist/test/expanded-date-picker.test.d.ts +1 -1
- package/dist/test/expanded-date-picker.test.js +95 -95
- package/dist/test/icon-overlay.test.d.ts +1 -1
- package/dist/test/icon-overlay.test.js +24 -24
- package/dist/test/image-block.test.d.ts +1 -1
- package/dist/test/image-block.test.js +48 -48
- package/dist/test/item-image.test.d.ts +1 -1
- package/dist/test/item-image.test.js +86 -86
- package/dist/test/manage/manage-bar.test.d.ts +1 -1
- package/dist/test/manage/manage-bar.test.js +72 -72
- package/dist/test/mediatype-config.test.d.ts +1 -1
- package/dist/test/mediatype-config.test.js +16 -16
- package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
- package/dist/test/mocks/mock-analytics-handler.js +15 -15
- package/dist/test/mocks/mock-collection-name-cache.d.ts +9 -9
- package/dist/test/mocks/mock-collection-name-cache.js +17 -17
- package/dist/test/mocks/mock-search-responses.d.ts +21 -21
- package/dist/test/mocks/mock-search-responses.js +709 -709
- package/dist/test/mocks/mock-search-service.d.ts +15 -15
- package/dist/test/mocks/mock-search-service.js +50 -50
- package/dist/test/restoration-state-handler.test.d.ts +1 -1
- package/dist/test/restoration-state-handler.test.js +270 -270
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +12 -12
- package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -73
- package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/sort-filter-bar.test.js +378 -378
- package/dist/test/text-overlay.test.d.ts +1 -1
- package/dist/test/text-overlay.test.js +48 -48
- package/dist/test/text-snippet-block.test.d.ts +1 -1
- package/dist/test/text-snippet-block.test.js +57 -57
- package/dist/test/tile-stats.test.d.ts +1 -1
- package/dist/test/tile-stats.test.js +33 -33
- package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/account-tile.test.js +76 -76
- package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +73 -73
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +254 -254
- package/dist/test/tiles/grid/search-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/search-tile.test.js +51 -51
- package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +258 -258
- package/dist/test/tiles/hover/tile-hover-pane.test.d.ts +1 -1
- package/dist/test/tiles/hover/tile-hover-pane.test.js +13 -13
- package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +143 -143
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +242 -242
- package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +94 -94
- package/dist/test/tiles/tile-display-value-provider.test.d.ts +1 -1
- package/dist/test/tiles/tile-display-value-provider.test.js +141 -141
- package/dist/test/utils/array-equals.test.d.ts +1 -1
- package/dist/test/utils/array-equals.test.js +26 -26
- package/dist/test/utils/format-count.test.d.ts +1 -1
- package/dist/test/utils/format-count.test.js +23 -23
- package/dist/test/utils/format-date.test.d.ts +1 -1
- package/dist/test/utils/format-date.test.js +17 -17
- package/dist/test/utils/format-unit-size.test.d.ts +1 -1
- package/dist/test/utils/format-unit-size.test.js +17 -17
- package/dist/test/utils/local-date-from-utc.test.d.ts +1 -1
- package/dist/test/utils/local-date-from-utc.test.js +26 -26
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +1 -1
- package/renovate.json +6 -6
- package/src/collection-browser.ts +5 -4
- package/tsconfig.json +21 -21
- package/types/sentry.d.ts +1 -0
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
- package/dist/src/selected-facets.d.ts +0 -67
- package/dist/src/selected-facets.js +0 -149
- package/dist/src/selected-facets.js.map +0 -1
- package/src/selected-facets.ts +0 -216
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { css, html, nothing } from 'lit';
|
|
3
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
-
import { join } from 'lit/directives/join.js';
|
|
5
|
-
import { map } from 'lit/directives/map.js';
|
|
6
|
-
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
7
|
-
import { customElement, property, state } from 'lit/decorators.js';
|
|
8
|
-
import { msg } from '@lit/localize';
|
|
9
|
-
import DOMPurify from 'dompurify';
|
|
10
|
-
import { suppressedCollections } from '../../models';
|
|
11
|
-
import { BaseTileComponent } from '../base-tile-component';
|
|
12
|
-
import { formatCount } from '../../utils/format-count';
|
|
13
|
-
import { formatDate } from '../../utils/format-date';
|
|
14
|
-
import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
|
|
15
|
-
import '../image-block';
|
|
16
|
-
import '../mediatype-icon';
|
|
17
|
-
let TileList = class TileList extends BaseTileComponent {
|
|
18
|
-
constructor() {
|
|
19
|
-
/*
|
|
20
|
-
* Reactive properties inherited from BaseTileComponent:
|
|
21
|
-
* - model?: TileModel;
|
|
22
|
-
* - currentWidth?: number;
|
|
23
|
-
* - currentHeight?: number;
|
|
24
|
-
* - baseNavigationUrl?: string;
|
|
25
|
-
* - baseImageUrl?: string;
|
|
26
|
-
* - collectionPagePath?: string;
|
|
27
|
-
* - sortParam: SortParam | null = null;
|
|
28
|
-
* - creatorFilter?: string;
|
|
29
|
-
* - mobileBreakpoint?: number;
|
|
30
|
-
* - loggedIn = false;
|
|
31
|
-
*/
|
|
32
|
-
super(...arguments);
|
|
33
|
-
this.collectionLinks = [];
|
|
34
|
-
}
|
|
35
|
-
render() {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, nothing } from 'lit';
|
|
3
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
+
import { join } from 'lit/directives/join.js';
|
|
5
|
+
import { map } from 'lit/directives/map.js';
|
|
6
|
+
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
7
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
8
|
+
import { msg } from '@lit/localize';
|
|
9
|
+
import DOMPurify from 'dompurify';
|
|
10
|
+
import { suppressedCollections } from '../../models';
|
|
11
|
+
import { BaseTileComponent } from '../base-tile-component';
|
|
12
|
+
import { formatCount } from '../../utils/format-count';
|
|
13
|
+
import { formatDate } from '../../utils/format-date';
|
|
14
|
+
import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
|
|
15
|
+
import '../image-block';
|
|
16
|
+
import '../mediatype-icon';
|
|
17
|
+
let TileList = class TileList extends BaseTileComponent {
|
|
18
|
+
constructor() {
|
|
19
|
+
/*
|
|
20
|
+
* Reactive properties inherited from BaseTileComponent:
|
|
21
|
+
* - model?: TileModel;
|
|
22
|
+
* - currentWidth?: number;
|
|
23
|
+
* - currentHeight?: number;
|
|
24
|
+
* - baseNavigationUrl?: string;
|
|
25
|
+
* - baseImageUrl?: string;
|
|
26
|
+
* - collectionPagePath?: string;
|
|
27
|
+
* - sortParam: SortParam | null = null;
|
|
28
|
+
* - creatorFilter?: string;
|
|
29
|
+
* - mobileBreakpoint?: number;
|
|
30
|
+
* - loggedIn = false;
|
|
31
|
+
*/
|
|
32
|
+
super(...arguments);
|
|
33
|
+
this.collectionLinks = [];
|
|
34
|
+
}
|
|
35
|
+
render() {
|
|
36
36
|
return html `
|
|
37
37
|
<div id="list-line" class="${this.classSize}">
|
|
38
|
-
${this.classSize === 'mobile'
|
|
39
|
-
? this.mobileTemplate
|
|
38
|
+
${this.classSize === 'mobile'
|
|
39
|
+
? this.mobileTemplate
|
|
40
40
|
: this.desktopTemplate}
|
|
41
41
|
</div>
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Templates
|
|
46
|
-
*/
|
|
47
|
-
get mobileTemplate() {
|
|
42
|
+
`;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Templates
|
|
46
|
+
*/
|
|
47
|
+
get mobileTemplate() {
|
|
48
48
|
return html `
|
|
49
49
|
<div id="list-line-top">
|
|
50
50
|
<div id="list-line-left">${this.imageBlockTemplate}</div>
|
|
@@ -56,9 +56,9 @@ let TileList = class TileList extends BaseTileComponent {
|
|
|
56
56
|
</div>
|
|
57
57
|
</div>
|
|
58
58
|
<div id="list-line-bottom">${this.detailsTemplate}</div>
|
|
59
|
-
`;
|
|
60
|
-
}
|
|
61
|
-
get desktopTemplate() {
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
get desktopTemplate() {
|
|
62
62
|
return html `
|
|
63
63
|
<div id="list-line-left">${this.imageBlockTemplate}</div>
|
|
64
64
|
<div id="list-line-right">
|
|
@@ -68,13 +68,13 @@ let TileList = class TileList extends BaseTileComponent {
|
|
|
68
68
|
</div>
|
|
69
69
|
${this.detailsTemplate}
|
|
70
70
|
</div>
|
|
71
|
-
`;
|
|
72
|
-
}
|
|
73
|
-
get imageBlockTemplate() {
|
|
74
|
-
if (!this.model)
|
|
75
|
-
return nothing;
|
|
76
|
-
const isCollection = this.model.mediatype === 'collection';
|
|
77
|
-
const href = this.displayValueProvider.itemPageUrl(this.model.identifier, isCollection);
|
|
71
|
+
`;
|
|
72
|
+
}
|
|
73
|
+
get imageBlockTemplate() {
|
|
74
|
+
if (!this.model)
|
|
75
|
+
return nothing;
|
|
76
|
+
const isCollection = this.model.mediatype === 'collection';
|
|
77
|
+
const href = this.displayValueProvider.itemPageUrl(this.model.identifier, isCollection);
|
|
78
78
|
return html `<a href=${href}>
|
|
79
79
|
<image-block
|
|
80
80
|
.model=${this.model}
|
|
@@ -85,9 +85,9 @@ let TileList = class TileList extends BaseTileComponent {
|
|
|
85
85
|
.loggedIn=${this.loggedIn}
|
|
86
86
|
>
|
|
87
87
|
</image-block>
|
|
88
|
-
</a> `;
|
|
89
|
-
}
|
|
90
|
-
get detailsTemplate() {
|
|
88
|
+
</a> `;
|
|
89
|
+
}
|
|
90
|
+
get detailsTemplate() {
|
|
91
91
|
return html `
|
|
92
92
|
${this.itemLineTemplate} ${this.creatorTemplate}
|
|
93
93
|
<div id="dates-line">
|
|
@@ -98,11 +98,11 @@ let TileList = class TileList extends BaseTileComponent {
|
|
|
98
98
|
</div>
|
|
99
99
|
${this.topicsTemplate} ${this.collectionsTemplate}
|
|
100
100
|
${this.descriptionTemplate} ${this.textSnippetsTemplate}
|
|
101
|
-
`;
|
|
102
|
-
}
|
|
103
|
-
// Data templates
|
|
104
|
-
get iconRightTemplate() {
|
|
105
|
-
var _a, _b;
|
|
101
|
+
`;
|
|
102
|
+
}
|
|
103
|
+
// Data templates
|
|
104
|
+
get iconRightTemplate() {
|
|
105
|
+
var _a, _b;
|
|
106
106
|
return html `
|
|
107
107
|
<a id="icon-right" href=${this.mediatypeURL}>
|
|
108
108
|
<mediatype-icon
|
|
@@ -111,274 +111,274 @@ let TileList = class TileList extends BaseTileComponent {
|
|
|
111
111
|
>
|
|
112
112
|
</mediatype-icon>
|
|
113
113
|
</a>
|
|
114
|
-
`;
|
|
115
|
-
}
|
|
116
|
-
get titleTemplate() {
|
|
117
|
-
var _a, _b, _c;
|
|
118
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
119
|
-
return nothing;
|
|
120
|
-
}
|
|
121
|
-
// If the model has a server-specified href, use it
|
|
122
|
-
// Otherwise construct a details link using the identifier
|
|
123
|
-
return ((_b = this.model) === null || _b === void 0 ? void 0 : _b.href)
|
|
114
|
+
`;
|
|
115
|
+
}
|
|
116
|
+
get titleTemplate() {
|
|
117
|
+
var _a, _b, _c;
|
|
118
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
119
|
+
return nothing;
|
|
120
|
+
}
|
|
121
|
+
// If the model has a server-specified href, use it
|
|
122
|
+
// Otherwise construct a details link using the identifier
|
|
123
|
+
return ((_b = this.model) === null || _b === void 0 ? void 0 : _b.href)
|
|
124
124
|
? html `<a href="${this.baseNavigationUrl}${this.model.href}"
|
|
125
125
|
>${(_c = this.model.title) !== null && _c !== void 0 ? _c : this.model.identifier}</a
|
|
126
|
-
>`
|
|
127
|
-
: this.detailsLink(this.model.identifier, this.model.title, this.model.mediatype === 'collection');
|
|
128
|
-
}
|
|
129
|
-
get itemLineTemplate() {
|
|
130
|
-
const source = this.sourceTemplate;
|
|
131
|
-
const volume = this.volumeTemplate;
|
|
132
|
-
const issue = this.issueTemplate;
|
|
133
|
-
if (!source && !volume && !issue) {
|
|
134
|
-
return nothing;
|
|
135
|
-
}
|
|
136
|
-
return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
|
|
137
|
-
}
|
|
138
|
-
get sourceTemplate() {
|
|
139
|
-
var _a;
|
|
140
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
|
|
141
|
-
return nothing;
|
|
142
|
-
}
|
|
126
|
+
>`
|
|
127
|
+
: this.detailsLink(this.model.identifier, this.model.title, this.model.mediatype === 'collection');
|
|
128
|
+
}
|
|
129
|
+
get itemLineTemplate() {
|
|
130
|
+
const source = this.sourceTemplate;
|
|
131
|
+
const volume = this.volumeTemplate;
|
|
132
|
+
const issue = this.issueTemplate;
|
|
133
|
+
if (!source && !volume && !issue) {
|
|
134
|
+
return nothing;
|
|
135
|
+
}
|
|
136
|
+
return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
|
|
137
|
+
}
|
|
138
|
+
get sourceTemplate() {
|
|
139
|
+
var _a;
|
|
140
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
|
|
141
|
+
return nothing;
|
|
142
|
+
}
|
|
143
143
|
return html `
|
|
144
144
|
<div id="source" class="metadata">
|
|
145
145
|
${this.labelTemplate(msg('Source'))}
|
|
146
146
|
${this.searchLink('source', this.model.source)}
|
|
147
147
|
</div>
|
|
148
|
-
`;
|
|
149
|
-
}
|
|
150
|
-
get volumeTemplate() {
|
|
151
|
-
var _a;
|
|
152
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, msg('Volume'));
|
|
153
|
-
}
|
|
154
|
-
get issueTemplate() {
|
|
155
|
-
var _a;
|
|
156
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, msg('Issue'));
|
|
157
|
-
}
|
|
158
|
-
get creatorTemplate() {
|
|
159
|
-
var _a, _b, _c;
|
|
160
|
-
// "Archivist since" if account
|
|
161
|
-
if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
|
|
148
|
+
`;
|
|
149
|
+
}
|
|
150
|
+
get volumeTemplate() {
|
|
151
|
+
var _a;
|
|
152
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, msg('Volume'));
|
|
153
|
+
}
|
|
154
|
+
get issueTemplate() {
|
|
155
|
+
var _a;
|
|
156
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, msg('Issue'));
|
|
157
|
+
}
|
|
158
|
+
get creatorTemplate() {
|
|
159
|
+
var _a, _b, _c;
|
|
160
|
+
// "Archivist since" if account
|
|
161
|
+
if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
|
|
162
162
|
return html `
|
|
163
163
|
<div id="creator" class="metadata">
|
|
164
164
|
<span class="label"
|
|
165
165
|
>${(_b = this.displayValueProvider.accountLabel) !== null && _b !== void 0 ? _b : nothing}</span
|
|
166
166
|
>
|
|
167
167
|
</div>
|
|
168
|
-
`;
|
|
169
|
-
}
|
|
170
|
-
// "Creator" if not account tile
|
|
171
|
-
if (!((_c = this.model) === null || _c === void 0 ? void 0 : _c.creators) || this.model.creators.length === 0) {
|
|
172
|
-
return nothing;
|
|
173
|
-
}
|
|
168
|
+
`;
|
|
169
|
+
}
|
|
170
|
+
// "Creator" if not account tile
|
|
171
|
+
if (!((_c = this.model) === null || _c === void 0 ? void 0 : _c.creators) || this.model.creators.length === 0) {
|
|
172
|
+
return nothing;
|
|
173
|
+
}
|
|
174
174
|
return html `
|
|
175
175
|
<div id="creator" class="metadata">
|
|
176
176
|
${this.labelTemplate(msg('By'))}
|
|
177
177
|
${join(map(this.model.creators, id => this.searchLink('creator', id)), ', ')}
|
|
178
178
|
</div>
|
|
179
|
-
`;
|
|
180
|
-
}
|
|
181
|
-
get datePublishedTemplate() {
|
|
182
|
-
var _a;
|
|
183
|
-
// If we're showing a date published of Jan 1 at midnight, only show the year.
|
|
184
|
-
// This is because items with only a year for their publication date are normalized to
|
|
185
|
-
// Jan 1 at midnight timestamps in the search engine documents.
|
|
186
|
-
const date = (_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished;
|
|
187
|
-
let format = 'long';
|
|
188
|
-
if (isFirstMillisecondOfUTCYear(date)) {
|
|
189
|
-
format = 'year-only';
|
|
190
|
-
}
|
|
191
|
-
return this.metadataTemplate(formatDate(date, format), msg('Published'));
|
|
192
|
-
}
|
|
193
|
-
// Show date label/value when sorted by date type
|
|
194
|
-
// Except datePublished which is always shown
|
|
195
|
-
get dateSortByTemplate() {
|
|
196
|
-
if (this.sortParam &&
|
|
197
|
-
(this.sortParam.field === 'addeddate' ||
|
|
198
|
-
this.sortParam.field === 'reviewdate' ||
|
|
199
|
-
this.sortParam.field === 'publicdate')) {
|
|
200
|
-
return this.metadataTemplate(formatDate(this.date, 'long'), this.displayValueProvider.dateLabel);
|
|
201
|
-
}
|
|
202
|
-
return nothing;
|
|
203
|
-
}
|
|
204
|
-
get viewsTemplate() {
|
|
205
|
-
var _a, _b, _c, _d;
|
|
206
|
-
const viewCount = ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) === 'week'
|
|
207
|
-
? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
|
|
208
|
-
: (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
|
|
209
|
-
// when its a search-tile, we don't have any stats to show
|
|
210
|
-
if (((_d = this.model) === null || _d === void 0 ? void 0 : _d.mediatype) === 'search') {
|
|
211
|
-
return this.metadataTemplate('(Favorited search query)', '');
|
|
212
|
-
}
|
|
213
|
-
return this.metadataTemplate(`${formatCount(viewCount !== null && viewCount !== void 0 ? viewCount : 0, this.formatSize)}`, msg('Views'));
|
|
214
|
-
}
|
|
215
|
-
get ratingTemplate() {
|
|
216
|
-
var _a;
|
|
217
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, msg('Avg Rating'));
|
|
218
|
-
}
|
|
219
|
-
get reviewsTemplate() {
|
|
220
|
-
var _a;
|
|
221
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, msg('Reviews'));
|
|
222
|
-
}
|
|
223
|
-
get topicsTemplate() {
|
|
224
|
-
var _a;
|
|
225
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
|
|
226
|
-
return nothing;
|
|
227
|
-
}
|
|
179
|
+
`;
|
|
180
|
+
}
|
|
181
|
+
get datePublishedTemplate() {
|
|
182
|
+
var _a;
|
|
183
|
+
// If we're showing a date published of Jan 1 at midnight, only show the year.
|
|
184
|
+
// This is because items with only a year for their publication date are normalized to
|
|
185
|
+
// Jan 1 at midnight timestamps in the search engine documents.
|
|
186
|
+
const date = (_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished;
|
|
187
|
+
let format = 'long';
|
|
188
|
+
if (isFirstMillisecondOfUTCYear(date)) {
|
|
189
|
+
format = 'year-only';
|
|
190
|
+
}
|
|
191
|
+
return this.metadataTemplate(formatDate(date, format), msg('Published'));
|
|
192
|
+
}
|
|
193
|
+
// Show date label/value when sorted by date type
|
|
194
|
+
// Except datePublished which is always shown
|
|
195
|
+
get dateSortByTemplate() {
|
|
196
|
+
if (this.sortParam &&
|
|
197
|
+
(this.sortParam.field === 'addeddate' ||
|
|
198
|
+
this.sortParam.field === 'reviewdate' ||
|
|
199
|
+
this.sortParam.field === 'publicdate')) {
|
|
200
|
+
return this.metadataTemplate(formatDate(this.date, 'long'), this.displayValueProvider.dateLabel);
|
|
201
|
+
}
|
|
202
|
+
return nothing;
|
|
203
|
+
}
|
|
204
|
+
get viewsTemplate() {
|
|
205
|
+
var _a, _b, _c, _d;
|
|
206
|
+
const viewCount = ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) === 'week'
|
|
207
|
+
? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
|
|
208
|
+
: (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
|
|
209
|
+
// when its a search-tile, we don't have any stats to show
|
|
210
|
+
if (((_d = this.model) === null || _d === void 0 ? void 0 : _d.mediatype) === 'search') {
|
|
211
|
+
return this.metadataTemplate('(Favorited search query)', '');
|
|
212
|
+
}
|
|
213
|
+
return this.metadataTemplate(`${formatCount(viewCount !== null && viewCount !== void 0 ? viewCount : 0, this.formatSize)}`, msg('Views'));
|
|
214
|
+
}
|
|
215
|
+
get ratingTemplate() {
|
|
216
|
+
var _a;
|
|
217
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, msg('Avg Rating'));
|
|
218
|
+
}
|
|
219
|
+
get reviewsTemplate() {
|
|
220
|
+
var _a;
|
|
221
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, msg('Reviews'));
|
|
222
|
+
}
|
|
223
|
+
get topicsTemplate() {
|
|
224
|
+
var _a;
|
|
225
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
|
|
226
|
+
return nothing;
|
|
227
|
+
}
|
|
228
228
|
return html `
|
|
229
229
|
<div id="topics" class="metadata">
|
|
230
230
|
${this.labelTemplate(msg('Topics'))}
|
|
231
231
|
${join(map(this.model.subjects, id => this.searchLink('subject', id)), ', ')}
|
|
232
232
|
</div>
|
|
233
|
-
`;
|
|
234
|
-
}
|
|
235
|
-
get collectionsTemplate() {
|
|
236
|
-
if (!this.collectionLinks || this.collectionLinks.length === 0) {
|
|
237
|
-
return nothing;
|
|
238
|
-
}
|
|
233
|
+
`;
|
|
234
|
+
}
|
|
235
|
+
get collectionsTemplate() {
|
|
236
|
+
if (!this.collectionLinks || this.collectionLinks.length === 0) {
|
|
237
|
+
return nothing;
|
|
238
|
+
}
|
|
239
239
|
return html `
|
|
240
240
|
<div id="collections" class="metadata">
|
|
241
241
|
${this.labelTemplate(msg('Collections'))}
|
|
242
242
|
${join(this.collectionLinks, ', ')}
|
|
243
243
|
</div>
|
|
244
|
-
`;
|
|
245
|
-
}
|
|
246
|
-
get descriptionTemplate() {
|
|
247
|
-
var _a, _b, _c;
|
|
248
|
-
return this.metadataTemplate(
|
|
249
|
-
// Sanitize away any HTML tags and convert line breaks to spaces.
|
|
250
|
-
unsafeHTML(DOMPurify.sanitize((_c = (_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.description) === null || _b === void 0 ? void 0 : _b.replace(/\n/g, ' ')) !== null && _c !== void 0 ? _c : '')), '', 'description');
|
|
251
|
-
}
|
|
252
|
-
get textSnippetsTemplate() {
|
|
253
|
-
var _a;
|
|
254
|
-
if (!this.hasSnippets)
|
|
255
|
-
return nothing;
|
|
244
|
+
`;
|
|
245
|
+
}
|
|
246
|
+
get descriptionTemplate() {
|
|
247
|
+
var _a, _b, _c;
|
|
248
|
+
return this.metadataTemplate(
|
|
249
|
+
// Sanitize away any HTML tags and convert line breaks to spaces.
|
|
250
|
+
unsafeHTML(DOMPurify.sanitize((_c = (_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.description) === null || _b === void 0 ? void 0 : _b.replace(/\n/g, ' ')) !== null && _c !== void 0 ? _c : '')), '', 'description');
|
|
251
|
+
}
|
|
252
|
+
get textSnippetsTemplate() {
|
|
253
|
+
var _a;
|
|
254
|
+
if (!this.hasSnippets)
|
|
255
|
+
return nothing;
|
|
256
256
|
return html `<text-snippet-block
|
|
257
257
|
viewsize="list"
|
|
258
258
|
.snippets=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets}
|
|
259
|
-
></text-snippet-block>`;
|
|
260
|
-
}
|
|
261
|
-
get hasSnippets() {
|
|
262
|
-
var _a, _b;
|
|
263
|
-
return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
|
|
264
|
-
}
|
|
265
|
-
// Utility functions
|
|
266
|
-
// eslint-disable-next-line default-param-last
|
|
267
|
-
metadataTemplate(text, label = '', id) {
|
|
268
|
-
if (!text)
|
|
269
|
-
return nothing;
|
|
259
|
+
></text-snippet-block>`;
|
|
260
|
+
}
|
|
261
|
+
get hasSnippets() {
|
|
262
|
+
var _a, _b;
|
|
263
|
+
return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
|
|
264
|
+
}
|
|
265
|
+
// Utility functions
|
|
266
|
+
// eslint-disable-next-line default-param-last
|
|
267
|
+
metadataTemplate(text, label = '', id) {
|
|
268
|
+
if (!text)
|
|
269
|
+
return nothing;
|
|
270
270
|
return html `
|
|
271
271
|
<div id=${ifDefined(id)} class="metadata">
|
|
272
272
|
${this.labelTemplate(label)} ${text}
|
|
273
273
|
</div>
|
|
274
|
-
`;
|
|
275
|
-
}
|
|
276
|
-
labelTemplate(label) {
|
|
277
|
-
return html ` ${label
|
|
278
|
-
? html `<span class="label">${label}: </span>`
|
|
279
|
-
: nothing}`;
|
|
280
|
-
}
|
|
281
|
-
searchLink(field, searchTerm) {
|
|
282
|
-
if (!field || !searchTerm) {
|
|
283
|
-
return nothing;
|
|
284
|
-
}
|
|
285
|
-
const query = encodeURIComponent(`${field}:"${searchTerm}"`);
|
|
286
|
-
// No whitespace after closing tag
|
|
287
|
-
// Note: single ' for href='' to wrap " in query var gets changed back by yarn format
|
|
288
|
-
/* eslint-disable lit/no-invalid-html */
|
|
274
|
+
`;
|
|
275
|
+
}
|
|
276
|
+
labelTemplate(label) {
|
|
277
|
+
return html ` ${label
|
|
278
|
+
? html `<span class="label">${label}: </span>`
|
|
279
|
+
: nothing}`;
|
|
280
|
+
}
|
|
281
|
+
searchLink(field, searchTerm) {
|
|
282
|
+
if (!field || !searchTerm) {
|
|
283
|
+
return nothing;
|
|
284
|
+
}
|
|
285
|
+
const query = encodeURIComponent(`${field}:"${searchTerm}"`);
|
|
286
|
+
// No whitespace after closing tag
|
|
287
|
+
// Note: single ' for href='' to wrap " in query var gets changed back by yarn format
|
|
288
|
+
/* eslint-disable lit/no-invalid-html */
|
|
289
289
|
return html `<a
|
|
290
290
|
href="${this.baseNavigationUrl}/search?query=${query}"
|
|
291
291
|
rel="nofollow"
|
|
292
292
|
>
|
|
293
293
|
${DOMPurify.sanitize(searchTerm)}</a
|
|
294
|
-
>`;
|
|
295
|
-
/* eslint-enable lit/no-invalid-html */
|
|
296
|
-
}
|
|
297
|
-
detailsLink(identifier, text, isCollection = false) {
|
|
298
|
-
const linkText = text !== null && text !== void 0 ? text : identifier;
|
|
299
|
-
const linkHref = this.displayValueProvider.itemPageUrl(identifier, isCollection);
|
|
300
|
-
return html `<a href=${linkHref}> ${DOMPurify.sanitize(linkText)} </a>`;
|
|
301
|
-
}
|
|
302
|
-
/** The URL of this item's mediatype collection, if defined. */
|
|
303
|
-
get mediatypeURL() {
|
|
304
|
-
var _a;
|
|
305
|
-
// NB: baseNavigationUrl can be an empty string
|
|
306
|
-
if (this.baseNavigationUrl === undefined || !((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype))
|
|
307
|
-
return nothing;
|
|
308
|
-
// Need special handling for certain mediatypes that don't have a top-level collection page
|
|
309
|
-
switch (this.model.mediatype) {
|
|
310
|
-
case 'collection':
|
|
311
|
-
return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;
|
|
312
|
-
case 'account':
|
|
313
|
-
return nothing;
|
|
314
|
-
default:
|
|
315
|
-
return this.displayValueProvider.itemPageUrl(this.model.mediatype, true);
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
updated(changed) {
|
|
319
|
-
if (changed.has('model')) {
|
|
320
|
-
this.fetchCollectionNames();
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
async fetchCollectionNames() {
|
|
324
|
-
var _a, _b;
|
|
325
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
|
|
326
|
-
this.model.collections.length === 0 ||
|
|
327
|
-
!this.collectionNameCache) {
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
// Note: quirk of Lit: need to replace collectionLinks array,
|
|
331
|
-
// otherwise it will not re-render. Can't simply alter the array.
|
|
332
|
-
this.collectionLinks = [];
|
|
333
|
-
const newCollectionLinks = [];
|
|
334
|
-
const promises = [];
|
|
335
|
-
for (const collection of this.model.collections) {
|
|
336
|
-
// Don't include favorites or collections that are meant to be suppressed
|
|
337
|
-
if (!suppressedCollections[collection] &&
|
|
338
|
-
!collection.startsWith('fav-')) {
|
|
339
|
-
promises.push((_b = this.collectionNameCache) === null || _b === void 0 ? void 0 : _b.collectionNameFor(collection).then(name => {
|
|
340
|
-
newCollectionLinks.push(this.detailsLink(collection, name !== null && name !== void 0 ? name : collection, true));
|
|
341
|
-
}));
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
await Promise.all(promises);
|
|
345
|
-
this.collectionLinks = newCollectionLinks;
|
|
346
|
-
}
|
|
347
|
-
/*
|
|
348
|
-
* TODO: fix field names to match model in src/collection-browser.ts
|
|
349
|
-
* private get dateSortSelector()
|
|
350
|
-
* @see src/models.ts
|
|
351
|
-
*/
|
|
352
|
-
get date() {
|
|
353
|
-
var _a, _b, _c, _d, _e;
|
|
354
|
-
switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
|
|
355
|
-
case 'date':
|
|
356
|
-
return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
|
|
357
|
-
case 'reviewdate':
|
|
358
|
-
return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
|
|
359
|
-
case 'addeddate':
|
|
360
|
-
return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
|
|
361
|
-
default:
|
|
362
|
-
return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
get classSize() {
|
|
366
|
-
if (this.mobileBreakpoint &&
|
|
367
|
-
this.currentWidth &&
|
|
368
|
-
this.currentWidth < this.mobileBreakpoint) {
|
|
369
|
-
return 'mobile';
|
|
370
|
-
}
|
|
371
|
-
return 'desktop';
|
|
372
|
-
}
|
|
373
|
-
get formatSize() {
|
|
374
|
-
if (this.mobileBreakpoint &&
|
|
375
|
-
this.currentWidth &&
|
|
376
|
-
this.currentWidth < this.mobileBreakpoint) {
|
|
377
|
-
return 'short';
|
|
378
|
-
}
|
|
379
|
-
return 'long';
|
|
380
|
-
}
|
|
381
|
-
static get styles() {
|
|
294
|
+
>`;
|
|
295
|
+
/* eslint-enable lit/no-invalid-html */
|
|
296
|
+
}
|
|
297
|
+
detailsLink(identifier, text, isCollection = false) {
|
|
298
|
+
const linkText = text !== null && text !== void 0 ? text : identifier;
|
|
299
|
+
const linkHref = this.displayValueProvider.itemPageUrl(identifier, isCollection);
|
|
300
|
+
return html `<a href=${linkHref}> ${DOMPurify.sanitize(linkText)} </a>`;
|
|
301
|
+
}
|
|
302
|
+
/** The URL of this item's mediatype collection, if defined. */
|
|
303
|
+
get mediatypeURL() {
|
|
304
|
+
var _a;
|
|
305
|
+
// NB: baseNavigationUrl can be an empty string
|
|
306
|
+
if (this.baseNavigationUrl === undefined || !((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype))
|
|
307
|
+
return nothing;
|
|
308
|
+
// Need special handling for certain mediatypes that don't have a top-level collection page
|
|
309
|
+
switch (this.model.mediatype) {
|
|
310
|
+
case 'collection':
|
|
311
|
+
return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;
|
|
312
|
+
case 'account':
|
|
313
|
+
return nothing;
|
|
314
|
+
default:
|
|
315
|
+
return this.displayValueProvider.itemPageUrl(this.model.mediatype, true);
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
updated(changed) {
|
|
319
|
+
if (changed.has('model')) {
|
|
320
|
+
this.fetchCollectionNames();
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
async fetchCollectionNames() {
|
|
324
|
+
var _a, _b;
|
|
325
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
|
|
326
|
+
this.model.collections.length === 0 ||
|
|
327
|
+
!this.collectionNameCache) {
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
// Note: quirk of Lit: need to replace collectionLinks array,
|
|
331
|
+
// otherwise it will not re-render. Can't simply alter the array.
|
|
332
|
+
this.collectionLinks = [];
|
|
333
|
+
const newCollectionLinks = [];
|
|
334
|
+
const promises = [];
|
|
335
|
+
for (const collection of this.model.collections) {
|
|
336
|
+
// Don't include favorites or collections that are meant to be suppressed
|
|
337
|
+
if (!suppressedCollections[collection] &&
|
|
338
|
+
!collection.startsWith('fav-')) {
|
|
339
|
+
promises.push((_b = this.collectionNameCache) === null || _b === void 0 ? void 0 : _b.collectionNameFor(collection).then(name => {
|
|
340
|
+
newCollectionLinks.push(this.detailsLink(collection, name !== null && name !== void 0 ? name : collection, true));
|
|
341
|
+
}));
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
await Promise.all(promises);
|
|
345
|
+
this.collectionLinks = newCollectionLinks;
|
|
346
|
+
}
|
|
347
|
+
/*
|
|
348
|
+
* TODO: fix field names to match model in src/collection-browser.ts
|
|
349
|
+
* private get dateSortSelector()
|
|
350
|
+
* @see src/models.ts
|
|
351
|
+
*/
|
|
352
|
+
get date() {
|
|
353
|
+
var _a, _b, _c, _d, _e;
|
|
354
|
+
switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
|
|
355
|
+
case 'date':
|
|
356
|
+
return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
|
|
357
|
+
case 'reviewdate':
|
|
358
|
+
return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
|
|
359
|
+
case 'addeddate':
|
|
360
|
+
return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
|
|
361
|
+
default:
|
|
362
|
+
return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
get classSize() {
|
|
366
|
+
if (this.mobileBreakpoint &&
|
|
367
|
+
this.currentWidth &&
|
|
368
|
+
this.currentWidth < this.mobileBreakpoint) {
|
|
369
|
+
return 'mobile';
|
|
370
|
+
}
|
|
371
|
+
return 'desktop';
|
|
372
|
+
}
|
|
373
|
+
get formatSize() {
|
|
374
|
+
if (this.mobileBreakpoint &&
|
|
375
|
+
this.currentWidth &&
|
|
376
|
+
this.currentWidth < this.mobileBreakpoint) {
|
|
377
|
+
return 'short';
|
|
378
|
+
}
|
|
379
|
+
return 'long';
|
|
380
|
+
}
|
|
381
|
+
static get styles() {
|
|
382
382
|
return css `
|
|
383
383
|
html {
|
|
384
384
|
font-size: unset;
|
|
@@ -549,17 +549,17 @@ let TileList = class TileList extends BaseTileComponent {
|
|
|
549
549
|
#views-line {
|
|
550
550
|
flex-wrap: wrap;
|
|
551
551
|
}
|
|
552
|
-
`;
|
|
553
|
-
}
|
|
554
|
-
};
|
|
555
|
-
__decorate([
|
|
556
|
-
property({ type: Object })
|
|
557
|
-
], TileList.prototype, "collectionNameCache", void 0);
|
|
558
|
-
__decorate([
|
|
559
|
-
state()
|
|
560
|
-
], TileList.prototype, "collectionLinks", void 0);
|
|
561
|
-
TileList = __decorate([
|
|
562
|
-
customElement('tile-list')
|
|
563
|
-
], TileList);
|
|
564
|
-
export { TileList };
|
|
552
|
+
`;
|
|
553
|
+
}
|
|
554
|
+
};
|
|
555
|
+
__decorate([
|
|
556
|
+
property({ type: Object })
|
|
557
|
+
], TileList.prototype, "collectionNameCache", void 0);
|
|
558
|
+
__decorate([
|
|
559
|
+
state()
|
|
560
|
+
], TileList.prototype, "collectionLinks", void 0);
|
|
561
|
+
TileList = __decorate([
|
|
562
|
+
customElement('tile-list')
|
|
563
|
+
], TileList);
|
|
564
|
+
export { TileList };
|
|
565
565
|
//# sourceMappingURL=tile-list.js.map
|