@internetarchive/collection-browser 4.3.0 → 4.3.1-alpha-webdev8257.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 (63) hide show
  1. package/dist/index.d.ts +1 -0
  2. package/dist/index.js.map +1 -1
  3. package/dist/src/app-root.d.ts +11 -0
  4. package/dist/src/app-root.js +107 -0
  5. package/dist/src/app-root.js.map +1 -1
  6. package/dist/src/collection-browser.d.ts +8 -4
  7. package/dist/src/collection-browser.js +19 -20
  8. package/dist/src/collection-browser.js.map +1 -1
  9. package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
  10. package/dist/src/manage/manage-bar.d.ts +7 -2
  11. package/dist/src/manage/manage-bar.js +25 -3
  12. package/dist/src/manage/manage-bar.js.map +1 -1
  13. package/dist/src/styles/tile-action-styles.d.ts +14 -0
  14. package/dist/src/styles/tile-action-styles.js +52 -0
  15. package/dist/src/styles/tile-action-styles.js.map +1 -0
  16. package/dist/src/tiles/base-tile-component.d.ts +17 -1
  17. package/dist/src/tiles/base-tile-component.js +48 -1
  18. package/dist/src/tiles/base-tile-component.js.map +1 -1
  19. package/dist/src/tiles/grid/item-tile.js +1 -0
  20. package/dist/src/tiles/grid/item-tile.js.map +1 -1
  21. package/dist/src/tiles/list/tile-list-compact-header.js +66 -46
  22. package/dist/src/tiles/list/tile-list-compact-header.js.map +1 -1
  23. package/dist/src/tiles/list/tile-list-compact.d.ts +1 -1
  24. package/dist/src/tiles/list/tile-list-compact.js +132 -100
  25. package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
  26. package/dist/src/tiles/list/tile-list.d.ts +1 -1
  27. package/dist/src/tiles/list/tile-list.js +316 -298
  28. package/dist/src/tiles/list/tile-list.js.map +1 -1
  29. package/dist/src/tiles/models.d.ts +14 -0
  30. package/dist/src/tiles/models.js.map +1 -1
  31. package/dist/src/tiles/tile-dispatcher.d.ts +14 -0
  32. package/dist/src/tiles/tile-dispatcher.js +107 -4
  33. package/dist/src/tiles/tile-dispatcher.js.map +1 -1
  34. package/dist/src/tiles/tile-display-value-provider.js.map +1 -1
  35. package/dist/test/data-source/collection-browser-data-source.test.js +2 -2
  36. package/dist/test/data-source/collection-browser-data-source.test.js.map +1 -1
  37. package/dist/test/manage/manage-bar.test.d.ts +1 -0
  38. package/dist/test/manage/manage-bar.test.js +123 -1
  39. package/dist/test/manage/manage-bar.test.js.map +1 -1
  40. package/dist/test/tiles/list/tile-list-compact-header.test.js +12 -12
  41. package/dist/test/tiles/list/tile-list-compact-header.test.js.map +1 -1
  42. package/dist/test/tiles/list/tile-list.test.js +134 -134
  43. package/dist/test/tiles/list/tile-list.test.js.map +1 -1
  44. package/index.ts +1 -0
  45. package/package.json +1 -1
  46. package/src/app-root.ts +115 -0
  47. package/src/collection-browser.ts +16 -30
  48. package/src/data-source/collection-browser-data-source.ts +1465 -1465
  49. package/src/manage/manage-bar.ts +33 -4
  50. package/src/styles/tile-action-styles.ts +52 -0
  51. package/src/tiles/base-tile-component.ts +57 -1
  52. package/src/tiles/grid/item-tile.ts +1 -0
  53. package/src/tiles/list/tile-list-compact-header.ts +106 -86
  54. package/src/tiles/list/tile-list-compact.ts +273 -239
  55. package/src/tiles/list/tile-list.ts +718 -700
  56. package/src/tiles/models.ts +16 -0
  57. package/src/tiles/tile-dispatcher.ts +114 -4
  58. package/src/tiles/tile-display-value-provider.ts +134 -134
  59. package/test/data-source/collection-browser-data-source.test.ts +193 -193
  60. package/test/manage/manage-bar.test.ts +192 -2
  61. package/test/tiles/list/tile-list-compact-header.test.ts +43 -43
  62. package/test/tiles/list/tile-list.test.ts +576 -576
  63. package/.claude/settings.local.json +0 -11
