@internetarchive/collection-browser 2.17.1-alpha-webdev7667.0 → 2.18.1-alpha-webdev7768.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/.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/.prettierignore +1 -1
- package/dist/src/app-root.d.ts +0 -3
- package/dist/src/app-root.js +0 -91
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.js +682 -682
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets.js +259 -259
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/expanded-date-picker.js +50 -50
- package/dist/src/expanded-date-picker.js.map +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +1 -1
- package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.js +1 -1
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/collection-browser.test.js +58 -3
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/image-block.test.js +21 -0
- package/dist/test/image-block.test.js.map +1 -1
- package/dist/test/item-image.test.js +73 -0
- package/dist/test/item-image.test.js.map +1 -1
- package/dist/test/mocks/mock-search-responses.d.ts +2 -0
- package/dist/test/mocks/mock-search-responses.js +96 -0
- package/dist/test/mocks/mock-search-responses.js.map +1 -1
- package/dist/test/mocks/mock-search-service.d.ts +1 -0
- package/dist/test/mocks/mock-search-service.js +7 -1
- package/dist/test/mocks/mock-search-service.js.map +1 -1
- package/eslint.config.mjs +53 -53
- package/index.html +24 -24
- package/package.json +117 -117
- package/src/app-root.ts +0 -97
- package/src/collection-browser.ts +2712 -2712
- package/src/collection-facets.ts +966 -966
- package/src/expanded-date-picker.ts +175 -175
- package/src/tiles/grid/styles/tile-grid-shared-styles.ts +1 -1
- package/src/tiles/tile-dispatcher.ts +1 -1
- package/test/collection-browser.test.ts +86 -2
- package/test/image-block.test.ts +24 -0
- package/test/item-image.test.ts +86 -0
- package/test/mocks/mock-search-responses.ts +104 -0
- package/test/mocks/mock-search-service.ts +11 -0
- package/tsconfig.json +20 -20
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getMockSuccessSingleResult, getMockSuccessMultipleResults, getMockSuccessSingleResultWithSort, getMockSuccessLoggedInResult, getMockSuccessNoPreviewResult, getMockSuccessLoggedInAndNoPreviewResult, getMockSuccessWithYearHistogramAggs, getMockSuccessWithDateHistogramAggs, getMockSuccessMultiLineDescription, getMockSuccessFirstTitleResult, getMockSuccessFirstCreatorResult, getMockErrorResult, getMockMalformedResult, getMockSuccessWithCollectionTitles, getMockSuccessWithChannelAliases, getMockSuccessWithCollectionAggregations, getMockSuccessExtraQuotedHref, getMockSuccessWithDefaultSort, getMockSuccessWithConciseDefaultSort, getMockSuccessWithDefaultFavSort, getMockSuccessWithParentCollections, getMockSuccessForTvCollection, getMockSuccessManyFields, getMockSuccessNoResults, getMockSuccessWithWebArchiveHits, getMockSuccessWithManyAggregations, getMockSuccessTvFields, } from './mock-search-responses';
|
|
1
|
+
import { getMockSuccessSingleResult, getMockSuccessMultipleResults, getMockSuccessSingleResultWithSort, getMockSuccessLoggedInResult, getMockSuccessNoPreviewResult, getMockSuccessLoggedInAndNoPreviewResult, getMockSuccessWithYearHistogramAggs, getMockSuccessWithDateHistogramAggs, getMockSuccessMultiLineDescription, getMockSuccessFirstTitleResult, getMockSuccessFirstCreatorResult, getMockErrorResult, getMockMalformedResult, getMockSuccessWithCollectionTitles, getMockSuccessWithChannelAliases, getMockSuccessWithCollectionAggregations, getMockSuccessExtraQuotedHref, getMockSuccessWithDefaultSort, getMockSuccessWithConciseDefaultSort, getMockSuccessWithDefaultFavSort, getMockSuccessWithParentCollections, getMockSuccessForTvCollection, getMockSuccessManyFields, getMockSuccessNoResults, getMockSuccessWithWebArchiveHits, getMockSuccessWithManyAggregations, getMockSuccessTvFields, getMockSuccessArchiveOrgUserResult, getMockSuccessArchiveOrgUserNoBlurResult, } from './mock-search-responses';
|
|
2
2
|
const responses = {
|
|
3
3
|
'single-result': getMockSuccessSingleResult,
|
|
4
4
|
years: getMockSuccessWithYearHistogramAggs,
|
|
@@ -7,6 +7,8 @@ const responses = {
|
|
|
7
7
|
loggedin: getMockSuccessLoggedInResult,
|
|
8
8
|
'no-preview': getMockSuccessNoPreviewResult,
|
|
9
9
|
'loggedin-no-preview': getMockSuccessLoggedInAndNoPreviewResult,
|
|
10
|
+
'archive-org-user-loggedin': getMockSuccessArchiveOrgUserResult,
|
|
11
|
+
'archive-org-user-loggedin-noblur': getMockSuccessArchiveOrgUserNoBlurResult,
|
|
10
12
|
'first-title': getMockSuccessFirstTitleResult,
|
|
11
13
|
'first-creator': getMockSuccessFirstCreatorResult,
|
|
12
14
|
'collection-titles': getMockSuccessWithCollectionTitles,
|
|
@@ -55,5 +57,9 @@ export class MockSearchService {
|
|
|
55
57
|
}
|
|
56
58
|
return result;
|
|
57
59
|
}
|
|
60
|
+
async itemDetails(_) {
|
|
61
|
+
// We don't currently use the itemDetails method in collection-browser
|
|
62
|
+
throw new Error('not implemented');
|
|
63
|
+
}
|
|
58
64
|
}
|
|
59
65
|
//# sourceMappingURL=mock-search-service.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock-search-service.js","sourceRoot":"","sources":["../../../test/mocks/mock-search-service.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,kCAAkC,EAClC,4BAA4B,EAC5B,6BAA6B,EAC7B,wCAAwC,EACxC,mCAAmC,EACnC,mCAAmC,EACnC,kCAAkC,EAClC,8BAA8B,EAC9B,gCAAgC,EAChC,kBAAkB,EAClB,sBAAsB,EACtB,kCAAkC,EAClC,gCAAgC,EAChC,wCAAwC,EACxC,6BAA6B,EAC7B,6BAA6B,EAC7B,oCAAoC,EACpC,gCAAgC,EAChC,mCAAmC,EACnC,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,EACvB,gCAAgC,EAChC,kCAAkC,EAClC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"mock-search-service.js","sourceRoot":"","sources":["../../../test/mocks/mock-search-service.ts"],"names":[],"mappings":"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","sourcesContent":["import type { Result } from '@internetarchive/result-type';\nimport type {\n SearchParams,\n SearchResponse,\n SearchServiceInterface,\n SearchServiceError,\n SearchType,\n} from '@internetarchive/search-service';\nimport {\n getMockSuccessSingleResult,\n getMockSuccessMultipleResults,\n getMockSuccessSingleResultWithSort,\n getMockSuccessLoggedInResult,\n getMockSuccessNoPreviewResult,\n getMockSuccessLoggedInAndNoPreviewResult,\n getMockSuccessWithYearHistogramAggs,\n getMockSuccessWithDateHistogramAggs,\n getMockSuccessMultiLineDescription,\n getMockSuccessFirstTitleResult,\n getMockSuccessFirstCreatorResult,\n getMockErrorResult,\n getMockMalformedResult,\n getMockSuccessWithCollectionTitles,\n getMockSuccessWithChannelAliases,\n getMockSuccessWithCollectionAggregations,\n getMockSuccessExtraQuotedHref,\n getMockSuccessWithDefaultSort,\n getMockSuccessWithConciseDefaultSort,\n getMockSuccessWithDefaultFavSort,\n getMockSuccessWithParentCollections,\n getMockSuccessForTvCollection,\n getMockSuccessManyFields,\n getMockSuccessNoResults,\n getMockSuccessWithWebArchiveHits,\n getMockSuccessWithManyAggregations,\n getMockSuccessTvFields,\n getMockSuccessArchiveOrgUserResult,\n getMockSuccessArchiveOrgUserNoBlurResult,\n} from './mock-search-responses';\n\nconst responses: Record<\n string,\n () => Result<SearchResponse, SearchServiceError>\n> = {\n 'single-result': getMockSuccessSingleResult,\n years: getMockSuccessWithYearHistogramAggs,\n months: getMockSuccessWithDateHistogramAggs,\n 'multi-line-description': getMockSuccessMultiLineDescription,\n loggedin: getMockSuccessLoggedInResult,\n 'no-preview': getMockSuccessNoPreviewResult,\n 'loggedin-no-preview': getMockSuccessLoggedInAndNoPreviewResult,\n 'archive-org-user-loggedin': getMockSuccessArchiveOrgUserResult,\n 'archive-org-user-loggedin-noblur': getMockSuccessArchiveOrgUserNoBlurResult,\n 'first-title': getMockSuccessFirstTitleResult,\n 'first-creator': getMockSuccessFirstCreatorResult,\n 'collection-titles': getMockSuccessWithCollectionTitles,\n 'channel-aliases': getMockSuccessWithChannelAliases,\n 'collection-aggregations': getMockSuccessWithCollectionAggregations,\n 'extra-quoted-href': getMockSuccessExtraQuotedHref,\n 'default-sort': getMockSuccessWithDefaultSort,\n 'default-sort-concise': getMockSuccessWithConciseDefaultSort,\n 'fav-sort': getMockSuccessWithDefaultFavSort,\n 'parent-collections': getMockSuccessWithParentCollections,\n 'tv-collection': getMockSuccessForTvCollection,\n 'web-archive': getMockSuccessWithWebArchiveHits,\n 'more-facets': getMockSuccessWithManyAggregations,\n 'many-fields': getMockSuccessManyFields,\n 'tv-fields': getMockSuccessTvFields,\n 'no-results': getMockSuccessNoResults,\n error: getMockErrorResult,\n malformed: getMockMalformedResult,\n};\n\nexport class MockSearchService implements SearchServiceInterface {\n searchParams?: SearchParams;\n\n searchType?: SearchType;\n\n asyncResponse: boolean;\n\n asyncResponseDelay: number;\n\n resultsSpy: Function;\n\n constructor({\n asyncResponse = false,\n asyncResponseDelay = 0,\n resultsSpy = () => {},\n } = {}) {\n this.asyncResponse = asyncResponse;\n this.asyncResponseDelay = asyncResponseDelay;\n this.resultsSpy = resultsSpy;\n }\n\n async search(\n params: SearchParams,\n searchType: SearchType,\n ): Promise<Result<SearchResponse, SearchServiceError>> {\n this.searchParams = params;\n this.searchType = searchType;\n\n if (this.asyncResponse) {\n // Add an artificial 1-tick delay\n await new Promise(res => {\n setTimeout(res, this.asyncResponseDelay);\n });\n }\n\n const responseKey =\n (this.searchParams.query || this.searchParams.pageTarget) ?? '';\n const resultFn: () => Result<SearchResponse, SearchServiceError> =\n responses[responseKey] ?? getMockSuccessMultipleResults;\n let result = resultFn();\n\n // with-sort query has special handling\n if (this.searchParams.query === 'with-sort') {\n result = getMockSuccessSingleResultWithSort(this.resultsSpy);\n }\n\n // Apply any uid param from the request\n if (result.success) {\n (result.success.request.clientParameters as any).uid = params.uid;\n }\n\n return result;\n }\n\n async itemDetails(\n _: string,\n ): Promise<Result<SearchResponse, SearchServiceError>> {\n // We don't currently use the itemDetails method in collection-browser\n throw new Error('not implemented');\n }\n}\n"]}
|
package/eslint.config.mjs
CHANGED
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
2
|
-
import html from 'eslint-plugin-html';
|
|
3
|
-
import tsParser from '@typescript-eslint/parser';
|
|
4
|
-
import path from 'node:path';
|
|
5
|
-
import { fileURLToPath } from 'node:url';
|
|
6
|
-
import js from '@eslint/js';
|
|
7
|
-
import { FlatCompat } from '@eslint/eslintrc';
|
|
8
|
-
|
|
9
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
-
const __dirname = path.dirname(__filename);
|
|
11
|
-
const compat = new FlatCompat({
|
|
12
|
-
baseDirectory: __dirname,
|
|
13
|
-
recommendedConfig: js.configs.recommended,
|
|
14
|
-
allConfig: js.configs.all,
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
export default [
|
|
18
|
-
...compat.extends('plugin:@typescript-eslint/recommended'),
|
|
19
|
-
{
|
|
20
|
-
plugins: {
|
|
21
|
-
'@typescript-eslint': typescriptEslint,
|
|
22
|
-
html,
|
|
23
|
-
},
|
|
24
|
-
|
|
25
|
-
languageOptions: {
|
|
26
|
-
parser: tsParser,
|
|
27
|
-
},
|
|
28
|
-
|
|
29
|
-
settings: {
|
|
30
|
-
'import/resolver': {
|
|
31
|
-
node: {
|
|
32
|
-
extensions: ['.ts', '.tsx'],
|
|
33
|
-
moduleDirectory: ['node_modules', 'src', 'demo'],
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
rules: {
|
|
39
|
-
'@typescript-eslint/no-unsafe-function-type': 'warn',
|
|
40
|
-
'@typescript-eslint/no-unused-vars': 'warn',
|
|
41
|
-
'@typescript-eslint/no-explicit-any': 'warn',
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
ignores: ['**/*.js', '**/*.mjs', '**/*.d.ts'],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
files: ['**/*.test.ts'],
|
|
49
|
-
rules: {
|
|
50
|
-
'@typescript-eslint/no-unused-expressions': 'off',
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
];
|
|
1
|
+
import typescriptEslint from '@typescript-eslint/eslint-plugin';
|
|
2
|
+
import html from 'eslint-plugin-html';
|
|
3
|
+
import tsParser from '@typescript-eslint/parser';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import js from '@eslint/js';
|
|
7
|
+
import { FlatCompat } from '@eslint/eslintrc';
|
|
8
|
+
|
|
9
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
10
|
+
const __dirname = path.dirname(__filename);
|
|
11
|
+
const compat = new FlatCompat({
|
|
12
|
+
baseDirectory: __dirname,
|
|
13
|
+
recommendedConfig: js.configs.recommended,
|
|
14
|
+
allConfig: js.configs.all,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
export default [
|
|
18
|
+
...compat.extends('plugin:@typescript-eslint/recommended'),
|
|
19
|
+
{
|
|
20
|
+
plugins: {
|
|
21
|
+
'@typescript-eslint': typescriptEslint,
|
|
22
|
+
html,
|
|
23
|
+
},
|
|
24
|
+
|
|
25
|
+
languageOptions: {
|
|
26
|
+
parser: tsParser,
|
|
27
|
+
},
|
|
28
|
+
|
|
29
|
+
settings: {
|
|
30
|
+
'import/resolver': {
|
|
31
|
+
node: {
|
|
32
|
+
extensions: ['.ts', '.tsx'],
|
|
33
|
+
moduleDirectory: ['node_modules', 'src', 'demo'],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
|
|
38
|
+
rules: {
|
|
39
|
+
'@typescript-eslint/no-unsafe-function-type': 'warn',
|
|
40
|
+
'@typescript-eslint/no-unused-vars': 'warn',
|
|
41
|
+
'@typescript-eslint/no-explicit-any': 'warn',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
ignores: ['**/*.js', '**/*.mjs', '**/*.d.ts'],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
files: ['**/*.test.ts'],
|
|
49
|
+
rules: {
|
|
50
|
+
'@typescript-eslint/no-unused-expressions': 'off',
|
|
51
|
+
},
|
|
52
|
+
},
|
|
53
|
+
];
|
package/index.html
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en-GB">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<style>
|
|
7
|
-
html {
|
|
8
|
-
font-size: 10px; /* This is to match petabox's base font size */
|
|
9
|
-
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
body {
|
|
13
|
-
background: #F5F5F7;
|
|
14
|
-
color: #2C2C2C;
|
|
15
|
-
line-height: 1.42857143; /* Same as production */
|
|
16
|
-
}
|
|
17
|
-
</style>
|
|
18
|
-
|
|
19
|
-
</head>
|
|
20
|
-
<body>
|
|
21
|
-
<app-root></app-root>
|
|
22
|
-
<script type="module" src="./dist/src/app-root.js"></script>
|
|
23
|
-
</body>
|
|
24
|
-
</html>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en-GB">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
html {
|
|
8
|
+
font-size: 10px; /* This is to match petabox's base font size */
|
|
9
|
+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
body {
|
|
13
|
+
background: #F5F5F7;
|
|
14
|
+
color: #2C2C2C;
|
|
15
|
+
line-height: 1.42857143; /* Same as production */
|
|
16
|
+
}
|
|
17
|
+
</style>
|
|
18
|
+
|
|
19
|
+
</head>
|
|
20
|
+
<body>
|
|
21
|
+
<app-root></app-root>
|
|
22
|
+
<script type="module" src="./dist/src/app-root.js"></script>
|
|
23
|
+
</body>
|
|
24
|
+
</html>
|
package/package.json
CHANGED
|
@@ -1,117 +1,117 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@internetarchive/collection-browser",
|
|
3
|
-
"description": "The Internet Archive Collection Browser.",
|
|
4
|
-
"license": "AGPL-3.0-only",
|
|
5
|
-
"author": "Internet Archive",
|
|
6
|
-
"version": "2.
|
|
7
|
-
"main": "dist/index.js",
|
|
8
|
-
"module": "dist/index.js",
|
|
9
|
-
"scripts": {
|
|
10
|
-
"start": "yarn run prepare && tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
|
11
|
-
"prepare:ghpages": "rimraf ghpages && yarn run prepare && vite build",
|
|
12
|
-
"prepare": "rimraf dist && tsc && husky install",
|
|
13
|
-
"lint": "eslint . && prettier \"**/*.ts\" --check",
|
|
14
|
-
"format": "eslint . --fix && prettier \"**/*.ts\" --write",
|
|
15
|
-
"circular": "madge --circular --extensions ts .",
|
|
16
|
-
"test": "tsc && yarn run lint && yarn run circular && wtr --coverage",
|
|
17
|
-
"test:fast": "tsc && wtr --coverage",
|
|
18
|
-
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
|
|
19
|
-
"deploy": "yarn run deploy:run -e $(git branch --show-current)",
|
|
20
|
-
"deploy:run": "yarn run prepare:ghpages && touch ghpages/.nojekyll && yarn run deploy:gh",
|
|
21
|
-
"deploy:gh": "gh-pages -t -d ghpages -m \"Build for $(git log --pretty=format:\"%h %an %ai %s\" -n1) [skip ci]\"",
|
|
22
|
-
"typecheck": "yarn tsc --noEmit"
|
|
23
|
-
},
|
|
24
|
-
"types": "dist/index.d.ts",
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"@internetarchive/analytics-manager": "^0.1.4",
|
|
27
|
-
"@internetarchive/feature-feedback": "^1.0.0",
|
|
28
|
-
"@internetarchive/field-parsers": "^1.0.0",
|
|
29
|
-
"@internetarchive/histogram-date-range": "^1.3.
|
|
30
|
-
"@internetarchive/ia-activity-indicator": "^0.0.6",
|
|
31
|
-
"@internetarchive/ia-dropdown": "^1.3.10",
|
|
32
|
-
"@internetarchive/iaux-item-metadata": "^1.0.5",
|
|
33
|
-
"@internetarchive/infinite-scroller": "^1.0.1",
|
|
34
|
-
"@internetarchive/modal-manager": "^2.0.1",
|
|
35
|
-
"@internetarchive/search-service": "2.
|
|
36
|
-
"@internetarchive/shared-resize-observer": "^0.2.0",
|
|
37
|
-
"@lit/localize": "^0.12.2",
|
|
38
|
-
"dompurify": "^3.2.4",
|
|
39
|
-
"lit": "^2.8.0",
|
|
40
|
-
"typescript-cookie": "^1.0.6"
|
|
41
|
-
},
|
|
42
|
-
"devDependencies": {
|
|
43
|
-
"@internetarchive/result-type": "^0.0.1",
|
|
44
|
-
"@open-wc/eslint-config": "^12.0.3",
|
|
45
|
-
"@open-wc/testing": "^4.0.0",
|
|
46
|
-
"@types/dompurify": "^3.2.0",
|
|
47
|
-
"@types/mocha": "^10.0.10",
|
|
48
|
-
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
|
49
|
-
"@typescript-eslint/parser": "^8.27.0",
|
|
50
|
-
"@web/dev-server": "^0.4.6",
|
|
51
|
-
"@web/test-runner": "^0.20.0",
|
|
52
|
-
"concurrently": "^9.1.2",
|
|
53
|
-
"eslint": "^9.22.0",
|
|
54
|
-
"eslint-config-prettier": "^10.1.1",
|
|
55
|
-
"eslint-plugin-html": "^8.1.2",
|
|
56
|
-
"eslint-plugin-import": "^2.31.0",
|
|
57
|
-
"eslint-plugin-lit": "^2.0.0",
|
|
58
|
-
"eslint-plugin-lit-a11y": "^4.1.4",
|
|
59
|
-
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
60
|
-
"eslint-plugin-wc": "^3.0.0",
|
|
61
|
-
"gh-pages": "^6.3.0",
|
|
62
|
-
"husky": "^9.1.7",
|
|
63
|
-
"madge": "^8.0.0",
|
|
64
|
-
"prettier": "^3.5.3",
|
|
65
|
-
"rimraf": "^6.0.1",
|
|
66
|
-
"sinon": "^19.0.4",
|
|
67
|
-
"tslib": "^2.8.1",
|
|
68
|
-
"typescript": "^5.8.2",
|
|
69
|
-
"vite": "^6.2.2"
|
|
70
|
-
},
|
|
71
|
-
"publishConfig": {
|
|
72
|
-
"access": "public"
|
|
73
|
-
},
|
|
74
|
-
"eslintConfig": {
|
|
75
|
-
"parser": "@typescript-eslint/parser",
|
|
76
|
-
"extends": [
|
|
77
|
-
"@open-wc",
|
|
78
|
-
"prettier"
|
|
79
|
-
],
|
|
80
|
-
"plugins": [
|
|
81
|
-
"@typescript-eslint"
|
|
82
|
-
],
|
|
83
|
-
"rules": {
|
|
84
|
-
"no-unused-vars": "off",
|
|
85
|
-
"@typescript-eslint/no-unused-vars": [
|
|
86
|
-
"error"
|
|
87
|
-
],
|
|
88
|
-
"no-shadow": "off",
|
|
89
|
-
"@typescript-eslint/no-shadow": [
|
|
90
|
-
"error"
|
|
91
|
-
],
|
|
92
|
-
"class-methods-use-this": "off",
|
|
93
|
-
"import/no-unresolved": "off",
|
|
94
|
-
"import/extensions": [
|
|
95
|
-
"off",
|
|
96
|
-
"ignorePackages",
|
|
97
|
-
{
|
|
98
|
-
"js": "never",
|
|
99
|
-
"ts": "never"
|
|
100
|
-
}
|
|
101
|
-
],
|
|
102
|
-
"no-unsafe-optional-chaining": "warn",
|
|
103
|
-
"default-param-last": "warn"
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
"prettier": {
|
|
107
|
-
"singleQuote": true,
|
|
108
|
-
"arrowParens": "avoid"
|
|
109
|
-
},
|
|
110
|
-
"lint-staged": {
|
|
111
|
-
"*.ts": [
|
|
112
|
-
"eslint --fix",
|
|
113
|
-
"prettier --write",
|
|
114
|
-
"git add"
|
|
115
|
-
]
|
|
116
|
-
}
|
|
117
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@internetarchive/collection-browser",
|
|
3
|
+
"description": "The Internet Archive Collection Browser.",
|
|
4
|
+
"license": "AGPL-3.0-only",
|
|
5
|
+
"author": "Internet Archive",
|
|
6
|
+
"version": "2.18.1-alpha-webdev7768.0",
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"module": "dist/index.js",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"start": "yarn run prepare && tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wds\"",
|
|
11
|
+
"prepare:ghpages": "rimraf ghpages && yarn run prepare && vite build",
|
|
12
|
+
"prepare": "rimraf dist && tsc && husky install",
|
|
13
|
+
"lint": "eslint . && prettier \"**/*.ts\" --check",
|
|
14
|
+
"format": "eslint . --fix && prettier \"**/*.ts\" --write",
|
|
15
|
+
"circular": "madge --circular --extensions ts .",
|
|
16
|
+
"test": "tsc && yarn run lint && yarn run circular && wtr --coverage",
|
|
17
|
+
"test:fast": "tsc && wtr --coverage",
|
|
18
|
+
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\"",
|
|
19
|
+
"deploy": "yarn run deploy:run -e $(git branch --show-current)",
|
|
20
|
+
"deploy:run": "yarn run prepare:ghpages && touch ghpages/.nojekyll && yarn run deploy:gh",
|
|
21
|
+
"deploy:gh": "gh-pages -t -d ghpages -m \"Build for $(git log --pretty=format:\"%h %an %ai %s\" -n1) [skip ci]\"",
|
|
22
|
+
"typecheck": "yarn tsc --noEmit"
|
|
23
|
+
},
|
|
24
|
+
"types": "dist/index.d.ts",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@internetarchive/analytics-manager": "^0.1.4",
|
|
27
|
+
"@internetarchive/feature-feedback": "^1.0.0",
|
|
28
|
+
"@internetarchive/field-parsers": "^1.0.0",
|
|
29
|
+
"@internetarchive/histogram-date-range": "^1.3.2",
|
|
30
|
+
"@internetarchive/ia-activity-indicator": "^0.0.6",
|
|
31
|
+
"@internetarchive/ia-dropdown": "^1.3.10",
|
|
32
|
+
"@internetarchive/iaux-item-metadata": "^1.0.5",
|
|
33
|
+
"@internetarchive/infinite-scroller": "^1.0.1",
|
|
34
|
+
"@internetarchive/modal-manager": "^2.0.1",
|
|
35
|
+
"@internetarchive/search-service": "^2.5.0",
|
|
36
|
+
"@internetarchive/shared-resize-observer": "^0.2.0",
|
|
37
|
+
"@lit/localize": "^0.12.2",
|
|
38
|
+
"dompurify": "^3.2.4",
|
|
39
|
+
"lit": "^2.8.0",
|
|
40
|
+
"typescript-cookie": "^1.0.6"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@internetarchive/result-type": "^0.0.1",
|
|
44
|
+
"@open-wc/eslint-config": "^12.0.3",
|
|
45
|
+
"@open-wc/testing": "^4.0.0",
|
|
46
|
+
"@types/dompurify": "^3.2.0",
|
|
47
|
+
"@types/mocha": "^10.0.10",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.27.0",
|
|
49
|
+
"@typescript-eslint/parser": "^8.27.0",
|
|
50
|
+
"@web/dev-server": "^0.4.6",
|
|
51
|
+
"@web/test-runner": "^0.20.0",
|
|
52
|
+
"concurrently": "^9.1.2",
|
|
53
|
+
"eslint": "^9.22.0",
|
|
54
|
+
"eslint-config-prettier": "^10.1.1",
|
|
55
|
+
"eslint-plugin-html": "^8.1.2",
|
|
56
|
+
"eslint-plugin-import": "^2.31.0",
|
|
57
|
+
"eslint-plugin-lit": "^2.0.0",
|
|
58
|
+
"eslint-plugin-lit-a11y": "^4.1.4",
|
|
59
|
+
"eslint-plugin-no-only-tests": "^3.3.0",
|
|
60
|
+
"eslint-plugin-wc": "^3.0.0",
|
|
61
|
+
"gh-pages": "^6.3.0",
|
|
62
|
+
"husky": "^9.1.7",
|
|
63
|
+
"madge": "^8.0.0",
|
|
64
|
+
"prettier": "^3.5.3",
|
|
65
|
+
"rimraf": "^6.0.1",
|
|
66
|
+
"sinon": "^19.0.4",
|
|
67
|
+
"tslib": "^2.8.1",
|
|
68
|
+
"typescript": "^5.8.2",
|
|
69
|
+
"vite": "^6.2.2"
|
|
70
|
+
},
|
|
71
|
+
"publishConfig": {
|
|
72
|
+
"access": "public"
|
|
73
|
+
},
|
|
74
|
+
"eslintConfig": {
|
|
75
|
+
"parser": "@typescript-eslint/parser",
|
|
76
|
+
"extends": [
|
|
77
|
+
"@open-wc",
|
|
78
|
+
"prettier"
|
|
79
|
+
],
|
|
80
|
+
"plugins": [
|
|
81
|
+
"@typescript-eslint"
|
|
82
|
+
],
|
|
83
|
+
"rules": {
|
|
84
|
+
"no-unused-vars": "off",
|
|
85
|
+
"@typescript-eslint/no-unused-vars": [
|
|
86
|
+
"error"
|
|
87
|
+
],
|
|
88
|
+
"no-shadow": "off",
|
|
89
|
+
"@typescript-eslint/no-shadow": [
|
|
90
|
+
"error"
|
|
91
|
+
],
|
|
92
|
+
"class-methods-use-this": "off",
|
|
93
|
+
"import/no-unresolved": "off",
|
|
94
|
+
"import/extensions": [
|
|
95
|
+
"off",
|
|
96
|
+
"ignorePackages",
|
|
97
|
+
{
|
|
98
|
+
"js": "never",
|
|
99
|
+
"ts": "never"
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
"no-unsafe-optional-chaining": "warn",
|
|
103
|
+
"default-param-last": "warn"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"prettier": {
|
|
107
|
+
"singleQuote": true,
|
|
108
|
+
"arrowParens": "avoid"
|
|
109
|
+
},
|
|
110
|
+
"lint-staged": {
|
|
111
|
+
"*.ts": [
|
|
112
|
+
"eslint --fix",
|
|
113
|
+
"prettier --write",
|
|
114
|
+
"git add"
|
|
115
|
+
]
|
|
116
|
+
}
|
|
117
|
+
}
|
package/src/app-root.ts
CHANGED
|
@@ -379,22 +379,6 @@ export class AppRoot extends LitElement {
|
|
|
379
379
|
|
|
380
380
|
<fieldset class="cb-visual-appearance">
|
|
381
381
|
<legend>CB Visual Appearance</legend>
|
|
382
|
-
<div class="checkbox-control">
|
|
383
|
-
<input
|
|
384
|
-
type="checkbox"
|
|
385
|
-
id="show-dummy-snippets"
|
|
386
|
-
@click=${this.snippetsChanged}
|
|
387
|
-
/>
|
|
388
|
-
<label for="show-dummy-snippets">Show dummy snippets</label>
|
|
389
|
-
</div>
|
|
390
|
-
<div class="checkbox-control">
|
|
391
|
-
<input
|
|
392
|
-
type="checkbox"
|
|
393
|
-
id="show-dummy-reviews"
|
|
394
|
-
@click=${this.reviewsChanged}
|
|
395
|
-
/>
|
|
396
|
-
<label for="show-dummy-reviews">Show dummy reviews</label>
|
|
397
|
-
</div>
|
|
398
382
|
<div class="checkbox-control">
|
|
399
383
|
<input
|
|
400
384
|
type="checkbox"
|
|
@@ -637,87 +621,6 @@ export class AppRoot extends LitElement {
|
|
|
637
621
|
}
|
|
638
622
|
}
|
|
639
623
|
|
|
640
|
-
private async snippetsChanged(e: Event) {
|
|
641
|
-
const target = e.target as HTMLInputElement;
|
|
642
|
-
if (target.checked) {
|
|
643
|
-
// Decorate the default search service with a wrapper that adds
|
|
644
|
-
// dummy snippets to any successful searches
|
|
645
|
-
this.searchService = {
|
|
646
|
-
async search(params, searchType) {
|
|
647
|
-
const searchResponse = await SearchService.default.search(
|
|
648
|
-
params,
|
|
649
|
-
searchType,
|
|
650
|
-
);
|
|
651
|
-
searchResponse.success?.response.results.forEach(result => {
|
|
652
|
-
Object.defineProperty(result, 'highlight', {
|
|
653
|
-
value: new StringField([
|
|
654
|
-
'this is a text {{{snippet}}} block with potentially',
|
|
655
|
-
'multiple {{{snippets}}} and such',
|
|
656
|
-
'but the {{{snippet}}} block may be quite long perhaps',
|
|
657
|
-
'depending on how many {{{snippet}}} matches there are',
|
|
658
|
-
'there may be multiple lines of {{{snippets}}} to show',
|
|
659
|
-
'but each {{{snippet}}} should be relatively short',
|
|
660
|
-
'and {{{snippets}}} are each a {{{snippet}}} of text',
|
|
661
|
-
'but every {{{snippet}}} might have multiple matches',
|
|
662
|
-
'the {{{snippets}}} should be separated and surrounded by ellipses',
|
|
663
|
-
]),
|
|
664
|
-
});
|
|
665
|
-
});
|
|
666
|
-
return searchResponse;
|
|
667
|
-
},
|
|
668
|
-
};
|
|
669
|
-
} else {
|
|
670
|
-
// Restore the default seach service
|
|
671
|
-
this.searchService = SearchService.default;
|
|
672
|
-
}
|
|
673
|
-
|
|
674
|
-
// Re-perform the current search to show/hide the snippets immediately
|
|
675
|
-
this.reperformCurrentSearch();
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
private async reviewsChanged(e: Event) {
|
|
679
|
-
const target = e.target as HTMLInputElement;
|
|
680
|
-
if (target.checked) {
|
|
681
|
-
// Decorate the default search service with a wrapper that adds
|
|
682
|
-
// dummy reviews to any successful searches
|
|
683
|
-
this.searchService = {
|
|
684
|
-
async search(params, searchType) {
|
|
685
|
-
const searchResponse = await SearchService.default.search(
|
|
686
|
-
params,
|
|
687
|
-
searchType,
|
|
688
|
-
);
|
|
689
|
-
searchResponse.success?.response.results.forEach((result, i) => {
|
|
690
|
-
Object.defineProperty(result, 'review', {
|
|
691
|
-
value: {
|
|
692
|
-
title: 'My Great Review',
|
|
693
|
-
body: "This item is really great and that's why I'm leaving this review on it and giving it so many star...",
|
|
694
|
-
stars: (i + 3) % 6,
|
|
695
|
-
},
|
|
696
|
-
});
|
|
697
|
-
});
|
|
698
|
-
return searchResponse;
|
|
699
|
-
},
|
|
700
|
-
};
|
|
701
|
-
} else {
|
|
702
|
-
// Restore the default seach service
|
|
703
|
-
this.searchService = SearchService.default;
|
|
704
|
-
}
|
|
705
|
-
|
|
706
|
-
// Re-perform the current search to show/hide the reviews immediately
|
|
707
|
-
this.reperformCurrentSearch();
|
|
708
|
-
}
|
|
709
|
-
|
|
710
|
-
private async reperformCurrentSearch(): Promise<void> {
|
|
711
|
-
const oldQuery = this.searchQuery;
|
|
712
|
-
this.searchQuery = '-'; // Should just reset to the placeholder
|
|
713
|
-
await this.updateComplete;
|
|
714
|
-
// For unclear reasons, Safari refuses to re-apply the old query until the next tick, hence:
|
|
715
|
-
await new Promise(res => {
|
|
716
|
-
setTimeout(res, 0);
|
|
717
|
-
});
|
|
718
|
-
this.searchQuery = oldQuery; // Re-apply the original query
|
|
719
|
-
}
|
|
720
|
-
|
|
721
624
|
private datePickerChanged(e: Event) {
|
|
722
625
|
const target = e.target as HTMLInputElement;
|
|
723
626
|
this.collectionBrowser.showHistogramDatePicker = target.checked;
|