@internetarchive/collection-browser 0.4.9-alpha.1 → 0.4.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/.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 +281 -281
- package/dist/src/collection-browser.js +1204 -1200
- 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 +77 -77
- package/dist/src/collection-facets/more-facets-content.js +357 -357
- package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
- package/dist/src/collection-facets/more-facets-pagination.js +192 -192
- package/dist/src/collection-facets.d.ts +83 -83
- package/dist/src/collection-facets.js +392 -392
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/empty-placeholder.d.ts +11 -11
- package/dist/src/empty-placeholder.js +42 -42
- 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 -114
- package/dist/src/models.js +125 -125
- package/dist/src/models.js.map +1 -1
- 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 -0
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +61 -0
- package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -0
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +20 -12
- package/dist/src/sort-filter-bar/alpha-bar.js +166 -58
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- 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 -17
- package/dist/src/tiles/grid/account-tile.js +68 -46
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.d.ts +17 -14
- package/dist/src/tiles/grid/collection-tile.js +75 -53
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +32 -29
- package/dist/src/tiles/grid/item-tile.js +126 -108
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- 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 +44 -8
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- 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 -197
- package/dist/src/tiles/hover/hover-pane-controller.js +352 -331
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- 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 +21 -21
- package/dist/src/tiles/list/tile-list-compact.js +99 -99
- package/dist/src/tiles/list/tile-list.d.ts +55 -55
- package/dist/src/tiles/list/tile-list.js +303 -297
- 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 -55
- package/dist/src/tiles/tile-dispatcher.js +203 -179
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- 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.test.d.ts +2 -2
- package/dist/test/collection-facets.test.js +508 -508
- 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 -0
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js +13 -0
- package/dist/test/sort-filter-bar/alpha-bar-tooltip.test.js.map +1 -0
- package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +73 -43
- package/dist/test/sort-filter-bar/alpha-bar.test.js.map +1 -1
- 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 +81 -60
- package/dist/test/tiles/grid/account-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/collection-tile.test.js +81 -57
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +163 -142
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- 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 +92 -92
- package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
- package/dist/test/tiles/list/tile-list.test.js +163 -163
- package/dist/test/tiles/tile-dispatcher.test.d.ts +1 -0
- package/dist/test/tiles/tile-dispatcher.test.js +101 -0
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -0
- 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 +1 -1
- package/renovate.json +6 -6
- package/src/collection-browser.ts +4 -0
- package/src/collection-facets.ts +3 -5
- package/src/models.ts +1 -0
- package/src/sort-filter-bar/alpha-bar-tooltip.ts +54 -0
- package/src/sort-filter-bar/alpha-bar.ts +133 -9
- package/src/tiles/grid/account-tile.ts +23 -1
- package/src/tiles/grid/collection-tile.ts +31 -2
- package/src/tiles/grid/item-tile.ts +22 -2
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +37 -1
- package/src/tiles/hover/hover-pane-controller.ts +38 -1
- package/src/tiles/list/tile-list.ts +8 -1
- package/src/tiles/tile-dispatcher.ts +29 -2
- package/test/sort-filter-bar/alpha-bar-tooltip.test.ts +17 -0
- package/test/sort-filter-bar/alpha-bar.test.ts +46 -1
- package/test/tiles/grid/account-tile.test.ts +27 -0
- package/test/tiles/grid/collection-tile.test.ts +30 -0
- package/test/tiles/grid/item-tile.test.ts +27 -0
- package/test/tiles/tile-dispatcher.test.ts +122 -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,258 +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;
|
|
106
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
107
|
-
return nothing;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
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
|
+
? html `<a href="${this.baseNavigationUrl}${this.model.href}"
|
|
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
|
+
}
|
|
125
131
|
return html `
|
|
126
132
|
<div id="source" class="metadata">
|
|
127
133
|
${this.labelTemplate('Source')}
|
|
128
134
|
${this.searchLink('source', this.model.source)}
|
|
129
135
|
</div>
|
|
130
|
-
`;
|
|
131
|
-
}
|
|
132
|
-
get volumeTemplate() {
|
|
133
|
-
var _a;
|
|
134
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, 'Volume');
|
|
135
|
-
}
|
|
136
|
-
get issueTemplate() {
|
|
137
|
-
var _a;
|
|
138
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, 'Issue');
|
|
139
|
-
}
|
|
140
|
-
get creatorTemplate() {
|
|
141
|
-
var _a, _b, _c;
|
|
142
|
-
// "Archivist since" if account
|
|
143
|
-
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') {
|
|
144
150
|
return html `
|
|
145
151
|
<div id="creator" class="metadata">
|
|
146
152
|
<span class="label"> ${accountLabel((_b = this.model) === null || _b === void 0 ? void 0 : _b.dateAdded)} </span>
|
|
147
153
|
</div>
|
|
148
|
-
`;
|
|
149
|
-
}
|
|
150
|
-
// "Creator" if not account tile
|
|
151
|
-
if (!((_c = this.model) === null || _c === void 0 ? void 0 : _c.creators) || this.model.creators.length === 0) {
|
|
152
|
-
return nothing;
|
|
153
|
-
}
|
|
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
160
|
return html `
|
|
155
161
|
<div id="creator" class="metadata">
|
|
156
162
|
${this.labelTemplate('By')}
|
|
157
163
|
${join(map(this.model.creators, id => this.searchLink('creator', id)), html `, `)}
|
|
158
164
|
</div>
|
|
159
|
-
`;
|
|
160
|
-
}
|
|
161
|
-
get datePublishedTemplate() {
|
|
162
|
-
var _a;
|
|
163
|
-
return this.metadataTemplate(formatDate((_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished, 'long'), 'Published');
|
|
164
|
-
}
|
|
165
|
-
// Show date label/value when sorted by date type
|
|
166
|
-
// Except datePublished which is always shown
|
|
167
|
-
get dateSortByTemplate() {
|
|
168
|
-
if (this.sortParam &&
|
|
169
|
-
(this.sortParam.field === 'addeddate' ||
|
|
170
|
-
this.sortParam.field === 'reviewdate' ||
|
|
171
|
-
this.sortParam.field === 'publicdate')) {
|
|
172
|
-
return this.metadataTemplate(formatDate(this.date, 'long'), dateLabel(this.sortParam.field));
|
|
173
|
-
}
|
|
174
|
-
return nothing;
|
|
175
|
-
}
|
|
176
|
-
get viewsTemplate() {
|
|
177
|
-
var _a, _b, _c;
|
|
178
|
-
const viewCount = ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) === 'week'
|
|
179
|
-
? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
|
|
180
|
-
: (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
|
|
181
|
-
return this.metadataTemplate(`${formatCount(viewCount !== null && viewCount !== void 0 ? viewCount : 0, this.formatSize)}`, 'Views');
|
|
182
|
-
}
|
|
183
|
-
get ratingTemplate() {
|
|
184
|
-
var _a;
|
|
185
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, 'Avg Rating');
|
|
186
|
-
}
|
|
187
|
-
get reviewsTemplate() {
|
|
188
|
-
var _a;
|
|
189
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, 'Reviews');
|
|
190
|
-
}
|
|
191
|
-
get topicsTemplate() {
|
|
192
|
-
var _a;
|
|
193
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
|
|
194
|
-
return nothing;
|
|
195
|
-
}
|
|
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
|
+
}
|
|
196
202
|
return html `
|
|
197
203
|
<div id="topics" class="metadata">
|
|
198
204
|
${this.labelTemplate('Topics')}
|
|
199
205
|
${join(map(this.model.subjects, id => this.searchLink('subject', id)), html `, `)}
|
|
200
206
|
</div>
|
|
201
|
-
`;
|
|
202
|
-
}
|
|
203
|
-
get collectionsTemplate() {
|
|
204
|
-
if (!this.collectionLinks || this.collectionLinks.length === 0) {
|
|
205
|
-
return nothing;
|
|
206
|
-
}
|
|
207
|
+
`;
|
|
208
|
+
}
|
|
209
|
+
get collectionsTemplate() {
|
|
210
|
+
if (!this.collectionLinks || this.collectionLinks.length === 0) {
|
|
211
|
+
return nothing;
|
|
212
|
+
}
|
|
207
213
|
return html `
|
|
208
214
|
<div id="collections" class="metadata">
|
|
209
215
|
${this.labelTemplate('Collections')}
|
|
210
216
|
${join(this.collectionLinks, html `, `)}
|
|
211
217
|
</div>
|
|
212
|
-
`;
|
|
213
|
-
}
|
|
214
|
-
get descriptionTemplate() {
|
|
215
|
-
var _a, _b, _c;
|
|
216
|
-
return this.metadataTemplate(
|
|
217
|
-
// Sanitize away any HTML tags and convert line breaks to spaces.
|
|
218
|
-
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');
|
|
219
|
-
}
|
|
220
|
-
get textSnippetsTemplate() {
|
|
221
|
-
var _a;
|
|
222
|
-
if (!this.hasSnippets)
|
|
223
|
-
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;
|
|
224
230
|
return html `<text-snippet-block
|
|
225
231
|
viewsize="list"
|
|
226
232
|
.snippets=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets}
|
|
227
|
-
></text-snippet-block>`;
|
|
228
|
-
}
|
|
229
|
-
get hasSnippets() {
|
|
230
|
-
var _a, _b;
|
|
231
|
-
return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
|
|
232
|
-
}
|
|
233
|
-
// Utility functions
|
|
234
|
-
// eslint-disable-next-line default-param-last
|
|
235
|
-
metadataTemplate(text, label = '', id) {
|
|
236
|
-
if (!text)
|
|
237
|
-
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;
|
|
238
244
|
return html `
|
|
239
245
|
<div id=${ifDefined(id)} class="metadata">
|
|
240
246
|
${this.labelTemplate(label)} ${text}
|
|
241
247
|
</div>
|
|
242
|
-
`;
|
|
243
|
-
}
|
|
244
|
-
labelTemplate(label) {
|
|
245
|
-
return html ` ${label
|
|
246
|
-
? html `<span class="label">${label}: </span>`
|
|
247
|
-
: nothing}`;
|
|
248
|
-
}
|
|
249
|
-
searchLink(field, searchTerm) {
|
|
250
|
-
if (!field || !searchTerm) {
|
|
251
|
-
return nothing;
|
|
252
|
-
}
|
|
253
|
-
const query = encodeURIComponent(`${field}:"${searchTerm}"`);
|
|
254
|
-
// No whitespace after closing tag
|
|
255
|
-
// Note: single ' for href='' to wrap " in query var gets changed back by yarn format
|
|
256
|
-
/* 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 */
|
|
257
263
|
return html `<a
|
|
258
264
|
href="${this.baseNavigationUrl}/search?query=${query}"
|
|
259
265
|
rel="nofollow"
|
|
260
266
|
>
|
|
261
267
|
${DOMPurify.sanitize(searchTerm)}</a
|
|
262
|
-
>`;
|
|
263
|
-
/* eslint-enable lit/no-invalid-html */
|
|
264
|
-
}
|
|
265
|
-
detailsLink(identifier, text) {
|
|
266
|
-
const linkText = text !== null && text !== void 0 ? text : identifier;
|
|
267
|
-
// No whitespace after closing tag
|
|
268
|
-
// 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
|
|
269
275
|
return html `<a
|
|
270
276
|
href="${this.baseNavigationUrl}/details/${encodeURI(identifier)}"
|
|
271
277
|
>${DOMPurify.sanitize(linkText)}</a
|
|
272
|
-
>`;
|
|
273
|
-
}
|
|
274
|
-
/** The URL of this item's mediatype collection, if defined. */
|
|
275
|
-
get mediatypeURL() {
|
|
276
|
-
var _a;
|
|
277
|
-
// NB: baseNavigationUrl can be an empty string
|
|
278
|
-
if (this.baseNavigationUrl === undefined || !((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype))
|
|
279
|
-
return nothing;
|
|
280
|
-
// Need special handling for certain mediatypes that don't have a top-level collection page
|
|
281
|
-
switch (this.model.mediatype) {
|
|
282
|
-
case 'collection':
|
|
283
|
-
return `${this.baseNavigationUrl}/search?query=mediatype:collection&sort=-downloads`;
|
|
284
|
-
case 'account':
|
|
285
|
-
return nothing;
|
|
286
|
-
default:
|
|
287
|
-
return `${this.baseNavigationUrl}/details/${encodeURI(this.model.mediatype)}`;
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
updated(changed) {
|
|
291
|
-
if (changed.has('model')) {
|
|
292
|
-
this.fetchCollectionNames();
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
async fetchCollectionNames() {
|
|
296
|
-
var _a, _b;
|
|
297
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
|
|
298
|
-
this.model.collections.length === 0 ||
|
|
299
|
-
!this.collectionNameCache) {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
// Note: quirk of Lit: need to replace collectionLinks array,
|
|
303
|
-
// otherwise it will not re-render. Can't simply alter the array.
|
|
304
|
-
this.collectionLinks = [];
|
|
305
|
-
const newCollectionLinks = [];
|
|
306
|
-
const promises = [];
|
|
307
|
-
for (const collection of this.model.collections) {
|
|
308
|
-
// Don't include favorites or collections that are meant to be suppressed
|
|
309
|
-
if (!suppressedCollections[collection] &&
|
|
310
|
-
!collection.startsWith('fav-')) {
|
|
311
|
-
promises.push((_b = this.collectionNameCache) === null || _b === void 0 ? void 0 : _b.collectionNameFor(collection).then(name => {
|
|
312
|
-
newCollectionLinks.push(this.detailsLink(collection, name !== null && name !== void 0 ? name : collection));
|
|
313
|
-
}));
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
await Promise.all(promises);
|
|
317
|
-
this.collectionLinks = newCollectionLinks;
|
|
318
|
-
}
|
|
319
|
-
/*
|
|
320
|
-
* TODO: fix field names to match model in src/collection-browser.ts
|
|
321
|
-
* private get dateSortSelector()
|
|
322
|
-
* @see src/models.ts
|
|
323
|
-
*/
|
|
324
|
-
get date() {
|
|
325
|
-
var _a, _b, _c, _d, _e;
|
|
326
|
-
switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
|
|
327
|
-
case 'date':
|
|
328
|
-
return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
|
|
329
|
-
case 'reviewdate':
|
|
330
|
-
return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
|
|
331
|
-
case 'addeddate':
|
|
332
|
-
return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
|
|
333
|
-
default:
|
|
334
|
-
return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
get classSize() {
|
|
338
|
-
if (this.mobileBreakpoint &&
|
|
339
|
-
this.currentWidth &&
|
|
340
|
-
this.currentWidth < this.mobileBreakpoint) {
|
|
341
|
-
return 'mobile';
|
|
342
|
-
}
|
|
343
|
-
return 'desktop';
|
|
344
|
-
}
|
|
345
|
-
get formatSize() {
|
|
346
|
-
if (this.mobileBreakpoint &&
|
|
347
|
-
this.currentWidth &&
|
|
348
|
-
this.currentWidth < this.mobileBreakpoint) {
|
|
349
|
-
return 'short';
|
|
350
|
-
}
|
|
351
|
-
return 'long';
|
|
352
|
-
}
|
|
353
|
-
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() {
|
|
354
360
|
return css `
|
|
355
361
|
html {
|
|
356
362
|
font-size: unset;
|
|
@@ -508,41 +514,41 @@ let TileList = class TileList extends LitElement {
|
|
|
508
514
|
#views-line {
|
|
509
515
|
flex-wrap: wrap;
|
|
510
516
|
}
|
|
511
|
-
`;
|
|
512
|
-
}
|
|
513
|
-
};
|
|
514
|
-
__decorate([
|
|
515
|
-
property({ type: Object })
|
|
516
|
-
], TileList.prototype, "model", void 0);
|
|
517
|
-
__decorate([
|
|
518
|
-
property({ type: String })
|
|
519
|
-
], TileList.prototype, "baseNavigationUrl", void 0);
|
|
520
|
-
__decorate([
|
|
521
|
-
property({ type: Object })
|
|
522
|
-
], TileList.prototype, "collectionNameCache", void 0);
|
|
523
|
-
__decorate([
|
|
524
|
-
property({ type: Number })
|
|
525
|
-
], TileList.prototype, "currentWidth", void 0);
|
|
526
|
-
__decorate([
|
|
527
|
-
property({ type: Number })
|
|
528
|
-
], TileList.prototype, "currentHeight", void 0);
|
|
529
|
-
__decorate([
|
|
530
|
-
property({ type: Object })
|
|
531
|
-
], TileList.prototype, "sortParam", void 0);
|
|
532
|
-
__decorate([
|
|
533
|
-
property({ type: Number })
|
|
534
|
-
], TileList.prototype, "mobileBreakpoint", void 0);
|
|
535
|
-
__decorate([
|
|
536
|
-
state()
|
|
537
|
-
], TileList.prototype, "collectionLinks", void 0);
|
|
538
|
-
__decorate([
|
|
539
|
-
property({ type: String })
|
|
540
|
-
], TileList.prototype, "baseImageUrl", void 0);
|
|
541
|
-
__decorate([
|
|
542
|
-
property({ type: Boolean })
|
|
543
|
-
], TileList.prototype, "loggedIn", void 0);
|
|
544
|
-
TileList = __decorate([
|
|
545
|
-
customElement('tile-list')
|
|
546
|
-
], TileList);
|
|
547
|
-
export { TileList };
|
|
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 };
|
|
548
554
|
//# sourceMappingURL=tile-list.js.map
|