@internetarchive/collection-browser 0.4.11 → 0.4.12
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/.github/workflows/ci.yml +26 -26
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- 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 +50 -50
- package/dist/src/app-root.js +278 -278
- 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/empty-query.d.ts +2 -2
- package/dist/src/assets/img/icons/empty-query.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/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 +280 -279
- package/dist/src/collection-browser.js +1175 -1156
- 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 +16 -16
- package/dist/src/collection-facets/facets-template.js +125 -125
- package/dist/src/collection-facets/more-facets-content.d.ts +76 -75
- package/dist/src/collection-facets/more-facets-content.js +354 -377
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
- package/dist/src/collection-facets/more-facets-pagination.js +197 -195
- package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
- package/dist/src/collection-facets/toggle-switch.d.ts +41 -0
- package/dist/src/collection-facets/toggle-switch.js +184 -0
- package/dist/src/collection-facets/toggle-switch.js.map +1 -0
- package/dist/src/collection-facets.d.ts +81 -81
- package/dist/src/collection-facets.js +375 -375
- package/dist/src/empty-placeholder.d.ts +13 -11
- package/dist/src/empty-placeholder.js +80 -44
- package/dist/src/empty-placeholder.js.map +1 -1
- 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/mediatype/mediatype-config.d.ts +3 -3
- package/dist/src/mediatype/mediatype-config.js +85 -85
- package/dist/src/models.d.ts +115 -115
- package/dist/src/models.js +125 -125
- package/dist/src/restoration-state-handler.d.ts +45 -45
- package/dist/src/restoration-state-handler.js +230 -230
- 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 +20 -20
- 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-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 +108 -108
- package/dist/src/sort-filter-bar/sort-filter-bar.js +438 -438
- package/dist/src/styles/item-image-styles.d.ts +8 -8
- package/dist/src/styles/item-image-styles.js +9 -9
- 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 +20 -20
- package/dist/src/tiles/grid/account-tile.js +64 -64
- package/dist/src/tiles/grid/collection-tile.d.ts +17 -17
- package/dist/src/tiles/grid/collection-tile.js +71 -71
- package/dist/src/tiles/grid/item-tile.d.ts +32 -32
- package/dist/src/tiles/grid/item-tile.js +122 -122
- 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 +7 -7
- package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
- package/dist/src/tiles/grid/tile-stats.js +40 -40
- 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 +72 -72
- package/dist/src/tiles/item-image.d.ts +35 -35
- package/dist/src/tiles/item-image.js +117 -117
- package/dist/src/tiles/list/account-label.d.ts +1 -1
- package/dist/src/tiles/list/account-label.js +6 -6
- package/dist/src/tiles/list/date-label.d.ts +1 -1
- package/dist/src/tiles/list/date-label.js +12 -12
- package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
- package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
- package/dist/src/tiles/list/tile-list-compact.d.ts +22 -21
- package/dist/src/tiles/list/tile-list-compact.js +114 -101
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +55 -55
- package/dist/src/tiles/list/tile-list.js +304 -301
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- 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 +58 -58
- package/dist/src/tiles/tile-dispatcher.js +194 -194
- package/dist/src/utils/analytics-events.d.ts +22 -22
- package/dist/src/utils/analytics-events.js +24 -24
- 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 +23 -23
- package/dist/src/utils/format-unit-size.d.ts +2 -2
- package/dist/src/utils/format-unit-size.js +33 -33
- package/dist/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +584 -584
- package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
- package/dist/test/collection-facets/facets-template.test.js +62 -62
- package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
- package/dist/test/collection-facets/more-facets-content.test.js +114 -114
- 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 -0
- package/dist/test/collection-facets/toggle-switch.test.js +87 -0
- package/dist/test/collection-facets/toggle-switch.test.js.map +1 -0
- package/dist/test/collection-facets.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +460 -460
- package/dist/test/empty-placeholder.test.d.ts +1 -1
- package/dist/test/empty-placeholder.test.js +33 -33
- 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 +84 -84
- 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 +7 -7
- package/dist/test/mocks/mock-collection-name-cache.js +13 -13
- package/dist/test/mocks/mock-search-responses.d.ts +12 -12
- package/dist/test/mocks/mock-search-responses.js +341 -341
- package/dist/test/mocks/mock-search-service.d.ts +13 -13
- package/dist/test/mocks/mock-search-service.js +40 -40
- package/dist/test/restoration-state-handler.test.d.ts +1 -1
- package/dist/test/restoration-state-handler.test.js +125 -125
- 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 +197 -197
- 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 +158 -158
- package/dist/test/tiles/hover/hover-pane-controller.test.d.ts +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +257 -257
- 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 +104 -92
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +175 -163
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +67 -67
- 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/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +3 -3
- package/renovate.json +6 -6
- package/src/collection-browser.ts +25 -1
- package/src/collection-facets/more-facets-content.ts +25 -48
- package/src/collection-facets/more-facets-pagination.ts +5 -3
- package/src/collection-facets/toggle-switch.ts +184 -0
- package/src/empty-placeholder.ts +53 -7
- package/src/tiles/list/tile-list-compact.ts +15 -2
- package/src/tiles/list/tile-list.ts +3 -0
- package/test/collection-facets/toggle-switch.test.ts +154 -0
- package/test/tiles/list/tile-list-compact.test.ts +14 -0
- package/test/tiles/list/tile-list.test.ts +14 -0
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { css, html, LitElement, 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 DOMPurify from 'dompurify';
|
|
9
|
-
import { suppressedCollections } from '../../models';
|
|
10
|
-
import { dateLabel } from './date-label';
|
|
11
|
-
import { accountLabel } from './account-label';
|
|
12
|
-
import { formatCount } from '../../utils/format-count';
|
|
13
|
-
import { formatDate } from '../../utils/format-date';
|
|
14
|
-
import '../image-block';
|
|
15
|
-
import '../mediatype-icon';
|
|
16
|
-
let TileList = class TileList extends LitElement {
|
|
17
|
-
constructor() {
|
|
18
|
-
super(...arguments);
|
|
19
|
-
this.sortParam = null;
|
|
20
|
-
this.collectionLinks = [];
|
|
21
|
-
this.loggedIn = false;
|
|
22
|
-
}
|
|
23
|
-
render() {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement, 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 DOMPurify from 'dompurify';
|
|
9
|
+
import { suppressedCollections } from '../../models';
|
|
10
|
+
import { dateLabel } from './date-label';
|
|
11
|
+
import { accountLabel } from './account-label';
|
|
12
|
+
import { formatCount } from '../../utils/format-count';
|
|
13
|
+
import { formatDate } from '../../utils/format-date';
|
|
14
|
+
import '../image-block';
|
|
15
|
+
import '../mediatype-icon';
|
|
16
|
+
let TileList = class TileList extends LitElement {
|
|
17
|
+
constructor() {
|
|
18
|
+
super(...arguments);
|
|
19
|
+
this.sortParam = null;
|
|
20
|
+
this.collectionLinks = [];
|
|
21
|
+
this.loggedIn = false;
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
24
|
return html `
|
|
25
25
|
<div id="list-line" class="${this.classSize}">
|
|
26
|
-
${this.classSize === 'mobile'
|
|
27
|
-
? this.mobileTemplate
|
|
26
|
+
${this.classSize === 'mobile'
|
|
27
|
+
? this.mobileTemplate
|
|
28
28
|
: this.desktopTemplate}
|
|
29
29
|
</div>
|
|
30
|
-
`;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Templates
|
|
34
|
-
*/
|
|
35
|
-
get mobileTemplate() {
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Templates
|
|
34
|
+
*/
|
|
35
|
+
get mobileTemplate() {
|
|
36
36
|
return html `
|
|
37
37
|
<div id="list-line-top">
|
|
38
38
|
<div id="list-line-left">${this.imageBlockTemplate}</div>
|
|
@@ -44,9 +44,9 @@ let TileList = class TileList extends LitElement {
|
|
|
44
44
|
</div>
|
|
45
45
|
</div>
|
|
46
46
|
<div id="list-line-bottom">${this.detailsTemplate}</div>
|
|
47
|
-
`;
|
|
48
|
-
}
|
|
49
|
-
get desktopTemplate() {
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
get desktopTemplate() {
|
|
50
50
|
return html `
|
|
51
51
|
<div id="list-line-left">${this.imageBlockTemplate}</div>
|
|
52
52
|
<div id="list-line-right">
|
|
@@ -56,11 +56,11 @@ let TileList = class TileList extends LitElement {
|
|
|
56
56
|
</div>
|
|
57
57
|
${this.detailsTemplate}
|
|
58
58
|
</div>
|
|
59
|
-
`;
|
|
60
|
-
}
|
|
61
|
-
get imageBlockTemplate() {
|
|
62
|
-
if (!this.model)
|
|
63
|
-
return nothing;
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
get imageBlockTemplate() {
|
|
62
|
+
if (!this.model)
|
|
63
|
+
return nothing;
|
|
64
64
|
return html `<a
|
|
65
65
|
href="${this.baseNavigationUrl}/details/${encodeURI(this.model.identifier)}"
|
|
66
66
|
>
|
|
@@ -73,9 +73,9 @@ let TileList = class TileList extends LitElement {
|
|
|
73
73
|
.loggedIn=${this.loggedIn}
|
|
74
74
|
>
|
|
75
75
|
</image-block>
|
|
76
|
-
</a> `;
|
|
77
|
-
}
|
|
78
|
-
get detailsTemplate() {
|
|
76
|
+
</a> `;
|
|
77
|
+
}
|
|
78
|
+
get detailsTemplate() {
|
|
79
79
|
return html `
|
|
80
80
|
${this.itemLineTemplate} ${this.creatorTemplate}
|
|
81
81
|
<div id="dates-line">
|
|
@@ -86,11 +86,11 @@ let TileList = class TileList extends LitElement {
|
|
|
86
86
|
</div>
|
|
87
87
|
${this.topicsTemplate} ${this.collectionsTemplate}
|
|
88
88
|
${this.descriptionTemplate} ${this.textSnippetsTemplate}
|
|
89
|
-
`;
|
|
90
|
-
}
|
|
91
|
-
// Data templates
|
|
92
|
-
get iconRightTemplate() {
|
|
93
|
-
var _a, _b;
|
|
89
|
+
`;
|
|
90
|
+
}
|
|
91
|
+
// Data templates
|
|
92
|
+
get iconRightTemplate() {
|
|
93
|
+
var _a, _b;
|
|
94
94
|
return html `
|
|
95
95
|
<a id="icon-right" href=${this.mediatypeURL} target="_blank">
|
|
96
96
|
<mediatype-icon
|
|
@@ -99,264 +99,264 @@ let TileList = class TileList extends LitElement {
|
|
|
99
99
|
>
|
|
100
100
|
</mediatype-icon>
|
|
101
101
|
</a>
|
|
102
|
-
`;
|
|
103
|
-
}
|
|
104
|
-
get titleTemplate() {
|
|
105
|
-
var _a, _b, _c;
|
|
106
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
107
|
-
return nothing;
|
|
108
|
-
}
|
|
109
|
-
// If the model has a server-specified href, use it
|
|
110
|
-
// Otherwise construct a details link using the identifier
|
|
111
|
-
return ((_b = this.model) === null || _b === void 0 ? void 0 : _b.href)
|
|
102
|
+
`;
|
|
103
|
+
}
|
|
104
|
+
get titleTemplate() {
|
|
105
|
+
var _a, _b, _c;
|
|
106
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
107
|
+
return nothing;
|
|
108
|
+
}
|
|
109
|
+
// If the model has a server-specified href, use it
|
|
110
|
+
// Otherwise construct a details link using the identifier
|
|
111
|
+
return ((_b = this.model) === null || _b === void 0 ? void 0 : _b.href)
|
|
112
112
|
? html `<a href="${this.baseNavigationUrl}${this.model.href}"
|
|
113
113
|
>${(_c = this.model.title) !== null && _c !== void 0 ? _c : this.model.identifier}</a
|
|
114
|
-
>`
|
|
115
|
-
: this.detailsLink(this.model.identifier, this.model.title);
|
|
116
|
-
}
|
|
117
|
-
get itemLineTemplate() {
|
|
118
|
-
const source = this.sourceTemplate;
|
|
119
|
-
const volume = this.volumeTemplate;
|
|
120
|
-
const issue = this.issueTemplate;
|
|
121
|
-
if (!source && !volume && !issue) {
|
|
122
|
-
return nothing;
|
|
123
|
-
}
|
|
124
|
-
return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
|
|
125
|
-
}
|
|
126
|
-
get sourceTemplate() {
|
|
127
|
-
var _a;
|
|
128
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
|
|
129
|
-
return nothing;
|
|
130
|
-
}
|
|
114
|
+
>`
|
|
115
|
+
: this.detailsLink(this.model.identifier, this.model.title);
|
|
116
|
+
}
|
|
117
|
+
get itemLineTemplate() {
|
|
118
|
+
const source = this.sourceTemplate;
|
|
119
|
+
const volume = this.volumeTemplate;
|
|
120
|
+
const issue = this.issueTemplate;
|
|
121
|
+
if (!source && !volume && !issue) {
|
|
122
|
+
return nothing;
|
|
123
|
+
}
|
|
124
|
+
return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
|
|
125
|
+
}
|
|
126
|
+
get sourceTemplate() {
|
|
127
|
+
var _a;
|
|
128
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
|
|
129
|
+
return nothing;
|
|
130
|
+
}
|
|
131
131
|
return html `
|
|
132
132
|
<div id="source" class="metadata">
|
|
133
133
|
${this.labelTemplate('Source')}
|
|
134
134
|
${this.searchLink('source', this.model.source)}
|
|
135
135
|
</div>
|
|
136
|
-
`;
|
|
137
|
-
}
|
|
138
|
-
get volumeTemplate() {
|
|
139
|
-
var _a;
|
|
140
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, 'Volume');
|
|
141
|
-
}
|
|
142
|
-
get issueTemplate() {
|
|
143
|
-
var _a;
|
|
144
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, 'Issue');
|
|
145
|
-
}
|
|
146
|
-
get creatorTemplate() {
|
|
147
|
-
var _a, _b, _c;
|
|
148
|
-
// "Archivist since" if account
|
|
149
|
-
if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
|
|
136
|
+
`;
|
|
137
|
+
}
|
|
138
|
+
get volumeTemplate() {
|
|
139
|
+
var _a;
|
|
140
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, 'Volume');
|
|
141
|
+
}
|
|
142
|
+
get issueTemplate() {
|
|
143
|
+
var _a;
|
|
144
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, 'Issue');
|
|
145
|
+
}
|
|
146
|
+
get creatorTemplate() {
|
|
147
|
+
var _a, _b, _c;
|
|
148
|
+
// "Archivist since" if account
|
|
149
|
+
if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
|
|
150
150
|
return html `
|
|
151
151
|
<div id="creator" class="metadata">
|
|
152
152
|
<span class="label"> ${accountLabel((_b = this.model) === null || _b === void 0 ? void 0 : _b.dateAdded)} </span>
|
|
153
153
|
</div>
|
|
154
|
-
`;
|
|
155
|
-
}
|
|
156
|
-
// "Creator" if not account tile
|
|
157
|
-
if (!((_c = this.model) === null || _c === void 0 ? void 0 : _c.creators) || this.model.creators.length === 0) {
|
|
158
|
-
return nothing;
|
|
159
|
-
}
|
|
154
|
+
`;
|
|
155
|
+
}
|
|
156
|
+
// "Creator" if not account tile
|
|
157
|
+
if (!((_c = this.model) === null || _c === void 0 ? void 0 : _c.creators) || this.model.creators.length === 0) {
|
|
158
|
+
return nothing;
|
|
159
|
+
}
|
|
160
160
|
return html `
|
|
161
161
|
<div id="creator" class="metadata">
|
|
162
162
|
${this.labelTemplate('By')}
|
|
163
163
|
${join(map(this.model.creators, id => this.searchLink('creator', id)), html `, `)}
|
|
164
164
|
</div>
|
|
165
|
-
`;
|
|
166
|
-
}
|
|
167
|
-
get datePublishedTemplate() {
|
|
168
|
-
var _a;
|
|
169
|
-
return this.metadataTemplate(formatDate((_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished, 'long'), 'Published');
|
|
170
|
-
}
|
|
171
|
-
// Show date label/value when sorted by date type
|
|
172
|
-
// Except datePublished which is always shown
|
|
173
|
-
get dateSortByTemplate() {
|
|
174
|
-
if (this.sortParam &&
|
|
175
|
-
(this.sortParam.field === 'addeddate' ||
|
|
176
|
-
this.sortParam.field === 'reviewdate' ||
|
|
177
|
-
this.sortParam.field === 'publicdate')) {
|
|
178
|
-
return this.metadataTemplate(formatDate(this.date, 'long'), dateLabel(this.sortParam.field));
|
|
179
|
-
}
|
|
180
|
-
return nothing;
|
|
181
|
-
}
|
|
182
|
-
get viewsTemplate() {
|
|
183
|
-
var _a, _b, _c;
|
|
184
|
-
const viewCount = ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) === 'week'
|
|
185
|
-
? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
|
|
186
|
-
: (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
|
|
187
|
-
return this.metadataTemplate(`${formatCount(viewCount !== null && viewCount !== void 0 ? viewCount : 0, this.formatSize)}`, 'Views');
|
|
188
|
-
}
|
|
189
|
-
get ratingTemplate() {
|
|
190
|
-
var _a;
|
|
191
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, 'Avg Rating');
|
|
192
|
-
}
|
|
193
|
-
get reviewsTemplate() {
|
|
194
|
-
var _a;
|
|
195
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, 'Reviews');
|
|
196
|
-
}
|
|
197
|
-
get topicsTemplate() {
|
|
198
|
-
var _a;
|
|
199
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
|
|
200
|
-
return nothing;
|
|
201
|
-
}
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
get datePublishedTemplate() {
|
|
168
|
+
var _a;
|
|
169
|
+
return this.metadataTemplate(formatDate((_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished, 'long'), 'Published');
|
|
170
|
+
}
|
|
171
|
+
// Show date label/value when sorted by date type
|
|
172
|
+
// Except datePublished which is always shown
|
|
173
|
+
get dateSortByTemplate() {
|
|
174
|
+
if (this.sortParam &&
|
|
175
|
+
(this.sortParam.field === 'addeddate' ||
|
|
176
|
+
this.sortParam.field === 'reviewdate' ||
|
|
177
|
+
this.sortParam.field === 'publicdate')) {
|
|
178
|
+
return this.metadataTemplate(formatDate(this.date, 'long'), dateLabel(this.sortParam.field));
|
|
179
|
+
}
|
|
180
|
+
return nothing;
|
|
181
|
+
}
|
|
182
|
+
get viewsTemplate() {
|
|
183
|
+
var _a, _b, _c;
|
|
184
|
+
const viewCount = ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) === 'week'
|
|
185
|
+
? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
|
|
186
|
+
: (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
|
|
187
|
+
return this.metadataTemplate(`${formatCount(viewCount !== null && viewCount !== void 0 ? viewCount : 0, this.formatSize)}`, 'Views');
|
|
188
|
+
}
|
|
189
|
+
get ratingTemplate() {
|
|
190
|
+
var _a;
|
|
191
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, 'Avg Rating');
|
|
192
|
+
}
|
|
193
|
+
get reviewsTemplate() {
|
|
194
|
+
var _a;
|
|
195
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, 'Reviews');
|
|
196
|
+
}
|
|
197
|
+
get topicsTemplate() {
|
|
198
|
+
var _a;
|
|
199
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
|
|
200
|
+
return nothing;
|
|
201
|
+
}
|
|
202
202
|
return html `
|
|
203
203
|
<div id="topics" class="metadata">
|
|
204
204
|
${this.labelTemplate('Topics')}
|
|
205
205
|
${join(map(this.model.subjects, id => this.searchLink('subject', id)), html `, `)}
|
|
206
206
|
</div>
|
|
207
|
-
`;
|
|
208
|
-
}
|
|
209
|
-
get collectionsTemplate() {
|
|
210
|
-
if (!this.collectionLinks || this.collectionLinks.length === 0) {
|
|
211
|
-
return nothing;
|
|
212
|
-
}
|
|
207
|
+
`;
|
|
208
|
+
}
|
|
209
|
+
get collectionsTemplate() {
|
|
210
|
+
if (!this.collectionLinks || this.collectionLinks.length === 0) {
|
|
211
|
+
return nothing;
|
|
212
|
+
}
|
|
213
213
|
return html `
|
|
214
214
|
<div id="collections" class="metadata">
|
|
215
215
|
${this.labelTemplate('Collections')}
|
|
216
216
|
${join(this.collectionLinks, html `, `)}
|
|
217
217
|
</div>
|
|
218
|
-
`;
|
|
219
|
-
}
|
|
220
|
-
get descriptionTemplate() {
|
|
221
|
-
var _a, _b, _c;
|
|
222
|
-
return this.metadataTemplate(
|
|
223
|
-
// Sanitize away any HTML tags and convert line breaks to spaces.
|
|
224
|
-
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');
|
|
225
|
-
}
|
|
226
|
-
get textSnippetsTemplate() {
|
|
227
|
-
var _a;
|
|
228
|
-
if (!this.hasSnippets)
|
|
229
|
-
return nothing;
|
|
218
|
+
`;
|
|
219
|
+
}
|
|
220
|
+
get descriptionTemplate() {
|
|
221
|
+
var _a, _b, _c;
|
|
222
|
+
return this.metadataTemplate(
|
|
223
|
+
// Sanitize away any HTML tags and convert line breaks to spaces.
|
|
224
|
+
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');
|
|
225
|
+
}
|
|
226
|
+
get textSnippetsTemplate() {
|
|
227
|
+
var _a;
|
|
228
|
+
if (!this.hasSnippets)
|
|
229
|
+
return nothing;
|
|
230
230
|
return html `<text-snippet-block
|
|
231
231
|
viewsize="list"
|
|
232
232
|
.snippets=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets}
|
|
233
|
-
></text-snippet-block>`;
|
|
234
|
-
}
|
|
235
|
-
get hasSnippets() {
|
|
236
|
-
var _a, _b;
|
|
237
|
-
return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
|
|
238
|
-
}
|
|
239
|
-
// Utility functions
|
|
240
|
-
// eslint-disable-next-line default-param-last
|
|
241
|
-
metadataTemplate(text, label = '', id) {
|
|
242
|
-
if (!text)
|
|
243
|
-
return nothing;
|
|
233
|
+
></text-snippet-block>`;
|
|
234
|
+
}
|
|
235
|
+
get hasSnippets() {
|
|
236
|
+
var _a, _b;
|
|
237
|
+
return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
|
|
238
|
+
}
|
|
239
|
+
// Utility functions
|
|
240
|
+
// eslint-disable-next-line default-param-last
|
|
241
|
+
metadataTemplate(text, label = '', id) {
|
|
242
|
+
if (!text)
|
|
243
|
+
return nothing;
|
|
244
244
|
return html `
|
|
245
245
|
<div id=${ifDefined(id)} class="metadata">
|
|
246
246
|
${this.labelTemplate(label)} ${text}
|
|
247
247
|
</div>
|
|
248
|
-
`;
|
|
249
|
-
}
|
|
250
|
-
labelTemplate(label) {
|
|
251
|
-
return html ` ${label
|
|
252
|
-
? html `<span class="label">${label}: </span>`
|
|
253
|
-
: nothing}`;
|
|
254
|
-
}
|
|
255
|
-
searchLink(field, searchTerm) {
|
|
256
|
-
if (!field || !searchTerm) {
|
|
257
|
-
return nothing;
|
|
258
|
-
}
|
|
259
|
-
const query = encodeURIComponent(`${field}:"${searchTerm}"`);
|
|
260
|
-
// No whitespace after closing tag
|
|
261
|
-
// Note: single ' for href='' to wrap " in query var gets changed back by yarn format
|
|
262
|
-
/* eslint-disable lit/no-invalid-html */
|
|
248
|
+
`;
|
|
249
|
+
}
|
|
250
|
+
labelTemplate(label) {
|
|
251
|
+
return html ` ${label
|
|
252
|
+
? html `<span class="label">${label}: </span>`
|
|
253
|
+
: nothing}`;
|
|
254
|
+
}
|
|
255
|
+
searchLink(field, searchTerm) {
|
|
256
|
+
if (!field || !searchTerm) {
|
|
257
|
+
return nothing;
|
|
258
|
+
}
|
|
259
|
+
const query = encodeURIComponent(`${field}:"${searchTerm}"`);
|
|
260
|
+
// No whitespace after closing tag
|
|
261
|
+
// Note: single ' for href='' to wrap " in query var gets changed back by yarn format
|
|
262
|
+
/* eslint-disable lit/no-invalid-html */
|
|
263
263
|
return html `<a
|
|
264
264
|
href="${this.baseNavigationUrl}/search?query=${query}"
|
|
265
265
|
rel="nofollow"
|
|
266
266
|
>
|
|
267
267
|
${DOMPurify.sanitize(searchTerm)}</a
|
|
268
|
-
>`;
|
|
269
|
-
/* eslint-enable lit/no-invalid-html */
|
|
270
|
-
}
|
|
271
|
-
detailsLink(identifier, text) {
|
|
272
|
-
const linkText = text !== null && text !== void 0 ? text : identifier;
|
|
273
|
-
// No whitespace after closing tag
|
|
274
|
-
// identifiers (all ASCII in their creation) should be safe to use in href, but sanitize anyway
|
|
268
|
+
>`;
|
|
269
|
+
/* eslint-enable lit/no-invalid-html */
|
|
270
|
+
}
|
|
271
|
+
detailsLink(identifier, text) {
|
|
272
|
+
const linkText = text !== null && text !== void 0 ? text : identifier;
|
|
273
|
+
// No whitespace after closing tag
|
|
274
|
+
// identifiers (all ASCII in their creation) should be safe to use in href, but sanitize anyway
|
|
275
275
|
return html `<a
|
|
276
276
|
href="${this.baseNavigationUrl}/details/${encodeURI(identifier)}"
|
|
277
277
|
>${DOMPurify.sanitize(linkText)}</a
|
|
278
|
-
>`;
|
|
279
|
-
}
|
|
280
|
-
/** The URL of this item's mediatype collection, if defined. */
|
|
281
|
-
get mediatypeURL() {
|
|
282
|
-
var _a;
|
|
283
|
-
// NB: baseNavigationUrl can be an empty string
|
|
284
|
-
if (this.baseNavigationUrl === undefined || !((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype))
|
|
285
|
-
return nothing;
|
|
286
|
-
// Need special handling for certain mediatypes that don't have a top-level collection page
|
|
287
|
-
switch (this.model.mediatype) {
|
|
288
|
-
case 'collection':
|
|
289
|
-
return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;
|
|
290
|
-
case 'account':
|
|
291
|
-
return nothing;
|
|
292
|
-
default:
|
|
293
|
-
return `${this.baseNavigationUrl}/details/${encodeURI(this.model.mediatype)}`;
|
|
294
|
-
}
|
|
295
|
-
}
|
|
296
|
-
updated(changed) {
|
|
297
|
-
if (changed.has('model')) {
|
|
298
|
-
this.fetchCollectionNames();
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
async fetchCollectionNames() {
|
|
302
|
-
var _a, _b;
|
|
303
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
|
|
304
|
-
this.model.collections.length === 0 ||
|
|
305
|
-
!this.collectionNameCache) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
// Note: quirk of Lit: need to replace collectionLinks array,
|
|
309
|
-
// otherwise it will not re-render. Can't simply alter the array.
|
|
310
|
-
this.collectionLinks = [];
|
|
311
|
-
const newCollectionLinks = [];
|
|
312
|
-
const promises = [];
|
|
313
|
-
for (const collection of this.model.collections) {
|
|
314
|
-
// Don't include favorites or collections that are meant to be suppressed
|
|
315
|
-
if (!suppressedCollections[collection] &&
|
|
316
|
-
!collection.startsWith('fav-')) {
|
|
317
|
-
promises.push((_b = this.collectionNameCache) === null || _b === void 0 ? void 0 : _b.collectionNameFor(collection).then(name => {
|
|
318
|
-
newCollectionLinks.push(this.detailsLink(collection, name !== null && name !== void 0 ? name : collection));
|
|
319
|
-
}));
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
await Promise.all(promises);
|
|
323
|
-
this.collectionLinks = newCollectionLinks;
|
|
324
|
-
}
|
|
325
|
-
/*
|
|
326
|
-
* TODO: fix field names to match model in src/collection-browser.ts
|
|
327
|
-
* private get dateSortSelector()
|
|
328
|
-
* @see src/models.ts
|
|
329
|
-
*/
|
|
330
|
-
get date() {
|
|
331
|
-
var _a, _b, _c, _d, _e;
|
|
332
|
-
switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
|
|
333
|
-
case 'date':
|
|
334
|
-
return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
|
|
335
|
-
case 'reviewdate':
|
|
336
|
-
return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
|
|
337
|
-
case 'addeddate':
|
|
338
|
-
return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
|
|
339
|
-
default:
|
|
340
|
-
return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
|
|
341
|
-
}
|
|
342
|
-
}
|
|
343
|
-
get classSize() {
|
|
344
|
-
if (this.mobileBreakpoint &&
|
|
345
|
-
this.currentWidth &&
|
|
346
|
-
this.currentWidth < this.mobileBreakpoint) {
|
|
347
|
-
return 'mobile';
|
|
348
|
-
}
|
|
349
|
-
return 'desktop';
|
|
350
|
-
}
|
|
351
|
-
get formatSize() {
|
|
352
|
-
if (this.mobileBreakpoint &&
|
|
353
|
-
this.currentWidth &&
|
|
354
|
-
this.currentWidth < this.mobileBreakpoint) {
|
|
355
|
-
return 'short';
|
|
356
|
-
}
|
|
357
|
-
return 'long';
|
|
358
|
-
}
|
|
359
|
-
static get styles() {
|
|
278
|
+
>`;
|
|
279
|
+
}
|
|
280
|
+
/** The URL of this item's mediatype collection, if defined. */
|
|
281
|
+
get mediatypeURL() {
|
|
282
|
+
var _a;
|
|
283
|
+
// NB: baseNavigationUrl can be an empty string
|
|
284
|
+
if (this.baseNavigationUrl === undefined || !((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype))
|
|
285
|
+
return nothing;
|
|
286
|
+
// Need special handling for certain mediatypes that don't have a top-level collection page
|
|
287
|
+
switch (this.model.mediatype) {
|
|
288
|
+
case 'collection':
|
|
289
|
+
return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;
|
|
290
|
+
case 'account':
|
|
291
|
+
return nothing;
|
|
292
|
+
default:
|
|
293
|
+
return `${this.baseNavigationUrl}/details/${encodeURI(this.model.mediatype)}`;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
updated(changed) {
|
|
297
|
+
if (changed.has('model')) {
|
|
298
|
+
this.fetchCollectionNames();
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
async fetchCollectionNames() {
|
|
302
|
+
var _a, _b;
|
|
303
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
|
|
304
|
+
this.model.collections.length === 0 ||
|
|
305
|
+
!this.collectionNameCache) {
|
|
306
|
+
return;
|
|
307
|
+
}
|
|
308
|
+
// Note: quirk of Lit: need to replace collectionLinks array,
|
|
309
|
+
// otherwise it will not re-render. Can't simply alter the array.
|
|
310
|
+
this.collectionLinks = [];
|
|
311
|
+
const newCollectionLinks = [];
|
|
312
|
+
const promises = [];
|
|
313
|
+
for (const collection of this.model.collections) {
|
|
314
|
+
// Don't include favorites or collections that are meant to be suppressed
|
|
315
|
+
if (!suppressedCollections[collection] &&
|
|
316
|
+
!collection.startsWith('fav-')) {
|
|
317
|
+
promises.push((_b = this.collectionNameCache) === null || _b === void 0 ? void 0 : _b.collectionNameFor(collection).then(name => {
|
|
318
|
+
newCollectionLinks.push(this.detailsLink(collection, name !== null && name !== void 0 ? name : collection));
|
|
319
|
+
}));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
await Promise.all(promises);
|
|
323
|
+
this.collectionLinks = newCollectionLinks;
|
|
324
|
+
}
|
|
325
|
+
/*
|
|
326
|
+
* TODO: fix field names to match model in src/collection-browser.ts
|
|
327
|
+
* private get dateSortSelector()
|
|
328
|
+
* @see src/models.ts
|
|
329
|
+
*/
|
|
330
|
+
get date() {
|
|
331
|
+
var _a, _b, _c, _d, _e;
|
|
332
|
+
switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
|
|
333
|
+
case 'date':
|
|
334
|
+
return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
|
|
335
|
+
case 'reviewdate':
|
|
336
|
+
return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
|
|
337
|
+
case 'addeddate':
|
|
338
|
+
return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
|
|
339
|
+
default:
|
|
340
|
+
return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
get classSize() {
|
|
344
|
+
if (this.mobileBreakpoint &&
|
|
345
|
+
this.currentWidth &&
|
|
346
|
+
this.currentWidth < this.mobileBreakpoint) {
|
|
347
|
+
return 'mobile';
|
|
348
|
+
}
|
|
349
|
+
return 'desktop';
|
|
350
|
+
}
|
|
351
|
+
get formatSize() {
|
|
352
|
+
if (this.mobileBreakpoint &&
|
|
353
|
+
this.currentWidth &&
|
|
354
|
+
this.currentWidth < this.mobileBreakpoint) {
|
|
355
|
+
return 'short';
|
|
356
|
+
}
|
|
357
|
+
return 'long';
|
|
358
|
+
}
|
|
359
|
+
static get styles() {
|
|
360
360
|
return css `
|
|
361
361
|
html {
|
|
362
362
|
font-size: unset;
|
|
@@ -368,6 +368,9 @@ let TileList = class TileList extends LitElement {
|
|
|
368
368
|
|
|
369
369
|
div a {
|
|
370
370
|
text-decoration: none;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
div a:link {
|
|
371
374
|
color: var(--ia-theme-link-color, #4b64ff);
|
|
372
375
|
}
|
|
373
376
|
|
|
@@ -514,41 +517,41 @@ let TileList = class TileList extends LitElement {
|
|
|
514
517
|
#views-line {
|
|
515
518
|
flex-wrap: wrap;
|
|
516
519
|
}
|
|
517
|
-
`;
|
|
518
|
-
}
|
|
519
|
-
};
|
|
520
|
-
__decorate([
|
|
521
|
-
property({ type: Object })
|
|
522
|
-
], TileList.prototype, "model", void 0);
|
|
523
|
-
__decorate([
|
|
524
|
-
property({ type: String })
|
|
525
|
-
], TileList.prototype, "baseNavigationUrl", void 0);
|
|
526
|
-
__decorate([
|
|
527
|
-
property({ type: Object })
|
|
528
|
-
], TileList.prototype, "collectionNameCache", void 0);
|
|
529
|
-
__decorate([
|
|
530
|
-
property({ type: Number })
|
|
531
|
-
], TileList.prototype, "currentWidth", void 0);
|
|
532
|
-
__decorate([
|
|
533
|
-
property({ type: Number })
|
|
534
|
-
], TileList.prototype, "currentHeight", void 0);
|
|
535
|
-
__decorate([
|
|
536
|
-
property({ type: Object })
|
|
537
|
-
], TileList.prototype, "sortParam", void 0);
|
|
538
|
-
__decorate([
|
|
539
|
-
property({ type: Number })
|
|
540
|
-
], TileList.prototype, "mobileBreakpoint", void 0);
|
|
541
|
-
__decorate([
|
|
542
|
-
state()
|
|
543
|
-
], TileList.prototype, "collectionLinks", void 0);
|
|
544
|
-
__decorate([
|
|
545
|
-
property({ type: String })
|
|
546
|
-
], TileList.prototype, "baseImageUrl", void 0);
|
|
547
|
-
__decorate([
|
|
548
|
-
property({ type: Boolean })
|
|
549
|
-
], TileList.prototype, "loggedIn", void 0);
|
|
550
|
-
TileList = __decorate([
|
|
551
|
-
customElement('tile-list')
|
|
552
|
-
], TileList);
|
|
553
|
-
export { TileList };
|
|
520
|
+
`;
|
|
521
|
+
}
|
|
522
|
+
};
|
|
523
|
+
__decorate([
|
|
524
|
+
property({ type: Object })
|
|
525
|
+
], TileList.prototype, "model", void 0);
|
|
526
|
+
__decorate([
|
|
527
|
+
property({ type: String })
|
|
528
|
+
], TileList.prototype, "baseNavigationUrl", void 0);
|
|
529
|
+
__decorate([
|
|
530
|
+
property({ type: Object })
|
|
531
|
+
], TileList.prototype, "collectionNameCache", void 0);
|
|
532
|
+
__decorate([
|
|
533
|
+
property({ type: Number })
|
|
534
|
+
], TileList.prototype, "currentWidth", void 0);
|
|
535
|
+
__decorate([
|
|
536
|
+
property({ type: Number })
|
|
537
|
+
], TileList.prototype, "currentHeight", void 0);
|
|
538
|
+
__decorate([
|
|
539
|
+
property({ type: Object })
|
|
540
|
+
], TileList.prototype, "sortParam", void 0);
|
|
541
|
+
__decorate([
|
|
542
|
+
property({ type: Number })
|
|
543
|
+
], TileList.prototype, "mobileBreakpoint", void 0);
|
|
544
|
+
__decorate([
|
|
545
|
+
state()
|
|
546
|
+
], TileList.prototype, "collectionLinks", void 0);
|
|
547
|
+
__decorate([
|
|
548
|
+
property({ type: String })
|
|
549
|
+
], TileList.prototype, "baseImageUrl", void 0);
|
|
550
|
+
__decorate([
|
|
551
|
+
property({ type: Boolean })
|
|
552
|
+
], TileList.prototype, "loggedIn", void 0);
|
|
553
|
+
TileList = __decorate([
|
|
554
|
+
customElement('tile-list')
|
|
555
|
+
], TileList);
|
|
556
|
+
export { TileList };
|
|
554
557
|
//# sourceMappingURL=tile-list.js.map
|