@internetarchive/collection-browser 2.17.1-alpha-webdev7713.0 → 2.17.1-alpha-webdev7667.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 (55) hide show
  1. package/dist/src/collection-browser.d.ts +20 -0
  2. package/dist/src/collection-browser.js +74 -0
  3. package/dist/src/collection-browser.js.map +1 -1
  4. package/dist/src/models.d.ts +9 -0
  5. package/dist/src/models.js.map +1 -1
  6. package/dist/src/tiles/base-tile-component.d.ts +1 -0
  7. package/dist/src/tiles/base-tile-component.js +4 -0
  8. package/dist/src/tiles/base-tile-component.js.map +1 -1
  9. package/dist/src/tiles/grid/account-tile.js +2 -0
  10. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  11. package/dist/src/tiles/grid/collection-tile.js +2 -0
  12. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  13. package/dist/src/tiles/grid/item-tile.js +2 -0
  14. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  15. package/dist/src/tiles/grid/search-tile.js +2 -0
  16. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  17. package/dist/src/tiles/hover/hover-pane-controller.d.ts +1 -0
  18. package/dist/src/tiles/hover/hover-pane-controller.js +4 -3
  19. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  20. package/dist/src/tiles/hover/tile-hover-pane.d.ts +1 -0
  21. package/dist/src/tiles/hover/tile-hover-pane.js +5 -0
  22. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  23. package/dist/src/tiles/image-block.d.ts +1 -0
  24. package/dist/src/tiles/image-block.js +7 -0
  25. package/dist/src/tiles/image-block.js.map +1 -1
  26. package/dist/src/tiles/item-image.d.ts +1 -0
  27. package/dist/src/tiles/item-image.js +7 -2
  28. package/dist/src/tiles/item-image.js.map +1 -1
  29. package/dist/src/tiles/list/tile-list-compact-header.js +1 -0
  30. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  31. package/dist/src/tiles/list/tile-list-compact.js +2 -0
  32. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  33. package/dist/src/tiles/list/tile-list.js +2 -0
  34. package/dist/src/tiles/list/tile-list.js.map +1 -1
  35. package/dist/src/tiles/tile-dispatcher.js +7 -0
  36. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  37. package/dist/test/tiles/hover/hover-pane-controller.test.js +1 -0
  38. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  39. package/package.json +3 -3
  40. package/src/collection-browser.ts +76 -0
  41. package/src/models.ts +10 -0
  42. package/src/tiles/base-tile-component.ts +2 -0
  43. package/src/tiles/grid/account-tile.ts +2 -0
  44. package/src/tiles/grid/collection-tile.ts +2 -0
  45. package/src/tiles/grid/item-tile.ts +2 -0
  46. package/src/tiles/grid/search-tile.ts +2 -0
  47. package/src/tiles/hover/hover-pane-controller.ts +2 -0
  48. package/src/tiles/hover/tile-hover-pane.ts +3 -0
  49. package/src/tiles/image-block.ts +5 -0
  50. package/src/tiles/item-image.ts +7 -2
  51. package/src/tiles/list/tile-list-compact-header.ts +1 -0
  52. package/src/tiles/list/tile-list-compact.ts +2 -0
  53. package/src/tiles/list/tile-list.ts +2 -0
  54. package/src/tiles/tile-dispatcher.ts +7 -0
  55. package/test/tiles/hover/hover-pane-controller.test.ts +1 -0
@@ -180,6 +180,11 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
180
180
  private facetsLoading;
181
181
  private totalResults?;
182
182
  private mobileView;
183
+ /**
184
+ * Any temporarily overridden `on`/`off` state for the user's tile blurring preference if they
185
+ * have chosen to override it, or `no-override` if they have not.
186
+ */
187
+ private tileBlurOverrideState;
183
188
  private collapsibleFacetsVisible;
184
189
  private contentWidth?;
185
190
  private placeholderType;
@@ -329,6 +334,11 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
329
334
  * Template for the sort & filtering bar that appears atop the search results.
330
335
  */
331
336
  private get sortFilterBarTemplate();
337
+ /**
338
+ * Template for the Blurring toggle for admins to enable/disable blurring of
339
+ * sensitive content in result tiles.
340
+ */
341
+ private get tileBlurCheckboxTemplate();
332
342
  /**
333
343
  * Template for the manage bar UI that appears atop the search results when we are
334
344
  * showing the management view. This generally replaces the sort bar when present.
@@ -357,6 +367,16 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
357
367
  * of the data source to account for any new gaps in the data.
358
368
  */
359
369
  removeCheckedTiles(): void;
370
+ /**
371
+ * Handler for when the tile blurring checkbox state is toggled
372
+ */
373
+ private tileBlurCheckboxChanged;
374
+ /**
375
+ * Whether result tiles should have the default blurring of sensitive content suppressed.
376
+ * First considers any override specified by the user, falling back to the setting in
377
+ * user preferences if not overridden.
378
+ */
379
+ private get shouldSuppressTileBlurring();
360
380
  /**
361
381
  * Handler for when the user changes the selected sort option or direction.
362
382
  */
@@ -149,6 +149,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
149
149
  this.searchResultsLoading = false;
150
150
  this.facetsLoading = false;
151
151
  this.mobileView = false;
152
+ /**
153
+ * Any temporarily overridden `on`/`off` state for the user's tile blurring preference if they
154
+ * have chosen to override it, or `no-override` if they have not.
155
+ */
156
+ this.tileBlurOverrideState = 'no-override';
152
157
  this.collapsibleFacetsVisible = false;
