@internetarchive/collection-browser 4.1.3-alpha-webdev8257.1 → 4.1.4

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.
@@ -2,7 +2,6 @@ var TileDispatcher_1;
2
2
  import { __decorate } from "tslib";
3
3
  import { css, html, nothing } from 'lit';
4
4
  import { customElement, property, query } from 'lit/decorators.js';
5
- import { classMap } from 'lit/directives/class-map.js';
6
5
  import { ifDefined } from 'lit/directives/if-defined.js';
7
6
  import { msg } from '@lit/localize';
8
7
  import './grid/collection-tile';
@@ -42,15 +41,6 @@ let TileDispatcher = class TileDispatcher extends BaseTileComponent {
42
41
  /** Whether this tile should include a hover pane at all (for applicable tile modes) */
43
42
  this.enableHoverPane = false;
44
43
  this.manageCheckTitle = msg('Remove this item from the list');
45
- /** Action buttons to display at the bottom of the tile (grid mode only) */
46
- this.tileActions = [];
47
- /**
48
- * When the mouse enters the tile actions area, dispatch a synthetic mouseleave
49
- * on the host to cancel the hover pane's show timer and hide any visible pane.
50
- */
51
- this.handleTileActionsMouseEnter = () => {
52
- this.dispatchEvent(new MouseEvent('mouseleave', { bubbles: false }));
53
- };
54
44
  }
55
45
  static { TileDispatcher_1 = this; }
56
46
  acquireFocus() {
@@ -68,20 +58,14 @@ let TileDispatcher = class TileDispatcher extends BaseTileComponent {
68
58
  }; }
69
59
  render() {
70
60
  const isGridMode = this.tileDisplayMode === 'grid';
71
- const hasTileActions = isGridMode && this.showTileActions;
72
61
  const hoverPaneTemplate = this.hoverPaneController?.getTemplate() ?? nothing;
73
- const containerClasses = classMap({
74
- hoverable: isGridMode,
75
- 'has-tile-actions': hasTileActions,
76
- });
77
- return html `
78
- <div id="container" class=${containerClasses}>
62
+ return html `
63
+ <div id="container" class=${isGridMode ? 'hoverable' : ''}>
79
64
  ${this.tileDisplayMode === 'list-header'
80
65
  ? this.headerTemplate
81
- : this.tileTemplate}
82
- ${this.tileActionsTemplate} ${this.manageCheckTemplate}
83
- ${hoverPaneTemplate}
84
- </div>
66
+ : this.tileTemplate}
67
+ ${this.manageCheckTemplate} ${hoverPaneTemplate}
68
+ </div>
85
69
  `;
86
70
  }
87
71
  firstUpdated() {
@@ -94,42 +78,42 @@ let TileDispatcher = class TileDispatcher extends BaseTileComponent {
94
78
  }
95
79
  get headerTemplate() {
96
80
  const { currentWidth, sortParam, defaultSortParam, mobileBreakpoint } = this;
97
- return html `
98
- <tile-list-compact-header
99
- class="header"
100
- .currentWidth=${currentWidth}
101
- .sortParam=${sortParam ?? defaultSortParam}
102
- .mobileBreakpoint=${mobileBreakpoint}
103
- >
104
- </tile-list-compact-header>
81
+ return html `
82
+ <tile-list-compact-header
83
+ class="header"
84
+ .currentWidth=${currentWidth}
85
+ .sortParam=${sortParam ?? defaultSortParam}
86
+ .mobileBreakpoint=${mobileBreakpoint}
87
+ >
88
+ </tile-list-compact-header>
105
89
  `;
106
90
  }
