@internetarchive/collection-browser 4.2.0-alpha-webdev8164.3 → 4.2.1-alpha-webdev7004.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 (88) hide show
  1. package/.claude/settings.local.json +11 -0
  2. package/.editorconfig +29 -29
  3. package/.github/workflows/ci.yml +27 -27
  4. package/.github/workflows/gh-pages-main.yml +39 -39
  5. package/.github/workflows/npm-publish.yml +39 -39
  6. package/.github/workflows/pr-preview.yml +38 -38
  7. package/.husky/pre-commit +1 -1
  8. package/.prettierignore +1 -1
  9. package/LICENSE +661 -661
  10. package/README.md +83 -83
  11. package/dist/src/app-root.js +4 -0
  12. package/dist/src/app-root.js.map +1 -1
  13. package/dist/src/collection-browser.js +32 -27
  14. package/dist/src/collection-browser.js.map +1 -1
  15. package/dist/src/collection-facets/facets-template.js +0 -5
  16. package/dist/src/collection-facets/facets-template.js.map +1 -1
  17. package/dist/src/collection-facets/more-facets-content.d.ts +8 -106
  18. package/dist/src/collection-facets/more-facets-content.js +103 -612
  19. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  20. package/dist/src/collection-facets/more-facets-pagination.d.ts +3 -12
  21. package/dist/src/collection-facets/more-facets-pagination.js +9 -71
  22. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  23. package/dist/src/collection-facets/toggle-switch.js +0 -1
  24. package/dist/src/collection-facets/toggle-switch.js.map +1 -1
  25. package/dist/src/collection-facets.js +9 -10
  26. package/dist/src/collection-facets.js.map +1 -1
  27. package/dist/src/data-source/collection-browser-data-source.d.ts +7 -0
  28. package/dist/src/data-source/collection-browser-data-source.js +27 -10
  29. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  30. package/dist/src/mediatype/mediatype-config.js +1 -1
  31. package/dist/src/mediatype/mediatype-config.js.map +1 -1
  32. package/dist/src/models.d.ts +12 -2
  33. package/dist/src/models.js +13 -8
  34. package/dist/src/models.js.map +1 -1
  35. package/dist/src/restoration-state-handler.js +9 -3
  36. package/dist/src/restoration-state-handler.js.map +1 -1
  37. package/dist/src/tiles/hover/hover-pane-controller.js +2 -1
  38. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  39. package/dist/src/tiles/tile-dispatcher.d.ts +6 -0
  40. package/dist/src/tiles/tile-dispatcher.js +11 -3
  41. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  42. package/dist/test/collection-browser.test.js +72 -0
  43. package/dist/test/collection-browser.test.js.map +1 -1
  44. package/dist/test/collection-facets/more-facets-content.test.js +3 -212
  45. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  46. package/dist/test/collection-facets/more-facets-pagination.test.js +3 -63
  47. package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
  48. package/dist/test/data-source/collection-browser-data-source.test.js +52 -0
  49. package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -1
  50. package/dist/test/mocks/mock-search-responses.d.ts +0 -5
  51. package/dist/test/mocks/mock-search-responses.js +0 -44
  52. package/dist/test/mocks/mock-search-responses.js.map +1 -1
  53. package/dist/test/mocks/mock-search-service.js +1 -2
  54. package/dist/test/mocks/mock-search-service.js.map +1 -1
  55. package/dist/test/tiles/tile-dispatcher.test.js +14 -0
  56. package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
  57. package/dist/test/tiles/tile-mediatype-icon.test.js +4 -4
  58. package/dist/test/tiles/tile-mediatype-icon.test.js.map +1 -1
  59. package/eslint.config.mjs +53 -53
  60. package/index.html +24 -24
  61. package/local.archive.org.cert +86 -86
  62. package/local.archive.org.key +27 -27
  63. package/package.json +120 -121
  64. package/renovate.json +6 -6
  65. package/src/app-root.ts +4 -0
  66. package/src/collection-browser.ts +43 -36
  67. package/src/collection-facets/facets-template.ts +0 -5
  68. package/src/collection-facets/more-facets-content.ts +113 -662
  69. package/src/collection-facets/more-facets-pagination.ts +10 -84
  70. package/src/collection-facets/toggle-switch.ts +0 -1
  71. package/src/collection-facets.ts +13 -10
  72. package/src/data-source/collection-browser-data-source.ts +31 -10
  73. package/src/mediatype/mediatype-config.ts +1 -1
  74. package/src/models.ts +30 -8
  75. package/src/restoration-state-handler.ts +7 -3
  76. package/src/tiles/hover/hover-pane-controller.ts +2 -1
  77. package/src/tiles/tile-dispatcher.ts +12 -3
  78. package/test/collection-browser.test.ts +105 -0
  79. package/test/collection-facets/more-facets-content.test.ts +4 -326
  80. package/test/collection-facets/more-facets-pagination.test.ts +3 -87
  81. package/test/data-source/collection-browser-data-source.test.ts +62 -0
  82. package/test/mocks/mock-search-responses.ts +0 -48
  83. package/test/mocks/mock-search-service.ts +0 -2
  84. package/test/tiles/tile-dispatcher.test.ts +17 -0
  85. package/test/tiles/tile-mediatype-icon.test.ts +4 -4
  86. package/tsconfig.json +25 -25
  87. package/web-dev-server.config.mjs +30 -30
  88. package/web-test-runner.config.mjs +52 -52
