@internetarchive/collection-browser 2.10.1-alpha-webdev7090.26 → 2.10.1-alpha-webdev7523.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 (25) hide show
  1. package/dist/src/collection-browser.d.ts +0 -8
  2. package/dist/src/collection-browser.js +7 -33
  3. package/dist/src/collection-browser.js.map +1 -1
  4. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js +1 -1
  5. package/dist/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.js.map +1 -1
  6. package/dist/src/collection-facets/smart-facets/smart-facet-bar.d.ts +2 -3
  7. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js +13 -37
  8. package/dist/src/collection-facets/smart-facets/smart-facet-bar.js.map +1 -1
  9. package/dist/src/collection-facets/smart-facets/smart-facet-button.js +10 -26
  10. package/dist/src/collection-facets/smart-facets/smart-facet-button.js.map +1 -1
  11. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js +9 -19
  12. package/dist/src/collection-facets/smart-facets/smart-facet-dropdown.js.map +1 -1
  13. package/dist/src/tiles/item-image.js +1 -0
  14. package/dist/src/tiles/item-image.js.map +1 -1
  15. package/package.json +2 -2
  16. package/src/collection-browser.ts +7 -35
  17. package/src/collection-facets/smart-facets/heuristics/wikidata/wikidata-heuristic.ts +1 -4
  18. package/src/collection-facets/smart-facets/smart-facet-bar.ts +16 -38
  19. package/src/collection-facets/smart-facets/smart-facet-button.ts +10 -27
  20. package/src/collection-facets/smart-facets/smart-facet-dropdown.ts +10 -21
  21. package/src/tiles/item-image.ts +1 -0
  22. package/dist/src/assets/img/icons/close-circle-dark.d.ts +0 -2
  23. package/dist/src/assets/img/icons/close-circle-dark.js +0 -5
  24. package/dist/src/assets/img/icons/close-circle-dark.js.map +0 -1
  25. package/src/assets/img/icons/close-circle-dark.ts +0 -5
@@ -67,7 +67,6 @@ import { sha1 } from './utils/sha1';
67
67
  import { log } from './utils/log';
68
68
  import type { PlaceholderType } from './empty-placeholder';
69
69
  import type { ManageBar } from './manage/manage-bar';
70
- import type { SmartFacetBar } from './collection-facets/smart-facets/smart-facet-bar';
71
70
 
72
71
  import './empty-placeholder';
73
72
  import './tiles/tile-dispatcher';
@@ -251,8 +250,6 @@ export class CollectionBrowser
251
250
  /** Whether to display a smart results carousel above the full results */
252
251
  @property({ type: Boolean, reflect: true }) showSmartResults = false;
253
252
 
254
- @property({ type: String }) resultsHeader?: string;
255
-
256
253
  /**
257
254
  * The maximum number of pages we will load when a privileged user clicks
258
255
  * the "Manage" button on the search page. Limited to 15 pages.
@@ -307,8 +304,6 @@ export class CollectionBrowser
307
304
 
308
305
  @query('manage-bar') private manageBar?: ManageBar;
309
306
 
310
- @query('smart-facet-bar') private smartFacetBar?: SmartFacetBar;
311
-
312
307
  @property({ type: Object, attribute: false })
313
308
  analyticsHandler?: AnalyticsManagerInterface;
314
309
 
@@ -512,7 +507,7 @@ export class CollectionBrowser
512
507
  render() {
513
508
  return html`
514
509
  ${this.showSmartFacetBar
515
- ? html`<smart-facet-bar
510
+ ? html` <smart-facet-bar
516
511
  .query=${this.baseQuery}
517
512
  .aggregations=${this.dataSource.aggregations}
518
513
  .selectedFacets=${this.selectedFacets}
@@ -521,7 +516,6 @@ export class CollectionBrowser
521
516
  @facetsChanged=${this.facetsChanged}
522
517
  @filtersToggled=${() => {
523
518
  this.facetPaneVisible = !this.facetPaneVisible;
524
- this.emitFacetPaneVisibilityChanged();
525
519
  }}
526
520
  ></smart-facet-bar>`
527
521
  : nothing}
@@ -688,21 +682,18 @@ export class CollectionBrowser
688
682
  * tiles and sort/filter bar are shown.
689
683
  */
