@internetarchive/collection-browser 2.7.14 → 2.8.1-alpha-webdev7002.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.
Files changed (68) hide show
  1. package/.editorconfig +29 -29
  2. package/.husky/pre-commit +4 -4
  3. package/LICENSE +661 -661
  4. package/README.md +83 -83
  5. package/dist/index.d.ts +4 -1
  6. package/dist/index.js +3 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/src/collection-browser.d.ts +2 -2
  9. package/dist/src/collection-browser.js +10 -6
  10. package/dist/src/collection-browser.js.map +1 -1
  11. package/dist/src/collection-facets/smart-facets/heuristics/{browser-language-heuristic.d.ts → browser-language/browser-language-heuristic.d.ts} +1 -1
  12. package/dist/src/collection-facets/smart-facets/heuristics/browser-language/browser-language-heuristic.js.map +1 -0
  13. package/dist/src/collection-facets/smart-facets/heuristics/index.d.ts +3 -0
  14. package/dist/src/collection-facets/smart-facets/heuristics/index.js +4 -0
  15. package/dist/src/collection-facets/smart-facets/heuristics/index.js.map +1 -0
  16. package/dist/src/collection-facets/smart-facets/heuristics/{query-keywords-heuristic.d.ts → query-keywords/query-keywords-heuristic.d.ts} +1 -2
  17. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.js +14 -0
  18. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.js.map +1 -0
  19. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.d.ts +6 -0
  20. package/dist/src/collection-facets/smart-facets/heuristics/{query-keywords-heuristic.js → query-keywords/query-keywords-map.js} +7 -17
  21. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.js.map +1 -0
  22. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.d.ts +9 -0
  23. package/dist/src/collection-facets/smart-facets/heuristics/{wikidata-heuristic.js → wikidata/wikidata-entity-map.js} +9 -49
  24. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js.map +1 -0
  25. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.d.ts +21 -0
  26. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +75 -0
  27. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -0
  28. package/dist/src/collection-facets/smart-facets/models.d.ts +4 -0
  29. package/dist/src/collection-facets/smart-facets/models.js.map +1 -1
  30. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.d.ts +2 -2
  31. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js +9 -7
  32. package/dist/src/collection-facets/smart-facets/smart-facet-heuristics.js.map +1 -1
  33. package/dist/src/data-source/collection-browser-data-source-interface.d.ts +5 -0
  34. package/dist/src/data-source/collection-browser-data-source-interface.js.map +1 -1
  35. package/dist/src/data-source/collection-browser-data-source.d.ts +9 -0
  36. package/dist/src/data-source/collection-browser-data-source.js +12 -1
  37. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  38. package/dist/test/collection-browser.test.js +18 -0
  39. package/dist/test/collection-browser.test.js.map +1 -1
  40. package/dist/test/data-source/collection-browser-data-source.test.js +10 -0
  41. package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -1
  42. package/index.ts +15 -1
  43. package/local.archive.org.cert +86 -86
  44. package/local.archive.org.key +27 -27
  45. package/package.json +1 -1
  46. package/renovate.json +6 -6
  47. package/src/collection-browser.ts +13 -6
  48. package/src/collection-facets/smart-facets/heuristics/{browser-language-heuristic.ts → browser-language/browser-language-heuristic.ts} +1 -1
  49. package/src/collection-facets/smart-facets/heuristics/index.ts +3 -0
  50. package/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-heuristic.ts +17 -0
  51. package/src/collection-facets/smart-facets/heuristics/query-keywords/query-keywords-map.ts +36 -0
  52. package/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.ts +134 -0
  53. package/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.ts +89 -0
  54. package/src/collection-facets/smart-facets/models.ts +4 -0
  55. package/src/collection-facets/smart-facets/smart-facet-heuristics.ts +13 -8
  56. package/src/data-source/collection-browser-data-source-interface.ts +6 -0
  57. package/src/data-source/collection-browser-data-source.ts +14 -1
  58. package/test/collection-browser.test.ts +24 -0
  59. package/test/data-source/collection-browser-data-source.test.ts +14 -0
  60. package/web-dev-server.config.mjs +30 -30
  61. package/web-test-runner.config.mjs +41 -41
  62. package/dist/src/collection-facets/smart-facets/heuristics/browser-language-heuristic.js.map +0 -1
  63. package/dist/src/collection-facets/smart-facets/heuristics/query-keywords-heuristic.js.map +0 -1
  64. package/dist/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.d.ts +0 -5
  65. package/dist/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.js.map +0 -1
  66. package/src/collection-facets/smart-facets/heuristics/query-keywords-heuristic.ts +0 -55
  67. package/src/collection-facets/smart-facets/heuristics/wikidata-heuristic.ts +0 -191
  68. /package/dist/src/collection-facets/smart-facets/heuristics/{browser-language-heuristic.js → browser-language/browser-language-heuristic.js} +0 -0
