@internetarchive/collection-browser 4.8.1-webdev-9227.3 → 4.9.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 (78) hide show
  1. package/README.md +0 -33
  2. package/dist/src/collection-browser.d.ts +1 -2
  3. package/dist/src/collection-browser.js +35 -13
  4. package/dist/src/collection-browser.js.map +1 -1
  5. package/dist/src/collection-facets/facet-row-template.d.ts +1 -1
  6. package/dist/src/collection-facets/facet-row-template.js +7 -14
  7. package/dist/src/collection-facets/facet-row-template.js.map +1 -1
  8. package/dist/src/collection-facets/facet-row.js +1 -3
  9. package/dist/src/collection-facets/facet-row.js.map +1 -1
  10. package/dist/src/collection-facets/more-facets-content.js +5 -6
  11. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  12. package/dist/src/collection-facets/more-facets-scroller.js +2 -3
  13. package/dist/src/collection-facets/more-facets-scroller.js.map +1 -1
  14. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js +4 -13
  15. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-entity-map.js.map +1 -1
  16. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +2 -6
  17. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  18. package/dist/src/collection-facets.js +5 -6
  19. package/dist/src/collection-facets.js.map +1 -1
  20. package/dist/src/empty-placeholder.d.ts +7 -7
  21. package/dist/src/empty-placeholder.js +15 -29
  22. package/dist/src/empty-placeholder.js.map +1 -1
  23. package/dist/src/expanded-date-picker.js +2 -3
  24. package/dist/src/expanded-date-picker.js.map +1 -1
  25. package/dist/src/manage/manage-bar.d.ts +2 -3
  26. package/dist/src/manage/manage-bar.js +16 -15
  27. package/dist/src/manage/manage-bar.js.map +1 -1
  28. package/dist/src/manage/remove-items-modal-content.js +2 -3
  29. package/dist/src/manage/remove-items-modal-content.js.map +1 -1
  30. package/dist/src/mediatype/mediatype-config.js +18 -55
  31. package/dist/src/mediatype/mediatype-config.js.map +1 -1
  32. package/dist/src/models.js +40 -120
  33. package/dist/src/models.js.map +1 -1
  34. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js +2 -8
  35. package/dist/src/sort-filter-bar/alpha-bar-tooltip.js.map +1 -1
  36. package/dist/src/sort-filter-bar/alpha-bar.js +2 -7
  37. package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
  38. package/dist/src/sort-filter-bar/sort-filter-bar.js +45 -28
  39. package/dist/src/sort-filter-bar/sort-filter-bar.js.map +1 -1
  40. package/dist/src/tiles/grid/account-tile.js +2 -3
  41. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  42. package/dist/src/tiles/grid/collection-tile.js +6 -12
  43. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  44. package/dist/src/tiles/grid/item-tile.js +7 -8
  45. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  46. package/dist/src/tiles/grid/tile-stats.js +3 -6
  47. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  48. package/dist/src/tiles/list/tile-list-compact-header.js +2 -3
  49. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  50. package/dist/src/tiles/list/tile-list-compact.js +1 -3
  51. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  52. package/dist/src/tiles/list/tile-list.js +5 -15
  53. package/dist/src/tiles/list/tile-list.js.map +1 -1
  54. package/dist/src/tiles/overlay/text-overlay.js +1 -3
  55. package/dist/src/tiles/overlay/text-overlay.js.map +1 -1
  56. package/dist/src/tiles/review-block.js +2 -3
  57. package/dist/src/tiles/review-block.js.map +1 -1
  58. package/dist/src/tiles/tile-dispatcher.d.ts +1 -2
  59. package/dist/src/tiles/tile-dispatcher.js +5 -6
  60. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  61. package/dist/src/tiles/tile-mediatype-icon.js +1 -3
  62. package/dist/src/tiles/tile-mediatype-icon.js.map +1 -1
  63. package/dist/src/utils/format-count.d.ts +1 -3
  64. package/dist/src/utils/format-count.js +59 -19
  65. package/dist/src/utils/format-count.js.map +1 -1
  66. package/dist/src/utils/format-unit-size.d.ts +1 -1
  67. package/dist/src/utils/format-unit-size.js +18 -21
  68. package/dist/src/utils/format-unit-size.js.map +1 -1
  69. package/dist/src/utils/log.d.ts +4 -1
  70. package/package.json +2 -10
  71. package/dist/src/locales/es.d.ts +0 -200
  72. package/dist/src/locales/es.js +0 -215
  73. package/dist/src/locales/es.js.map +0 -1
  74. package/dist/src/utils/get-locale.d.ts +0 -14
  75. package/dist/src/utils/get-locale.js +0 -18
  76. package/dist/src/utils/get-locale.js.map +0 -1
  77. package/locales/es.d.ts +0 -1
  78. package/locales/es.js +0 -1
