@internetarchive/collection-browser 3.3.1 → 3.3.3
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/.editorconfig +29 -29
- package/.github/workflows/ci.yml +27 -27
- package/.github/workflows/gh-pages-main.yml +39 -39
- package/.github/workflows/npm-publish.yml +39 -39
- package/.github/workflows/pr-preview.yml +38 -38
- package/.husky/pre-commit +4 -4
- package/.prettierignore +1 -1
- package/LICENSE +661 -661
- package/README.md +83 -83
- package/dist/src/collection-browser.js +683 -683
- package/dist/src/collection-browser.js.map +1 -1
- package/dist/src/collection-facets/more-facets-content.js +118 -118
- package/dist/src/collection-facets/more-facets-content.js.map +1 -1
- package/dist/src/collection-facets.js +265 -266
- package/dist/src/collection-facets.js.map +1 -1
- package/dist/src/data-source/collection-browser-data-source.js.map +1 -1
- package/dist/src/data-source/collection-browser-query-state.js.map +1 -1
- package/dist/src/data-source/models.js.map +1 -1
- package/dist/src/tiles/base-tile-component.js.map +1 -1
- package/dist/src/tiles/grid/account-tile.js +36 -36
- package/dist/src/tiles/grid/account-tile.js.map +1 -1
- package/dist/src/tiles/grid/collection-tile.js +77 -77
- package/dist/src/tiles/grid/collection-tile.js.map +1 -1
- package/dist/src/tiles/grid/item-tile.js +137 -137
- package/dist/src/tiles/grid/item-tile.js.map +1 -1
- package/dist/src/tiles/hover/hover-pane-controller.d.ts +9 -1
- package/dist/src/tiles/hover/hover-pane-controller.js +105 -37
- package/dist/src/tiles/hover/hover-pane-controller.js.map +1 -1
- package/dist/src/tiles/hover/tile-hover-pane.d.ts +1 -0
- package/dist/src/tiles/hover/tile-hover-pane.js +115 -112
- package/dist/src/tiles/hover/tile-hover-pane.js.map +1 -1
- package/dist/src/tiles/list/tile-list-compact.js +99 -99
- package/dist/src/tiles/list/tile-list-compact.js.map +1 -1
- package/dist/src/tiles/list/tile-list.js +297 -297
- package/dist/src/tiles/list/tile-list.js.map +1 -1
- package/dist/src/tiles/tile-dispatcher.d.ts +4 -1
- package/dist/src/tiles/tile-dispatcher.js +231 -204
- package/dist/src/tiles/tile-dispatcher.js.map +1 -1
- package/dist/src/utils/format-date.js.map +1 -1
- package/dist/test/collection-browser.test.js +189 -189
- package/dist/test/collection-browser.test.js.map +1 -1
- package/dist/test/tiles/grid/item-tile.test.js +77 -77
- package/dist/test/tiles/grid/item-tile.test.js.map +1 -1
- package/dist/test/tiles/hover/hover-pane-controller.test.js +68 -21
- package/dist/test/tiles/hover/hover-pane-controller.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list-compact.test.js +70 -70
- package/dist/test/tiles/list/tile-list-compact.test.js.map +1 -1
- package/dist/test/tiles/list/tile-list.test.js +126 -126
- package/dist/test/tiles/list/tile-list.test.js.map +1 -1
- package/dist/test/tiles/tile-dispatcher.test.js +130 -52
- package/dist/test/tiles/tile-dispatcher.test.js.map +1 -1
- package/dist/test/utils/format-date.test.js.map +1 -1
- package/eslint.config.mjs +53 -53
- package/index.html +24 -24
- package/local.archive.org.cert +86 -86
- package/local.archive.org.key +27 -27
- package/package.json +118 -117
- package/renovate.json +6 -6
- package/src/collection-browser.ts +2829 -2829
- package/src/collection-facets/more-facets-content.ts +639 -639
- package/src/collection-facets.ts +994 -995
- package/src/data-source/collection-browser-data-source.ts +1401 -1401
- package/src/data-source/collection-browser-query-state.ts +65 -65
- package/src/data-source/models.ts +43 -43
- package/src/tiles/base-tile-component.ts +65 -65
- package/src/tiles/grid/account-tile.ts +113 -113
- package/src/tiles/grid/collection-tile.ts +163 -163
- package/src/tiles/grid/item-tile.ts +340 -340
- package/src/tiles/hover/hover-pane-controller.ts +613 -517
- package/src/tiles/hover/tile-hover-pane.ts +184 -180
- package/src/tiles/list/tile-list-compact.ts +239 -239
- package/src/tiles/list/tile-list.ts +700 -700
- package/src/tiles/tile-dispatcher.ts +517 -490
- package/src/utils/format-date.ts +62 -62
- package/test/collection-browser.test.ts +2403 -2403
- package/test/tiles/grid/item-tile.test.ts +520 -520
- package/test/tiles/hover/hover-pane-controller.test.ts +418 -353
- package/test/tiles/list/tile-list-compact.test.ts +282 -282
- package/test/tiles/list/tile-list.test.ts +552 -552
- package/test/tiles/tile-dispatcher.test.ts +283 -187
- package/test/utils/format-date.test.ts +89 -89
- package/tsconfig.json +20 -20
- package/web-dev-server.config.mjs +30 -30
- package/web-test-runner.config.mjs +41 -41
|
@@ -14,6 +14,7 @@ import './list/tile-list-compact';
|
|
|
14
14
|
import './list/tile-list-compact-header';
|
|
15
15
|
import { BaseTileComponent } from './base-tile-component';
|
|
16
16
|
import { HoverPaneController, } from './hover/hover-pane-controller';
|
|
17
|
+
import { srOnlyStyle } from '../styles/sr-only';
|
|
17
18
|
let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileComponent {
|
|
18
19
|
constructor() {
|
|
19
20
|
/*
|
|
@@ -41,17 +42,25 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
41
42
|
this.enableHoverPane = false;
|
|
42
43
|
this.manageCheckTitle = msg('Remove this item from the list');
|
|
43
44
|
}
|
|
45
|
+
acquireFocus() {
|
|
46
|
+
var _a;
|
|
47
|
+
(_a = this.tileLinkElement) === null || _a === void 0 ? void 0 : _a.focus();
|
|
48
|
+
}
|
|
49
|
+
releaseFocus() {
|
|
50
|
+
var _a;
|
|
51
|
+
(_a = this.tileLinkElement) === null || _a === void 0 ? void 0 : _a.blur();
|
|
52
|
+
}
|
|
44
53
|
render() {
|
|
45
54
|
var _a, _b;
|
|
46
55
|
const isGridMode = this.tileDisplayMode === 'grid';
|
|
47
56
|
const hoverPaneTemplate = (_b = (_a = this.hoverPaneController) === null || _a === void 0 ? void 0 : _a.getTemplate()) !== null && _b !== void 0 ? _b : nothing;
|
|
48
|
-
return html `
|
|
49
|
-
<div id="container" class=${isGridMode ? 'hoverable' :
|
|
57
|
+
return html `
|
|
58
|
+
<div id="container" class=${isGridMode ? 'hoverable' : ''}>
|
|
50
59
|
${this.tileDisplayMode === 'list-header'
|
|
51
60
|
? this.headerTemplate
|
|
52
|
-
: this.tileTemplate}
|
|
53
|
-
${this.manageCheckTemplate} ${hoverPaneTemplate}
|
|
54
|
-
</div>
|
|
61
|
+
: this.tileTemplate}
|
|
62
|
+
${this.manageCheckTemplate} ${hoverPaneTemplate}
|
|
63
|
+
</div>
|
|
55
64
|
`;
|
|
56
65
|
}
|
|
57
66
|
firstUpdated() {
|
|
@@ -64,37 +73,43 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
64
73
|
}
|
|
65
74
|
get headerTemplate() {
|
|
66
75
|
const { currentWidth, sortParam, defaultSortParam, mobileBreakpoint } = this;
|
|
67
|
-
return html `
|
|
68
|
-
<tile-list-compact-header
|
|
69
|
-
class="header"
|
|
70
|
-
.currentWidth=${currentWidth}
|
|
71
|
-
.sortParam=${sortParam !== null && sortParam !== void 0 ? sortParam : defaultSortParam}
|
|
72
|
-
.mobileBreakpoint=${mobileBreakpoint}
|
|
73
|
-
>
|
|
74
|
-
</tile-list-compact-header>
|
|
76
|
+
return html `
|
|
77
|
+
<tile-list-compact-header
|
|
78
|
+
class="header"
|
|
79
|
+
.currentWidth=${currentWidth}
|
|
80
|
+
.sortParam=${sortParam !== null && sortParam !== void 0 ? sortParam : defaultSortParam}
|
|
81
|
+
.mobileBreakpoint=${mobileBreakpoint}
|
|
82
|
+
>
|
|
83
|
+
</tile-list-compact-header>
|
|
75
84
|
`;
|
|
76
85
|
}
|
|
77
86
|
get tileTemplate() {
|
|
78
|
-
return html `
|
|
87
|
+
return html `
|
|
79
88
|
${this.tileDisplayMode === 'list-detail'
|
|
80
89
|
? this.tile
|
|
81
|
-
: this.linkTileTemplate}
|
|
90
|
+
: this.linkTileTemplate}
|
|
82
91
|
`;
|
|
83
92
|
}
|
|
84
93
|
get linkTileTemplate() {
|
|
85
94
|
var _a, _b, _c;
|
|
86
|
-
return html `
|
|
87
|
-
<a
|
|
88
|
-
href=${this.linkTileHref}
|
|
89
|
-
aria-label=${(_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : 'Untitled item'}
|
|
95
|
+
return html `
|
|
96
|
+
<a
|
|
97
|
+
href=${this.linkTileHref}
|
|
98
|
+
aria-label=${(_b = (_a = this.model) === null || _a === void 0 ? void 0 : _a.title) !== null && _b !== void 0 ? _b : 'Untitled item'}
|
|
99
|
+
aria-describedby="link-aria-description"
|
|
100
|
+
aria-haspopup=${this.shouldPrepareHoverPane ? 'dialog' : 'false'}
|
|
90
101
|
title=${this.shouldPrepareHoverPane
|
|
91
102
|
? nothing // Don't show title tooltips when we have the tile info popups
|
|
92
|
-
: ifDefined((_c = this.model) === null || _c === void 0 ? void 0 : _c.title)}
|
|
93
|
-
@click=${this.handleLinkClicked}
|
|
94
|
-
@contextmenu=${this.handleLinkContextMenu}
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
103
|
+
: ifDefined((_c = this.model) === null || _c === void 0 ? void 0 : _c.title)}
|
|
104
|
+
@click=${this.handleLinkClicked}
|
|
105
|
+
@contextmenu=${this.handleLinkContextMenu}
|
|
106
|
+
class="tile-link"
|
|
107
|
+
>
|
|
108
|
+
${this.tile}
|
|
109
|
+
</a>
|
|
110
|
+
<div id="link-aria-description" class="sr-only">
|
|
111
|
+
${msg('Press Down Arrow to preview item details')}
|
|
112
|
+
</div>
|
|
98
113
|
`;
|
|
99
114
|
}
|
|
100
115
|
get linkTileHref() {
|
|
@@ -112,15 +127,15 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
112
127
|
var _a;
|
|
113
128
|
if (!this.isManageView || this.tileDisplayMode !== 'grid')
|
|
114
129
|
return nothing;
|
|
115
|
-
return html `
|
|
116
|
-
<div class="manage-check">
|
|
117
|
-
<input
|
|
118
|
-
type="checkbox"
|
|
119
|
-
title=${this.manageCheckTitle}
|
|
120
|
-
|
|
121
|
-
@change=${this.handleLinkClicked}
|
|
122
|
-
/>
|
|
123
|
-
</div>
|
|
130
|
+
return html `
|
|
131
|
+
<div class="manage-check">
|
|
132
|
+
<input
|
|
133
|
+
type="checkbox"
|
|
134
|
+
title=${this.manageCheckTitle}
|
|
135
|
+
?checked=${(_a = this.model) === null || _a === void 0 ? void 0 : _a.checked}
|
|
136
|
+
@change=${this.handleLinkClicked}
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
124
139
|
`;
|
|
125
140
|
}
|
|
126
141
|
/**
|
|
@@ -212,193 +227,202 @@ let TileDispatcher = TileDispatcher_1 = class TileDispatcher extends BaseTileCom
|
|
|
212
227
|
case 'grid':
|
|
213
228
|
switch (model.mediatype) {
|
|
214
229
|
case 'collection':
|
|
215
|
-
return html `<collection-tile
|
|
216
|
-
.model=${model}
|
|
217
|
-
.collectionPagePath=${collectionPagePath}
|
|
218
|
-
.baseImageUrl=${this.baseImageUrl}
|
|
219
|
-
.currentWidth=${currentWidth}
|
|
220
|
-
.currentHeight=${currentHeight}
|
|
221
|
-
.creatorFilter=${creatorFilter}
|
|
222
|
-
.suppressBlurring=${this.suppressBlurring}
|
|
223
|
-
.isManageView=${this.isManageView}
|
|
224
|
-
?showInfoButton=${!this.isHoverEnabled}
|
|
225
|
-
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
226
|
-
>
|
|
230
|
+
return html `<collection-tile
|
|
231
|
+
.model=${model}
|
|
232
|
+
.collectionPagePath=${collectionPagePath}
|
|
233
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
234
|
+
.currentWidth=${currentWidth}
|
|
235
|
+
.currentHeight=${currentHeight}
|
|
236
|
+
.creatorFilter=${creatorFilter}
|
|
237
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
238
|
+
.isManageView=${this.isManageView}
|
|
239
|
+
?showInfoButton=${!this.isHoverEnabled}
|
|
240
|
+
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
241
|
+
>
|
|
227
242
|
</collection-tile>`;
|
|
228
243
|
case 'account':
|
|
229
|
-
return html `<account-tile
|
|
230
|
-
.model=${model}
|
|
231
|
-
.collectionPagePath=${collectionPagePath}
|
|
232
|
-
.baseImageUrl=${this.baseImageUrl}
|
|
233
|
-
.currentWidth=${currentWidth}
|
|
234
|
-
.currentHeight=${currentHeight}
|
|
235
|
-
.creatorFilter=${creatorFilter}
|
|
236
|
-
.suppressBlurring=${this.suppressBlurring}
|
|
237
|
-
.isManageView=${this.isManageView}
|
|
238
|
-
?showInfoButton=${!this.isHoverEnabled}
|
|
239
|
-
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
240
|
-
>
|
|
244
|
+
return html `<account-tile
|
|
245
|
+
.model=${model}
|
|
246
|
+
.collectionPagePath=${collectionPagePath}
|
|
247
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
248
|
+
.currentWidth=${currentWidth}
|
|
249
|
+
.currentHeight=${currentHeight}
|
|
250
|
+
.creatorFilter=${creatorFilter}
|
|
251
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
252
|
+
.isManageView=${this.isManageView}
|
|
253
|
+
?showInfoButton=${!this.isHoverEnabled}
|
|
254
|
+
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
255
|
+
>
|
|
241
256
|
</account-tile>`;
|
|
242
257
|
case 'search':
|
|
243
|
-
return html `<search-tile
|
|
244
|
-
.model=${model}
|
|
245
|
-
.collectionPagePath=${collectionPagePath}
|
|
246
|
-
.baseImageUrl=${this.baseImageUrl}
|
|
247
|
-
.currentWidth=${currentWidth}
|
|
248
|
-
.currentHeight=${currentHeight}
|
|
249
|
-
.creatorFilter=${creatorFilter}
|
|
250
|
-
.suppressBlurring=${this.suppressBlurring}
|
|
251
|
-
.isManageView=${this.isManageView}
|
|
252
|
-
?showInfoButton=${false}
|
|
253
|
-
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
254
|
-
>
|
|
258
|
+
return html `<search-tile
|
|
259
|
+
.model=${model}
|
|
260
|
+
.collectionPagePath=${collectionPagePath}
|
|
261
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
262
|
+
.currentWidth=${currentWidth}
|
|
263
|
+
.currentHeight=${currentHeight}
|
|
264
|
+
.creatorFilter=${creatorFilter}
|
|
265
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
266
|
+
.isManageView=${this.isManageView}
|
|
267
|
+
?showInfoButton=${false}
|
|
268
|
+
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
269
|
+
>
|
|
255
270
|
</search-tile>`;
|
|
256
271
|
default:
|
|
257
|
-
return html `<item-tile
|
|
258
|
-
.model=${model}
|
|
259
|
-
.collectionPagePath=${collectionPagePath}
|
|
260
|
-
.currentWidth=${this.currentWidth}
|
|
261
|
-
.currentHeight=${this.currentHeight}
|
|
262
|
-
.baseImageUrl=${this.baseImageUrl}
|
|
263
|
-
.sortParam=${sortParam}
|
|
264
|
-
.defaultSortParam=${defaultSortParam}
|
|
265
|
-
.creatorFilter=${creatorFilter}
|
|
266
|
-
.loggedIn=${this.loggedIn}
|
|
267
|
-
.suppressBlurring=${this.suppressBlurring}
|
|
268
|
-
.isManageView=${this.isManageView}
|
|
269
|
-
.simpleLayoutType=${this.simpleLayoutType}
|
|
270
|
-
?showTvClips=${this.showTvClips}
|
|
271
|
-
?showInfoButton=${!this.isHoverEnabled}
|
|
272
|
-
?useLocalTime=${this.useLocalTime}
|
|
273
|
-
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
274
|
-
>
|
|
272
|
+
return html `<item-tile
|
|
273
|
+
.model=${model}
|
|
274
|
+
.collectionPagePath=${collectionPagePath}
|
|
275
|
+
.currentWidth=${this.currentWidth}
|
|
276
|
+
.currentHeight=${this.currentHeight}
|
|
277
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
278
|
+
.sortParam=${sortParam}
|
|
279
|
+
.defaultSortParam=${defaultSortParam}
|
|
280
|
+
.creatorFilter=${creatorFilter}
|
|
281
|
+
.loggedIn=${this.loggedIn}
|
|
282
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
283
|
+
.isManageView=${this.isManageView}
|
|
284
|
+
.simpleLayoutType=${this.simpleLayoutType}
|
|
285
|
+
?showTvClips=${this.showTvClips}
|
|
286
|
+
?showInfoButton=${!this.isHoverEnabled}
|
|
287
|
+
?useLocalTime=${this.useLocalTime}
|
|
288
|
+
@infoButtonPressed=${this.tileInfoButtonPressed}
|
|
289
|
+
>
|
|
275
290
|
</item-tile>`;
|
|
276
291
|
}
|
|
277
292
|
case 'list-compact':
|
|
278
|
-
return html `<tile-list-compact
|
|
279
|
-
.model=${model}
|
|
280
|
-
.collectionPagePath=${collectionPagePath}
|
|
281
|
-
.currentWidth=${currentWidth}
|
|
282
|
-
.currentHeight=${currentHeight}
|
|
283
|
-
.baseNavigationUrl=${baseNavigationUrl}
|
|
284
|
-
.sortParam=${sortParam}
|
|
285
|
-
.defaultSortParam=${defaultSortParam}
|
|
286
|
-
.creatorFilter=${creatorFilter}
|
|
287
|
-
.mobileBreakpoint=${mobileBreakpoint}
|
|
288
|
-
.baseImageUrl=${this.baseImageUrl}
|
|
289
|
-
.loggedIn=${this.loggedIn}
|
|
290
|
-
.suppressBlurring=${this.suppressBlurring}
|
|
291
|
-
?useLocalTime=${this.useLocalTime}
|
|
292
|
-
>
|
|
293
|
+
return html `<tile-list-compact
|
|
294
|
+
.model=${model}
|
|
295
|
+
.collectionPagePath=${collectionPagePath}
|
|
296
|
+
.currentWidth=${currentWidth}
|
|
297
|
+
.currentHeight=${currentHeight}
|
|
298
|
+
.baseNavigationUrl=${baseNavigationUrl}
|
|
299
|
+
.sortParam=${sortParam}
|
|
300
|
+
.defaultSortParam=${defaultSortParam}
|
|
301
|
+
.creatorFilter=${creatorFilter}
|
|
302
|
+
.mobileBreakpoint=${mobileBreakpoint}
|
|
303
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
304
|
+
.loggedIn=${this.loggedIn}
|
|
305
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
306
|
+
?useLocalTime=${this.useLocalTime}
|
|
307
|
+
>
|
|
293
308
|
</tile-list-compact>`;
|
|
294
309
|
case 'list-detail':
|
|
295
|
-
return html `<tile-list
|
|
296
|
-
.model=${model}
|
|
297
|
-
.collectionPagePath=${collectionPagePath}
|
|
298
|
-
.collectionTitles=${this.collectionTitles}
|
|
299
|
-
.currentWidth=${currentWidth}
|
|
300
|
-
.currentHeight=${currentHeight}
|
|
301
|
-
.baseNavigationUrl=${baseNavigationUrl}
|
|
302
|
-
.sortParam=${sortParam}
|
|
303
|
-
.defaultSortParam=${defaultSortParam}
|
|
304
|
-
.creatorFilter=${creatorFilter}
|
|
305
|
-
.mobileBreakpoint=${mobileBreakpoint}
|
|
306
|
-
.baseImageUrl=${this.baseImageUrl}
|
|
307
|
-
.loggedIn=${this.loggedIn}
|
|
308
|
-
.suppressBlurring=${this.suppressBlurring}
|
|
309
|
-
?useLocalTime=${this.useLocalTime}
|
|
310
|
-
>
|
|
310
|
+
return html `<tile-list
|
|
311
|
+
.model=${model}
|
|
312
|
+
.collectionPagePath=${collectionPagePath}
|
|
313
|
+
.collectionTitles=${this.collectionTitles}
|
|
314
|
+
.currentWidth=${currentWidth}
|
|
315
|
+
.currentHeight=${currentHeight}
|
|
316
|
+
.baseNavigationUrl=${baseNavigationUrl}
|
|
317
|
+
.sortParam=${sortParam}
|
|
318
|
+
.defaultSortParam=${defaultSortParam}
|
|
319
|
+
.creatorFilter=${creatorFilter}
|
|
320
|
+
.mobileBreakpoint=${mobileBreakpoint}
|
|
321
|
+
.baseImageUrl=${this.baseImageUrl}
|
|
322
|
+
.loggedIn=${this.loggedIn}
|
|
323
|
+
.suppressBlurring=${this.suppressBlurring}
|
|
324
|
+
?useLocalTime=${this.useLocalTime}
|
|
325
|
+
>
|
|
311
326
|
</tile-list>`;
|
|
312
327
|
default:
|
|
313
328
|
return nothing;
|
|
314
329
|
}
|
|
315
330
|
}
|
|
316
331
|
static get styles() {
|
|
317
|
-
return
|
|
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
|
-
|
|
332
|
+
return [
|
|
333
|
+
srOnlyStyle,
|
|
334
|
+
css `
|
|
335
|
+
:host {
|
|
336
|
+
display: block;
|
|
337
|
+
height: 100%;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
collection-tile {
|
|
341
|
+
--tileBorderColor: #555555;
|
|
342
|
+
--tileBackgroundColor: #666666;
|
|
343
|
+
--imageBlockBackgroundColor: #666666;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
account-tile {
|
|
347
|
+
--tileBorderColor: #dddddd;
|
|
348
|
+
--imageBlockBackgroundColor: #fcf5e6;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
item-tile {
|
|
352
|
+
--tileBorderColor: #dddddd;
|
|
353
|
+
--imageBlockBackgroundColor: #f1f1f4;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
search-tile {
|
|
357
|
+
--tileBorderColor: #555555;
|
|
358
|
+
--tileBackgroundColor: #666666;
|
|
359
|
+
--imageBlockBackgroundColor: #666666;
|
|
360
|
+
--iconFillColor: #2c2c2c;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
#container {
|
|
364
|
+
position: relative;
|
|
365
|
+
height: 100%;
|
|
366
|
+
border-radius: 4px;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
#container.hoverable a:focus,
|
|
370
|
+
#container.hoverable a:hover {
|
|
371
|
+
box-shadow: var(
|
|
372
|
+
--tileHoverBoxShadow,
|
|
373
|
+
0 0 6px 2px rgba(8, 8, 32, 0.8)
|
|
374
|
+
);
|
|
375
|
+
transition: box-shadow 0.1s ease;
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
a {
|
|
379
|
+
display: block;
|
|
380
|
+
height: 100%;
|
|
381
|
+
color: unset;
|
|
382
|
+
text-decoration: none;
|
|
383
|
+
transition: transform 0.05s ease;
|
|
384
|
+
border-radius: 4px;
|
|
385
|
+
outline: none;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
a :first-child {
|
|
389
|
+
display: block;
|
|
390
|
+
height: 100%;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.manage-check {
|
|
394
|
+
position: absolute;
|
|
395
|
+
right: 0;
|
|
396
|
+
top: 0;
|
|
397
|
+
border: 5px solid #2c2c2c;
|
|
398
|
+
border-radius: 3px;
|
|
399
|
+
background-color: #2c2c2c;
|
|
400
|
+
z-index: 1;
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
.manage-check > input[type='checkbox'] {
|
|
404
|
+
display: block;
|
|
405
|
+
margin: 0;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
#touch-backdrop {
|
|
409
|
+
position: fixed;
|
|
410
|
+
width: 100vw;
|
|
411
|
+
height: 100vh;
|
|
412
|
+
top: 0;
|
|
413
|
+
left: 0;
|
|
414
|
+
z-index: 2;
|
|
415
|
+
background: transparent;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
tile-hover-pane {
|
|
419
|
+
position: absolute;
|
|
420
|
+
top: 0;
|
|
421
|
+
left: -9999px;
|
|
422
|
+
z-index: 2;
|
|
423
|
+
}
|
|
424
|
+
`,
|
|
425
|
+
];
|
|
402
426
|
}
|
|
403
427
|
};
|
|
404
428
|
/** Maps each display mode to whether hover panes should appear in that mode */
|
|
@@ -438,6 +462,9 @@ __decorate([
|
|
|
438
462
|
__decorate([
|
|
439
463
|
query('tile-hover-pane')
|
|
440
464
|
], TileDispatcher.prototype, "hoverPane", void 0);
|
|
465
|
+
__decorate([
|
|
466
|
+
query('.tile-link')
|
|
467
|
+
], TileDispatcher.prototype, "tileLinkElement", void 0);
|
|
441
468
|
TileDispatcher = TileDispatcher_1 = __decorate([
|
|
442
469
|
customElement('tile-dispatcher')
|
|
443
470
|
], TileDispatcher);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC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;;;;;KAoFT,CAAC;IACJ,CAAC;;AAvZD,+EAA+E;AACvD,uCAAwB,GAG5C;IACF,IAAI,EAAE,IAAI;IACV,cAAc,EAAE,IAAI;IACpB,aAAa,EAAE,KAAK;IACpB,aAAa,EAAE,KAAK;CACrB,AAR+C,CAQ9C;AAtC0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uDAAmC;AAEjC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;oDAAsB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAgD;AAG3E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDACS;AAEP;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAqB;AAGrB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA6C;AAG3C;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uDAAyB;AAEzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAEzB;AAKM;IADP,KAAK,CAAC,YAAY,CAAC;iDACe;AAG3B;IADP,KAAK,CAAC,iBAAiB,CAAC;iDACS;AAlDvB,cAAc;IAD1B,aAAa,CAAC,iBAAiB,CAAC;GACpB,cAAc,CA4c1B","sourcesContent":["import { css, html, nothing, PropertyValues } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { msg } from '@lit/localize';\nimport type {\n SharedResizeObserverInterface,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport type { TileDisplayMode } from '../models';\nimport type { CollectionTitles } from '../data-source/models';\nimport './grid/collection-tile';\nimport './grid/item-tile';\nimport './grid/account-tile';\nimport './grid/search-tile';\nimport './hover/tile-hover-pane';\nimport './list/tile-list';\nimport './list/tile-list-compact';\nimport './list/tile-list-compact-header';\nimport type { TileHoverPane } from './hover/tile-hover-pane';\nimport { BaseTileComponent } from './base-tile-component';\nimport { SimpleLayoutType } from './models';\nimport {\n HoverPaneController,\n HoverPaneControllerInterface,\n HoverPaneProperties,\n HoverPaneProviderInterface,\n} from './hover/hover-pane-controller';\n\n@customElement('tile-dispatcher')\nexport class TileDispatcher\n extends BaseTileComponent\n implements\n SharedResizeObserverResizeHandlerInterface,\n HoverPaneProviderInterface\n{\n /*\n * Reactive properties inherited from BaseTileComponent:\n * - model?: TileModel;\n * - currentWidth?: number;\n * - currentHeight?: number;\n * - baseNavigationUrl?: string;\n * - baseImageUrl?: string;\n * - collectionPagePath?: string;\n * - sortParam: SortParam | null = null;\n * - defaultSortParam: SortParam | null = null;\n * - creatorFilter?: string;\n * - mobileBreakpoint?: number;\n * - loggedIn = false;\n * - suppressTileBlurring = false;\n * - useLocalTime = false;\n */\n\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\n\n @property({ type: Boolean }) isManageView = false;\n\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\n\n @property({ type: Object })\n collectionTitles?: CollectionTitles;\n\n @property({ type: Boolean }) showTvClips = false;\n\n /** What type of simple layout to use in grid mode, if any */\n @property({ type: String }) simpleLayoutType: SimpleLayoutType = 'none';\n\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\n @property({ type: Boolean }) enableHoverPane = false;\n\n @property({ type: String }) manageCheckTitle = msg(\n 'Remove this item from the list',\n );\n\n private hoverPaneController?: HoverPaneControllerInterface;\n\n @query('#container')\n private container!: HTMLDivElement;\n\n @query('tile-hover-pane')\n private hoverPane?: TileHoverPane;\n\n /** Maps each display mode to whether hover panes should appear in that mode */\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\n TileDisplayMode,\n boolean\n > = {\n grid: true,\n 'list-compact': true,\n 'list-detail': false,\n 'list-header': false,\n };\n\n render() {\n const isGridMode = this.tileDisplayMode === 'grid';\n const hoverPaneTemplate =\n this.hoverPaneController?.getTemplate() ?? nothing;\n return html`\n <div id=\"container\" class=${isGridMode ? 'hoverable' : nothing}>\n ${this.tileDisplayMode === 'list-header'\n ? this.headerTemplate\n : this.tileTemplate}\n ${this.manageCheckTemplate} ${hoverPaneTemplate}\n </div>\n `;\n }\n\n protected firstUpdated(): void {\n if (this.shouldPrepareHoverPane) {\n this.hoverPaneController = new HoverPaneController(this, {\n mobileBreakpoint: this.mobileBreakpoint,\n enableLongPress: false,\n });\n }\n }\n\n private get headerTemplate() {\n const { currentWidth, sortParam, defaultSortParam, mobileBreakpoint } =\n this;\n return html`\n <tile-list-compact-header\n class=\"header\"\n .currentWidth=${currentWidth}\n .sortParam=${sortParam ?? defaultSortParam}\n .mobileBreakpoint=${mobileBreakpoint}\n >\n </tile-list-compact-header>\n `;\n }\n\n private get tileTemplate() {\n return html`\n ${this.tileDisplayMode === 'list-detail'\n ? this.tile\n : this.linkTileTemplate}\n `;\n }\n\n private get linkTileTemplate() {\n return html`\n <a\n href=${this.linkTileHref}\n aria-label=${this.model?.title ?? 'Untitled item'}\n title=${this.shouldPrepareHoverPane\n ? nothing // Don't show title tooltips when we have the tile info popups\n : ifDefined(this.model?.title)}\n @click=${this.handleLinkClicked}\n @contextmenu=${this.handleLinkContextMenu}\n >\n ${this.tile}\n </a>\n `;\n }\n\n private get linkTileHref(): string | typeof nothing {\n if (!this.model?.identifier || this.baseNavigationUrl == null)\n return nothing;\n\n // Use the server-specified href if available.\n // Otherwise, construct a details page URL from the item identifier.\n if (this.model.href) {\n return `${this.baseNavigationUrl}${this.model.href}`;\n }\n\n return this.displayValueProvider.itemPageUrl(\n this.model.identifier,\n this.model.mediatype === 'collection',\n );\n }\n\n private get manageCheckTemplate() {\n if (!this.isManageView || this.tileDisplayMode !== 'grid') return nothing;\n\n return html`\n <div class=\"manage-check\">\n <input\n type=\"checkbox\"\n title=${this.manageCheckTitle}\n .checked=${this.model?.checked}\n @change=${this.handleLinkClicked}\n />\n </div>\n `;\n }\n\n /**\n * Whether hover pane behavior should be prepared for this tile\n * (e.g., whether mouse listeners should be attached, etc.)\n */\n private get shouldPrepareHoverPane(): boolean {\n return (\n this.enableHoverPane &&\n !!this.tileDisplayMode &&\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode] &&\n this.model?.mediatype !== 'search' && // don't show hover panes on search tiles\n !this.model?.captureDates // don't show hover panes on web archive tiles\n );\n }\n\n private get isHoverEnabled(): boolean {\n return window.matchMedia('(hover: hover)').matches;\n }\n\n /** @inheritdoc */\n getHoverPane(): TileHoverPane | undefined {\n return this.hoverPane;\n }\n\n /** @inheritdoc */\n getHoverPaneProps(): HoverPaneProperties {\n return this;\n }\n\n handleResize(entry: ResizeObserverEntry): void {\n this.currentWidth = entry.contentRect.width;\n this.currentHeight = entry.contentRect.height;\n }\n\n disconnectedCallback(): void {\n this.stopResizeObservation(this.resizeObserver);\n }\n\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\n observer?.removeObserver({\n handler: this,\n target: this.container,\n });\n }\n\n private startResizeObservation() {\n this.stopResizeObservation(this.resizeObserver);\n this.resizeObserver?.addObserver({\n handler: this,\n target: this.container,\n });\n }\n\n updated(props: PropertyValues) {\n if (props.has('resizeObserver')) {\n const previousObserver = props.get(\n 'resizeObserver',\n ) as SharedResizeObserverInterface;\n this.stopResizeObservation(previousObserver);\n this.startResizeObservation();\n }\n }\n\n /**\n * Handler for when the tile link is left-clicked. Emits the `resultSelected` event.\n * In manage view, it also checks/unchecks the tile.\n */\n private handleLinkClicked(e: Event): void {\n if (this.isManageView) {\n e.preventDefault();\n if (this.model) this.model.checked = !this.model.checked;\n }\n\n this.dispatchEvent(\n new CustomEvent('resultSelected', { detail: this.model }),\n );\n }\n\n /**\n * Handler for when the tile link is right-clicked.\n * In manage view, it opens the item in a new tab. Otherwise, does nothing.\n */\n private handleLinkContextMenu(e: Event): void {\n if (this.isManageView && this.linkTileHref !== nothing) {\n e.preventDefault();\n window.open(this.linkTileHref, '_blank');\n }\n }\n\n private tileInfoButtonPressed(\n e: CustomEvent<{ x: number; y: number }>,\n ): void {\n this.hoverPaneController?.toggleHoverPane({\n coords: e.detail,\n enableTouchBackdrop: true,\n });\n }\n\n private get tile() {\n const {\n model,\n collectionPagePath,\n baseNavigationUrl,\n currentWidth,\n currentHeight,\n sortParam,\n creatorFilter,\n mobileBreakpoint,\n defaultSortParam,\n } = this;\n\n if (!model) return nothing;\n\n switch (this.tileDisplayMode) {\n case 'grid':\n switch (model.mediatype) {\n case 'collection':\n return html`<collection-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </collection-tile>`;\n case 'account':\n return html`<account-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n ?showInfoButton=${!this.isHoverEnabled}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </account-tile>`;\n case 'search':\n return html`<search-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .baseImageUrl=${this.baseImageUrl}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .creatorFilter=${creatorFilter}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n ?showInfoButton=${false}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </search-tile>`;\n default:\n return html`<item-tile\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${this.currentWidth}\n .currentHeight=${this.currentHeight}\n .baseImageUrl=${this.baseImageUrl}\n .sortParam=${sortParam}\n .defaultSortParam=${defaultSortParam}\n .creatorFilter=${creatorFilter}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n .isManageView=${this.isManageView}\n .simpleLayoutType=${this.simpleLayoutType}\n ?showTvClips=${this.showTvClips}\n ?showInfoButton=${!this.isHoverEnabled}\n ?useLocalTime=${this.useLocalTime}\n @infoButtonPressed=${this.tileInfoButtonPressed}\n >\n </item-tile>`;\n }\n case 'list-compact':\n return html`<tile-list-compact\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .defaultSortParam=${defaultSortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n ?useLocalTime=${this.useLocalTime}\n >\n </tile-list-compact>`;\n case 'list-detail':\n return html`<tile-list\n .model=${model}\n .collectionPagePath=${collectionPagePath}\n .collectionTitles=${this.collectionTitles}\n .currentWidth=${currentWidth}\n .currentHeight=${currentHeight}\n .baseNavigationUrl=${baseNavigationUrl}\n .sortParam=${sortParam}\n .defaultSortParam=${defaultSortParam}\n .creatorFilter=${creatorFilter}\n .mobileBreakpoint=${mobileBreakpoint}\n .baseImageUrl=${this.baseImageUrl}\n .loggedIn=${this.loggedIn}\n .suppressBlurring=${this.suppressBlurring}\n ?useLocalTime=${this.useLocalTime}\n >\n </tile-list>`;\n default:\n return nothing;\n }\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n height: 100%;\n }\n\n collection-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n }\n\n account-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #fcf5e6;\n }\n\n item-tile {\n --tileBorderColor: #dddddd;\n --imageBlockBackgroundColor: #f1f1f4;\n }\n\n search-tile {\n --tileBorderColor: #555555;\n --tileBackgroundColor: #666666;\n --imageBlockBackgroundColor: #666666;\n --iconFillColor: #2c2c2c;\n }\n\n #container {\n position: relative;\n height: 100%;\n border-radius: 4px;\n }\n\n #container.hoverable:hover {\n box-shadow: var(--tileHoverBoxShadow, 0 0 6px 2px rgba(8, 8, 32, 0.8));\n transition: box-shadow 0.1s ease;\n }\n\n a {\n display: block;\n height: 100%;\n color: unset;\n text-decoration: none;\n transition: transform 0.05s ease;\n }\n\n a :first-child {\n display: block;\n height: 100%;\n }\n\n .manage-check {\n position: absolute;\n right: 0;\n top: 0;\n border: 5px solid #2c2c2c;\n border-radius: 3px;\n background-color: #2c2c2c;\n z-index: 1;\n }\n\n .manage-check > input[type='checkbox'] {\n display: block;\n margin: 0;\n }\n\n #touch-backdrop {\n position: fixed;\n width: 100vw;\n height: 100vh;\n top: 0;\n left: 0;\n z-index: 2;\n background: transparent;\n }\n\n tile-hover-pane {\n position: absolute;\n top: 0;\n left: -9999px;\n z-index: 2;\n }\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tile-dispatcher.js","sourceRoot":"","sources":["../../../src/tiles/tile-dispatcher.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AAOpC,OAAO,wBAAwB,CAAC;AAChC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,yBAAyB,CAAC;AACjC,OAAO,kBAAkB,CAAC;AAC1B,OAAO,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property, query } from 'lit/decorators.js';\r\nimport { ifDefined } from 'lit/directives/if-defined.js';\r\nimport { msg } from '@lit/localize';\r\nimport type {\r\n SharedResizeObserverInterface,\r\n SharedResizeObserverResizeHandlerInterface,\r\n} from '@internetarchive/shared-resize-observer';\r\nimport type { TileDisplayMode } from '../models';\r\nimport type { CollectionTitles } from '../data-source/models';\r\nimport './grid/collection-tile';\r\nimport './grid/item-tile';\r\nimport './grid/account-tile';\r\nimport './grid/search-tile';\r\nimport './hover/tile-hover-pane';\r\nimport './list/tile-list';\r\nimport './list/tile-list-compact';\r\nimport './list/tile-list-compact-header';\r\nimport type { TileHoverPane } from './hover/tile-hover-pane';\r\nimport { BaseTileComponent } from './base-tile-component';\r\nimport { SimpleLayoutType } from './models';\r\nimport {\r\n HoverPaneController,\r\n HoverPaneControllerInterface,\r\n HoverPaneProperties,\r\n HoverPaneProviderInterface,\r\n} from './hover/hover-pane-controller';\r\nimport { srOnlyStyle } from '../styles/sr-only';\r\n\r\n@customElement('tile-dispatcher')\r\nexport class TileDispatcher\r\n extends BaseTileComponent\r\n implements\r\n SharedResizeObserverResizeHandlerInterface,\r\n HoverPaneProviderInterface\r\n{\r\n /*\r\n * Reactive properties inherited from BaseTileComponent:\r\n * - model?: TileModel;\r\n * - currentWidth?: number;\r\n * - currentHeight?: number;\r\n * - baseNavigationUrl?: string;\r\n * - baseImageUrl?: string;\r\n * - collectionPagePath?: string;\r\n * - sortParam: SortParam | null = null;\r\n * - defaultSortParam: SortParam | null = null;\r\n * - creatorFilter?: string;\r\n * - mobileBreakpoint?: number;\r\n * - loggedIn = false;\r\n * - suppressTileBlurring = false;\r\n * - useLocalTime = false;\r\n */\r\n\r\n @property({ type: String }) tileDisplayMode?: TileDisplayMode;\r\n\r\n @property({ type: Boolean }) isManageView = false;\r\n\r\n @property({ type: Object }) resizeObserver?: SharedResizeObserverInterface;\r\n\r\n @property({ type: Object })\r\n collectionTitles?: CollectionTitles;\r\n\r\n @property({ type: Boolean }) showTvClips = false;\r\n\r\n /** What type of simple layout to use in grid mode, if any */\r\n @property({ type: String }) simpleLayoutType: SimpleLayoutType = 'none';\r\n\r\n /** Whether this tile should include a hover pane at all (for applicable tile modes) */\r\n @property({ type: Boolean }) enableHoverPane = false;\r\n\r\n @property({ type: String }) manageCheckTitle = msg(\r\n 'Remove this item from the list',\r\n );\r\n\r\n private hoverPaneController?: HoverPaneControllerInterface;\r\n\r\n @query('#container')\r\n private container!: HTMLDivElement;\r\n\r\n @query('tile-hover-pane')\r\n private hoverPane?: TileHoverPane;\r\n\r\n @query('.tile-link')\r\n private tileLinkElement?: HTMLAnchorElement;\r\n\r\n acquireFocus(): void {\r\n this.tileLinkElement?.focus();\r\n }\r\n\r\n releaseFocus(): void {\r\n this.tileLinkElement?.blur();\r\n }\r\n\r\n /** Maps each display mode to whether hover panes should appear in that mode */\r\n private static readonly HOVER_PANE_DISPLAY_MODES: Record<\r\n TileDisplayMode,\r\n boolean\r\n > = {\r\n grid: true,\r\n 'list-compact': true,\r\n 'list-detail': false,\r\n 'list-header': false,\r\n };\r\n\r\n render() {\r\n const isGridMode = this.tileDisplayMode === 'grid';\r\n const hoverPaneTemplate =\r\n this.hoverPaneController?.getTemplate() ?? nothing;\r\n return html`\r\n <div id=\"container\" class=${isGridMode ? 'hoverable' : ''}>\r\n ${this.tileDisplayMode === 'list-header'\r\n ? this.headerTemplate\r\n : this.tileTemplate}\r\n ${this.manageCheckTemplate} ${hoverPaneTemplate}\r\n </div>\r\n `;\r\n }\r\n\r\n protected firstUpdated(): void {\r\n if (this.shouldPrepareHoverPane) {\r\n this.hoverPaneController = new HoverPaneController(this, {\r\n mobileBreakpoint: this.mobileBreakpoint,\r\n enableLongPress: false,\r\n });\r\n }\r\n }\r\n\r\n private get headerTemplate() {\r\n const { currentWidth, sortParam, defaultSortParam, mobileBreakpoint } =\r\n this;\r\n return html`\r\n <tile-list-compact-header\r\n class=\"header\"\r\n .currentWidth=${currentWidth}\r\n .sortParam=${sortParam ?? defaultSortParam}\r\n .mobileBreakpoint=${mobileBreakpoint}\r\n >\r\n </tile-list-compact-header>\r\n `;\r\n }\r\n\r\n private get tileTemplate() {\r\n return html`\r\n ${this.tileDisplayMode === 'list-detail'\r\n ? this.tile\r\n : this.linkTileTemplate}\r\n `;\r\n }\r\n\r\n private get linkTileTemplate() {\r\n return html`\r\n <a\r\n href=${this.linkTileHref}\r\n aria-label=${this.model?.title ?? 'Untitled item'}\r\n aria-describedby=\"link-aria-description\"\r\n aria-haspopup=${this.shouldPrepareHoverPane ? 'dialog' : 'false'}\r\n title=${this.shouldPrepareHoverPane\r\n ? nothing // Don't show title tooltips when we have the tile info popups\r\n : ifDefined(this.model?.title)}\r\n @click=${this.handleLinkClicked}\r\n @contextmenu=${this.handleLinkContextMenu}\r\n class=\"tile-link\"\r\n >\r\n ${this.tile}\r\n </a>\r\n <div id=\"link-aria-description\" class=\"sr-only\">\r\n ${msg('Press Down Arrow to preview item details')}\r\n </div>\r\n `;\r\n }\r\n\r\n private get linkTileHref(): string | typeof nothing {\r\n if (!this.model?.identifier || this.baseNavigationUrl == null)\r\n return nothing;\r\n\r\n // Use the server-specified href if available.\r\n // Otherwise, construct a details page URL from the item identifier.\r\n if (this.model.href) {\r\n return `${this.baseNavigationUrl}${this.model.href}`;\r\n }\r\n\r\n return this.displayValueProvider.itemPageUrl(\r\n this.model.identifier,\r\n this.model.mediatype === 'collection',\r\n );\r\n }\r\n\r\n private get manageCheckTemplate() {\r\n if (!this.isManageView || this.tileDisplayMode !== 'grid') return nothing;\r\n\r\n return html`\r\n <div class=\"manage-check\">\r\n <input\r\n type=\"checkbox\"\r\n title=${this.manageCheckTitle}\r\n ?checked=${this.model?.checked}\r\n @change=${this.handleLinkClicked}\r\n />\r\n </div>\r\n `;\r\n }\r\n\r\n /**\r\n * Whether hover pane behavior should be prepared for this tile\r\n * (e.g., whether mouse listeners should be attached, etc.)\r\n */\r\n private get shouldPrepareHoverPane(): boolean {\r\n return (\r\n this.enableHoverPane &&\r\n !!this.tileDisplayMode &&\r\n TileDispatcher.HOVER_PANE_DISPLAY_MODES[this.tileDisplayMode] &&\r\n this.model?.mediatype !== 'search' && // don't show hover panes on search tiles\r\n !this.model?.captureDates // don't show hover panes on web archive tiles\r\n );\r\n }\r\n\r\n private get isHoverEnabled(): boolean {\r\n return window.matchMedia('(hover: hover)').matches;\r\n }\r\n\r\n /** @inheritdoc */\r\n getHoverPane(): TileHoverPane | undefined {\r\n return this.hoverPane;\r\n }\r\n\r\n /** @inheritdoc */\r\n getHoverPaneProps(): HoverPaneProperties {\r\n return this;\r\n }\r\n\r\n handleResize(entry: ResizeObserverEntry): void {\r\n this.currentWidth = entry.contentRect.width;\r\n this.currentHeight = entry.contentRect.height;\r\n }\r\n\r\n disconnectedCallback(): void {\r\n this.stopResizeObservation(this.resizeObserver);\r\n }\r\n\r\n private stopResizeObservation(observer?: SharedResizeObserverInterface) {\r\n observer?.removeObserver({\r\n handler: this,\r\n target: this.container,\r\n });\r\n }\r\n\r\n private startResizeObservation() {\r\n this.stopResizeObservation(this.resizeObserver);\r\n this.resizeObserver?.addObserver({\r\n handler: this,\r\n target: this.container,\r\n });\r\n }\r\n\r\n updated(props: PropertyValues) {\r\n if (props.has('resizeObserver')) {\r\n const previousObserver = props.get(\r\n 'resizeObserver',\r\n ) as SharedResizeObserverInterface;\r\n this.stopResizeObservation(previousObserver);\r\n this.startResizeObservation();\r\n }\r\n }\r\n\r\n /**\r\n * Handler for when the tile link is left-clicked. Emits the `resultSelected` event.\r\n * In manage view, it also checks/unchecks the tile.\r\n */\r\n private handleLinkClicked(e: Event): void {\r\n if (this.isManageView) {\r\n e.preventDefault();\r\n if (this.model) this.model.checked = !this.model.checked;\r\n }\r\n\r\n this.dispatchEvent(\r\n new CustomEvent('resultSelected', { detail: this.model }),\r\n );\r\n }\r\n\r\n /**\r\n * Handler for when the tile link is right-clicked.\r\n * In manage view, it opens the item in a new tab. Otherwise, does nothing.\r\n */\r\n private handleLinkContextMenu(e: Event): void {\r\n if (this.isManageView && this.linkTileHref !== nothing) {\r\n e.preventDefault();\r\n window.open(this.linkTileHref, '_blank');\r\n }\r\n }\r\n\r\n private tileInfoButtonPressed(\r\n e: CustomEvent<{ x: number; y: number }>,\r\n ): void {\r\n this.hoverPaneController?.toggleHoverPane({\r\n coords: e.detail,\r\n enableTouchBackdrop: true,\r\n });\r\n }\r\n\r\n private get tile() {\r\n const {\r\n model,\r\n collectionPagePath,\r\n baseNavigationUrl,\r\n currentWidth,\r\n currentHeight,\r\n sortParam,\r\n creatorFilter,\r\n mobileBreakpoint,\r\n defaultSortParam,\r\n } = this;\r\n\r\n if (!model) return nothing;\r\n\r\n switch (this.tileDisplayMode) {\r\n case 'grid':\r\n switch (model.mediatype) {\r\n case 'collection':\r\n return html`<collection-tile\r\n .model=${model}\r\n .collectionPagePath=${collectionPagePath}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .currentWidth=${currentWidth}\r\n .currentHeight=${currentHeight}\r\n .creatorFilter=${creatorFilter}\r\n .suppressBlurring=${this.suppressBlurring}\r\n .isManageView=${this.isManageView}\r\n ?showInfoButton=${!this.isHoverEnabled}\r\n @infoButtonPressed=${this.tileInfoButtonPressed}\r\n >\r\n </collection-tile>`;\r\n case 'account':\r\n return html`<account-tile\r\n .model=${model}\r\n .collectionPagePath=${collectionPagePath}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .currentWidth=${currentWidth}\r\n .currentHeight=${currentHeight}\r\n .creatorFilter=${creatorFilter}\r\n .suppressBlurring=${this.suppressBlurring}\r\n .isManageView=${this.isManageView}\r\n ?showInfoButton=${!this.isHoverEnabled}\r\n @infoButtonPressed=${this.tileInfoButtonPressed}\r\n >\r\n </account-tile>`;\r\n case 'search':\r\n return html`<search-tile\r\n .model=${model}\r\n .collectionPagePath=${collectionPagePath}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .currentWidth=${currentWidth}\r\n .currentHeight=${currentHeight}\r\n .creatorFilter=${creatorFilter}\r\n .suppressBlurring=${this.suppressBlurring}\r\n .isManageView=${this.isManageView}\r\n ?showInfoButton=${false}\r\n @infoButtonPressed=${this.tileInfoButtonPressed}\r\n >\r\n </search-tile>`;\r\n default:\r\n return html`<item-tile\r\n .model=${model}\r\n .collectionPagePath=${collectionPagePath}\r\n .currentWidth=${this.currentWidth}\r\n .currentHeight=${this.currentHeight}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .sortParam=${sortParam}\r\n .defaultSortParam=${defaultSortParam}\r\n .creatorFilter=${creatorFilter}\r\n .loggedIn=${this.loggedIn}\r\n .suppressBlurring=${this.suppressBlurring}\r\n .isManageView=${this.isManageView}\r\n .simpleLayoutType=${this.simpleLayoutType}\r\n ?showTvClips=${this.showTvClips}\r\n ?showInfoButton=${!this.isHoverEnabled}\r\n ?useLocalTime=${this.useLocalTime}\r\n @infoButtonPressed=${this.tileInfoButtonPressed}\r\n >\r\n </item-tile>`;\r\n }\r\n case 'list-compact':\r\n return html`<tile-list-compact\r\n .model=${model}\r\n .collectionPagePath=${collectionPagePath}\r\n .currentWidth=${currentWidth}\r\n .currentHeight=${currentHeight}\r\n .baseNavigationUrl=${baseNavigationUrl}\r\n .sortParam=${sortParam}\r\n .defaultSortParam=${defaultSortParam}\r\n .creatorFilter=${creatorFilter}\r\n .mobileBreakpoint=${mobileBreakpoint}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .loggedIn=${this.loggedIn}\r\n .suppressBlurring=${this.suppressBlurring}\r\n ?useLocalTime=${this.useLocalTime}\r\n >\r\n </tile-list-compact>`;\r\n case 'list-detail':\r\n return html`<tile-list\r\n .model=${model}\r\n .collectionPagePath=${collectionPagePath}\r\n .collectionTitles=${this.collectionTitles}\r\n .currentWidth=${currentWidth}\r\n .currentHeight=${currentHeight}\r\n .baseNavigationUrl=${baseNavigationUrl}\r\n .sortParam=${sortParam}\r\n .defaultSortParam=${defaultSortParam}\r\n .creatorFilter=${creatorFilter}\r\n .mobileBreakpoint=${mobileBreakpoint}\r\n .baseImageUrl=${this.baseImageUrl}\r\n .loggedIn=${this.loggedIn}\r\n .suppressBlurring=${this.suppressBlurring}\r\n ?useLocalTime=${this.useLocalTime}\r\n >\r\n </tile-list>`;\r\n default:\r\n return nothing;\r\n }\r\n }\r\n\r\n static get styles() {\r\n return [\r\n srOnlyStyle,\r\n css`\r\n :host {\r\n display: block;\r\n height: 100%;\r\n }\r\n\r\n collection-tile {\r\n --tileBorderColor: #555555;\r\n --tileBackgroundColor: #666666;\r\n --imageBlockBackgroundColor: #666666;\r\n }\r\n\r\n account-tile {\r\n --tileBorderColor: #dddddd;\r\n --imageBlockBackgroundColor: #fcf5e6;\r\n }\r\n\r\n item-tile {\r\n --tileBorderColor: #dddddd;\r\n --imageBlockBackgroundColor: #f1f1f4;\r\n }\r\n\r\n search-tile {\r\n --tileBorderColor: #555555;\r\n --tileBackgroundColor: #666666;\r\n --imageBlockBackgroundColor: #666666;\r\n --iconFillColor: #2c2c2c;\r\n }\r\n\r\n #container {\r\n position: relative;\r\n height: 100%;\r\n border-radius: 4px;\r\n }\r\n\r\n #container.hoverable a:focus,\r\n #container.hoverable a:hover {\r\n box-shadow: var(\r\n --tileHoverBoxShadow,\r\n 0 0 6px 2px rgba(8, 8, 32, 0.8)\r\n );\r\n transition: box-shadow 0.1s ease;\r\n }\r\n\r\n a {\r\n display: block;\r\n height: 100%;\r\n color: unset;\r\n text-decoration: none;\r\n transition: transform 0.05s ease;\r\n border-radius: 4px;\r\n outline: none;\r\n }\r\n\r\n a :first-child {\r\n display: block;\r\n height: 100%;\r\n }\r\n\r\n .manage-check {\r\n position: absolute;\r\n right: 0;\r\n top: 0;\r\n border: 5px solid #2c2c2c;\r\n border-radius: 3px;\r\n background-color: #2c2c2c;\r\n z-index: 1;\r\n }\r\n\r\n .manage-check > input[type='checkbox'] {\r\n display: block;\r\n margin: 0;\r\n }\r\n\r\n #touch-backdrop {\r\n position: fixed;\r\n width: 100vw;\r\n height: 100vh;\r\n top: 0;\r\n left: 0;\r\n z-index: 2;\r\n background: transparent;\r\n }\r\n\r\n tile-hover-pane {\r\n position: absolute;\r\n top: 0;\r\n left: -9999px;\r\n z-index: 2;\r\n }\r\n `,\r\n ];\r\n }\r\n}\r\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-date.js","sourceRoot":"","sources":["../../../src/utils/format-date.ts"],"names":[],"mappings":"AAwBA,MAAM,UAAU,UAAU,CACxB,IAAsB,EACtB,SAAqB,OAAO,EAC5B,EAAE,MAAM,GAAG,OAAO,EAAE,YAAY,GAAG,KAAK,KAAwB,EAAE;IAElE,4BAA4B;IAC5B,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,mFAAmF;IACnF,yEAAyE;IACzE,mFAAmF;IACnF,yDAAyD;IACzD,MAAM,OAAO,GAA+B,YAAY;QACtD,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAExB,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,8EAA8E;YAC9E,+EAA+E;YAC/E,6DAA6D;YAC7D,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QACpC,KAAK,OAAO;YACV,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC;YACxB,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;YACzB,MAAM;QACR,KAAK,MAAM;YACT,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;YACzB,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC;YACxB,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;YACxB,MAAM;QACR;YACE,MAAM;IACV,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/D,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC","sourcesContent":["/*\n * Display date\n * Override browser timezone to always display same date as in data\n */\nexport type DateFormat =\n | 'year-only' // 2020\n | 'short' // Dec 2020\n | 'long'; // Dec 20, 2020\n\n/**\n * Extra options accepted by the `formatDate` function\n */\nexport type FormatDateOptions = {\n /**\n * Which locale to format the date string for (default `'en-US'`)\n */\n locale?: string;\n /**\n * Whether to display the date in the browser's local time zone.\n * Default is `false`, displaying the dates in UTC.\n */\n useLocalTime?: boolean;\n};\n\nexport function formatDate(\n date: Date | undefined,\n format: DateFormat = 'short',\n { locale = 'en-US', useLocalTime = false }: FormatDateOptions = {},\n): string {\n // Return blank if undefined\n if (!date) return '';\n\n // The dates provided by the backend are assumed to already be with respect to UTC,\n // and by default we specify that they should be rendered as such. If the\n // `useLocalTime` option was set, we omit the UTC time zone from our format options\n // so that the browser's local time zone is used instead.\n const options: Intl.DateTimeFormatOptions = useLocalTime\n ? {}\n : { timeZone: 'UTC' };\n\n switch (format) {\n case 'year-only':\n // If we're only using the year, ensure we output the correct UTC year and not\n // the local year. If the local timezone is used, we can get strange off-by-one\n // errors due to quirks of timezone handling for older years.\n return `${date.getUTCFullYear()}`;\n case 'short':\n options.month = 'short';\n options.year = 'numeric';\n break;\n case 'long':\n options.year = 'numeric';\n options.month = 'short';\n options.day = '2-digit';\n break;\n default:\n break;\n }\n\n const dateFormatter = new Intl.DateTimeFormat(locale, options);\n return dateFormatter.format(date);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"format-date.js","sourceRoot":"","sources":["../../../src/utils/format-date.ts"],"names":[],"mappings":"AAwBA,MAAM,UAAU,UAAU,CACxB,IAAsB,EACtB,SAAqB,OAAO,EAC5B,EAAE,MAAM,GAAG,OAAO,EAAE,YAAY,GAAG,KAAK,KAAwB,EAAE;IAElE,4BAA4B;IAC5B,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IAErB,mFAAmF;IACnF,yEAAyE;IACzE,mFAAmF;IACnF,yDAAyD;IACzD,MAAM,OAAO,GAA+B,YAAY;QACtD,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;IAExB,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,WAAW;YACd,8EAA8E;YAC9E,+EAA+E;YAC/E,6DAA6D;YAC7D,OAAO,GAAG,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;QACpC,KAAK,OAAO;YACV,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC;YACxB,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;YACzB,MAAM;QACR,KAAK,MAAM;YACT,OAAO,CAAC,IAAI,GAAG,SAAS,CAAC;YACzB,OAAO,CAAC,KAAK,GAAG,OAAO,CAAC;YACxB,OAAO,CAAC,GAAG,GAAG,SAAS,CAAC;YACxB,MAAM;QACR;YACE,MAAM;IACV,CAAC;IAED,MAAM,aAAa,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/D,OAAO,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACpC,CAAC","sourcesContent":["/*\r\n * Display date\r\n * Override browser timezone to always display same date as in data\r\n */\r\nexport type DateFormat =\r\n | 'year-only' // 2020\r\n | 'short' // Dec 2020\r\n | 'long'; // Dec 20, 2020\r\n\r\n/**\r\n * Extra options accepted by the `formatDate` function\r\n */\r\nexport type FormatDateOptions = {\r\n /**\r\n * Which locale to format the date string for (default `'en-US'`)\r\n */\r\n locale?: string;\r\n /**\r\n * Whether to display the date in the browser's local time zone.\r\n * Default is `false`, displaying the dates in UTC.\r\n */\r\n useLocalTime?: boolean;\r\n};\r\n\r\nexport function formatDate(\r\n date: Date | undefined,\r\n format: DateFormat = 'short',\r\n { locale = 'en-US', useLocalTime = false }: FormatDateOptions = {},\r\n): string {\r\n // Return blank if undefined\r\n if (!date) return '';\r\n\r\n // The dates provided by the backend are assumed to already be with respect to UTC,\r\n // and by default we specify that they should be rendered as such. If the\r\n // `useLocalTime` option was set, we omit the UTC time zone from our format options\r\n // so that the browser's local time zone is used instead.\r\n const options: Intl.DateTimeFormatOptions = useLocalTime\r\n ? {}\r\n : { timeZone: 'UTC' };\r\n\r\n switch (format) {\r\n case 'year-only':\r\n // If we're only using the year, ensure we output the correct UTC year and not\r\n // the local year. If the local timezone is used, we can get strange off-by-one\r\n // errors due to quirks of timezone handling for older years.\r\n return `${date.getUTCFullYear()}`;\r\n case 'short':\r\n options.month = 'short';\r\n options.year = 'numeric';\r\n break;\r\n case 'long':\r\n options.year = 'numeric';\r\n options.month = 'short';\r\n options.day = '2-digit';\r\n break;\r\n default:\r\n break;\r\n }\r\n\r\n const dateFormatter = new Intl.DateTimeFormat(locale, options);\r\n return dateFormatter.format(date);\r\n}\r\n"]}
|