@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
package/.github/workflows/ci.yml
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
name: App CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [ main ]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [ main ]
|
|
8
|
-
|
|
9
|
-
jobs:
|
|
10
|
-
build:
|
|
11
|
-
runs-on: ubuntu-latest
|
|
12
|
-
|
|
13
|
-
steps:
|
|
14
|
-
- uses: actions/checkout@v4
|
|
15
|
-
- uses: actions/setup-node@v4
|
|
16
|
-
with:
|
|
17
|
-
node-version: latest
|
|
18
|
-
|
|
19
|
-
- name: Install dependencies
|
|
20
|
-
run: yarn install
|
|
21
|
-
|
|
22
|
-
- name: Run tests
|
|
23
|
-
run: yarn run test
|
|
24
|
-
|
|
25
|
-
- uses: codecov/codecov-action@v4
|
|
26
|
-
with:
|
|
27
|
-
token: ${{ secrets.CODECOV_TOKEN }}
|
|
1
|
+
name: App CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
- uses: actions/setup-node@v4
|
|
16
|
+
with:
|
|
17
|
+
node-version: latest
|
|
18
|
+
|
|
19
|
+
- name: Install dependencies
|
|
20
|
+
run: yarn install
|
|
21
|
+
|
|
22
|
+
- name: Run tests
|
|
23
|
+
run: yarn run test
|
|
24
|
+
|
|
25
|
+
- uses: codecov/codecov-action@v4
|
|
26
|
+
with:
|
|
27
|
+
token: ${{ secrets.CODECOV_TOKEN }}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
# This workflow will generate the static page under `main` subdirectory inside the `gh-pages` branch
|
|
2
|
-
|
|
3
|
-
# This workflow will run every time new changes were pushed to the `main` branch
|
|
4
|
-
|
|
5
|
-
name: App build CI/CD to main branch
|
|
6
|
-
|
|
7
|
-
on:
|
|
8
|
-
push:
|
|
9
|
-
branches: [ main ]
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
build:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v4
|
|
17
|
-
with:
|
|
18
|
-
persist-credentials: false
|
|
19
|
-
|
|
20
|
-
- uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: latest
|
|
23
|
-
|
|
24
|
-
- name: Install dependencies
|
|
25
|
-
run: yarn install
|
|
26
|
-
|
|
27
|
-
- name: Create build files for gh-pages deploy
|
|
28
|
-
run: yarn prepare:ghpages
|
|
29
|
-
|
|
30
|
-
# Reference: https://github.com/JamesIves/github-pages-deploy-action
|
|
31
|
-
- name: Deploy 🚀
|
|
32
|
-
uses: JamesIves/github-pages-deploy-action@v4.4.3
|
|
33
|
-
with:
|
|
34
|
-
branch: gh-pages
|
|
35
|
-
folder: ghpages
|
|
36
|
-
clean-exclude: pr/
|
|
37
|
-
force: false
|
|
38
|
-
target-folder: main
|
|
39
|
-
token: ${{ secrets.GH_TOKEN }}
|
|
1
|
+
# This workflow will generate the static page under `main` subdirectory inside the `gh-pages` branch
|
|
2
|
+
|
|
3
|
+
# This workflow will run every time new changes were pushed to the `main` branch
|
|
4
|
+
|
|
5
|
+
name: App build CI/CD to main branch
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches: [ main ]
|
|
10
|
+
|
|
11
|
+
jobs:
|
|
12
|
+
build:
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
|
|
15
|
+
steps:
|
|
16
|
+
- uses: actions/checkout@v4
|
|
17
|
+
with:
|
|
18
|
+
persist-credentials: false
|
|
19
|
+
|
|
20
|
+
- uses: actions/setup-node@v4
|
|
21
|
+
with:
|
|
22
|
+
node-version: latest
|
|
23
|
+
|
|
24
|
+
- name: Install dependencies
|
|
25
|
+
run: yarn install
|
|
26
|
+
|
|
27
|
+
- name: Create build files for gh-pages deploy
|
|
28
|
+
run: yarn prepare:ghpages
|
|
29
|
+
|
|
30
|
+
# Reference: https://github.com/JamesIves/github-pages-deploy-action
|
|
31
|
+
- name: Deploy 🚀
|
|
32
|
+
uses: JamesIves/github-pages-deploy-action@v4.4.3
|
|
33
|
+
with:
|
|
34
|
+
branch: gh-pages
|
|
35
|
+
folder: ghpages
|
|
36
|
+
clean-exclude: pr/
|
|
37
|
+
force: false
|
|
38
|
+
target-folder: main
|
|
39
|
+
token: ${{ secrets.GH_TOKEN }}
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
# This workflow will be triggered if there's a new release tag created/pushed in Github repo
|
|
2
|
-
|
|
3
|
-
# This workflow will do the following:
|
|
4
|
-
# - run tests using node
|
|
5
|
-
# - publish a package to GitHub Packages when a release is created
|
|
6
|
-
|
|
7
|
-
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
|
|
8
|
-
|
|
9
|
-
name: Node.js Package
|
|
10
|
-
|
|
11
|
-
on:
|
|
12
|
-
release:
|
|
13
|
-
types: [created]
|
|
14
|
-
|
|
15
|
-
jobs:
|
|
16
|
-
build:
|
|
17
|
-
runs-on: ubuntu-latest
|
|
18
|
-
steps:
|
|
19
|
-
- uses: actions/checkout@v4
|
|
20
|
-
- uses: actions/setup-node@v3
|
|
21
|
-
with:
|
|
22
|
-
node-version: 16
|
|
23
|
-
- run: npm ci
|
|
24
|
-
- run: npm prepare
|
|
25
|
-
- run: npm test
|
|
26
|
-
|
|
27
|
-
publish-npm:
|
|
28
|
-
needs: build
|
|
29
|
-
runs-on: ubuntu-latest
|
|
30
|
-
steps:
|
|
31
|
-
- uses: actions/checkout@v4
|
|
32
|
-
- uses: actions/setup-node@v3
|
|
33
|
-
with:
|
|
34
|
-
node-version: 16
|
|
35
|
-
registry-url: https://registry.npmjs.org/
|
|
36
|
-
- run: npm ci
|
|
37
|
-
- run: npm publish --tag next
|
|
38
|
-
env:
|
|
39
|
-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
1
|
+
# This workflow will be triggered if there's a new release tag created/pushed in Github repo
|
|
2
|
+
|
|
3
|
+
# This workflow will do the following:
|
|
4
|
+
# - run tests using node
|
|
5
|
+
# - publish a package to GitHub Packages when a release is created
|
|
6
|
+
|
|
7
|
+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
|
|
8
|
+
|
|
9
|
+
name: Node.js Package
|
|
10
|
+
|
|
11
|
+
on:
|
|
12
|
+
release:
|
|
13
|
+
types: [created]
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
build:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
- uses: actions/setup-node@v3
|
|
21
|
+
with:
|
|
22
|
+
node-version: 16
|
|
23
|
+
- run: npm ci
|
|
24
|
+
- run: npm prepare
|
|
25
|
+
- run: npm test
|
|
26
|
+
|
|
27
|
+
publish-npm:
|
|
28
|
+
needs: build
|
|
29
|
+
runs-on: ubuntu-latest
|
|
30
|
+
steps:
|
|
31
|
+
- uses: actions/checkout@v4
|
|
32
|
+
- uses: actions/setup-node@v3
|
|
33
|
+
with:
|
|
34
|
+
node-version: 16
|
|
35
|
+
registry-url: https://registry.npmjs.org/
|
|
36
|
+
- run: npm ci
|
|
37
|
+
- run: npm publish --tag next
|
|
38
|
+
env:
|
|
39
|
+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
# This workflow will generate the static page under `pr` subdirectory inside the `gh-pages` branch
|
|
2
|
-
|
|
3
|
-
# This workflow will run every time there's a PR opened, reopened, synchronize, or closed
|
|
4
|
-
|
|
5
|
-
name: Deploy PR previews
|
|
6
|
-
|
|
7
|
-
on:
|
|
8
|
-
pull_request:
|
|
9
|
-
types:
|
|
10
|
-
- opened
|
|
11
|
-
- reopened
|
|
12
|
-
- synchronize
|
|
13
|
-
- closed
|
|
14
|
-
|
|
15
|
-
concurrency: preview-${{ github.ref }}
|
|
16
|
-
|
|
17
|
-
jobs:
|
|
18
|
-
deploy-preview:
|
|
19
|
-
runs-on: ubuntu-latest
|
|
20
|
-
steps:
|
|
21
|
-
- name: Checkout
|
|
22
|
-
uses: actions/checkout@v4
|
|
23
|
-
|
|
24
|
-
- uses: actions/setup-node@v4
|
|
25
|
-
with:
|
|
26
|
-
node-version: latest
|
|
27
|
-
|
|
28
|
-
- name: Install and Build
|
|
29
|
-
run: |
|
|
30
|
-
yarn install
|
|
31
|
-
yarn prepare:ghpages
|
|
32
|
-
|
|
33
|
-
# Reference: https://github.com/rossjrw/pr-preview-action
|
|
34
|
-
- name: Deploy preview
|
|
35
|
-
uses: rossjrw/pr-preview-action@v1
|
|
36
|
-
with:
|
|
37
|
-
source-dir: ./ghpages/
|
|
38
|
-
umbrella-dir: pr
|
|
1
|
+
# This workflow will generate the static page under `pr` subdirectory inside the `gh-pages` branch
|
|
2
|
+
|
|
3
|
+
# This workflow will run every time there's a PR opened, reopened, synchronize, or closed
|
|
4
|
+
|
|
5
|
+
name: Deploy PR previews
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
pull_request:
|
|
9
|
+
types:
|
|
10
|
+
- opened
|
|
11
|
+
- reopened
|
|
12
|
+
- synchronize
|
|
13
|
+
- closed
|
|
14
|
+
|
|
15
|
+
concurrency: preview-${{ github.ref }}
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
deploy-preview:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- name: Checkout
|
|
22
|
+
uses: actions/checkout@v4
|
|
23
|
+
|
|
24
|
+
- uses: actions/setup-node@v4
|
|
25
|
+
with:
|
|
26
|
+
node-version: latest
|
|
27
|
+
|
|
28
|
+
- name: Install and Build
|
|
29
|
+
run: |
|
|
30
|
+
yarn install
|
|
31
|
+
yarn prepare:ghpages
|
|
32
|
+
|
|
33
|
+
# Reference: https://github.com/rossjrw/pr-preview-action
|
|
34
|
+
- name: Deploy preview
|
|
35
|
+
uses: rossjrw/pr-preview-action@v1
|
|
36
|
+
with:
|
|
37
|
+
source-dir: ./ghpages/
|
|
38
|
+
umbrella-dir: pr
|
package/.prettierignore
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
coverage
|
|
1
|
+
coverage
|
package/dist/src/app-root.d.ts
CHANGED
|
@@ -45,9 +45,6 @@ export declare class AppRoot extends LitElement {
|
|
|
45
45
|
private outlineChanged;
|
|
46
46
|
private toggleDevTools;
|
|
47
47
|
private toggleFacetGroupOutline;
|
|
48
|
-
private snippetsChanged;
|
|
49
|
-
private reviewsChanged;
|
|
50
|
-
private reperformCurrentSearch;
|
|
51
48
|
private datePickerChanged;
|
|
52
49
|
private facetsChanged;
|
|
53
50
|
private lazyLoadFacetsChanged;
|
package/dist/src/app-root.js
CHANGED
|
@@ -5,7 +5,6 @@ import { html, css, LitElement, nothing } from 'lit';
|
|
|
5
5
|
import { customElement, property, query, state } from 'lit/decorators.js';
|
|
6
6
|
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
|
7
7
|
import '../src/collection-browser';
|
|
8
|
-
import { StringField } from '@internetarchive/iaux-item-metadata';
|
|
9
8
|
let AppRoot = class AppRoot extends LitElement {
|
|
10
9
|
constructor() {
|
|
11
10
|
super(...arguments);
|
|
@@ -325,22 +324,6 @@ let AppRoot = class AppRoot extends LitElement {
|
|
|
325
324
|
|
|
326
325
|
<fieldset class="cb-visual-appearance">
|
|
327
326
|
<legend>CB Visual Appearance</legend>
|
|
328
|
-
<div class="checkbox-control">
|
|
329
|
-
<input
|
|
330
|
-
type="checkbox"
|
|
331
|
-
id="show-dummy-snippets"
|
|
332
|
-
@click=${this.snippetsChanged}
|
|
333
|
-
/>
|
|
334
|
-
<label for="show-dummy-snippets">Show dummy snippets</label>
|
|
335
|
-
</div>
|
|
336
|
-
<div class="checkbox-control">
|
|
337
|
-
<input
|
|
338
|
-
type="checkbox"
|
|
339
|
-
id="show-dummy-reviews"
|
|
340
|
-
@click=${this.reviewsChanged}
|
|
341
|
-
/>
|
|
342
|
-
<label for="show-dummy-reviews">Show dummy reviews</label>
|
|
343
|
-
</div>
|
|
344
327
|
<div class="checkbox-control">
|
|
345
328
|
<input
|
|
346
329
|
type="checkbox"
|
|
@@ -566,80 +549,6 @@ let AppRoot = class AppRoot extends LitElement {
|
|
|
566
549
|
this.modalManager.classList.remove('showFacetGroupOutlines');
|
|
567
550
|
}
|
|
568
551
|
}
|
|
569
|
-
async snippetsChanged(e) {
|
|
570
|
-
const target = e.target;
|
|
571
|
-
if (target.checked) {
|
|
572
|
-
// Decorate the default search service with a wrapper that adds
|
|
573
|
-
// dummy snippets to any successful searches
|
|
574
|
-
this.searchService = {
|
|
575
|
-
async search(params, searchType) {
|
|
576
|
-
var _a;
|
|
577
|
-
const searchResponse = await SearchService.default.search(params, searchType);
|
|
578
|
-
(_a = searchResponse.success) === null || _a === void 0 ? void 0 : _a.response.results.forEach(result => {
|
|
579
|
-
Object.defineProperty(result, 'highlight', {
|
|
580
|
-
value: new StringField([
|
|
581
|
-
'this is a text {{{snippet}}} block with potentially',
|
|
582
|
-
'multiple {{{snippets}}} and such',
|
|
583
|
-
'but the {{{snippet}}} block may be quite long perhaps',
|
|
584
|
-
'depending on how many {{{snippet}}} matches there are',
|
|
585
|
-
'there may be multiple lines of {{{snippets}}} to show',
|
|
586
|
-
'but each {{{snippet}}} should be relatively short',
|
|
587
|
-
'and {{{snippets}}} are each a {{{snippet}}} of text',
|
|
588
|
-
'but every {{{snippet}}} might have multiple matches',
|
|
589
|
-
'the {{{snippets}}} should be separated and surrounded by ellipses',
|
|
590
|
-
]),
|
|
591
|
-
});
|
|
592
|
-
});
|
|
593
|
-
return searchResponse;
|
|
594
|
-
},
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
else {
|
|
598
|
-
// Restore the default seach service
|
|
599
|
-
this.searchService = SearchService.default;
|
|
600
|
-
}
|
|
601
|
-
// Re-perform the current search to show/hide the snippets immediately
|
|
602
|
-
this.reperformCurrentSearch();
|
|
603
|
-
}
|
|
604
|
-
async reviewsChanged(e) {
|
|
605
|
-
const target = e.target;
|
|
606
|
-
if (target.checked) {
|
|
607
|
-
// Decorate the default search service with a wrapper that adds
|
|
608
|
-
// dummy reviews to any successful searches
|
|
609
|
-
this.searchService = {
|
|
610
|
-
async search(params, searchType) {
|
|
611
|
-
var _a;
|
|
612
|
-
const searchResponse = await SearchService.default.search(params, searchType);
|
|
613
|
-
(_a = searchResponse.success) === null || _a === void 0 ? void 0 : _a.response.results.forEach((result, i) => {
|
|
614
|
-
Object.defineProperty(result, 'review', {
|
|
615
|
-
value: {
|
|
616
|
-
title: 'My Great Review',
|
|
617
|
-
body: "This item is really great and that's why I'm leaving this review on it and giving it so many star...",
|
|
618
|
-
stars: (i + 3) % 6,
|
|
619
|
-
},
|
|
620
|
-
});
|
|
621
|
-
});
|
|
622
|
-
return searchResponse;
|
|
623
|
-
},
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
else {
|
|
627
|
-
// Restore the default seach service
|
|
628
|
-
this.searchService = SearchService.default;
|
|
629
|
-
}
|
|
630
|
-
// Re-perform the current search to show/hide the reviews immediately
|
|
631
|
-
this.reperformCurrentSearch();
|
|
632
|
-
}
|
|
633
|
-
async reperformCurrentSearch() {
|
|
634
|
-
const oldQuery = this.searchQuery;
|
|
635
|
-
this.searchQuery = '-'; // Should just reset to the placeholder
|
|
636
|
-
await this.updateComplete;
|
|
637
|
-
// For unclear reasons, Safari refuses to re-apply the old query until the next tick, hence:
|
|
638
|
-
await new Promise(res => {
|
|
639
|
-
setTimeout(res, 0);
|
|
640
|
-
});
|
|
641
|
-
this.searchQuery = oldQuery; // Re-apply the original query
|
|
642
|
-
}
|
|
643
552
|
datePickerChanged(e) {
|
|
644
553
|
const target = e.target;
|
|
645
554
|
this.collectionBrowser.showHistogramDatePicker = target.checked;
|