@internetarchive/collection-browser 2.17.1-alpha-webdev7713.0 → 2.18.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 (76) hide show
  1. package/dist/src/app-root.d.ts +0 -3
  2. package/dist/src/app-root.js +0 -91
  3. package/dist/src/app-root.js.map +1 -1
  4. package/dist/src/collection-browser.d.ts +20 -0
  5. package/dist/src/collection-browser.js +74 -0
  6. package/dist/src/collection-browser.js.map +1 -1
  7. package/dist/src/models.d.ts +9 -0
  8. package/dist/src/models.js.map +1 -1
  9. package/dist/src/tiles/base-tile-component.d.ts +1 -0
  10. package/dist/src/tiles/base-tile-component.js +4 -0
  11. package/dist/src/tiles/base-tile-component.js.map +1 -1
  12. package/dist/src/tiles/grid/account-tile.js +2 -0
  13. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  14. package/dist/src/tiles/grid/collection-tile.js +2 -0
  15. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  16. package/dist/src/tiles/grid/item-tile.js +2 -0
  17. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  18. package/dist/src/tiles/grid/search-tile.js +2 -0
  19. package/dist/src/tiles/grid/search-tile.js.map +1 -1
  20. package/dist/src/tiles/hover/hover-pane-controller.d.ts +1 -0
  21. package/dist/src/tiles/hover/hover-pane-controller.js +4 -3
  22. package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
  23. package/dist/src/tiles/hover/tile-hover-pane.d.ts +1 -0
  24. package/dist/src/tiles/hover/tile-hover-pane.js +5 -0
  25. package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
  26. package/dist/src/tiles/image-block.d.ts +1 -0
  27. package/dist/src/tiles/image-block.js +7 -0
  28. package/dist/src/tiles/image-block.js.map +1 -1
  29. package/dist/src/tiles/item-image.d.ts +1 -0
  30. package/dist/src/tiles/item-image.js +7 -2
  31. package/dist/src/tiles/item-image.js.map +1 -1
  32. package/dist/src/tiles/list/tile-list-compact-header.js +1 -0
  33. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  34. package/dist/src/tiles/list/tile-list-compact.js +2 -0
  35. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  36. package/dist/src/tiles/list/tile-list.js +2 -0
  37. package/dist/src/tiles/list/tile-list.js.map +1 -1
  38. package/dist/src/tiles/tile-dispatcher.js +7 -0
  39. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  40. package/dist/test/collection-browser.test.js +58 -3
  41. package/dist/test/collection-browser.test.js.map +1 -1
  42. package/dist/test/image-block.test.js +21 -0
  43. package/dist/test/image-block.test.js.map +1 -1
  44. package/dist/test/item-image.test.js +73 -0
  45. package/dist/test/item-image.test.js.map +1 -1
  46. package/dist/test/mocks/mock-search-responses.d.ts +2 -0
  47. package/dist/test/mocks/mock-search-responses.js +96 -0
  48. package/dist/test/mocks/mock-search-responses.js.map +1 -1
  49. package/dist/test/mocks/mock-search-service.d.ts +1 -0
  50. package/dist/test/mocks/mock-search-service.js +7 -1
  51. package/dist/test/mocks/mock-search-service.js.map +1 -1
  52. package/dist/test/tiles/hover/hover-pane-controller.test.js +1 -0
  53. package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
  54. package/package.json +3 -3
  55. package/src/app-root.ts +0 -97
  56. package/src/collection-browser.ts +76 -0
  57. package/src/models.ts +10 -0
  58. package/src/tiles/base-tile-component.ts +2 -0
  59. package/src/tiles/grid/account-tile.ts +2 -0
  60. package/src/tiles/grid/collection-tile.ts +2 -0
  61. package/src/tiles/grid/item-tile.ts +2 -0
  62. package/src/tiles/grid/search-tile.ts +2 -0
  63. package/src/tiles/hover/hover-pane-controller.ts +2 -0
  64. package/src/tiles/hover/tile-hover-pane.ts +3 -0
  65. package/src/tiles/image-block.ts +5 -0
  66. package/src/tiles/item-image.ts +7 -2
  67. package/src/tiles/list/tile-list-compact-header.ts +1 -0
  68. package/src/tiles/list/tile-list-compact.ts +2 -0
  69. package/src/tiles/list/tile-list.ts +2 -0
  70. package/src/tiles/tile-dispatcher.ts +7 -0
  71. package/test/collection-browser.test.ts +86 -2
  72. package/test/image-block.test.ts +24 -0
  73. package/test/item-image.test.ts +86 -0
  74. package/test/mocks/mock-search-responses.ts +104 -0
  75. package/test/mocks/mock-search-service.ts +11 -0
  76. package/test/tiles/hover/hover-pane-controller.test.ts +1 -0
@@ -1,4 +1,4 @@
1
- import { getMockSuccessSingleResult, getMockSuccessMultipleResults, getMockSuccessSingleResultWithSort, getMockSuccessLoggedInResult, getMockSuccessNoPreviewResult, getMockSuccessLoggedInAndNoPreviewResult, getMockSuccessWithYearHistogramAggs, getMockSuccessWithDateHistogramAggs, getMockSuccessMultiLineDescription, getMockSuccessFirstTitleResult, getMockSuccessFirstCreatorResult, getMockErrorResult, getMockMalformedResult, getMockSuccessWithCollectionTitles, getMockSuccessWithChannelAliases, getMockSuccessWithCollectionAggregations, getMockSuccessExtraQuotedHref, getMockSuccessWithDefaultSort, getMockSuccessWithConciseDefaultSort, getMockSuccessWithDefaultFavSort, getMockSuccessWithParentCollections, getMockSuccessForTvCollection, getMockSuccessManyFields, getMockSuccessNoResults, getMockSuccessWithWebArchiveHits, getMockSuccessWithManyAggregations, getMockSuccessTvFields, } from './mock-search-responses';
1
+ import { getMockSuccessSingleResult, getMockSuccessMultipleResults, getMockSuccessSingleResultWithSort, getMockSuccessLoggedInResult, getMockSuccessNoPreviewResult, getMockSuccessLoggedInAndNoPreviewResult, getMockSuccessWithYearHistogramAggs, getMockSuccessWithDateHistogramAggs, getMockSuccessMultiLineDescription, getMockSuccessFirstTitleResult, getMockSuccessFirstCreatorResult, getMockErrorResult, getMockMalformedResult, getMockSuccessWithCollectionTitles, getMockSuccessWithChannelAliases, getMockSuccessWithCollectionAggregations, getMockSuccessExtraQuotedHref, getMockSuccessWithDefaultSort, getMockSuccessWithConciseDefaultSort, getMockSuccessWithDefaultFavSort, getMockSuccessWithParentCollections, getMockSuccessForTvCollection, getMockSuccessManyFields, getMockSuccessNoResults, getMockSuccessWithWebArchiveHits, getMockSuccessWithManyAggregations, getMockSuccessTvFields, getMockSuccessArchiveOrgUserResult, getMockSuccessArchiveOrgUserNoBlurResult, } from './mock-search-responses';
2
2
  const responses = {
3
3
  'single-result': getMockSuccessSingleResult,
4
4
  years: getMockSuccessWithYearHistogramAggs,
@@ -7,6 +7,8 @@ const responses = {
7
7
  loggedin: getMockSuccessLoggedInResult,
8
8
  'no-preview': getMockSuccessNoPreviewResult,
9
9
  'loggedin-no-preview': getMockSuccessLoggedInAndNoPreviewResult,
10
+ 'archive-org-user-loggedin': getMockSuccessArchiveOrgUserResult,
11
+ 'archive-org-user-loggedin-noblur': getMockSuccessArchiveOrgUserNoBlurResult,
10
12
  'first-title': getMockSuccessFirstTitleResult,
11
13
  'first-creator': getMockSuccessFirstCreatorResult,
12
14
  'collection-titles': getMockSuccessWithCollectionTitles,
@@ -55,5 +57,9 @@ export class MockSearchService {
55
57
  }
56
58
  return result;
57
59
  }
60
+ async itemDetails(_) {
61
+ // We don't currently use the itemDetails method in collection-browser
62
+ throw new Error('not implemented');
63
+ }
58
64
  }