690
684
  private get rightColumnTemplate(): TemplateResult {
691
- const rightColumnClasses = classMap({
692
- column: true,
693
- 'full-width': this.showSmartFacetBar && !this.facetPaneVisible,
694
- 'smart-results-spacing': !!this.showSmartResults,
695
- });
696
-
697
685
  return html`
698
- <div id="right-column" class=${rightColumnClasses}>
686
+ <div
687
+ id="right-column"
688
+ class="column ${this.showSmartResults ? 'smart-results-spacing' : ''}"
689
+ >
699
690
  ${this.showSmartResults
700
691
  ? html`<slot name="smart-results"></slot>`
701
692
  : nothing}
702
693
  <section id="results">
703
694
  ${this.showSmartResults
704
695
  ? html`<h2 class="results-section-heading">
705
- ${this.resultsHeader ?? msg('All results')}
696
+ ${msg('All results')}
706
697
  </h2>`
707
698
  : nothing}
708
699
  <div id="cb-top-view">
@@ -850,10 +841,6 @@ export class CollectionBrowser
850
841
  );
851
842
  }
852
843
 
853
- refreshSmartFacets(): void {
854
- this.smartFacetBar?.refresh();
855
- }
856
-
857
844
  /**
858
845
  * Handler to show processing modal while removing item
859
846
  */
@@ -1676,18 +1663,6 @@ export class CollectionBrowser
1676
1663
  );
1677
1664
  }
1678
1665
 
1679
- /**
1680
- * Emits a `facetPaneVisibilityChanged` event indicating that the facet pane has
1681
- * been toggled open or closed.
1682
- */
1683
- private emitFacetPaneVisibilityChanged(): void {
1684
- this.dispatchEvent(
1685
- new CustomEvent<boolean>('facetPaneVisibilityChanged', {
1686
- detail: this.facetPaneVisible,
1687
- }),
1688
- );
1689
- }
1690
-
1691
1666
  /**
1692
1667
  * Emits a `queryStateChanged` event indicating that one or more of this component's
1693
1668
  * properties have changed in a way that could affect the set of search results.
@@ -2232,16 +2207,13 @@ export class CollectionBrowser
2232
2207
  flex: 1;
2233
2208
  position: relative;
2234
2209
  min-height: 90vh;
2210
+ border-left: 1px solid rgb(232, 232, 232);
2235
2211
  border-right: 1px solid rgb(232, 232, 232);
2236
2212
  margin-top: var(--rightColumnMarginTop, 0);
2237
2213
  padding-top: 2rem;
2238
2214
  background: #fff;
2239
2215
  }
2240
2216
 
2241
- #left-column:not([hidden]) + #right-column {
2242
- border-left: 1px solid rgb(232, 232, 232);
2243
- }
2244
-
2245
2217
  #right-column.smart-results-spacing {
2246
2218
  padding-top: 0.5rem;
2247
2219
  border-right: none;
@@ -44,10 +44,7 @@ export class WikidataHeuristic implements SmartQueryHeuristic {
44
44
  facets: smartFacet.facets.map(facet => {
45
45
  const replaced = {
46
46
  ...facet,
47
- bucketKey: facet.bucketKey.replace(
48
- '__QUERY',
49
- query.toLowerCase(),
50
- ),
47
+ bucketKey: facet.bucketKey.replace('__QUERY', query),
51
48
  };
52
49
 
53
50
  if (facet.displayText) {
@@ -9,7 +9,6 @@ import {
9
9
  } from 'lit';
10
10
  import { repeat } from 'lit/directives/repeat.js';
11
11
  import { customElement, property, state } from 'lit/decorators.js';
12
- import { msg } from '@lit/localize';
13
12
  import type { Aggregation, Bucket } from '@internetarchive/search-service';
14
13
  import type { CollectionTitles } from '../../data-source/models';
15
14
  import type { FacetOption, SelectedFacets } from '../../models';
@@ -19,11 +18,11 @@ import type { SmartFacetDropdown } from './smart-facet-dropdown';
19
18
  import type { SmartFacet, SmartFacetEvent } from './models';
20
19
  import { smartFacetEquals } from './smart-facet-equals';
21
20
  import { dedupe } from './dedupe';
22
- import { log } from '../../utils/log';
23
21
  import filterIcon from '../../assets/img/icons/filter';
24
22
 
25
23
  import './smart-facet-button';
26
24
  import './smart-facet-dropdown';
25
+ import { log } from '../../utils/log';
27
26
 
28
27
  const fieldPrefixes: Partial<Record<FacetOption, string>> = {
29
28
  collection: 'Collection: ',
@@ -60,14 +59,9 @@ export class SmartFacetBar extends LitElement {
60
59
  //
61
60
 
62
61
  render() {
63
- if (!this.query) return nothing;
64
-
65
62
  return html`
66
63
  <div id="smart-facets-container">
67
64
  ${this.filtersToggleTemplate}
68
- ${this.smartFacets.length > 0
69
- ? html`<p id="filters-label">${msg('Insights:')}</p>`
70
- : nothing}
71
65
  ${repeat(
72
66
  this.smartFacets,
73
67
  f =>
@@ -104,11 +98,6 @@ export class SmartFacetBar extends LitElement {
104
98
  }
105
99
  }
106
100
 
107
- refresh(): void {
108
- this.lastAggregations = this.aggregations;
109
- this.updateSmartFacets();
110
- }
111
-
112
101
  private async updateSmartFacets(): Promise<void> {
113
102
  log('updating smart facets');
114
103
  if (this.query) {
@@ -217,12 +206,10 @@ export class SmartFacetBar extends LitElement {
217
206
  });
218
207
 
219
208
  if (facetType === 'mediatype') {
220
- continue;
221
- // Don't include mediatype bubbles
222
- // facets.push(
223
- // [this.toSmartFacet(facetType, [unusedBuckets[0]])],
224
- // [this.toSmartFacet(facetType, [unusedBuckets[1]])],
225
- // );
209
+ facets.push(
210
+ [this.toSmartFacet(facetType, [unusedBuckets[0]])],
211
+ [this.toSmartFacet(facetType, [unusedBuckets[1]])],
212
+ );
226
213
  } else if (facetType === 'collection' || facetType === 'subject') {
227
214
  const topBuckets = unusedBuckets.slice(0, 5);
228
215
  facets.push(topBuckets.map(b => this.toSmartFacet(facetType, [b])));
@@ -333,42 +320,33 @@ export class SmartFacetBar extends LitElement {
333
320
  display: flex;
334
321
  align-items: center;
335
322
  flex-wrap: wrap;
336
- gap: 5px 10px;
323
+ gap: 5px;
337
324
  padding: 10px 0;
338
325
  }
339
326
 
340
327
  #filters-toggle {
341
328
  margin: 0;
342
329
  border: 0;
343
- padding: 5px 8px;
344
- border-radius: 50%;
345
- background: white;
346
- color: #2c2c2c;
347
- border: 1px solid #194880;
348
- font-size: 1.4rem;
330
+ padding: 5px 10px;
331
+ border-radius: 15px;
332
+ background: #194880;
333
+ color: white;
334
+ font-size: 1.6rem;
349
335
  font-family: inherit;
350
336
  text-decoration: none;
337
+ box-shadow: 1px 1px rgba(0, 0, 0, 0.4);
351
338
  cursor: pointer;
352
339
  }
353
340
 
354
341
  #filters-toggle.active {
355
- background: #194880;
356
- color: white;
342
+ background: #09294d;
343
+ box-shadow: -1px -1px rgba(0, 0, 0, 0.1);
357
344
  }
358
345
 
359
346
  #filters-toggle > svg {
360
- width: 12px;
361
- filter: invert(0.16667);
362
- vertical-align: -1px;
363
- }
364
-
365
- #filters-toggle.active > svg {
347
+ width: 15px;
366
348
  filter: invert(1);
367
- }
368
-
369
- #filters-label {
370
- font-weight: bold;
371
- margin: 0 -5px 0 0;
349
+ vertical-align: text-bottom;
372
350
  }