107
91
  get tileTemplate() {
108
- return html `
92
+ return html `
109
93
  ${this.tileDisplayMode === 'list-detail'
110
94
  ? this.tile
111
- : this.linkTileTemplate}
95
+ : this.linkTileTemplate}
112
96
  `;
113
97
  }
114
98
  get linkTileTemplate() {
115
- return html `
116
- <a
117
- href=${this.linkTileHref}
118
- aria-label=${this.model?.title ?? 'Untitled item'}
119
- aria-describedby="link-aria-description"
120
- aria-haspopup=${this.shouldPrepareHoverPane ? 'dialog' : 'false'}
99
+ return html `
100
+ <a
101
+ href=${this.linkTileHref}
102
+ aria-label=${this.model?.title ?? 'Untitled item'}
103
+ aria-describedby="link-aria-description"
104
+ aria-haspopup=${this.shouldPrepareHoverPane ? 'dialog' : 'false'}
121
105
  title=${this.shouldPrepareHoverPane
122
106
  ? nothing // Don't show title tooltips when we have the tile info popups
123
- : ifDefined(this.model?.title)}
124
- @click=${this.handleLinkClicked}
125
- @contextmenu=${this.handleLinkContextMenu}
126
- class="tile-link"
127
- >
128
- ${this.tile}
129
- </a>
130
- <div id="link-aria-description" class="sr-only">
131
- ${msg('Press Down Arrow to preview item details')}
132
- </div>
107
+ : ifDefined(this.model?.title)}
108
+ @click=${this.handleLinkClicked}
109
+ @contextmenu=${this.handleLinkContextMenu}
110
+ class="tile-link"
111
+ >
112
+ ${this.tile}
113
+ </a>
114
+ <div id="link-aria-description" class="sr-only">
115
+ ${msg('Press Down Arrow to preview item details')}
116
+ </div>
133
117
  `;
134
118
  }