package/README.md CHANGED
@@ -45,39 +45,6 @@ To automatically fix many linting errors, run
45
45
  pnpm run format
46
46
  ```
47
47
 
48
- ## Localization
49
-
50
- Wrap user-facing text in `msg()` from `@lit/localize`, inside `render()` or a getter it calls. The first argument has to be a literal: a string, `` str`...${x}` `` when it has an expression, or `` html`...` `` when it has markup. A `msg()` that runs at module scope or in a static field resolves once at import, so it never changes language. A string that has to live outside `render()` goes in a getter, static or not, so it's read at render time.
51
-
52
- Every component that renders a `msg()` string, directly or through a helper, needs `@localized()` from `@lit/localize`. Without it the component doesn't re-render when the app switches locale.
53
-
54
- This package never calls `configureLocalization`. `@lit/localize` can only be configured once per page, so the app owns that call and loads one bundle holding its own messages and ours. We publish our translations for the app to merge in:
55
-
56
- ```bash
57
- pnpm run strings:extract # add new msg() strings to xliff/<locale>.xlf
58
- # translate the empty <target>s in xliff/<locale>.xlf
59
- pnpm run strings:build # write src/locales/<locale>.ts
60
- ```
61
-
62
- Commit all three: the XLIFF, the generated module and the source change.
63
-
64
- ### What gets published
65
-
66
- `@internetarchive/collection-browser/locales/<locale>.js` exports `templates`, the same shape `lit-localize build` writes in runtime mode: an object keyed by message id (a hash of the English source) whose values are what `loadLocale` returns. It only holds messages that have a translation. A message with no translation is left out instead of falling back to English, so merging it can never override another package's or the app's translation of the same text.
67
-
68
- That path is a stub in `locales/` at the package root that re-exports `dist/src/locales/<locale>.js`. The package has no `exports` map, so a deep import resolves to a real file, and adding a map would break every other deep import. A new locale needs its own pair of stubs (`.js` and `.d.ts`).
69
-
70
- To merge it, an app spreads it under its own templates, app last so the app wins a conflict:
71
-
72
- ```ts
73
- import { templates as collectionBrowser } from '@internetarchive/collection-browser/locales/es.js';
74
- import { templates as app } from './app-es';
75
-
76
- export const templates = { ...collectionBrowser, ...app };
77
- ```
78
-
79
- The XLIFF in `xliff/` is where translations are edited. It isn't published.
80
-
81
48
  ## Tooling configs
82
49
 
83
50
  For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
@@ -172,8 +172,7 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
172
172
  * `LayoutType` for available options. Has no effect on list display modes.
173
173
  */
174
174
  tileLayoutType: LayoutType;
175
- /** Label for the manage bar. Defaults to the manage bar's own localized label. */
176
- manageViewLabel?: string;
175
+ manageViewLabel: string;
177
176
  /** Whether to replace the default sort options with a slot for customization (default: false) */
178
177
  enableSortOptionsSlot: boolean;
179
178
  /** Whether to expose a slot for a smart results carousel above the full results */
@@ -3,7 +3,7 @@ import { __decorate } from "tslib";
3
3
  import { html, css, LitElement, nothing, } from 'lit';
4
4
  import { customElement, property, query, state } from 'lit/decorators.js';
5
5
  import { classMap } from 'lit/directives/class-map.js';
6
- import { localized, msg } from '@lit/localize';
6
+ import { msg } from '@lit/localize';
7
7
  import { SearchType, } from '@internetarchive/search-service';
8
8
  import '@internetarchive/infinite-scroller';
9
9
  import { SortField, getDefaultSelectedFacets, sortOptionFromAPIString, SORT_OPTIONS, defaultProfileElementSorts, defaultFacetDisplayOrder, tvFacetDisplayOrder, defaultSortAvailability, favoritesSortAvailability, tvSortAvailability, } from './models';
@@ -15,7 +15,6 @@ import { updateSelectedFacetBucket } from './utils/facet-utils';
15
15
  import chevronIcon from './assets/img/icons/chevron';
16
16
  import { srOnlyStyle } from './styles/sr-only';
17
17
  import { sha1 } from './utils/sha1';
18
- import { getLocale } from './utils/get-locale';
19
18
  import '@internetarchive/elements/ia-combo-box/ia-combo-box';
20
19
  import './empty-placeholder';
21
20
  import './tiles/tile-dispatcher';
@@ -132,6 +131,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
132
131
  * `LayoutType` for available options. Has no effect on list display modes.
133
132
  */
134
133
  this.tileLayoutType = 'default';
134
+ this.manageViewLabel = 'Select items to remove';
135
135
  /** Whether to replace the default sort options with a slot for customization (default: false) */
136
136
  this.enableSortOptionsSlot = false;
137
137
  /** Whether to expose a slot for a smart results carousel above the full results */
@@ -609,15 +609,13 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
609
609
  return nothing;
610
610
  const shouldShowSearching = this.searchResultsLoading || this.totalResults === undefined;
611
611
  const classes = classMap({ filtered: this.hasActiveFilters });
612
- const resultsCount = this.totalResults === undefined
613
- ? undefined
614
- : new Intl.NumberFormat(getLocale()).format(this.totalResults);
615
- const resultsLabel = this.totalResults === 1 ? msg('Result') : msg('Results');
612
+ const resultsCount = this.totalResults?.toLocaleString();
613
+ const resultsLabel = this.totalResults === 1 ? 'Result' : 'Results';
616
614
  // Added data-testid for Playwright testing
617
615
  return html `