373
351
  `;
374
352
  }
@@ -3,8 +3,6 @@ import { customElement, property } from 'lit/decorators.js';
3
3
  import { mediatypeConfig } from '../../mediatype/mediatype-config';
4
4
  import type { SmartFacet, SmartFacetEvent } from './models';
5
5
 
6
- import closeCircleDark from '../../assets/img/icons/close-circle-dark';
7
-
8
6
  function capitalize(str?: string): string | undefined {
9
7
  if (!str) return str;
10
8
  return str.charAt(0).toLocaleUpperCase() + str.slice(1);
@@ -49,7 +47,7 @@ export class SmartFacetButton extends LitElement {
49
47
  >
50
48
  ${icon} ${displayText}
51
49
  ${this.selected
52
- ? html`<span class="unselect-button">${closeCircleDark}</span>`
50
+ ? html`<span style="margin-left: 5px;">×</span>`
53
51
  : nothing}
54
52
  </a>
55
53
  `;
@@ -103,39 +101,24 @@ export class SmartFacetButton extends LitElement {
103
101
  static get styles(): CSSResultGroup {
104
102
  return css`
105
103
  .smart-facet-button {
106
- display: inline-flex;
107
- align-items: center;
108
- column-gap: 5px;
109
- padding: 5px 5px;
110
- border-radius: 5px;
111
- background: white;
112
- color: #2c2c2c;
113
- border: 1px solid #194880;
114
- font-size: 1.4rem;
104
+ padding: 5px 10px;
105
+ border-radius: 15px;
106
+ background: #194880;
107
+ color: white;
108
+ font-size: 1.6rem;
115
109
  font-family: inherit;
116
- line-height: normal;
117
110
  text-decoration: none;
111
+ box-shadow: 1px 1px rgba(0, 0, 0, 0.4);
118
112
  }
119
113
 
120
114
  .smart-facet-button.selected {
121
- background: #194880;
122
- color: white;
123
- }
124
-
125
- .unselect-button > svg {
126
- width: 10px;
127
- height: 10px;
128
- filter: invert(1);
115
+ background: #4c76aa;
129
116
  }
130
117
 
131
118
  .smart-facet-button > svg {
132
- width: 12px;
133
- height: 12px;
134
- filter: invert(0.16667);
135
- }
136
-
137
- .smart-facet-button.selected > svg {
119
+ width: 15px;
138
120
  filter: invert(1);
121
+ vertical-align: text-top;
139
122
  }
140
123
  `;
141
124
  }
@@ -33,8 +33,6 @@ export class SmartFacetDropdown extends LitElement {
33
33
  displayCaret
34
34
  openViaButton
35
35
  closeOnSelect
36
- closeOnEscape
37
- closeOnBackdropClick
38
36
  includeSelectedOption
39
37
  .options=${this.dropdownOptions}
40
38
  .selectedOption=${this.activeDropdownOption}
@@ -59,11 +57,8 @@ export class SmartFacetDropdown extends LitElement {
59
57
  const firstFacet = smartFacet.facets[0];
60
58
  return {
61
59
  id: firstFacet.bucketKey,
62
- label: html`<span>
63
- ${smartFacet.label ??
64
- firstFacet.displayText ??
65
- firstFacet.bucketKey}
66
- </span>`,
60
+ label:
61
+ smartFacet.label ?? firstFacet.displayText ?? firstFacet.bucketKey,
67
62
  };
68
63
  }) ?? []
69
64
  );
