@internetarchive/collection-browser 1.4.1 → 1.4.2-alpha.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.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/app-root.d.ts +3 -0
- package/dist/src/app-root.js +27 -1
- package/dist/src/app-root.js.map +1 -1
- package/dist/src/collection-browser.d.ts +8 -0
- package/dist/src/collection-browser.js +42 -16
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/facets-template.d.ts +1 -0
- package/dist/src/collection-facets/facets-template.js +8 -1
- package/dist/src/collection-facets/facets-template.js.map +1 -1
- package/dist/src/collection-facets.d.ts +1 -0
- package/dist/src/collection-facets.js +5 -0
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js +1 -1
- package/dist/src/sort-filter-bar/alpha-bar.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.d.ts +1 -0
- package/dist/src/tiles/list/tile-list-compact.js +10 -4
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.d.ts +1 -0
- package/dist/src/tiles/list/tile-list.js +15 -6
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +1 -0
- package/dist/src/tiles/tile-dispatcher.js +12 -4
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/index.ts +1 -1
- package/package.json +1 -1
- package/src/app-root.ts +26 -0
- package/src/collection-browser.ts +43 -15
- package/src/collection-facets/facets-template.ts +3 -1
- package/src/collection-facets.ts +3 -0
- package/src/sort-filter-bar/alpha-bar.ts +1 -1
- package/src/tiles/list/tile-list-compact.ts +10 -3
- package/src/tiles/list/tile-list.ts +21 -8
- package/src/tiles/tile-dispatcher.ts +12 -3
|
@@ -49,6 +49,8 @@ export class TileList extends LitElement {
|
|
|
49
49
|
|
|
50
50
|
@property({ type: Boolean }) loggedIn = false;
|
|
51
51
|
|
|
52
|
+
@property({ type: String }) collectionPagePath: string = '/details/';
|
|
53
|
+
|
|
52
54
|
render() {
|
|
53
55
|
return html`
|
|
54
56
|
<div id="list-line" class="${this.classSize}">
|
|
@@ -93,10 +95,11 @@ export class TileList extends LitElement {
|
|
|
93
95
|
private get imageBlockTemplate() {
|
|
94
96
|
if (!this.model) return nothing;
|
|
95
97
|
|
|
98
|
+
const isCollection = this.model.mediatype === 'collection';
|
|
96
99
|
return html`<a
|
|
97
|
-
href="${this.baseNavigationUrl}
|
|
98
|
-
this.
|
|
99
|
-
|
|
100
|
+
href="${this.baseNavigationUrl}${isCollection
|
|
101
|
+
? this.collectionPagePath
|
|
102
|
+
: '/details/'}${encodeURI(this.model.identifier)}"
|
|
100
103
|
>
|
|
101
104
|
<image-block
|
|
102
105
|
.model=${this.model}
|
|
@@ -148,7 +151,11 @@ export class TileList extends LitElement {
|
|
|
148
151
|
? html`<a href="${this.baseNavigationUrl}${this.model.href}"
|
|
149
152
|
>${this.model.title ?? this.model.identifier}</a
|
|
150
153
|
>`
|
|
151
|
-
: this.detailsLink(
|
|
154
|
+
: this.detailsLink(
|
|
155
|
+
this.model.identifier,
|
|
156
|
+
this.model.title,
|
|
157
|
+
this.model.mediatype === 'collection'
|
|
158
|
+
);
|
|
152
159
|
}
|
|
153
160
|
|
|
154
161
|
private get itemLineTemplate() {
|
|
@@ -341,12 +348,18 @@ export class TileList extends LitElement {
|
|
|
341
348
|
/* eslint-enable lit/no-invalid-html */
|
|
342
349
|
}
|
|
343
350
|
|
|
344
|
-
private detailsLink(
|
|
351
|
+
private detailsLink(
|
|
352
|
+
identifier: string,
|
|
353
|
+
text?: string,
|
|
354
|
+
collection = false
|
|
355
|
+
): TemplateResult {
|
|
345
356
|
const linkText = text ?? identifier;
|
|
346
357
|
// No whitespace after closing tag
|
|
347
358
|
// identifiers (all ASCII in their creation) should be safe to use in href, but sanitize anyway
|
|
348
359
|
return html`<a
|
|
349
|
-
href="${this.baseNavigationUrl}
|
|
360
|
+
href="${this.baseNavigationUrl}${collection
|
|
361
|
+
? this.collectionPagePath
|
|
362
|
+
: '/details/'}${encodeURI(identifier)}"
|
|
350
363
|
>${DOMPurify.sanitize(linkText)}</a
|
|
351
364
|
>`;
|
|
352
365
|
}
|
|
@@ -364,7 +377,7 @@ export class TileList extends LitElement {
|
|
|
364
377
|
case 'account':
|
|
365
378
|
return nothing;
|
|
366
379
|
default:
|
|
367
|
-
return `${this.baseNavigationUrl}
|
|
380
|
+
return `${this.baseNavigationUrl}${this.collectionPagePath}${encodeURI(
|
|
368
381
|
this.model.mediatype
|
|
369
382
|
)}`;
|
|
370
383
|
}
|
|
@@ -398,7 +411,7 @@ export class TileList extends LitElement {
|
|
|
398
411
|
promises.push(
|
|
399
412
|
this.collectionNameCache?.collectionNameFor(collection).then(name => {
|
|
400
413
|
newCollectionLinks.push(
|
|
401
|
-
this.detailsLink(collection, name ?? collection)
|
|
414
|
+
this.detailsLink(collection, name ?? collection, true)
|
|
402
415
|
);
|
|
403
416
|
})
|
|
404
417
|
);
|
|
@@ -56,6 +56,8 @@ export class TileDispatcher
|
|
|
56
56
|
/** Whether this tile should include a hover pane at all (for applicable tile modes) */
|
|
57
57
|
@property({ type: Boolean }) enableHoverPane = false;
|
|
58
58
|
|
|
59
|
+
@property({ type: String }) collectionPagePath: string = '/details/';
|
|
60
|
+
|
|
59
61
|
private hoverPaneController?: HoverPaneControllerInterface;
|
|
60
62
|
|
|
61
63
|
@query('#container')
|
|
@@ -140,9 +142,14 @@ export class TileDispatcher
|
|
|
140
142
|
private get linkTileHref() {
|
|
141
143
|
// Use the server-specified href if available.
|
|
142
144
|
// Otherwise, construct a details page URL from the item identifier.
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
145
|
+
if (this.model?.href) {
|
|
146
|
+
return `${this.baseNavigationUrl}${this.model?.href}`;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
const isCollection = this.model?.mediatype === 'collection';
|
|
150
|
+
return `${this.baseNavigationUrl}${
|
|
151
|
+
isCollection ? this.collectionPagePath : '/details/'
|
|
152
|
+
}${this.model?.identifier}`;
|
|
146
153
|
}
|
|
147
154
|
|
|
148
155
|
/**
|
|
@@ -266,6 +273,7 @@ export class TileDispatcher
|
|
|
266
273
|
case 'list-compact':
|
|
267
274
|
return html`<tile-list-compact
|
|
268
275
|
.model=${model}
|
|
276
|
+
.collectionPagePath=${this.collectionPagePath}
|
|
269
277
|
.currentWidth=${currentWidth}
|
|
270
278
|
.currentHeight=${currentHeight}
|
|
271
279
|
.baseNavigationUrl=${baseNavigationUrl}
|
|
@@ -278,6 +286,7 @@ export class TileDispatcher
|
|
|
278
286
|
case 'list-detail':
|
|
279
287
|
return html`<tile-list
|
|
280
288
|
.model=${model}
|
|
289
|
+
.collectionPagePath=${this.collectionPagePath}
|
|
281
290
|
.collectionNameCache=${this.collectionNameCache}
|
|
282
291
|
.currentWidth=${currentWidth}
|
|
283
292
|
.currentHeight=${currentHeight}
|