@internetarchive/ia-item-navigator 0.0.0-a9 → 0.0.2-a2
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +29 -19
- package/demo/app-root.ts +37 -31
- package/demo/index.html +1 -0
- package/dist/demo/app-root.d.ts +11 -15
- package/dist/demo/app-root.js +26 -26
- package/dist/demo/app-root.js.map +1 -1
- package/dist/src/interfaces/custom-theater-interface.d.ts +20 -0
- package/dist/src/interfaces/custom-theater-interface.js +2 -0
- package/dist/src/interfaces/custom-theater-interface.js.map +1 -0
- package/dist/src/interfaces/event-interfaces.d.ts +11 -11
- package/dist/src/interfaces/event-interfaces.js.map +1 -1
- package/dist/src/interfaces/menu-interfaces.d.ts +6 -7
- package/dist/src/interfaces/menu-interfaces.js.map +1 -1
- package/dist/src/interfaces/nav-controller-interface.d.ts +11 -6
- package/dist/src/interfaces/nav-controller-interface.js.map +1 -1
- package/dist/src/item-inspector/item-inspector.d.ts +0 -47
- package/dist/src/item-inspector/item-inspector.js +253 -271
- package/dist/src/item-inspector/item-inspector.js.map +1 -1
- package/dist/src/item-navigator.d.ts +41 -28
- package/dist/src/item-navigator.js +96 -113
- package/dist/src/item-navigator.js.map +1 -1
- package/dist/src/no-theater-available.d.ts +9 -0
- package/dist/src/no-theater-available.js +79 -0
- package/dist/src/no-theater-available.js.map +1 -0
- package/dist/test/book-nav-stub.d.ts +22 -0
- package/dist/test/book-nav-stub.js +49 -0
- package/dist/test/book-nav-stub.js.map +1 -0
- package/dist/test/ia-item-navigator.test.d.ts +1 -0
- package/dist/test/ia-item-navigator.test.js +279 -131
- package/dist/test/ia-item-navigator.test.js.map +1 -1
- package/dist/test/ia-stub.d.ts +22 -0
- package/dist/test/ia-stub.js +34 -3
- package/dist/test/ia-stub.js.map +1 -1
- package/dist/test/no-theater-available.test.d.ts +1 -0
- package/dist/test/no-theater-available.test.js +27 -0
- package/dist/test/no-theater-available.test.js.map +1 -0
- package/package.json +4 -3
- package/src/interfaces/custom-theater-interface.ts +28 -0
- package/src/interfaces/event-interfaces.ts +15 -11
- package/src/interfaces/menu-interfaces.ts +9 -10
- package/src/item-navigator.ts +133 -144
- package/src/no-theater-available.ts +85 -0
- package/test/book-nav-stub.ts +47 -0
- package/test/ia-item-navigator.test.ts +365 -156
- package/test/ia-stub.ts +78 -2
- package/test/no-theater-available.test.ts +32 -0
- package/demo/demo-book-manifest.json +0 -1163
- package/src/interfaces/nav-controller-interface.ts +0 -18
- package/src/item-inspector/files-by-type/files-by-type-provider.ts +0 -43
- package/src/item-inspector/files-by-type/ia-files-by-type.ts +0 -100
- package/src/item-inspector/item-inspector.ts +0 -296
- package/src/item-inspector/share-provider.ts +0 -51
- package/src/item-inspector/visual-mod-provider.ts +0 -65
- package/src/item-navigator-js.js +0 -372
package/src/item-navigator.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
/* eslint-disable import/no-duplicates */
|
2
1
|
import {
|
3
2
|
css,
|
4
3
|
html,
|
@@ -8,35 +7,39 @@ import {
|
|
8
7
|
state,
|
9
8
|
query,
|
10
9
|
PropertyValues,
|
10
|
+
CSSResult,
|
11
11
|
} from 'lit-element';
|
12
12
|
import { nothing, TemplateResult } from 'lit-html';
|
13
13
|
import { MetadataResponse } from '@internetarchive/search-service';
|
14
14
|
import {
|
15
15
|
SharedResizeObserver,
|
16
|
-
// SharedResizeObserverInterface,
|
17
16
|
SharedResizeObserverResizeHandlerInterface,
|
18
17
|
} from '@internetarchive/shared-resize-observer';
|
19
|
-
// @ts-ignore
|
20
|
-
import { IAMenuSlider } from '@internetarchive/ia-menu-slider';
|
21
18
|
import '@internetarchive/ia-menu-slider';
|
22
19
|
|
23
|
-
import {
|
20
|
+
import { ModalManager } from '@internetarchive/modal-manager';
|
24
21
|
import '@internetarchive/icon-ellipses/icon-ellipses';
|
25
22
|
import './loader';
|
26
|
-
// import { IaItemInspector } from './item-inspector/item-inspector';
|
27
|
-
import './item-inspector/item-inspector';
|
28
23
|
|
29
24
|
import {
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
25
|
+
ToggleSideMenuOpenEvent,
|
26
|
+
ToggleSidePanelOpenEvent,
|
27
|
+
SetSideMenuContentsEvent,
|
28
|
+
SetSideMenuShortcutsEvent,
|
29
|
+
loadingStateUpdatedEvent,
|
30
|
+
ManageFullscreenEvent,
|
36
31
|
} from './interfaces/event-interfaces';
|
37
32
|
|
38
|
-
import {
|
39
|
-
|
33
|
+
import {
|
34
|
+
MenuProviderInterface,
|
35
|
+
MenuShortcutInterface,
|
36
|
+
MenuId,
|
37
|
+
} from './interfaces/menu-interfaces';
|
38
|
+
import './no-theater-available';
|
39
|
+
|
40
|
+
export enum ItemType {
|
41
|
+
BOOK = 'bookreader',
|
42
|
+
}
|
40
43
|
@customElement('ia-item-navigator')
|
41
44
|
export class ItemNavigator
|
42
45
|
extends LitElement
|
@@ -50,9 +53,9 @@ export class ItemNavigator
|
|
50
53
|
return value as MetadataResponse;
|
51
54
|
},
|
52
55
|
})
|
53
|
-
item
|
56
|
+
item?: MetadataResponse;
|
54
57
|
|
55
|
-
@property({ type: String }) itemType
|
58
|
+
@property({ type: String }) itemType?: ItemType;
|
56
59
|
|
57
60
|
@property({ type: String }) baseHost = 'archive.org';
|
58
61
|
|
@@ -66,65 +69,44 @@ export class ItemNavigator
|
|
66
69
|
})
|
67
70
|
signedIn = false;
|
68
71
|
|
69
|
-
@property({
|
70
|
-
type: Array,
|
71
|
-
hasChanged: (newVal: Array<object>, oldVal: Array<object>) => {
|
72
|
-
if (newVal !== oldVal) {
|
73
|
-
return true;
|
74
|
-
}
|
75
|
-
return false;
|
76
|
-
},
|
77
|
-
})
|
78
|
-
@property({ type: Array })
|
79
|
-
menuContents: IntMenuProvider[] = [];
|
72
|
+
@property({ type: Array }) menuContents: MenuProviderInterface[] = [];
|
80
73
|
|
81
|
-
@property({ type: Array }) menuShortcuts:
|
74
|
+
@property({ type: Array }) menuShortcuts: MenuShortcutInterface[] = [];
|
82
75
|
|
83
|
-
@property({ type: Boolean, reflect: true })
|
76
|
+
@property({ type: Boolean, reflect: true, attribute: true })
|
77
|
+
viewportInFullscreen: boolean | null = null;
|
84
78
|
|
85
79
|
@property({ type: Boolean }) menuOpened = false;
|
86
80
|
|
87
|
-
@property({ type: String }) openMenu
|
81
|
+
@property({ type: String }) openMenu?: MenuId;
|
88
82
|
|
89
|
-
@property({ attribute: false }) modal?:
|
83
|
+
@property({ attribute: false }) modal?: ModalManager;
|
90
84
|
|
91
|
-
@property({ attribute: false }) sharedObserver?:
|
85
|
+
@property({ attribute: false }) sharedObserver?: SharedResizeObserver;
|
92
86
|
|
93
|
-
@property({ type: Boolean, reflect: true }) loaded:
|
87
|
+
@property({ type: Boolean, reflect: true, attribute: true }) loaded:
|
88
|
+
| true
|
89
|
+
| null = null;
|
94
90
|
|
95
91
|
@state() openMenuState: 'overlay' | 'shift' = 'shift';
|
96
92
|
|
97
93
|
@query('#frame') private frame!: HTMLDivElement;
|
98
94
|
|
99
|
-
|
100
|
-
this.sharedObserver?.removeObserver({
|
101
|
-
handler: this,
|
102
|
-
target: this.frame,
|
103
|
-
});
|
104
|
-
}
|
105
|
-
|
106
|
-
firstUpdated(pp: any): void {
|
107
|
-
console.log('first updated item-nav', this.modal, pp);
|
108
|
-
if (!this.modal) {
|
109
|
-
this.createModal();
|
110
|
-
}
|
95
|
+
@query('slot[name="theater-header"]') private headerSlot!: HTMLDivElement;
|
111
96
|
|
112
|
-
|
97
|
+
disconnectedCallback() {
|
98
|
+
this.removeResizeObserver();
|
113
99
|
}
|
114
100
|
|
115
101
|
updated(changed: PropertyValues) {
|
116
|
-
if (changed.has('modal')) {
|
117
|
-
if (!this.modal) {
|
118
|
-
this.createModal();
|
119
|
-
}
|
120
|
-
}
|
121
102
|
if (changed.has('sharedObserver')) {
|
122
|
-
|
123
|
-
|
124
|
-
|
103
|
+
const oldObserver = changed.get('sharedObserver') as SharedResizeObserver;
|
104
|
+
oldObserver?.removeObserver(this.resizeObserverConfig);
|
105
|
+
this.setResizeObserver();
|
125
106
|
}
|
126
107
|
}
|
127
108
|
|
109
|
+
/** Shared observer */
|
128
110
|
handleResize(entry: ResizeObserverEntry): void {
|
129
111
|
const { width } = entry.contentRect;
|
130
112
|
if (width <= 600) {
|
@@ -134,52 +116,85 @@ export class ItemNavigator
|
|
134
116
|
this.openMenuState = 'shift';
|
135
117
|
}
|
136
118
|
|
137
|
-
private
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
119
|
+
private setResizeObserver(): void {
|
120
|
+
this.sharedObserver?.addObserver(this.resizeObserverConfig);
|
121
|
+
}
|
122
|
+
|
123
|
+
private removeResizeObserver(): void {
|
124
|
+
this.sharedObserver?.removeObserver(this.resizeObserverConfig);
|
125
|
+
}
|
126
|
+
|
127
|
+
get resizeObserverConfig(): {
|
128
|
+
handler: SharedResizeObserverResizeHandlerInterface;
|
129
|
+
target: Element;
|
130
|
+
} {
|
131
|
+
return {
|
142
132
|
handler: this,
|
143
133
|
target: this.frame,
|
144
|
-
}
|
134
|
+
};
|
145
135
|
}
|
136
|
+
/** End shared observer */
|
146
137
|
|
147
138
|
get loaderTitle() {
|
148
139
|
return this.viewportInFullscreen ? 'Internet Archive' : '';
|
149
140
|
}
|
150
141
|
|
142
|
+
get readerHeightStyle(): string {
|
143
|
+
const calcFSHeight = `calc(100vh - ${this.headerSlot?.offsetHeight}px)`;
|
144
|
+
return this.viewportInFullscreen ? `height: ${calcFSHeight}` : '';
|
145
|
+
}
|
146
|
+
|
147
|
+
get loadingArea() {
|
148
|
+
return html`
|
149
|
+
<div class="loading-area">
|
150
|
+
<div class="loading-view">
|
151
|
+
<ia-itemnav-loader .title=${this.loaderTitle}></ia-itemnav-loader>
|
152
|
+
</div>
|
153
|
+
</div>
|
154
|
+
`;
|
155
|
+
}
|
156
|
+
|
151
157
|
render(): TemplateResult {
|
152
|
-
const displayReaderClass = this.loaded ? '' : '
|
158
|
+
const displayReaderClass = this.loaded ? '' : 'hidden';
|
153
159
|
return html`
|
154
160
|
<div id="frame" class=${`${this.menuClass}`}>
|
155
|
-
<slot name="theater-header"></slot>
|
156
161
|
<div class="menu-and-reader">
|
157
162
|
${this.shouldRenderMenu ? this.renderSideMenu : nothing}
|
158
|
-
<
|
163
|
+
<slot name="theater-header"></slot>
|
164
|
+
<div
|
165
|
+
id="reader"
|
166
|
+
class=${displayReaderClass}
|
167
|
+
style=${this.readerHeightStyle}
|
168
|
+
>
|
159
169
|
${this.renderViewport}
|
160
170
|
</div>
|
161
|
-
${!this.loaded
|
162
|
-
? html` <div class="loading-area">
|
163
|
-
<div class="loading-view">
|
164
|
-
<ia-itemnav-loader
|
165
|
-
.title=${this.loaderTitle}
|
166
|
-
></ia-itemnav-loader>
|
167
|
-
</div>
|
168
|
-
</div>`
|
169
|
-
: nothing}
|
171
|
+
${!this.loaded ? this.loadingArea : nothing}
|
170
172
|
</div>
|
171
173
|
</div>
|
172
174
|
`;
|
173
175
|
}
|
174
176
|
|
175
|
-
get
|
177
|
+
get noTheaterView() {
|
178
|
+
return html`<ia-no-theater-available
|
179
|
+
.identifier=${this.item?.metadata?.identifier}
|
180
|
+
@loadingStateUpdated=${this.loadingStateUpdated}
|
181
|
+
></ia-no-theater-available>`;
|
182
|
+
}
|
183
|
+
|
184
|
+
get theaterSlot() {
|
185
|
+
return html`
|
186
|
+
<slot name="theater-main" style=${this.readerHeightStyle}></slot>
|
187
|
+
`;
|
188
|
+
}
|
189
|
+
|
190
|
+
get booksViewer(): TemplateResult {
|
176
191
|
const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';
|
177
192
|
|
178
193
|
return html`
|
179
194
|
<book-navigator
|
180
195
|
.modal=${this.modal}
|
181
196
|
.baseHost=${this.baseHost}
|
182
|
-
.
|
197
|
+
.itemMD=${this.item}
|
183
198
|
?signedIn=${this.signedIn}
|
184
199
|
?sideMenuOpen=${this.menuOpened}
|
185
200
|
.sharedObserver=${this.sharedObserver}
|
@@ -190,7 +205,7 @@ export class ItemNavigator
|
|
190
205
|
@menuShortcutsUpdated=${this.setMenuShortcuts}
|
191
206
|
>
|
192
207
|
<div slot="theater-main" style=${slotVisibility}>
|
193
|
-
|
208
|
+
${this.theaterSlot}
|
194
209
|
</div>
|
195
210
|
</book-navigator>
|
196
211
|
`;
|
@@ -200,49 +215,27 @@ export class ItemNavigator
|
|
200
215
|
if (!this.item) {
|
201
216
|
return nothing;
|
202
217
|
}
|
203
|
-
if (this.itemType ===
|
204
|
-
return this.
|
218
|
+
if (this.itemType === ItemType.BOOK) {
|
219
|
+
return this.booksViewer;
|
205
220
|
}
|
206
|
-
return
|
207
|
-
class="meow"
|
208
|
-
.itemMD=${this.item}
|
209
|
-
.modal=${this.modal}
|
210
|
-
@updateSideMenu=${this.manageSideMenuEvents}
|
211
|
-
@menuUpdated=${this.setMenuContents}
|
212
|
-
@ViewportInFullScreen=${this.manageViewportFullscreen}
|
213
|
-
@menuShortcutsUpdated=${this.setMenuShortcuts}
|
214
|
-
@loadingStateUpdated=${(e: IntLoadingStateUpdatedEvent) => {
|
215
|
-
console.log(
|
216
|
-
'loadingStateUpdatedloadingStateUpdatedloadingStateUpdatedloadingStateUpdated'
|
217
|
-
);
|
218
|
-
this.loadingStateUpdated(e);
|
219
|
-
}}
|
220
|
-
></ia-item-inspector>`;
|
221
|
+
return this.noTheaterView;
|
221
222
|
}
|
222
223
|
|
223
|
-
loadingStateUpdated(e:
|
224
|
+
loadingStateUpdated(e: loadingStateUpdatedEvent): void {
|
224
225
|
const { loaded } = e.detail;
|
225
|
-
this.loaded =
|
226
|
-
console.log('******loadingStateUpdated', e.detail);
|
227
|
-
}
|
228
|
-
|
229
|
-
/** Creates modal DOM & attaches to `<body>` */
|
230
|
-
private createModal(): void {
|
231
|
-
this.modal = document.createElement(
|
232
|
-
'modal-manager'
|
233
|
-
) as ModalManagerInterface;
|
234
|
-
document.body.appendChild(this.modal);
|
226
|
+
this.loaded = loaded || null;
|
235
227
|
}
|
236
|
-
/* End Modal management */
|
237
228
|
|
238
229
|
/** Fullscreen Management */
|
239
|
-
manageViewportFullscreen(e:
|
240
|
-
|
241
|
-
this.
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
);
|
230
|
+
manageViewportFullscreen(e: ManageFullscreenEvent): void {
|
231
|
+
const fullscreenStatus = !!e.detail.isFullScreen;
|
232
|
+
this.viewportInFullscreen = !fullscreenStatus ? null : fullscreenStatus;
|
233
|
+
|
234
|
+
const event = new CustomEvent('fullscreenToggled', {
|
235
|
+
detail: e.detail,
|
236
|
+
}) as ManageFullscreenEvent;
|
237
|
+
|
238
|
+
this.dispatchEvent(event);
|
246
239
|
}
|
247
240
|
/** End Fullscreen Management */
|
248
241
|
|
@@ -259,22 +252,22 @@ export class ItemNavigator
|
|
259
252
|
this.menuOpened = false;
|
260
253
|
}
|
261
254
|
|
262
|
-
setOpenMenu(e:
|
255
|
+
setOpenMenu(e: ToggleSidePanelOpenEvent): void {
|
263
256
|
const { id } = e.detail;
|
264
|
-
this.openMenu = id
|
257
|
+
this.openMenu = id !== this.openMenu ? id : undefined;
|
265
258
|
}
|
266
259
|
|
267
|
-
setMenuContents(e:
|
260
|
+
setMenuContents(e: SetSideMenuContentsEvent): void {
|
268
261
|
const updatedContents = [...e.detail];
|
269
262
|
this.menuContents = updatedContents;
|
270
263
|
}
|
271
264
|
|
272
|
-
setMenuShortcuts(e:
|
265
|
+
setMenuShortcuts(e: SetSideMenuShortcutsEvent) {
|
273
266
|
this.menuShortcuts = [...e.detail];
|
274
267
|
}
|
275
268
|
|
276
269
|
/** Toggles Side Menu & Sets viewable subpanel */
|
277
|
-
manageSideMenuEvents(e:
|
270
|
+
manageSideMenuEvents(e: ToggleSideMenuOpenEvent): void {
|
278
271
|
const { menuId, action } = e.detail;
|
279
272
|
if (!menuId) {
|
280
273
|
return;
|
@@ -289,7 +282,6 @@ export class ItemNavigator
|
|
289
282
|
}
|
290
283
|
|
291
284
|
get menuToggleButton() {
|
292
|
-
// <ia-icon icon="ellipses" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>
|
293
285
|
return html`
|
294
286
|
<button
|
295
287
|
class="toggle-menu"
|
@@ -305,16 +297,19 @@ export class ItemNavigator
|
|
305
297
|
`;
|
306
298
|
}
|
307
299
|
|
300
|
+
get selectedMenuId(): MenuId | '' {
|
301
|
+
return this.openMenu || '';
|
302
|
+
}
|
303
|
+
|
308
304
|
get renderSideMenu(): TemplateResult {
|
309
305
|
const drawerState = this.menuOpened ? '' : 'hidden';
|
310
|
-
|
311
306
|
return html`
|
312
307
|
<nav>
|
313
308
|
<div class="minimized">${this.shortcuts} ${this.menuToggleButton}</div>
|
314
309
|
<div id="menu" class=${drawerState}>
|
315
310
|
<ia-menu-slider
|
316
311
|
.menus=${this.menuContents}
|
317
|
-
.selectedMenu=${this.
|
312
|
+
.selectedMenu=${this.selectedMenuId}
|
318
313
|
@menuTypeSelected=${this.setOpenMenu}
|
319
314
|
@menuSliderClosed=${this.closeMenu}
|
320
315
|
manuallyHandleClose
|
@@ -327,7 +322,7 @@ export class ItemNavigator
|
|
327
322
|
/** End Side menu */
|
328
323
|
|
329
324
|
/** Menu Shortcuts */
|
330
|
-
openShortcut(selectedMenuId = ''): void {
|
325
|
+
openShortcut(selectedMenuId: MenuId = ''): void {
|
331
326
|
this.openMenu = selectedMenuId;
|
332
327
|
this.menuOpened = true;
|
333
328
|
}
|
@@ -355,7 +350,7 @@ export class ItemNavigator
|
|
355
350
|
return `${drawerState} ${fullscreenState} ${this.openMenuState}`;
|
356
351
|
}
|
357
352
|
|
358
|
-
static get styles() {
|
353
|
+
static get styles(): CSSResult {
|
359
354
|
const subnavWidth = css`var(--menuWidth, 320px)`;
|
360
355
|
const transitionTiming = css`var(--animationTiming, 200ms)`;
|
361
356
|
const transitionEffect = css`transform ${transitionTiming} ease-out`;
|
@@ -365,7 +360,6 @@ export class ItemNavigator
|
|
365
360
|
return css`
|
366
361
|
:host,
|
367
362
|
#frame,
|
368
|
-
#reader,
|
369
363
|
.menu-and-reader {
|
370
364
|
min-height: inherit;
|
371
365
|
height: inherit;
|
@@ -374,6 +368,20 @@ export class ItemNavigator
|
|
374
368
|
display: block;
|
375
369
|
}
|
376
370
|
|
371
|
+
:host,
|
372
|
+
#frame,
|
373
|
+
.menu-and-reader,
|
374
|
+
.loading-area,
|
375
|
+
.loading-view {
|
376
|
+
min-height: inherit;
|
377
|
+
height: inherit;
|
378
|
+
}
|
379
|
+
|
380
|
+
slot {
|
381
|
+
display: block;
|
382
|
+
overflow: hidden;
|
383
|
+
}
|
384
|
+
|
377
385
|
#frame {
|
378
386
|
background-color: ${theaterBg};
|
379
387
|
color-scheme: dark;
|
@@ -388,27 +396,10 @@ export class ItemNavigator
|
|
388
396
|
z-index: 9;
|
389
397
|
}
|
390
398
|
|
391
|
-
#frame.fullscreen,
|
392
|
-
#frame.fullscreen #reader {
|
393
|
-
height: 100vh;
|
394
|
-
}
|
395
|
-
|
396
|
-
.loading-area {
|
397
|
-
position: absolute;
|
398
|
-
top: 0;
|
399
|
-
left: 0;
|
400
|
-
right: 0;
|
401
|
-
bottom: 0;
|
402
|
-
height: inherit;
|
403
|
-
min-height: inherit;
|
404
|
-
}
|
405
|
-
|
406
399
|
.loading-view {
|
407
400
|
display: flex;
|
408
401
|
align-items: center;
|
409
402
|
justify-content: center;
|
410
|
-
min-height: inherit;
|
411
|
-
height: inherit;
|
412
403
|
}
|
413
404
|
|
414
405
|
ia-itemnav-loader {
|
@@ -417,8 +408,7 @@ export class ItemNavigator
|
|
417
408
|
}
|
418
409
|
|
419
410
|
.hidden {
|
420
|
-
|
421
|
-
width: 1px;
|
411
|
+
display: none;
|
422
412
|
}
|
423
413
|
|
424
414
|
button {
|
@@ -509,6 +499,7 @@ export class ItemNavigator
|
|
509
499
|
transition: ${transitionEffect};
|
510
500
|
}
|
511
501
|
|
502
|
+
.open.shift slot[name='theater-header'],
|
512
503
|
.open.shift #reader {
|
513
504
|
width: calc(100% - var(--menuWidth));
|
514
505
|
float: right;
|
@@ -517,5 +508,3 @@ export class ItemNavigator
|
|
517
508
|
`;
|
518
509
|
}
|
519
510
|
}
|
520
|
-
|
521
|
-
customElements.define('ia-menu-slider', IAMenuSlider);
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import {
|
2
|
+
LitElement,
|
3
|
+
customElement,
|
4
|
+
property,
|
5
|
+
html,
|
6
|
+
TemplateResult,
|
7
|
+
PropertyValues,
|
8
|
+
CSSResult,
|
9
|
+
css,
|
10
|
+
} from 'lit-element';
|
11
|
+
|
12
|
+
@customElement('ia-no-theater-available')
|
13
|
+
export class IANoTheaterAvailable extends LitElement {
|
14
|
+
@property({ type: String }) identifier?: string = '';
|
15
|
+
|
16
|
+
emitLoaded(): void {
|
17
|
+
this.dispatchEvent(
|
18
|
+
new CustomEvent<{ loaded: boolean }>('loadingStateUpdated', {
|
19
|
+
detail: { loaded: true },
|
20
|
+
})
|
21
|
+
);
|
22
|
+
}
|
23
|
+
|
24
|
+
updated(changed: PropertyValues): void {
|
25
|
+
if (changed.has('identifier')) {
|
26
|
+
this.emitLoaded();
|
27
|
+
}
|
28
|
+
}
|
29
|
+
|
30
|
+
get downloadUrl(): string {
|
31
|
+
return `/download/${this.identifier}`;
|
32
|
+
}
|
33
|
+
|
34
|
+
render(): TemplateResult {
|
35
|
+
return html`
|
36
|
+
<section>
|
37
|
+
<h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>
|
38
|
+
<p>
|
39
|
+
This item does not appear to have any files that can be experienced on
|
40
|
+
Archive.org. <br />
|
41
|
+
Please download files in this item to interact with them on your
|
42
|
+
computer.
|
43
|
+
</p>
|
44
|
+
<a href=${this.downloadUrl}>Show all files</a>
|
45
|
+
</section>
|
46
|
+
`;
|
47
|
+
}
|
48
|
+
|
49
|
+
static get styles(): CSSResult {
|
50
|
+
return css`
|
51
|
+
:host {
|
52
|
+
color: var(--primaryTextColor, #fff);
|
53
|
+
text-align: center;
|
54
|
+
}
|
55
|
+
section {
|
56
|
+
margin: 10% auto 0;
|
57
|
+
padding: 0 5%;
|
58
|
+
}
|
59
|
+
p {
|
60
|
+
font-size: 1.4rem;
|
61
|
+
}
|
62
|
+
a {
|
63
|
+
color: var(--primaryTextColor, #fff);
|
64
|
+
background-color: rgb(25, 72, 128);
|
65
|
+
min-height: 35px;
|
66
|
+
outline: none;
|
67
|
+
cursor: pointer;
|
68
|
+
line-height: normal;
|
69
|
+
border-radius: 0.4rem;
|
70
|
+
text-align: center;
|
71
|
+
vertical-align: middle;
|
72
|
+
font-size: 1.4rem;
|
73
|
+
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
|
74
|
+
display: inline-block;
|
75
|
+
padding: 0.85rem 1.2rem;
|
76
|
+
border: 1px solid rgb(197, 209, 223);
|
77
|
+
white-space: nowrap;
|
78
|
+
appearance: auto;
|
79
|
+
box-sizing: border-box;
|
80
|
+
user-select: none;
|
81
|
+
text-decoration: none;
|
82
|
+
}
|
83
|
+
`;
|
84
|
+
}
|
85
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
import { ModalManager } from '@internetarchive/modal-manager';
|
2
|
+
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
3
|
+
import { html, customElement, LitElement, property } from 'lit-element';
|
4
|
+
import { MetadataResponse } from '@internetarchive/search-service';
|
5
|
+
import {
|
6
|
+
MenuProviderInterface,
|
7
|
+
MenuShortcutInterface,
|
8
|
+
} from '../src/interfaces/menu-interfaces';
|
9
|
+
import { CustomTheaterInterface } from '../src/interfaces/custom-theater-interface';
|
10
|
+
@customElement('book-navigator')
|
11
|
+
export class BookNavigator
|
12
|
+
extends LitElement
|
13
|
+
implements CustomTheaterInterface {
|
14
|
+
@property({ attribute: false }) modal?: ModalManager;
|
15
|
+
|
16
|
+
@property({ type: Object }) itemMD?: MetadataResponse;
|
17
|
+
|
18
|
+
@property({ type: String }) baseHost?: string;
|
19
|
+
|
20
|
+
@property({ type: Boolean, reflect: true }) signedIn?: boolean | null = null;
|
21
|
+
|
22
|
+
@property({ type: Boolean }) sideMenuOpen!: boolean;
|
23
|
+
|
24
|
+
@property({ attribute: false }) sharedObserver?: SharedResizeObserver;
|
25
|
+
|
26
|
+
@property({ type: Array }) menuProviders?: MenuProviderInterface[];
|
27
|
+
|
28
|
+
@property({ type: Array }) menuShortcuts?: MenuShortcutInterface[];
|
29
|
+
|
30
|
+
emitLoadingStatusUpdate() {}
|
31
|
+
|
32
|
+
addMenuShortcut(menuId: string) {
|
33
|
+
return menuId;
|
34
|
+
}
|
35
|
+
|
36
|
+
removeMenuShortcut(menuId: string) {
|
37
|
+
return menuId;
|
38
|
+
}
|
39
|
+
|
40
|
+
sortMenuShortcuts() {}
|
41
|
+
|
42
|
+
emitMenuShortcutsUpdated() {}
|
43
|
+
|
44
|
+
render() {
|
45
|
+
return html` <p>foo</p> `;
|
46
|
+
}
|
47
|
+
}
|