@internetarchive/collection-browser 3.5.3-alpha-webdev8156.0 → 4.0.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 (34) hide show
  1. package/dist/src/app-root.d.ts +1 -0
  2. package/dist/src/app-root.js +21 -0
  3. package/dist/src/app-root.js.map +1 -1
  4. package/dist/src/collection-browser.js +772 -772
  5. package/dist/src/collection-browser.js.map +1 -1
  6. package/dist/src/collection-facets/more-facets-content.d.ts +0 -1
  7. package/dist/src/collection-facets/more-facets-content.js +127 -126
  8. package/dist/src/collection-facets/more-facets-content.js.map +1 -1
  9. package/dist/src/data-source/collection-browser-query-state.d.ts +1 -2
  10. package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
  11. package/dist/src/models.d.ts +4 -0
  12. package/dist/src/models.js +8 -0
  13. package/dist/src/models.js.map +1 -1
  14. package/dist/src/tiles/grid/collection-tile.d.ts +2 -0
  15. package/dist/src/tiles/grid/collection-tile.js +22 -1
  16. package/dist/src/tiles/grid/collection-tile.js.map +1 -1
  17. package/dist/src/tiles/grid/item-tile.d.ts +2 -2
  18. package/dist/src/tiles/grid/item-tile.js +14 -8
  19. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  20. package/dist/src/tiles/models.d.ts +8 -1
  21. package/dist/src/tiles/models.js.map +1 -1
  22. package/dist/src/tiles/tile-dispatcher.d.ts +3 -3
  23. package/dist/src/tiles/tile-dispatcher.js +5 -4
  24. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  25. package/package.json +1 -1
  26. package/src/app-root.ts +26 -0
  27. package/src/collection-browser.ts +3075 -3077
  28. package/src/collection-facets/more-facets-content.ts +644 -642
  29. package/src/data-source/collection-browser-query-state.ts +59 -60
  30. package/src/models.ts +873 -864
  31. package/src/tiles/grid/collection-tile.ts +22 -1
  32. package/src/tiles/grid/item-tile.ts +14 -8
  33. package/src/tiles/models.ts +8 -1
  34. package/src/tiles/tile-dispatcher.ts +5 -4
@@ -1,10 +1,12 @@
1
1
  import { css, CSSResultGroup, html, nothing, TemplateResult } from 'lit';
2
2
  import { customElement, property } from 'lit/decorators.js';
3
+ import { classMap } from 'lit/directives/class-map.js';
3
4
  import { msg } from '@lit/localize';
4
5
  import { collectionIcon } from '../../assets/img/icons/mediatype/collection';
5
6
  import { formatUnitSize } from '../../utils/format-unit-size';
6
7
  import { baseTileStyles } from './styles/tile-grid-shared-styles';
7
8
  import { BaseTileComponent } from '../base-tile-component';
9
+ import { LayoutType } from '../models';
8
10
  import '../image-block';
9
11
 
10
12
  @customElement('collection-tile')
@@ -27,9 +29,16 @@ export class CollectionTile extends BaseTileComponent {
27
29
 
28
30
  @property({ type: Boolean }) showInfoButton = false;
29
31
 
32
+ @property({ type: String }) layoutType: LayoutType = 'default';
33
+
30
34
  render() {
35
+ const containerClasses = classMap({
36
+ container: true,
37
+ minimal: this.layoutType === 'minimal',
38
+ });
39
+
31
40
  return html`
32
- <div class="container">
41
+ <div class=${containerClasses}>
33
42
  ${this.infoButtonTemplate}
34
43
  <div class="tile-details">
35
44
  <div class="item-info">
@@ -157,6 +166,18 @@ export class CollectionTile extends BaseTileComponent {
157
166
  flex-direction: column;
158
167
  margin-left: 10px;
159
168
  }
169
+
170
+ .minimal #item-stats {
171
+ display: none;
172
+ }
173
+
174
+ .minimal .truncated {
175
+ -webkit-line-clamp: initial;
176
+ }
177
+
178
+ .minimal .item-info {
179
+ padding-bottom: 5px;
180
+ }
160
181
  `,
161
182
  ];
162
183
  }
@@ -10,7 +10,7 @@ import type { DateFormat } from '../../utils/format-date';
10
10
  import { isFirstMillisecondOfUTCYear } from '../../utils/local-date-from-utc';
11
11
  import { BaseTileComponent } from '../base-tile-component';
12
12
  import { baseTileStyles } from './styles/tile-grid-shared-styles';
13
- import { SimpleLayoutType } from '../models';
13
+ import { LayoutType } from '../models';
14
14
 
15
15
  import '../image-block';
16
16
  import '../review-block';