@@ -12,8 +12,8 @@ describe('List Tile', () => {
12
12
  expect(imageBlock).to.exist;
13
13
  });
14
14
  it('should render the mobile template if below mobile breakpoint', async () => {
15
- const el = await fixture(html `
16
- <tile-list .mobileBreakpoint=${500} .currentWidth=${400}> </tile-list>
15
+ const el = await fixture(html `
16
+ <tile-list .mobileBreakpoint=${500} .currentWidth=${400}> </tile-list>
17
17
  `);
18
18
  const listContainer = el.shadowRoot?.getElementById('list-line');
19
19
  const topLine = el.shadowRoot?.getElementById('list-line-top');
@@ -24,30 +24,30 @@ describe('List Tile', () => {
24
24
  expect(bottomLine).to.exist;
25
25
  });
26
26
  it('should render title link with model href if provided', async () => {
27
- const el = await fixture(html `
28
- <tile-list
29
- .baseNavigationUrl=${''}
30
- .model=${{ title: 'foo', href: '/foo/bar' }}
31
- ></tile-list>
27
+ const el = await fixture(html `
28
+ <tile-list
29
+ .baseNavigationUrl=${''}
30
+ .model=${{ title: 'foo', href: '/foo/bar' }}
31
+ ></tile-list>
32
32
  `);
33
33
  const title = el.shadowRoot?.querySelector('#title > a');
34
34
  expect(title).to.exist;
35
35
  expect(title?.getAttribute('href')).to.equal('/foo/bar');
36
36
  });
37
37
  it('should add title to image link if provided', async () => {
38
- const el = await fixture(html `
39
- <tile-list
40
- .baseNavigationUrl=${''}
41
- .model=${{ title: 'foo', href: '/foo/bar' }}
42
- ></tile-list>
38
+ const el = await fixture(html `
39
+ <tile-list
40
+ .baseNavigationUrl=${''}
41
+ .model=${{ title: 'foo', href: '/foo/bar' }}
42
+ ></tile-list>
43
43
  `);
44
44
  const imageLink = el.shadowRoot?.querySelector('#image-link');
45
45
  expect(imageLink).to.exist;
46
46
  expect(imageLink?.getAttribute('title')).to.equal('View foo');
47
47
  });
48
48
  it('should render with creator element but not dates', async () => {
49
- const el = await fixture(html `
50
- <tile-list .model=${{ creators: ['someone'] }}></tile-list>
49
+ const el = await fixture(html `
50
+ <tile-list .model=${{ creators: ['someone'] }}></tile-list>
51
51
  `);
52
52
  const creator = el.shadowRoot?.querySelector('#creator');
53
53
  const datesLine = el.shadowRoot?.querySelector('#dates-line');
@@ -55,9 +55,9 @@ describe('List Tile', () => {
55
55
  expect(datesLine?.children.length).to.equal(0);
56
56
  });
57
57
  it('should render with snippet block when it has snippets', async () => {
58
- const el = await fixture(html `
59
- <tile-list .model=${{ snippets: ['some {{{snippet}}} text'] }}>
60
- </tile-list>
58
+ const el = await fixture(html `
59
+ <tile-list .model=${{ snippets: ['some {{{snippet}}} text'] }}>
60
+ </tile-list>
61
61
  `);
62
62
  const snippetBlock = el.shadowRoot?.querySelector('text-snippet-block');
63
63
  expect(snippetBlock).to.exist;
@@ -68,12 +68,12 @@ describe('List Tile', () => {
68
68
  expect(snippetBlock).to.not.exist;
69
69
  });
70
70
  it('should not render suppressed collections', async () => {
71
- const el = await fixture(html `
72
- <tile-list
73
- .model=${{ collections: ['deemphasize', 'community', 'foo'] }}
74
- .baseNavigationUrl=${'base'}
75
- >
76
- </tile-list>
71
+ const el = await fixture(html `
72
+ <tile-list
73
+ .model=${{ collections: ['deemphasize', 'community', 'foo'] }}
74
+ .baseNavigationUrl=${'base'}
75
+ >
76
+ </tile-list>
77
77
  `);
78
78
  const collectionsRow = el.shadowRoot?.getElementById('collections');
79
79
  expect(collectionsRow).to.exist;
@@ -82,12 +82,12 @@ describe('List Tile', () => {
82
82
  expect(collectionLinks?.item(0).getAttribute('href')).to.equal('base/details/foo');
83
83
  });
84
84
  it('should not render fav- collections', async () => {
85
- const el = await fixture(html `
86
- <tile-list
87
- .model=${{ collections: ['fav-foo', 'bar'] }}
88
- .baseNavigationUrl=${'base'}
89
- >
90
- </tile-list>
85
+ const el = await fixture(html `
86
+ <tile-list
87
+ .model=${{ collections: ['fav-foo', 'bar'] }}
88
+ .baseNavigationUrl=${'base'}
89
+ >
90
+ </tile-list>
91
91
  `);
92
92
  const collectionsRow = el.shadowRoot?.getElementById('collections');
93
93
  expect(collectionsRow).to.exist;
@@ -96,32 +96,32 @@ describe('List Tile', () => {
96
96
  expect(collectionLinks?.item(0).getAttribute('href')).to.equal('base/details/bar');
97
97
  });
98
98
  it('should render weekly views when sorting by week', async () => {
99
- const el = await fixture(html `
100
- <tile-list
101
- .model=${{ viewCount: 50, weeklyViewCount: 10 }}
102
- .sortParam=${{ field: 'week', direction: 'desc' }}
103
- >
104
- </tile-list>
99
+ const el = await fixture(html `
100
+ <tile-list
101
+ .model=${{ viewCount: 50, weeklyViewCount: 10 }}
102
+ .sortParam=${{ field: 'week', direction: 'desc' }}
103
+ >
104
+ </tile-list>
105
105
  `);
106
106
  const viewsRow = el.shadowRoot?.getElementById('views-line');
107
107
  expect(viewsRow).to.exist;
108
108
  expect(viewsRow?.textContent?.trim()).to.equal('Weekly views: 10');
109
109
  });
110
110
  it('should render all-time views when sorting by non-week field', async () => {
111
- const el = await fixture(html `
112
- <tile-list
113
- .model=${{ viewCount: 50, weeklyViewCount: 10 }}
114
- .sortParam=${{ field: 'downloads', direction: 'desc' }}
115
- >
116
- </tile-list>
111
+ const el = await fixture(html `
112
+ <tile-list
113
+ .model=${{ viewCount: 50, weeklyViewCount: 10 }}
114
+ .sortParam=${{ field: 'downloads', direction: 'desc' }}
115
+ >
116
+ </tile-list>
117
117
  `);
118
118
  const viewsRow = el.shadowRoot?.getElementById('views-line');
119
119
  expect(viewsRow).to.exist;
120
120
  expect(viewsRow?.textContent?.trim()).to.equal('All-time views: 50');
121
121
  });
122
122
  it('should render all-time views with no sort param', async () => {
123
- const el = await fixture(html `
124
- <tile-list .model=${{ viewCount: 50, weeklyViewCount: 10 }}> </tile-list>
123
+ const el = await fixture(html `
124
+ <tile-list .model=${{ viewCount: 50, weeklyViewCount: 10 }}> </tile-list>
125
125
  `);
126
126
  const viewsRow = el.shadowRoot?.getElementById('views-line');
127
127
  expect(viewsRow).to.exist;
@@ -134,12 +134,12 @@ describe('List Tile', () => {
134
134
  datePublished: new Date(2012, 0, 2),
135
135
  dateReviewed: new Date(2013, 0, 2),
136
136
  };
137
- const el = await fixture(html `
138
- <tile-list
139
- .model=${model}
140
- .sortParam=${{ field: 'date', direction: 'desc' }}
141
- >
142
- </tile-list>
137
+ const el = await fixture(html `
138
+ <tile-list
139
+ .model=${model}
140
+ .sortParam=${{ field: 'date', direction: 'desc' }}
141
+ >
142
+ </tile-list>
143
143
  `);
144
144
  const dateRow = el.shadowRoot?.getElementById('dates-line');
145
145
  expect(dateRow).to.exist;
@@ -152,12 +152,12 @@ describe('List Tile', () => {
152
152
  datePublished: new Date(2012, 0, 2),
153
153
  dateReviewed: new Date(2013, 0, 2),
154
154
  };
155
- const el = await fixture(html `
156
- <tile-list
157
- .model=${model}
158
- .sortParam=${{ field: 'addeddate', direction: 'desc' }}
159
- >
160
- </tile-list>
155
+ const el = await fixture(html `
156
+ <tile-list
157
+ .model=${model}
158
+ .sortParam=${{ field: 'addeddate', direction: 'desc' }}
159
+ >
160
+ </tile-list>
161
161
  `);
162
162
  const dateRow = el.shadowRoot?.getElementById('dates-line');
163
163
  expect(dateRow).to.exist;
@@ -170,12 +170,12 @@ describe('List Tile', () => {
170
170
  datePublished: new Date(2012, 0, 2),
171
171
  dateReviewed: new Date(2013, 0, 2),
172
172
  };
173
- const el = await fixture(html `
174
- <tile-list
175
- .model=${model}
176
- .sortParam=${{ field: 'publicdate', direction: 'desc' }}
177
- >
178
- </tile-list>
173
+ const el = await fixture(html `
174
+ <tile-list
175
+ .model=${model}
176
+ .sortParam=${{ field: 'publicdate', direction: 'desc' }}
177
+ >
178
+ </tile-list>
179
179
  `);
180
180
  const dateRow = el.shadowRoot?.getElementById('dates-line');
181
181
  expect(dateRow).to.exist;
@@ -188,12 +188,12 @@ describe('List Tile', () => {
188
188
  datePublished: new Date(2012, 0, 2),
189
189
  dateReviewed: new Date(2013, 0, 2),
190
190
  };
191
- const el = await fixture(html `
192
- <tile-list
193
- .model=${model}
194
- .sortParam=${{ field: 'reviewdate', direction: 'desc' }}
195
- >
196
- </tile-list>
191
+ const el = await fixture(html `
192
+ <tile-list
193
+ .model=${model}
194
+ .sortParam=${{ field: 'reviewdate', direction: 'desc' }}
195
+ >
196
+ </tile-list>
197
197
  `);
198
198
  const dateRow = el.shadowRoot?.getElementById('dates-line');
199
199
  expect(dateRow).to.exist;
@@ -203,12 +203,12 @@ describe('List Tile', () => {
203
203
  const model = {
204
204
  datePublished: new Date('2012-01-01T00:00:00Z'),
205
205
  };
206
- const el = await fixture(html `
207
- <tile-list
208
- .model=${model}
209
- .sortParam=${{ field: 'date', direction: 'desc' }}
210
- >
211
- </tile-list>
206
+ const el = await fixture(html `
207
+ <tile-list
208
+ .model=${model}
209
+ .sortParam=${{ field: 'date', direction: 'desc' }}
210
+ >
211
+ </tile-list>
212
212
  `);
213
213
  const dateRow = el.shadowRoot?.getElementById('dates-line');
214
214
  expect(dateRow).to.exist;
@@ -221,12 +221,12 @@ describe('List Tile', () => {
221
221
  datePublished: new Date(2012, 0, 1, 0, 0, 0, 0),
222
222
  dateReviewed: new Date(2013, 0, 1, 0, 0, 0, 0),
223
223
  };
224
- const el = await fixture(html `
225
- <tile-list
226
- .model=${model}
227
- .sortParam=${{ field: 'addeddate', direction: 'desc' }}
228
- >
229
- </tile-list>
224
+ const el = await fixture(html `
225
+ <tile-list
226
+ .model=${model}
227
+ .sortParam=${{ field: 'addeddate', direction: 'desc' }}
228
+ >
229
+ </tile-list>
230
230
  `);
231
231
  let dateRow = el.shadowRoot?.getElementById('dates-line');
232
232
  expect(dateRow).to.exist;
@@ -246,12 +246,12 @@ describe('List Tile', () => {
246
246
  const model = {
247
247
  datePublished: new Date('2012-02-15T00:00:00Z'),
248
248
  };
249
- const el = await fixture(html `
250
- <tile-list
251
- .model=${model}
252
- .sortParam=${{ field: 'date', direction: 'desc' }}
253
- >
254
- </tile-list>
249
+ const el = await fixture(html `
250
+ <tile-list
251
+ .model=${model}
252
+ .sortParam=${{ field: 'date', direction: 'desc' }}
253
+ >
254
+ </tile-list>
255
255
  `);
256
256
  const dateRow = el.shadowRoot?.getElementById('dates-line');
257
257
  expect(dateRow).to.exist;
@@ -279,13 +279,13 @@ describe('List Tile', () => {
279
279
  const model = {
280
280
  datePublished,
281
281
  };
282
- const el = await fixture(html `
283
- <tile-list
284
- useLocalTime
285
- .model=${model}
286
- .sortParam=${{ field: 'date', direction: 'desc' }}
287
- >
288
- </tile-list>
282
+ const el = await fixture(html `
283
+ <tile-list
284
+ useLocalTime
285
+ .model=${model}
286
+ .sortParam=${{ field: 'date', direction: 'desc' }}
287
+ >
288
+ </tile-list>
289
289
  `);
290
290
  const dateRow = el.shadowRoot?.getElementById('dates-line');
291
291
  expect(dateRow).to.exist;
@@ -297,8 +297,8 @@ describe('List Tile', () => {
297
297
  creators: ['bar'],
298
298
  source: 'baz',
299
299
  };
300
- const el = await fixture(html `
301
- <tile-list .model=${model}></tile-list>
300
+ const el = await fixture(html `
301
+ <tile-list .model=${model}></tile-list>
302
302
  `);
303
303
  const subjectLink = el.shadowRoot?.querySelector('#topics a[href]');
304
304
  expect(subjectLink).to.exist;
@@ -311,8 +311,8 @@ describe('List Tile', () => {
311
311
  expect(sourceLink?.getAttribute('href')).to.equal(`/search?query=${encodeURIComponent('source:"baz"')}`);
312
312
  });
313
313
  it('should render multi-line descriptions with spaces b/w lines', async () => {
314
- const el = await fixture(html `
315
- <tile-list .model=${{ description: 'line1\nline2' }}> </tile-list>
314
+ const el = await fixture(html `
315
+ <tile-list .model=${{ description: 'line1\nline2' }}> </tile-list>
316
316
  `);
317
317
  const descriptionBlock = el.shadowRoot?.getElementById('description');
318
318
  expect(descriptionBlock).to.exist;
@@ -322,11 +322,11 @@ describe('List Tile', () => {
322
322
  const model = {
323
323
  mediatype: 'texts',
324
324
  };
325
- const el = await fixture(html `
326
- <tile-list
327
- .baseNavigationUrl=${'https://archive.org'}
328
- .model=${model}
329
- ></tile-list>
325
+ const el = await fixture(html `
326
+ <tile-list
327
+ .baseNavigationUrl=${'https://archive.org'}
328
+ .model=${model}
329
+ ></tile-list>
330
330
  `);
331
331
  const mediatypeLink = el.shadowRoot?.querySelector('a#icon-right');
332
332
  expect(mediatypeLink).to.exist;
@@ -337,8 +337,8 @@ describe('List Tile', () => {
337
337
  const model = {
338
338
  mediatype: 'texts',
339
339
  };
340
- const el = await fixture(html `
341
- <tile-list .baseNavigationUrl=${''} .model=${model}></tile-list>
340
+ const el = await fixture(html `
341
+ <tile-list .baseNavigationUrl=${''} .model=${model}></tile-list>
342
342
  `);
343
343
  const mediatypeLink = el.shadowRoot?.querySelector('a#icon-right');
344
344
  expect(mediatypeLink).to.exist;
@@ -348,11 +348,11 @@ describe('List Tile', () => {
348
348
  const model = {
349
349
  mediatype: 'collection',
350
350
  };
351
- const el = await fixture(html `
352
- <tile-list
353
- .baseNavigationUrl=${'https://archive.org'}
354
- .model=${model}
355
- ></tile-list>
351
+ const el = await fixture(html `
352
+ <tile-list
353
+ .baseNavigationUrl=${'https://archive.org'}
354
+ .model=${model}
355
+ ></tile-list>
356
356
  `);
357
357
  const mediatypeLink = el.shadowRoot?.querySelector('a#icon-right');
358
358
  expect(mediatypeLink).to.exist;
@@ -362,25 +362,25 @@ describe('List Tile', () => {
362
362
  const model = {
363
363
  mediatype: 'account',
364
364
  };
365
- const el = await fixture(html `
366
- <tile-list
367
- .baseNavigationUrl=${'https://archive.org'}
368
- .model=${model}
369
- ></tile-list>
365
+ const el = await fixture(html `
366
+ <tile-list
367
+ .baseNavigationUrl=${'https://archive.org'}
368
+ .model=${model}
369
+ ></tile-list>
370
370
  `);
371
371
  const mediatypeLink = el.shadowRoot?.querySelector('a#icon-right');
372
372
  expect(mediatypeLink).to.exist;
373
373
  expect(mediatypeLink?.getAttribute('href')).not.to.exist;
374
374
  });
375
375
  it('should render date added for accounts', async () => {
376
- const el = await fixture(html `
377
- <tile-list
376
+ const el = await fixture(html `
377
+ <tile-list
378
378
  .model=${{
379
379
  mediatype: 'account',
380
380
  dateAdded: new Date('2015-05-05T00:00:00'),
381
- }}
382
- >
383
- </tile-list>
381
+ }}
382
+ >
383
+ </tile-list>
384
384
  `);
385
385
  const creatorBlock = el.shadowRoot?.getElementById('creator');
386
386
  expect(creatorBlock).to.exist;
@@ -391,14 +391,14 @@ describe('List Tile', () => {
391
391
  new Date('2010-01-02T12:34:56Z'),
392
392
  new Date('2011-02-03T12:43:21Z'),
393
393
  ];
394
- const el = await fixture(html `
395
- <tile-list
394
+ const el = await fixture(html `
395
+ <tile-list
396
396
  .model=${{
397
397
  identifier: 'foo',
398
398
  title: 'https://example.com/',
399
399
  captureDates,
400
- }}
401
- ></tile-list>
400
+ }}
401
+ ></tile-list>
402
402
  `);
403
403
  const captureDatesUl = el.shadowRoot?.querySelector('.capture-dates');
404
404
  expect(captureDatesUl, 'capture dates container').to.exist;
@@ -417,13 +417,13 @@ describe('List Tile', () => {
417
417
  new Date('2010-01-02T12:34:56Z'),
418
418
  new Date('2011-02-03T12:43:21Z'),
419
419
  ];
420
- const el = await fixture(html `
421
- <tile-list
420
+ const el = await fixture(html `
421
+ <tile-list
422
422
  .model=${{
423
423
  identifier: 'foo',
424
424
  captureDates,
425
- }}
426
- ></tile-list>
425
+ }}
426
+ ></tile-list>
427
427
  `);
428
428
  const captureDatesUl = el.shadowRoot?.querySelector('.capture-dates');
429
429
  expect(captureDatesUl).not.to.exist;
@@ -434,24 +434,24 @@ describe('List Tile', () => {
434
434
  body: 'foo bar baz',
435
435
  stars: 3,
436
436
  };
437
- const el = await fixture(html `
438
- <tile-list
437
+ const el = await fixture(html `
438
+ <tile-list
439
439
  .model=${{
440
440
  identifier: 'foo',
441
441
  review,
442
- }}
443
- ></tile-list>
442
+ }}
443
+ ></tile-list>
444
444
  `);
445
445
  const reviewBlock = el.shadowRoot?.querySelector('review-block');
446
446
  expect(reviewBlock).to.exist;
447
447
  });
448
448
  it('should not render review snippet block when no review is present', async () => {
449
- const el = await fixture(html `
450
- <tile-list
449
+ const el = await fixture(html `
450
+ <tile-list
451
451
  .model=${{
452
452
  identifier: 'foo',
453
- }}
454
- ></tile-list>
453
+ }}
454
+ ></tile-list>
455
455
  `);
456
456
  const reviewBlock = el.shadowRoot?.querySelector('review-block');
457
457
  expect(reviewBlock).not.to.exist;