@internetarchive/collection-browser 0.4.3-alpha.9 → 0.4.4-alpha

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 (250) hide show
  1. package/.editorconfig +29 -29
  2. package/.github/workflows/ci.yml +26 -26
  3. package/.github/workflows/gh-pages-main.yml +39 -39
  4. package/.github/workflows/npm-publish.yml +39 -39
  5. package/.github/workflows/pr-preview.yml +38 -38
  6. package/.husky/pre-commit +4 -4
  7. package/LICENSE +661 -661
  8. package/README.md +83 -83
  9. package/dist/index.d.ts +9 -9
  10. package/dist/index.js +9 -9
  11. package/dist/src/app-root.d.ts +50 -48
  12. package/dist/src/app-root.js +449 -412
  13. package/dist/src/app-root.js.map +1 -1
  14. package/dist/src/assets/img/icons/arrow-left.d.ts +2 -2
  15. package/dist/src/assets/img/icons/arrow-left.js +2 -2
  16. package/dist/src/assets/img/icons/arrow-right.d.ts +2 -2
  17. package/dist/src/assets/img/icons/arrow-right.js +2 -2
  18. package/dist/src/assets/img/icons/chevron.d.ts +2 -2
  19. package/dist/src/assets/img/icons/chevron.js +2 -2
  20. package/dist/src/assets/img/icons/empty-query.d.ts +2 -2
  21. package/dist/src/assets/img/icons/empty-query.js +2 -2
  22. package/dist/src/assets/img/icons/eye-closed.d.ts +2 -2
  23. package/dist/src/assets/img/icons/eye-closed.js +2 -2
  24. package/dist/src/assets/img/icons/eye.d.ts +2 -2
  25. package/dist/src/assets/img/icons/eye.js +2 -2
  26. package/dist/src/assets/img/icons/favorite-filled.d.ts +1 -1
  27. package/dist/src/assets/img/icons/favorite-filled.js +2 -2
  28. package/dist/src/assets/img/icons/login-required.d.ts +1 -1
  29. package/dist/src/assets/img/icons/login-required.js +2 -2
  30. package/dist/src/assets/img/icons/mediatype/account.d.ts +1 -1
  31. package/dist/src/assets/img/icons/mediatype/account.js +2 -2
  32. package/dist/src/assets/img/icons/mediatype/audio.d.ts +1 -1
  33. package/dist/src/assets/img/icons/mediatype/audio.js +2 -2
  34. package/dist/src/assets/img/icons/mediatype/collection.d.ts +1 -1
  35. package/dist/src/assets/img/icons/mediatype/collection.js +2 -2
  36. package/dist/src/assets/img/icons/mediatype/data.d.ts +1 -1
  37. package/dist/src/assets/img/icons/mediatype/data.js +2 -2
  38. package/dist/src/assets/img/icons/mediatype/etree.d.ts +1 -1
  39. package/dist/src/assets/img/icons/mediatype/etree.js +2 -2
  40. package/dist/src/assets/img/icons/mediatype/film.d.ts +1 -1
  41. package/dist/src/assets/img/icons/mediatype/film.js +2 -2
  42. package/dist/src/assets/img/icons/mediatype/images.d.ts +1 -1
  43. package/dist/src/assets/img/icons/mediatype/images.js +2 -2
  44. package/dist/src/assets/img/icons/mediatype/radio.d.ts +1 -1
  45. package/dist/src/assets/img/icons/mediatype/radio.js +2 -2
  46. package/dist/src/assets/img/icons/mediatype/software.d.ts +1 -1
  47. package/dist/src/assets/img/icons/mediatype/software.js +2 -2
  48. package/dist/src/assets/img/icons/mediatype/texts.d.ts +1 -1
  49. package/dist/src/assets/img/icons/mediatype/texts.js +2 -2
  50. package/dist/src/assets/img/icons/mediatype/tv.d.ts +1 -1
  51. package/dist/src/assets/img/icons/mediatype/tv.js +2 -2
  52. package/dist/src/assets/img/icons/mediatype/video.d.ts +1 -1
  53. package/dist/src/assets/img/icons/mediatype/video.js +2 -2
  54. package/dist/src/assets/img/icons/mediatype/web.d.ts +1 -1
  55. package/dist/src/assets/img/icons/mediatype/web.js +2 -2
  56. package/dist/src/assets/img/icons/null-result.d.ts +2 -2
  57. package/dist/src/assets/img/icons/null-result.js +2 -2
  58. package/dist/src/assets/img/icons/restricted.d.ts +1 -1
  59. package/dist/src/assets/img/icons/restricted.js +2 -2
  60. package/dist/src/assets/img/icons/reviews.d.ts +1 -1
  61. package/dist/src/assets/img/icons/reviews.js +2 -2
  62. package/dist/src/assets/img/icons/upload.d.ts +1 -1
  63. package/dist/src/assets/img/icons/upload.js +2 -2
  64. package/dist/src/assets/img/icons/views.d.ts +1 -1
  65. package/dist/src/assets/img/icons/views.js +2 -2
  66. package/dist/src/circular-activity-indicator.d.ts +5 -5
  67. package/dist/src/circular-activity-indicator.js +17 -17
  68. package/dist/src/collection-browser.d.ts +315 -276
  69. package/dist/src/collection-browser.js +1276 -1179
  70. package/dist/src/collection-browser.js.map +1 -1
  71. package/dist/src/collection-facets/facet-tombstone-row.d.ts +5 -5
  72. package/dist/src/collection-facets/facet-tombstone-row.js +15 -15
  73. package/dist/src/collection-facets/facets-template.d.ts +16 -16
  74. package/dist/src/collection-facets/facets-template.js +125 -125
  75. package/dist/src/collection-facets/more-facets-content.d.ts +77 -77
  76. package/dist/src/collection-facets/more-facets-content.js +357 -357
  77. package/dist/src/collection-facets/more-facets-pagination.d.ts +36 -36
  78. package/dist/src/collection-facets/more-facets-pagination.js +192 -192
  79. package/dist/src/collection-facets.d.ts +78 -78
  80. package/dist/src/collection-facets.js +391 -391
  81. package/dist/src/empty-placeholder.d.ts +11 -11
  82. package/dist/src/empty-placeholder.js +42 -42
  83. package/dist/src/language-code-handler/language-code-handler.d.ts +37 -37
  84. package/dist/src/language-code-handler/language-code-handler.js +26 -26
  85. package/dist/src/language-code-handler/language-code-mapping.d.ts +1 -1
  86. package/dist/src/language-code-handler/language-code-mapping.js +562 -562
  87. package/dist/src/mediatype/mediatype-config.d.ts +3 -3
  88. package/dist/src/mediatype/mediatype-config.js +85 -85
  89. package/dist/src/models.d.ts +114 -112
  90. package/dist/src/models.js +125 -125
  91. package/dist/src/models.js.map +1 -1
  92. package/dist/src/restoration-state-handler.d.ts +45 -45
  93. package/dist/src/restoration-state-handler.js +230 -230
  94. package/dist/src/sort-filter-bar/alpha-bar.d.ts +12 -12
  95. package/dist/src/sort-filter-bar/alpha-bar.js +52 -52
  96. package/dist/src/sort-filter-bar/img/compact.d.ts +1 -1
  97. package/dist/src/sort-filter-bar/img/compact.js +2 -2
  98. package/dist/src/sort-filter-bar/img/list.d.ts +1 -1
  99. package/dist/src/sort-filter-bar/img/list.js +2 -2
  100. package/dist/src/sort-filter-bar/img/sort-triangle.d.ts +1 -1
  101. package/dist/src/sort-filter-bar/img/sort-triangle.js +2 -2
  102. package/dist/src/sort-filter-bar/img/tile.d.ts +1 -1
  103. package/dist/src/sort-filter-bar/img/tile.js +2 -2
  104. package/dist/src/sort-filter-bar/sort-filter-bar.d.ts +108 -108
  105. package/dist/src/sort-filter-bar/sort-filter-bar.js +428 -428
  106. package/dist/src/styles/item-image-styles.d.ts +8 -8
  107. package/dist/src/styles/item-image-styles.js +22 -12
  108. package/dist/src/styles/item-image-styles.js.map +1 -1
  109. package/dist/src/tiles/collection-browser-loading-tile.d.ts +5 -5
  110. package/dist/src/tiles/collection-browser-loading-tile.js +16 -16
  111. package/dist/src/tiles/collection-browser-loading-tile.js.map +1 -1
  112. package/dist/src/tiles/grid/account-tile.d.ts +17 -17
  113. package/dist/src/tiles/grid/account-tile.js +48 -47
  114. package/dist/src/tiles/grid/account-tile.js.map +1 -1
  115. package/dist/src/tiles/grid/collection-tile.d.ts +14 -7
  116. package/dist/src/tiles/grid/collection-tile.js +112 -146
  117. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  118. package/dist/src/tiles/grid/item-tile.d.ts +29 -29
  119. package/dist/src/tiles/grid/item-tile.js +110 -105
  120. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  121. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.d.ts +1 -1
  122. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js +12 -8
  123. package/dist/src/tiles/grid/styles/tile-grid-shared-styles.js.map +1 -1
  124. package/dist/src/tiles/grid/tile-stats.d.ts +10 -10
  125. package/dist/src/tiles/grid/tile-stats.js +41 -40
  126. package/dist/src/tiles/grid/tile-stats.js.map +1 -1
  127. package/dist/src/tiles/image-block.d.ts +17 -17
  128. package/dist/src/tiles/image-block.js +76 -72
  129. package/dist/src/tiles/image-block.js.map +1 -1
  130. package/dist/src/tiles/item-image.d.ts +35 -35
  131. package/dist/src/tiles/item-image.js +117 -116
  132. package/dist/src/tiles/item-image.js.map +1 -1
  133. package/dist/src/tiles/list/account-label.d.ts +1 -1
  134. package/dist/src/tiles/list/account-label.js +6 -6
  135. package/dist/src/tiles/list/date-label.d.ts +1 -1
  136. package/dist/src/tiles/list/date-label.js +12 -12
  137. package/dist/src/tiles/list/tile-list-compact-header.d.ts +12 -12
  138. package/dist/src/tiles/list/tile-list-compact-header.js +41 -41
  139. package/dist/src/tiles/list/tile-list-compact.d.ts +21 -21
  140. package/dist/src/tiles/list/tile-list-compact.js +93 -93
  141. package/dist/src/tiles/list/tile-list.d.ts +53 -53
  142. package/dist/src/tiles/list/tile-list.js +279 -279
  143. package/dist/src/tiles/mediatype-icon.d.ts +9 -9
  144. package/dist/src/tiles/mediatype-icon.js +47 -47
  145. package/dist/src/tiles/overlay/icon-overlay.d.ts +10 -10
  146. package/dist/src/tiles/overlay/icon-overlay.js +40 -40
  147. package/dist/src/tiles/overlay/icon-text-overlay.d.ts +9 -9
  148. package/dist/src/tiles/overlay/icon-text-overlay.js +38 -38
  149. package/dist/src/tiles/overlay/text-overlay.d.ts +10 -10
  150. package/dist/src/tiles/overlay/text-overlay.js +42 -42
  151. package/dist/src/tiles/text-snippet-block.d.ts +27 -27
  152. package/dist/src/tiles/text-snippet-block.js +73 -73
  153. package/dist/src/tiles/tile-dispatcher.d.ts +36 -36
  154. package/dist/src/tiles/tile-dispatcher.js +145 -128
  155. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  156. package/dist/src/utils/analytics-events.d.ts +22 -22
  157. package/dist/src/utils/analytics-events.js +24 -24
  158. package/dist/src/utils/format-count.d.ts +7 -7
  159. package/dist/src/utils/format-count.js +76 -76
  160. package/dist/src/utils/format-date.d.ts +2 -2
  161. package/dist/src/utils/format-date.js +23 -23
  162. package/dist/src/utils/format-unit-size.d.ts +2 -0
  163. package/dist/src/utils/format-unit-size.js +34 -0
  164. package/dist/src/utils/format-unit-size.js.map +1 -0
  165. package/dist/test/collection-browser.test.d.ts +1 -1
  166. package/dist/test/collection-browser.test.js +646 -646
  167. package/dist/test/collection-facets/facets-template.test.d.ts +1 -1
  168. package/dist/test/collection-facets/facets-template.test.js +62 -62
  169. package/dist/test/collection-facets/more-facets-content.test.d.ts +1 -1
  170. package/dist/test/collection-facets/more-facets-content.test.js +114 -114
  171. package/dist/test/collection-facets/more-facets-pagination.test.d.ts +1 -1
  172. package/dist/test/collection-facets/more-facets-pagination.test.js +117 -117
  173. package/dist/test/collection-facets.test.d.ts +2 -2
  174. package/dist/test/collection-facets.test.js +544 -544
  175. package/dist/test/empty-placeholder.test.d.ts +1 -1
  176. package/dist/test/empty-placeholder.test.js +33 -33
  177. package/dist/test/icon-overlay.test.d.ts +1 -1
  178. package/dist/test/icon-overlay.test.js +24 -24
  179. package/dist/test/image-block.test.d.ts +1 -1
  180. package/dist/test/image-block.test.js +48 -48
  181. package/dist/test/item-image.test.d.ts +1 -1
  182. package/dist/test/item-image.test.js +84 -80
  183. package/dist/test/item-image.test.js.map +1 -1
  184. package/dist/test/mediatype-config.test.d.ts +1 -1
  185. package/dist/test/mediatype-config.test.js +16 -16
  186. package/dist/test/mocks/mock-analytics-handler.d.ts +10 -10
  187. package/dist/test/mocks/mock-analytics-handler.js +15 -15
  188. package/dist/test/mocks/mock-collection-name-cache.d.ts +7 -7
  189. package/dist/test/mocks/mock-collection-name-cache.js +13 -13
  190. package/dist/test/mocks/mock-search-responses.d.ts +12 -12
  191. package/dist/test/mocks/mock-search-responses.js +341 -341
  192. package/dist/test/mocks/mock-search-service.d.ts +13 -13
  193. package/dist/test/mocks/mock-search-service.js +40 -40
  194. package/dist/test/restoration-state-handler.test.d.ts +1 -1
  195. package/dist/test/restoration-state-handler.test.js +125 -125
  196. package/dist/test/sort-filter-bar/alpha-bar.test.d.ts +1 -1
  197. package/dist/test/sort-filter-bar/alpha-bar.test.js +43 -43
  198. package/dist/test/sort-filter-bar/sort-filter-bar.test.d.ts +1 -1
  199. package/dist/test/sort-filter-bar/sort-filter-bar.test.js +141 -141
  200. package/dist/test/text-overlay.test.d.ts +1 -1
  201. package/dist/test/text-overlay.test.js +48 -48
  202. package/dist/test/text-snippet-block.test.d.ts +1 -1
  203. package/dist/test/text-snippet-block.test.js +57 -57
  204. package/dist/test/tile-stats.test.d.ts +1 -1
  205. package/dist/test/tile-stats.test.js +33 -33
  206. package/dist/test/tiles/grid/account-tile.test.d.ts +1 -1
  207. package/dist/test/tiles/grid/account-tile.test.js +60 -60
  208. package/dist/test/tiles/grid/collection-tile.test.d.ts +1 -0
  209. package/dist/test/tiles/grid/collection-tile.test.js +73 -0
  210. package/dist/test/tiles/grid/collection-tile.test.js.map +1 -0
  211. package/dist/test/tiles/grid/item-tile.test.d.ts +1 -1
  212. package/dist/test/tiles/grid/item-tile.test.js +142 -129
  213. package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
  214. package/dist/test/tiles/list/tile-list-compact.test.d.ts +1 -1
  215. package/dist/test/tiles/list/tile-list-compact.test.js +92 -92
  216. package/dist/test/tiles/list/tile-list.test.d.ts +1 -1
  217. package/dist/test/tiles/list/tile-list.test.js +123 -123
  218. package/dist/test/utils/format-count.test.d.ts +1 -1
  219. package/dist/test/utils/format-count.test.js +23 -23
  220. package/dist/test/utils/format-date.test.d.ts +1 -1
  221. package/dist/test/utils/format-date.test.js +17 -17
  222. package/dist/test/utils/format-unit-size.test.d.ts +1 -0
  223. package/dist/test/utils/format-unit-size.test.js +18 -0
  224. package/dist/test/utils/format-unit-size.test.js.map +1 -0
  225. package/index.html +24 -24
  226. package/local.archive.org.cert +86 -86
  227. package/local.archive.org.key +27 -27
  228. package/package.json +2 -2
  229. package/renovate.json +6 -6
  230. package/src/app-root.ts +214 -169
  231. package/src/collection-browser.ts +122 -3
  232. package/src/models.ts +2 -0
  233. package/src/styles/item-image-styles.ts +13 -3
  234. package/src/tiles/collection-browser-loading-tile.ts +1 -1
  235. package/src/tiles/grid/account-tile.ts +4 -2
  236. package/src/tiles/grid/collection-tile.ts +106 -136
  237. package/src/tiles/grid/item-tile.ts +8 -2
  238. package/src/tiles/grid/styles/tile-grid-shared-styles.ts +6 -2
  239. package/src/tiles/grid/tile-stats.ts +1 -0
  240. package/src/tiles/image-block.ts +5 -2
  241. package/src/tiles/item-image.ts +4 -3
  242. package/src/tiles/tile-dispatcher.ts +17 -0
  243. package/src/utils/format-unit-size.ts +43 -0
  244. package/test/item-image.test.ts +4 -0
  245. package/test/tiles/grid/collection-tile.test.ts +85 -0
  246. package/test/tiles/grid/item-tile.test.ts +30 -4
  247. package/test/utils/format-unit-size.test.ts +21 -0
  248. package/tsconfig.json +21 -21
  249. package/web-dev-server.config.mjs +30 -30
  250. package/web-test-runner.config.mjs +41 -41
