@internetarchive/collection-browser 4.4.1 → 4.5.1-alpha-webdev8221.0
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 +1 -1
- package/.prettierignore +1 -1
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/index.d.ts +1 -0
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.d.ts +8 -0
- package/dist/src/app-root.js +26 -0
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +8 -4
- package/dist/src/collection-browser.js +20 -11
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.d.ts +6 -0
- package/dist/src/collection-facets/facet-row.js +19 -1
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/facets-template.js +2 -0
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source-interface.d.ts +5 -0
- package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.d.ts +1 -1
- package/dist/src/data-source/collection-browser-data-source.js +8 -6
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/restoration-state-handler.js +2 -4
- package/dist/src/restoration-state-handler.js.map +1 -1
- package/dist/src/styles/tile-action-styles.d.ts +14 -0
- package/dist/src/styles/tile-action-styles.js +59 -0
- package/dist/src/styles/tile-action-styles.js.map +1 -0
- package/dist/src/tiles/base-tile-component.d.ts +17 -1
- package/dist/src/tiles/base-tile-component.js +50 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +1 -0
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact-header.js +27 -2
- package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.d.ts +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +113 -75
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +1 -1
- package/dist/src/tiles/list/tile-list.js +164 -146
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/models.d.ts +11 -0
- package/dist/src/tiles/models.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +14 -0
- package/dist/src/tiles/tile-dispatcher.js +107 -4
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/utils/date-filter-field.d.ts +6 -0
- package/dist/src/utils/date-filter-field.js +9 -0
- package/dist/src/utils/date-filter-field.js.map +1 -0
- package/dist/test/collection-browser.test.js +81 -0
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/collection-facets/facet-row.test.js +32 -0
- package/dist/test/collection-facets/facet-row.test.js.map +1 -1
- package/eslint.config.mjs +53 -53
- package/index.html +24 -24
- package/index.ts +1 -0
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +120 -120
- package/renovate.json +6 -6
- package/src/app-root.ts +30 -0
- package/src/collection-browser.ts +17 -13
- package/src/collection-facets/facet-row.ts +11 -1
- package/src/collection-facets/facets-template.ts +2 -0
- package/src/data-source/collection-browser-data-source-interface.ts +6 -0
- package/src/data-source/collection-browser-data-source.ts +16 -7
- package/src/restoration-state-handler.ts +5 -5
- package/src/styles/tile-action-styles.ts +59 -0
- package/src/tiles/base-tile-component.ts +60 -1
- package/src/tiles/grid/item-tile.ts +1 -0
- package/src/tiles/list/tile-list-compact-header.ts +28 -2
- package/src/tiles/list/tile-list-compact.ts +114 -75
- package/src/tiles/list/tile-list.ts +190 -172
- package/src/tiles/models.ts +13 -0
- package/src/tiles/tile-dispatcher.ts +114 -4
- package/src/utils/date-filter-field.ts +11 -0
- package/test/collection-browser.test.ts +132 -0
- package/test/collection-facets/facet-row.test.ts +46 -0
- package/tsconfig.json +25 -25
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +52 -52
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { css, html } from 'lit';
|
|
1
|
+
import { css, html, nothing } from 'lit';
|
|
2
2
|
import { customElement } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
3
4
|
import { msg } from '@lit/localize';
|
|
4
5
|
import { BaseTileComponent } from '../base-tile-component';
|
|
5
6
|
|
|
@@ -8,6 +9,7 @@ export class TileListCompactHeader extends BaseTileComponent {
|
|
|
8
9
|
/*
|
|
9
10
|
* Reactive properties inherited from BaseTileComponent:
|
|
10
11
|
* - model?: TileModel;
|
|
12
|
+
* - tileActions: TileAction[] = [];
|
|
11
13
|
* - currentWidth?: number;
|
|
12
14
|
* - currentHeight?: number;
|
|
13
15
|
* - baseNavigationUrl?: string;
|
|
@@ -21,9 +23,17 @@ export class TileListCompactHeader extends BaseTileComponent {
|
|
|
21
23
|
*/
|
|
22
24
|
|
|
23
25
|
render() {
|
|
26
|
+
const hasActions = this.tileActions.length > 0;
|
|
27
|
+
const headerClasses = classMap({
|
|
28
|
+
mobile: this.classSize === 'mobile',
|
|
29
|
+
desktop: this.classSize === 'desktop',
|
|
30
|
+
'has-actions': hasActions,
|
|
31
|
+
});
|
|
32
|
+
|
|
24
33
|
return html`
|
|
25
|
-
<div id="list-line-header" class
|
|
34
|
+
<div id="list-line-header" class=${headerClasses}>
|
|
26
35
|
<div id="thumb"></div>
|
|
36
|
+
${hasActions ? html`<div id="actions-header"></div>` : nothing}
|
|
27
37
|
<div id="title">${msg('Title')}</div>
|
|
28
38
|
<div id="creator">${msg('Creator')}</div>
|
|
29
39
|
<div id="date">
|
|
@@ -81,6 +91,22 @@ export class TileListCompactHeader extends BaseTileComponent {
|
|
|
81
91
|
#list-line-header.desktop {
|
|
82
92
|
grid-template-columns: 51px 3fr 2fr 95px 30px 115px;
|
|
83
93
|
}
|
|
94
|
+
|
|
95
|
+
/*
|
|
96
|
+
* When tile actions are present in the rows below, reserve a matching
|
|
97
|
+
* column here so the columns stay aligned with each row.
|
|
98
|
+
*/
|
|
99
|
+
#list-line-header.mobile.has-actions {
|
|
100
|
+
grid-template-columns:
|
|
101
|
+
36px var(--tileActionColumnWidth, 90px) 3fr 2fr
|
|
102
|
+
68px 35px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
#list-line-header.desktop.has-actions {
|
|
106
|
+
grid-template-columns:
|
|
107
|
+
51px var(--tileActionColumnWidth, 100px) 3fr 2fr
|
|
108
|
+
95px 30px 115px;
|
|
109
|
+
}
|
|
84
110
|
`;
|
|
85
111
|
}
|
|
86
112
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css, html, nothing } from 'lit';
|
|
2
2
|
import { customElement } from 'lit/decorators.js';
|
|
3
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
3
4
|
import DOMPurify from 'dompurify';
|
|
4
5
|
import type { SortParam } from '@internetarchive/search-service';
|
|
5
6
|
import { BaseTileComponent } from '../base-tile-component';
|
|
@@ -7,6 +8,7 @@ import { BaseTileComponent } from '../base-tile-component';
|
|
|
7
8
|
import { formatCount, NumberFormat } from '../../utils/format-count';
|
|
8
9
|
import type { DateFormat } from '../../utils/format-date';
|
|
9
10
|
import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
|
|
11
|
+
import { tileActionStyles } from '../../styles/tile-action-styles';
|
|
10
12
|
|
|
11
13
|
import '../image-block';
|
|
12
14
|
import '../tile-mediatype-icon';
|
|
@@ -16,6 +18,7 @@ export class TileListCompact extends BaseTileComponent {
|
|
|
16
18
|
/*
|
|
17
19
|
* Reactive properties inherited from BaseTileComponent:
|
|
18
20
|
* - model?: TileModel;
|
|
21
|
+
* - tileActions: TileAction[] = [];
|
|
19
22
|
* - currentWidth?: number;
|
|
20
23
|
* - currentHeight?: number;
|
|
21
24
|
* - baseNavigationUrl?: string;
|
|
@@ -31,8 +34,15 @@ export class TileListCompact extends BaseTileComponent {
|
|
|
31
34
|
*/
|
|
32
35
|
|
|
33
36
|
render() {
|
|
37
|
+
const hasActions = this.tileActions.length > 0;
|
|
38
|
+
const lineClasses = classMap({
|
|
39
|
+
mobile: this.classSize === 'mobile',
|
|
40
|
+
desktop: this.classSize === 'desktop',
|
|
41
|
+
'has-actions': hasActions,
|
|
42
|
+
});
|
|
43
|
+
|
|
34
44
|
return html`
|
|
35
|
-
<div id="list-line" class
|
|
45
|
+
<div id="list-line" class=${lineClasses}>
|
|
36
46
|
<image-block
|
|
37
47
|
.model=${this.model}
|
|
38
48
|
.baseImageUrl=${this.baseImageUrl}
|
|
@@ -43,6 +53,11 @@ export class TileListCompact extends BaseTileComponent {
|
|
|
43
53
|
.suppressBlurring=${this.suppressBlurring}
|
|
44
54
|
>
|
|
45
55
|
</image-block>
|
|
56
|
+
${hasActions
|
|
57
|
+
? html`<div id="actions">
|
|
58
|
+
${this.renderTileActions('list-compact')}
|
|
59
|
+
</div>`
|
|
60
|
+
: nothing}
|
|
46
61
|
<a href=${this.href} id="title"
|
|
47
62
|
>${DOMPurify.sanitize(this.model?.title ?? '')}</a
|
|
48
63
|
>
|
|
@@ -161,79 +176,103 @@ export class TileListCompact extends BaseTileComponent {
|
|
|
161
176
|
}
|
|
162
177
|
|
|
163
178
|
static get styles() {
|
|
164
|
-
return
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
179
|
+
return [
|
|
180
|
+
tileActionStyles,
|
|
181
|
+
css`
|
|
182
|
+
html {
|
|
183
|
+
font-size: unset;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
div {
|
|
187
|
+
font-size: 14px;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
#list-line {
|
|
191
|
+
display: grid;
|
|
192
|
+
column-gap: 10px;
|
|
193
|
+
border-top: 1px solid #ddd;
|
|
194
|
+
align-items: center;
|
|
195
|
+
line-height: 20px;
|
|
196
|
+
padding-top: 5px;
|
|
197
|
+
margin-bottom: -5px;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
#list-line.mobile {
|
|
201
|
+
grid-template-columns: 36px 3fr 2fr 68px 35px;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
#list-line.desktop {
|
|
205
|
+
grid-template-columns: 51px 3fr 2fr 95px 30px 115px;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/*
|
|
209
|
+
* When tile actions are present, insert an extra column for them
|
|
210
|
+
* between the thumbnail and the title.
|
|
211
|
+
*/
|
|
212
|
+
#list-line.mobile.has-actions {
|
|
213
|
+
grid-template-columns:
|
|
214
|
+
36px var(--tileActionColumnWidth, 90px)
|
|
215
|
+
3fr 2fr 68px 35px;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
#list-line.desktop.has-actions {
|
|
219
|
+
grid-template-columns:
|
|
220
|
+
51px var(--tileActionColumnWidth, 100px)
|
|
221
|
+
3fr 2fr 95px 30px 115px;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
#actions {
|
|
225
|
+
/* The flex container inside is what holds the action buttons */
|
|
226
|
+
display: flex;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
#list-line:hover #title {
|
|
230
|
+
text-decoration: underline;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
#title {
|
|
234
|
+
text-decoration: none;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
#title:link {
|
|
238
|
+
color: var(--ia-theme-link-color, #4b64ff);
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
#title,
|
|
242
|
+
#creator {
|
|
243
|
+
text-overflow: ellipsis;
|
|
244
|
+
overflow: hidden;
|
|
245
|
+
white-space: nowrap;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
#icon {
|
|
249
|
+
margin-left: 2px;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
#views {
|
|
253
|
+
text-align: right;
|
|
254
|
+
padding-right: 8px;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.mobile #views {
|
|
258
|
+
display: none;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.mobile tile-mediatype-icon {
|
|
262
|
+
--iconHeight: 14px;
|
|
263
|
+
--iconWidth: 14px;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.desktop #icon {
|
|
267
|
+
--iconHeight: 20px;
|
|
268
|
+
--iconWidth: 20px;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
item-image {
|
|
272
|
+
--imgHeight: 100%;
|
|
273
|
+
--imgWidth: 100%;
|
|
274
|
+
}
|
|
275
|
+
`,
|
|
276
|
+
];
|
|
238
277
|
}
|
|
239
278
|
}
|