59
65
  //# sourceMappingURL=mock-search-service.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"mock-search-service.js","sourceRoot":"","sources":["../../../test/mocks/mock-search-service.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,kCAAkC,EAClC,4BAA4B,EAC5B,6BAA6B,EAC7B,wCAAwC,EACxC,mCAAmC,EACnC,mCAAmC,EACnC,kCAAkC,EAClC,8BAA8B,EAC9B,gCAAgC,EAChC,kBAAkB,EAClB,sBAAsB,EACtB,kCAAkC,EAClC,gCAAgC,EAChC,wCAAwC,EACxC,6BAA6B,EAC7B,6BAA6B,EAC7B,oCAAoC,EACpC,gCAAgC,EAChC,mCAAmC,EACnC,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,EACvB,gCAAgC,EAChC,kCAAkC,EAClC,sBAAsB,GACvB,M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iCAAiC;YACjC,MAAM,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE;gBACtB,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,WAAW,GACf,MAAA,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,mCAAI,EAAE,CAAC;QAClE,MAAM,QAAQ,GACZ,MAAA,SAAS,CAAC,WAAW,CAAC,mCAAI,6BAA6B,CAAC;QAC1D,IAAI,MAAM,GAAG,QAAQ,EAAE,CAAC;QAExB,uCAAuC;QACvC,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;YAC5C,MAAM,GAAG,kCAAkC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/D,CAAC;QAED,uCAAuC;QACvC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAwB,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACpE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;CACF","sourcesContent":["import type { Result } from '@internetarchive/result-type';\nimport type {\n SearchParams,\n SearchResponse,\n SearchServiceInterface,\n SearchServiceError,\n SearchType,\n} from '@internetarchive/search-service';\nimport {\n getMockSuccessSingleResult,\n getMockSuccessMultipleResults,\n getMockSuccessSingleResultWithSort,\n getMockSuccessLoggedInResult,\n getMockSuccessNoPreviewResult,\n getMockSuccessLoggedInAndNoPreviewResult,\n getMockSuccessWithYearHistogramAggs,\n getMockSuccessWithDateHistogramAggs,\n getMockSuccessMultiLineDescription,\n getMockSuccessFirstTitleResult,\n getMockSuccessFirstCreatorResult,\n getMockErrorResult,\n getMockMalformedResult,\n getMockSuccessWithCollectionTitles,\n getMockSuccessWithChannelAliases,\n getMockSuccessWithCollectionAggregations,\n getMockSuccessExtraQuotedHref,\n getMockSuccessWithDefaultSort,\n getMockSuccessWithConciseDefaultSort,\n getMockSuccessWithDefaultFavSort,\n getMockSuccessWithParentCollections,\n getMockSuccessForTvCollection,\n getMockSuccessManyFields,\n getMockSuccessNoResults,\n getMockSuccessWithWebArchiveHits,\n getMockSuccessWithManyAggregations,\n getMockSuccessTvFields,\n} from './mock-search-responses';\n\nconst responses: Record<\n string,\n () => Result<SearchResponse, SearchServiceError>\n> = {\n 'single-result': getMockSuccessSingleResult,\n years: getMockSuccessWithYearHistogramAggs,\n months: getMockSuccessWithDateHistogramAggs,\n 'multi-line-description': getMockSuccessMultiLineDescription,\n loggedin: getMockSuccessLoggedInResult,\n 'no-preview': getMockSuccessNoPreviewResult,\n 'loggedin-no-preview': getMockSuccessLoggedInAndNoPreviewResult,\n 'first-title': getMockSuccessFirstTitleResult,\n 'first-creator': getMockSuccessFirstCreatorResult,\n 'collection-titles': getMockSuccessWithCollectionTitles,\n 'channel-aliases': getMockSuccessWithChannelAliases,\n 'collection-aggregations': getMockSuccessWithCollectionAggregations,\n 'extra-quoted-href': getMockSuccessExtraQuotedHref,\n 'default-sort': getMockSuccessWithDefaultSort,\n 'default-sort-concise': getMockSuccessWithConciseDefaultSort,\n 'fav-sort': getMockSuccessWithDefaultFavSort,\n 'parent-collections': getMockSuccessWithParentCollections,\n 'tv-collection': getMockSuccessForTvCollection,\n 'web-archive': getMockSuccessWithWebArchiveHits,\n 'more-facets': getMockSuccessWithManyAggregations,\n 'many-fields': getMockSuccessManyFields,\n 'tv-fields': getMockSuccessTvFields,\n 'no-results': getMockSuccessNoResults,\n error: getMockErrorResult,\n malformed: getMockMalformedResult,\n};\n\nexport class MockSearchService implements SearchServiceInterface {\n searchParams?: SearchParams;\n\n searchType?: SearchType;\n\n asyncResponse: boolean;\n\n asyncResponseDelay: number;\n\n resultsSpy: Function;\n\n constructor({\n asyncResponse = false,\n asyncResponseDelay = 0,\n resultsSpy = () => {},\n } = {}) {\n this.asyncResponse = asyncResponse;\n this.asyncResponseDelay = asyncResponseDelay;\n this.resultsSpy = resultsSpy;\n }\n\n async search(\n params: SearchParams,\n searchType: SearchType,\n ): Promise<Result<SearchResponse, SearchServiceError>> {\n this.searchParams = params;\n this.searchType = searchType;\n\n if (this.asyncResponse) {\n // Add an artificial 1-tick delay\n await new Promise(res => {\n setTimeout(res, this.asyncResponseDelay);\n });\n }\n\n const responseKey =\n (this.searchParams.query || this.searchParams.pageTarget) ?? '';\n const resultFn: () => Result<SearchResponse, SearchServiceError> =\n responses[responseKey] ?? getMockSuccessMultipleResults;\n let result = resultFn();\n\n // with-sort query has special handling\n if (this.searchParams.query === 'with-sort') {\n result = getMockSuccessSingleResultWithSort(this.resultsSpy);\n }\n\n // Apply any uid param from the request\n if (result.success) {\n (result.success.request.clientParameters as any).uid = params.uid;\n }\n\n return result;\n }\n}\n"]}
