@internetarchive/collection-browser 0.3.8 → 0.3.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 +48 -48
- package/dist/src/app-root.js +258 -258
- 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 +278 -278
- package/dist/src/collection-browser.js +1105 -1105
- 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 -76
- package/dist/src/collection-facets/more-facets-content.js +353 -353
- 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 +77 -77
- package/dist/src/collection-facets.js +388 -388
- 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 +103 -103
- package/dist/src/models.js +117 -117
- package/dist/src/restoration-state-handler.d.ts +46 -46
- package/dist/src/restoration-state-handler.js +230 -230
- package/dist/src/sort-filter-bar/alpha-bar.d.ts +9 -9
- package/dist/src/sort-filter-bar/alpha-bar.js +41 -41
- 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 +107 -107
- package/dist/src/sort-filter-bar/sort-filter-bar.js +423 -423
- 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 +8 -8
- package/dist/src/tiles/grid/account-tile.js +20 -20
- package/dist/src/tiles/grid/collection-tile.d.ts +7 -7
- package/dist/src/tiles/grid/collection-tile.js +23 -23
- package/dist/src/tiles/grid/item-tile.d.ts +24 -24
- package/dist/src/tiles/grid/item-tile.js +87 -87
- 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/image-block.d.ts +17 -17
- package/dist/src/tiles/image-block.js +69 -69
- package/dist/src/tiles/item-image.d.ts +31 -31
- package/dist/src/tiles/item-image.js +103 -103
- 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 +93 -93
- package/dist/src/tiles/list/tile-list.d.ts +50 -50
- package/dist/src/tiles/list/tile-list.js +280 -275
- 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 +7 -7
- package/dist/src/tiles/overlay/icon-overlay.js +30 -30
- package/dist/src/tiles/overlay/text-overlay.d.ts +8 -8
- package/dist/src/tiles/overlay/text-overlay.js +31 -31
- package/dist/src/tiles/text-snippet-block.d.ts +29 -29
- package/dist/src/tiles/text-snippet-block.js +81 -81
- package/dist/src/tiles/tile-dispatcher.d.ts +36 -36
- package/dist/src/tiles/tile-dispatcher.js +128 -128
- 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/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +575 -575
- 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 +544 -544
- 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 +56 -56
- 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 +10 -10
- package/dist/test/mocks/mock-search-responses.js +271 -271
- package/dist/test/mocks/mock-search-service.d.ts +13 -13
- package/dist/test/mocks/mock-search-service.js +36 -36
- package/dist/test/restoration-state-handler.test.d.ts +1 -1
- package/dist/test/restoration-state-handler.test.js +126 -126
- 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 +113 -113
- package/dist/test/text-overlay.test.d.ts +1 -1
- package/dist/test/text-overlay.test.js +41 -41
- 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/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +107 -107
- 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 +136 -92
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- 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/index.html +24 -24
- 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/tiles/list/tile-list.ts +12 -5
- package/test/tiles/list/tile-list.test.ts +51 -0
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,63 +1,64 @@
|
|
|
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
|
-
updated(changed) {
|
|
24
|
-
if (changed.has('model')) {
|
|
25
|
-
this.fetchCollectionNames();
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
async fetchCollectionNames() {
|
|
29
|
-
var _a, _b;
|
|
30
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
|
|
31
|
-
this.model.collections.length === 0 ||
|
|
32
|
-
!this.collectionNameCache) {
|
|
33
|
-
return;
|
|
34
|
-
}
|
|
35
|
-
// Note: quirk of Lit: need to replace collectionLinks array,
|
|
36
|
-
// otherwise it will not re-render. Can't simply alter the array.
|
|
37
|
-
this.collectionLinks = [];
|
|
38
|
-
const newCollectionLinks = [];
|
|
39
|
-
const promises = [];
|
|
40
|
-
for (const collection of this.model.collections) {
|
|
41
|
-
// Don't include collections that are meant to be suppressed
|
|
42
|
-
if (!suppressedCollections[collection]
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
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
|
+
updated(changed) {
|
|
24
|
+
if (changed.has('model')) {
|
|
25
|
+
this.fetchCollectionNames();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
async fetchCollectionNames() {
|
|
29
|
+
var _a, _b;
|
|
30
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.collections) ||
|
|
31
|
+
this.model.collections.length === 0 ||
|
|
32
|
+
!this.collectionNameCache) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
// Note: quirk of Lit: need to replace collectionLinks array,
|
|
36
|
+
// otherwise it will not re-render. Can't simply alter the array.
|
|
37
|
+
this.collectionLinks = [];
|
|
38
|
+
const newCollectionLinks = [];
|
|
39
|
+
const promises = [];
|
|
40
|
+
for (const collection of this.model.collections) {
|
|
41
|
+
// Don't include favorites or collections that are meant to be suppressed
|
|
42
|
+
if (!suppressedCollections[collection] &&
|
|
43
|
+
!collection.startsWith('fav-')) {
|
|
44
|
+
promises.push((_b = this.collectionNameCache) === null || _b === void 0 ? void 0 : _b.collectionNameFor(collection).then(name => {
|
|
45
|
+
newCollectionLinks.push(this.detailsLink(collection, name !== null && name !== void 0 ? name : collection));
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
await Promise.all(promises);
|
|
50
|
+
this.collectionLinks = newCollectionLinks;
|
|
51
|
+
}
|
|
52
|
+
render() {
|
|
52
53
|
return html `
|
|
53
54
|
<div id="list-line" class="${this.classSize}">
|
|
54
|
-
${this.classSize === 'mobile'
|
|
55
|
-
? this.mobileTemplate
|
|
55
|
+
${this.classSize === 'mobile'
|
|
56
|
+
? this.mobileTemplate
|
|
56
57
|
: this.desktopTemplate}
|
|
57
58
|
</div>
|
|
58
|
-
`;
|
|
59
|
-
}
|
|
60
|
-
get mobileTemplate() {
|
|
59
|
+
`;
|
|
60
|
+
}
|
|
61
|
+
get mobileTemplate() {
|
|
61
62
|
return html `
|
|
62
63
|
<div id="list-line-top">
|
|
63
64
|
<div id="list-line-left">${this.imageBlockTemplate}</div>
|
|
@@ -69,9 +70,9 @@ let TileList = class TileList extends LitElement {
|
|
|
69
70
|
</div>
|
|
70
71
|
</div>
|
|
71
72
|
<div id="list-line-bottom">${this.detailsTemplate}</div>
|
|
72
|
-
`;
|
|
73
|
-
}
|
|
74
|
-
get desktopTemplate() {
|
|
73
|
+
`;
|
|
74
|
+
}
|
|
75
|
+
get desktopTemplate() {
|
|
75
76
|
return html `
|
|
76
77
|
<div id="list-line-left">${this.imageBlockTemplate}</div>
|
|
77
78
|
<div id="list-line-right">
|
|
@@ -81,9 +82,9 @@ let TileList = class TileList extends LitElement {
|
|
|
81
82
|
</div>
|
|
82
83
|
${this.detailsTemplate}
|
|
83
84
|
</div>
|
|
84
|
-
`;
|
|
85
|
-
}
|
|
86
|
-
get imageBlockTemplate() {
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
get imageBlockTemplate() {
|
|
87
88
|
return html `
|
|
88
89
|
<image-block
|
|
89
90
|
.model=${this.model}
|
|
@@ -94,9 +95,9 @@ let TileList = class TileList extends LitElement {
|
|
|
94
95
|
.loggedIn=${this.loggedIn}
|
|
95
96
|
>
|
|
96
97
|
</image-block>
|
|
97
|
-
`;
|
|
98
|
-
}
|
|
99
|
-
get detailsTemplate() {
|
|
98
|
+
`;
|
|
99
|
+
}
|
|
100
|
+
get detailsTemplate() {
|
|
100
101
|
return html `
|
|
101
102
|
${this.itemLineTemplate} ${this.creatorTemplate}
|
|
102
103
|
<div id="dates-line">
|
|
@@ -107,11 +108,11 @@ let TileList = class TileList extends LitElement {
|
|
|
107
108
|
</div>
|
|
108
109
|
${this.topicsTemplate} ${this.collectionsTemplate}
|
|
109
110
|
${this.descriptionTemplate} ${this.textSnippetsTemplate}
|
|
110
|
-
`;
|
|
111
|
-
}
|
|
112
|
-
// Data templates
|
|
113
|
-
get iconRightTemplate() {
|
|
114
|
-
var _a, _b;
|
|
111
|
+
`;
|
|
112
|
+
}
|
|
113
|
+
// Data templates
|
|
114
|
+
get iconRightTemplate() {
|
|
115
|
+
var _a, _b;
|
|
115
116
|
return html `
|
|
116
117
|
<div id="icon-right">
|
|
117
118
|
<mediatype-icon
|
|
@@ -120,209 +121,213 @@ let TileList = class TileList extends LitElement {
|
|
|
120
121
|
>
|
|
121
122
|
</mediatype-icon>
|
|
122
123
|
</div>
|
|
123
|
-
`;
|
|
124
|
-
}
|
|
125
|
-
get titleTemplate() {
|
|
126
|
-
var _a;
|
|
127
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
128
|
-
return nothing;
|
|
129
|
-
}
|
|
130
|
-
return html ` ${this.detailsLink(this.model.identifier, this.model.title)} `;
|
|
131
|
-
}
|
|
132
|
-
get itemLineTemplate() {
|
|
133
|
-
const source = this.sourceTemplate;
|
|
134
|
-
const volume = this.volumeTemplate;
|
|
135
|
-
const issue = this.issueTemplate;
|
|
136
|
-
if (!source && !volume && !issue) {
|
|
137
|
-
return nothing;
|
|
138
|
-
}
|
|
139
|
-
return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
|
|
140
|
-
}
|
|
141
|
-
get sourceTemplate() {
|
|
142
|
-
var _a;
|
|
143
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
|
|
144
|
-
return nothing;
|
|
145
|
-
}
|
|
124
|
+
`;
|
|
125
|
+
}
|
|
126
|
+
get titleTemplate() {
|
|
127
|
+
var _a;
|
|
128
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.title)) {
|
|
129
|
+
return nothing;
|
|
130
|
+
}
|
|
131
|
+
return html ` ${this.detailsLink(this.model.identifier, this.model.title)} `;
|
|
132
|
+
}
|
|
133
|
+
get itemLineTemplate() {
|
|
134
|
+
const source = this.sourceTemplate;
|
|
135
|
+
const volume = this.volumeTemplate;
|
|
136
|
+
const issue = this.issueTemplate;
|
|
137
|
+
if (!source && !volume && !issue) {
|
|
138
|
+
return nothing;
|
|
139
|
+
}
|
|
140
|
+
return html ` <div id="item-line">${source} ${volume} ${issue}</div> `;
|
|
141
|
+
}
|
|
142
|
+
get sourceTemplate() {
|
|
143
|
+
var _a;
|
|
144
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.source)) {
|
|
145
|
+
return nothing;
|
|
146
|
+
}
|
|
146
147
|
return html `
|
|
147
148
|
<div id="source" class="metadata">
|
|
148
149
|
${this.labelTemplate('Source')}
|
|
149
150
|
${this.searchLink('source', this.model.source)}
|
|
150
151
|
</div>
|
|
151
|
-
`;
|
|
152
|
-
}
|
|
153
|
-
get volumeTemplate() {
|
|
154
|
-
var _a;
|
|
155
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, 'Volume');
|
|
156
|
-
}
|
|
157
|
-
get issueTemplate() {
|
|
158
|
-
var _a;
|
|
159
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, 'Issue');
|
|
160
|
-
}
|
|
161
|
-
get creatorTemplate() {
|
|
162
|
-
var _a, _b, _c;
|
|
163
|
-
// "
|
|
164
|
-
if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
|
|
152
|
+
`;
|
|
153
|
+
}
|
|
154
|
+
get volumeTemplate() {
|
|
155
|
+
var _a;
|
|
156
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.volume, 'Volume');
|
|
157
|
+
}
|
|
158
|
+
get issueTemplate() {
|
|
159
|
+
var _a;
|
|
160
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.issue, 'Issue');
|
|
161
|
+
}
|
|
162
|
+
get creatorTemplate() {
|
|
163
|
+
var _a, _b, _c;
|
|
164
|
+
// "Archivist since" if account
|
|
165
|
+
if (((_a = this.model) === null || _a === void 0 ? void 0 : _a.mediatype) === 'account') {
|
|
165
166
|
return html `
|
|
166
167
|
<div id="creator" class="metadata">
|
|
167
168
|
<span class="label"> ${accountLabel((_b = this.model) === null || _b === void 0 ? void 0 : _b.dateAdded)} </span>
|
|
168
169
|
</div>
|
|
169
|
-
`;
|
|
170
|
-
}
|
|
171
|
-
// "Creator" if not account tile
|
|
172
|
-
if (!((_c = this.model) === null || _c === void 0 ? void 0 : _c.creators) || this.model.creators.length === 0) {
|
|
173
|
-
return nothing;
|
|
174
|
-
}
|
|
170
|
+
`;
|
|
171
|
+
}
|
|
172
|
+
// "Creator" if not account tile
|
|
173
|
+
if (!((_c = this.model) === null || _c === void 0 ? void 0 : _c.creators) || this.model.creators.length === 0) {
|
|
174
|
+
return nothing;
|
|
175
|
+
}
|
|
175
176
|
return html `
|
|
176
177
|
<div id="creator" class="metadata">
|
|
177
178
|
${this.labelTemplate('By')}
|
|
178
179
|
${join(map(this.model.creators, id => this.searchLink('creator', id)), html `, `)}
|
|
179
180
|
</div>
|
|
180
|
-
`;
|
|
181
|
-
}
|
|
182
|
-
get datePublishedTemplate() {
|
|
183
|
-
var _a;
|
|
184
|
-
return this.metadataTemplate(formatDate((_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished, 'long'), 'Published');
|
|
185
|
-
}
|
|
186
|
-
// Show date label/value when sorted by date type
|
|
187
|
-
// Except datePublished which is always shown
|
|
188
|
-
get dateSortByTemplate() {
|
|
189
|
-
if (this.sortParam &&
|
|
190
|
-
(this.sortParam.field === 'addeddate' ||
|
|
191
|
-
this.sortParam.field === 'reviewdate' ||
|
|
192
|
-
this.sortParam.field === 'publicdate')) {
|
|
193
|
-
return this.metadataTemplate(formatDate(this.date, 'long'), dateLabel(this.sortParam.field));
|
|
194
|
-
}
|
|
195
|
-
return nothing;
|
|
196
|
-
}
|
|
197
|
-
get viewsTemplate() {
|
|
198
|
-
var _a, _b, _c;
|
|
199
|
-
const viewCount = ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) === 'week'
|
|
200
|
-
? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
|
|
201
|
-
: (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
|
|
202
|
-
return this.metadataTemplate(`${formatCount(viewCount !== null && viewCount !== void 0 ? viewCount : 0, this.formatSize)}`, 'Views');
|
|
203
|
-
}
|
|
204
|
-
get ratingTemplate() {
|
|
205
|
-
var _a;
|
|
206
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, 'Avg Rating');
|
|
207
|
-
}
|
|
208
|
-
get reviewsTemplate() {
|
|
209
|
-
var _a;
|
|
210
|
-
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, 'Reviews');
|
|
211
|
-
}
|
|
212
|
-
get topicsTemplate() {
|
|
213
|
-
var _a;
|
|
214
|
-
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
|
|
215
|
-
return nothing;
|
|
216
|
-
}
|
|
181
|
+
`;
|
|
182
|
+
}
|
|
183
|
+
get datePublishedTemplate() {
|
|
184
|
+
var _a;
|
|
185
|
+
return this.metadataTemplate(formatDate((_a = this.model) === null || _a === void 0 ? void 0 : _a.datePublished, 'long'), 'Published');
|
|
186
|
+
}
|
|
187
|
+
// Show date label/value when sorted by date type
|
|
188
|
+
// Except datePublished which is always shown
|
|
189
|
+
get dateSortByTemplate() {
|
|
190
|
+
if (this.sortParam &&
|
|
191
|
+
(this.sortParam.field === 'addeddate' ||
|
|
192
|
+
this.sortParam.field === 'reviewdate' ||
|
|
193
|
+
this.sortParam.field === 'publicdate')) {
|
|
194
|
+
return this.metadataTemplate(formatDate(this.date, 'long'), dateLabel(this.sortParam.field));
|
|
195
|
+
}
|
|
196
|
+
return nothing;
|
|
197
|
+
}
|
|
198
|
+
get viewsTemplate() {
|
|
199
|
+
var _a, _b, _c;
|
|
200
|
+
const viewCount = ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) === 'week'
|
|
201
|
+
? (_b = this.model) === null || _b === void 0 ? void 0 : _b.weeklyViewCount // weekly views
|
|
202
|
+
: (_c = this.model) === null || _c === void 0 ? void 0 : _c.viewCount; // all-time views
|
|
203
|
+
return this.metadataTemplate(`${formatCount(viewCount !== null && viewCount !== void 0 ? viewCount : 0, this.formatSize)}`, 'Views');
|
|
204
|
+
}
|
|
205
|
+
get ratingTemplate() {
|
|
206
|
+
var _a;
|
|
207
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.averageRating, 'Avg Rating');
|
|
208
|
+
}
|
|
209
|
+
get reviewsTemplate() {
|
|
210
|
+
var _a;
|
|
211
|
+
return this.metadataTemplate((_a = this.model) === null || _a === void 0 ? void 0 : _a.commentCount, 'Reviews');
|
|
212
|
+
}
|
|
213
|
+
get topicsTemplate() {
|
|
214
|
+
var _a;
|
|
215
|
+
if (!((_a = this.model) === null || _a === void 0 ? void 0 : _a.subjects) || this.model.subjects.length === 0) {
|
|
216
|
+
return nothing;
|
|
217
|
+
}
|
|
217
218
|
return html `
|
|
218
219
|
<div id="topics" class="metadata">
|
|
219
220
|
${this.labelTemplate('Topics')}
|
|
220
221
|
${join(map(this.model.subjects, id => this.searchLink('subject', id)), html `, `)}
|
|
221
222
|
</div>
|
|
222
|
-
`;
|
|
223
|
-
}
|
|
224
|
-
get collectionsTemplate() {
|
|
225
|
-
if (!this.collectionLinks || this.collectionLinks.length === 0) {
|
|
226
|
-
return nothing;
|
|
227
|
-
}
|
|
223
|
+
`;
|
|
224
|
+
}
|
|
225
|
+
get collectionsTemplate() {
|
|
226
|
+
if (!this.collectionLinks || this.collectionLinks.length === 0) {
|
|
227
|
+
return nothing;
|
|
228
|
+
}
|
|
228
229
|
return html `
|
|
229
230
|
<div id="collections" class="metadata">
|
|
230
231
|
${this.labelTemplate('Collections')}
|
|
231
232
|
${join(this.collectionLinks, html `, `)}
|
|
232
233
|
</div>
|
|
233
|
-
`;
|
|
234
|
-
}
|
|
235
|
-
get descriptionTemplate() {
|
|
236
|
-
var _a, _b, _c;
|
|
237
|
-
return this.metadataTemplate(
|
|
238
|
-
// Sanitize away any HTML tags and convert line breaks to spaces.
|
|
239
|
-
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');
|
|
240
|
-
}
|
|
241
|
-
get textSnippetsTemplate() {
|
|
242
|
-
var _a;
|
|
243
|
-
if (!this.hasSnippets)
|
|
244
|
-
return nothing;
|
|
234
|
+
`;
|
|
235
|
+
}
|
|
236
|
+
get descriptionTemplate() {
|
|
237
|
+
var _a, _b, _c;
|
|
238
|
+
return this.metadataTemplate(
|
|
239
|
+
// Sanitize away any HTML tags and convert line breaks to spaces.
|
|
240
|
+
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');
|
|
241
|
+
}
|
|
242
|
+
get textSnippetsTemplate() {
|
|
243
|
+
var _a;
|
|
244
|
+
if (!this.hasSnippets)
|
|
245
|
+
return nothing;
|
|
245
246
|
return html `<text-snippet-block
|
|
246
247
|
viewsize="list"
|
|
247
248
|
.snippets=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets}
|
|
248
|
-
></text-snippet-block>`;
|
|
249
|
-
}
|
|
250
|
-
get hasSnippets() {
|
|
251
|
-
var _a, _b;
|
|
252
|
-
return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
|
|
253
|
-
}
|
|
254
|
-
// Utility functions
|
|
255
|
-
// eslint-disable-next-line default-param-last
|
|
256
|
-
metadataTemplate(text, label = '', id) {
|
|
257
|
-
if (!text)
|
|
258
|
-
return nothing;
|
|
249
|
+
></text-snippet-block>`;
|
|
250
|
+
}
|
|
251
|
+
get hasSnippets() {
|
|
252
|
+
var _a, _b;
|
|
253
|
+
return !!((_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.snippets) === null || _b === void 0 ? void 0 : _b.length);
|
|
254
|
+
}
|
|
255
|
+
// Utility functions
|
|
256
|
+
// eslint-disable-next-line default-param-last
|
|
257
|
+
metadataTemplate(text, label = '', id) {
|
|
258
|
+
if (!text)
|
|
259
|
+
return nothing;
|
|
259
260
|
return html `
|
|
260
261
|
<div id=${ifDefined(id)} class="metadata">
|
|
261
262
|
${this.labelTemplate(label)} ${text}
|
|
262
263
|
</div>
|
|
263
|
-
`;
|
|
264
|
-
}
|
|
265
|
-
labelTemplate(label) {
|
|
266
|
-
return html ` ${label
|
|
267
|
-
? html `<span class="label">${label}: </span>`
|
|
268
|
-
: nothing}`;
|
|
269
|
-
}
|
|
270
|
-
searchLink(field, searchTerm) {
|
|
271
|
-
if (!field || !searchTerm) {
|
|
272
|
-
return nothing;
|
|
273
|
-
}
|
|
274
|
-
const query = encodeURIComponent(`${field}:"${searchTerm}"`);
|
|
275
|
-
// No whitespace after closing tag
|
|
276
|
-
// Note: single ' for href='' to wrap " in query var gets changed back by yarn format
|
|
277
|
-
|
|
278
|
-
return html `<a
|
|
264
|
+
`;
|
|
265
|
+
}
|
|
266
|
+
labelTemplate(label) {
|
|
267
|
+
return html ` ${label
|
|
268
|
+
? html `<span class="label">${label}: </span>`
|
|
269
|
+
: nothing}`;
|
|
270
|
+
}
|
|
271
|
+
searchLink(field, searchTerm) {
|
|
272
|
+
if (!field || !searchTerm) {
|
|
273
|
+
return nothing;
|
|
274
|
+
}
|
|
275
|
+
const query = encodeURIComponent(`${field}:"${searchTerm}"`);
|
|
276
|
+
// No whitespace after closing tag
|
|
277
|
+
// Note: single ' for href='' to wrap " in query var gets changed back by yarn format
|
|
278
|
+
/* eslint-disable lit/no-invalid-html */
|
|
279
|
+
return html `<a
|
|
280
|
+
href="${this.baseNavigationUrl}/search?query=${query}"
|
|
281
|
+
rel="nofollow"
|
|
282
|
+
>
|
|
279
283
|
${DOMPurify.sanitize(searchTerm)}</a
|
|
280
|
-
>`;
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
//
|
|
284
|
+
>`;
|
|
285
|
+
/* eslint-enable lit/no-invalid-html */
|
|
286
|
+
}
|
|
287
|
+
detailsLink(identifier, text) {
|
|
288
|
+
const linkText = text !== null && text !== void 0 ? text : identifier;
|
|
289
|
+
// No whitespace after closing tag
|
|
290
|
+
// identifiers (all ASCII in their creation) should be safe to use in href, but sanitize anyway
|
|
286
291
|
return html `<a
|
|
287
292
|
href="${this.baseNavigationUrl}/details/${encodeURI(identifier)}"
|
|
288
293
|
>${DOMPurify.sanitize(linkText)}</a
|
|
289
|
-
>`;
|
|
290
|
-
}
|
|
291
|
-
/*
|
|
292
|
-
* TODO: fix field names to match model in src/collection-browser.ts
|
|
293
|
-
* private get dateSortSelector()
|
|
294
|
-
* @see src/models.ts
|
|
295
|
-
*/
|
|
296
|
-
get date() {
|
|
297
|
-
var _a, _b, _c, _d, _e;
|
|
298
|
-
switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
|
|
299
|
-
case 'date':
|
|
300
|
-
return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
|
|
301
|
-
case 'reviewdate':
|
|
302
|
-
return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
|
|
303
|
-
case 'addeddate':
|
|
304
|
-
return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
|
|
305
|
-
default:
|
|
306
|
-
return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
get classSize() {
|
|
310
|
-
if (this.mobileBreakpoint &&
|
|
311
|
-
this.currentWidth &&
|
|
312
|
-
this.currentWidth < this.mobileBreakpoint) {
|
|
313
|
-
return 'mobile';
|
|
314
|
-
}
|
|
315
|
-
return 'desktop';
|
|
316
|
-
}
|
|
317
|
-
get formatSize() {
|
|
318
|
-
if (this.mobileBreakpoint &&
|
|
319
|
-
this.currentWidth &&
|
|
320
|
-
this.currentWidth < this.mobileBreakpoint) {
|
|
321
|
-
return 'short';
|
|
322
|
-
}
|
|
323
|
-
return 'long';
|
|
324
|
-
}
|
|
325
|
-
static get styles() {
|
|
294
|
+
>`;
|
|
295
|
+
}
|
|
296
|
+
/*
|
|
297
|
+
* TODO: fix field names to match model in src/collection-browser.ts
|
|
298
|
+
* private get dateSortSelector()
|
|
299
|
+
* @see src/models.ts
|
|
300
|
+
*/
|
|
301
|
+
get date() {
|
|
302
|
+
var _a, _b, _c, _d, _e;
|
|
303
|
+
switch ((_a = this.sortParam) === null || _a === void 0 ? void 0 : _a.field) {
|
|
304
|
+
case 'date':
|
|
305
|
+
return (_b = this.model) === null || _b === void 0 ? void 0 : _b.datePublished;
|
|
306
|
+
case 'reviewdate':
|
|
307
|
+
return (_c = this.model) === null || _c === void 0 ? void 0 : _c.dateReviewed;
|
|
308
|
+
case 'addeddate':
|
|
309
|
+
return (_d = this.model) === null || _d === void 0 ? void 0 : _d.dateAdded;
|
|
310
|
+
default:
|
|
311
|
+
return (_e = this.model) === null || _e === void 0 ? void 0 : _e.dateArchived; // publicdate
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
get classSize() {
|
|
315
|
+
if (this.mobileBreakpoint &&
|
|
316
|
+
this.currentWidth &&
|
|
317
|
+
this.currentWidth < this.mobileBreakpoint) {
|
|
318
|
+
return 'mobile';
|
|
319
|
+
}
|
|
320
|
+
return 'desktop';
|
|
321
|
+
}
|
|
322
|
+
get formatSize() {
|
|
323
|
+
if (this.mobileBreakpoint &&
|
|
324
|
+
this.currentWidth &&
|
|
325
|
+
this.currentWidth < this.mobileBreakpoint) {
|
|
326
|
+
return 'short';
|
|
327
|
+
}
|
|
328
|
+
return 'long';
|
|
329
|
+
}
|
|
330
|
+
static get styles() {
|
|
326
331
|
return css `
|
|
327
332
|
html {
|
|
328
333
|
font-size: unset;
|
|
@@ -441,41 +446,41 @@ let TileList = class TileList extends LitElement {
|
|
|
441
446
|
flex-direction: row;
|
|
442
447
|
gap: 10px;
|
|
443
448
|
}
|
|
444
|
-
`;
|
|
445
|
-
}
|
|
446
|
-
};
|
|
447
|
-
__decorate([
|
|
448
|
-
property({ type: Object })
|
|
449
|
-
], TileList.prototype, "model", void 0);
|
|
450
|
-
__decorate([
|
|
451
|
-
property({ type: String })
|
|
452
|
-
], TileList.prototype, "baseNavigationUrl", void 0);
|
|
453
|
-
__decorate([
|
|
454
|
-
property({ type: Object })
|
|
455
|
-
], TileList.prototype, "collectionNameCache", void 0);
|
|
456
|
-
__decorate([
|
|
457
|
-
property({ type: Number })
|
|
458
|
-
], TileList.prototype, "currentWidth", void 0);
|
|
459
|
-
__decorate([
|
|
460
|
-
property({ type: Number })
|
|
461
|
-
], TileList.prototype, "currentHeight", void 0);
|
|
462
|
-
__decorate([
|
|
463
|
-
property({ type: Object })
|
|
464
|
-
], TileList.prototype, "sortParam", void 0);
|
|
465
|
-
__decorate([
|
|
466
|
-
property({ type: Number })
|
|
467
|
-
], TileList.prototype, "mobileBreakpoint", void 0);
|
|
468
|
-
__decorate([
|
|
469
|
-
state()
|
|
470
|
-
], TileList.prototype, "collectionLinks", void 0);
|
|
471
|
-
__decorate([
|
|
472
|
-
property({ type: String })
|
|
473
|
-
], TileList.prototype, "baseImageUrl", void 0);
|
|
474
|
-
__decorate([
|
|
475
|
-
property({ type: Boolean })
|
|
476
|
-
], TileList.prototype, "loggedIn", void 0);
|
|
477
|
-
TileList = __decorate([
|
|
478
|
-
customElement('tile-list')
|
|
479
|
-
], TileList);
|
|
480
|
-
export { TileList };
|
|
449
|
+
`;
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
__decorate([
|
|
453
|
+
property({ type: Object })
|
|
454
|
+
], TileList.prototype, "model", void 0);
|
|
455
|
+
__decorate([
|
|
456
|
+
property({ type: String })
|
|
457
|
+
], TileList.prototype, "baseNavigationUrl", void 0);
|
|
458
|
+
__decorate([
|
|
459
|
+
property({ type: Object })
|
|
460
|
+
], TileList.prototype, "collectionNameCache", void 0);
|
|
461
|
+
__decorate([
|
|
462
|
+
property({ type: Number })
|
|
463
|
+
], TileList.prototype, "currentWidth", void 0);
|
|
464
|
+
__decorate([
|
|
465
|
+
property({ type: Number })
|
|
466
|
+
], TileList.prototype, "currentHeight", void 0);
|
|
467
|
+
__decorate([
|
|
468
|
+
property({ type: Object })
|
|
469
|
+
], TileList.prototype, "sortParam", void 0);
|
|
470
|
+
__decorate([
|
|
471
|
+
property({ type: Number })
|
|
472
|
+
], TileList.prototype, "mobileBreakpoint", void 0);
|
|
473
|
+
__decorate([
|
|
474
|
+
state()
|
|
475
|
+
], TileList.prototype, "collectionLinks", void 0);
|
|
476
|
+
__decorate([
|
|
477
|
+
property({ type: String })
|
|
478
|
+
], TileList.prototype, "baseImageUrl", void 0);
|
|
479
|
+
__decorate([
|
|
480
|
+
property({ type: Boolean })
|
|
481
|
+
], TileList.prototype, "loggedIn", void 0);
|
|
482
|
+
TileList = __decorate([
|
|
483
|
+
customElement('tile-list')
|
|
484
|
+
], TileList);
|
|
485
|
+
export { TileList };
|
|
481
486
|
//# sourceMappingURL=tile-list.js.map
|