618
616
  <div id="results-total" class=${classes} data-testid="results-total">
619
617
  <span id="big-results-count">
620
- ${shouldShowSearching ? msg('Searching…') : resultsCount}
618
+ ${shouldShowSearching ? html `Searching&hellip;` : resultsCount}
621
619
  </span>
622
620
  <span id="big-results-label">
623
621
  ${shouldShowSearching ? nothing : resultsLabel}
@@ -651,10 +649,17 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
651
649
  ? this.manageBarTemplate
652
650
  : this.sortFilterBarTemplate}
653
651
  <slot name="cb-results"></slot>
654
- ${this.displayMode === `list-compact` && this.totalResults
652
+ <div id="results-body">
653
+ <slot name="results-aside"></slot>
654
+ <div id="results-main">
655
+ ${this.displayMode === `list-compact` && this.totalResults
655
656
  ? this.listHeaderTemplate
656
657
  : nothing}
657
- ${this.suppressResultTiles ? nothing : this.infiniteScrollerTemplate}
658
+ ${this.suppressResultTiles
659
+ ? nothing
660
+ : this.infiniteScrollerTemplate}
661
+ </div>
662
+ </div>
658
663
  </section>
659
664
  </div>
660
665
  `;
@@ -666,7 +671,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
666
671
  return html `<infinite-scroller
667
672
  class=${this.infiniteScrollerClasses}
668
673
  itemCount=${this.placeholderType ? 0 : nothing}
669
- ariaLandmarkLabel=${msg('Search results')}
674
+ ariaLandmarkLabel="Search results"
670
675
  .estimatedCellHeight=${this.estimatedTileHeight}
671
676
  .minBufferMarginCells=${this.pageSize}
672
677
  .cellProvider=${this}
@@ -749,6 +754,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
749
754
  <slot name="sort-options-left" slot="sort-options-left"></slot>
750
755
  <slot name="sort-options" slot="sort-options"></slot>
751
756
  <slot name="sort-options-right" slot="sort-options-right"></slot>
757
+ <slot name="sort-bar-end" slot="sort-bar-end"></slot>
752
758
  </sort-filter-bar>
753
759
  `;
754
760
  }
@@ -1272,7 +1278,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1272
1278
  'clear-filters-btn': true,
1273
1279
  mobile,
1274
1280
  });
1275
- const buttonText = mobile ? msg('Clear all') : msg('Clear all filters');
1281
+ const buttonText = mobile ? 'Clear all' : 'Clear all filters';
1276
1282
  return html `
1277
1283
  <div class="clear-filters-btn-row">
1278
1284
  ${mobile
@@ -2221,6 +2227,23 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
2221
2227
  padding: 5px 5px 0;
2222
2228
  }
2223
2229
 
2230
+ /*
2231
+ * The results sit in a row with the optional results-aside slot, which
2232
+ * lays out beside them as a flex item and takes its own width and spacing.
2233
+ * The aside comes first in the DOM so keyboard and screen reader users
2234
+ * reach it before the infinitely scrolling tiles, but it shows on the right.
2235
+ */
2236
+ #results-body {
2237
+ display: flex;
2238
+ align-items: flex-start;
2239
+ }
2240
+
2241
+ #results-main {
2242
+ order: -1;
2243
+ flex: 1;
2244
+ min-width: 0;
2245
+ }
2246
+
2224
2247
  #left-column {
2225
2248
  width: var(--leftColumnWidth, 18rem);
2226
2249
  /* Prevents Safari from shrinking col at first draw */
@@ -2822,8 +2845,7 @@ __decorate([
2822
2845
  query('infinite-scroller')
2823
2846
  ], CollectionBrowser.prototype, "infiniteScroller", void 0);
2824
2847
  CollectionBrowser = CollectionBrowser_1 = __decorate([
2825
- customElement('collection-browser'),
2826
- localized()
2848
+ customElement('collection-browser')
2827
2849
  ], CollectionBrowser);
2828
2850
  export { CollectionBrowser };
2829
2851
  //# sourceMappingURL=collection-browser.js.map