@internetarchive/collection-browser 3.3.1 → 3.3.3
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 +27 -27
- 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/.prettierignore +1 -1
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/src/collection-browser.js +683 -683
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.js +118 -118
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets.js +265 -266
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +36 -36
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +77 -77
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +137 -137
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +9 -1
- package/dist/src/tiles/hover/hover-pane-controller.js +105 -37
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +1 -0
- package/dist/src/tiles/hover/tile-hover-pane.js +115 -112
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +99 -99
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +297 -297
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +4 -1
- package/dist/src/tiles/tile-dispatcher.js +231 -204
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/utils/format-date.js.map +1 -1
- package/dist/test/collection-browser.test.js +189 -189
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +77 -77
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +68 -21
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +70 -70
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +126 -126
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +130 -52
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/dist/test/utils/format-date.test.js.map +1 -1
- package/eslint.config.mjs +53 -53
- package/index.html +24 -24
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +118 -117
- package/renovate.json +6 -6
- package/src/collection-browser.ts +2829 -2829
- package/src/collection-facets/more-facets-content.ts +639 -639
- package/src/collection-facets.ts +994 -995
- package/src/data-source/collection-browser-data-source.ts +1401 -1401
- package/src/data-source/collection-browser-query-state.ts +65 -65
- package/src/data-source/models.ts +43 -43
- package/src/tiles/base-tile-component.ts +65 -65
- package/src/tiles/grid/account-tile.ts +113 -113
- package/src/tiles/grid/collection-tile.ts +163 -163
- package/src/tiles/grid/item-tile.ts +340 -340
- package/src/tiles/hover/hover-pane-controller.ts +613 -517
- package/src/tiles/hover/tile-hover-pane.ts +184 -180
- package/src/tiles/list/tile-list-compact.ts +239 -239
- package/src/tiles/list/tile-list.ts +700 -700
- package/src/tiles/tile-dispatcher.ts +517 -490
- package/src/utils/format-date.ts +62 -62
- package/test/collection-browser.test.ts +2403 -2403
- package/test/tiles/grid/item-tile.test.ts +520 -520
- package/test/tiles/hover/hover-pane-controller.test.ts +418 -353
- package/test/tiles/list/tile-list-compact.test.ts +282 -282
- package/test/tiles/list/tile-list.test.ts +552 -552
- package/test/tiles/tile-dispatcher.test.ts +283 -187
- package/test/utils/format-date.test.ts +89 -89
- package/tsconfig.json +20 -20
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -1,180 +1,184 @@
|
|
|
1
|
-
import type { SortParam } from '@internetarchive/search-service';
|
|
2
|
-
import {
|
|
3
|
-
css,
|
|
4
|
-
CSSResultGroup,
|
|
5
|
-
html,
|
|
6
|
-
LitElement,
|
|
7
|
-
nothing,
|
|
8
|
-
TemplateResult,
|
|
9
|
-
} from 'lit';
|
|
10
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
11
|
-
import
|
|
12
|
-
|
|
13
|
-
import '
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
@property({ type:
|
|
20
|
-
|
|
21
|
-
@property({ type: String })
|
|
22
|
-
|
|
23
|
-
@property({ type:
|
|
24
|
-
|
|
25
|
-
@property({ type: Boolean })
|
|
26
|
-
|
|
27
|
-
@property({ type:
|
|
28
|
-
|
|
29
|
-
@property({ type:
|
|
30
|
-
|
|
31
|
-
@property({ type: Number })
|
|
32
|
-
|
|
33
|
-
@property({ type:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
:host(.
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
1
|
+
import type { SortParam } from '@internetarchive/search-service';
|
|
2
|
+
import {
|
|
3
|
+
css,
|
|
4
|
+
CSSResultGroup,
|
|
5
|
+
html,
|
|
6
|
+
LitElement,
|
|
7
|
+
nothing,
|
|
8
|
+
TemplateResult,
|
|
9
|
+
} from 'lit';
|
|
10
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
11
|
+
import '@a11y/focus-trap';
|
|
12
|
+
|
|
13
|
+
import { suppressedCollections, type TileModel } from '../../models';
|
|
14
|
+
import type { CollectionTitles } from '../../data-source/models';
|
|
15
|
+
import '../list/tile-list';
|
|
16
|
+
|
|
17
|
+
@customElement('tile-hover-pane')
|
|
18
|
+
export class TileHoverPane extends LitElement {
|
|
19
|
+
@property({ type: Object }) model?: TileModel;
|
|
20
|
+
|
|
21
|
+
@property({ type: String }) baseNavigationUrl?: string;
|
|
22
|
+
|
|
23
|
+
@property({ type: String }) baseImageUrl?: string;
|
|
24
|
+
|
|
25
|
+
@property({ type: Boolean }) loggedIn: boolean = false;
|
|
26
|
+
|
|
27
|
+
@property({ type: Boolean }) suppressBlurring: boolean = false;
|
|
28
|
+
|
|
29
|
+
@property({ type: Object }) sortParam?: SortParam;
|
|
30
|
+
|
|
31
|
+
@property({ type: Number }) mobileBreakpoint?: number;
|
|
32
|
+
|
|
33
|
+
@property({ type: Number }) currentWidth?: number;
|
|
34
|
+
|
|
35
|
+
@property({ type: Object })
|
|
36
|
+
collectionTitles?: CollectionTitles;
|
|
37
|
+
|
|
38
|
+
protected render(): TemplateResult {
|
|
39
|
+
return html`
|
|
40
|
+
<div id="container">
|
|
41
|
+
<focus-trap>
|
|
42
|
+
${this.headerTemplate}
|
|
43
|
+
<div id="hover-tile-list">
|
|
44
|
+
<tile-list
|
|
45
|
+
.model=${this.model}
|
|
46
|
+
.baseNavigationUrl=${this.baseNavigationUrl}
|
|
47
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
48
|
+
.loggedIn=${this.loggedIn}
|
|
49
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
50
|
+
.sortParam=${this.sortParam}
|
|
51
|
+
.collectionTitles=${this.collectionTitles}
|
|
52
|
+
.mobileBreakpoint=${this.mobileBreakpoint}
|
|
53
|
+
.currentWidth=${this.currentWidth}
|
|
54
|
+
></tile-list>
|
|
55
|
+
</div>
|
|
56
|
+
</focus-trap>
|
|
57
|
+
</div>
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
private get headerTemplate(): TemplateResult | typeof nothing {
|
|
62
|
+
// early return if item does't have parent collection
|
|
63
|
+
if (this.model?.collections?.length === 0) return nothing;
|
|
64
|
+
|
|
65
|
+
let collectionTitle = '';
|
|
66
|
+
let collectionIdentifier = '';
|
|
67
|
+
|
|
68
|
+
for (const collection of this.model?.collections || []) {
|
|
69
|
+
if (
|
|
70
|
+
!suppressedCollections[collection] &&
|
|
71
|
+
!collection.startsWith('fav-')
|
|
72
|
+
) {
|
|
73
|
+
collectionTitle = this.collectionTitles?.get(collection) ?? collection;
|
|
74
|
+
collectionIdentifier = collection;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
// sometimes item does have collections but they are in suppressed or favorite list,
|
|
80
|
+
// let's not render that
|
|
81
|
+
if (!collectionIdentifier) return nothing;
|
|
82
|
+
|
|
83
|
+
return html`
|
|
84
|
+
<div id="list-line-header">
|
|
85
|
+
<a href="${this.baseNavigationUrl}/details/${collectionIdentifier}">
|
|
86
|
+
<img
|
|
87
|
+
src="${this.baseImageUrl}/services/img/${collectionIdentifier}"
|
|
88
|
+
alt=""
|
|
89
|
+
/><span>${collectionTitle}</span>
|
|
90
|
+
</a>
|
|
91
|
+
</div>
|
|
92
|
+
`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
static get styles(): CSSResultGroup {
|
|
96
|
+
const hoverPaneHeaderBGColor = css`var(--hoverPaneHeaderBGColor, #edf0ff)`;
|
|
97
|
+
const iaLinkColor = css`var(--ia-theme-link-color, #4b64ff)`;
|
|
98
|
+
const iaFontFamily = css`var(--ia-theme-base-font-family, "Helvetica Neue", Helvetica, Arial, sans-serif);`;
|
|
99
|
+
|
|
100
|
+
return css`
|
|
101
|
+
:host {
|
|
102
|
+
margin: 0;
|
|
103
|
+
border: 0;
|
|
104
|
+
padding: 0;
|
|
105
|
+
overflow: visible;
|
|
106
|
+
color: inherit;
|
|
107
|
+
background: none;
|
|
108
|
+
visibility: hidden;
|
|
109
|
+
opacity: 0;
|
|
110
|
+
transform: translateY(8px);
|
|
111
|
+
transition:
|
|
112
|
+
opacity 0.1s ease-in,
|
|
113
|
+
transform 0.1s ease-in;
|
|
114
|
+
--image-width: auto;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
:host(.visible) {
|
|
118
|
+
visibility: visible;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
:host(.fade-in) {
|
|
122
|
+
opacity: 1;
|
|
123
|
+
transform: translateY(0);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@media (prefers-reduced-motion: reduce) {
|
|
127
|
+
:host {
|
|
128
|
+
transition-duration: 0.001s !important; /* Imperceptibly fast */
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
#container {
|
|
133
|
+
width: max-content;
|
|
134
|
+
max-width: min(45vw, 600px);
|
|
135
|
+
border: 1px solid #ddd;
|
|
136
|
+
border-radius: 4px;
|
|
137
|
+
box-shadow: 4px 4px 8px 0 rgba(0, 0, 0, 0.8);
|
|
138
|
+
background: white;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
@media screen and (max-width: 600px) {
|
|
142
|
+
#container {
|
|
143
|
+
max-width: 80vw;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
/* main tile-list container */
|
|
148
|
+
#hover-tile-list {
|
|
149
|
+
padding: 10px;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* header on hover panel to show collection icon and title */
|
|
153
|
+
#list-line-header {
|
|
154
|
+
background: ${hoverPaneHeaderBGColor};
|
|
155
|
+
}
|
|
156
|
+
#list-line-header a {
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
column-gap: 5px;
|
|
160
|
+
height: 3.4rem;
|
|
161
|
+
padding: 0 10px;
|
|
162
|
+
border-radius: 4px 4px 0 0;
|
|
163
|
+
width: fit-content;
|
|
164
|
+
font-size: 1.4rem;
|
|
165
|
+
color: ${iaLinkColor};
|
|
166
|
+
font-family: ${iaFontFamily};
|
|
167
|
+
text-decoration: none;
|
|
168
|
+
width: auto;
|
|
169
|
+
}
|
|
170
|
+
#list-line-header a span {
|
|
171
|
+
white-space: nowrap;
|
|
172
|
+
overflow: hidden;
|
|
173
|
+
text-overflow: ellipsis;
|
|
174
|
+
}
|
|
175
|
+
#list-line-header a:hover {
|
|
176
|
+
text-decoration: underline;
|
|
177
|
+
}
|
|
178
|
+
#list-line-header a img {
|
|
179
|
+
width: 30px;
|
|
180
|
+
max-height: 30px;
|
|
181
|
+
}
|
|
182
|
+
`;
|
|
183
|
+
}
|
|
184
|
+
}
|