@@ -1,74 +1,74 @@
1
- import { __decorate } from "tslib";
2
- import { css, html, LitElement, nothing, } from 'lit';
3
- import { customElement, property } from 'lit/decorators.js';
4
- import { join } from 'lit/directives/join.js';
5
- let TextSnippetBlock = class TextSnippetBlock extends LitElement {
6
- constructor() {
7
- super(...arguments);
8
- this.snippets = [];
9
- this.viewSize = 'desktop';
10
- }
11
- render() {
12
- var _a;
13
- if (!((_a = this.snippets) === null || _a === void 0 ? void 0 : _a.length))
14
- return html `${nothing}`;
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement, nothing, } from 'lit';
3
+ import { customElement, property } from 'lit/decorators.js';
4
+ import { join } from 'lit/directives/join.js';
5
+ let TextSnippetBlock = class TextSnippetBlock extends LitElement {
6
+ constructor() {
7
+ super(...arguments);
8
+ this.snippets = [];
9
+ this.viewSize = 'desktop';
10
+ }
11
+ render() {
12
+ var _a;
13
+ if (!((_a = this.snippets) === null || _a === void 0 ? void 0 : _a.length))
14
+ return html `${nothing}`;
15
15
  return html `
16
16
  <div class="container">
17
17
  <div class="snippet-view ${this.viewSize}">
18
18
  ${this.ellipsisJoinedSnippets}
19
19
  </div>
20
20
  </div>
21
- `;
22
- }
23
- /**
24
- * An array of HTML templates derived from the snippets, with ellipses inserted
25
- * at the beginning, end, and between each pair of snippets.
26
- */
27
- get ellipsisJoinedSnippets() {
21
+ `;
22
+ }
23
+ /**
24
+ * An array of HTML templates derived from the snippets, with ellipses inserted
25
+ * at the beginning, end, and between each pair of snippets.
26
+ */
27
+ get ellipsisJoinedSnippets() {
28
28
  return html `
29
29
  &hellip; ${join(this.snippetTemplates, html ` &hellip; `)} &hellip;
30
- `;
31
- }
32
- /**
33
- * Returns an array of HTML span templates containing this item's snippets with all of
34
- * their `{{{triple-brace-delimited}}}` matches replaced by `<mark>HTML mark tags</mark>`.
35
- *
36
- * This approach safely avoids the use of `unsafeHTML` and leaves any existing HTML tags
37
- * in the snippets intact (as inert text), rather than stripping them away with DOMPurify.
38
- *
39
- * Note on `<em>` vs. `<mark>`:
40
- * The old search page snippets had search keywords demarcated with `<em>` tags.
41
- * The `<mark>` tag is semantically more accurate for this use case than `<em>`,
42
- * but screen-reader behavior may be different. `<em>` will likely be read in a
43
- * different tone, while `<mark>` is often read no differently than ordinary text
44
- * in many screen-readers (though there are ways to work around this if needed).
45
- */
46
- get snippetTemplates() {
47
- var _a;
48
- return (_a = this.snippets) === null || _a === void 0 ? void 0 : _a.map(s => {
49
- const matches = s.matchAll(/{{{(.+?)}}}/gs);
50
- const templates = [];
51
- // Convert each match into an HTML template that includes:
52
- // - Everything from the end of the previous match (or the beginning of the
53
- // string) up to the current match, as raw text.
54
- // - The current match (excluding the curly braces) wrapped in a `<mark>` tag.
55
- let index = 0;
56
- for (const match of matches) {
57
- if (match.index != null) {
30
+ `;
31
+ }
32
+ /**
33
+ * Returns an array of HTML span templates containing this item's snippets with all of
34
+ * their `{{{triple-brace-delimited}}}` matches replaced by `<mark>HTML mark tags</mark>`.
35
+ *
36
+ * This approach safely avoids the use of `unsafeHTML` and leaves any existing HTML tags
37
+ * in the snippets intact (as inert text), rather than stripping them away with DOMPurify.
38
+ *
39
+ * Note on `<em>` vs. `<mark>`:
40
+ * The old search page snippets had search keywords demarcated with `<em>` tags.
41
+ * The `<mark>` tag is semantically more accurate for this use case than `<em>`,
42
+ * but screen-reader behavior may be different. `<em>` will likely be read in a
43
+ * different tone, while `<mark>` is often read no differently than ordinary text
44
+ * in many screen-readers (though there are ways to work around this if needed).
45
+ */
46
+ get snippetTemplates() {
47
+ var _a;
48
+ return (_a = this.snippets) === null || _a === void 0 ? void 0 : _a.map(s => {
49
+ const matches = s.matchAll(/{{{(.+?)}}}/gs);
50
+ const templates = [];
51
+ // Convert each match into an HTML template that includes:
52
+ // - Everything from the end of the previous match (or the beginning of the
53
+ // string) up to the current match, as raw text.
54
+ // - The current match (excluding the curly braces) wrapped in a `<mark>` tag.
55
+ let index = 0;
56
+ for (const match of matches) {
57
+ if (match.index != null) {
58
58
  templates.push(html `
59
59
  ${s.slice(index, match.index)}
60
60
  <mark>${match[1]}</mark>
61
- `);
62
- index = match.index + match[0].length;
63
- }
64
- }
65
- // Include any text from the last match to the end
66
- templates.push(html `${s.slice(index)}`);
67
- // Squash everything into a single span template
68
- return html `<span>${templates}</span>`;
69
- });
70
- }
71
- static get styles() {
61
+ `);
62
+ index = match.index + match[0].length;
63
+ }
64
+ }
65
+ // Include any text from the last match to the end
66
+ templates.push(html `${s.slice(index)}`);
67
+ // Squash everything into a single span template
68
+ return html `<span>${templates}</span>`;
69
+ });
70
+ }
71
+ static get styles() {
72
72
  return css `
73
73
  .container {
74
74
  display: flex;
@@ -110,17 +110,17 @@ let TextSnippetBlock = class TextSnippetBlock extends LitElement {
110
110
  background-color: #0000ff33;
111
111
  color: inherit;
112
112
  }
113
- `;
114
- }
115
- };
116
- __decorate([
117
- property({ type: Array })
118
- ], TextSnippetBlock.prototype, "snippets", void 0);
119
- __decorate([
120
- property({ type: String })
121
- ], TextSnippetBlock.prototype, "viewSize", void 0);
122
- TextSnippetBlock = __decorate([
123
- customElement('text-snippet-block')
124
- ], TextSnippetBlock);
125
- export { TextSnippetBlock };
113
+ `;
114
+ }
115
+ };
116
+ __decorate([
117
+ property({ type: Array })
118
+ ], TextSnippetBlock.prototype, "snippets", void 0);
119
+ __decorate([
120
+ property({ type: String })
121
+ ], TextSnippetBlock.prototype, "viewSize", void 0);
122
+ TextSnippetBlock = __decorate([
123
+ customElement('text-snippet-block')
124
+ ], TextSnippetBlock);
125
+ export { TextSnippetBlock };
126
126
  //# sourceMappingURL=text-snippet-block.js.map
@@ -1,36 +1,36 @@
1
- import { LitElement, PropertyValues } from 'lit';
2
- import type { SharedResizeObserverInterface, SharedResizeObserverResizeHandlerInterface } from '@internetarchive/shared-resize-observer';
3
- import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
4
- import type { SortParam } from '@internetarchive/search-service';
5
- import type { TileDisplayMode, TileModel } from '../models';
6
- import './grid/collection-tile';
7
- import './grid/item-tile';
8
- import './grid/account-tile';
9
- import './list/tile-list';
10
- import './list/tile-list-compact';
11
- import './list/tile-list-compact-header';
12
- export declare class TileDispatcher extends LitElement implements SharedResizeObserverResizeHandlerInterface {
13
- tileDisplayMode?: TileDisplayMode;
14
- model?: TileModel;
15
- baseNavigationUrl?: string;
16
- currentWidth?: number;
17
- currentHeight?: number;
18
- resizeObserver?: SharedResizeObserverInterface;
19
- collectionNameCache?: CollectionNameCacheInterface;
20
- sortParam: SortParam | null;
21
- private container;
22
- mobileBreakpoint?: number;
23
- baseImageUrl?: string;
24
- loggedIn: boolean;
25
- render(): import("lit-html").TemplateResult<1>;
26
- private get headerTemplate();
27
- private get tileTemplate();
28
- private get linkTileTemplate();
29
- handleResize(entry: ResizeObserverEntry): void;
30
- disconnectedCallback(): void;
31
- private stopResizeObservation;
32
- private startResizeObservation;
33
- updated(props: PropertyValues): void;
34
- private get tile();
35
- static get styles(): import("lit").CSSResult;
36
- }
1
+ import { LitElement, PropertyValues } from 'lit';
2
+ import type { SharedResizeObserverInterface, SharedResizeObserverResizeHandlerInterface } from '@internetarchive/shared-resize-observer';
3
+ import type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';
4
+ import type { SortParam } from '@internetarchive/search-service';
5
+ import type { TileDisplayMode, TileModel } from '../models';
6
+ import './grid/collection-tile';
7
+ import './grid/item-tile';
8
+ import './grid/account-tile';
9
+ import './list/tile-list';
10
+ import './list/tile-list-compact';
11
+ import './list/tile-list-compact-header';
12
+ export declare class TileDispatcher extends LitElement implements SharedResizeObserverResizeHandlerInterface {
13
+ tileDisplayMode?: TileDisplayMode;
14
+ model?: TileModel;
15
+ baseNavigationUrl?: string;
16
+ currentWidth?: number;
17
+ currentHeight?: number;
18
+ resizeObserver?: SharedResizeObserverInterface;
19
+ collectionNameCache?: CollectionNameCacheInterface;
20
+ sortParam: SortParam | null;
21
+ private container;
22
+ mobileBreakpoint?: number;
23
+ baseImageUrl?: string;
24
+ loggedIn: boolean;
25
+ render(): import("lit-html").TemplateResult<1>;
26
+ private get headerTemplate();
27
+ private get tileTemplate();
28
+ private get linkTileTemplate();
29
+ handleResize(entry: ResizeObserverEntry): void;
30
+ disconnectedCallback(): void;
31
+ private stopResizeObservation;
32
+ private startResizeObservation;
33
+ updated(props: PropertyValues): void;
34
+ private get tile();
35
+ static get styles(): import("lit").CSSResult;
36
+ }
@@ -1,30 +1,30 @@
1
- import { __decorate } from "tslib";
2
- import { css, html, LitElement, nothing } from 'lit';
3
- import { customElement, property, query } from 'lit/decorators.js';
4
- import { ifDefined } from 'lit/directives/if-defined.js';
5
- import './grid/collection-tile';
6
- import './grid/item-tile';
7
- import './grid/account-tile';
8
- import './list/tile-list';
9
- import './list/tile-list-compact';
10
- import './list/tile-list-compact-header';
11
- let TileDispatcher = class TileDispatcher extends LitElement {
12
- constructor() {
13
- super(...arguments);
14
- this.sortParam = null;
15
- this.loggedIn = false;
16
- }
17
- render() {
1
+ import { __decorate } from "tslib";
2
+ import { css, html, LitElement, nothing } from 'lit';
3
+ import { customElement, property, query } from 'lit/decorators.js';
4
+ import { ifDefined } from 'lit/directives/if-defined.js';
5
+ import './grid/collection-tile';
6
+ import './grid/item-tile';
7
+ import './grid/account-tile';
8
+ import './list/tile-list';
9
+ import './list/tile-list-compact';
10
+ import './list/tile-list-compact-header';
11
+ let TileDispatcher = class TileDispatcher extends LitElement {
12
+ constructor() {
13
+ super(...arguments);
14
+ this.sortParam = null;
15
+ this.loggedIn = false;
16
+ }
17
+ render() {
18
18
  return html `
19
19
  <div id="container">
20
- ${this.tileDisplayMode === 'list-header'
21
- ? this.headerTemplate
20
+ ${this.tileDisplayMode === 'list-header'
21
+ ? this.headerTemplate
22
22
  : this.tileTemplate}
23
23
  </div>
24
- `;
25
- }
26
- get headerTemplate() {
27
- const { currentWidth, sortParam, mobileBreakpoint } = this;
24
+ `;
25
+ }
26
+ get headerTemplate() {
27
+ const { currentWidth, sortParam, mobileBreakpoint } = this;
28
28
  return html `
29
29
  <tile-list-compact-header
30
30
  class="header"
@@ -33,17 +33,17 @@ let TileDispatcher = class TileDispatcher extends LitElement {
33
33
  .mobileBreakpoint=${mobileBreakpoint}
34
34
  >
35
35
  </tile-list-compact-header>
36
- `;
37
- }
38
- get tileTemplate() {
36
+ `;
37
+ }
38
+ get tileTemplate() {
39
39
  return html `
40
- ${this.tileDisplayMode === 'list-detail'
41
- ? this.tile
40
+ ${this.tileDisplayMode === 'list-detail'
41
+ ? this.tile
42
42
  : this.linkTileTemplate}
43
- `;
44
- }
45
- get linkTileTemplate() {
46
- var _a, _b;
43
+ `;
44
+ }
45
+ get linkTileTemplate() {
46
+ var _a, _b;
47
47
  return html `
48
48
  <a
49
49
  href="${this.baseNavigationUrl}/details/${(_a = this.model) === null || _a === void 0 ? void 0 : _a.identifier}"
@@ -52,59 +52,60 @@ let TileDispatcher = class TileDispatcher extends LitElement {
52
52
  >
53
53
  ${this.tile}
54
54
  </a>
55
- `;
56
- }
57
- handleResize(entry) {
58
- this.currentWidth = entry.contentRect.width;
59
- this.currentHeight = entry.contentRect.height;
60
- }
61
- disconnectedCallback() {
62
- this.stopResizeObservation(this.resizeObserver);
63
- }
64
- stopResizeObservation(observer) {
65
- observer === null || observer === void 0 ? void 0 : observer.removeObserver({
66
- handler: this,
67
- target: this.container,
68
- });
69
- }
70
- startResizeObservation() {
71
- var _a;
72
- this.stopResizeObservation(this.resizeObserver);
73
- (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.addObserver({
74
- handler: this,
75
- target: this.container,
76
- });
77
- }
78
- updated(props) {
79
- if (props.has('resizeObserver')) {
80
- const previousObserver = props.get('resizeObserver');
81
- this.stopResizeObservation(previousObserver);
82
- this.startResizeObservation();
83
- }
84
- }
85
- get tile() {
86
- const { model, baseNavigationUrl, currentWidth, currentHeight, sortParam, mobileBreakpoint, } = this;
87
- if (!model)
88
- return nothing;
89
- switch (this.tileDisplayMode) {
90
- case 'grid':
91
- switch (model.mediatype) {
92
- case 'collection':
55
+ `;
56
+ }
57
+ handleResize(entry) {
58
+ this.currentWidth = entry.contentRect.width;
59
+ this.currentHeight = entry.contentRect.height;
60
+ }
61
+ disconnectedCallback() {
62
+ this.stopResizeObservation(this.resizeObserver);
63
+ }
64
+ stopResizeObservation(observer) {
65
+ observer === null || observer === void 0 ? void 0 : observer.removeObserver({
66
+ handler: this,
67
+ target: this.container,
68
+ });
69
+ }
70
+ startResizeObservation() {
71
+ var _a;
72
+ this.stopResizeObservation(this.resizeObserver);
73
+ (_a = this.resizeObserver) === null || _a === void 0 ? void 0 : _a.addObserver({
74
+ handler: this,
75
+ target: this.container,
76
+ });
77
+ }
78
+ updated(props) {
79
+ if (props.has('resizeObserver')) {
80
+ const previousObserver = props.get('resizeObserver');
81
+ this.stopResizeObservation(previousObserver);
82
+ this.startResizeObservation();
83
+ }
84
+ }
85
+ get tile() {
86
+ const { model, baseNavigationUrl, currentWidth, currentHeight, sortParam, mobileBreakpoint, } = this;
87
+ if (!model)
88
+ return nothing;
89
+ switch (this.tileDisplayMode) {
90
+ case 'grid':
91
+ switch (model.mediatype) {
92
+ case 'collection':
93
93
  return html `<collection-tile
94
94
  .model=${model}
95
+ .baseImageUrl=${this.baseImageUrl}
95
96
  .currentWidth=${currentWidth}
96
97
  .currentHeight=${currentHeight}
97
98
  >
98
- </collection-tile>`;
99
- case 'account':
99
+ </collection-tile>`;
100
+ case 'account':
100
101
  return html `<account-tile
101
102
  .model=${model}
102
103
  .baseImageUrl=${this.baseImageUrl}
103
104
  .currentWidth=${currentWidth}
104
105
  .currentHeight=${currentHeight}
105
106
  >
106
- </account-tile>`;
107
- default:
107
+ </account-tile>`;
108
+ default:
108
109
  return html `<item-tile
109
110
  .model=${model}
110
111
  .currentWidth=${this.currentWidth}
@@ -114,9 +115,9 @@ let TileDispatcher = class TileDispatcher extends LitElement {
114
115
  .sortParam=${sortParam}
115
116
  .loggedIn=${this.loggedIn}
116
117
  >
117
- </item-tile>`;
118
- }
119
- case 'list-compact':
118
+ </item-tile>`;
119
+ }
120
+ case 'list-compact':
120
121
  return html `<tile-list-compact
121
122
  .model=${model}
122
123
  .currentWidth=${currentWidth}
@@ -127,8 +128,8 @@ let TileDispatcher = class TileDispatcher extends LitElement {
127
128
  .baseImageUrl=${this.baseImageUrl}
128
129
  .loggedIn=${this.loggedIn}
129
130
  >
130
- </tile-list-compact>`;
131
- case 'list-detail':
131
+ </tile-list-compact>`;
132
+ case 'list-detail':
132
133
  return html `<tile-list
133
134
  .model=${model}
134
135
  .collectionNameCache=${this.collectionNameCache}
@@ -140,18 +141,34 @@ let TileDispatcher = class TileDispatcher extends LitElement {
140
141
  .baseImageUrl=${this.baseImageUrl}
141
142
  .loggedIn=${this.loggedIn}
142
143
  >
143
- </tile-list>`;
144
- default:
145
- return nothing;
146
- }
147
- }
148
- static get styles() {
144
+ </tile-list>`;
145
+ default:
146
+ return nothing;
147
+ }
148
+ }
149
+ static get styles() {
149
150
  return css `
150
151
  :host {
151
152
  display: block;
152
153
  height: 100%;
153
154
  }
154
155
 
156
+ collection-tile {
157
+ --tileBorderColor: #555555;
158
+ --tileBackgroundColor: #666666;
159
+ --imageBlockBackgroundColor: #666666;
160
+ }
161
+
162
+ account-tile {
163
+ --tileBorderColor: #dddddd;
164
+ --imageBlockBackgroundColor: #fcf5e6;
165
+ }
166
+
167
+ item-tile {
168
+ --tileBorderColor: #dddddd;
169
+ --imageBlockBackgroundColor: #f1f1f4;
170
+ }
171
+
155
172
  #container {
156
173
  height: 100%;
157
174
  }
@@ -171,47 +188,47 @@ let TileDispatcher = class TileDispatcher extends LitElement {
171
188
  display: block;
172
189
  height: 100%;
173
190
  }
174
- `;
175
- }
176
- };
177
- __decorate([
178
- property({ type: String })
179
- ], TileDispatcher.prototype, "tileDisplayMode", void 0);
180
- __decorate([
181
- property({ type: Object })
182
- ], TileDispatcher.prototype, "model", void 0);
183
- __decorate([
184
- property({ type: String })
185
- ], TileDispatcher.prototype, "baseNavigationUrl", void 0);
186
- __decorate([
187
- property({ type: Number })
188
- ], TileDispatcher.prototype, "currentWidth", void 0);
189
- __decorate([
190
- property({ type: Number })
191
- ], TileDispatcher.prototype, "currentHeight", void 0);
192
- __decorate([
193
- property({ type: Object })
194
- ], TileDispatcher.prototype, "resizeObserver", void 0);
195
- __decorate([
196
- property({ type: Object })
197
- ], TileDispatcher.prototype, "collectionNameCache", void 0);
198
- __decorate([
199
- property({ type: Object })
200
- ], TileDispatcher.prototype, "sortParam", void 0);
201
- __decorate([
202
- query('#container')
203
- ], TileDispatcher.prototype, "container", void 0);
204
- __decorate([
205
- property({ type: Number })
206
- ], TileDispatcher.prototype, "mobileBreakpoint", void 0);
207
- __decorate([
208
- property({ type: String })
209
- ], TileDispatcher.prototype, "baseImageUrl", void 0);
210
- __decorate([
211
- property({ type: Boolean })
212
- ], TileDispatcher.prototype, "loggedIn", void 0);
213
- TileDispatcher = __decorate([
214
- customElement('tile-dispatcher')
215
- ], TileDispatcher);
216
- export { TileDispatcher };
191
+ `;
192
+ }
193
+ };
194
+ __decorate([
195
+ property({ type: String })
196
+ ], TileDispatcher.prototype, "tileDisplayMode", void 0);
197
+ __decorate([
198
+ property({ type: Object })
199
+ ], TileDispatcher.prototype, "model", void 0);
200
+ __decorate([
201
+ property({ type: String })
202
+ ], TileDispatcher.prototype, "baseNavigationUrl", void 0);
203
+ __decorate([
204
+ property({ type: Number })
205
+ ], TileDispatcher.prototype, "currentWidth", void 0);
206
+ __decorate([
207
+ property({ type: Number })
208
+ ], TileDispatcher.prototype, "currentHeight", void 0);
209
+ __decorate([
210
+ property({ type: Object })
211
+ ], TileDispatcher.prototype, "resizeObserver", void 0);
212
+ __decorate([
213
+ property({ type: Object })
214
+ ], TileDispatcher.prototype, "collectionNameCache", void 0);
215
+ __decorate([
216
+ property({ type: Object })
217
+ ], TileDispatcher.prototype, "sortParam", void 0);
218
+ __decorate([
219
+ query('#container')
220
+ ], TileDispatcher.prototype, "container", void 0);
221
+ __decorate([
222
+ property({ type: Number })
223
+ ], TileDispatcher.prototype, "mobileBreakpoint", void 0);
224
+ __decorate([
225
+ property({ type: String })
226
+ ], TileDispatcher.prototype, "baseImageUrl", void 0);
227
+ __decorate([
228
+ property({ type: Boolean })
229
+ ], TileDispatcher.prototype, "loggedIn", void 0);
230
+ TileDispatcher = __decorate([
231
+ customElement('tile-dispatcher')
232
+ ], TileDispatcher);
233
+ export { TileDispatcher };
217
234
  //# sourceMappingURL=tile-dispatcher.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAQzD,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,0BAA0B,CAAC;AAClC,OAAO,iCAAiC,CAAC;AAGzC,IAAa,cAAc,GAA3B,MAAa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AC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAoC;AAE1C;IAApB,KAAK,CAAC,YAAY,CAAC;iDAAoC;AAE5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA2B;AAE1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAuB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAkB;AA3BnC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAiN1B;SAjNY,cAAc","sourcesContent":["import { css, html, LitElement, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { SortParam } from '@internetarchive/search-service';\nimport type { TileDisplayMode, TileModel } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface\n{\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @query('#container') private container!: HTMLDivElement;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) loggedIn = false;\n\n render() {\n return html`\n <div id=\"container\">\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n </div>\n `;\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=\"${this.baseNavigationUrl}/details/${this.model?.identifier}\"\n title=${ifDefined(this.model?.title)}\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n )}\n >\n ${this.tile}\n </a>\n `;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n private get tile() {\n const {\n model,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .loggedIn=${this.loggedIn}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n #container {\n height: 100%;\n }\n\n #delete-button {\n float: right;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B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;oDAAuB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qDAAwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAgD;AAG3E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2DACwB;AAEvB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAoC;AAE1C;IAApB,KAAK,CAAC,YAAY,CAAC;iDAAoC;AAE5B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA2B;AAE1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAuB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAAkB;AA3BnC,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CAkO1B;SAlOY,cAAc","sourcesContent":["import { css, html, LitElement, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { CollectionNameCacheInterface } from '@internetarchive/collection-name-cache';\nimport type { SortParam } from '@internetarchive/search-service';\nimport type { TileDisplayMode, TileModel } from '../models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface\n{\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Object }) model?: TileModel;\n\n @property({ type: String }) baseNavigationUrl?: string;\n\n @property({ type: Number }) currentWidth?: number;\n\n @property({ type: Number }) currentHeight?: number;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionNameCache?: CollectionNameCacheInterface;\n\n @property({ type: Object }) sortParam: SortParam | null = null;\n\n @query('#container') private container!: HTMLDivElement;\n\n @property({ type: Number }) mobileBreakpoint?: number;\n\n @property({ type: String }) baseImageUrl?: string;\n\n @property({ type: Boolean }) loggedIn = false;\n\n render() {\n return html`\n <div id=\"container\">\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n </div>\n `;\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, mobileBreakpoint } = this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=\"${this.baseNavigationUrl}/details/${this.model?.identifier}\"\n title=${ifDefined(this.model?.title)}\n @click=${() =>\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model })\n )}\n >\n ${this.tile}\n </a>\n `;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver'\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n private get tile() {\n const {\n model,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n mobileBreakpoint,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n >\n </account-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .collectionNameCache=${this.collectionNameCache}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .loggedIn=${this.loggedIn}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionNameCache=${this.collectionNameCache}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n #container {\n height: 100%;\n }\n\n #delete-button {\n float: right;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n `;\n }\n}\n"]}