@@ -42,15 +42,16 @@ export class ItemTile extends BaseTileComponent {
42
42
 
43
43
  @property({ type: Boolean }) showTvClips = false;
44
44
 
45
- @property({ type: String }) simpleLayoutType: SimpleLayoutType = 'none';
45
+ @property({ type: String }) layoutType: LayoutType = 'default';
46
46
 
47
47
  render() {
48
48
  const itemTitle = this.model?.title;
49
49
  const containerClasses = classMap({
50
50
  container: true,
51
- simple: this.simpleLayoutType !== 'none',
52
- 'stats-only': this.simpleLayoutType === 'stats-only',
53
- 'snippets-only': this.simpleLayoutType === 'snippets-only',
51
+ simple: this.layoutType !== 'default',
52
+ 'stats-only': this.layoutType === 'stats-only',
53
+ 'snippets-only': this.layoutType === 'snippets-only',
54
+ minimal: this.layoutType === 'minimal',
54
55
  });
55
56
 
56
57
  return html`
@@ -175,8 +176,10 @@ export class ItemTile extends BaseTileComponent {
175
176
  }
176
177
 
177
178
  private get textSnippetsTemplate(): TemplateResult | typeof nothing {
178
- if (!this.hasSnippets || this.simpleLayoutType === 'stats-only')
179
+ if (!this.hasSnippets) return nothing;
180
+ if (['stats-only', 'minimal'].includes(this.layoutType)) {
179
181
  return nothing;
182
+ }
180
183
 
181
184
  return html`
182
185
  <text-snippet-block viewsize="grid" .snippets=${this.model?.snippets}>
@@ -221,7 +224,9 @@ export class ItemTile extends BaseTileComponent {
221
224
  * Template for the stats row along the bottom of the tile.
222
225
  */
223
226
  private get tileStatsTemplate(): TemplateResult | typeof nothing {
224
- if (this.simpleLayoutType === 'snippets-only') return nothing;
227
+ if (['snippets-only', 'minimal'].includes(this.layoutType)) {
228
+ return nothing;
229
+ }
225
230
 
226
231
  const effectiveSort = this.sortParam ?? this.defaultSortParam;
227
232
  const [viewCount, viewLabel] =
@@ -301,7 +306,8 @@ export class ItemTile extends BaseTileComponent {
301
306
  -webkit-line-clamp: 1;
302
307
  }
303
308
 
304
- .simple.snippets-only .item-info {
309
+ .simple.snippets-only .item-info,
310
+ .simple.minimal .item-info {
305
311
  padding-bottom: 5px;
306
312
  }
307
313
 
@@ -1 +1,8 @@
1
- export type SimpleLayoutType = 'none' | 'stats-only' | 'snippets-only';
1
+ /**
2
+ * What type of simplified tile layout to use.
3
+ * - `default`: Do not apply any layout simplifications.
4
+ * - `stats-only`: Only show the tile stats row, but not text snippets.
5
+ * - `snippets-only`: Only show the text snippets row (if snippets exist), but not tile stats.
6
+ * - `minimal`: Show neither tile stats nor the text snippets.
7
+ */
8
+ export type LayoutType = 'default' | 'stats-only' | 'snippets-only' | 'minimal';
@@ -18,7 +18,7 @@ import './list/tile-list-compact';
18
18
  import './list/tile-list-compact-header';
19
19
  import type { TileHoverPane } from './hover/tile-hover-pane';
20
20
  import { BaseTileComponent } from './base-tile-component';
21
- import { SimpleLayoutType } from './models';
21
+ import { LayoutType } from './models';
22
22
  import {
23
23
  HoverPaneController,
24
24
  HoverPaneControllerInterface,
@@ -62,8 +62,8 @@ export class TileDispatcher
62
62
 
63
63
  @property({ type: Boolean }) showTvClips = false;
64
64
 
65
- /** What type of simple layout to use in grid mode, if any */
66
- @property({ type: String }) simpleLayoutType: SimpleLayoutType = 'none';
65
+ /** What type of simplified layout to use in grid mode, if any */
66
+ @property({ type: String }) layoutType: LayoutType = 'default';
67
67
 
68
68
  /** Whether this tile should include a hover pane at all (for applicable tile modes) */
69
69
  @property({ type: Boolean }) enableHoverPane = false;
@@ -325,6 +325,7 @@ export class TileDispatcher
325
325
  .creatorFilter=${creatorFilter}
326
326
  .suppressBlurring=${this.suppressBlurring}
327
327
  .isManageView=${this.isManageView}
328
+ .layoutType=${this.layoutType}
328
329
  ?showInfoButton=${!this.isHoverEnabled}
329
330
  @infoButtonPressed=${this.tileInfoButtonPressed}
330
331
  >
@@ -370,7 +371,7 @@ export class TileDispatcher
370
371
  .loggedIn=${this.loggedIn}
371
372
  .suppressBlurring=${this.suppressBlurring}
372
373
  .isManageView=${this.isManageView}
373
- .simpleLayoutType=${this.simpleLayoutType}
374
+ .layoutType=${this.layoutType}
374
375
  ?showTvClips=${this.showTvClips}
375
376
  ?showInfoButton=${!this.isHoverEnabled}
376
377
  ?useLocalTime=${this.useLocalTime}