@internetarchive/collection-browser 3.0.1 → 3.0.2
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 +1 -0
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facet-row.js +2 -1
- package/dist/src/collection-facets/facet-row.js.map +1 -1
- package/dist/src/collection-facets/models.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 +3 -1
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +3 -2
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +2 -2
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/grid/search-tile.js +3 -2
- package/dist/src/tiles/grid/search-tile.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +3 -2
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +13 -3
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +13 -0
- package/dist/test/tiles/list/tile-list.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 +117 -117
- package/renovate.json +6 -6
- package/src/collection-browser.ts +1 -0
- package/src/collection-facets/facet-row.ts +2 -1
- package/src/collection-facets/models.ts +10 -10
- package/src/collection-facets/more-facets-content.ts +636 -636
- package/src/collection-facets.ts +3 -1
- package/src/tiles/grid/collection-tile.ts +3 -2
- package/src/tiles/grid/item-tile.ts +2 -2
- package/src/tiles/grid/search-tile.ts +3 -2
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +3 -2
- package/src/tiles/list/tile-list.ts +11 -3
- package/test/tiles/list/tile-list.test.ts +15 -0
- package/tsconfig.json +20 -20
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
package/src/collection-facets.ts
CHANGED
|
@@ -397,6 +397,7 @@ export class CollectionFacets extends LitElement {
|
|
|
397
397
|
? html`<button
|
|
398
398
|
class="expand-date-picker-btn"
|
|
399
399
|
aria-hidden="true"
|
|
400
|
+
tabindex="-1"
|
|
400
401
|
@click=${this.showDatePickerModal}
|
|
401
402
|
>
|
|
402
403
|
${expandIcon}
|
|
@@ -425,7 +426,7 @@ export class CollectionFacets extends LitElement {
|
|
|
425
426
|
|
|
426
427
|
return html`
|
|
427
428
|
<histogram-date-range
|
|
428
|
-
class=${this.isTvSearch ? 'wide-inputs' :
|
|
429
|
+
class=${this.isTvSearch ? 'wide-inputs' : ''}
|
|
429
430
|
.minDate=${minDate}
|
|
430
431
|
.maxDate=${maxDate}
|
|
431
432
|
.minSelectedDate=${this.minSelectedDate ?? minDate}
|
|
@@ -951,6 +952,7 @@ export class CollectionFacets extends LitElement {
|
|
|
951
952
|
font-size: 1.2rem;
|
|
952
953
|
text-decoration: none;
|
|
953
954
|
padding: 0;
|
|
955
|
+
margin-top: 0.25rem;
|
|
954
956
|
background: inherit;
|
|
955
957
|
border: 0;
|
|
956
958
|
color: var(--ia-theme-link-color, #4b64ff);
|
|
@@ -55,7 +55,7 @@ export class CollectionTile extends BaseTileComponent {
|
|
|
55
55
|
|
|
56
56
|
private get getTitleTemplate() {
|
|
57
57
|
return html`<div id="title">
|
|
58
|
-
<
|
|
58
|
+
<h3 class="truncated">${this.model?.title}</h3>
|
|
59
59
|
</div>`;
|
|
60
60
|
}
|
|
61
61
|
|
|
@@ -123,7 +123,8 @@ export class CollectionTile extends BaseTileComponent {
|
|
|
123
123
|
flex-grow: initial;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
h4.truncated
|
|
126
|
+
h4.truncated,
|
|
127
|
+
h3.truncated {
|
|
127
128
|
color: ${whiteColor};
|
|
128
129
|
}
|
|
129
130
|
|
|
@@ -60,9 +60,9 @@ export class ItemTile extends BaseTileComponent {
|
|
|
60
60
|
${this.imageBlockTemplate}
|
|
61
61
|
|
|
62
62
|
<div id="title">
|
|
63
|
-
<
|
|
63
|
+
<h3 class="truncated" title=${ifDefined(itemTitle)}>
|
|
64
64
|
${itemTitle}
|
|
65
|
-
</
|
|
65
|
+
</h3>
|
|
66
66
|
</div>
|
|
67
67
|
|
|
68
68
|
${this.volumeIssueTemplate}
|
|
@@ -49,7 +49,7 @@ export class SearchTile extends BaseTileComponent {
|
|
|
49
49
|
|
|
50
50
|
private get getTitleTemplate() {
|
|
51
51
|
return html`<div id="title">
|
|
52
|
-
<
|
|
52
|
+
<h3 class="truncated">${this.model?.title}</h3>
|
|
53
53
|
</div>`;
|
|
54
54
|
}
|
|
55
55
|
|
|
@@ -70,7 +70,8 @@ export class SearchTile extends BaseTileComponent {
|
|
|
70
70
|
flex-grow: initial;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
h4.truncated
|
|
73
|
+
h4.truncated,
|
|
74
|
+
h3.truncated {
|
|
74
75
|
color: ${whiteColor};
|
|
75
76
|
-webkit-line-clamp: 4;
|
|
76
77
|
}
|
|
@@ -72,7 +72,8 @@ export const baseTileStyles = css`
|
|
|
72
72
|
-webkit-box-orient: vertical;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
h4.truncated
|
|
75
|
+
h4.truncated,
|
|
76
|
+
h3.truncated {
|
|
76
77
|
display: -webkit-box;
|
|
77
78
|
margin: 0px;
|
|
78
79
|
line-height: 15px;
|
|
@@ -114,7 +115,7 @@ export const baseTileStyles = css`
|
|
|
114
115
|
align-items: center;
|
|
115
116
|
background: rgba(220, 220, 220, 0.5);
|
|
116
117
|
color: white;
|
|
117
|
-
font-size:
|
|
118
|
+
font-size: 2.4rem;
|
|
118
119
|
font-weight: bold;
|
|
119
120
|
line-height: 1;
|
|
120
121
|
text-shadow: black 1px 1px 3px;
|
|
@@ -4,7 +4,7 @@ import { join } from 'lit/directives/join.js';
|
|
|
4
4
|
import { map } from 'lit/directives/map.js';
|
|
5
5
|
import { unsafeHTML } from 'lit/directives/unsafe-html.js';
|
|
6
6
|
import { customElement, property, state } from 'lit/decorators.js';
|
|
7
|
-
import { msg } from '@lit/localize';
|
|
7
|
+
import { msg, str } from '@lit/localize';
|
|
8
8
|
import DOMPurify from 'dompurify';
|
|
9
9
|
|
|
10
10
|
import type { SortParam } from '@internetarchive/search-service';
|
|
@@ -94,7 +94,11 @@ export class TileList extends BaseTileComponent {
|
|
|
94
94
|
isCollection,
|
|
95
95
|
);
|
|
96
96
|
|
|
97
|
-
return html`<a
|
|
97
|
+
return html`<a
|
|
98
|
+
id="image-link"
|
|
99
|
+
title=${msg(str`View ${this.model?.title}`)}
|
|
100
|
+
href=${href}
|
|
101
|
+
>
|
|
98
102
|
<image-block
|
|
99
103
|
.model=${this.model}
|
|
100
104
|
.baseImageUrl=${this.baseImageUrl}
|
|
@@ -127,7 +131,11 @@ export class TileList extends BaseTileComponent {
|
|
|
127
131
|
// Data templates
|
|
128
132
|
private get iconRightTemplate() {
|
|
129
133
|
return html`
|
|
130
|
-
<a
|
|
134
|
+
<a
|
|
135
|
+
id="icon-right"
|
|
136
|
+
href=${this.mediatypeURL}
|
|
137
|
+
title=${msg(str`See more: ${this.model?.mediatype}`)}
|
|
138
|
+
>
|
|
131
139
|
<tile-mediatype-icon .model=${this.model}> </tile-mediatype-icon>
|
|
132
140
|
</a>
|
|
133
141
|
`;
|
|
@@ -49,6 +49,20 @@ describe('List Tile', () => {
|
|
|
49
49
|
expect(title?.getAttribute('href')).to.equal('/foo/bar');
|
|
50
50
|
});
|
|
51
51
|
|
|
52
|
+
it('should add title to image link if provided', async () => {
|
|
53
|
+
const el = await fixture<TileList>(html`
|
|
54
|
+
<tile-list
|
|
55
|
+
.baseNavigationUrl=${''}
|
|
56
|
+
.model=${{ title: 'foo', href: '/foo/bar' }}
|
|
57
|
+
></tile-list>
|
|
58
|
+
`);
|
|
59
|
+
|
|
60
|
+
const imageLink = el.shadowRoot?.querySelector('#image-link');
|
|
61
|
+
|
|
62
|
+
expect(imageLink).to.exist;
|
|
63
|
+
expect(imageLink?.getAttribute('title')).to.equal('View foo');
|
|
64
|
+
});
|
|
65
|
+
|
|
52
66
|
it('should render with creator element but not dates', async () => {
|
|
53
67
|
const el = await fixture<TileList>(html`
|
|
54
68
|
<tile-list .model=${{ creators: ['someone'] }}></tile-list>
|
|
@@ -324,6 +338,7 @@ describe('List Tile', () => {
|
|
|
324
338
|
expect(mediatypeLink?.getAttribute('href')).to.equal(
|
|
325
339
|
`https://archive.org/details/texts`,
|
|
326
340
|
);
|
|
341
|
+
expect(mediatypeLink?.getAttribute('title')).to.equal('See more: texts');
|
|
327
342
|
});
|
|
328
343
|
|
|
329
344
|
it('should render mediatype icon as link even with empty baseNavigationUrl', async () => {
|
package/tsconfig.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es2018",
|
|
4
|
-
"module": "esnext",
|
|
5
|
-
"moduleResolution": "node",
|
|
6
|
-
"noEmitOnError": true,
|
|
7
|
-
"lib": ["es2017", "dom", "dom.iterable"],
|
|
8
|
-
"strict": true,
|
|
9
|
-
"esModuleInterop": false,
|
|
10
|
-
"allowSyntheticDefaultImports": true,
|
|
11
|
-
"experimentalDecorators": true,
|
|
12
|
-
"importHelpers": true,
|
|
13
|
-
"outDir": "dist",
|
|
14
|
-
"sourceMap": true,
|
|
15
|
-
"inlineSources": true,
|
|
16
|
-
"rootDir": "./",
|
|
17
|
-
"declaration": true,
|
|
18
|
-
},
|
|
19
|
-
"include": ["src", "test", "index.ts", "types"],
|
|
20
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2018",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"moduleResolution": "node",
|
|
6
|
+
"noEmitOnError": true,
|
|
7
|
+
"lib": ["es2017", "dom", "dom.iterable"],
|
|
8
|
+
"strict": true,
|
|
9
|
+
"esModuleInterop": false,
|
|
10
|
+
"allowSyntheticDefaultImports": true,
|
|
11
|
+
"experimentalDecorators": true,
|
|
12
|
+
"importHelpers": true,
|
|
13
|
+
"outDir": "dist",
|
|
14
|
+
"sourceMap": true,
|
|
15
|
+
"inlineSources": true,
|
|
16
|
+
"rootDir": "./",
|
|
17
|
+
"declaration": true,
|
|
18
|
+
},
|
|
19
|
+
"include": ["src", "test", "index.ts", "types"],
|
|
20
|
+
}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
-
|
|
3
|
-
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
-
const hmr = process.argv.includes('--hmr');
|
|
5
|
-
|
|
6
|
-
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
-
nodeResolve: true,
|
|
8
|
-
open: '/',
|
|
9
|
-
watch: !hmr,
|
|
10
|
-
|
|
11
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
12
|
-
// esbuildTarget: 'auto'
|
|
13
|
-
|
|
14
|
-
/** Set appIndex to enable SPA routing */
|
|
15
|
-
// appIndex: 'demo/index.html',
|
|
16
|
-
|
|
17
|
-
/** Confgure bare import resolve plugin */
|
|
18
|
-
// nodeResolve: {
|
|
19
|
-
// exportConditions: ['browser', 'development']
|
|
20
|
-
// },
|
|
21
|
-
|
|
22
|
-
plugins: [
|
|
23
|
-
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
24
|
-
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
25
|
-
],
|
|
26
|
-
|
|
27
|
-
http2: true,
|
|
28
|
-
sslCert: './local.archive.org.cert',
|
|
29
|
-
sslKey: './local.archive.org.key',
|
|
30
|
-
});
|
|
1
|
+
// import { hmrPlugin, presets } from '@open-wc/dev-server-hmr';
|
|
2
|
+
|
|
3
|
+
/** Use Hot Module replacement by adding --hmr to the start command */
|
|
4
|
+
const hmr = process.argv.includes('--hmr');
|
|
5
|
+
|
|
6
|
+
export default /** @type {import('@web/dev-server').DevServerConfig} */ ({
|
|
7
|
+
nodeResolve: true,
|
|
8
|
+
open: '/',
|
|
9
|
+
watch: !hmr,
|
|
10
|
+
|
|
11
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
12
|
+
// esbuildTarget: 'auto'
|
|
13
|
+
|
|
14
|
+
/** Set appIndex to enable SPA routing */
|
|
15
|
+
// appIndex: 'demo/index.html',
|
|
16
|
+
|
|
17
|
+
/** Confgure bare import resolve plugin */
|
|
18
|
+
// nodeResolve: {
|
|
19
|
+
// exportConditions: ['browser', 'development']
|
|
20
|
+
// },
|
|
21
|
+
|
|
22
|
+
plugins: [
|
|
23
|
+
/** Use Hot Module Replacement by uncommenting. Requires @open-wc/dev-server-hmr plugin */
|
|
24
|
+
// hmr && hmrPlugin({ exclude: ['**/*/node_modules/**/*'], presets: [presets.litElement] }),
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
http2: true,
|
|
28
|
+
sslCert: './local.archive.org.cert',
|
|
29
|
+
sslKey: './local.archive.org.key',
|
|
30
|
+
});
|
|
@@ -1,41 +1,41 @@
|
|
|
1
|
-
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
2
|
-
|
|
3
|
-
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
|
4
|
-
|
|
5
|
-
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
6
|
-
/** Test files to run */
|
|
7
|
-
files: 'dist/test/**/*.test.js',
|
|
8
|
-
|
|
9
|
-
/** Resolve bare module imports */
|
|
10
|
-
nodeResolve: {
|
|
11
|
-
exportConditions: ['browser', 'development'],
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
/** Filter out lit dev mode logs */
|
|
15
|
-
filterBrowserLogs(log) {
|
|
16
|
-
for (const arg of log.args) {
|
|
17
|
-
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
return true;
|
|
22
|
-
},
|
|
23
|
-
|
|
24
|
-
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
25
|
-
// esbuildTarget: 'auto',
|
|
26
|
-
|
|
27
|
-
/** Amount of browsers to run concurrently */
|
|
28
|
-
// concurrentBrowsers: 2,
|
|
29
|
-
|
|
30
|
-
/** Amount of test files per browser to test concurrently */
|
|
31
|
-
// concurrency: 1,
|
|
32
|
-
|
|
33
|
-
/** Browsers to run tests on */
|
|
34
|
-
// browsers: [
|
|
35
|
-
// playwrightLauncher({ product: 'chromium' }),
|
|
36
|
-
// playwrightLauncher({ product: 'firefox' }),
|
|
37
|
-
// playwrightLauncher({ product: 'webkit' }),
|
|
38
|
-
// ],
|
|
39
|
-
|
|
40
|
-
// See documentation for all available options
|
|
41
|
-
});
|
|
1
|
+
// import { playwrightLauncher } from '@web/test-runner-playwright';
|
|
2
|
+
|
|
3
|
+
const filteredLogs = ['Running in dev mode', 'lit-html is in dev mode'];
|
|
4
|
+
|
|
5
|
+
export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
6
|
+
/** Test files to run */
|
|
7
|
+
files: 'dist/test/**/*.test.js',
|
|
8
|
+
|
|
9
|
+
/** Resolve bare module imports */
|
|
10
|
+
nodeResolve: {
|
|
11
|
+
exportConditions: ['browser', 'development'],
|
|
12
|
+
},
|
|
13
|
+
|
|
14
|
+
/** Filter out lit dev mode logs */
|
|
15
|
+
filterBrowserLogs(log) {
|
|
16
|
+
for (const arg of log.args) {
|
|
17
|
+
if (typeof arg === 'string' && filteredLogs.some(l => arg.includes(l))) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
/** Compile JS for older browsers. Requires @web/dev-server-esbuild plugin */
|
|
25
|
+
// esbuildTarget: 'auto',
|
|
26
|
+
|
|
27
|
+
/** Amount of browsers to run concurrently */
|
|
28
|
+
// concurrentBrowsers: 2,
|
|
29
|
+
|
|
30
|
+
/** Amount of test files per browser to test concurrently */
|
|
31
|
+
// concurrency: 1,
|
|
32
|
+
|
|
33
|
+
/** Browsers to run tests on */
|
|
34
|
+
// browsers: [
|
|
35
|
+
// playwrightLauncher({ product: 'chromium' }),
|
|
36
|
+
// playwrightLauncher({ product: 'firefox' }),
|
|
37
|
+
// playwrightLauncher({ product: 'webkit' }),
|
|
38
|
+
// ],
|
|
39
|
+
|
|
40
|
+
// See documentation for all available options
|
|
41
|
+
});
|