@internetarchive/collection-browser 2.15.0 → 2.15.1-alpha-webdev7667.1

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 (52) hide show
  1. package/dist/src/collection-browser.d.ts +17 -0
  2. package/dist/src/collection-browser.js +66 -0
  3. package/dist/src/collection-browser.js.map +1 -1
  4. package/dist/src/tiles/base-tile-component.d.ts +1 -0
  5. package/dist/src/tiles/base-tile-component.js +4 -0
  6. package/dist/src/tiles/base-tile-component.js.map +1 -1
  7. package/dist/src/tiles/grid/account-tile.js +2 -0
  8. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  9. package/dist/src/tiles/grid/collection-tile.js +2 -0
  10. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  11. package/dist/src/tiles/grid/item-tile.js +2 -0
  12. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  13. package/dist/src/tiles/grid/search-tile.js +2 -0
  14. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  15. package/dist/src/tiles/hover/hover-pane-controller.d.ts +1 -0
  16. package/dist/src/tiles/hover/hover-pane-controller.js +4 -3
  17. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  18. package/dist/src/tiles/hover/tile-hover-pane.d.ts +1 -0
  19. package/dist/src/tiles/hover/tile-hover-pane.js +5 -0
  20. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  21. package/dist/src/tiles/image-block.d.ts +1 -0
  22. package/dist/src/tiles/image-block.js +7 -0
  23. package/dist/src/tiles/image-block.js.map +1 -1
  24. package/dist/src/tiles/item-image.d.ts +1 -0
  25. package/dist/src/tiles/item-image.js +7 -2
  26. package/dist/src/tiles/item-image.js.map +1 -1
  27. package/dist/src/tiles/list/tile-list-compact-header.js +1 -0
  28. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  29. package/dist/src/tiles/list/tile-list-compact.js +2 -0
  30. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  31. package/dist/src/tiles/list/tile-list.js +2 -0
  32. package/dist/src/tiles/list/tile-list.js.map +1 -1
  33. package/dist/src/tiles/tile-dispatcher.js +7 -0
  34. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  35. package/dist/test/tiles/hover/hover-pane-controller.test.js +1 -0
  36. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  37. package/package.json +2 -2
  38. package/src/collection-browser.ts +63 -0
  39. package/src/tiles/base-tile-component.ts +2 -0
  40. package/src/tiles/grid/account-tile.ts +2 -0
  41. package/src/tiles/grid/collection-tile.ts +2 -0
  42. package/src/tiles/grid/item-tile.ts +2 -0
  43. package/src/tiles/grid/search-tile.ts +2 -0
  44. package/src/tiles/hover/hover-pane-controller.ts +2 -0
  45. package/src/tiles/hover/tile-hover-pane.ts +3 -0
  46. package/src/tiles/image-block.ts +5 -0
  47. package/src/tiles/item-image.ts +6 -2
  48. package/src/tiles/list/tile-list-compact-header.ts +1 -0
  49. package/src/tiles/list/tile-list-compact.ts +2 -0
  50. package/src/tiles/list/tile-list.ts +2 -0
  51. package/src/tiles/tile-dispatcher.ts +7 -0
  52. package/test/tiles/hover/hover-pane-controller.test.ts +1 -0
@@ -180,6 +180,8 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
180
180
  private facetsLoading;
181
181
  private totalResults?;
182
182
  private mobileView;
183
+ private tileBlurPreference;
184
+ private tileBlurOverride?;
183
185
  private collapsibleFacetsVisible;
184
186
  private contentWidth?;
185
187
  private placeholderType;
@@ -329,6 +331,11 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
329
331
  * Template for the sort & filtering bar that appears atop the search results.
330
332
  */
331
333
  private get sortFilterBarTemplate();
334
+ /**
335
+ * Template for the Blurring toggle for admins to enable/disable blurring of
336
+ * sensitive content in result tiles.
337
+ */
338
+ private get tileBlurCheckboxTemplate();
332
339
  /**
333
340
  * Template for the manage bar UI that appears atop the search results when we are
334
341
  * showing the management view. This generally replaces the sort bar when present.
@@ -357,6 +364,16 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
357
364
  * of the data source to account for any new gaps in the data.
358
365
  */
359
366
  removeCheckedTiles(): void;
367
+ /**
368
+ * Handler for when the tile blurring checkbox state is toggled
369
+ */
370
+ private tileBlurCheckboxChanged;
371
+ /**
372
+ * Whether result tiles that contain sensitive content should be blurred.
373
+ * First considers the `tileBlurOverride` if set, falling back to the setting in
374
+ * user preferences if not.
375
+ */
376
+ private get shouldBlurTiles();
360
377
  /**
361
378
  * Handler for when the user changes the selected sort option or direction.
362
379
  */
@@ -149,6 +149,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
149
149
  this.searchResultsLoading = false;
150
150
  this.facetsLoading = false;
151
151
  this.mobileView = false;
152
+ this.tileBlurPreference = true;
152
153
  this.collapsibleFacetsVisible = false;
153
154
  this.placeholderType = null;