package/package.json CHANGED
@@ -1,121 +1,120 @@
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": "4.2.0-alpha-webdev8164.3",
7
- "main": "dist/index.js",
8
- "module": "dist/index.js",
9
- "scripts": {
10
- "start": "vite",
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
- "@a11y/focus-trap": "^1.0.5",
27
- "@internetarchive/analytics-manager": "^0.1.4",
28
- "@internetarchive/elements": "^0.2.2",
29
- "@internetarchive/feature-feedback": "^1.0.0",
30
- "@internetarchive/field-parsers": "^1.0.0",
31
- "@internetarchive/histogram-date-range": "^1.4.1",
32
- "@internetarchive/ia-clearable-text-input": "^1.1.1",
33
- "@internetarchive/ia-dropdown": "^2.0.0",
34
- "@internetarchive/iaux-item-metadata": "^1.0.5",
35
- "@internetarchive/infinite-scroller": "^1.0.1",
36
- "@internetarchive/modal-manager": "^2.0.5",
37
- "@internetarchive/search-service": "^2.7.0",
38
- "@internetarchive/shared-resize-observer": "^0.2.0",
39
- "@lit/localize": "^0.12.2",
40
- "dompurify": "^3.2.4",
41
- "lit": "^2.8.0 || ^3.3.2",
42
- "typescript-cookie": "^1.0.6"
43
- },
44
- "devDependencies": {
45
- "@internetarchive/result-type": "^0.0.1",
46
- "@open-wc/eslint-config": "^12.0.3",
47
- "@open-wc/testing": "^4.0.0",
48
- "@rollup/plugin-image": "^3.0.3",
49
- "@types/dompurify": "^3.2.0",
50
- "@types/mocha": "^10.0.10",
51
- "@typescript-eslint/eslint-plugin": "^8.27.0",
52
- "@typescript-eslint/parser": "^8.27.0",
53
- "@vitejs/plugin-basic-ssl": "^2.1.4",
54
- "@web/dev-server": "^0.4.6",
55
- "@web/dev-server-rollup": "^0.6.4",
56
- "@web/test-runner": "^0.20.0",
57
- "concurrently": "^9.1.2",
58
- "eslint": "^9.22.0",
59
- "eslint-config-prettier": "^10.1.1",
60
- "eslint-plugin-html": "^8.1.2",
61
- "eslint-plugin-import": "^2.31.0",
62
- "eslint-plugin-lit": "^2.0.0",
63
- "eslint-plugin-lit-a11y": "^4.1.4",
64
- "eslint-plugin-no-only-tests": "^3.3.0",
65
- "eslint-plugin-wc": "^3.0.0",
66
- "gh-pages": "^6.3.0",
67
- "husky": "^9.1.7",
68
- "madge": "^8.0.0",
69
- "prettier": "^3.5.3",
70
- "rimraf": "^6.0.1",
71
- "sinon": "^19.0.4",
72
- "tslib": "^2.8.1",
73
- "typescript": "^5.8.2",
74
- "vite": "^6.2.2"
75
- },
76
- "publishConfig": {
77
- "access": "public"
78
- },
79
- "eslintConfig": {
80
- "parser": "@typescript-eslint/parser",
81
- "extends": [
82
- "@open-wc",
83
- "prettier"
84
- ],
85
- "plugins": [
86
- "@typescript-eslint"
87
- ],
88
- "rules": {
89
- "no-unused-vars": "off",
90
- "@typescript-eslint/no-unused-vars": [
91
- "error"
92
- ],
93
- "no-shadow": "off",
94
- "@typescript-eslint/no-shadow": [
95
- "error"
96
- ],
97
- "class-methods-use-this": "off",
98
- "import/no-unresolved": "off",
99
- "import/extensions": [
100
- "off",
101
- "ignorePackages",
102
- {
103
- "js": "never",
104
- "ts": "never"
105
- }
106
- ],
107
- "no-unsafe-optional-chaining": "warn",
108
- "default-param-last": "warn"
109
- }
110
- },
111
- "prettier": {
112
- "singleQuote": true,
113
- "arrowParens": "avoid"
114
- },
115
- "lint-staged": {
116
- "*.ts": [
117
- "eslint --fix",
118
- "prettier --write"
119
- ]
120
- }
121
- }
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": "4.2.1-alpha-webdev7004.0",
7
+ "main": "dist/index.js",
8
+ "module": "dist/index.js",
9
+ "scripts": {
10
+ "start": "vite",
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
+ "@a11y/focus-trap": "^1.0.5",
27
+ "@internetarchive/analytics-manager": "^0.1.4",
28
+ "@internetarchive/elements": "^0.2.2",
29
+ "@internetarchive/feature-feedback": "^1.0.0",
30
+ "@internetarchive/field-parsers": "^1.0.0",
31
+ "@internetarchive/histogram-date-range": "^1.4.1",
32
+ "@internetarchive/ia-dropdown": "^2.0.0",
33
+ "@internetarchive/iaux-item-metadata": "^1.0.5",
34
+ "@internetarchive/infinite-scroller": "^1.0.1",
35
+ "@internetarchive/modal-manager": "^2.0.5",
36
+ "@internetarchive/search-service": "^2.7.1",
37
+ "@internetarchive/shared-resize-observer": "^0.2.0",
38
+ "@lit/localize": "^0.12.2",
39
+ "dompurify": "^3.2.4",
40
+ "lit": "^2.8.0 || ^3.3.2",
41
+ "typescript-cookie": "^1.0.6"
42
+ },
43
+ "devDependencies": {
44
+ "@internetarchive/result-type": "^0.0.1",
45
+ "@open-wc/eslint-config": "^13.0.0",
46
+ "@open-wc/testing": "^4.0.0",
47
+ "@rollup/plugin-image": "^3.0.3",
48
+ "@types/dompurify": "^3.2.0",
49
+ "@types/mocha": "^10.0.10",
50
+ "@typescript-eslint/eslint-plugin": "^8.27.0",
51
+ "@typescript-eslint/parser": "^8.27.0",
52
+ "@vitejs/plugin-basic-ssl": "^2.1.4",
53
+ "@web/dev-server": "^0.4.6",
54
+ "@web/dev-server-rollup": "^0.6.4",
55
+ "@web/test-runner": "^0.20.0",
56
+ "concurrently": "^9.1.2",
57
+ "eslint": "^9.22.0",
58
+ "eslint-config-prettier": "^10.1.1",
59
+ "eslint-plugin-html": "^8.1.2",
60
+ "eslint-plugin-import": "^2.31.0",
61
+ "eslint-plugin-lit": "^2.0.0",
62
+ "eslint-plugin-lit-a11y": "^5.0.0",
63
+ "eslint-plugin-no-only-tests": "^3.3.0",
64
+ "eslint-plugin-wc": "^3.0.0",
65
+ "gh-pages": "^6.3.0",
66
+ "husky": "^9.1.7",
67
+ "madge": "^8.0.0",
68
+ "prettier": "^3.5.3",
69
+ "rimraf": "^6.0.1",
70
+ "sinon": "^19.0.4",
71
+ "tslib": "^2.8.1",
72
+ "typescript": "^5.8.2",
73
+ "vite": "^8.0.0"
74
+ },
75
+ "publishConfig": {
76
+ "access": "public"
77
+ },
78
+ "eslintConfig": {
79
+ "parser": "@typescript-eslint/parser",
80
+ "extends": [
81
+ "@open-wc",
82
+ "prettier"
83
+ ],
84
+ "plugins": [
85
+ "@typescript-eslint"
86
+ ],
87
+ "rules": {
88
+ "no-unused-vars": "off",
89
+ "@typescript-eslint/no-unused-vars": [
90
+ "error"
91
+ ],
92
+ "no-shadow": "off",
93
+ "@typescript-eslint/no-shadow": [
94
+ "error"
95
+ ],
96
+ "class-methods-use-this": "off",
97
+ "import/no-unresolved": "off",
98
+ "import/extensions": [
99
+ "off",
100
+ "ignorePackages",
101
+ {
102
+ "js": "never",
103
+ "ts": "never"
104
+ }
105
+ ],
106
+ "no-unsafe-optional-chaining": "warn",
107
+ "default-param-last": "warn"
108
+ }
109
+ },
110
+ "prettier": {
111
+ "singleQuote": true,
112
+ "arrowParens": "avoid"
113
+ },
114
+ "lint-staged": {
115
+ "*.ts": [
116
+ "eslint --fix",
117
+ "prettier --write"
118
+ ]
119
+ }
120
+ }
package/renovate.json CHANGED
@@ -1,6 +1,6 @@
1
- {
2
- "extends": [
3
- "config:base",
4
- ":preserveSemverRanges"
5
- ]
6
- }
1
+ {
2
+ "extends": [
3
+ "config:base",
4
+ ":preserveSemverRanges"
5
+ ]
6
+ }
package/src/app-root.ts CHANGED
@@ -950,6 +950,10 @@ export class AppRoot extends LitElement {
950
950
  --modalBorder: 2px solid var(--primaryButtonBGColor, #194880);
951
951
  --modalTitleLineHeight: 4rem;
952
952
  --modalTitleFontSize: 1.8rem;
953
+ --modalCornerRadius: 0;
954
+ --modalBottomPadding: 0;
955
+ --modalBottomMargin: 0;
956
+ --modalScrollOffset: 0;
953
957
  --modalCornerRadius: 0.5rem;
954
958
  }
955
959
  modal-manager.expanded-date-picker {
@@ -605,6 +605,43 @@ export class CollectionBrowser
605
605
  if (changed.has('searchType') && this.searchType === SearchType.TV) {
606
606
  this.applyDefaultTVSearchSort();
607
607
  }
608
+
609
+ // If we need to clear filters due to a query change or other reset, we do so *before* any
610
+ // updates happen, to prevent unnecessary update cycles and ensure there's a clean slate
611
+ // for any search requests that fire.
612
+ if (
613
+ changed.has('baseQuery') ||
614
+ changed.has('identifiers') ||
615
+ changed.has('searchType') ||
616
+ changed.has('withinCollection')
617
+ ) {
618
+ // Unless this query/search type update is from the initial page load or the
619
+ // result of hitting the back button,
620
+ // we need to clear any existing filters since they may no longer be valid for
621
+ // the new set of search results.
622
+ if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
623
+ // Ordinarily, we leave the sort param unchanged between searches.
624
+ // However, if we are changing the target collection itself, we want the sort cleared too,
625
+ // since different collections may have different sorting options available.
626
+ const shouldClearSort =
627
+ changed.has('withinCollection') &&
628
+ !changed.has('selectedSort') &&
629
+ !changed.has('sortDirection');
630
+
631
+ // Otherwise, only clear filters that haven't been simultaneously applied in this update
632
+ this.clearFilters({
633
+ sort: shouldClearSort,
634
+ facets: !changed.has('selectedFacets'),
635
+ dateRange: !(
636
+ changed.has('minSelectedDate') || changed.has('maxSelectedDate')
637
+ ),
638
+ letterFilters: !(
639
+ changed.has('selectedTitleFilter') ||
640
+ changed.has('selectedCreatorFilter')
641
+ ),
642
+ });
643
+ }
644
+ }
608
645
  }