1
+ {"version":3,"file":"mock-search-service.js","sourceRoot":"","sources":["../../../test/mocks/mock-search-service.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,0BAA0B,EAC1B,6BAA6B,EAC7B,kCAAkC,EAClC,4BAA4B,EAC5B,6BAA6B,EAC7B,wCAAwC,EACxC,mCAAmC,EACnC,mCAAmC,EACnC,kCAAkC,EAClC,8BAA8B,EAC9B,gCAAgC,EAChC,kBAAkB,EAClB,sBAAsB,EACtB,kCAAkC,EAClC,gCAAgC,EAChC,wCAAwC,EACxC,6BAA6B,EAC7B,6BAA6B,EAC7B,oCAAoC,EACpC,gCAAgC,EAChC,mCAAmC,EACnC,6BAA6B,EAC7B,wBAAwB,EACxB,uBAAuB,EACvB,gCAAgC,EAChC,kCAAkC,EAClC,sBAAsB,EACtB,kCAAkC,EAClC,wCAAwC,GACzC,MAAM,yBAAyB,CAAC;AAEjC,MAAM,SAAS,GAGX;IACF,eAAe,EAAE,0BAA0B;IAC3C,KAAK,EAAE,mCAAmC;IAC1C,MAAM,EAAE,mCAAmC;IAC3C,wBAAwB,EAAE,kCAAkC;IAC5D,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AAkB,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;QACL,CAAC;QAED,MAAM,WAAW,GACf,MAAA,CAAC,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,mCAAI,EAAE,CAAC;QAClE,MAAM,QAAQ,GACZ,MAAA,SAAS,CAAC,WAAW,CAAC,mCAAI,6BAA6B,CAAC;QAC1D,IAAI,MAAM,GAAG,QAAQ,EAAE,CAAC;QAExB,uCAAuC;QACvC,IAAI,IAAI,CAAC,YAAY,CAAC,KAAK,KAAK,WAAW,EAAE,CAAC;YAC5C,MAAM,GAAG,kCAAkC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC/D,CAAC;QAED,uCAAuC;QACvC,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;YAClB,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,gBAAwB,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACpE,CAAC;QAED,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,WAAW,CACf,CAAS;QAET,sEAAsE;QACtE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IACrC,CAAC;CACF","sourcesContent":["import type { Result } from '@internetarchive/result-type';\nimport type {\n SearchParams,\n SearchResponse,\n SearchServiceInterface,\n SearchServiceError,\n SearchType,\n} from '@internetarchive/search-service';\nimport {\n getMockSuccessSingleResult,\n getMockSuccessMultipleResults,\n getMockSuccessSingleResultWithSort,\n getMockSuccessLoggedInResult,\n getMockSuccessNoPreviewResult,\n getMockSuccessLoggedInAndNoPreviewResult,\n getMockSuccessWithYearHistogramAggs,\n getMockSuccessWithDateHistogramAggs,\n getMockSuccessMultiLineDescription,\n getMockSuccessFirstTitleResult,\n getMockSuccessFirstCreatorResult,\n getMockErrorResult,\n getMockMalformedResult,\n getMockSuccessWithCollectionTitles,\n getMockSuccessWithChannelAliases,\n getMockSuccessWithCollectionAggregations,\n getMockSuccessExtraQuotedHref,\n getMockSuccessWithDefaultSort,\n getMockSuccessWithConciseDefaultSort,\n getMockSuccessWithDefaultFavSort,\n getMockSuccessWithParentCollections,\n getMockSuccessForTvCollection,\n getMockSuccessManyFields,\n getMockSuccessNoResults,\n getMockSuccessWithWebArchiveHits,\n getMockSuccessWithManyAggregations,\n getMockSuccessTvFields,\n getMockSuccessArchiveOrgUserResult,\n getMockSuccessArchiveOrgUserNoBlurResult,\n} from './mock-search-responses';\n\nconst responses: Record<\n string,\n () => Result<SearchResponse, SearchServiceError>\n> = {\n 'single-result': getMockSuccessSingleResult,\n years: getMockSuccessWithYearHistogramAggs,\n months: getMockSuccessWithDateHistogramAggs,\n 'multi-line-description': getMockSuccessMultiLineDescription,\n loggedin: getMockSuccessLoggedInResult,\n 'no-preview': getMockSuccessNoPreviewResult,\n 'loggedin-no-preview': getMockSuccessLoggedInAndNoPreviewResult,\n 'archive-org-user-loggedin': getMockSuccessArchiveOrgUserResult,\n 'archive-org-user-loggedin-noblur': getMockSuccessArchiveOrgUserNoBlurResult,\n 'first-title': getMockSuccessFirstTitleResult,\n 'first-creator': getMockSuccessFirstCreatorResult,\n 'collection-titles': getMockSuccessWithCollectionTitles,\n 'channel-aliases': getMockSuccessWithChannelAliases,\n 'collection-aggregations': getMockSuccessWithCollectionAggregations,\n 'extra-quoted-href': getMockSuccessExtraQuotedHref,\n 'default-sort': getMockSuccessWithDefaultSort,\n 'default-sort-concise': getMockSuccessWithConciseDefaultSort,\n 'fav-sort': getMockSuccessWithDefaultFavSort,\n 'parent-collections': getMockSuccessWithParentCollections,\n 'tv-collection': getMockSuccessForTvCollection,\n 'web-archive': getMockSuccessWithWebArchiveHits,\n 'more-facets': getMockSuccessWithManyAggregations,\n 'many-fields': getMockSuccessManyFields,\n 'tv-fields': getMockSuccessTvFields,\n 'no-results': getMockSuccessNoResults,\n error: getMockErrorResult,\n malformed: getMockMalformedResult,\n};\n\nexport class MockSearchService implements SearchServiceInterface {\n searchParams?: SearchParams;\n\n searchType?: SearchType;\n\n asyncResponse: boolean;\n\n asyncResponseDelay: number;\n\n resultsSpy: Function;\n\n constructor({\n asyncResponse = false,\n asyncResponseDelay = 0,\n resultsSpy = () => {},\n } = {}) {\n this.asyncResponse = asyncResponse;\n this.asyncResponseDelay = asyncResponseDelay;\n this.resultsSpy = resultsSpy;\n }\n\n async search(\n params: SearchParams,\n searchType: SearchType,\n ): Promise<Result<SearchResponse, SearchServiceError>> {\n this.searchParams = params;\n this.searchType = searchType;\n\n if (this.asyncResponse) {\n // Add an artificial 1-tick delay\n await new Promise(res => {\n setTimeout(res, this.asyncResponseDelay);\n });\n }\n\n const responseKey =\n (this.searchParams.query || this.searchParams.pageTarget) ?? '';\n const resultFn: () => Result<SearchResponse, SearchServiceError> =\n responses[responseKey] ?? getMockSuccessMultipleResults;\n let result = resultFn();\n\n // with-sort query has special handling\n if (this.searchParams.query === 'with-sort') {\n result = getMockSuccessSingleResultWithSort(this.resultsSpy);\n }\n\n // Apply any uid param from the request\n if (result.success) {\n (result.success.request.clientParameters as any).uid = params.uid;\n }\n\n return result;\n }\n\n async itemDetails(\n _: string,\n ): Promise<Result<SearchResponse, SearchServiceError>> {\n // We don't currently use the itemDetails method in collection-browser\n throw new Error('not implemented');\n }\n}\n"]}
@@ -39,6 +39,7 @@ let HostElement = class HostElement extends LitElement {
39
39
  return {
40
40
  model: tileModel,
41
41
  loggedIn: false,
42
+ suppressBlurring: false,
42
43
  sortParam: null,
43
44
  };
44
45
  }
@@ -1 +1 @@
1
- {"version":3,"file":"hover-pane-controller.test.js","sourceRoot":"","sources":["../../../../test/tiles/hover/hover-pane-controller.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EA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AAI,CAAC,UAAU,0CACX,aAAa,CAAC,iBAAiB,CAAC,0CAChC,aAAa,CAAC,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;YAChD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC1B,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, fixture } from '@open-wc/testing';\nimport { html, LitElement, nothing, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneControllerOptions,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from '../../../src/tiles/hover/hover-pane-controller';\nimport type { TileHoverPane } from '../../../src/tiles/hover/tile-hover-pane';\nimport { TileModel } from '../../../src/models';\n\n@customElement('host-element')\nclass HostElement extends LitElement implements HoverPaneProviderInterface {\n @property({ type: Object }) controllerOptions?: HoverPaneControllerOptions;\n\n @property({ type: Boolean }) suppressHoverPane: boolean = false;\n\n @query('tile-hover-pane') hoverPane?: TileHoverPane;\n\n controller?: HoverPaneControllerInterface;\n\n render(): TemplateResult {\n return html` ${this.controller?.getTemplate()} `;\n }\n\n protected firstUpdated(): void {\n this.controller = new HoverPaneController(this, this.controllerOptions);\n }\n\n getHoverPane(): HTMLElement | undefined {\n return this.suppressHoverPane ? undefined : this.hoverPane;\n }\n\n getHoverPaneProps(): HoverPaneProperties {\n const tileModel = new TileModel({});\n tileModel.checked = false;\n tileModel.collectionFilesCount = 1;\n tileModel.collections = ['foo', 'bar'];\n tileModel.collectionSize = 1;\n tileModel.commentCount = 1;\n tileModel.contentWarning = false;\n tileModel.creators = ['foo', 'bar'];\n tileModel.favCount = 1;\n tileModel.identifier = 'foo';\n tileModel.itemCount = 1;\n tileModel.loginRequired = false;\n tileModel.mediatype = 'data';\n tileModel.subjects = ['foo', 'bar'];\n tileModel.title = 'foo';\n tileModel.viewCount = 1;\n\n return {\n model: tileModel,\n loggedIn: false,\n sortParam: null,\n };\n }\n}\n\ndescribe('Hover Pane Controller', () => {\n let oldMatchMedia: typeof window.matchMedia;\n let oldOnTouchStart: typeof window.ontouchstart;\n\n before(() => {\n oldMatchMedia = window.matchMedia;\n oldOnTouchStart = window.ontouchstart;\n window.matchMedia = () => ({ matches: true }) as MediaQueryList;\n window.ontouchstart = () => {};\n });\n\n after(() => {\n window.matchMedia = oldMatchMedia;\n window.ontouchstart = oldOnTouchStart;\n });\n\n it('should initially provide empty template', async () => {\n const host = await fixture<HostElement>(\n html`<host-element></host-element>`,\n );\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n it('should produce a hover pane template after mousemove, and hide it after mouseleave', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{ showDelay: 0, hideDelay: 0 }}\n ></host-element>`,\n );\n\n host.dispatchEvent(new MouseEvent('mousemove'));\n // Need to wait a tick for the event handlers to run\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing); // Is a TemplateResult\n\n host.dispatchEvent(new MouseEvent('mouseleave'));\n // Need to wait for the fade out transition\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n it('should produce a hover pane template after mouseenter, even without mousemove', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{ showDelay: 0, hideDelay: 0 }}\n ></host-element>`,\n );\n\n host.dispatchEvent(new MouseEvent('mouseenter'));\n // Need to wait a tick for the event handlers to run\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing); // Is a TemplateResult\n });\n\n it('should immediately fade back in if mouse enters while fading out', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{ showDelay: 0, hideDelay: 0 }}\n ></host-element>`,\n );\n\n // Enter the host element and wait for the show handlers to run\n host.dispatchEvent(new MouseEvent('mousemove'));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n // Leave the host element so it begins fading out, but not all the way\n host.dispatchEvent(new MouseEvent('mouseleave'));\n await new Promise(resolve => {\n setTimeout(resolve, 20);\n });\n\n // Re-enter the host element and wait long enough that it would disappear\n // if the hide were not cancelled\n host.dispatchEvent(new MouseEvent('mousemove'));\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing);\n });\n\n it('should flip hover pane if it would overflow the viewport', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{ showDelay: 0, hideDelay: 0 }}\n ></host-element>`,\n );\n\n host.dispatchEvent(\n new MouseEvent('mousemove', { clientX: 800, clientY: 600 }),\n );\n // Need to wait a tick for the event handlers to run\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n await host.updateComplete;\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing);\n expect(host.getHoverPane()?.getBoundingClientRect()?.right).to.be.lessThan(\n window.innerWidth,\n );\n expect(host.getHoverPane()?.getBoundingClientRect()?.bottom).to.be.lessThan(\n window.innerHeight,\n );\n });\n\n it('should gracefully handle undefined hover pane from host element', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{ showDelay: 0, hideDelay: 0 }}\n ?suppressHoverPane=${true}\n ></host-element>`,\n );\n\n host.dispatchEvent(new MouseEvent('mousemove'));\n // Need to wait a tick for the event handlers to run\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing);\n\n host.dispatchEvent(new MouseEvent('mouseleave'));\n await new Promise(resolve => {\n setTimeout(resolve, 20);\n });\n\n host.dispatchEvent(new MouseEvent('mousemove'));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n host.dispatchEvent(new MouseEvent('mouseleave'));\n // Need to wait for the fade out transition\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n describe('Touch & long-press', () => {\n const getTouchStartEvent = (host: EventTarget) =>\n new TouchEvent('touchstart', {\n touches: [new Touch({ identifier: 0, target: host })],\n });\n\n it('should produce a hover pane after long press', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{\n showDelay: 0,\n longPressDelay: 0,\n enableLongPress: true,\n }}\n ></host-element>`,\n );\n\n // Touch the host element and wait for the long press handlers to run\n host.dispatchEvent(getTouchStartEvent(host));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing); // Is a TemplateResult\n });\n\n it('should cancel a long press by moving', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{\n showDelay: 0,\n longPressDelay: 100,\n enableLongPress: true,\n }}\n ></host-element>`,\n );\n\n // Touch the host element\n host.dispatchEvent(getTouchStartEvent(host));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n // Move the touch point, cancelling the long press\n host.dispatchEvent(new TouchEvent('touchmove'));\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n it('should cancel a long press by ending touch', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{\n showDelay: 0,\n longPressDelay: 100,\n enableLongPress: true,\n }}\n ></host-element>`,\n );\n\n // Touch the host element\n host.dispatchEvent(getTouchStartEvent(host));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n // Lift the touch point, cancelling the long press\n host.dispatchEvent(new TouchEvent('touchend'));\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n it('should cancel a long press by cancelling touch (e.g., too many touch points)', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{\n showDelay: 0,\n longPressDelay: 100,\n enableLongPress: true,\n }}\n ></host-element>`,\n );\n\n // Touch the host element\n host.dispatchEvent(getTouchStartEvent(host));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n // Cancel the touch point, also cancelling the long press\n host.dispatchEvent(new TouchEvent('touchcancel'));\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n it('should close the hover pane on mobile when touching the backdrop', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{\n showDelay: 0,\n hideDelay: 0,\n longPressDelay: 0,\n enableLongPress: true,\n mobileBreakpoint: 9999, // Ensure we get the mobile view\n }}\n ></host-element>`,\n );\n\n // Touch the host element\n host.dispatchEvent(getTouchStartEvent(host));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing);\n\n await host.updateComplete;\n\n // Touch the backdrop\n host.shadowRoot\n ?.querySelector('#touch-backdrop')\n ?.dispatchEvent(new TouchEvent('touchstart'));\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n });\n});\n"]}
1
+ {"version":3,"file":"hover-pane-controller.test.js","sourceRoot":"","sources":["../../../../test/tiles/hover/hover-pane-controller.test.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EACL,mBAAmB,GAKp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,CAAC,iBAAiB,CAAC,0CAChC,aAAa,CAAC,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC;YAChD,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC1B,UAAU,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;YAEH,MAAM,CAAC,MAAA,IAAI,CAAC,UAAU,0CAAE,WAAW,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC3D,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { expect, fixture } from '@open-wc/testing';\nimport { html, LitElement, nothing, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneControllerOptions,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from '../../../src/tiles/hover/hover-pane-controller';\nimport type { TileHoverPane } from '../../../src/tiles/hover/tile-hover-pane';\nimport { TileModel } from '../../../src/models';\n\n@customElement('host-element')\nclass HostElement extends LitElement implements HoverPaneProviderInterface {\n @property({ type: Object }) controllerOptions?: HoverPaneControllerOptions;\n\n @property({ type: Boolean }) suppressHoverPane: boolean = false;\n\n @query('tile-hover-pane') hoverPane?: TileHoverPane;\n\n controller?: HoverPaneControllerInterface;\n\n render(): TemplateResult {\n return html` ${this.controller?.getTemplate()} `;\n }\n\n protected firstUpdated(): void {\n this.controller = new HoverPaneController(this, this.controllerOptions);\n }\n\n getHoverPane(): HTMLElement | undefined {\n return this.suppressHoverPane ? undefined : this.hoverPane;\n }\n\n getHoverPaneProps(): HoverPaneProperties {\n const tileModel = new TileModel({});\n tileModel.checked = false;\n tileModel.collectionFilesCount = 1;\n tileModel.collections = ['foo', 'bar'];\n tileModel.collectionSize = 1;\n tileModel.commentCount = 1;\n tileModel.contentWarning = false;\n tileModel.creators = ['foo', 'bar'];\n tileModel.favCount = 1;\n tileModel.identifier = 'foo';\n tileModel.itemCount = 1;\n tileModel.loginRequired = false;\n tileModel.mediatype = 'data';\n tileModel.subjects = ['foo', 'bar'];\n tileModel.title = 'foo';\n tileModel.viewCount = 1;\n\n return {\n model: tileModel,\n loggedIn: false,\n suppressBlurring: false,\n sortParam: null,\n };\n }\n}\n\ndescribe('Hover Pane Controller', () => {\n let oldMatchMedia: typeof window.matchMedia;\n let oldOnTouchStart: typeof window.ontouchstart;\n\n before(() => {\n oldMatchMedia = window.matchMedia;\n oldOnTouchStart = window.ontouchstart;\n window.matchMedia = () => ({ matches: true }) as MediaQueryList;\n window.ontouchstart = () => {};\n });\n\n after(() => {\n window.matchMedia = oldMatchMedia;\n window.ontouchstart = oldOnTouchStart;\n });\n\n it('should initially provide empty template', async () => {\n const host = await fixture<HostElement>(\n html`<host-element></host-element>`,\n );\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n it('should produce a hover pane template after mousemove, and hide it after mouseleave', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{ showDelay: 0, hideDelay: 0 }}\n ></host-element>`,\n );\n\n host.dispatchEvent(new MouseEvent('mousemove'));\n // Need to wait a tick for the event handlers to run\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing); // Is a TemplateResult\n\n host.dispatchEvent(new MouseEvent('mouseleave'));\n // Need to wait for the fade out transition\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n it('should produce a hover pane template after mouseenter, even without mousemove', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{ showDelay: 0, hideDelay: 0 }}\n ></host-element>`,\n );\n\n host.dispatchEvent(new MouseEvent('mouseenter'));\n // Need to wait a tick for the event handlers to run\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing); // Is a TemplateResult\n });\n\n it('should immediately fade back in if mouse enters while fading out', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{ showDelay: 0, hideDelay: 0 }}\n ></host-element>`,\n );\n\n // Enter the host element and wait for the show handlers to run\n host.dispatchEvent(new MouseEvent('mousemove'));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n // Leave the host element so it begins fading out, but not all the way\n host.dispatchEvent(new MouseEvent('mouseleave'));\n await new Promise(resolve => {\n setTimeout(resolve, 20);\n });\n\n // Re-enter the host element and wait long enough that it would disappear\n // if the hide were not cancelled\n host.dispatchEvent(new MouseEvent('mousemove'));\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing);\n });\n\n it('should flip hover pane if it would overflow the viewport', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{ showDelay: 0, hideDelay: 0 }}\n ></host-element>`,\n );\n\n host.dispatchEvent(\n new MouseEvent('mousemove', { clientX: 800, clientY: 600 }),\n );\n // Need to wait a tick for the event handlers to run\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n await host.updateComplete;\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing);\n expect(host.getHoverPane()?.getBoundingClientRect()?.right).to.be.lessThan(\n window.innerWidth,\n );\n expect(host.getHoverPane()?.getBoundingClientRect()?.bottom).to.be.lessThan(\n window.innerHeight,\n );\n });\n\n it('should gracefully handle undefined hover pane from host element', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{ showDelay: 0, hideDelay: 0 }}\n ?suppressHoverPane=${true}\n ></host-element>`,\n );\n\n host.dispatchEvent(new MouseEvent('mousemove'));\n // Need to wait a tick for the event handlers to run\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing);\n\n host.dispatchEvent(new MouseEvent('mouseleave'));\n await new Promise(resolve => {\n setTimeout(resolve, 20);\n });\n\n host.dispatchEvent(new MouseEvent('mousemove'));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n host.dispatchEvent(new MouseEvent('mouseleave'));\n // Need to wait for the fade out transition\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n describe('Touch & long-press', () => {\n const getTouchStartEvent = (host: EventTarget) =>\n new TouchEvent('touchstart', {\n touches: [new Touch({ identifier: 0, target: host })],\n });\n\n it('should produce a hover pane after long press', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{\n showDelay: 0,\n longPressDelay: 0,\n enableLongPress: true,\n }}\n ></host-element>`,\n );\n\n // Touch the host element and wait for the long press handlers to run\n host.dispatchEvent(getTouchStartEvent(host));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing); // Is a TemplateResult\n });\n\n it('should cancel a long press by moving', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{\n showDelay: 0,\n longPressDelay: 100,\n enableLongPress: true,\n }}\n ></host-element>`,\n );\n\n // Touch the host element\n host.dispatchEvent(getTouchStartEvent(host));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n // Move the touch point, cancelling the long press\n host.dispatchEvent(new TouchEvent('touchmove'));\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n it('should cancel a long press by ending touch', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{\n showDelay: 0,\n longPressDelay: 100,\n enableLongPress: true,\n }}\n ></host-element>`,\n );\n\n // Touch the host element\n host.dispatchEvent(getTouchStartEvent(host));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n // Lift the touch point, cancelling the long press\n host.dispatchEvent(new TouchEvent('touchend'));\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n it('should cancel a long press by cancelling touch (e.g., too many touch points)', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{\n showDelay: 0,\n longPressDelay: 100,\n enableLongPress: true,\n }}\n ></host-element>`,\n );\n\n // Touch the host element\n host.dispatchEvent(getTouchStartEvent(host));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n // Cancel the touch point, also cancelling the long press\n host.dispatchEvent(new TouchEvent('touchcancel'));\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n\n it('should close the hover pane on mobile when touching the backdrop', async () => {\n const host = await fixture<HostElement>(\n html`<host-element\n .controllerOptions=${{\n showDelay: 0,\n hideDelay: 0,\n longPressDelay: 0,\n enableLongPress: true,\n mobileBreakpoint: 9999, // Ensure we get the mobile view\n }}\n ></host-element>`,\n );\n\n // Touch the host element\n host.dispatchEvent(getTouchStartEvent(host));\n await new Promise(resolve => {\n setTimeout(resolve, 0);\n });\n\n expect(host.controller?.getTemplate()).not.to.equal(nothing);\n\n await host.updateComplete;\n\n // Touch the backdrop\n host.shadowRoot\n ?.querySelector('#touch-backdrop')\n ?.dispatchEvent(new TouchEvent('touchstart'));\n await new Promise(resolve => {\n setTimeout(resolve, 150);\n });\n\n expect(host.controller?.getTemplate()).to.equal(nothing);\n });\n });\n});\n"]}
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "The Internet Archive Collection Browser.",
4
4
  "license": "AGPL-3.0-only",
5
5
  "author": "Internet Archive",
6
- "version": "2.17.1-alpha-webdev7713.0",
6
+ "version": "2.18.0",
7
7
  "main": "dist/index.js",
8
8
  "module": "dist/index.js",
9
9
  "scripts": {
@@ -26,13 +26,13 @@
26
26
  "@internetarchive/analytics-manager": "^0.1.4",
27
27
  "@internetarchive/feature-feedback": "^1.0.0",
28
28
  "@internetarchive/field-parsers": "^1.0.0",
29
- "@internetarchive/histogram-date-range": "1.3.2-alpha-webdev7713.0",
29
+ "@internetarchive/histogram-date-range": "^1.3.2",
30
30
  "@internetarchive/ia-activity-indicator": "^0.0.6",
31
31
  "@internetarchive/ia-dropdown": "^1.3.10",
32
32
  "@internetarchive/iaux-item-metadata": "^1.0.5",
33
33
  "@internetarchive/infinite-scroller": "^1.0.1",
34
34
  "@internetarchive/modal-manager": "^2.0.1",
35
- "@internetarchive/search-service": "^2.4.0",
35
+ "@internetarchive/search-service": "^2.5.0",
36
36
  "@internetarchive/shared-resize-observer": "^0.2.0",
37
37
  "@lit/localize": "^0.12.2",
38
38
  "dompurify": "^3.2.4",
package/src/app-root.ts CHANGED
@@ -379,22 +379,6 @@ export class AppRoot extends LitElement {
379
379
 
380
380
  <fieldset class="cb-visual-appearance">
381
381
  <legend>CB Visual Appearance</legend>
382
- <div class="checkbox-control">
383
- <input
384
- type="checkbox"
385
- id="show-dummy-snippets"
386
- @click=${this.snippetsChanged}
387
- />
388
- <label for="show-dummy-snippets">Show dummy snippets</label>
389
- </div>
390
- <div class="checkbox-control">
391
- <input
392
- type="checkbox"
393
- id="show-dummy-reviews"
394
- @click=${this.reviewsChanged}
395
- />
396
- <label for="show-dummy-reviews">Show dummy reviews</label>
397
- </div>
398
382
  <div class="checkbox-control">
399
383
  <input
400
384
  type="checkbox"
@@ -637,87 +621,6 @@ export class AppRoot extends LitElement {
637
621
  }
638
622
  }
639
623
 
640
- private async snippetsChanged(e: Event) {
641
- const target = e.target as HTMLInputElement;
642
- if (target.checked) {
643
- // Decorate the default search service with a wrapper that adds
644
- // dummy snippets to any successful searches
645
- this.searchService = {
646
- async search(params, searchType) {
647
- const searchResponse = await SearchService.default.search(
648
- params,
649
- searchType,
650
- );
651
- searchResponse.success?.response.results.forEach(result => {
652
- Object.defineProperty(result, 'highlight', {
653
- value: new StringField([
654
- 'this is a text {{{snippet}}} block with potentially',
655
- 'multiple {{{snippets}}} and such',
656
- 'but the {{{snippet}}} block may be quite long perhaps',
657
- 'depending on how many {{{snippet}}} matches there are',
658
- 'there may be multiple lines of {{{snippets}}} to show',
659
- 'but each {{{snippet}}} should be relatively short',
660
- 'and {{{snippets}}} are each a {{{snippet}}} of text',
661
- 'but every {{{snippet}}} might have multiple matches',
662
- 'the {{{snippets}}} should be separated and surrounded by ellipses',
663
- ]),
664
- });
665
- });
666
- return searchResponse;
667
- },
668
- };
669
- } else {
670
- // Restore the default seach service
671
- this.searchService = SearchService.default;
672
- }
673
-
674
- // Re-perform the current search to show/hide the snippets immediately
675
- this.reperformCurrentSearch();
676
- }
677
-
678
- private async reviewsChanged(e: Event) {
679
- const target = e.target as HTMLInputElement;
680
- if (target.checked) {
681
- // Decorate the default search service with a wrapper that adds
682
- // dummy reviews to any successful searches
683
- this.searchService = {
684
- async search(params, searchType) {
685
- const searchResponse = await SearchService.default.search(
686
- params,
687
- searchType,
688
- );
689
- searchResponse.success?.response.results.forEach((result, i) => {
690
- Object.defineProperty(result, 'review', {
691
- value: {
692
- title: 'My Great Review',
693
- body: "This item is really great and that's why I'm leaving this review on it and giving it so many star...",
694
- stars: (i + 3) % 6,
695
- },
696
- });
697
- });
698
- return searchResponse;
699
- },
700
- };
701
- } else {
702
- // Restore the default seach service
703
- this.searchService = SearchService.default;
704
- }
705
-
706
- // Re-perform the current search to show/hide the reviews immediately
707
- this.reperformCurrentSearch();
708
- }
709
-
710
- private async reperformCurrentSearch(): Promise<void> {
711
- const oldQuery = this.searchQuery;
712
- this.searchQuery = '-'; // Should just reset to the placeholder
713
- await this.updateComplete;
714
- // For unclear reasons, Safari refuses to re-apply the old query until the next tick, hence:
715
- await new Promise(res => {
716
- setTimeout(res, 0);
717
- });
718
- this.searchQuery = oldQuery; // Re-apply the original query
719
- }
720
-
721
624
  private datePickerChanged(e: Event) {
722
625
  const target = e.target as HTMLInputElement;
723
626
  this.collectionBrowser.showHistogramDatePicker = target.checked;
@@ -46,6 +46,7 @@ import {
46
46
  defaultFacetDisplayOrder,
47
47
  tvFacetDisplayOrder,
48
48
  TvClipFilterType,
49
+ TileBlurOverrideState,
49
50
  } from './models';
50
51
  import {
51
52
  RestorationStateHandlerInterface,
@@ -318,6 +319,12 @@ export class CollectionBrowser
318
319
 
319
320
  @state() private mobileView = false;
320
321
 
322
+ /**
323
+ * Any temporarily overridden `on`/`off` state for the user's tile blurring preference if they
324
+ * have chosen to override it, or `no-override` if they have not.
325
+ */
326
+ @state() private tileBlurOverrideState: TileBlurOverrideState = 'no-override';
327
+
321
328
  @state() private collapsibleFacetsVisible = false;
322
329
 
323
330
  @state() private contentWidth?: number;
@@ -801,6 +808,7 @@ export class CollectionBrowser
801
808
  @titleLetterChanged=${this.titleLetterSelected}
802
809
  @creatorLetterChanged=${this.creatorLetterSelected}
803
810
  >
811
+ ${this.tileBlurCheckboxTemplate}
804
812
  <slot name="sort-options-left" slot="sort-options-left"></slot>
805
813
  <slot name="sort-options" slot="sort-options"></slot>
806
814
  <slot name="sort-options-right" slot="sort-options-right"></slot>
@@ -808,6 +816,31 @@ export class CollectionBrowser
808
816
  `;
809
817
  }
810
818
 
819
+ /**
820
+ * Template for the Blurring toggle for admins to enable/disable blurring of
821
+ * sensitive content in result tiles.
822
+ */
823
+ private get tileBlurCheckboxTemplate(): TemplateResult | typeof nothing {
824
+ // Only show the checkbox for @archive.org users
825
+ if (!this.dataSource.sessionContext?.is_archive_user) return nothing;
826
+
827
+ return html`
828
+ <label
829
+ id="tile-blur-label"
830
+ for="tile-blur-check"
831
+ slot="sort-options-right"
832
+ >
833
+ ${msg('Blurring')}
834
+ <input
835
+ id="tile-blur-check"
836
+ type="checkbox"
837
+ ?checked=${!this.shouldSuppressTileBlurring}
838
+ @change=${this.tileBlurCheckboxChanged}
839
+ />
840
+ </label>
841
+ `;
842
+ }
843
+
811
844
  /**
812
845
  * Template for the manage bar UI that appears atop the search results when we are
813
846
  * showing the management view. This generally replaces the sort bar when present.
@@ -901,6 +934,37 @@ export class CollectionBrowser
901
934
  this.dataSource.removeCheckedTiles();
902
935
  }
903
936
 
937
+ /**
938
+ * Handler for when the tile blurring checkbox state is toggled
939
+ */
940
+ private tileBlurCheckboxChanged(e: Event): void {
941
+ const { checked } = e.target as HTMLInputElement;
942
+ this.tileBlurOverrideState = checked ? 'on' : 'off';
943
+ this.infiniteScroller?.refreshAllVisibleCells();
944
+ }
945
+
946
+ /**
947
+ * Whether result tiles should have the default blurring of sensitive content suppressed.
948
+ * First considers any override specified by the user, falling back to the setting in
949
+ * user preferences if not overridden.
950
+ */
951
+ private get shouldSuppressTileBlurring(): boolean {
952
+ if (this.tileBlurOverrideState !== 'no-override') {
953
+ // User wants to override their preference.
954
+ // Return true if they want blurring turned off, or false otherwise.
955
+ return this.tileBlurOverrideState === 'off';
956
+ }
957
+
958
+ // Not overriding, so use the preference from session context
959
+ const { sessionContext } = this.dataSource;
960
+ const userPrefs = sessionContext?.pps_relevant_user_preferences;
961
+ const blurringPref = userPrefs?.display__blur_moderated_content;
962
+
963
+ // Only suppress blurring if the preference is disabled.
964
+ // If enabled or missing, tile blurring remains on.
965
+ return blurringPref === 'off';
966
+ }
967
+
904
968
  /**
905
969
  * Handler for when the user changes the selected sort option or direction.
906
970
  */
@@ -1238,6 +1302,7 @@ export class CollectionBrowser
1238
1302
  .defaultSortParam=${this.defaultSortParam}
1239
1303
  .mobileBreakpoint=${this.mobileBreakpoint}
1240
1304
  .loggedIn=${this.loggedIn}
1305
+ .suppressBlurring=${this.shouldSuppressTileBlurring}
1241
1306
  >
1242
1307
  </tile-dispatcher>
1243
1308
  </div>
@@ -2158,6 +2223,7 @@ export class CollectionBrowser
2158
2223
  .creatorFilter=${this.selectedCreatorFilter}
2159
2224
  .mobileBreakpoint=${this.mobileBreakpoint}
2160
2225
  .loggedIn=${this.loggedIn}
2226
+ .suppressBlurring=${this.shouldSuppressTileBlurring}
2161
2227
  .isManageView=${this.isManageView}
2162
2228
  ?showTvClips=${this.isTVCollection || this.searchType === SearchType.TV}
2163
2229
  ?enableHoverPane=${true}
@@ -2550,6 +2616,16 @@ export class CollectionBrowser
2550
2616
  padding-top: 50px;
2551
2617
  }
2552
2618
 
2619
+ #tile-blur-label {
2620
+ display: flex;
2621
+ align-items: center;
2622
+ column-gap: 5px;
2623
+ }
2624
+
2625
+ #tile-blur-check {
2626
+ margin: 0 5px 0 0;
2627
+ }
2628
+
2553
2629
  circular-activity-indicator {
2554
2630
  width: 30px;
2555
2631
  height: 30px;
package/src/models.ts CHANGED
@@ -810,3 +810,13 @@ export interface ManageableItem {
810
810
  dateStr?: string;
811
811
  date?: string;
812
812
  }
813
+
814
+ /**
815
+ * Possible states for whether & how the user has overridden their user preference
816
+ * for blurring behavior on tiles with sensitive content.
817
+ * - `no-override`: The user has not overridden their user preference, so simply
818
+ * respect the preference as given.
819
+ * - `on`: The user has overridden their preference and wants tile blurring enabled.
820
+ * - `off`: The user has overridden their preference and wants tile blurring disabled.
821
+ */
822
+ export type TileBlurOverrideState = 'no-override' | 'on' | 'off';
@@ -27,6 +27,8 @@ export abstract class BaseTileComponent extends LitElement {
27
27
 
28
28
  @property({ type: Boolean }) loggedIn = false;
29
29
 
30
+ @property({ type: Boolean }) suppressBlurring = false;
31
+
30
32
  protected displayValueProvider = new TileDisplayValueProvider();
31
33
 
32
34
  protected willUpdate(changed: PropertyValues<this>) {
@@ -21,6 +21,7 @@ export class AccountTile extends BaseTileComponent {
21
21
  * - creatorFilter?: string;
22
22
  * - mobileBreakpoint?: number;
23
23
  * - loggedIn = false;
24
+ * - suppressBlurring = false;
24
25
  */
25
26
 
26
27
  @property({ type: Boolean }) showInfoButton = false;
@@ -46,6 +47,7 @@ export class AccountTile extends BaseTileComponent {
46
47
  .model=${this.model}
47
48
  .baseImageUrl=${this.baseImageUrl}
48
49
  .viewSize=${'grid'}
50
+ .suppressBlurring=${this.suppressBlurring}
49
51
  >
50
52
  </image-block>
51
53
  `;
@@ -21,6 +21,7 @@ export class CollectionTile extends BaseTileComponent {
21
21
  * - creatorFilter?: string;
22
22
  * - mobileBreakpoint?: number;
23
23
  * - loggedIn = false;
24
+ * - suppressBlurring = false;
24
25
  */
25
26
 
26
27
  @property({ type: Boolean }) showInfoButton = false;
@@ -46,6 +47,7 @@ export class CollectionTile extends BaseTileComponent {
46
47
  .model=${this.model}
47
48
  .baseImageUrl=${this.baseImageUrl}
48
49
  .viewSize=${'grid'}
50
+ .suppressBlurring=${this.suppressBlurring}
49
51
  >
50
52
  </image-block>
51
53
  `;
@@ -34,6 +34,7 @@ export class ItemTile extends BaseTileComponent {
34
34
  * - creatorFilter?: string;
35
35
  * - mobileBreakpoint?: number;
36
36
  * - loggedIn = false;
37
+ * - suppressBlurring = false;
37
38
  */
38
39
 
39
40
  @property({ type: Boolean }) showInfoButton = false;
@@ -101,6 +102,7 @@ export class ItemTile extends BaseTileComponent {
101
102
  .model=${this.model}
102
103
  .baseImageUrl=${this.baseImageUrl}
103
104
  .loggedIn=${this.loggedIn}
105
+ .suppressBlurring=${this.suppressBlurring}
104
106
  .isCompactTile=${false}
105
107
  .isListTile=${false}
106
108
  .viewSize=${'grid'}
@@ -18,6 +18,7 @@ export class SearchTile extends BaseTileComponent {
18
18
  * - creatorFilter?: string;
19
19
  * - mobileBreakpoint?: number;
20
20
  * - loggedIn = false;
21
+ * - suppressBlurring = false;
21
22
  */
22
23
 
23
24
  @property({ type: Boolean }) showInfoButton = false;
@@ -40,6 +41,7 @@ export class SearchTile extends BaseTileComponent {
40
41
  .model=${this.model}
41
42
  .baseImageUrl=${this.baseImageUrl}
42
43
  .viewSize=${'grid'}
44
+ .suppressBlurring=${this.suppressBlurring}
43
45
  >
44
46
  </image-block>
45
47
  `;
@@ -16,6 +16,7 @@ export interface HoverPaneProperties {
16
16
  baseNavigationUrl?: string;
17
17
  baseImageUrl?: string;
18
18
  loggedIn: boolean;
19
+ suppressBlurring: boolean;
19
20
  sortParam: SortParam | null;
20
21
  collectionTitles?: CollectionTitles;
21
22
  }
@@ -189,6 +190,7 @@ export class HoverPaneController implements HoverPaneControllerInterface {
189
190
  .baseNavigationUrl=${this.hoverPaneProps?.baseNavigationUrl}
190
191
  .baseImageUrl=${this.hoverPaneProps?.baseImageUrl}
191
192
  .loggedIn=${this.hoverPaneProps?.loggedIn}
193
+ .suppressBlurring=${this.hoverPaneProps?.suppressBlurring}
192
194
  .sortParam=${this.hoverPaneProps?.sortParam}
193
195
  .collectionTitles=${this.hoverPaneProps?.collectionTitles}
194
196
  .mobileBreakpoint=${this.mobileBreakpoint}
@@ -22,6 +22,8 @@ export class TileHoverPane extends LitElement {
22
22
 
23
23
  @property({ type: Boolean }) loggedIn: boolean = false;
24
24
 
25
+ @property({ type: Boolean }) suppressBlurring: boolean = false;
26
+
25
27
  @property({ type: Object }) sortParam?: SortParam;
26
28
 
27
29
  @property({ type: Number }) mobileBreakpoint?: number;
@@ -41,6 +43,7 @@ export class TileHoverPane extends LitElement {
41
43
  .baseNavigationUrl=${this.baseNavigationUrl}
42
44
  .baseImageUrl=${this.baseImageUrl}
43
45
  .loggedIn=${this.loggedIn}
46
+ .suppressBlurring=${this.suppressBlurring}
44
47
  .sortParam=${this.sortParam}
45
48
  .collectionTitles=${this.collectionTitles}
46
49
  .mobileBreakpoint=${this.mobileBreakpoint}
@@ -17,6 +17,8 @@ export class ImageBlock extends LitElement {
17
17
 
18
18
  @property({ type: Boolean }) loggedIn = false;
19
19
 
20
+ @property({ type: Boolean }) suppressBlurring = false;
21
+
20
22
  @property({ type: Object }) model?: TileModel;
21
23
 
22
24
  @property({ type: String }) viewSize: string = 'desktop';
@@ -32,6 +34,7 @@ export class ImageBlock extends LitElement {
32
34
  .isListTile=${this.isListTile}
33
35
  .isCompactTile=${this.isCompactTile}
34
36
  .loggedIn=${this.loggedIn}
37
+ .suppressBlurring=${this.suppressBlurring}
35
38
  style="--imgHeight: 100%; --imgWidth: 100%"
36
39
  >
37
40
  </item-image>
@@ -78,6 +81,8 @@ export class ImageBlock extends LitElement {
78
81
  }
79
82
 
80
83
  private get overlayType(): TileOverlayType | undefined {
84
+ if (this.suppressBlurring) return undefined;
85
+
81
86
  // Prioritize showing the login-required overlay if needed.
82
87
  // Otherwise, if a content warning is required, show that overlay instead.
83
88
  // If neither flag is present, no overlay should be shown.
@@ -22,6 +22,8 @@ export class ItemImage extends LitElement {
22
22
 
23
23
  @property({ type: Boolean }) loggedIn = false;
24
24
 
25
+ @property({ type: Boolean }) suppressBlurring = false;
26
+
25
27
  @state() private isWaveform = false;
26
28
 
27
29
  @state() private isNotFound = false;
@@ -111,12 +113,15 @@ export class ItemImage extends LitElement {
111
113
  }
112
114
 
113
115
  private get itemImageClass(): ClassInfo {
114
- const toBlur = this.model?.contentWarning || this.model?.loginRequired;
116
+ const hasSensitiveContent = !!(
117
+ this.model?.contentWarning || this.model?.loginRequired
118
+ );
119
+ const shouldBlur = hasSensitiveContent && !this.suppressBlurring;
115
120
 
116
121
  return {
117
122
  contain: !this.isCompactTile && !this.isWaveform,
118
123
  cover: this.isCompactTile,
119
- blur: toBlur || false,
124
+ blur: shouldBlur,
120
125
  waveform: this.isWaveform,
121
126
  'account-image': this.isAccountImage, // for account tile image
122
127
  'collection-image': this.model?.mediatype === 'collection', // for collection tile image
@@ -17,6 +17,7 @@ export class TileListCompactHeader extends BaseTileComponent {
17
17
  * - creatorFilter?: string;
18
18
  * - mobileBreakpoint?: number;
19
19
  * - loggedIn = false;
20
+ * - suppressBlurring = false;
20
21
  */
21
22
 
22
23
  render() {
@@ -26,6 +26,7 @@ export class TileListCompact extends BaseTileComponent {
26
26
  * - creatorFilter?: string;
27
27
  * - mobileBreakpoint?: number;
28
28
  * - loggedIn = false;
29
+ * - suppressBlurring = false;
29
30
  */
30
31
 
31
32
  render() {
@@ -38,6 +39,7 @@ export class TileListCompact extends BaseTileComponent {
38
39
  .isListTile=${true}
39
40
  .viewSize=${this.classSize}
40
41
  .loggedIn=${this.loggedIn}
42
+ .suppressBlurring=${this.suppressBlurring}
41
43
  >
42
44
  </image-block>
43
45
  <a href=${this.href} id="title"