154
155
  /** Whether layout size analytics have been sent already. */
@@ -597,12 +598,38 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
597
598
  @titleLetterChanged=${this.titleLetterSelected}
598
599
  @creatorLetterChanged=${this.creatorLetterSelected}
599
600
  >
601
+ ${this.tileBlurCheckboxTemplate}
600
602
  <slot name="sort-options-left" slot="sort-options-left"></slot>
601
603
  <slot name="sort-options" slot="sort-options"></slot>
602
604
  <slot name="sort-options-right" slot="sort-options-right"></slot>
603
605
  </sort-filter-bar>
604
606
  `;
605
607
  }
608
+ /**
609
+ * Template for the Blurring toggle for admins to enable/disable blurring of
610
+ * sensitive content in result tiles.
611
+ */
612
+ get tileBlurCheckboxTemplate() {
613
+ var _a;
614
+ // Only show the checkbox for @archive.org users
615
+ if (!((_a = this.dataSource.sessionContext) === null || _a === void 0 ? void 0 : _a.is_archive_user))
616
+ return nothing;
617
+ return html `
618
+ <label
619
+ id="tile-blur-label"
620
+ for="tile-blur-check"
621
+ slot="sort-options-right"
622
+ >
623
+ ${msg('Blurring')}
624
+ <input
625
+ id="tile-blur-check"
626
+ type="checkbox"
627
+ ?checked=${!this.shouldBlurTiles}
628
+ @change=${this.tileBlurCheckboxChanged}
629
+ />
630
+ </label>
631
+ `;
632
+ }
606
633
  /**
607
634
  * Template for the manage bar UI that appears atop the search results when we are
608
635
  * showing the management view. This generally replaces the sort bar when present.
@@ -686,6 +713,27 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
686
713
  removeCheckedTiles() {
687
714
  this.dataSource.removeCheckedTiles();
688
715
  }
716
+ /**
717
+ * Handler for when the tile blurring checkbox state is toggled
718
+ */
719
+ tileBlurCheckboxChanged(e) {
720
+ var _a;
721
+ const { checked } = e.target;
722
+ this.tileBlurOverride = checked;
723
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
724
+ }
725
+ /**
726
+ * Whether result tiles that contain sensitive content should be blurred.
727
+ * First considers the `tileBlurOverride` if set, falling back to the setting in
728
+ * user preferences if not.
729
+ */
730
+ get shouldBlurTiles() {
731
+ var _a;
732
+ const { sessionContext } = this.dataSource;
733
+ const userPrefs = sessionContext === null || sessionContext === void 0 ? void 0 : sessionContext.pps_relevant_user_preferences;
734
+ const blurPref = (userPrefs === null || userPrefs === void 0 ? void 0 : userPrefs.display__blur_moderated_content) === 'on';
735
+ return (_a = this.tileBlurOverride) !== null && _a !== void 0 ? _a : blurPref;
736
+ }
689
737
  /**
690
738
  * Handler for when the user changes the selected sort option or direction.
691
739
  */
@@ -983,6 +1031,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
983
1031
  .defaultSortParam=${this.defaultSortParam}
984
1032
  .mobileBreakpoint=${this.mobileBreakpoint}
985
1033
  .loggedIn=${this.loggedIn}
1034
+ .suppressBlurring=${!this.shouldBlurTiles}
986
1035
  >
987
1036
  </tile-dispatcher>
988
1037
  </div>
@@ -1728,6 +1777,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1728
1777
  .creatorFilter=${this.selectedCreatorFilter}
1729
1778
  .mobileBreakpoint=${this.mobileBreakpoint}
1730
1779
  .loggedIn=${this.loggedIn}
1780
+ .suppressBlurring=${!this.shouldBlurTiles}
1731
1781
  .isManageView=${this.isManageView}
1732
1782
  ?showTvClips=${this.isTVCollection || this.searchType === SearchType.TV}
1733
1783
  ?enableHoverPane=${true}
@@ -2114,6 +2164,16 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
2114
2164
  padding-top: 50px;
2115
2165
  }
2116
2166
 
2167
+ #tile-blur-label {
2168
+ display: flex;
2169
+ align-items: center;
2170
+ column-gap: 5px;
2171
+ }
2172
+
2173
+ #tile-blur-check {
2174
+ margin: 0 5px 0 0;
2175
+ }
2176
+
2117
2177
  circular-activity-indicator {
2118
2178
  width: 30px;
2119
2179
  height: 30px;
@@ -2369,6 +2429,12 @@ __decorate([
2369
2429
  __decorate([
2370
2430
  state()
2371
2431
  ], CollectionBrowser.prototype, "mobileView", void 0);
2432
+ __decorate([
2433
+ state()
2434
+ ], CollectionBrowser.prototype, "tileBlurPreference", void 0);
2435
+ __decorate([
2436
+ state()
2437
+ ], CollectionBrowser.prototype, "tileBlurOverride", void 0);
2372
2438
  __decorate([
2373
2439
  state()
2374
2440
  ], CollectionBrowser.prototype, "collapsibleFacetsVisible", void 0);