@internetarchive/collection-browser 0.4.3-alpha.9 → 0.4.4-alpha
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 -48
- package/dist/src/app-root.js +449 -412
- package/dist/src/app-root.js.map +1 -1
- 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 +315 -276
- package/dist/src/collection-browser.js +1276 -1179
- 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 +78 -78
- package/dist/src/collection-facets.js +391 -391
- 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 +114 -112
- 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.d.ts +12 -12
- package/dist/src/sort-filter-bar/alpha-bar.js +52 -52
- 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 +428 -428
- package/dist/src/styles/item-image-styles.d.ts +8 -8
- package/dist/src/styles/item-image-styles.js +22 -12
- package/dist/src/styles/item-image-styles.js.map +1 -1
- package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
- package/dist/src/tiles/collection-browser-loading-tile.js +16 -16
- package/dist/src/tiles/collection-browser-loading-tile.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.d.ts +17 -17
- package/dist/src/tiles/grid/account-tile.js +48 -47
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.d.ts +14 -7
- package/dist/src/tiles/grid/collection-tile.js +112 -146
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.d.ts +29 -29
- package/dist/src/tiles/grid/item-tile.js +110 -105
- 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 +12 -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 +41 -40
- package/dist/src/tiles/grid/tile-stats.js.map +1 -1
- package/dist/src/tiles/image-block.d.ts +17 -17
- package/dist/src/tiles/image-block.js +76 -72
- package/dist/src/tiles/image-block.js.map +1 -1
- package/dist/src/tiles/item-image.d.ts +35 -35
- package/dist/src/tiles/item-image.js +117 -116
- package/dist/src/tiles/item-image.js.map +1 -1
- 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 +53 -53
- package/dist/src/tiles/list/tile-list.js +279 -279
- 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 +36 -36
- package/dist/src/tiles/tile-dispatcher.js +145 -128
- 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 -0
- package/dist/src/utils/format-unit-size.js +34 -0
- package/dist/src/utils/format-unit-size.js.map +1 -0
- package/dist/test/collection-browser.test.d.ts +1 -1
- package/dist/test/collection-browser.test.js +646 -646
- 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 +84 -80
- package/dist/test/item-image.test.js.map +1 -1
- 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.test.d.ts +1 -1
- package/dist/test/sort-filter-bar/alpha-bar.test.js +43 -43
- 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 +141 -141
- 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 +60 -60
- package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -0
- package/dist/test/tiles/grid/collection-tile.test.js +73 -0
- package/dist/test/tiles/grid/collection-tile.test.js.map +1 -0
- package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +142 -129
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- 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 +123 -123
- 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 -0
- package/dist/test/utils/format-unit-size.test.js +18 -0
- package/dist/test/utils/format-unit-size.test.js.map +1 -0
- package/index.html +24 -24
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +2 -2
- package/renovate.json +6 -6
- package/src/app-root.ts +214 -169
- package/src/collection-browser.ts +122 -3
- package/src/models.ts +2 -0
- package/src/styles/item-image-styles.ts +13 -3
- package/src/tiles/collection-browser-loading-tile.ts +1 -1
- package/src/tiles/grid/account-tile.ts +4 -2
- package/src/tiles/grid/collection-tile.ts +106 -136
- package/src/tiles/grid/item-tile.ts +8 -2
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +6 -2
- package/src/tiles/grid/tile-stats.ts +1 -0
- package/src/tiles/image-block.ts +5 -2
- package/src/tiles/item-image.ts +4 -3
- package/src/tiles/tile-dispatcher.ts +17 -0
- package/src/utils/format-unit-size.ts +43 -0
- package/test/item-image.test.ts +4 -0
- package/test/tiles/grid/collection-tile.test.ts +85 -0
- package/test/tiles/grid/item-tile.test.ts +30 -4
- package/test/utils/format-unit-size.test.ts +21 -0
- package/tsconfig.json +21 -21
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { css, html, LitElement, nothing, } from 'lit';
|
|
3
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
-
import { join } from 'lit/directives/join.js';
|
|
5
|
-
let TextSnippetBlock = class TextSnippetBlock extends LitElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.snippets = [];
|
|
9
|
-
this.viewSize = 'desktop';
|
|
10
|
-
}
|
|
11
|
-
render() {
|
|
12
|
-
var _a;
|
|
13
|
-
if (!((_a = this.snippets) === null || _a === void 0 ? void 0 : _a.length))
|
|
14
|
-
return html `${nothing}`;
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement, nothing, } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import { join } from 'lit/directives/join.js';
|
|
5
|
+
let TextSnippetBlock = class TextSnippetBlock extends LitElement {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.snippets = [];
|
|
9
|
+
this.viewSize = 'desktop';
|
|
10
|
+
}
|
|
11
|
+
render() {
|
|
12
|
+
var _a;
|
|
13
|
+
if (!((_a = this.snippets) === null || _a === void 0 ? void 0 : _a.length))
|
|
14
|
+
return html `${nothing}`;
|
|
15
15
|
return html `
|
|
16
16
|
<div class="container">
|
|
17
17
|
<div class="snippet-view ${this.viewSize}">
|
|
18
18
|
${this.ellipsisJoinedSnippets}
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
21
|
-
`;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* An array of HTML templates derived from the snippets, with ellipses inserted
|
|
25
|
-
* at the beginning, end, and between each pair of snippets.
|
|
26
|
-
*/
|
|
27
|
-
get ellipsisJoinedSnippets() {
|
|
21
|
+
`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* An array of HTML templates derived from the snippets, with ellipses inserted
|
|
25
|
+
* at the beginning, end, and between each pair of snippets.
|
|
26
|
+
*/
|
|
27
|
+
get ellipsisJoinedSnippets() {
|
|
28
28
|
return html `
|
|
29
29
|
… ${join(this.snippetTemplates, html ` … `)} …
|
|
30
|
-
`;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Returns an array of HTML span templates containing this item's snippets with all of
|
|
34
|
-
* their `{{{triple-brace-delimited}}}` matches replaced by `<mark>HTML mark tags</mark>`.
|
|
35
|
-
*
|
|
36
|
-
* This approach safely avoids the use of `unsafeHTML` and leaves any existing HTML tags
|
|
37
|
-
* in the snippets intact (as inert text), rather than stripping them away with DOMPurify.
|
|
38
|
-
*
|
|
39
|
-
* Note on `<em>` vs. `<mark>`:
|
|
40
|
-
* The old search page snippets had search keywords demarcated with `<em>` tags.
|
|
41
|
-
* The `<mark>` tag is semantically more accurate for this use case than `<em>`,
|
|
42
|
-
* but screen-reader behavior may be different. `<em>` will likely be read in a
|
|
43
|
-
* different tone, while `<mark>` is often read no differently than ordinary text
|
|
44
|
-
* in many screen-readers (though there are ways to work around this if needed).
|
|
45
|
-
*/
|
|
46
|
-
get snippetTemplates() {
|
|
47
|
-
var _a;
|
|
48
|
-
return (_a = this.snippets) === null || _a === void 0 ? void 0 : _a.map(s => {
|
|
49
|
-
const matches = s.matchAll(/{{{(.+?)}}}/gs);
|
|
50
|
-
const templates = [];
|
|
51
|
-
// Convert each match into an HTML template that includes:
|
|
52
|
-
// - Everything from the end of the previous match (or the beginning of the
|
|
53
|
-
// string) up to the current match, as raw text.
|
|
54
|
-
// - The current match (excluding the curly braces) wrapped in a `<mark>` tag.
|
|
55
|
-
let index = 0;
|
|
56
|
-
for (const match of matches) {
|
|
57
|
-
if (match.index != null) {
|
|
30
|
+
`;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Returns an array of HTML span templates containing this item's snippets with all of
|
|
34
|
+
* their `{{{triple-brace-delimited}}}` matches replaced by `<mark>HTML mark tags</mark>`.
|
|
35
|
+
*
|
|
36
|
+
* This approach safely avoids the use of `unsafeHTML` and leaves any existing HTML tags
|
|
37
|
+
* in the snippets intact (as inert text), rather than stripping them away with DOMPurify.
|
|
38
|
+
*
|
|
39
|
+
* Note on `<em>` vs. `<mark>`:
|
|
40
|
+
* The old search page snippets had search keywords demarcated with `<em>` tags.
|
|
41
|
+
* The `<mark>` tag is semantically more accurate for this use case than `<em>`,
|
|
42
|
+
* but screen-reader behavior may be different. `<em>` will likely be read in a
|
|
43
|
+
* different tone, while `<mark>` is often read no differently than ordinary text
|
|
44
|
+
* in many screen-readers (though there are ways to work around this if needed).
|
|
45
|
+
*/
|
|
46
|
+
get snippetTemplates() {
|
|
47
|
+
var _a;
|
|
48
|
+
return (_a = this.snippets) === null || _a === void 0 ? void 0 : _a.map(s => {
|
|
49
|
+
const matches = s.matchAll(/{{{(.+?)}}}/gs);
|
|
50
|
+
const templates = [];
|
|
51
|
+
// Convert each match into an HTML template that includes:
|
|
52
|
+
// - Everything from the end of the previous match (or the beginning of the
|
|
53
|
+
// string) up to the current match, as raw text.
|
|
54
|
+
// - The current match (excluding the curly braces) wrapped in a `<mark>` tag.
|
|
55
|
+
let index = 0;
|
|
56
|
+
for (const match of matches) {
|
|
57
|
+
if (match.index != null) {
|
|
58
58
|
templates.push(html `
|
|
59
59
|
${s.slice(index, match.index)}
|
|
60
60
|
<mark>${match[1]}</mark>
|
|
61
|
-
`);
|
|
62
|
-
index = match.index + match[0].length;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// Include any text from the last match to the end
|
|
66
|
-
templates.push(html `${s.slice(index)}`);
|
|
67
|
-
// Squash everything into a single span template
|
|
68
|
-
return html `<span>${templates}</span>`;
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
static get styles() {
|
|
61
|
+
`);
|
|
62
|
+
index = match.index + match[0].length;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Include any text from the last match to the end
|
|
66
|
+
templates.push(html `${s.slice(index)}`);
|
|
67
|
+
// Squash everything into a single span template
|
|
68
|
+
return html `<span>${templates}</span>`;
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
static get styles() {
|
|
72
72
|
return css `
|
|
73
73
|
.container {
|
|
74
74
|
display: flex;
|
|
@@ -110,17 +110,17 @@ let TextSnippetBlock = class TextSnippetBlock extends LitElement {
|
|
|
110
110
|
background-color: #0000ff33;
|
|
111
111
|
color: inherit;
|
|
112
112
|
}
|
|
113
|
-
`;
|
|
114
|
-
}
|
|
115
|
-
};
|
|
116
|
-
__decorate([
|
|
117
|
-
property({ type: Array })
|
|
118
|
-
], TextSnippetBlock.prototype, "snippets", void 0);
|
|
119
|
-
__decorate([
|
|
120
|
-
property({ type: String })
|
|
121
|
-
], TextSnippetBlock.prototype, "viewSize", void 0);
|
|
122
|
-
TextSnippetBlock = __decorate([
|
|
123
|
-
customElement('text-snippet-block')
|
|
124
|
-
], TextSnippetBlock);
|
|
125
|
-
export { TextSnippetBlock };
|
|
113
|
+
`;
|
|
114
|
+
}
|
|
115
|
+
};
|
|
116
|
+
__decorate([
|
|
117
|
+
property({ type: Array })
|
|
118
|
+
], TextSnippetBlock.prototype, "snippets", void 0);
|
|
119
|
+
__decorate([
|
|
120
|
+
property({ type: String })
|
|
121
|
+
], TextSnippetBlock.prototype, "viewSize", void 0);
|
|
122
|
+
TextSnippetBlock = __decorate([
|
|
123
|
+
customElement('text-snippet-block')
|
|
124
|
+
], TextSnippetBlock);
|
|
125
|
+
export { TextSnippetBlock };
|
|
126
126
|
//# sourceMappingURL=text-snippet-block.js.map
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
-
import type { SharedResizeObserverInterface, SharedResizeObserverResizeHandlerInterface } from '@internetarchive/shared-resize-observer';
|
|
3
|
-
import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
|
|
4
|
-
import type { SortParam } from '@internetarchive/search-service';
|
|
5
|
-
import type { TileDisplayMode, TileModel } from '../models';
|
|
6
|
-
import './grid/collection-tile';
|
|
7
|
-
import './grid/item-tile';
|
|
8
|
-
import './grid/account-tile';
|
|
9
|
-
import './list/tile-list';
|
|
10
|
-
import './list/tile-list-compact';
|
|
11
|
-
import './list/tile-list-compact-header';
|
|
12
|
-
export declare class TileDispatcher extends LitElement implements SharedResizeObserverResizeHandlerInterface {
|
|
13
|
-
tileDisplayMode?: TileDisplayMode;
|
|
14
|
-
model?: TileModel;
|
|
15
|
-
baseNavigationUrl?: string;
|
|
16
|
-
currentWidth?: number;
|
|
17
|
-
currentHeight?: number;
|
|
18
|
-
resizeObserver?: SharedResizeObserverInterface;
|
|
19
|
-
collectionNameCache?: CollectionNameCacheInterface;
|
|
20
|
-
sortParam: SortParam | null;
|
|
21
|
-
private container;
|
|
22
|
-
mobileBreakpoint?: number;
|
|
23
|
-
baseImageUrl?: string;
|
|
24
|
-
loggedIn: boolean;
|
|
25
|
-
render(): import("lit-html").TemplateResult<1>;
|
|
26
|
-
private get headerTemplate();
|
|
27
|
-
private get tileTemplate();
|
|
28
|
-
private get linkTileTemplate();
|
|
29
|
-
handleResize(entry: ResizeObserverEntry): void;
|
|
30
|
-
disconnectedCallback(): void;
|
|
31
|
-
private stopResizeObservation;
|
|
32
|
-
private startResizeObservation;
|
|
33
|
-
updated(props: PropertyValues): void;
|
|
34
|
-
private get tile();
|
|
35
|
-
static get styles(): import("lit").CSSResult;
|
|
36
|
-
}
|
|
1
|
+
import { LitElement, PropertyValues } from 'lit';
|
|
2
|
+
import type { SharedResizeObserverInterface, SharedResizeObserverResizeHandlerInterface } from '@internetarchive/shared-resize-observer';
|
|
3
|
+
import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
|
|
4
|
+
import type { SortParam } from '@internetarchive/search-service';
|
|
5
|
+
import type { TileDisplayMode, TileModel } from '../models';
|
|
6
|
+
import './grid/collection-tile';
|
|
7
|
+
import './grid/item-tile';
|
|
8
|
+
import './grid/account-tile';
|
|
9
|
+
import './list/tile-list';
|
|
10
|
+
import './list/tile-list-compact';
|
|
11
|
+
import './list/tile-list-compact-header';
|
|
12
|
+
export declare class TileDispatcher extends LitElement implements SharedResizeObserverResizeHandlerInterface {
|
|
13
|
+
tileDisplayMode?: TileDisplayMode;
|
|
14
|
+
model?: TileModel;
|
|
15
|
+
baseNavigationUrl?: string;
|
|
16
|
+
currentWidth?: number;
|
|
17
|
+
currentHeight?: number;
|
|
18
|
+
resizeObserver?: SharedResizeObserverInterface;
|
|
19
|
+
collectionNameCache?: CollectionNameCacheInterface;
|
|
20
|
+
sortParam: SortParam | null;
|
|
21
|
+
private container;
|
|
22
|
+
mobileBreakpoint?: number;
|
|
23
|
+
baseImageUrl?: string;
|
|
24
|
+
loggedIn: boolean;
|
|
25
|
+
render(): import("lit-html").TemplateResult<1>;
|
|
26
|
+
private get headerTemplate();
|
|
27
|
+
private get tileTemplate();
|
|
28
|
+
private get linkTileTemplate();
|
|
29
|
+
handleResize(entry: ResizeObserverEntry): void;
|
|
30
|
+
disconnectedCallback(): void;
|
|
31
|
+
private stopResizeObservation;
|
|
32
|
+
private startResizeObservation;
|
|
33
|
+
updated(props: PropertyValues): void;
|
|
34
|
+
private get tile();
|
|
35
|
+
static get styles(): import("lit").CSSResult;
|
|
36
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { __decorate } from "tslib";
|
|
2
|
-
import { css, html, LitElement, nothing } from 'lit';
|
|
3
|
-
import { customElement, property, query } from 'lit/decorators.js';
|
|
4
|
-
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
-
import './grid/collection-tile';
|
|
6
|
-
import './grid/item-tile';
|
|
7
|
-
import './grid/account-tile';
|
|
8
|
-
import './list/tile-list';
|
|
9
|
-
import './list/tile-list-compact';
|
|
10
|
-
import './list/tile-list-compact-header';
|
|
11
|
-
let TileDispatcher = class TileDispatcher extends LitElement {
|
|
12
|
-
constructor() {
|
|
13
|
-
super(...arguments);
|
|
14
|
-
this.sortParam = null;
|
|
15
|
-
this.loggedIn = false;
|
|
16
|
-
}
|
|
17
|
-
render() {
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement, nothing } from 'lit';
|
|
3
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
4
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
5
|
+
import './grid/collection-tile';
|
|
6
|
+
import './grid/item-tile';
|
|
7
|
+
import './grid/account-tile';
|
|
8
|
+
import './list/tile-list';
|
|
9
|
+
import './list/tile-list-compact';
|
|
10
|
+
import './list/tile-list-compact-header';
|
|
11
|
+
let TileDispatcher = class TileDispatcher extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.sortParam = null;
|
|
15
|
+
this.loggedIn = false;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
18
|
return html `
|
|
19
19
|
<div id="container">
|
|
20
|
-
${this.tileDisplayMode === 'list-header'
|
|
21
|
-
? this.headerTemplate
|
|
20
|
+
${this.tileDisplayMode === 'list-header'
|
|
21
|
+
? this.headerTemplate
|
|
22
22
|
: this.tileTemplate}
|
|
23
23
|
</div>
|
|
24
|
-
`;
|
|
25
|
-
}
|
|
26
|
-
get headerTemplate() {
|
|
27
|
-
const { currentWidth, sortParam, mobileBreakpoint } = this;
|
|
24
|
+
`;
|
|
25
|
+
}
|
|
26
|
+
get headerTemplate() {
|
|
27
|
+
const { currentWidth, sortParam, mobileBreakpoint } = this;
|
|
28
28
|
return html `
|
|
29
29
|
<tile-list-compact-header
|
|
30
30
|
class="header"
|
|
@@ -33,17 +33,17 @@ let TileDispatcher = class TileDispatcher extends LitElement {
|
|
|
33
33
|
.mobileBreakpoint=${mobileBreakpoint}
|
|
34
34
|
>
|
|
35
35
|
</tile-list-compact-header>
|
|
36
|
-
`;
|
|
37
|
-
}
|
|
38
|
-
get tileTemplate() {
|
|
36
|
+
`;
|
|
37
|
+
}
|
|
38
|
+
get tileTemplate() {
|
|
39
39
|
return html `
|
|
40
|
-
${this.tileDisplayMode === 'list-detail'
|
|
41
|
-
? this.tile
|
|
40
|
+
${this.tileDisplayMode === 'list-detail'
|
|
41
|
+
? this.tile
|
|
42
42
|
: this.linkTileTemplate}
|
|
43
|
-
`;
|
|
44
|
-
}
|
|
45
|
-
get linkTileTemplate() {
|
|
46
|
-
var _a, _b;
|
|
43
|
+
`;
|
|
44
|
+
}
|
|
45
|
+
get linkTileTemplate() {
|
|
46
|
+
var _a, _b;
|
|
47
47
|
return html `
|
|
48
48
|
<a
|
|
49
49
|
href="${this.baseNavigationUrl}/details/${(_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier}"
|
|
@@ -52,59 +52,60 @@ let TileDispatcher = class TileDispatcher extends LitElement {
|
|
|
52
52
|
>
|
|
53
53
|
${this.tile}
|
|
54
54
|
</a>
|
|
55
|
-
`;
|
|
56
|
-
}
|
|
57
|
-
handleResize(entry) {
|
|
58
|
-
this.currentWidth = entry.contentRect.width;
|
|
59
|
-
this.currentHeight = entry.contentRect.height;
|
|
60
|
-
}
|
|
61
|
-
disconnectedCallback() {
|
|
62
|
-
this.stopResizeObservation(this.resizeObserver);
|
|
63
|
-
}
|
|
64
|
-
stopResizeObservation(observer) {
|
|
65
|
-
observer === null || observer === void 0 ? void 0 : observer.removeObserver({
|
|
66
|
-
handler: this,
|
|
67
|
-
target: this.container,
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
startResizeObservation() {
|
|
71
|
-
var _a;
|
|
72
|
-
this.stopResizeObservation(this.resizeObserver);
|
|
73
|
-
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.addObserver({
|
|
74
|
-
handler: this,
|
|
75
|
-
target: this.container,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
updated(props) {
|
|
79
|
-
if (props.has('resizeObserver')) {
|
|
80
|
-
const previousObserver = props.get('resizeObserver');
|
|
81
|
-
this.stopResizeObservation(previousObserver);
|
|
82
|
-
this.startResizeObservation();
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
get tile() {
|
|
86
|
-
const { model, baseNavigationUrl, currentWidth, currentHeight, sortParam, mobileBreakpoint, } = this;
|
|
87
|
-
if (!model)
|
|
88
|
-
return nothing;
|
|
89
|
-
switch (this.tileDisplayMode) {
|
|
90
|
-
case 'grid':
|
|
91
|
-
switch (model.mediatype) {
|
|
92
|
-
case 'collection':
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
handleResize(entry) {
|
|
58
|
+
this.currentWidth = entry.contentRect.width;
|
|
59
|
+
this.currentHeight = entry.contentRect.height;
|
|
60
|
+
}
|
|
61
|
+
disconnectedCallback() {
|
|
62
|
+
this.stopResizeObservation(this.resizeObserver);
|
|
63
|
+
}
|
|
64
|
+
stopResizeObservation(observer) {
|
|
65
|
+
observer === null || observer === void 0 ? void 0 : observer.removeObserver({
|
|
66
|
+
handler: this,
|
|
67
|
+
target: this.container,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
startResizeObservation() {
|
|
71
|
+
var _a;
|
|
72
|
+
this.stopResizeObservation(this.resizeObserver);
|
|
73
|
+
(_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.addObserver({
|
|
74
|
+
handler: this,
|
|
75
|
+
target: this.container,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
updated(props) {
|
|
79
|
+
if (props.has('resizeObserver')) {
|
|
80
|
+
const previousObserver = props.get('resizeObserver');
|
|
81
|
+
this.stopResizeObservation(previousObserver);
|
|
82
|
+
this.startResizeObservation();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
get tile() {
|
|
86
|
+
const { model, baseNavigationUrl, currentWidth, currentHeight, sortParam, mobileBreakpoint, } = this;
|
|
87
|
+
if (!model)
|
|
88
|
+
return nothing;
|
|
89
|
+
switch (this.tileDisplayMode) {
|
|
90
|
+
case 'grid':
|
|
91
|
+
switch (model.mediatype) {
|
|
92
|
+
case 'collection':
|
|
93
93
|
return html `<collection-tile
|
|
94
94
|
.model=${model}
|
|
95
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
95
96
|
.currentWidth=${currentWidth}
|
|
96
97
|
.currentHeight=${currentHeight}
|
|
97
98
|
>
|
|
98
|
-
</collection-tile>`;
|
|
99
|
-
case 'account':
|
|
99
|
+
</collection-tile>`;
|
|
100
|
+
case 'account':
|
|
100
101
|
return html `<account-tile
|
|
101
102
|
.model=${model}
|
|
102
103
|
.baseImageUrl=${this.baseImageUrl}
|
|
103
104
|
.currentWidth=${currentWidth}
|
|
104
105
|
.currentHeight=${currentHeight}
|
|
105
106
|
>
|
|
106
|
-
</account-tile>`;
|
|
107
|
-
default:
|
|
107
|
+
</account-tile>`;
|
|
108
|
+
default:
|
|
108
109
|
return html `<item-tile
|
|
109
110
|
.model=${model}
|
|
110
111
|
.currentWidth=${this.currentWidth}
|
|
@@ -114,9 +115,9 @@ let TileDispatcher = class TileDispatcher extends LitElement {
|
|
|
114
115
|
.sortParam=${sortParam}
|
|
115
116
|
.loggedIn=${this.loggedIn}
|
|
116
117
|
>
|
|
117
|
-
</item-tile>`;
|
|
118
|
-
}
|
|
119
|
-
case 'list-compact':
|
|
118
|
+
</item-tile>`;
|
|
119
|
+
}
|
|
120
|
+
case 'list-compact':
|
|
120
121
|
return html `<tile-list-compact
|
|
121
122
|
.model=${model}
|
|
122
123
|
.currentWidth=${currentWidth}
|
|
@@ -127,8 +128,8 @@ let TileDispatcher = class TileDispatcher extends LitElement {
|
|
|
127
128
|
.baseImageUrl=${this.baseImageUrl}
|
|
128
129
|
.loggedIn=${this.loggedIn}
|
|
129
130
|
>
|
|
130
|
-
</tile-list-compact>`;
|
|
131
|
-
case 'list-detail':
|
|
131
|
+
</tile-list-compact>`;
|
|
132
|
+
case 'list-detail':
|
|
132
133
|
return html `<tile-list
|
|
133
134
|
.model=${model}
|
|
134
135
|
.collectionNameCache=${this.collectionNameCache}
|
|
@@ -140,18 +141,34 @@ let TileDispatcher = class TileDispatcher extends LitElement {
|
|
|
140
141
|
.baseImageUrl=${this.baseImageUrl}
|
|
141
142
|
.loggedIn=${this.loggedIn}
|
|
142
143
|
>
|
|
143
|
-
</tile-list>`;
|
|
144
|
-
default:
|
|
145
|
-
return nothing;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
static get styles() {
|
|
144
|
+
</tile-list>`;
|
|
145
|
+
default:
|
|
146
|
+
return nothing;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
static get styles() {
|
|
149
150
|
return css `
|
|
150
151
|
:host {
|
|
151
152
|
display: block;
|
|
152
153
|
height: 100%;
|
|
153
154
|
}
|
|
154
155
|
|
|
156
|
+
collection-tile {
|
|
157
|
+
--tileBorderColor: #555555;
|
|
158
|
+
--tileBackgroundColor: #666666;
|
|
159
|
+
--imageBlockBackgroundColor: #666666;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
account-tile {
|
|
163
|
+
--tileBorderColor: #dddddd;
|
|
164
|
+
--imageBlockBackgroundColor: #fcf5e6;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
item-tile {
|
|
168
|
+
--tileBorderColor: #dddddd;
|
|
169
|
+
--imageBlockBackgroundColor: #f1f1f4;
|
|
170
|
+
}
|
|
171
|
+
|
|
155
172
|
#container {
|
|
156
173
|
height: 100%;
|
|
157
174
|
}
|
|
@@ -171,47 +188,47 @@ let TileDispatcher = class TileDispatcher extends LitElement {
|
|
|
171
188
|
display: block;
|
|
172
189
|
height: 100%;
|
|
173
190
|
}
|
|
174
|
-
`;
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
__decorate([
|
|
178
|
-
property({ type: String })
|
|
179
|
-
], TileDispatcher.prototype, "tileDisplayMode", void 0);
|
|
180
|
-
__decorate([
|
|
181
|
-
property({ type: Object })
|
|
182
|
-
], TileDispatcher.prototype, "model", void 0);
|
|
183
|
-
__decorate([
|
|
184
|
-
property({ type: String })
|
|
185
|
-
], TileDispatcher.prototype, "baseNavigationUrl", void 0);
|
|
186
|
-
__decorate([
|
|
187
|
-
property({ type: Number })
|
|
188
|
-
], TileDispatcher.prototype, "currentWidth", void 0);
|
|
189
|
-
__decorate([
|
|
190
|
-
property({ type: Number })
|
|
191
|
-
], TileDispatcher.prototype, "currentHeight", void 0);
|
|
192
|
-
__decorate([
|
|
193
|
-
property({ type: Object })
|
|
194
|
-
], TileDispatcher.prototype, "resizeObserver", void 0);
|
|
195
|
-
__decorate([
|
|
196
|
-
property({ type: Object })
|
|
197
|
-
], TileDispatcher.prototype, "collectionNameCache", void 0);
|
|
198
|
-
__decorate([
|
|
199
|
-
property({ type: Object })
|
|
200
|
-
], TileDispatcher.prototype, "sortParam", void 0);
|
|
201
|
-
__decorate([
|
|
202
|
-
query('#container')
|
|
203
|
-
], TileDispatcher.prototype, "container", void 0);
|
|
204
|
-
__decorate([
|
|
205
|
-
property({ type: Number })
|
|
206
|
-
], TileDispatcher.prototype, "mobileBreakpoint", void 0);
|
|
207
|
-
__decorate([
|
|
208
|
-
property({ type: String })
|
|
209
|
-
], TileDispatcher.prototype, "baseImageUrl", void 0);
|
|
210
|
-
__decorate([
|
|
211
|
-
property({ type: Boolean })
|
|
212
|
-
], TileDispatcher.prototype, "loggedIn", void 0);
|
|
213
|
-
TileDispatcher = __decorate([
|
|
214
|
-
customElement('tile-dispatcher')
|
|
215
|
-
], TileDispatcher);
|
|
216
|
-
export { TileDispatcher };
|
|
191
|
+
`;
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
__decorate([
|
|
195
|
+
property({ type: String })
|
|
196
|
+
], TileDispatcher.prototype, "tileDisplayMode", void 0);
|
|
197
|
+
__decorate([
|
|
198
|
+
property({ type: Object })
|
|
199
|
+
], TileDispatcher.prototype, "model", void 0);
|
|
200
|
+
__decorate([
|
|
201
|
+
property({ type: String })
|
|
202
|
+
], TileDispatcher.prototype, "baseNavigationUrl", void 0);
|
|
203
|
+
__decorate([
|
|
204
|
+
property({ type: Number })
|
|
205
|
+
], TileDispatcher.prototype, "currentWidth", void 0);
|
|
206
|
+
__decorate([
|
|
207
|
+
property({ type: Number })
|
|
208
|
+
], TileDispatcher.prototype, "currentHeight", void 0);
|
|
209
|
+
__decorate([
|
|
210
|
+
property({ type: Object })
|
|
211
|
+
], TileDispatcher.prototype, "resizeObserver", void 0);
|
|
212
|
+
__decorate([
|
|
213
|
+
property({ type: Object })
|
|
214
|
+
], TileDispatcher.prototype, "collectionNameCache", void 0);
|
|
215
|
+
__decorate([
|
|
216
|
+
property({ type: Object })
|
|
217
|
+
], TileDispatcher.prototype, "sortParam", void 0);
|
|
218
|
+
__decorate([
|
|
219
|
+
query('#container')
|
|
220
|
+
], TileDispatcher.prototype, "container", void 0);
|
|
221
|
+
__decorate([
|
|
222
|
+
property({ type: Number })
|
|
223
|
+
], TileDispatcher.prototype, "mobileBreakpoint", void 0);
|
|
224
|
+
__decorate([
|
|
225
|
+
property({ type: String })
|
|
226
|
+
], TileDispatcher.prototype, "baseImageUrl", void 0);
|
|
227
|
+
__decorate([
|
|
228
|
+
property({ type: Boolean })
|
|
229
|
+
], TileDispatcher.prototype, "loggedIn", void 0);
|
|
230
|
+
TileDispatcher = __decorate([
|
|
231
|
+
customElement('tile-dispatcher')
|
|
232
|
+
], TileDispatcher);
|
|
233
|
+
export { TileDispatcher };
|
|
217
234
|
//# sourceMappingURL=tile-dispatcher.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAQzD,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,0BAA0B,CAAC;AAClC,OAAO,iCAAiC,CAAC;AAGzC,IAAa,cAAc,G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,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAoC;AAE1C;IAApB,KAAK,CAAC,YAAY,CAAC;iDAAoC;AAE5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA2B;AAE1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAuB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAkB;AA3BnC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAiN1B;SAjNY,cAAc","sourcesContent":["import { css, html, LitElement, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { SortParam } from '@internetarchive/search-service';\nimport type { TileDisplayMode, TileModel } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface\n{\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @query('#container') private container!: HTMLDivElement;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) loggedIn = false;\n\n render() {\n return html`\n <div id=\"container\">\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n </div>\n `;\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=\"${this.baseNavigationUrl}/details/${this.model?.identifier}\"\n title=${ifDefined(this.model?.title)}\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n )}\n >\n ${this.tile}\n </a>\n `;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n private get tile() {\n const {\n model,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .loggedIn=${this.loggedIn}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n #container {\n height: 100%;\n }\n\n #delete-button {\n float: right;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,E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,MAAM,EAAE,CAAC;oDAAuB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAgD;AAG3E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAoC;AAE1C;IAApB,KAAK,CAAC,YAAY,CAAC;iDAAoC;AAE5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA2B;AAE1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAuB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAkB;AA3BnC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAkO1B;SAlOY,cAAc","sourcesContent":["import { css, html, LitElement, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { SortParam } from '@internetarchive/search-service';\nimport type { TileDisplayMode, TileModel } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface\n{\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @query('#container') private container!: HTMLDivElement;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) loggedIn = false;\n\n render() {\n return html`\n <div id=\"container\">\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n </div>\n `;\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=\"${this.baseNavigationUrl}/details/${this.model?.identifier}\"\n title=${ifDefined(this.model?.title)}\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n )}\n >\n ${this.tile}\n </a>\n `;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n private get tile() {\n const {\n model,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .loggedIn=${this.loggedIn}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n #container {\n height: 100%;\n }\n\n #delete-button {\n float: right;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n `;\n }\n}\n"]}
|