@internetarchive/collection-browser 0.1.7 → 0.1.9

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 (95) hide show
  1. package/README.md +15 -2
  2. package/dist/{demo → src}/app-root.d.ts +2 -0
  3. package/dist/{demo → src}/app-root.js +22 -0
  4. package/dist/src/app-root.js.map +1 -0
  5. package/dist/src/assets/img/icons/restricted.d.ts +1 -0
  6. package/dist/src/assets/img/icons/restricted.js +29 -0
  7. package/dist/src/assets/img/icons/restricted.js.map +1 -0
  8. package/dist/src/collection-browser.d.ts +11 -0
  9. package/dist/src/collection-browser.js +100 -45
  10. package/dist/src/collection-browser.js.map +1 -1
  11. package/dist/src/models.d.ts +2 -0
  12. package/dist/src/models.js.map +1 -1
  13. package/dist/src/tiles/grid/account-tile.js +16 -1
  14. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  15. package/dist/src/tiles/item-image.d.ts +7 -5
  16. package/dist/src/tiles/item-image.js +86 -23
  17. package/dist/src/tiles/item-image.js.map +1 -1
  18. package/dist/src/tiles/list/tile-list-compact.js +54 -59
  19. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  20. package/dist/src/tiles/list/tile-list.js +25 -22
  21. package/dist/src/tiles/list/tile-list.js.map +1 -1
  22. package/{demo/index.html → index.html} +1 -3
  23. package/package.json +12 -7
  24. package/{demo → src}/app-root.ts +20 -0
  25. package/src/assets/img/icons/restricted.ts +29 -0
  26. package/src/collection-browser.ts +80 -25
  27. package/src/models.ts +2 -0
  28. package/src/tiles/grid/account-tile.ts +16 -1
  29. package/src/tiles/item-image.ts +90 -31
  30. package/src/tiles/list/tile-list-compact.ts +45 -50
  31. package/src/tiles/list/tile-list.ts +22 -21
  32. package/tsconfig.json +1 -1
  33. package/vite.config.ts +22 -0
  34. package/web-dev-server.config.mjs +1 -1
  35. package/dist/demo/app-root.js.map +0 -1
  36. package/dist/src/assets/img/icons/mediatype/livemusic.d.ts +0 -1
  37. package/dist/src/assets/img/icons/mediatype/livemusic.js +0 -7
  38. package/dist/src/assets/img/icons/mediatype/livemusic.js.map +0 -1
  39. package/dist/src/assets/img/icons/mediatype/photos.d.ts +0 -1
  40. package/dist/src/assets/img/icons/mediatype/photos.js +0 -7
  41. package/dist/src/assets/img/icons/mediatype/photos.js.map +0 -1
  42. package/dist/src/helpers.d.ts +0 -1
  43. package/dist/src/helpers.js +0 -20
  44. package/dist/src/helpers.js.map +0 -1
  45. package/dist/src/mediatype/mediatype-color.d.ts +0 -3
  46. package/dist/src/mediatype/mediatype-color.js +0 -15
  47. package/dist/src/mediatype/mediatype-color.js.map +0 -1
  48. package/dist/src/mediatype/mediatype-display.d.ts +0 -3
  49. package/dist/src/mediatype/mediatype-display.js +0 -86
  50. package/dist/src/mediatype/mediatype-display.js.map +0 -1
  51. package/dist/src/mediatype/mediatype-icon.d.ts +0 -10
  52. package/dist/src/mediatype/mediatype-icon.js +0 -105
  53. package/dist/src/mediatype/mediatype-icon.js.map +0 -1
  54. package/dist/src/mediatype/mediatype-text.d.ts +0 -3
  55. package/dist/src/mediatype/mediatype-text.js +0 -17
  56. package/dist/src/mediatype/mediatype-text.js.map +0 -1
  57. package/dist/src/mediatype/mediatypeConfig.d.ts +0 -3
  58. package/dist/src/mediatype/mediatypeConfig.js +0 -86
  59. package/dist/src/mediatype/mediatypeConfig.js.map +0 -1
  60. package/dist/src/mediatype-icon.d.ts +0 -9
  61. package/dist/src/mediatype-icon.js +0 -78
  62. package/dist/src/mediatype-icon.js.map +0 -1
  63. package/dist/src/sort-filter-bar/img/grid.d.ts +0 -1
  64. package/dist/src/sort-filter-bar/img/grid.js +0 -5
  65. package/dist/src/sort-filter-bar/img/grid.js.map +0 -1
  66. package/dist/src/tiles/list/tile-list-detail.d.ts +0 -7
  67. package/dist/src/tiles/list/tile-list-detail.js +0 -28
  68. package/dist/src/tiles/list/tile-list-detail.js.map +0 -1
  69. package/dist/src/tiles/loading-tile.d.ts +0 -5
  70. package/dist/src/tiles/loading-tile.js +0 -32
  71. package/dist/src/tiles/loading-tile.js.map +0 -1
  72. package/dist/src/utils/format-string.d.ts +0 -2
  73. package/dist/src/utils/format-string.js +0 -7
  74. package/dist/src/utils/format-string.js.map +0 -1
  75. package/dist/src/waveform-thumbnail.d.ts +0 -7
  76. package/dist/src/waveform-thumbnail.js +0 -106
  77. package/dist/src/waveform-thumbnail.js.map +0 -1
  78. package/dist/src/waveform-view.d.ts +0 -0
  79. package/dist/src/waveform-view.js +0 -2
  80. package/dist/src/waveform-view.js.map +0 -1
  81. package/dist/src/your-webcomponent.d.ts +0 -8
  82. package/dist/src/your-webcomponent.js +0 -38
  83. package/dist/src/your-webcomponent.js.map +0 -1
  84. package/dist/test/mediatype-icon.test.d.ts +0 -0
  85. package/dist/test/mediatype-icon.test.js +0 -3
  86. package/dist/test/mediatype-icon.test.js.map +0 -1
  87. package/dist/test/mediatypeConfig.test.d.ts +0 -1
  88. package/dist/test/mediatypeConfig.test.js +0 -17
  89. package/dist/test/mediatypeConfig.test.js.map +0 -1
  90. package/dist/test/utils/format-string.test.d.ts +0 -1
  91. package/dist/test/utils/format-string.test.js +0 -17
  92. package/dist/test/utils/format-string.test.js.map +0 -1
  93. package/dist/test/your-webcomponent.test.d.ts +0 -1
  94. package/dist/test/your-webcomponent.test.js +0 -23
  95. package/dist/test/your-webcomponent.test.js.map +0 -1
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
- ![Build Status](https://github.com/internetarchive/iaux-collection-browser/actions/workflows/ci.yml/badge.svg)
1
+ ![Build Status](https://github.com/internetarchive/iaux-collection-browser/actions/workflows/ci.yml/badge.svg) [![codecov](https://codecov.io/gh/internetarchive/iaux-collection-browser/branch/main/graph/badge.svg?token=CLWEGO4RMQ)](https://codecov.io/gh/internetarchive/iaux-collection-browser)
2
+
2
3
 
3
4
  # Internet Archive Collection Browser
4
5
 
@@ -15,9 +16,10 @@ import '@internetarchive/collection-browser';
15
16
 
16
17
  ## Local Demo with `web-dev-server`
17
18
  ```bash
19
+ yarn install
18
20
  yarn start
19
21
  ```
20
- To run a local development server that serves the basic demo located in `demo/index.html`
22
+ To run a local development server that serves the basic demo located in `index.html`
21
23
 
22
24
  ## Testing with Web Test Runner
23
25
  To run the suite of Web Test Runner tests, run
@@ -63,3 +65,14 @@ yarn run format:prettier
63
65
  For most of the tools, the configuration is in the `package.json` to reduce the amount of files in your project.
64
66
 
65
67
  If you customize the configuration a lot, you can consider moving them to individual files.
68
+
69
+ ## Deploying using `gh-pages`
70
+
71
+
72
+ ```
73
+ yarn run deploy -e <review_app_name>
74
+ ```
75
+
76
+ Review app URL: [https://internetarchive.github.io/iaux-collection-browser](https://internetarchive.github.io/iaux-collection-browser)
77
+
78
+
@@ -11,6 +11,7 @@ export declare class AppRoot extends LitElement {
11
11
  private cellHeight;
12
12
  private rowGap;
13
13
  private colGap;
14
+ private loggedIn;
14
15
  private baseQueryField;
15
16
  private pageNumberInput;
16
17
  private collectionBrowser;
@@ -20,6 +21,7 @@ export declare class AppRoot extends LitElement {
20
21
  private queryUpdated;
21
22
  render(): import("lit-html").TemplateResult<1>;
22
23
  private baseQueryChanged;
24
+ private loginChanged;
23
25
  private outlineChanged;
24
26
  private rowGapChanged;
25
27
  private colGapChanged;
@@ -20,6 +20,7 @@ let AppRoot = class AppRoot extends LitElement {
20
20
  this.cellHeight = 29;
21
21
  this.rowGap = 1.7;
22
22
  this.colGap = 1.7;
23
+ this.loggedIn = false;
23
24
  }
24
25
  searchPressed(e) {
25
26
  var _a, _b;
@@ -100,6 +101,14 @@ let AppRoot = class AppRoot extends LitElement {
100
101
  @click=${this.outlineChanged}
101
102
  />
102
103
  </div>
104
+ <div>
105
+ <label for="simulate-login">Simulate Login:</label>
106
+ <input
107
+ type="checkbox"
108
+ id="simulate-login"
109
+ @click=${this.loginChanged}
110
+ />
111
+ </div>
103
112
  </div>
104
113
  <div id="cell-gap-control">
105
114
  <div>
@@ -140,6 +149,7 @@ let AppRoot = class AppRoot extends LitElement {
140
149
  .resizeObserver=${this.resizeObserver}
141
150
  .collectionNameCache=${this.collectionNameCache}
142
151
  .showHistogramDatePicker=${true}
152
+ .loggedIn=${this.loggedIn}
143
153
  @visiblePageChanged=${this.visiblePageChanged}
144
154
  @baseQueryChanged=${this.baseQueryChanged}
145
155
  >
@@ -150,6 +160,15 @@ let AppRoot = class AppRoot extends LitElement {
150
160
  baseQueryChanged(e) {
151
161
  this.searchQuery = e.detail.baseQuery;
152
162
  }
163
+ loginChanged(e) {
164
+ const target = e.target;
165
+ if (target.checked) {
166
+ this.loggedIn = true;
167
+ }
168
+ else {
169
+ this.loggedIn = false;
170
+ }
171
+ }
153
172
  outlineChanged(e) {
154
173
  const target = e.target;
155
174
  if (target.checked) {
@@ -247,6 +266,9 @@ __decorate([
247
266
  __decorate([
248
267
  state()
249
268
  ], AppRoot.prototype, "colGap", void 0);
269
+ __decorate([
270
+ state()
271
+ ], AppRoot.prototype, "loggedIn", void 0);
250
272
  __decorate([
251
273
  query('#base-query-field')
252
274
  ], AppRoot.prototype, "baseQueryField", void 0);
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app-root.js","sourceRoot":"","sources":["../../src/app-root.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,MAAM,wCAAwC,CAAC;AAE7E,OAAO,2BAA2B,CAAC;AAGnC,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IAAvC;;QACU,kBAAa,GAAG,aAAa,CAAC,OAAO,CAAC;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B,CAAC,KAAK,CAAC,WAAW,CACtC,kCAAkC,EAClC,GAAG,KAAK,CAAC,KAAK,KAAK,CACpB,CAAC;QACF,IAAI,CAAC,iBAAiB,CAAC,KAAK,CAAC,WAAW,CACtC,kCAAkC,EAClC,GAAG,KAAK,CAAC,KAAK,KAAK,CACpB,CAAC;IACJ,CAAC;IAEO,kBAAkB,CAAC,CAAsC;QAC/D,MAAM,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;QAChC,IAAI,UAAU,KAAK,IAAI,CAAC,WAAW;YAAE,OAAO;QAC5C,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;IAChC,CAAC;CA4CF,CAAA;AA1CQ,cAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyClB,CAAC;AAjRO;IAAR,KAAK,EAAE;4CAA8B;AAE7B;IAAR,KAAK,EAAE;4CAA8B;AAE7B;IAAR,KAAK,EAAE;0CAAgC;AAE/B;IAAR,KAAK,EAAE;2CAAiC;AAEhC;IAAR,KAAK,EAAE;uCAA8B;AAE7B;IAAR,KAAK,EAAE;uCAA8B;AAE7B;IAAR,KAAK,EAAE;yCAAmC;AAEf;IAA3B,KAAK,CAAC,mBAAmB,CAAC;+CAA2C;AAEzC;IAA5B,KAAK,CAAC,oBAAoB,CAAC;gDAA4C;AAE3C;IAA5B,KAAK,CAAC,oBAAoB,CAAC;kDAA+C;AA9BhE,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CA8RnB;SA9RY,OAAO","sourcesContent":["import { SearchService } from '@internetarchive/search-service';\nimport { LocalCache } from '@internetarchive/local-cache';\nimport { html, css, LitElement, PropertyValues } from 'lit';\nimport { customElement, query, state } from 'lit/decorators.js';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { CollectionNameCache } from '@internetarchive/collection-name-cache';\nimport type { CollectionBrowser } from '../src/collection-browser';\nimport '../src/collection-browser';\n\n@customElement('app-root')\nexport class AppRoot extends LitElement {\n private searchService = SearchService.default;\n\n private resizeObserver = new SharedResizeObserver();\n\n private localCache = new LocalCache();\n\n private collectionNameCache = new CollectionNameCache({\n searchService: this.searchService,\n localCache: this.localCache,\n });\n\n @state() private currentPage?: number;\n\n @state() private searchQuery?: string;\n\n @state() private cellWidth: number = 18;\n\n @state() private cellHeight: number = 29;\n\n @state() private rowGap: number = 1.7;\n\n @state() private colGap: number = 1.7;\n\n @state() private loggedIn: boolean = false;\n\n @query('#base-query-field') private baseQueryField!: HTMLInputElement;\n\n @query('#page-number-input') private pageNumberInput!: HTMLInputElement;\n\n @query('collection-browser') private collectionBrowser!: CollectionBrowser;\n\n private searchPressed(e: Event) {\n e.preventDefault();\n this.searchQuery = this.baseQueryField.value;\n if ((this.currentPage ?? 1) > 1) {\n this.collectionBrowser.goToPage(this.currentPage ?? 1);\n }\n }\n\n private changePagePressed(e: Event) {\n e.preventDefault();\n this.currentPage = this.pageNumberInput.valueAsNumber;\n this.collectionBrowser.goToPage(this.currentPage);\n }\n\n protected updated(changed: PropertyValues): void {\n if (changed.has('currentPage') && this.currentPage) {\n this.pageNumberInput.value = this.currentPage.toString();\n }\n\n if (changed.has('searchQuery')) {\n this.queryUpdated();\n }\n }\n\n private queryUpdated() {\n this.collectionBrowser.baseQuery = this.searchQuery;\n }\n\n render() {\n return html`\n <div id=\"dev-tools\">\n <form @submit=${this.searchPressed}>\n Query:\n <input\n type=\"text\"\n id=\"base-query-field\"\n .value=${this.searchQuery ?? ''}\n />\n <input type=\"submit\" value=\"Search\" />\n </form>\n\n <form @submit=${this.changePagePressed}>\n Page: <input type=\"number\" value=\"1\" id=\"page-number-input\" />\n <input type=\"submit\" value=\"Go\" />\n </form>\n\n <div id=\"cell-controls\">\n <div id=\"cell-size-control\">\n <div>\n <label for=\"cell-width-slider\">Minimum cell width:</label>\n <input\n type=\"range\"\n min=\"10\"\n max=\"100\"\n value=\"18\"\n step=\"0.1\"\n id=\"cell-width-slider\"\n @input=${this.widthChanged}\n />\n <span>${this.cellWidth}rem</span>\n </div>\n <div>\n <label for=\"cell-height-slider\">Cell height:</label>\n <input\n type=\"range\"\n min=\"10\"\n max=\"100\"\n value=\"29\"\n step=\"0.1\"\n id=\"cell-height-slider\"\n @input=${this.heightChanged}\n />\n <span>${this.cellHeight}rem</span>\n </div>\n <div>\n <label for=\"show-outline-check\">Show outlines:</label>\n <input\n type=\"checkbox\"\n id=\"show-outline-check\"\n @click=${this.outlineChanged}\n />\n </div>\n <div>\n <label for=\"simulate-login\">Simulate Login:</label>\n <input\n type=\"checkbox\"\n id=\"simulate-login\"\n @click=${this.loginChanged}\n />\n </div>\n </div>\n <div id=\"cell-gap-control\">\n <div>\n <label for=\"cell-row-gap-slider\">Row gap:</label>\n <input\n type=\"range\"\n min=\"0\"\n max=\"5\"\n value=\"1.7\"\n step=\"0.1\"\n id=\"cell-row-gap-slider\"\n @input=${this.rowGapChanged}\n />\n <span>${this.rowGap}rem</span>\n </div>\n <div>\n <label for=\"cell-col-gap-slider\">Col gap:</label>\n <input\n type=\"range\"\n min=\"0\"\n max=\"5\"\n value=\"1.7\"\n step=\"0.1\"\n id=\"cell-col-gap-slider\"\n @input=${this.colGapChanged}\n />\n <span>${this.colGap}rem</span>\n </div>\n </div>\n </div>\n </div>\n\n <div id=\"collection-browser-container\">\n <collection-browser\n .baseNavigationUrl=${'https://archive.org'}\n .baseImageUrl=${'https://archive.org'}\n .searchService=${this.searchService}\n .resizeObserver=${this.resizeObserver}\n .collectionNameCache=${this.collectionNameCache}\n .showHistogramDatePicker=${true}\n .loggedIn=${this.loggedIn}\n @visiblePageChanged=${this.visiblePageChanged}\n @baseQueryChanged=${this.baseQueryChanged}\n >\n </collection-browser>\n </div>\n `;\n }\n\n private baseQueryChanged(e: CustomEvent<{ baseQuery?: string }>) {\n this.searchQuery = e.detail.baseQuery;\n }\n\n private loginChanged(e: Event) {\n const target = e.target as HTMLInputElement;\n if (target.checked) {\n this.loggedIn = true;\n } else {\n this.loggedIn = false;\n }\n }\n\n private outlineChanged(e: Event) {\n const target = e.target as HTMLInputElement;\n if (target.checked) {\n this.collectionBrowser.style.setProperty(\n '--infiniteScrollerCellOutline',\n '1px solid #33D1FF'\n );\n } else {\n this.collectionBrowser.style.removeProperty(\n '--infiniteScrollerCellOutline'\n );\n }\n }\n\n private rowGapChanged(e: Event) {\n const input = e.target as HTMLInputElement;\n this.rowGap = parseFloat(input.value);\n this.collectionBrowser.style.setProperty(\n '--collectionBrowserRowGap',\n `${input.value}rem`\n );\n }\n\n private colGapChanged(e: Event) {\n const input = e.target as HTMLInputElement;\n this.colGap = parseFloat(input.value);\n this.collectionBrowser.style.setProperty(\n '--collectionBrowserColGap',\n `${input.value}rem`\n );\n }\n\n private widthChanged(e: Event) {\n const input = e.target as HTMLInputElement;\n this.cellWidth = parseFloat(input.value);\n this.collectionBrowser.style.setProperty(\n '--collectionBrowserCellMinWidth',\n `${input.value}rem`\n );\n }\n\n private heightChanged(e: Event) {\n const input = e.target as HTMLInputElement;\n this.cellHeight = parseFloat(input.value);\n this.collectionBrowser.style.setProperty(\n '--collectionBrowserCellMinHeight',\n `${input.value}rem`\n );\n this.collectionBrowser.style.setProperty(\n '--collectionBrowserCellMaxHeight',\n `${input.value}rem`\n );\n }\n\n private visiblePageChanged(e: CustomEvent<{ pageNumber: number }>) {\n const { pageNumber } = e.detail;\n if (pageNumber === this.currentPage) return;\n this.currentPage = pageNumber;\n }\n\n static styles = css`\n :host {\n display: block;\n }\n\n input,\n button {\n font-size: 1.6rem;\n }\n\n collection-browser {\n margin-top: 30rem;\n }\n\n #base-query-field {\n width: 300px;\n }\n\n #dev-tools {\n position: fixed;\n top: 0;\n left: 0;\n z-index: 10;\n -webkit-backdrop-filter: blur(10px);\n backdrop-filter: blur(10px);\n padding: 0.5rem 1rem;\n border: 1px solid black;\n }\n\n #cell-controls {\n display: flex;\n }\n\n #cell-controls label {\n display: inline-block;\n width: 10rem;\n }\n\n #cell-gap-control {\n margin-left: 1rem;\n }\n `;\n}\n"]}
@@ -0,0 +1 @@
1
+ export declare const restrictedIcon: import("lit-html").TemplateResult<2>;
@@ -0,0 +1,29 @@
1
+ import { svg } from 'lit';
2
+ export const restrictedIcon = svg `
3
+ <svg
4
+ viewBox="0 0 100 100"
5
+ xmlns="http://www.w3.org/2000/svg"
6
+ >
7
+ <g
8
+ fill="none"
9
+ fill-rule="evenodd"
10
+ >
11
+ <path
12
+ d="m56.4612493 8.80450354 41.8901185 75.94632926c1.7706782 2.8433173 2.1150372 5.2623412 1.0330766 7.2570716-1.0819604 1.9947304-3.26978 2.9920956-6.5634587 2.9920956h-85.69973905c-3.29367873 0-5.46954894-.9973652-6.52761065-2.9920956-1.0580617-1.9947304-.70175345-4.4137543 1.06892476-7.2570716l41.89011844-75.12308969c1.8184757-2.84331737 3.9693609-4.37738627 6.4526556-4.60220671s4.6341799 1.03483527 6.4526556 3.77896714z"
13
+ fill="#000"
14
+ fill-rule="nonzero"
15
+ />
16
+ <path
17
+ d="m94.0140845 90-44.5547054-79-44.4593791 79z"
18
+ fill="#f8e71c"
19
+ fill-rule="nonzero"
20
+ />
21
+ <path
22
+ d="m54 69v8h-8v-8zm0-30v10.2515641l-2.0923567 14.7484359h-3.8184713l-2.089172-14.7484359v-10.2515641z"
23
+ fill="#000"
24
+ />
25
+ </g>
26
+ <title>Content may be inappropriate</title>
27
+ </svg>
28
+ `;
29
+ //# sourceMappingURL=restricted.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"restricted.js","sourceRoot":"","sources":["../../../../../src/assets/img/icons/restricted.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BhC,CAAC","sourcesContent":["import { svg } from 'lit';\n\nexport const restrictedIcon = svg`\n <svg\n viewBox=\"0 0 100 100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g\n fill=\"none\"\n fill-rule=\"evenodd\"\n >\n <path\n d=\"m56.4612493 8.80450354 41.8901185 75.94632926c1.7706782 2.8433173 2.1150372 5.2623412 1.0330766 7.2570716-1.0819604 1.9947304-3.26978 2.9920956-6.5634587 2.9920956h-85.69973905c-3.29367873 0-5.46954894-.9973652-6.52761065-2.9920956-1.0580617-1.9947304-.70175345-4.4137543 1.06892476-7.2570716l41.89011844-75.12308969c1.8184757-2.84331737 3.9693609-4.37738627 6.4526556-4.60220671s4.6341799 1.03483527 6.4526556 3.77896714z\"\n fill=\"#000\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m94.0140845 90-44.5547054-79-44.4593791 79z\"\n fill=\"#f8e71c\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m54 69v8h-8v-8zm0-30v10.2515641l-2.0923567 14.7484359h-3.8184713l-2.089172-14.7484359v-10.2515641z\"\n fill=\"#000\"\n />\n </g>\n <title>Content may be inappropriate</title>\n </svg>\n`;\n"]}
@@ -37,6 +37,11 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
37
37
  pageContext: CollectionBrowserContext;
38
38
  restorationStateHandler: RestorationStateHandlerInterface;
39
39
  mobileBreakpoint: number;
40
+ loggedIn: boolean;
41
+ /**
42
+ * If item management UI active
43
+ */
44
+ isManageView: boolean;
40
45
  /**
41
46
  * The page that the consumer wants to load.
42
47
  */
@@ -67,6 +72,11 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
67
72
  * When we've reached the end of the data, stop trying to fetch more
68
73
  */
69
74
  private endOfDataReached;
75
+ /**
76
+ * When page width resizes from desktop to mobile, set true to
77
+ * disable expand/collapse transition when loading.
78
+ */
79
+ private isResizeToMobile;
70
80
  private placeholderCellTemplate;
71
81
  private tileModelAtCellIndex;
72
82
  private get sortFilterQueries();
@@ -97,6 +107,7 @@ export declare class CollectionBrowser extends LitElement implements InfiniteScr
97
107
  private titleLetterSelected;
98
108
  private creatorLetterSelected;
99
109
  private get facetDataLoading();
110
+ private get mobileFacetsTemplate();
100
111
  private get facetsTemplate();
101
112
  private get loadingTemplate();
102
113
  private get listHeaderTemplate();
@@ -30,6 +30,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
30
30
  context: this.pageContext,
31
31
  });
32
32
  this.mobileBreakpoint = 600;
33
+ this.loggedIn = false;
34
+ /**
35
+ * If item management UI active
36
+ */
37
+ this.isManageView = false;
33
38
  /**
34
39
  * The page that the consumer wants to load.
35
40
  */
@@ -56,6 +61,11 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
56
61
  * When we've reached the end of the data, stop trying to fetch more
57
62
  */
58
63
  this.endOfDataReached = false;
64
+ /**
65
+ * When page width resizes from desktop to mobile, set true to
66
+ * disable expand/collapse transition when loading.
67
+ */
68
+ this.isResizeToMobile = false;
59
69
  this.placeholderCellTemplate = html `<collection-browser-loading-tile></collection-browser-loading-tile>`;
60
70
  /**
61
71
  * The results per page so we can paginate.
@@ -129,31 +139,12 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
129
139
  render() {
130
140
  return html `
131
141
  <div id="content-container" class=${this.mobileView ? 'mobile' : ''}>
132
- <div id="left-column" class="column">
142
+ <div
143
+ id="left-column"
144
+ class="column${this.isResizeToMobile ? ' preload' : ''}"
145
+ >
133
146
  <div id="mobile-header-container">
134
- ${this.mobileView
135
- ? html `
136
- <div id="mobile-filter-collapse">
137
- <h1
138
- @click=${() => {
139
- this.mobileFacetsVisible = !this.mobileFacetsVisible;
140
- }}
141
- @keyup=${() => {
142
- this.mobileFacetsVisible = !this.mobileFacetsVisible;
143
- }}
144
- >
145
- <span
146
- class="collapser ${this.mobileFacetsVisible
147
- ? 'open'
148
- : ''}"
149
- >
150
- ${chevronIcon}
151
- </span>
152
- Filters
153
- </h1>
154
- </div>
155
- `
156
- : nothing}
147
+ ${this.mobileView ? this.mobileFacetsTemplate : nothing}
157
148
  <div id="results-total">
158
149
  <span id="big-results-count"
159
150
  >${this.totalResults !== undefined
@@ -255,6 +246,27 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
255
246
  get facetDataLoading() {
256
247
  return this.facetsLoading || this.fullYearAggregationLoading;
257
248
  }
249
+ get mobileFacetsTemplate() {
250
+ return html `
251
+ <div id="mobile-filter-collapse">
252
+ <h1
253
+ @click=${() => {
254
+ this.isResizeToMobile = false;
255
+ this.mobileFacetsVisible = !this.mobileFacetsVisible;
256
+ }}
257
+ @keyup=${() => {
258
+ this.isResizeToMobile = false;
259
+ this.mobileFacetsVisible = !this.mobileFacetsVisible;
260
+ }}
261
+ >
262
+ <span class="collapser ${this.mobileFacetsVisible ? 'open' : ''}">
263
+ ${chevronIcon}
264
+ </span>
265
+ Filters
266
+ </h1>
267
+ </div>
268
+ `;
269
+ }
258
270
  get facetsTemplate() {
259
271
  return html `
260
272
  ${this.facetsLoading ? this.loadingTemplate : nothing}
@@ -369,8 +381,13 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
369
381
  }
370
382
  }
371
383
  handleResize(entry) {
384
+ const previousView = this.mobileView;
372
385
  if (entry.target === this.contentContainer) {
373
- this.mobileView = entry.contentRect.width < 600;
386
+ this.mobileView = entry.contentRect.width < this.mobileBreakpoint;
387
+ // If changing from desktop to mobile disable transition
388
+ if (this.mobileView && !previousView) {
389
+ this.isResizeToMobile = true;
390
+ }
374
391
  }
375
392
  }
376
393
  emitBaseQueryChanged() {
@@ -789,30 +806,50 @@ let CollectionBrowser = class CollectionBrowser extends LitElement {
789
806
  const datasource = { ...this.dataSource };
790
807
  const tiles = [];
791
808
  docs === null || docs === void 0 ? void 0 : docs.forEach(doc => {
792
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
809
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7;
793
810
  if (!doc.identifier)
794
811
  return;
812
+ let loginRequired = false;
813
+ let contentWarning = false;
814
+ // Check if item and item in "modifying" collection, setting above flags
815
+ if (((_a = doc.collections_raw) === null || _a === void 0 ? void 0 : _a.values.length) &&
816
+ ((_b = doc.mediatype) === null || _b === void 0 ? void 0 : _b.value) !== 'collection') {
817
+ for (const collection of (_c = doc.collections_raw) === null || _c === void 0 ? void 0 : _c.values) {
818
+ if (collection === 'loggedin') {
819
+ loginRequired = true;
820
+ if (contentWarning)
821
+ break;
822
+ }
823
+ if (collection === 'no-preview') {
824
+ contentWarning = true;
825
+ if (loginRequired)
826
+ break;
827
+ }
828
+ }
829
+ }
795
830
  tiles.push({
796
- averageRating: (_a = doc.avg_rating) === null || _a === void 0 ? void 0 : _a.value,
797
- collections: (_c = (_b = doc.collections_raw) === null || _b === void 0 ? void 0 : _b.values) !== null && _c !== void 0 ? _c : [],
798
- commentCount: (_e = (_d = doc.num_reviews) === null || _d === void 0 ? void 0 : _d.value) !== null && _e !== void 0 ? _e : 0,
799
- creator: (_f = doc.creator) === null || _f === void 0 ? void 0 : _f.value,
800
- creators: (_h = (_g = doc.creator) === null || _g === void 0 ? void 0 : _g.values) !== null && _h !== void 0 ? _h : [],
801
- dateAdded: (_j = doc.addeddate) === null || _j === void 0 ? void 0 : _j.value,
802
- dateArchived: (_k = doc.publicdate) === null || _k === void 0 ? void 0 : _k.value,
803
- datePublished: (_l = doc.date) === null || _l === void 0 ? void 0 : _l.value,
804
- dateReviewed: (_m = doc.reviewdate) === null || _m === void 0 ? void 0 : _m.value,
805
- description: (_o = doc.description) === null || _o === void 0 ? void 0 : _o.value,
806
- favCount: (_q = (_p = doc.num_favorites) === null || _p === void 0 ? void 0 : _p.value) !== null && _q !== void 0 ? _q : 0,
831
+ averageRating: (_d = doc.avg_rating) === null || _d === void 0 ? void 0 : _d.value,
832
+ collections: (_f = (_e = doc.collections_raw) === null || _e === void 0 ? void 0 : _e.values) !== null && _f !== void 0 ? _f : [],
833
+ commentCount: (_h = (_g = doc.num_reviews) === null || _g === void 0 ? void 0 : _g.value) !== null && _h !== void 0 ? _h : 0,
834
+ creator: (_j = doc.creator) === null || _j === void 0 ? void 0 : _j.value,
835
+ creators: (_l = (_k = doc.creator) === null || _k === void 0 ? void 0 : _k.values) !== null && _l !== void 0 ? _l : [],
836
+ dateAdded: (_m = doc.addeddate) === null || _m === void 0 ? void 0 : _m.value,
837
+ dateArchived: (_o = doc.publicdate) === null || _o === void 0 ? void 0 : _o.value,
838
+ datePublished: (_p = doc.date) === null || _p === void 0 ? void 0 : _p.value,
839
+ dateReviewed: (_q = doc.reviewdate) === null || _q === void 0 ? void 0 : _q.value,
840
+ description: (_r = doc.description) === null || _r === void 0 ? void 0 : _r.value,
841
+ favCount: (_t = (_s = doc.num_favorites) === null || _s === void 0 ? void 0 : _s.value) !== null && _t !== void 0 ? _t : 0,
807
842
  identifier: doc.identifier,
808
- issue: (_r = doc.issue) === null || _r === void 0 ? void 0 : _r.value,
809
- itemCount: (_t = (_s = doc.item_count) === null || _s === void 0 ? void 0 : _s.value) !== null && _t !== void 0 ? _t : 0,
810
- mediatype: (_v = (_u = doc.mediatype) === null || _u === void 0 ? void 0 : _u.value) !== null && _v !== void 0 ? _v : 'data',
811
- source: (_w = doc.source) === null || _w === void 0 ? void 0 : _w.value,
812
- subjects: (_y = (_x = doc.subject) === null || _x === void 0 ? void 0 : _x.values) !== null && _y !== void 0 ? _y : [],
813
- title: this.etreeTitle((_z = doc.title) === null || _z === void 0 ? void 0 : _z.value, (_0 = doc.mediatype) === null || _0 === void 0 ? void 0 : _0.value, (_1 = doc.collection) === null || _1 === void 0 ? void 0 : _1.values),
814
- volume: (_2 = doc.volume) === null || _2 === void 0 ? void 0 : _2.value,
815
- viewCount: (_4 = (_3 = doc.downloads) === null || _3 === void 0 ? void 0 : _3.value) !== null && _4 !== void 0 ? _4 : 0,
843
+ issue: (_u = doc.issue) === null || _u === void 0 ? void 0 : _u.value,
844
+ itemCount: (_w = (_v = doc.item_count) === null || _v === void 0 ? void 0 : _v.value) !== null && _w !== void 0 ? _w : 0,
845
+ mediatype: (_y = (_x = doc.mediatype) === null || _x === void 0 ? void 0 : _x.value) !== null && _y !== void 0 ? _y : 'data',
846
+ source: (_z = doc.source) === null || _z === void 0 ? void 0 : _z.value,
847
+ subjects: (_1 = (_0 = doc.subject) === null || _0 === void 0 ? void 0 : _0.values) !== null && _1 !== void 0 ? _1 : [],
848
+ title: this.etreeTitle((_2 = doc.title) === null || _2 === void 0 ? void 0 : _2.value, (_3 = doc.mediatype) === null || _3 === void 0 ? void 0 : _3.value, (_4 = doc.collection) === null || _4 === void 0 ? void 0 : _4.values),
849
+ volume: (_5 = doc.volume) === null || _5 === void 0 ? void 0 : _5.value,
850
+ viewCount: (_7 = (_6 = doc.downloads) === null || _6 === void 0 ? void 0 : _6.value) !== null && _7 !== void 0 ? _7 : 0,
851
+ loginRequired,
852
+ contentWarning,
816
853
  });
817
854
  });
818
855
  datasource[pageNumber] = tiles;
@@ -869,6 +906,18 @@ CollectionBrowser.styles = css `
869
906
  display: block;
870
907
  }
871
908
 
909
+ /**
910
+ * When page width resizes from desktop to mobile, use this class to
911
+ * disable expand/collapse transition when loading.
912
+ */
913
+ .preload * {
914
+ transition: none !important;
915
+ -webkit-transition: none !important;
916
+ -moz-transition: none !important;
917
+ -ms-transition: none !important;
918
+ -o-transition: none !important;
919
+ }
920
+
872
921
  #content-container {
873
922
  display: flex;
874
923
  }
@@ -1115,6 +1164,12 @@ __decorate([
1115
1164
  __decorate([
1116
1165
  property({ type: Number })
1117
1166
  ], CollectionBrowser.prototype, "mobileBreakpoint", void 0);
1167
+ __decorate([
1168
+ property({ type: Boolean })
1169
+ ], CollectionBrowser.prototype, "loggedIn", void 0);
1170
+ __decorate([
1171
+ property({ type: Boolean })
1172
+ ], CollectionBrowser.prototype, "isManageView", void 0);
1118
1173
  __decorate([
1119
1174
  state()
1120
1175
  ], CollectionBrowser.prototype, "pagesToRender", void 0);