609
646
 
610
647
  render() {
@@ -860,8 +897,12 @@ export class CollectionBrowser
860
897
  let sortFieldAvailability = defaultSortAvailability;
861
898
 
862
899
  // We adjust the available sort options for a couple of special cases...
863
- if (this.withinCollection?.startsWith('fav-')) {
864
- // When viewing a fav- collection, we include the Date Favorited option as the default
900
+ if (
901
+ this.withinCollection?.startsWith('fav-') ||
902
+ this.profileElement === 'favorites'
903
+ ) {
904
+ // When viewing a fav- collection or the favorites profile tab,
905
+ // we include the Date Favorited option as the default
865
906
  sortFieldAvailability = favoritesSortAvailability;
866
907
  } else if (!this.withinCollection && this.searchType === SearchType.TV) {
867
908
  // When viewing TV search results, we exclude several of the usual date sort options.
@@ -1722,40 +1763,6 @@ export class CollectionBrowser
1722
1763
  this.infiniteScroller?.reload();
1723
1764
  }
1724
1765
 
1725
- if (
1726
- changed.has('baseQuery') ||
1727
- changed.has('identifiers') ||
1728
- changed.has('searchType') ||
1729
- changed.has('withinCollection')
1730
- ) {
1731
- // Unless this query/search type update is from the initial page load or the
1732
- // result of hitting the back button,
1733
- // we need to clear any existing filters since they may no longer be valid for
1734
- // the new set of search results.
1735
- if (!this.historyPopOccurred && this.initialQueryChangeHappened) {
1736
- // Ordinarily, we leave the sort param unchanged between searches.
1737
- // However, if we are changing the target collection itself, we want the sort cleared too,
1738
- // since different collections may have different sorting options available.
1739
- const shouldClearSort =
1740
- changed.has('withinCollection') &&
1741
- !changed.has('selectedSort') &&
1742
- !changed.has('sortDirection');
1743
-
1744
- // Otherwise, only clear filters that haven't been simultaneously applied in this update
1745
- this.clearFilters({
1746
- sort: shouldClearSort,
1747
- facets: !changed.has('selectedFacets'),
1748
- dateRange: !(
1749
- changed.has('minSelectedDate') || changed.has('maxSelectedDate')
1750
- ),
1751
- letterFilters: !(
1752
- changed.has('selectedTitleFilter') ||
1753
- changed.has('selectedCreatorFilter')
1754
- ),
1755
- });
1756
- }
1757
- }
1758
-
1759
1766
  if (changed.has('profileElement')) {
1760
1767
  this.applyDefaultProfileSort();
1761
1768
  }
@@ -63,16 +63,11 @@ export class FacetsTemplate extends LitElement {
63
63
  static get styles(): CSSResultGroup {
64
64
  const columnCount = css`var(--facetsColumnCount, 1)`;
65
65
  const columnGap = css`var(--facetsColumnGap, 15px)`;
66
- const columnWidth = css`var(--facetsColumnWidth, auto)`;
67
- const maxHeight = css`var(--facetsMaxHeight, none)`;
68
66
 
69
67
  return css`
70
68
  .facet-rows {
71
69
  column-count: ${columnCount};
72
70
  column-gap: ${columnGap};
73
- column-width: ${columnWidth};
74
- max-height: ${maxHeight};
75
- column-fill: auto;
76
71
  }
77
72
 
78
73
  a:link,