135
119
  get linkTileHref() {
@@ -145,15 +129,15 @@ let TileDispatcher = class TileDispatcher extends BaseTileComponent {
145
129
  get manageCheckTemplate() {
146
130
  if (!this.isManageView || this.tileDisplayMode !== 'grid')
147
131
  return nothing;
148
- return html `
149
- <div class="manage-check">
150
- <input
151
- type="checkbox"
152
- title=${this.manageCheckTitle}
153
- ?checked=${this.model?.checked}
154
- @change=${this.handleLinkClicked}
155
- />
156
- </div>
132
+ return html `
133
+ <div class="manage-check">
134
+ <input
135
+ type="checkbox"
136
+ title=${this.manageCheckTitle}
137
+ ?checked=${this.model?.checked}
138
+ @change=${this.handleLinkClicked}
139
+ />
140
+ </div>
157
141
  `;
158
142
  }
159
143
  /**
@@ -242,43 +226,6 @@ let TileDispatcher = class TileDispatcher extends BaseTileComponent {
242
226
  enableTouchBackdrop: true,
243
227
  });
244
228
  }
245
- /** Whether tile action buttons should be rendered */
246
- get showTileActions() {
247
- return (this.tileActions.length > 0 &&
248
- !this.isManageView &&
249
- this.tileDisplayMode === 'grid');
250
- }
251
- get tileActionsTemplate() {
252
- if (!this.showTileActions)
253
- return nothing;
254
- return html `
255
- <div
256
- class="tile-actions"
257
- @mouseenter=${this.handleTileActionsMouseEnter}
258
- @mousemove=${(e) => e.stopPropagation()}
259
- >
260
- ${this.tileActions.map(action => html `
261
- <button
262
- class="tile-action-btn"
263
- @click=${(e) => this.handleTileActionClick(e, action)}
264
- >
265
- ${action.label}
266
- </button>
267
- `)}
268
- </div>
269
- `;
270
- }
271
- handleTileActionClick(e, action) {
272
- e.stopPropagation();
273
- // Pre-set the hover pane controller's clicking flag so that focus
274
- // restoration after a consumer-opened modal won't trigger the hover pane.
275
- this.dispatchEvent(new PointerEvent('pointerdown'));
276
- this.dispatchEvent(new CustomEvent('tileActionClicked', {
277
- detail: { actionId: action.id, model: this.model },
278
- bubbles: true,
279
- composed: true,
280
- }));
281
- }
282
229
  get tile() {
283
230
  const { model, collectionPagePath, baseNavigationUrl, currentWidth, currentHeight, sortParam, creatorFilter, mobileBreakpoint, defaultSortParam, } = this;
284
231
  if (!model)
@@ -287,103 +234,103 @@ let TileDispatcher = class TileDispatcher extends BaseTileComponent {
287
234
  case 'grid':
288
235
  switch (model.mediatype) {
289
236
  case 'collection':
290
- return html `<collection-tile
291
- .model=${model}
292
- .collectionPagePath=${collectionPagePath}
293
- .baseImageUrl=${this.baseImageUrl}
294
- .currentWidth=${currentWidth}
295
- .currentHeight=${currentHeight}
296
- .creatorFilter=${creatorFilter}
297
- .suppressBlurring=${this.suppressBlurring}
298
- .isManageView=${this.isManageView}
299
- .layoutType=${this.layoutType}
300
- ?showInfoButton=${this.shouldShowInfoButton}
301
- @infoButtonPressed=${this.tileInfoButtonPressed}
302
- >
237
+ return html `<collection-tile
238
+ .model=${model}
239
+ .collectionPagePath=${collectionPagePath}
240
+ .baseImageUrl=${this.baseImageUrl}
241
+ .currentWidth=${currentWidth}
242
+ .currentHeight=${currentHeight}
243
+ .creatorFilter=${creatorFilter}
244
+ .suppressBlurring=${this.suppressBlurring}
245
+ .isManageView=${this.isManageView}
246
+ .layoutType=${this.layoutType}
247
+ ?showInfoButton=${this.shouldShowInfoButton}
248
+ @infoButtonPressed=${this.tileInfoButtonPressed}
249
+ >
303
250
  </collection-tile>`;
304
251
  case 'account':
305
- return html `<account-tile
306
- .model=${model}
307
- .collectionPagePath=${collectionPagePath}
308
- .baseImageUrl=${this.baseImageUrl}
309
- .currentWidth=${currentWidth}
310
- .currentHeight=${currentHeight}
311
- .creatorFilter=${creatorFilter}
312
- .suppressBlurring=${this.suppressBlurring}
313
- .isManageView=${this.isManageView}
314
- ?showInfoButton=${this.shouldShowInfoButton}
315
- @infoButtonPressed=${this.tileInfoButtonPressed}
316
- >
252
+ return html `<account-tile
253
+ .model=${model}
254
+ .collectionPagePath=${collectionPagePath}
255
+ .baseImageUrl=${this.baseImageUrl}
256
+ .currentWidth=${currentWidth}
257
+ .currentHeight=${currentHeight}
258
+ .creatorFilter=${creatorFilter}
259
+ .suppressBlurring=${this.suppressBlurring}
260
+ .isManageView=${this.isManageView}
261
+ ?showInfoButton=${this.shouldShowInfoButton}
262
+ @infoButtonPressed=${this.tileInfoButtonPressed}
263
+ >
317
264
  </account-tile>`;
318
265
  case 'search':
319
- return html `<search-tile
320
- .model=${model}
321
- .collectionPagePath=${collectionPagePath}
322
- .baseImageUrl=${this.baseImageUrl}
323
- .currentWidth=${currentWidth}
324
- .currentHeight=${currentHeight}
325
- .creatorFilter=${creatorFilter}
326
- .suppressBlurring=${this.suppressBlurring}
327
- .isManageView=${this.isManageView}
328
- ?showInfoButton=${false}
329
- @infoButtonPressed=${this.tileInfoButtonPressed}
330
- >
266
+ return html `<search-tile
267
+ .model=${model}
268
+ .collectionPagePath=${collectionPagePath}
269
+ .baseImageUrl=${this.baseImageUrl}
270
+ .currentWidth=${currentWidth}
271
+ .currentHeight=${currentHeight}
272
+ .creatorFilter=${creatorFilter}
273
+ .suppressBlurring=${this.suppressBlurring}
274
+ .isManageView=${this.isManageView}
275
+ ?showInfoButton=${false}
276
+ @infoButtonPressed=${this.tileInfoButtonPressed}
277
+ >
331
278
  </search-tile>`;
332
279
  default:
333
- return html `<item-tile
334
- .model=${model}
335
- .collectionPagePath=${collectionPagePath}
336
- .currentWidth=${this.currentWidth}
337
- .currentHeight=${this.currentHeight}
338
- .baseImageUrl=${this.baseImageUrl}
339
- .sortParam=${sortParam}
340
- .defaultSortParam=${defaultSortParam}
341
- .creatorFilter=${creatorFilter}
342
- .loggedIn=${this.loggedIn}
343
- .suppressBlurring=${this.suppressBlurring}
344
- .isManageView=${this.isManageView}
345
- .layoutType=${this.layoutType}
346
- ?showTvClips=${this.showTvClips}
347
- ?showInfoButton=${this.shouldShowInfoButton}
348
- ?useLocalTime=${this.useLocalTime}
349
- @infoButtonPressed=${this.tileInfoButtonPressed}
350
- >
280
+ return html `<item-tile
281
+ .model=${model}
282
+ .collectionPagePath=${collectionPagePath}
283
+ .currentWidth=${this.currentWidth}
284
+ .currentHeight=${this.currentHeight}
285
+ .baseImageUrl=${this.baseImageUrl}
286
+ .sortParam=${sortParam}
287
+ .defaultSortParam=${defaultSortParam}
288
+ .creatorFilter=${creatorFilter}
289
+ .loggedIn=${this.loggedIn}
290
+ .suppressBlurring=${this.suppressBlurring}
291
+ .isManageView=${this.isManageView}
292
+ .layoutType=${this.layoutType}
293
+ ?showTvClips=${this.showTvClips}
294
+ ?showInfoButton=${this.shouldShowInfoButton}
295
+ ?useLocalTime=${this.useLocalTime}
296
+ @infoButtonPressed=${this.tileInfoButtonPressed}
297
+ >
351
298
  </item-tile>`;
352
299
  }
353
300
  case 'list-compact':
354
- return html `<tile-list-compact
355
- .model=${model}
356
- .collectionPagePath=${collectionPagePath}
357
- .currentWidth=${currentWidth}
358
- .currentHeight=${currentHeight}
359
- .baseNavigationUrl=${baseNavigationUrl}
360
- .sortParam=${sortParam}
361
- .defaultSortParam=${defaultSortParam}
362
- .creatorFilter=${creatorFilter}
363
- .mobileBreakpoint=${mobileBreakpoint}
364
- .baseImageUrl=${this.baseImageUrl}
365
- .loggedIn=${this.loggedIn}
366
- .suppressBlurring=${this.suppressBlurring}
367
- ?useLocalTime=${this.useLocalTime}
368
- >
301
+ return html `<tile-list-compact
302
+ .model=${model}
303
+ .collectionPagePath=${collectionPagePath}
304
+ .currentWidth=${currentWidth}
305
+ .currentHeight=${currentHeight}
306
+ .baseNavigationUrl=${baseNavigationUrl}
307
+ .sortParam=${sortParam}
308
+ .defaultSortParam=${defaultSortParam}
309
+ .creatorFilter=${creatorFilter}
310
+ .mobileBreakpoint=${mobileBreakpoint}
311
+ .baseImageUrl=${this.baseImageUrl}
312
+ .loggedIn=${this.loggedIn}
313
+ .suppressBlurring=${this.suppressBlurring}
314
+ ?useLocalTime=${this.useLocalTime}
315
+ >
369
316
  </tile-list-compact>`;
370
317
  case 'list-detail':
371
- return html `<tile-list
372
- .model=${model}
373
- .collectionPagePath=${collectionPagePath}
374
- .collectionTitles=${this.collectionTitles}
375
- .currentWidth=${currentWidth}
376
- .currentHeight=${currentHeight}
377
- .baseNavigationUrl=${baseNavigationUrl}
378
- .sortParam=${sortParam}
379
- .defaultSortParam=${defaultSortParam}
380
- .creatorFilter=${creatorFilter}
381
- .mobileBreakpoint=${mobileBreakpoint}
382
- .baseImageUrl=${this.baseImageUrl}
383
- .loggedIn=${this.loggedIn}
384
- .suppressBlurring=${this.suppressBlurring}
385
- ?useLocalTime=${this.useLocalTime}
386
- >
318
+ return html `<tile-list
319
+ .model=${model}
320
+ .collectionPagePath=${collectionPagePath}
321
+ .collectionTitles=${this.collectionTitles}
322
+ .currentWidth=${currentWidth}
323
+ .currentHeight=${currentHeight}
324
+ .baseNavigationUrl=${baseNavigationUrl}
325
+ .sortParam=${sortParam}
326
+ .defaultSortParam=${defaultSortParam}
327
+ .creatorFilter=${creatorFilter}
328
+ .mobileBreakpoint=${mobileBreakpoint}
329
+ .baseImageUrl=${this.baseImageUrl}
330
+ .loggedIn=${this.loggedIn}
331
+ .suppressBlurring=${this.suppressBlurring}
332
+ ?useLocalTime=${this.useLocalTime}
333
+ >
387
334
  </tile-list>`;
388
335
  default:
389
336
  return nothing;
@@ -392,157 +339,96 @@ let TileDispatcher = class TileDispatcher extends BaseTileComponent {
392
339
  static get styles() {
393
340
  return [
394
341
  srOnlyStyle,
395
- css `
396
- :host {
397
- display: block;
398
- height: 100%;
399
- }
400
-
401
- collection-tile {
402
- --tileBorderColor: #555555;
403
- --tileBackgroundColor: #666666;
404
- --imageBlockBackgroundColor: #666666;
405
- }
406
-
407
- account-tile {
408
- --tileBorderColor: #dddddd;
409
- --imageBlockBackgroundColor: #fcf5e6;
410
- }
411
-
412
- item-tile {
413
- --tileBorderColor: #dddddd;
414
- --imageBlockBackgroundColor: #f1f1f4;
415
- }
416
-
417
- search-tile {
418
- --tileBorderColor: #555555;
419
- --tileBackgroundColor: #666666;
420
- --imageBlockBackgroundColor: #666666;
421
- --iconFillColor: #2c2c2c;
422
- }
423
-
424
- #container {
425
- position: relative;
426
- height: 100%;
427
- border-radius: 4px;
428
- }
429
-
430
- /*
431
- * When tile actions are present, the container becomes the visual "card"
432
- * so that the tile content and action buttons appear as one unified element.
433
- */
434
- /*
435
- * When tile actions are present, the container takes over the tile's
436
- * border-radius and box-shadow so that the action bar appears as part
437
- * of the same card. The inner tile's own shadow/radius are disabled
438
- * via CSS variable overrides so there is no visual duplication.
439
- */
440
- #container.has-tile-actions {
441
- display: flex;
442
- flex-direction: column;
443
- overflow: hidden;
444
- box-shadow: var(--tileShadow, 1px 1px 2px 0);
445
- --tileBoxShadow: none;
446
- --tileCornerRadius: 0;
447
- }
448
-
449
- #container.has-tile-actions .tile-link {
450
- flex: 1;
451
- min-height: 0;
452
- overflow: hidden;
453
- border-radius: 0;
454
- }
455
-
456
- /* Move hover shadow to container level when tile actions are present */
457
- #container.hoverable:not(.has-tile-actions) a:focus,
458
- #container.hoverable:not(.has-tile-actions) a:hover {
459
- box-shadow: var(
460
- --tileHoverBoxShadow,
461
- 0 0 6px 2px rgba(8, 8, 32, 0.8)
462
- );
463
- transition: box-shadow 0.1s ease;
464
- }
465
-
466
- #container.hoverable.has-tile-actions:hover {
467
- box-shadow: var(
468
- --tileHoverBoxShadow,
469
- 0 0 6px 2px rgba(8, 8, 32, 0.8)
470
- );
471
- transition: box-shadow 0.1s ease;
472
- }
473
-
474
- a {
475
- display: block;
476
- height: 100%;
477
- color: unset;
478
- text-decoration: none;
479
- transition: transform 0.05s ease;
480
- border-radius: 4px;
481
- outline: none;
482
- }
483
-
484
- a :first-child {
485
- display: block;
486
- height: 100%;
487
- }
488
-
489
- .manage-check {
490
- position: absolute;
491
- right: 0;
492
- top: 0;
493
- border: 5px solid #2c2c2c;
494
- border-radius: 3px;
495
- background-color: #2c2c2c;
496
- z-index: 1;
497
- }
498
-
499
- .manage-check > input[type='checkbox'] {
500
- display: block;
501
- margin: 0;
502
- }
503
-
504
- #touch-backdrop {
505
- position: fixed;
506
- width: 100vw;
507
- height: 100vh;
508
- top: 0;
509
- left: 0;
510
- z-index: 2;
511
- background: transparent;
512
- }
513
-
514
- tile-hover-pane {
515
- position: absolute;
516
- top: 0;
517
- left: -9999px;
518
- z-index: 2;
519
- }
520
-
521
- .tile-actions {
522
- flex-shrink: 0;
523
- display: flex;
524
- border-top: 1px solid var(--tileActionSeparatorColor, #ddd);
525
- }
526
-
527
- .tile-action-btn {
528
- flex: 1;
529
- padding: 8px;
530
- border: none;
531
- border-radius: 0;
532
- font-size: 1.2rem;
533
- cursor: pointer;
534
- color: var(--tileActionColor, #333);
535
- background: var(--tileActionBg, #fff);
536
- transition: background 0.15s;
537
- }
538
-
539
- .tile-action-btn + .tile-action-btn {
540
- border-left: 1px solid var(--tileActionSeparatorColor, #ddd);
541
- }
542
-
543
- .tile-action-btn:hover {
544
- background: var(--tileActionHoverBg, #f0f0f0);
545
- }
342
+ css `
343
+ :host {
344
+ display: block;
345
+ height: 100%;
346
+ }
347
+
348
+ collection-tile {
349
+ --tileBorderColor: #555555;
350
+ --tileBackgroundColor: #666666;
351
+ --imageBlockBackgroundColor: #666666;
352
+ }
353
+
354
+ account-tile {
355
+ --tileBorderColor: #dddddd;
356
+ --imageBlockBackgroundColor: #fcf5e6;
357
+ }
358
+
359
+ item-tile {
360
+ --tileBorderColor: #dddddd;
361
+ --imageBlockBackgroundColor: #f1f1f4;
362
+ }
363
+
364
+ search-tile {
365
+ --tileBorderColor: #555555;
366
+ --tileBackgroundColor: #666666;
367
+ --imageBlockBackgroundColor: #666666;
368
+ --iconFillColor: #2c2c2c;
369
+ }
370
+
371
+ #container {
372
+ position: relative;
373
+ height: 100%;
374
+ border-radius: 4px;
375
+ }
376
+
377
+ #container.hoverable a:focus,
378
+ #container.hoverable a:hover {
379
+ box-shadow: var(
380
+ --tileHoverBoxShadow,
381
+ 0 0 6px 2px rgba(8, 8, 32, 0.8)
382
+ );
383
+ transition: box-shadow 0.1s ease;
384
+ }
385
+
386
+ a {
387
+ display: block;
388
+ height: 100%;
389
+ color: unset;
390
+ text-decoration: none;
391
+ transition: transform 0.05s ease;
392
+ border-radius: 4px;
393
+ outline: none;
394
+ }
395
+
396
+ a :first-child {
397
+ display: block;
398
+ height: 100%;
399
+ }
400
+
401
+ .manage-check {
402
+ position: absolute;
403
+ right: 0;
404
+ top: 0;
405
+ border: 5px solid #2c2c2c;
406
+ border-radius: 3px;
407
+ background-color: #2c2c2c;
408
+ z-index: 1;
409
+ }
410
+
411
+ .manage-check > input[type='checkbox'] {
412
+ display: block;
413
+ margin: 0;
414
+ }
415
+
416
+ #touch-backdrop {
417
+ position: fixed;
418
+ width: 100vw;
419
+ height: 100vh;
420
+ top: 0;
421
+ left: 0;
422
+ z-index: 2;
423
+ background: transparent;
424
+ }
425
+
426
+ tile-hover-pane {
427
+ position: absolute;
428
+ top: 0;
429
+ left: -9999px;
430
+ z-index: 2;
431
+ }
546
432
  `,
547
433
  ];
548
434
  }
@@ -571,9 +457,6 @@ __decorate([
571
457
  __decorate([
572
458
  property({ type: String })
573
459
  ], TileDispatcher.prototype, "manageCheckTitle", void 0);
574
- __decorate([
575
- property({ type: Array })
576
- ], TileDispatcher.prototype, "tileActions", void 0);
577
460
  __decorate([
578
461
  query('#container')
579
462
  ], TileDispatcher.prototype, "container", void 0);