153
158
  this.placeholderType = null;
154
159
  /** Whether layout size analytics have been sent already. */
@@ -597,12 +602,38 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
597
602
  @titleLetterChanged=${this.titleLetterSelected}
598
603
  @creatorLetterChanged=${this.creatorLetterSelected}
599
604
  >
605
+ ${this.tileBlurCheckboxTemplate}
600
606
  <slot name="sort-options-left" slot="sort-options-left"></slot>
601
607
  <slot name="sort-options" slot="sort-options"></slot>
602
608
  <slot name="sort-options-right" slot="sort-options-right"></slot>
603
609
  </sort-filter-bar>
604
610
  `;
605
611
  }
612
+ /**
613
+ * Template for the Blurring toggle for admins to enable/disable blurring of
614
+ * sensitive content in result tiles.
615
+ */
616
+ get tileBlurCheckboxTemplate() {
617
+ var _a;
618
+ // Only show the checkbox for @archive.org users
619
+ if (!((_a = this.dataSource.sessionContext) === null || _a === void 0 ? void 0 : _a.is_archive_user))
620
+ return nothing;
621
+ return html `
622
+ <label
623
+ id="tile-blur-label"
624
+ for="tile-blur-check"
625
+ slot="sort-options-right"
626
+ >
627
+ ${msg('Blurring')}
628
+ <input
629
+ id="tile-blur-check"
630
+ type="checkbox"
631
+ ?checked=${!this.shouldSuppressTileBlurring}
632
+ @change=${this.tileBlurCheckboxChanged}
633
+ />
634
+ </label>
635
+ `;
636
+ }
606
637
  /**
607
638
  * Template for the manage bar UI that appears atop the search results when we are
608
639
  * showing the management view. This generally replaces the sort bar when present.
@@ -686,6 +717,34 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
686
717
  removeCheckedTiles() {
687
718
  this.dataSource.removeCheckedTiles();
688
719
  }
720
+ /**
721
+ * Handler for when the tile blurring checkbox state is toggled
722
+ */
723
+ tileBlurCheckboxChanged(e) {
724
+ var _a;
725
+ const { checked } = e.target;
726
+ this.tileBlurOverrideState = checked ? 'on' : 'off';
727
+ (_a = this.infiniteScroller) === null || _a === void 0 ? void 0 : _a.refreshAllVisibleCells();
728
+ }
729
+ /**
730
+ * Whether result tiles should have the default blurring of sensitive content suppressed.
731
+ * First considers any override specified by the user, falling back to the setting in
732
+ * user preferences if not overridden.
733
+ */
734
+ get shouldSuppressTileBlurring() {
735
+ if (this.tileBlurOverrideState !== 'no-override') {
736
+ // User wants to override their preference.
737
+ // Return true if they want blurring turned off, or false otherwise.
738
+ return this.tileBlurOverrideState === 'off';
739
+ }
740
+ // Not overriding, so use the preference from session context
741
+ const { sessionContext } = this.dataSource;
742
+ const userPrefs = sessionContext === null || sessionContext === void 0 ? void 0 : sessionContext.pps_relevant_user_preferences;
743
+ const blurringPref = userPrefs === null || userPrefs === void 0 ? void 0 : userPrefs.display__blur_moderated_content;
744
+ // Only suppress blurring if the preference is disabled.
745
+ // If enabled or missing, tile blurring remains on.
746
+ return blurringPref === 'off';
747
+ }
689
748
  /**
690
749
  * Handler for when the user changes the selected sort option or direction.
691
750
  */
@@ -983,6 +1042,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
983
1042
  .defaultSortParam=${this.defaultSortParam}
984
1043
  .mobileBreakpoint=${this.mobileBreakpoint}
985
1044
  .loggedIn=${this.loggedIn}
1045
+ .suppressBlurring=${this.shouldSuppressTileBlurring}
986
1046
  >
987
1047
  </tile-dispatcher>
988
1048
  </div>
@@ -1728,6 +1788,7 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
1728
1788
  .creatorFilter=${this.selectedCreatorFilter}
1729
1789
  .mobileBreakpoint=${this.mobileBreakpoint}
1730
1790
  .loggedIn=${this.loggedIn}
1791
+ .suppressBlurring=${this.shouldSuppressTileBlurring}
1731
1792
  .isManageView=${this.isManageView}
1732
1793
  ?showTvClips=${this.isTVCollection || this.searchType === SearchType.TV}
1733
1794
  ?enableHoverPane=${true}
@@ -2114,6 +2175,16 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
2114
2175
  padding-top: 50px;
2115
2176
  }
2116
2177
 
2178
+ #tile-blur-label {
2179
+ display: flex;
2180
+ align-items: center;
2181
+ column-gap: 5px;
2182
+ }
2183
+
2184
+ #tile-blur-check {
2185
+ margin: 0 5px 0 0;
2186
+ }
2187
+
2117
2188
  circular-activity-indicator {
2118
2189
  width: 30px;
2119
2190
  height: 30px;
@@ -2369,6 +2440,9 @@ __decorate([
2369
2440
  __decorate([
2370
2441
  state()
2371
2442
  ], CollectionBrowser.prototype, "mobileView", void 0);
2443
+ __decorate([
2444
+ state()
2445
+ ], CollectionBrowser.prototype, "tileBlurOverrideState", void 0);
2372
2446
  __decorate([
2373
2447
  state()
2374
2448
  ], CollectionBrowser.prototype, "collapsibleFacetsVisible", void 0);