@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.
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.d.ts +0 -8
- package/dist/src/app-root.js +614 -645
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +0 -3
- package/dist/src/collection-browser.js +790 -794
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/tiles/models.d.ts +0 -14
- package/dist/src/tiles/models.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +1 -12
- package/dist/src/tiles/tile-dispatcher.js +216 -333
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/test/collection-browser.test.js +261 -189
- package/dist/test/collection-browser.test.js.map +1 -1
- package/index.ts +28 -29
- package/package.json +1 -1
- package/src/app-root.ts +1166 -1201
- package/src/collection-browser.ts +3077 -3080
- package/src/tiles/models.ts +8 -24
- package/src/tiles/tile-dispatcher.ts +527 -652
- package/test/collection-browser.test.ts +2507 -2402
|
@@ -1,652 +1,527 @@
|
|
|
1
|
-
import { css, html, nothing, PropertyValues } from 'lit';
|
|
2
|
-
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
} from '
|
|
10
|
-
import type {
|
|
11
|
-
import
|
|
12
|
-
import './grid/
|
|
13
|
-
import './grid/
|
|
14
|
-
import './grid/
|
|
15
|
-
import './
|
|
16
|
-
import './
|
|
17
|
-
import './list/tile-list';
|
|
18
|
-
import './list/tile-list-compact';
|
|
19
|
-
import './
|
|
20
|
-
import
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} from '
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
*
|
|
40
|
-
* -
|
|
41
|
-
* -
|
|
42
|
-
* -
|
|
43
|
-
* -
|
|
44
|
-
* -
|
|
45
|
-
* -
|
|
46
|
-
* -
|
|
47
|
-
* -
|
|
48
|
-
* -
|
|
49
|
-
* -
|
|
50
|
-
* -
|
|
51
|
-
* -
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
@
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
this.tileLinkElement?.
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
'
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
.
|
|
146
|
-
.
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
:
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
private get
|
|
218
|
-
return (
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
return
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
this.
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
.
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
.
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
position: relative;
|
|
529
|
-
height: 100%;
|
|
530
|
-
border-radius: 4px;
|
|
531
|
-
}
|
|
532
|
-
|
|
533
|
-
/*
|
|
534
|
-
* When tile actions are present, the container becomes the visual "card"
|
|
535
|
-
* so that the tile content and action buttons appear as one unified element.
|
|
536
|
-
*/
|
|
537
|
-
/*
|
|
538
|
-
* When tile actions are present, the container takes over the tile's
|
|
539
|
-
* border-radius and box-shadow so that the action bar appears as part
|
|
540
|
-
* of the same card. The inner tile's own shadow/radius are disabled
|
|
541
|
-
* via CSS variable overrides so there is no visual duplication.
|
|
542
|
-
*/
|
|
543
|
-
#container.has-tile-actions {
|
|
544
|
-
display: flex;
|
|
545
|
-
flex-direction: column;
|
|
546
|
-
overflow: hidden;
|
|
547
|
-
box-shadow: var(--tileShadow, 1px 1px 2px 0);
|
|
548
|
-
--tileBoxShadow: none;
|
|
549
|
-
--tileCornerRadius: 0;
|
|
550
|
-
}
|
|
551
|
-
|
|
552
|
-
#container.has-tile-actions .tile-link {
|
|
553
|
-
flex: 1;
|
|
554
|
-
min-height: 0;
|
|
555
|
-
overflow: hidden;
|
|
556
|
-
border-radius: 0;
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
/* Move hover shadow to container level when tile actions are present */
|
|
560
|
-
#container.hoverable:not(.has-tile-actions) a:focus,
|
|
561
|
-
#container.hoverable:not(.has-tile-actions) a:hover {
|
|
562
|
-
box-shadow: var(
|
|
563
|
-
--tileHoverBoxShadow,
|
|
564
|
-
0 0 6px 2px rgba(8, 8, 32, 0.8)
|
|
565
|
-
);
|
|
566
|
-
transition: box-shadow 0.1s ease;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
#container.hoverable.has-tile-actions:hover {
|
|
570
|
-
box-shadow: var(
|
|
571
|
-
--tileHoverBoxShadow,
|
|
572
|
-
0 0 6px 2px rgba(8, 8, 32, 0.8)
|
|
573
|
-
);
|
|
574
|
-
transition: box-shadow 0.1s ease;
|
|
575
|
-
}
|
|
576
|
-
|
|
577
|
-
a {
|
|
578
|
-
display: block;
|
|
579
|
-
height: 100%;
|
|
580
|
-
color: unset;
|
|
581
|
-
text-decoration: none;
|
|
582
|
-
transition: transform 0.05s ease;
|
|
583
|
-
border-radius: 4px;
|
|
584
|
-
outline: none;
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
a :first-child {
|
|
588
|
-
display: block;
|
|
589
|
-
height: 100%;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
.manage-check {
|
|
593
|
-
position: absolute;
|
|
594
|
-
right: 0;
|
|
595
|
-
top: 0;
|
|
596
|
-
border: 5px solid #2c2c2c;
|
|
597
|
-
border-radius: 3px;
|
|
598
|
-
background-color: #2c2c2c;
|
|
599
|
-
z-index: 1;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
.manage-check > input[type='checkbox'] {
|
|
603
|
-
display: block;
|
|
604
|
-
margin: 0;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
#touch-backdrop {
|
|
608
|
-
position: fixed;
|
|
609
|
-
width: 100vw;
|
|
610
|
-
height: 100vh;
|
|
611
|
-
top: 0;
|
|
612
|
-
left: 0;
|
|
613
|
-
z-index: 2;
|
|
614
|
-
background: transparent;
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
tile-hover-pane {
|
|
618
|
-
position: absolute;
|
|
619
|
-
top: 0;
|
|
620
|
-
left: -9999px;
|
|
621
|
-
z-index: 2;
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
.tile-actions {
|
|
625
|
-
flex-shrink: 0;
|
|
626
|
-
display: flex;
|
|
627
|
-
border-top: 1px solid var(--tileActionSeparatorColor, #ddd);
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
.tile-action-btn {
|
|
631
|
-
flex: 1;
|
|
632
|
-
padding: 8px;
|
|
633
|
-
border: none;
|
|
634
|
-
border-radius: 0;
|
|
635
|
-
font-size: 1.2rem;
|
|
636
|
-
cursor: pointer;
|
|
637
|
-
color: var(--tileActionColor, #333);
|
|
638
|
-
background: var(--tileActionBg, #fff);
|
|
639
|
-
transition: background 0.15s;
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
.tile-action-btn + .tile-action-btn {
|
|
643
|
-
border-left: 1px solid var(--tileActionSeparatorColor, #ddd);
|
|
644
|
-
}
|
|
645
|
-
|
|
646
|
-
.tile-action-btn:hover {
|
|
647
|
-
background: var(--tileActionHoverBg, #f0f0f0);
|
|
648
|
-
}
|
|
649
|
-
`,
|
|
650
|
-
];
|
|
651
|
-
}
|
|
652
|
-
}
|
|
1
|
+
import { css, html, nothing, PropertyValues } from 'lit';
|
|
2
|
+
import { customElement, property, query } from 'lit/decorators.js';
|
|
3
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
4
|
+
import { msg } from '@lit/localize';
|
|
5
|
+
import type {
|
|
6
|
+
SharedResizeObserverInterface,
|
|
7
|
+
SharedResizeObserverResizeHandlerInterface,
|
|
8
|
+
} from '@internetarchive/shared-resize-observer';
|
|
9
|
+
import type { TileDisplayMode } from '../models';
|
|
10
|
+
import type { CollectionTitles } from '../data-source/models';
|
|
11
|
+
import './grid/collection-tile';
|
|
12
|
+
import './grid/item-tile';
|
|
13
|
+
import './grid/account-tile';
|
|
14
|
+
import './grid/search-tile';
|
|
15
|
+
import './hover/tile-hover-pane';
|
|
16
|
+
import './list/tile-list';
|
|
17
|
+
import './list/tile-list-compact';
|
|
18
|
+
import './list/tile-list-compact-header';
|
|
19
|
+
import type { TileHoverPane } from './hover/tile-hover-pane';
|
|
20
|
+
import { BaseTileComponent } from './base-tile-component';
|
|
21
|
+
import { LayoutType } from './models';
|
|
22
|
+
import {
|
|
23
|
+
HoverPaneController,
|
|
24
|
+
HoverPaneControllerInterface,
|
|
25
|
+
HoverPaneProperties,
|
|
26
|
+
HoverPaneProviderInterface,
|
|
27
|
+
} from './hover/hover-pane-controller';
|
|
28
|
+
import { srOnlyStyle } from '../styles/sr-only';
|
|
29
|
+
|
|
30
|
+
@customElement('tile-dispatcher')
|
|
31
|
+
export class TileDispatcher
|
|
32
|
+
extends BaseTileComponent
|
|
33
|
+
implements
|
|
34
|
+
SharedResizeObserverResizeHandlerInterface,
|
|
35
|
+
HoverPaneProviderInterface
|
|
36
|
+
{
|
|
37
|
+
/*
|
|
38
|
+
* Reactive properties inherited from BaseTileComponent:
|
|
39
|
+
* - model?: TileModel;
|
|
40
|
+
* - currentWidth?: number;
|
|
41
|
+
* - currentHeight?: number;
|
|
42
|
+
* - baseNavigationUrl?: string;
|
|
43
|
+
* - baseImageUrl?: string;
|
|
44
|
+
* - collectionPagePath?: string;
|
|
45
|
+
* - sortParam: SortParam | null = null;
|
|
46
|
+
* - defaultSortParam: SortParam | null = null;
|
|
47
|
+
* - creatorFilter?: string;
|
|
48
|
+
* - mobileBreakpoint?: number;
|
|
49
|
+
* - loggedIn = false;
|
|
50
|
+
* - suppressTileBlurring = false;
|
|
51
|
+
* - useLocalTime = false;
|
|
52
|
+
*/
|
|
53
|
+
|
|
54
|
+
@property({ type: String }) tileDisplayMode?: TileDisplayMode;
|
|
55
|
+
|
|
56
|
+
@property({ type: Boolean }) isManageView = false;
|
|
57
|
+
|
|
58
|
+
@property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;
|
|
59
|
+
|
|
60
|
+
@property({ type: Object })
|
|
61
|
+
collectionTitles?: CollectionTitles;
|
|
62
|
+
|
|
63
|
+
@property({ type: Boolean }) showTvClips = false;
|
|
64
|
+
|
|
65
|
+
/** What type of simplified layout to use in grid mode, if any */
|
|
66
|
+
@property({ type: String }) layoutType: LayoutType = 'default';
|
|
67
|
+
|
|
68
|
+
/** Whether this tile should include a hover pane at all (for applicable tile modes) */
|
|
69
|
+
@property({ type: Boolean }) enableHoverPane = false;
|
|
70
|
+
|
|
71
|
+
@property({ type: String }) manageCheckTitle = msg(
|
|
72
|
+
'Remove this item from the list',
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
private hoverPaneController?: HoverPaneControllerInterface;
|
|
76
|
+
|
|
77
|
+
@query('#container')
|
|
78
|
+
private container!: HTMLDivElement;
|
|
79
|
+
|
|
80
|
+
@query('tile-hover-pane')
|
|
81
|
+
private hoverPane?: TileHoverPane;
|
|
82
|
+
|
|
83
|
+
@query('.tile-link')
|
|
84
|
+
private tileLinkElement?: HTMLAnchorElement;
|
|
85
|
+
|
|
86
|
+
acquireFocus(): void {
|
|
87
|
+
this.tileLinkElement?.focus();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
releaseFocus(): void {
|
|
91
|
+
this.tileLinkElement?.blur();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Maps each display mode to whether hover panes should appear in that mode */
|
|
95
|
+
private static readonly HOVER_PANE_DISPLAY_MODES: Record<
|
|
96
|
+
TileDisplayMode,
|
|
97
|
+
boolean
|
|
98
|
+
> = {
|
|
99
|
+
grid: true,
|
|
100
|
+
'list-compact': true,
|
|
101
|
+
'list-detail': false,
|
|
102
|
+
'list-header': false,
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
render() {
|
|
106
|
+
const isGridMode = this.tileDisplayMode === 'grid';
|
|
107
|
+
const hoverPaneTemplate =
|
|
108
|
+
this.hoverPaneController?.getTemplate() ?? nothing;
|
|
109
|
+
return html`
|
|
110
|
+
<div id="container" class=${isGridMode ? 'hoverable' : ''}>
|
|
111
|
+
${this.tileDisplayMode === 'list-header'
|
|
112
|
+
? this.headerTemplate
|
|
113
|
+
: this.tileTemplate}
|
|
114
|
+
${this.manageCheckTemplate} ${hoverPaneTemplate}
|
|
115
|
+
</div>
|
|
116
|
+
`;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
protected firstUpdated(): void {
|
|
120
|
+
if (this.shouldPrepareHoverPane) {
|
|
121
|
+
this.hoverPaneController = new HoverPaneController(this, {
|
|
122
|
+
mobileBreakpoint: this.mobileBreakpoint,
|
|
123
|
+
enableLongPress: false,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private get headerTemplate() {
|
|
129
|
+
const { currentWidth, sortParam, defaultSortParam, mobileBreakpoint } =
|
|
130
|
+
this;
|
|
131
|
+
return html`
|
|
132
|
+
<tile-list-compact-header
|
|
133
|
+
class="header"
|
|
134
|
+
.currentWidth=${currentWidth}
|
|
135
|
+
.sortParam=${sortParam ?? defaultSortParam}
|
|
136
|
+
.mobileBreakpoint=${mobileBreakpoint}
|
|
137
|
+
>
|
|
138
|
+
</tile-list-compact-header>
|
|
139
|
+
`;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
private get tileTemplate() {
|
|
143
|
+
return html`
|
|
144
|
+
${this.tileDisplayMode === 'list-detail'
|
|
145
|
+
? this.tile
|
|
146
|
+
: this.linkTileTemplate}
|
|
147
|
+
`;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
private get linkTileTemplate() {
|
|
151
|
+
return html`
|
|
152
|
+
<a
|
|
153
|
+
href=${this.linkTileHref}
|
|
154
|
+
aria-label=${this.model?.title ?? 'Untitled item'}
|
|
155
|
+
aria-describedby="link-aria-description"
|
|
156
|
+
aria-haspopup=${this.shouldPrepareHoverPane ? 'dialog' : 'false'}
|
|
157
|
+
title=${this.shouldPrepareHoverPane
|
|
158
|
+
? nothing // Don't show title tooltips when we have the tile info popups
|
|
159
|
+
: ifDefined(this.model?.title)}
|
|
160
|
+
@click=${this.handleLinkClicked}
|
|
161
|
+
@contextmenu=${this.handleLinkContextMenu}
|
|
162
|
+
class="tile-link"
|
|
163
|
+
>
|
|
164
|
+
${this.tile}
|
|
165
|
+
</a>
|
|
166
|
+
<div id="link-aria-description" class="sr-only">
|
|
167
|
+
${msg('Press Down Arrow to preview item details')}
|
|
168
|
+
</div>
|
|
169
|
+
`;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
private get linkTileHref(): string | typeof nothing {
|
|
173
|
+
if (!this.model?.identifier || this.baseNavigationUrl == null)
|
|
174
|
+
return nothing;
|
|
175
|
+
|
|
176
|
+
// Use the server-specified href if available.
|
|
177
|
+
// Otherwise, construct a details page URL from the item identifier.
|
|
178
|
+
if (this.model.href) {
|
|
179
|
+
return `${this.baseNavigationUrl}${this.model.href}`;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
return this.displayValueProvider.itemPageUrl(
|
|
183
|
+
this.model.identifier,
|
|
184
|
+
this.model.mediatype === 'collection',
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
private get manageCheckTemplate() {
|
|
189
|
+
if (!this.isManageView || this.tileDisplayMode !== 'grid') return nothing;
|
|
190
|
+
|
|
191
|
+
return html`
|
|
192
|
+
<div class="manage-check">
|
|
193
|
+
<input
|
|
194
|
+
type="checkbox"
|
|
195
|
+
title=${this.manageCheckTitle}
|
|
196
|
+
?checked=${this.model?.checked}
|
|
197
|
+
@change=${this.handleLinkClicked}
|
|
198
|
+
/>
|
|
199
|
+
</div>
|
|
200
|
+
`;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Whether hover pane behavior should be prepared for this tile
|
|
205
|
+
* (e.g., whether mouse listeners should be attached, etc.)
|
|
206
|
+
*/
|
|
207
|
+
private get shouldPrepareHoverPane(): boolean {
|
|
208
|
+
return (
|
|
209
|
+
this.enableHoverPane &&
|
|
210
|
+
!!this.tileDisplayMode &&
|
|
211
|
+
TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode] &&
|
|
212
|
+
this.model?.mediatype !== 'search' && // don't show hover panes on search tiles
|
|
213
|
+
!this.model?.captureDates // don't show hover panes on web archive tiles
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
private get isHoverEnabled(): boolean {
|
|
218
|
+
return window.matchMedia('(hover: hover)').matches;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* Whether the info button should be shown on this tile.
|
|
223
|
+
* Only shown on touch/non-hover devices where a hover pane is available,
|
|
224
|
+
* so the button always has something to toggle.
|
|
225
|
+
*/
|
|
226
|
+
private get shouldShowInfoButton(): boolean {
|
|
227
|
+
return !this.isHoverEnabled && this.shouldPrepareHoverPane;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
/** @inheritdoc */
|
|
231
|
+
getHoverPane(): TileHoverPane | undefined {
|
|
232
|
+
return this.hoverPane;
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** @inheritdoc */
|
|
236
|
+
getHoverPaneProps(): HoverPaneProperties {
|
|
237
|
+
return this;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
handleResize(entry: ResizeObserverEntry): void {
|
|
241
|
+
this.currentWidth = entry.contentRect.width;
|
|
242
|
+
this.currentHeight = entry.contentRect.height;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
disconnectedCallback(): void {
|
|
246
|
+
this.stopResizeObservation(this.resizeObserver);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
private stopResizeObservation(observer?: SharedResizeObserverInterface) {
|
|
250
|
+
observer?.removeObserver({
|
|
251
|
+
handler: this,
|
|
252
|
+
target: this.container,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
private startResizeObservation() {
|
|
257
|
+
this.stopResizeObservation(this.resizeObserver);
|
|
258
|
+
this.resizeObserver?.addObserver({
|
|
259
|
+
handler: this,
|
|
260
|
+
target: this.container,
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
updated(props: PropertyValues) {
|
|
265
|
+
if (props.has('resizeObserver')) {
|
|
266
|
+
const previousObserver = props.get(
|
|
267
|
+
'resizeObserver',
|
|
268
|
+
) as SharedResizeObserverInterface;
|
|
269
|
+
this.stopResizeObservation(previousObserver);
|
|
270
|
+
this.startResizeObservation();
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Handler for when the tile link is left-clicked. Emits the `resultSelected` event.
|
|
276
|
+
* In manage view, it also checks/unchecks the tile.
|
|
277
|
+
*/
|
|
278
|
+
private handleLinkClicked(e: Event): void {
|
|
279
|
+
if (this.isManageView) {
|
|
280
|
+
e.preventDefault();
|
|
281
|
+
if (this.model) this.model.checked = !this.model.checked;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
this.dispatchEvent(
|
|
285
|
+
new CustomEvent('resultSelected', { detail: this.model }),
|
|
286
|
+
);
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Handler for when the tile link is right-clicked.
|
|
291
|
+
* In manage view, it opens the item in a new tab. Otherwise, does nothing.
|
|
292
|
+
*/
|
|
293
|
+
private handleLinkContextMenu(e: Event): void {
|
|
294
|
+
if (this.isManageView && this.linkTileHref !== nothing) {
|
|
295
|
+
e.preventDefault();
|
|
296
|
+
window.open(this.linkTileHref, '_blank');
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
private tileInfoButtonPressed(
|
|
301
|
+
e: CustomEvent<{ x: number; y: number }>,
|
|
302
|
+
): void {
|
|
303
|
+
this.hoverPaneController?.toggleHoverPane({
|
|
304
|
+
coords: e.detail,
|
|
305
|
+
enableTouchBackdrop: true,
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
private get tile() {
|
|
310
|
+
const {
|
|
311
|
+
model,
|
|
312
|
+
collectionPagePath,
|
|
313
|
+
baseNavigationUrl,
|
|
314
|
+
currentWidth,
|
|
315
|
+
currentHeight,
|
|
316
|
+
sortParam,
|
|
317
|
+
creatorFilter,
|
|
318
|
+
mobileBreakpoint,
|
|
319
|
+
defaultSortParam,
|
|
320
|
+
} = this;
|
|
321
|
+
|
|
322
|
+
if (!model) return nothing;
|
|
323
|
+
|
|
324
|
+
switch (this.tileDisplayMode) {
|
|
325
|
+
case 'grid':
|
|
326
|
+
switch (model.mediatype) {
|
|
327
|
+
case 'collection':
|
|
328
|
+
return html`<collection-tile
|
|
329
|
+
.model=${model}
|
|
330
|
+
.collectionPagePath=${collectionPagePath}
|
|
331
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
332
|
+
.currentWidth=${currentWidth}
|
|
333
|
+
.currentHeight=${currentHeight}
|
|
334
|
+
.creatorFilter=${creatorFilter}
|
|
335
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
336
|
+
.isManageView=${this.isManageView}
|
|
337
|
+
.layoutType=${this.layoutType}
|
|
338
|
+
?showInfoButton=${this.shouldShowInfoButton}
|
|
339
|
+
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
340
|
+
>
|
|
341
|
+
</collection-tile>`;
|
|
342
|
+
case 'account':
|
|
343
|
+
return html`<account-tile
|
|
344
|
+
.model=${model}
|
|
345
|
+
.collectionPagePath=${collectionPagePath}
|
|
346
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
347
|
+
.currentWidth=${currentWidth}
|
|
348
|
+
.currentHeight=${currentHeight}
|
|
349
|
+
.creatorFilter=${creatorFilter}
|
|
350
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
351
|
+
.isManageView=${this.isManageView}
|
|
352
|
+
?showInfoButton=${this.shouldShowInfoButton}
|
|
353
|
+
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
354
|
+
>
|
|
355
|
+
</account-tile>`;
|
|
356
|
+
case 'search':
|
|
357
|
+
return html`<search-tile
|
|
358
|
+
.model=${model}
|
|
359
|
+
.collectionPagePath=${collectionPagePath}
|
|
360
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
361
|
+
.currentWidth=${currentWidth}
|
|
362
|
+
.currentHeight=${currentHeight}
|
|
363
|
+
.creatorFilter=${creatorFilter}
|
|
364
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
365
|
+
.isManageView=${this.isManageView}
|
|
366
|
+
?showInfoButton=${false}
|
|
367
|
+
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
368
|
+
>
|
|
369
|
+
</search-tile>`;
|
|
370
|
+
default:
|
|
371
|
+
return html`<item-tile
|
|
372
|
+
.model=${model}
|
|
373
|
+
.collectionPagePath=${collectionPagePath}
|
|
374
|
+
.currentWidth=${this.currentWidth}
|
|
375
|
+
.currentHeight=${this.currentHeight}
|
|
376
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
377
|
+
.sortParam=${sortParam}
|
|
378
|
+
.defaultSortParam=${defaultSortParam}
|
|
379
|
+
.creatorFilter=${creatorFilter}
|
|
380
|
+
.loggedIn=${this.loggedIn}
|
|
381
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
382
|
+
.isManageView=${this.isManageView}
|
|
383
|
+
.layoutType=${this.layoutType}
|
|
384
|
+
?showTvClips=${this.showTvClips}
|
|
385
|
+
?showInfoButton=${this.shouldShowInfoButton}
|
|
386
|
+
?useLocalTime=${this.useLocalTime}
|
|
387
|
+
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
388
|
+
>
|
|
389
|
+
</item-tile>`;
|
|
390
|
+
}
|
|
391
|
+
case 'list-compact':
|
|
392
|
+
return html`<tile-list-compact
|
|
393
|
+
.model=${model}
|
|
394
|
+
.collectionPagePath=${collectionPagePath}
|
|
395
|
+
.currentWidth=${currentWidth}
|
|
396
|
+
.currentHeight=${currentHeight}
|
|
397
|
+
.baseNavigationUrl=${baseNavigationUrl}
|
|
398
|
+
.sortParam=${sortParam}
|
|
399
|
+
.defaultSortParam=${defaultSortParam}
|
|
400
|
+
.creatorFilter=${creatorFilter}
|
|
401
|
+
.mobileBreakpoint=${mobileBreakpoint}
|
|
402
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
403
|
+
.loggedIn=${this.loggedIn}
|
|
404
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
405
|
+
?useLocalTime=${this.useLocalTime}
|
|
406
|
+
>
|
|
407
|
+
</tile-list-compact>`;
|
|
408
|
+
case 'list-detail':
|
|
409
|
+
return html`<tile-list
|
|
410
|
+
.model=${model}
|
|
411
|
+
.collectionPagePath=${collectionPagePath}
|
|
412
|
+
.collectionTitles=${this.collectionTitles}
|
|
413
|
+
.currentWidth=${currentWidth}
|
|
414
|
+
.currentHeight=${currentHeight}
|
|
415
|
+
.baseNavigationUrl=${baseNavigationUrl}
|
|
416
|
+
.sortParam=${sortParam}
|
|
417
|
+
.defaultSortParam=${defaultSortParam}
|
|
418
|
+
.creatorFilter=${creatorFilter}
|
|
419
|
+
.mobileBreakpoint=${mobileBreakpoint}
|
|
420
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
421
|
+
.loggedIn=${this.loggedIn}
|
|
422
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
423
|
+
?useLocalTime=${this.useLocalTime}
|
|
424
|
+
>
|
|
425
|
+
</tile-list>`;
|
|
426
|
+
default:
|
|
427
|
+
return nothing;
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
static get styles() {
|
|
432
|
+
return [
|
|
433
|
+
srOnlyStyle,
|
|
434
|
+
css`
|
|
435
|
+
:host {
|
|
436
|
+
display: block;
|
|
437
|
+
height: 100%;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
collection-tile {
|
|
441
|
+
--tileBorderColor: #555555;
|
|
442
|
+
--tileBackgroundColor: #666666;
|
|
443
|
+
--imageBlockBackgroundColor: #666666;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
account-tile {
|
|
447
|
+
--tileBorderColor: #dddddd;
|
|
448
|
+
--imageBlockBackgroundColor: #fcf5e6;
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
item-tile {
|
|
452
|
+
--tileBorderColor: #dddddd;
|
|
453
|
+
--imageBlockBackgroundColor: #f1f1f4;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
search-tile {
|
|
457
|
+
--tileBorderColor: #555555;
|
|
458
|
+
--tileBackgroundColor: #666666;
|
|
459
|
+
--imageBlockBackgroundColor: #666666;
|
|
460
|
+
--iconFillColor: #2c2c2c;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
#container {
|
|
464
|
+
position: relative;
|
|
465
|
+
height: 100%;
|
|
466
|
+
border-radius: 4px;
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
#container.hoverable a:focus,
|
|
470
|
+
#container.hoverable a:hover {
|
|
471
|
+
box-shadow: var(
|
|
472
|
+
--tileHoverBoxShadow,
|
|
473
|
+
0 0 6px 2px rgba(8, 8, 32, 0.8)
|
|
474
|
+
);
|
|
475
|
+
transition: box-shadow 0.1s ease;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
a {
|
|
479
|
+
display: block;
|
|
480
|
+
height: 100%;
|
|
481
|
+
color: unset;
|
|
482
|
+
text-decoration: none;
|
|
483
|
+
transition: transform 0.05s ease;
|
|
484
|
+
border-radius: 4px;
|
|
485
|
+
outline: none;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
a :first-child {
|
|
489
|
+
display: block;
|
|
490
|
+
height: 100%;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.manage-check {
|
|
494
|
+
position: absolute;
|
|
495
|
+
right: 0;
|
|
496
|
+
top: 0;
|
|
497
|
+
border: 5px solid #2c2c2c;
|
|
498
|
+
border-radius: 3px;
|
|
499
|
+
background-color: #2c2c2c;
|
|
500
|
+
z-index: 1;
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
.manage-check > input[type='checkbox'] {
|
|
504
|
+
display: block;
|
|
505
|
+
margin: 0;
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
#touch-backdrop {
|
|
509
|
+
position: fixed;
|
|
510
|
+
width: 100vw;
|
|
511
|
+
height: 100vh;
|
|
512
|
+
top: 0;
|
|
513
|
+
left: 0;
|
|
514
|
+
z-index: 2;
|
|
515
|
+
background: transparent;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
tile-hover-pane {
|
|
519
|
+
position: absolute;
|
|
520
|
+
top: 0;
|
|
521
|
+
left: -9999px;
|
|
522
|
+
z-index: 2;
|
|
523
|
+
}
|
|
524
|
+
`,
|
|
525
|
+
];
|
|
526
|
+
}
|
|
527
|
+
}
|