@@ -132,29 +127,23 @@ export class SmartFacetDropdown extends LitElement {
132
127
  static get styles(): CSSResultGroup {
133
128
  return css`
134
129
  .dropdown-container {
135
- padding: 5px 5px;
130
+ padding: 5px 8px;
136
131
  border-radius: 5px;
137
- background: white;
138
- color: #2c2c2c;
139
- border: 1px solid #194880;
140
- font-size: 1.4rem;
132
+ background: #194880;
133
+ color: white;
134
+ font-size: 1.6rem;
141
135
  font-family: inherit;
136
+ box-shadow: 1px 1px rgba(0, 0, 0, 0.4);
142
137
  }
143
138
 
144
139
  .dropdown-label {
145
- font-size: 1.4rem;
140
+ font-size: 1.6rem;
146
141
  font-family: inherit;
147
142
  }
148
143
 
149
144
  .dropdown {
150
- --dropdownBorderColor: #194880;
151
- --dropdownBorderWidth: 1px;
152
- --dropdownBgColor: white;
153
- --dropdownHoverBgColor: #f8f8f8;
154
- --dropdownTextColor: #2c2c2c;
155
- --dropdownHoverTextColor: #2c2c2c;
156
- --dropdownCaretColor: #2c2c2c;
157
- --dropdownWhiteSpace: nowrap;
145
+ --dropdownBorderWidth: 5px;
146
+ --dropdownBorderColor: transparent;
158
147
  --caretWidth: 14px;
159
148
  --caretHeight: 14px;
160
149
  }
@@ -44,6 +44,7 @@ export class ItemImage extends LitElement {
44
44
  class=${classMap(this.itemImageClass)}
45
45
  src="${this.imageSrc}"
46
46
  alt=""
47
+ loading="lazy"
47
48
  @load=${this.onLoad}
48
49
  @error=${this.onError}
49
50
  />
@@ -1,2 +0,0 @@
1
- declare const _default: import("lit").TemplateResult<2>;
2
- export default _default;
@@ -1,5 +0,0 @@
1
- import { svg } from 'lit';
2
- export default svg `
3
- <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m50 0c27.6142375 0 50 22.3857625 50 50s-22.3857625 50-50 50-50-22.3857625-50-50 22.3857625-50 50-50zm23.8159475 26.1840525c-1.4033215-1.4033215-3.5816761-1.5592461-5.1572272-.4677738l-.5598841.4677738-18.0988362 18.0989475-18.0988362-18.0989475-.5598841-.4677738c-1.5755511-1.0914723-3.7539057-.9355477-5.1572272.4677738-1.5787367 1.5787367-1.5787367 4.1383746 0 5.7171113l18.0989475 18.0988362-18.0989475 18.0988362c-1.5787367 1.5787367-1.5787367 4.1383746 0 5.7171113 1.4033215 1.4033215 3.5816761 1.5592461 5.1572272.4677738l.5598841-.4677738 18.0988362-18.0989475 18.0988362 18.0989475.5598841.4677738c1.5755511 1.0914723 3.7539057.9355477 5.1572272-.4677738 1.5787367-1.5787367 1.5787367-4.1383746 0-5.7171113l-18.0989475-18.0988362 18.0989475-18.0988362c1.5787367-1.5787367 1.5787367-4.1383746 0-5.7171113z" fill-rule="evenodd"/></svg>
4
- `;
5
- //# sourceMappingURL=close-circle-dark.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"close-circle-dark.js","sourceRoot":"","sources":["../../../../../src/assets/img/icons/close-circle-dark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,eAAe,GAAG,CAAA;;CAEjB,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport default svg`\n <svg viewBox=\"0 0 100 100\" xmlns=\"http://www.w3.org/2000/svg\"><path d=\"m50 0c27.6142375 0 50 22.3857625 50 50s-22.3857625 50-50 50-50-22.3857625-50-50 22.3857625-50 50-50zm23.8159475 26.1840525c-1.4033215-1.4033215-3.5816761-1.5592461-5.1572272-.4677738l-.5598841.4677738-18.0988362 18.0989475-18.0988362-18.0989475-.5598841-.4677738c-1.5755511-1.0914723-3.7539057-.9355477-5.1572272.4677738-1.5787367 1.5787367-1.5787367 4.1383746 0 5.7171113l18.0989475 18.0988362-18.0989475 18.0988362c-1.5787367 1.5787367-1.5787367 4.1383746 0 5.7171113 1.4033215 1.4033215 3.5816761 1.5592461 5.1572272.4677738l.5598841-.4677738 18.0988362-18.0989475 18.0988362 18.0989475.5598841.4677738c1.5755511 1.0914723 3.7539057.9355477 5.1572272-.4677738 1.5787367-1.5787367 1.5787367-4.1383746 0-5.7171113l-18.0989475-18.0988362 18.0989475-18.0988362c1.5787367-1.5787367 1.5787367-4.1383746 0-5.7171113z\" fill-rule=\"evenodd\"/></svg>\n`;\n"]}
@@ -1,5 +0,0 @@
1
- import { svg } from 'lit';
2
-
3
- export default svg`
4
- <svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path d="m50 0c27.6142375 0 50 22.3857625 50 50s-22.3857625 50-50 50-50-22.3857625-50-50 22.3857625-50 50-50zm23.8159475 26.1840525c-1.4033215-1.4033215-3.5816761-1.5592461-5.1572272-.4677738l-.5598841.4677738-18.0988362 18.0989475-18.0988362-18.0989475-.5598841-.4677738c-1.5755511-1.0914723-3.7539057-.9355477-5.1572272.4677738-1.5787367 1.5787367-1.5787367 4.1383746 0 5.7171113l18.0989475 18.0988362-18.0989475 18.0988362c-1.5787367 1.5787367-1.5787367 4.1383746 0 5.7171113 1.4033215 1.4033215 3.5816761 1.5592461 5.1572272.4677738l.5598841-.4677738 18.0988362-18.0989475 18.0988362 18.0989475.5598841.4677738c1.5755511 1.0914723 3.7539057.9355477 5.1572272-.4677738 1.5787367-1.5787367 1.5787367-4.1383746 0-5.7171113l-18.0989475-18.0988362 18.0989475-18.0988362c1.5787367-1.5787367 1.5787367-4.1383746 0-5.7171113z" fill-rule="evenodd"/></svg>
5
- `;