@internetarchive/collection-browser 4.1.0-alpha-webdev8164.0 → 4.1.0-alpha-webdev8186.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 (51) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +27 -27
  3. package/.github/workflows/gh-pages-main.yml +39 -39
  4. package/.github/workflows/npm-publish.yml +39 -39
  5. package/.github/workflows/pr-preview.yml +38 -38
  6. package/.husky/pre-commit +4 -4
  7. package/.prettierignore +1 -1
  8. package/LICENSE +661 -661
  9. package/README.md +83 -83
  10. package/dist/index.d.ts +1 -0
  11. package/dist/index.js.map +1 -1
  12. package/dist/src/collection-browser.js +3 -13
  13. package/dist/src/collection-browser.js.map +1 -1
  14. package/dist/src/collection-facets/facets-template.js +0 -5
  15. package/dist/src/collection-facets/facets-template.js.map +1 -1
  16. package/dist/src/collection-facets/more-facets-content.d.ts +8 -47
  17. package/dist/src/collection-facets/more-facets-content.js +83 -382
  18. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  19. package/dist/src/collection-facets/more-facets-pagination.d.ts +0 -10
  20. package/dist/src/collection-facets/more-facets-pagination.js +1 -64
  21. package/dist/src/collection-facets/more-facets-pagination.js.map +1 -1
  22. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +13 -172
  23. package/dist/src/sort-filter-bar/sort-filter-bar.js +37 -546
  24. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  25. package/dist/test/collection-browser.test.js +8 -13
  26. package/dist/test/collection-browser.test.js.map +1 -1
  27. package/dist/test/collection-facets/more-facets-content.test.js +3 -154
  28. package/dist/test/collection-facets/more-facets-content.test.js.map +1 -1
  29. package/dist/test/collection-facets/more-facets-pagination.test.js +0 -60
  30. package/dist/test/collection-facets/more-facets-pagination.test.js.map +1 -1
  31. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +86 -401
  32. package/dist/test/sort-filter-bar/sort-filter-bar.test.js.map +1 -1
  33. package/eslint.config.mjs +53 -53
  34. package/index.html +24 -24
  35. package/index.ts +1 -0
  36. package/local.archive.org.cert +86 -86
  37. package/local.archive.org.key +27 -27
  38. package/package.json +121 -121
  39. package/renovate.json +6 -6
  40. package/src/collection-browser.ts +3 -13
  41. package/src/collection-facets/facets-template.ts +0 -5
  42. package/src/collection-facets/more-facets-content.ts +94 -411
  43. package/src/collection-facets/more-facets-pagination.ts +1 -73
  44. package/src/sort-filter-bar/sort-filter-bar.ts +42 -603
  45. package/test/collection-browser.test.ts +9 -20
  46. package/test/collection-facets/more-facets-content.test.ts +3 -218
  47. package/test/collection-facets/more-facets-pagination.test.ts +0 -84
  48. package/test/sort-filter-bar/sort-filter-bar.test.ts +110 -566
  49. package/tsconfig.json +25 -25
  50. package/web-dev-server.config.mjs +30 -30
  51. package/web-test-runner.config.mjs +52 -52
@@ -25,12 +25,6 @@ export class MoreFacetsPagination extends LitElement {
25
25
 
26
26
  @property({ type: Number }) currentPage: number = 1;
27
27
 
28
- /**
29
- * When true, shows a more compact set of page numbers
30
- * (only 1 neighbor on each side of the current page).
31
- */
32
- @property({ type: Boolean }) compact = false;
33
-
34
28
  @state() pages?: number[] = [];
35
29
 
36
30
  firstUpdated() {
@@ -39,7 +33,7 @@ export class MoreFacetsPagination extends LitElement {
39
33
 
40
34
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
41
35
  override updated(changed: Map<string, any>) {
42
- if (changed.has('size') || changed.has('compact')) {
36
+ if (changed.has('size')) {
43
37
  this.observePageCount();
44
38
  }
45
39
  if (changed.has('currentPage')) {
@@ -59,11 +53,6 @@ export class MoreFacetsPagination extends LitElement {
59
53
  observePageCount() {
60
54
  this.pages = []; /* `0` is elipses marker */
61
55
 
62
- if (this.compact) {
63
- this.observePageCountCompact();
64
- return;
65
- }
66
-
67
56
  const paginatorMaxPagesToShow = 7;
68
57
  const atMinThreshold = this.size <= paginatorMaxPagesToShow;
69
58
 
@@ -177,52 +166,6 @@ export class MoreFacetsPagination extends LitElement {
177
166
  }
178
167
  }
179
168
 
180
- /**
181
- * Compact page calculation: shows first, ..., prev, current, next, ..., last.
182
- * Only 1 neighbor on each side of the current page for minimal width.
183
- */
184
- private observePageCountCompact() {
185
- if (this.size <= 3) {
186
- this.pages = [...Array(this.size).keys()].map(i => i + 1);
187
- return;
188
- }
189
-
190
- const pages: number[] = [];
191
-
192
- // First page
193
- pages.push(1);
194
-
195
- // Ellipsis after first if current is far enough away
196
- if (this.currentPage > 3) {
197
- pages.push(0);
198
- }
199
-
200
- // Previous page (if not already shown as first)
201
- if (this.currentPage - 1 > 1) {
202
- pages.push(this.currentPage - 1);
203
- }
204
-
205
- // Current page (if not first or last)
206
- if (this.currentPage !== 1 && this.currentPage !== this.size) {
207
- pages.push(this.currentPage);
208
- }
209
-
210
- // Next page (if not already the last)
211
- if (this.currentPage + 1 < this.size) {
212
- pages.push(this.currentPage + 1);
213
- }
214
-
215
- // Ellipsis before last if current is far enough away
216
- if (this.currentPage < this.size - 2) {
217
- pages.push(0);
218
- }
219
-
220
- // Last page
221
- pages.push(this.size);
222
-
223
- this.pages = pages;
224
- }
225
-
226
169
  private get getEllipsisTemplate() {
227
170
  return html`<i class="ellipses">...</i>`;
228
171
  }
@@ -307,10 +250,6 @@ export class MoreFacetsPagination extends LitElement {
307
250
  margin-top: 10px;
308
251
  background-color: #eee;
309
252
  text-align: center;
310
- display: flex;
311
- align-items: center;
312
- justify-content: center;
313
- flex-wrap: nowrap;
314
253
  }
315
254
  .facets-pagination button {
316
255
  border: none;
@@ -337,7 +276,6 @@ export class MoreFacetsPagination extends LitElement {
337
276
  vertical-align: baseline;
338
277
  display: inline-block;
339
278
  min-width: 2.5rem;
340
- font-family: inherit;
341
279
  }
342
280
  .facets-pagination i {
343
281
  cursor: auto;
@@ -350,16 +288,6 @@ export class MoreFacetsPagination extends LitElement {
350
288
  .page-numbers {
351
289
  display: inline-block;
352
290
  }
353
-
354
- @media (max-width: 560px) {
355
- .facets-pagination button,
356
- .facets-pagination i {
357
- margin: 5px 2px;
358
- padding: 3px;
359
- min-width: 2rem;
360
- font-size: 1.2rem;
361
- }
362
- }
363
291
  `,
364
292
  ];
365
293
  }