package/README.md CHANGED
@@ -1,84 +1,84 @@
1
- ![Build Status](https://github.com/internetarchive/iaux-collection-browser/actions/workflows/ci.yml/badge.svg) [![codecov](https://codecov.io/gh/internetarchive/iaux-collection-browser/branch/main/graph/badge.svg?token=CLWEGO4RMQ)](https://codecov.io/gh/internetarchive/iaux-collection-browser)
2
-
3
-
4
- # Internet Archive Collection Browser
5
-
6
- This is the main collection browser for the Internet Archive website.
7
-
8
- [Review app URL](https://internetarchive.github.io/iaux-collection-browser/main)
9
- ## Usage
10
-
11
- ```ts
12
- import '@internetarchive/collection-browser';
13
-
14
- <collection-browser>
15
- </collection-browser>
16
- ```
17
-
18
- ## Local Demo with `web-dev-server`
19
- ```bash
20
- yarn install
21
- yarn start
22
- ```
23
- To run a local development server that serves the basic demo located in `index.html`
24
-
25
- ## Testing with Web Test Runner
26
- To run the suite of Web Test Runner tests, run
27
- ```bash
28
- yarn run test
29
- ```
30
-
31
- To run the tests in watch mode (for &lt;abbr title=&#34;test driven development&#34;&gt;TDD&lt;/abbr&gt;, for example), run
32
-
33
- ```bash
34
- yarn run test:watch
35
- ```
36
-
37
- ## Linting with ESLint, Prettier, and Types
38
- To scan the project for linting errors, run
39
- ```bash
40
- yarn run lint
41
- ```
42
-
43
- You can lint with ESLint and Prettier individually as well
44
- ```bash
45
- yarn run lint:eslint
46
- ```
47
- ```bash
48
- yarn run lint:prettier
49
- ```
50
-
51
- To automatically fix many linting errors, run
52
- ```bash
53
- yarn run format
54
- ```
55
-
56
- You can format using ESLint and Prettier individually as well
57
- ```bash
58
- yarn run format:eslint
59
- ```
60
- ```bash
61
- yarn run format:prettier
62
- ```
63
-
64
- ## Tooling configs
65
-
66
- For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
67
-
68
- If you customize the configuration a lot, you can consider moving them to individual files.
69
-
70
- ## Manual Deploy using `gh-pages`
71
-
72
- Live demo app from current main branch: [https://internetarchive.github.io/iaux-collection-browser](https://internetarchive.github.io/iaux-collection-browser)
73
-
74
- ```
75
- yarn run deploy
76
- ```
77
-
78
- ## Automatic Deploy of Demo App
79
-
80
- When you create a Pull Request, if your code passes codecov unit tests, it will be always served live at base url / pull request number. For this demo app, you must create a Pull Request, nothing will be created from a simple branch.
81
-
82
- This URL will be removed when the Pull Request is merged/closed.
83
-
1
+ ![Build Status](https://github.com/internetarchive/iaux-collection-browser/actions/workflows/ci.yml/badge.svg) [![codecov](https://codecov.io/gh/internetarchive/iaux-collection-browser/branch/main/graph/badge.svg?token=CLWEGO4RMQ)](https://codecov.io/gh/internetarchive/iaux-collection-browser)
2
+
3
+
4
+ # Internet Archive Collection Browser
5
+
6
+ This is the main collection browser for the Internet Archive website.
7
+
8
+ [Review app URL](https://internetarchive.github.io/iaux-collection-browser/main)
9
+ ## Usage
10
+
11
+ ```ts
12
+ import '@internetarchive/collection-browser';
13
+
14
+ <collection-browser>
15
+ </collection-browser>
16
+ ```
17
+
18
+ ## Local Demo with `web-dev-server`
19
+ ```bash
20
+ yarn install
21
+ yarn start
22
+ ```
23
+ To run a local development server that serves the basic demo located in `index.html`
24
+
25
+ ## Testing with Web Test Runner
26
+ To run the suite of Web Test Runner tests, run
27
+ ```bash
28
+ yarn run test
29
+ ```
30
+
31
+ To run the tests in watch mode (for &lt;abbr title=&#34;test driven development&#34;&gt;TDD&lt;/abbr&gt;, for example), run
32
+
33
+ ```bash
34
+ yarn run test:watch
35
+ ```
36
+
37
+ ## Linting with ESLint, Prettier, and Types
38
+ To scan the project for linting errors, run
39
+ ```bash
40
+ yarn run lint
41
+ ```
42
+
43
+ You can lint with ESLint and Prettier individually as well
44
+ ```bash
45
+ yarn run lint:eslint
46
+ ```
47
+ ```bash
48
+ yarn run lint:prettier
49
+ ```
50
+
51
+ To automatically fix many linting errors, run
52
+ ```bash
53
+ yarn run format
54
+ ```
55
+
56
+ You can format using ESLint and Prettier individually as well
57
+ ```bash
58
+ yarn run format:eslint
59
+ ```
60
+ ```bash
61
+ yarn run format:prettier
62
+ ```
63
+
64
+ ## Tooling configs
65
+
66
+ For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
67
+
68
+ If you customize the configuration a lot, you can consider moving them to individual files.
69
+
70
+ ## Manual Deploy using `gh-pages`
71
+
72
+ Live demo app from current main branch: [https://internetarchive.github.io/iaux-collection-browser](https://internetarchive.github.io/iaux-collection-browser)
73
+
74
+ ```
75
+ yarn run deploy
76
+ ```
77
+
78
+ ## Automatic Deploy of Demo App
79
+
80
+ When you create a Pull Request, if your code passes codecov unit tests, it will be always served live at base url / pull request number. For this demo app, you must create a Pull Request, nothing will be created from a simple branch.
81
+
82
+ This URL will be removed when the Pull Request is merged/closed.
83
+
84
84
  Example: `https://internetarchive.github.io/iaux-collection-browser/pr/<pr-number>`
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { CollectionBrowserDataSource } from './src/data-source/collection-browse
3
3
  export { CollectionBrowserDataSourceInterface } from './src/data-source/collection-browser-data-source-interface';
4
4
  export { CollectionBrowserQueryState } from './src/data-source/collection-browser-query-state';
5
5
  export { SortFilterBar } from './src/sort-filter-bar/sort-filter-bar';
6
- export { CollectionDisplayMode, SortField, TileModel } from './src/models';
6
+ export { CollectionDisplayMode, SortField, TileModel, FacetOption, SelectedFacets, getDefaultSelectedFacets, } from './src/models';
7
7
  export { CollectionBrowserLoadingTile } from './src/tiles/collection-browser-loading-tile';
8
8
  export { CollectionTile } from './src/tiles/grid/collection-tile';
9
9
  export { AccountTile } from './src/tiles/grid/account-tile';
@@ -11,3 +11,6 @@ export { ItemTile } from './src/tiles/grid/item-tile';
11
11
  export { TileList } from './src/tiles/list/tile-list';
12
12
  export { TileListCompact } from './src/tiles/list/tile-list-compact';
13
13
  export { TileDispatcher } from './src/tiles/tile-dispatcher';
14
+ export { SmartQueryHeuristic, KeywordFacetMap, SmartFacet, } from './src/collection-facets/smart-facets/models';
15
+ export * from './src/collection-facets/smart-facets/heuristics/index';
16
+ export { SmartQueryHeuristicGroup } from './src/collection-facets/smart-facets/smart-facet-heuristics';
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  export { CollectionBrowser } from './src/collection-browser';
2
2
  export { CollectionBrowserDataSource } from './src/data-source/collection-browser-data-source';
3
3
  export { SortFilterBar } from './src/sort-filter-bar/sort-filter-bar';
4
- export { SortField, TileModel } from './src/models';
4
+ export { SortField, TileModel, getDefaultSelectedFacets, } from './src/models';
5
5
  export { CollectionBrowserLoadingTile } from './src/tiles/collection-browser-loading-tile';
6
6
  export { CollectionTile } from './src/tiles/grid/collection-tile';
7
7
  export { AccountTile } from './src/tiles/grid/account-tile';
@@ -9,4 +9,6 @@ export { ItemTile } from './src/tiles/grid/item-tile';
9
9
  export { TileList } from './src/tiles/list/tile-list';
10
10
  export { TileListCompact } from './src/tiles/list/tile-list-compact';
11
11
  export { TileDispatcher } from './src/tiles/tile-dispatcher';
12
+ export * from './src/collection-facets/smart-facets/heuristics/index';
13
+ export { SmartQueryHeuristicGroup } from './src/collection-facets/smart-facets/smart-facet-heuristics';
12
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAG/F,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAAyB,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC3E,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC","sourcesContent":["export { CollectionBrowser } from './src/collection-browser';\nexport { CollectionBrowserDataSource } from './src/data-source/collection-browser-data-source';\nexport { CollectionBrowserDataSourceInterface } from './src/data-source/collection-browser-data-source-interface';\nexport { CollectionBrowserQueryState } from './src/data-source/collection-browser-query-state';\nexport { SortFilterBar } from './src/sort-filter-bar/sort-filter-bar';\nexport { CollectionDisplayMode, SortField, TileModel } from './src/models';\nexport { CollectionBrowserLoadingTile } from './src/tiles/collection-browser-loading-tile';\nexport { CollectionTile } from './src/tiles/grid/collection-tile';\nexport { AccountTile } from './src/tiles/grid/account-tile';\nexport { ItemTile } from './src/tiles/grid/item-tile';\nexport { TileList } from './src/tiles/list/tile-list';\nexport { TileListCompact } from './src/tiles/list/tile-list-compact';\nexport { TileDispatcher } from './src/tiles/tile-dispatcher';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kDAAkD,CAAC;AAG/F,OAAO,EAAE,aAAa,EAAE,MAAM,uCAAuC,CAAC;AACtE,OAAO,EAEL,SAAS,EACT,SAAS,EAGT,wBAAwB,GACzB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,4BAA4B,EAAE,MAAM,6CAA6C,CAAC;AAC3F,OAAO,EAAE,cAAc,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,oCAAoC,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAM7D,cAAc,uDAAuD,CAAC;AACtE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6DAA6D,CAAC","sourcesContent":["export { CollectionBrowser } from './src/collection-browser';\nexport { CollectionBrowserDataSource } from './src/data-source/collection-browser-data-source';\nexport { CollectionBrowserDataSourceInterface } from './src/data-source/collection-browser-data-source-interface';\nexport { CollectionBrowserQueryState } from './src/data-source/collection-browser-query-state';\nexport { SortFilterBar } from './src/sort-filter-bar/sort-filter-bar';\nexport {\n CollectionDisplayMode,\n SortField,\n TileModel,\n FacetOption,\n SelectedFacets,\n getDefaultSelectedFacets,\n} from './src/models';\nexport { CollectionBrowserLoadingTile } from './src/tiles/collection-browser-loading-tile';\nexport { CollectionTile } from './src/tiles/grid/collection-tile';\nexport { AccountTile } from './src/tiles/grid/account-tile';\nexport { ItemTile } from './src/tiles/grid/item-tile';\nexport { TileList } from './src/tiles/list/tile-list';\nexport { TileListCompact } from './src/tiles/list/tile-list-compact';\nexport { TileDispatcher } from './src/tiles/tile-dispatcher';\nexport {\n SmartQueryHeuristic,\n KeywordFacetMap,\n SmartFacet,\n} from './src/collection-facets/smart-facets/models';\nexport * from './src/collection-facets/smart-facets/heuristics/index';\nexport { SmartQueryHeuristicGroup } from './src/collection-facets/smart-facets/smart-facet-heuristics';\n"]}
@@ -596,11 +596,11 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
596
596
  * Fetches search results for privileged users when in manage view.
597
597
  *
598
598
  * This method:
599
- * 1. Checks if we're in search context with > 100 results and not currently loading
599
+ * 1. Checks if we're in search context and either haven't loaded results yet, or have already finished loading with > 100 total results
600
600
  * 2. Resets the datasource pagination state
601
601
  * 3. Fetches first page with limit based on maxPagesToManage threshold
602
602
  * 4. Reloads the infinite scroller to display new results
603
603
  */
604
- private fetchManagableSearchResults;
604
+ private fetchManageableSearchResults;
605
605
  static get styles(): import("lit").CSSResult[];
606
606
  }
@@ -1166,12 +1166,15 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1166
1166
  if (changed.has('isManageView')) {
1167
1167
  if (this.isManageView) {
1168
1168
  this.displayMode = 'grid';
1169
- this.fetchManagableSearchResults();
1169
+ this.fetchManageableSearchResults();
1170
1170
  }
1171
1171
  else if (this.pageContext === 'search')
1172
1172
  (_b = this.infiniteScroller) === null || _b === void 0 ? void 0 : _b.reload();
1173
1173
  (_c = this.infiniteScroller) === null || _c === void 0 ? void 0 : _c.refreshAllVisibleCells();
1174
- this.emitManageModeChangedEvent();
1174
+ // Only emit change event if changing b/w true & false, not on initial value set.
1175
+ if (changed.get('isManageView') !== undefined) {
1176
+ this.emitManageModeChangedEvent();
1177
+ }
1175
1178
  }
1176
1179
  if (changed.has('resizeObserver')) {
1177
1180
  const oldObserver = changed.get('resizeObserver');
@@ -1692,16 +1695,17 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1692
1695
  * Fetches search results for privileged users when in manage view.
1693
1696
  *
1694
1697
  * This method:
1695
- * 1. Checks if we're in search context with > 100 results and not currently loading
1698
+ * 1. Checks if we're in search context and either haven't loaded results yet, or have already finished loading with > 100 total results
1696
1699
  * 2. Resets the datasource pagination state
1697
1700
  * 3. Fetches first page with limit based on maxPagesToManage threshold
1698
1701
  * 4. Reloads the infinite scroller to display new results
1699
1702
  */
1700
- fetchManagableSearchResults() {
1703
+ fetchManageableSearchResults() {
1701
1704
  var _a;
1705
+ const hasNotLoadedInitialResults = !this.dataSource.totalResults;
1706
+ const hasLoadedWithMoreResultsAvailable = !this.searchResultsLoading && this.dataSource.totalResults > 100;
1702
1707
  if (this.pageContext === 'search' &&
1703
- this.dataSource.totalResults > 100 &&
1704
- !this.searchResultsLoading) {
1708
+ (hasNotLoadedInitialResults || hasLoadedWithMoreResultsAvailable)) {
1705
1709
  this.dataSource.resetPages();
1706
1710
  this.dataSource.fetchPage(1, this.maxPagesToManage);
1707
1711
  (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.reload();