@internetarchive/ia-item-navigator 0.0.5-1 → 0.0.5-2
Sign up to get free protection for your applications and to get access to all the features.
- package/demo/app-root.ts +173 -19
- package/demo/index.html +4 -0
- package/dist/demo/app-root.d.ts +16 -4
- package/dist/demo/app-root.js +157 -26
- package/dist/demo/app-root.js.map +1 -1
- package/dist/src/item-navigator.js +10 -7
- package/dist/src/item-navigator.js.map +1 -1
- package/package.json +1 -1
- package/src/item-navigator.ts +10 -7
package/demo/app-root.ts
CHANGED
@@ -17,26 +17,46 @@ import { ModalManager } from '@internetarchive/modal-manager';
|
|
17
17
|
import '@internetarchive/modal-manager';
|
18
18
|
import { ItemNavigator } from '../src/item-navigator';
|
19
19
|
import '../src/item-navigator';
|
20
|
+
import {
|
21
|
+
MenuShortcutInterface,
|
22
|
+
MenuDetailsInterface,
|
23
|
+
} from '../src/interfaces/menu-interfaces';
|
20
24
|
@customElement('app-root')
|
21
25
|
export class AppRoot extends LitElement {
|
22
26
|
/**
|
23
27
|
* Example controller to connect to `<ia-item-navigator>`
|
24
28
|
*/
|
25
|
-
@property({ type: Object }) itemMD
|
29
|
+
@property({ type: Object }) itemMD?: MetadataResponse;
|
26
30
|
|
27
31
|
@property({ type: String }) encodedManifest = '';
|
28
32
|
|
29
|
-
@
|
33
|
+
@property({ attribute: false }) sharedObserver = new SharedResizeObserver();
|
30
34
|
|
31
|
-
@
|
35
|
+
@property({ type: Array, attribute: false })
|
36
|
+
menuContents: MenuDetailsInterface[] = [];
|
32
37
|
|
33
|
-
@property({ attribute: false })
|
38
|
+
@property({ type: Array, attribute: false })
|
39
|
+
menuShortcuts: MenuShortcutInterface[] = [];
|
34
40
|
|
35
|
-
@property({
|
41
|
+
@property({ reflect: true, attribute: true }) fullscreen:
|
36
42
|
| boolean
|
37
43
|
| null = null;
|
38
44
|
|
39
|
-
@property({
|
45
|
+
@property({ reflect: true, attribute: true }) headerOn: true | null = null;
|
46
|
+
|
47
|
+
@property({ reflect: true, attribute: true }) loaded = true;
|
48
|
+
|
49
|
+
@property({ reflect: true, attribute: true }) showPlaceholder:
|
50
|
+
| true
|
51
|
+
| null = null;
|
52
|
+
|
53
|
+
@property({ reflect: true, attribute: true }) showTheaterExample:
|
54
|
+
| true
|
55
|
+
| null = true;
|
56
|
+
|
57
|
+
@query('ia-item-navigator') private itemNav!: ItemNavigator;
|
58
|
+
|
59
|
+
@query('modal-manager') modalMgr!: ModalManager;
|
40
60
|
|
41
61
|
firstUpdated() {
|
42
62
|
this.fetchItemMD();
|
@@ -103,10 +123,98 @@ export class AppRoot extends LitElement {
|
|
103
123
|
/** End fullscreen */
|
104
124
|
|
105
125
|
toggleHeader() {
|
106
|
-
this.headerOn =
|
126
|
+
this.headerOn = this.headerOn ? null : true;
|
127
|
+
}
|
128
|
+
|
129
|
+
toggleLoader() {
|
130
|
+
this.loaded = !this.loaded;
|
131
|
+
}
|
132
|
+
|
133
|
+
togglePlaceholder() {
|
134
|
+
this.toggleLoader();
|
135
|
+
const show = this.showPlaceholder ? null : true;
|
136
|
+
this.showPlaceholder = show;
|
137
|
+
}
|
138
|
+
|
139
|
+
toggleImmersion() {
|
140
|
+
const nextState = this.fullscreen ? null : true;
|
141
|
+
if (!nextState) {
|
142
|
+
this.menuShortcuts = [];
|
143
|
+
return;
|
144
|
+
}
|
145
|
+
this.menuShortcuts = [
|
146
|
+
{
|
147
|
+
icon: html`<button
|
148
|
+
@click=${() => {
|
149
|
+
this.fullscreen = null;
|
150
|
+
this.menuContents = [];
|
151
|
+
this.menuShortcuts = [];
|
152
|
+
}}
|
153
|
+
>
|
154
|
+
Exit
|
155
|
+
</button>`,
|
156
|
+
id: 'exit',
|
157
|
+
},
|
158
|
+
];
|
159
|
+
this.menuContents = [
|
160
|
+
{
|
161
|
+
icon: html`<button
|
162
|
+
@click=${() => {
|
163
|
+
this.fullscreen = null;
|
164
|
+
}}
|
165
|
+
>
|
166
|
+
Exit
|
167
|
+
</button>`,
|
168
|
+
id: 'exit',
|
169
|
+
label: 'Exit',
|
170
|
+
selected: false,
|
171
|
+
},
|
172
|
+
];
|
173
|
+
|
174
|
+
this.fullscreen = nextState;
|
175
|
+
}
|
176
|
+
|
177
|
+
toggleTheaterExample() {
|
178
|
+
if (this.showTheaterExample) {
|
179
|
+
// turn on placeholder
|
180
|
+
this.showPlaceholder = true;
|
181
|
+
// turn off example
|
182
|
+
this.showTheaterExample = null;
|
183
|
+
|
184
|
+
this.menuContents = [];
|
185
|
+
this.menuShortcuts = [];
|
186
|
+
return;
|
187
|
+
}
|
188
|
+
|
189
|
+
// turn off placeholder
|
190
|
+
this.showPlaceholder = null;
|
191
|
+
this.showTheaterExample = true;
|
192
|
+
|
193
|
+
const x = {
|
194
|
+
icon: html`<p style="color: red">Allo</p>`,
|
195
|
+
id: 'a',
|
196
|
+
label: 'Hello world',
|
197
|
+
menuDetails: html`<h3>Wheee!</h3>`,
|
198
|
+
} as any;
|
199
|
+
this.menuContents = [x];
|
200
|
+
this.menuShortcuts = [x];
|
107
201
|
}
|
108
202
|
|
109
203
|
/** Views */
|
204
|
+
get theaterExample(): TemplateResult {
|
205
|
+
return html`
|
206
|
+
<div slot="main">
|
207
|
+
<div class="theater-example">
|
208
|
+
<img
|
209
|
+
alt="cat theater"
|
210
|
+
src="https://archive.org/download/encyclopediaofca0000poll_t2e2/__ia_thumb.jpg"
|
211
|
+
/>
|
212
|
+
<h3>Welcome to Cat Theater</h3>
|
213
|
+
</div>
|
214
|
+
</div>
|
215
|
+
`;
|
216
|
+
}
|
217
|
+
|
110
218
|
get headerExample(): TemplateResult {
|
111
219
|
return html`
|
112
220
|
<div slot="header">
|
@@ -124,7 +232,34 @@ export class AppRoot extends LitElement {
|
|
124
232
|
`;
|
125
233
|
}
|
126
234
|
|
235
|
+
get isViewAvailable(): boolean {
|
236
|
+
if (this.showTheaterExample) {
|
237
|
+
return true;
|
238
|
+
}
|
239
|
+
return false;
|
240
|
+
}
|
241
|
+
|
127
242
|
render(): TemplateResult {
|
243
|
+
const {
|
244
|
+
isViewAvailable,
|
245
|
+
loaded,
|
246
|
+
showPlaceholder,
|
247
|
+
headerOn,
|
248
|
+
fullscreen,
|
249
|
+
menuContents,
|
250
|
+
menuShortcuts,
|
251
|
+
showTheaterExample,
|
252
|
+
} = this;
|
253
|
+
console.log('&&&& item nav properties', {
|
254
|
+
loaded,
|
255
|
+
headerOn,
|
256
|
+
isViewAvailable,
|
257
|
+
showTheaterExample,
|
258
|
+
showPlaceholder,
|
259
|
+
fullscreen,
|
260
|
+
menuContents,
|
261
|
+
menuShortcuts,
|
262
|
+
});
|
128
263
|
return html`
|
129
264
|
<h1>theater, in page</h1>
|
130
265
|
<section>
|
@@ -133,14 +268,22 @@ export class AppRoot extends LitElement {
|
|
133
268
|
.item=${this.itemMD}
|
134
269
|
.modal=${this.modalMgr}
|
135
270
|
.sharedObserver=${this.sharedObserver}
|
136
|
-
.loaded=${
|
137
|
-
|
271
|
+
.loaded=${this.loaded}
|
272
|
+
?viewAvailable=${!!this.showTheaterExample}
|
273
|
+
.menuContents=${this.menuContents}
|
274
|
+
.menuShortcuts=${this.menuShortcuts}
|
275
|
+
.viewportInFullscreen=${this.fullscreen}
|
138
276
|
>
|
139
277
|
${this.headerOn ? this.headerExample : ''}
|
278
|
+
${this.showTheaterExample ? this.theaterExample : ''}
|
140
279
|
</ia-item-navigator>
|
141
280
|
</section>
|
142
281
|
<div>
|
143
282
|
<button @click=${this.toggleHeader}>toggle header</button>
|
283
|
+
<button @click=${this.toggleLoader}>toggle loader</button>
|
284
|
+
<button @click=${this.togglePlaceholder}>toggle placeholder</button>
|
285
|
+
<button @click=${this.toggleTheaterExample}>toggle new theater</button>
|
286
|
+
<button @click=${this.toggleImmersion}>toggle immersion</button>
|
144
287
|
</div>
|
145
288
|
<modal-manager></modal-manager>
|
146
289
|
`;
|
@@ -172,17 +315,7 @@ export class AppRoot extends LitElement {
|
|
172
315
|
display: block;
|
173
316
|
position: relative;
|
174
317
|
width: 100%;
|
175
|
-
height: inherit;
|
176
|
-
}
|
177
|
-
ia-item-navigator {
|
178
|
-
height: inherit;
|
179
|
-
min-height: inherit;
|
180
|
-
}
|
181
|
-
div {
|
182
|
-
position: relative;
|
183
|
-
overflow: hidden;
|
184
318
|
height: 100%;
|
185
|
-
min-height: inherit;
|
186
319
|
}
|
187
320
|
|
188
321
|
.embed-link {
|
@@ -190,6 +323,27 @@ export class AppRoot extends LitElement {
|
|
190
323
|
border: 1px solid yellow;
|
191
324
|
}
|
192
325
|
|
326
|
+
.theater-example {
|
327
|
+
color: white;
|
328
|
+
display: flex;
|
329
|
+
justify-content: center;
|
330
|
+
align-items: center;
|
331
|
+
flex-direction: column;
|
332
|
+
margin: 10px;
|
333
|
+
border: 5px dotted yellow;
|
334
|
+
flex: 1;
|
335
|
+
}
|
336
|
+
|
337
|
+
div[slot='main'] {
|
338
|
+
height: 100%;
|
339
|
+
display: flex;
|
340
|
+
flex-direction: column;
|
341
|
+
}
|
342
|
+
|
343
|
+
div[slot='main'] > * {
|
344
|
+
flex: 1;
|
345
|
+
}
|
346
|
+
|
193
347
|
modal-manager[mode='closed'] {
|
194
348
|
display: none;
|
195
349
|
}
|
package/demo/index.html
CHANGED
@@ -2,6 +2,10 @@
|
|
2
2
|
<html lang="en-GB">
|
3
3
|
<head>
|
4
4
|
<meta charset="utf-8">
|
5
|
+
<script type="text/javascript" src="https://polyfill.io/v3/polyfill.min.js?features=es2015%2Ces5%2CglobalThis"></script>
|
6
|
+
<script type="text/javascript" src="https://unpkg.com/lit@2.1.2/polyfill-support.js"></script>
|
7
|
+
<script type="text/javascript" src="https://unpkg.com/@webcomponents/webcomponentsjs@2.2.10/webcomponents-bundle.js"></script>
|
8
|
+
|
5
9
|
<style>
|
6
10
|
html, app-root {
|
7
11
|
font-size: 10px; /* This is to match petabox's base font size */
|
package/dist/demo/app-root.d.ts
CHANGED
@@ -4,17 +4,23 @@ import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
|
4
4
|
import { ModalManager } from '@internetarchive/modal-manager';
|
5
5
|
import '@internetarchive/modal-manager';
|
6
6
|
import '../src/item-navigator';
|
7
|
+
import { MenuShortcutInterface, MenuDetailsInterface } from '../src/interfaces/menu-interfaces';
|
7
8
|
export declare class AppRoot extends LitElement {
|
8
9
|
/**
|
9
10
|
* Example controller to connect to `<ia-item-navigator>`
|
10
11
|
*/
|
11
|
-
itemMD
|
12
|
+
itemMD?: MetadataResponse;
|
12
13
|
encodedManifest: string;
|
13
|
-
private itemNav;
|
14
|
-
modalMgr: ModalManager;
|
15
14
|
sharedObserver: SharedResizeObserver;
|
15
|
+
menuContents: MenuDetailsInterface[];
|
16
|
+
menuShortcuts: MenuShortcutInterface[];
|
16
17
|
fullscreen: boolean | null;
|
17
|
-
headerOn:
|
18
|
+
headerOn: true | null;
|
19
|
+
loaded: boolean;
|
20
|
+
showPlaceholder: true | null;
|
21
|
+
showTheaterExample: true | null;
|
22
|
+
private itemNav;
|
23
|
+
modalMgr: ModalManager;
|
18
24
|
firstUpdated(): void;
|
19
25
|
updated(changed: any): void;
|
20
26
|
fetchItemMD(): Promise<void>;
|
@@ -28,8 +34,14 @@ export declare class AppRoot extends LitElement {
|
|
28
34
|
fullscreenCheck(): void;
|
29
35
|
/** End fullscreen */
|
30
36
|
toggleHeader(): void;
|
37
|
+
toggleLoader(): void;
|
38
|
+
togglePlaceholder(): void;
|
39
|
+
toggleImmersion(): void;
|
40
|
+
toggleTheaterExample(): void;
|
31
41
|
/** Views */
|
42
|
+
get theaterExample(): TemplateResult;
|
32
43
|
get headerExample(): TemplateResult;
|
44
|
+
get isViewAvailable(): boolean;
|
33
45
|
render(): TemplateResult;
|
34
46
|
static styles: import("lit-element").CSSResult;
|
35
47
|
}
|
package/dist/demo/app-root.js
CHANGED
@@ -8,14 +8,15 @@ import '../src/item-navigator';
|
|
8
8
|
let AppRoot = class AppRoot extends LitElement {
|
9
9
|
constructor() {
|
10
10
|
super(...arguments);
|
11
|
-
/**
|
12
|
-
* Example controller to connect to `<ia-item-navigator>`
|
13
|
-
*/
|
14
|
-
this.itemMD = undefined;
|
15
11
|
this.encodedManifest = '';
|
16
12
|
this.sharedObserver = new SharedResizeObserver();
|
13
|
+
this.menuContents = [];
|
14
|
+
this.menuShortcuts = [];
|
17
15
|
this.fullscreen = null;
|
18
|
-
this.headerOn =
|
16
|
+
this.headerOn = null;
|
17
|
+
this.loaded = true;
|
18
|
+
this.showPlaceholder = null;
|
19
|
+
this.showTheaterExample = true;
|
19
20
|
}
|
20
21
|
firstUpdated() {
|
21
22
|
this.fetchItemMD();
|
@@ -66,9 +67,88 @@ let AppRoot = class AppRoot extends LitElement {
|
|
66
67
|
}
|
67
68
|
/** End fullscreen */
|
68
69
|
toggleHeader() {
|
69
|
-
this.headerOn =
|
70
|
+
this.headerOn = this.headerOn ? null : true;
|
71
|
+
}
|
72
|
+
toggleLoader() {
|
73
|
+
this.loaded = !this.loaded;
|
74
|
+
}
|
75
|
+
togglePlaceholder() {
|
76
|
+
this.toggleLoader();
|
77
|
+
const show = this.showPlaceholder ? null : true;
|
78
|
+
this.showPlaceholder = show;
|
79
|
+
}
|
80
|
+
toggleImmersion() {
|
81
|
+
const nextState = this.fullscreen ? null : true;
|
82
|
+
if (!nextState) {
|
83
|
+
this.menuShortcuts = [];
|
84
|
+
return;
|
85
|
+
}
|
86
|
+
this.menuShortcuts = [
|
87
|
+
{
|
88
|
+
icon: html `<button
|
89
|
+
@click=${() => {
|
90
|
+
this.fullscreen = null;
|
91
|
+
this.menuContents = [];
|
92
|
+
this.menuShortcuts = [];
|
93
|
+
}}
|
94
|
+
>
|
95
|
+
Exit
|
96
|
+
</button>`,
|
97
|
+
id: 'exit',
|
98
|
+
},
|
99
|
+
];
|
100
|
+
this.menuContents = [
|
101
|
+
{
|
102
|
+
icon: html `<button
|
103
|
+
@click=${() => {
|
104
|
+
this.fullscreen = null;
|
105
|
+
}}
|
106
|
+
>
|
107
|
+
Exit
|
108
|
+
</button>`,
|
109
|
+
id: 'exit',
|
110
|
+
label: 'Exit',
|
111
|
+
selected: false,
|
112
|
+
},
|
113
|
+
];
|
114
|
+
this.fullscreen = nextState;
|
115
|
+
}
|
116
|
+
toggleTheaterExample() {
|
117
|
+
if (this.showTheaterExample) {
|
118
|
+
// turn on placeholder
|
119
|
+
this.showPlaceholder = true;
|
120
|
+
// turn off example
|
121
|
+
this.showTheaterExample = null;
|
122
|
+
this.menuContents = [];
|
123
|
+
this.menuShortcuts = [];
|
124
|
+
return;
|
125
|
+
}
|
126
|
+
// turn off placeholder
|
127
|
+
this.showPlaceholder = null;
|
128
|
+
this.showTheaterExample = true;
|
129
|
+
const x = {
|
130
|
+
icon: html `<p style="color: red">Allo</p>`,
|
131
|
+
id: 'a',
|
132
|
+
label: 'Hello world',
|
133
|
+
menuDetails: html `<h3>Wheee!</h3>`,
|
134
|
+
};
|
135
|
+
this.menuContents = [x];
|
136
|
+
this.menuShortcuts = [x];
|
70
137
|
}
|
71
138
|
/** Views */
|
139
|
+
get theaterExample() {
|
140
|
+
return html `
|
141
|
+
<div slot="main">
|
142
|
+
<div class="theater-example">
|
143
|
+
<img
|
144
|
+
alt="cat theater"
|
145
|
+
src="https://archive.org/download/encyclopediaofca0000poll_t2e2/__ia_thumb.jpg"
|
146
|
+
/>
|
147
|
+
<h3>Welcome to Cat Theater</h3>
|
148
|
+
</div>
|
149
|
+
</div>
|
150
|
+
`;
|
151
|
+
}
|
72
152
|
get headerExample() {
|
73
153
|
return html `
|
74
154
|
<div slot="header">
|
@@ -85,7 +165,24 @@ let AppRoot = class AppRoot extends LitElement {
|
|
85
165
|
</div>
|
86
166
|
`;
|
87
167
|
}
|
168
|
+
get isViewAvailable() {
|
169
|
+
if (this.showTheaterExample) {
|
170
|
+
return true;
|
171
|
+
}
|
172
|
+
return false;
|
173
|
+
}
|
88
174
|
render() {
|
175
|
+
const { isViewAvailable, loaded, showPlaceholder, headerOn, fullscreen, menuContents, menuShortcuts, showTheaterExample, } = this;
|
176
|
+
console.log('&&&& item nav properties', {
|
177
|
+
loaded,
|
178
|
+
headerOn,
|
179
|
+
isViewAvailable,
|
180
|
+
showTheaterExample,
|
181
|
+
showPlaceholder,
|
182
|
+
fullscreen,
|
183
|
+
menuContents,
|
184
|
+
menuShortcuts,
|
185
|
+
});
|
89
186
|
return html `
|
90
187
|
<h1>theater, in page</h1>
|
91
188
|
<section>
|
@@ -94,14 +191,22 @@ let AppRoot = class AppRoot extends LitElement {
|
|
94
191
|
.item=${this.itemMD}
|
95
192
|
.modal=${this.modalMgr}
|
96
193
|
.sharedObserver=${this.sharedObserver}
|
97
|
-
.loaded=${
|
98
|
-
|
194
|
+
.loaded=${this.loaded}
|
195
|
+
?viewAvailable=${!!this.showTheaterExample}
|
196
|
+
.menuContents=${this.menuContents}
|
197
|
+
.menuShortcuts=${this.menuShortcuts}
|
198
|
+
.viewportInFullscreen=${this.fullscreen}
|
99
199
|
>
|
100
200
|
${this.headerOn ? this.headerExample : ''}
|
201
|
+
${this.showTheaterExample ? this.theaterExample : ''}
|
101
202
|
</ia-item-navigator>
|
102
203
|
</section>
|
103
204
|
<div>
|
104
205
|
<button @click=${this.toggleHeader}>toggle header</button>
|
206
|
+
<button @click=${this.toggleLoader}>toggle loader</button>
|
207
|
+
<button @click=${this.togglePlaceholder}>toggle placeholder</button>
|
208
|
+
<button @click=${this.toggleTheaterExample}>toggle new theater</button>
|
209
|
+
<button @click=${this.toggleImmersion}>toggle immersion</button>
|
105
210
|
</div>
|
106
211
|
<modal-manager></modal-manager>
|
107
212
|
`;
|
@@ -133,17 +238,7 @@ AppRoot.styles = css `
|
|
133
238
|
display: block;
|
134
239
|
position: relative;
|
135
240
|
width: 100%;
|
136
|
-
height: inherit;
|
137
|
-
}
|
138
|
-
ia-item-navigator {
|
139
|
-
height: inherit;
|
140
|
-
min-height: inherit;
|
141
|
-
}
|
142
|
-
div {
|
143
|
-
position: relative;
|
144
|
-
overflow: hidden;
|
145
241
|
height: 100%;
|
146
|
-
min-height: inherit;
|
147
242
|
}
|
148
243
|
|
149
244
|
.embed-link {
|
@@ -151,6 +246,27 @@ AppRoot.styles = css `
|
|
151
246
|
border: 1px solid yellow;
|
152
247
|
}
|
153
248
|
|
249
|
+
.theater-example {
|
250
|
+
color: white;
|
251
|
+
display: flex;
|
252
|
+
justify-content: center;
|
253
|
+
align-items: center;
|
254
|
+
flex-direction: column;
|
255
|
+
margin: 10px;
|
256
|
+
border: 5px dotted yellow;
|
257
|
+
flex: 1;
|
258
|
+
}
|
259
|
+
|
260
|
+
div[slot='main'] {
|
261
|
+
height: 100%;
|
262
|
+
display: flex;
|
263
|
+
flex-direction: column;
|
264
|
+
}
|
265
|
+
|
266
|
+
div[slot='main'] > * {
|
267
|
+
flex: 1;
|
268
|
+
}
|
269
|
+
|
154
270
|
modal-manager[mode='closed'] {
|
155
271
|
display: none;
|
156
272
|
}
|
@@ -161,21 +277,36 @@ __decorate([
|
|
161
277
|
__decorate([
|
162
278
|
property({ type: String })
|
163
279
|
], AppRoot.prototype, "encodedManifest", void 0);
|
164
|
-
__decorate([
|
165
|
-
query('ia-item-navigator')
|
166
|
-
], AppRoot.prototype, "itemNav", void 0);
|
167
|
-
__decorate([
|
168
|
-
query('modal-manager')
|
169
|
-
], AppRoot.prototype, "modalMgr", void 0);
|
170
280
|
__decorate([
|
171
281
|
property({ attribute: false })
|
172
282
|
], AppRoot.prototype, "sharedObserver", void 0);
|
173
283
|
__decorate([
|
174
|
-
property({ type:
|
284
|
+
property({ type: Array, attribute: false })
|
285
|
+
], AppRoot.prototype, "menuContents", void 0);
|
286
|
+
__decorate([
|
287
|
+
property({ type: Array, attribute: false })
|
288
|
+
], AppRoot.prototype, "menuShortcuts", void 0);
|
289
|
+
__decorate([
|
290
|
+
property({ reflect: true, attribute: true })
|
175
291
|
], AppRoot.prototype, "fullscreen", void 0);
|
176
292
|
__decorate([
|
177
|
-
property({
|
293
|
+
property({ reflect: true, attribute: true })
|
178
294
|
], AppRoot.prototype, "headerOn", void 0);
|
295
|
+
__decorate([
|
296
|
+
property({ reflect: true, attribute: true })
|
297
|
+
], AppRoot.prototype, "loaded", void 0);
|
298
|
+
__decorate([
|
299
|
+
property({ reflect: true, attribute: true })
|
300
|
+
], AppRoot.prototype, "showPlaceholder", void 0);
|
301
|
+
__decorate([
|
302
|
+
property({ reflect: true, attribute: true })
|
303
|
+
], AppRoot.prototype, "showTheaterExample", void 0);
|
304
|
+
__decorate([
|
305
|
+
query('ia-item-navigator')
|
306
|
+
], AppRoot.prototype, "itemNav", void 0);
|
307
|
+
__decorate([
|
308
|
+
query('modal-manager')
|
309
|
+
], AppRoot.prototype, "modalMgr", void 0);
|
179
310
|
AppRoot = __decorate([
|
180
311
|
customElement('app-root')
|
181
312
|
], AppRoot);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app-root.js","sourceRoot":"","sources":["../../demo/app-root.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,OAAO,EACL,IAAI,EACJ,GAAG,EACH,UAAU,EACV,aAAa,EACb,QAAQ,EACR,KAAK,GAEN,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,gCAAgC,CAAC;AAExC,OAAO,uBAAuB,CAAC;AAE/B,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IAAvC;;QACE;;WAEG;QACyB,WAAM,GAAiC,SAAS,CAAC;QAEjD,oBAAe,GAAG,EAAE,CAAC;QAMjB,mBAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAEf,eAAU,GAE5D,IAAI,CAAC;QAE6C,aAAQ,GAAG,KAAK,CAAC;IA8JhF,CAAC;IA5JC,YAAY;QACV,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CACT,iCAAiC,EACjC,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,cAAc,CACpB,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,aAAa,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E5C;AAE6C;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;yCAAkB;AAlBnE,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAgLnB;SAhLY,OAAO","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport {\n html,\n css,\n LitElement,\n customElement,\n property,\n query,\n TemplateResult,\n} from 'lit-element';\nimport {\n MetadataResponse,\n SearchService,\n} from '@internetarchive/search-service';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/modal-manager';\nimport { ItemNavigator } from '../src/item-navigator';\nimport '../src/item-navigator';\n@customElement('app-root')\nexport class AppRoot extends LitElement {\n /**\n * Example controller to connect to `<ia-item-navigator>`\n */\n @property({ type: Object }) itemMD: MetadataResponse | undefined = undefined;\n\n @property({ type: String }) encodedManifest = '';\n\n @query('ia-item-navigator') private itemNav!: ItemNavigator;\n\n @query('modal-manager') modalMgr!: ModalManager;\n\n @property({ attribute: false }) sharedObserver = new SharedResizeObserver();\n\n @property({ type: Boolean, reflect: true, attribute: true }) fullscreen:\n | boolean\n | null = null;\n\n @property({ type: Boolean, reflect: true, attribute: true }) headerOn = false;\n\n firstUpdated() {\n this.fetchItemMD();\n console.log(\n '<app-root> component has loaded',\n this.modalMgr,\n this.sharedObserver\n );\n\n this.itemNav.viewAvailable = false;\n }\n\n updated(changed: any) {\n console.log('changed', changed);\n if (changed.has('itemMD')) {\n this.fullscreenCheck();\n }\n }\n\n async fetchItemMD() {\n const searchService = SearchService.default;\n const mdResponse = await searchService.fetchMetadata('ux-team-books');\n\n if (mdResponse.error) {\n console.log('MD Fetch error: ', mdResponse.error);\n (window as any).confirm(\n 'There was an error fetching response, please check dev console'\n );\n return;\n }\n\n console.log('mdResponse.success', JSON.stringify(mdResponse.success));\n this.itemMD = mdResponse.success;\n }\n\n get theaterReady(): boolean {\n return this.modalMgr && this.sharedObserver && !!this.itemMD;\n }\n\n get urlParams(): URLSearchParams {\n return new URLSearchParams(location.search.slice(1));\n }\n\n /** Fullscreen */\n get showFullscreen(): boolean {\n return this.urlParams.get('view') === 'theater';\n }\n\n /** sets url query param `view=theater` to toggle fullscreen */\n toggleFS(): void {\n if (this.urlParams.get('view')) {\n location.search = '';\n } else {\n location.search = 'view=theater';\n }\n }\n\n /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */\n fullscreenCheck(): void {\n if (this.showFullscreen && this.itemNav) {\n this.fullscreen = true;\n }\n }\n /** End fullscreen */\n\n toggleHeader() {\n this.headerOn = !this.headerOn;\n }\n\n /** Views */\n get headerExample(): TemplateResult {\n return html`\n <div slot=\"header\">\n <div class=\"embed-link\">\n <img\n src=\"https://archive.org/images/glogo-jw.png\"\n alt=\"glowing ia logo\"\n />\n <a href=\"/details/goody\">\n The history of Little Goody Two-Shoes : otherwise called Mrs.\n Margery Two-Shoes ... [1766 edition]\n </a>\n </div>\n </div>\n `;\n }\n\n render(): TemplateResult {\n return html`\n <h1>theater, in page</h1>\n <section>\n <ia-item-navigator\n baseHost=\"https://archive.org\"\n .item=${this.itemMD}\n .modal=${this.modalMgr}\n .sharedObserver=${this.sharedObserver}\n .loaded=${true}\n @fullscreenToggled=${this.toggleFS}\n >\n ${this.headerOn ? this.headerExample : ''}\n </ia-item-navigator>\n </section>\n <div>\n <button @click=${this.toggleHeader}>toggle header</button>\n </div>\n <modal-manager></modal-manager>\n `;\n }\n\n static styles = css`\n :host([fullscreen]),\n :host([fullscreen]) section {\n height: 100vh;\n width: 100vw;\n }\n\n :host([fullscreen]) h1 {\n display: none;\n }\n\n h1 {\n color: black;\n }\n\n section {\n border: 1px solid pink;\n color: #222;\n height: calc(100vh - 200px);\n }\n\n :host,\n ia-item-navigator {\n display: block;\n position: relative;\n width: 100%;\n height: inherit;\n }\n ia-item-navigator {\n height: inherit;\n min-height: inherit;\n }\n div {\n position: relative;\n overflow: hidden;\n height: 100%;\n min-height: inherit;\n }\n\n .embed-link {\n height: 55px;\n border: 1px solid yellow;\n }\n\n modal-manager[mode='closed'] {\n display: none;\n }\n `;\n}\n"]}
|
1
|
+
{"version":3,"file":"app-root.js","sourceRoot":"","sources":["../../demo/app-root.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,OAAO,EACL,IAAI,EACJ,GAAG,EACH,UAAU,EACV,aAAa,EACb,QAAQ,EACR,KAAK,GAEN,MAAM,aAAa,CAAC;AACrB,OAAO,EAEL,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,gCAAgC,CAAC;AAExC,OAAO,uBAAuB,CAAC;AAM/B,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IAAvC;;QAM8B,oBAAe,GAAG,EAAE,CAAC;QAEjB,mBAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAG5E,iBAAY,GAA2B,EAAE,CAAC;QAG1C,kBAAa,GAA4B,EAAE,CAAC;QAEE,eAAU,GAE7C,IAAI,CAAC;QAE8B,aAAQ,GAAgB,IAAI,CAAC;QAE7B,WAAM,GAAG,IAAI,CAAC;QAEd,oBAAe,GAElD,IAAI,CAAC;QAE8B,uBAAkB,GAErD,IAAI,CAAC;IAwSlB,CAAC;IAlSC,YAAY;QACV,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CACT,iCAAiC,EACjC,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,cAAc,CACpB,CAAC;QAEF,IAAI,CAAC,OAAO,CAAC,aAAa,GAAG,KAAK,CAAC;IACrC,CAAC;IAED,OAAO,CAAC,OAAY;QAClB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACzB,IAAI,CAAC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,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;yCAA8B;AAE7B;IAA7C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;uCAAe;AAEd;IAA7C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;gDAE7B;AAE8B;IAA7C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;mDAE7B;AAEY;IAA3B,KAAK,CAAC,mBAAmB,CAAC;wCAAiC;AAEpC;IAAvB,KAAK,CAAC,eAAe,CAAC;yCAAyB;AAlCrC,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAsUnB;SAtUY,OAAO","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport {\n html,\n css,\n LitElement,\n customElement,\n property,\n query,\n TemplateResult,\n} from 'lit-element';\nimport {\n MetadataResponse,\n SearchService,\n} from '@internetarchive/search-service';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/modal-manager';\nimport { ItemNavigator } from '../src/item-navigator';\nimport '../src/item-navigator';\nimport {\n MenuShortcutInterface,\n MenuDetailsInterface,\n} from '../src/interfaces/menu-interfaces';\n@customElement('app-root')\nexport class AppRoot extends LitElement {\n /**\n * Example controller to connect to `<ia-item-navigator>`\n */\n @property({ type: Object }) itemMD?: MetadataResponse;\n\n @property({ type: String }) encodedManifest = '';\n\n @property({ attribute: false }) sharedObserver = new SharedResizeObserver();\n\n @property({ type: Array, attribute: false })\n menuContents: MenuDetailsInterface[] = [];\n\n @property({ type: Array, attribute: false })\n menuShortcuts: MenuShortcutInterface[] = [];\n\n @property({ reflect: true, attribute: true }) fullscreen:\n | boolean\n | null = null;\n\n @property({ reflect: true, attribute: true }) headerOn: true | null = null;\n\n @property({ reflect: true, attribute: true }) loaded = true;\n\n @property({ reflect: true, attribute: true }) showPlaceholder:\n | true\n | null = null;\n\n @property({ reflect: true, attribute: true }) showTheaterExample:\n | true\n | null = true;\n\n @query('ia-item-navigator') private itemNav!: ItemNavigator;\n\n @query('modal-manager') modalMgr!: ModalManager;\n\n firstUpdated() {\n this.fetchItemMD();\n console.log(\n '<app-root> component has loaded',\n this.modalMgr,\n this.sharedObserver\n );\n\n this.itemNav.viewAvailable = false;\n }\n\n updated(changed: any) {\n console.log('changed', changed);\n if (changed.has('itemMD')) {\n this.fullscreenCheck();\n }\n }\n\n async fetchItemMD() {\n const searchService = SearchService.default;\n const mdResponse = await searchService.fetchMetadata('ux-team-books');\n\n if (mdResponse.error) {\n console.log('MD Fetch error: ', mdResponse.error);\n (window as any).confirm(\n 'There was an error fetching response, please check dev console'\n );\n return;\n }\n\n console.log('mdResponse.success', JSON.stringify(mdResponse.success));\n this.itemMD = mdResponse.success;\n }\n\n get theaterReady(): boolean {\n return this.modalMgr && this.sharedObserver && !!this.itemMD;\n }\n\n get urlParams(): URLSearchParams {\n return new URLSearchParams(location.search.slice(1));\n }\n\n /** Fullscreen */\n get showFullscreen(): boolean {\n return this.urlParams.get('view') === 'theater';\n }\n\n /** sets url query param `view=theater` to toggle fullscreen */\n toggleFS(): void {\n if (this.urlParams.get('view')) {\n location.search = '';\n } else {\n location.search = 'view=theater';\n }\n }\n\n /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */\n fullscreenCheck(): void {\n if (this.showFullscreen && this.itemNav) {\n this.fullscreen = true;\n }\n }\n /** End fullscreen */\n\n toggleHeader() {\n this.headerOn = this.headerOn ? null : true;\n }\n\n toggleLoader() {\n this.loaded = !this.loaded;\n }\n\n togglePlaceholder() {\n this.toggleLoader();\n const show = this.showPlaceholder ? null : true;\n this.showPlaceholder = show;\n }\n\n toggleImmersion() {\n const nextState = this.fullscreen ? null : true;\n if (!nextState) {\n this.menuShortcuts = [];\n return;\n }\n this.menuShortcuts = [\n {\n icon: html`<button\n @click=${() => {\n this.fullscreen = null;\n this.menuContents = [];\n this.menuShortcuts = [];\n }}\n >\n Exit\n </button>`,\n id: 'exit',\n },\n ];\n this.menuContents = [\n {\n icon: html`<button\n @click=${() => {\n this.fullscreen = null;\n }}\n >\n Exit\n </button>`,\n id: 'exit',\n label: 'Exit',\n selected: false,\n },\n ];\n\n this.fullscreen = nextState;\n }\n\n toggleTheaterExample() {\n if (this.showTheaterExample) {\n // turn on placeholder\n this.showPlaceholder = true;\n // turn off example\n this.showTheaterExample = null;\n\n this.menuContents = [];\n this.menuShortcuts = [];\n return;\n }\n\n // turn off placeholder\n this.showPlaceholder = null;\n this.showTheaterExample = true;\n\n const x = {\n icon: html`<p style=\"color: red\">Allo</p>`,\n id: 'a',\n label: 'Hello world',\n menuDetails: html`<h3>Wheee!</h3>`,\n } as any;\n this.menuContents = [x];\n this.menuShortcuts = [x];\n }\n\n /** Views */\n get theaterExample(): TemplateResult {\n return html`\n <div slot=\"main\">\n <div class=\"theater-example\">\n <img\n alt=\"cat theater\"\n src=\"https://archive.org/download/encyclopediaofca0000poll_t2e2/__ia_thumb.jpg\"\n />\n <h3>Welcome to Cat Theater</h3>\n </div>\n </div>\n `;\n }\n\n get headerExample(): TemplateResult {\n return html`\n <div slot=\"header\">\n <div class=\"embed-link\">\n <img\n src=\"https://archive.org/images/glogo-jw.png\"\n alt=\"glowing ia logo\"\n />\n <a href=\"/details/goody\">\n The history of Little Goody Two-Shoes : otherwise called Mrs.\n Margery Two-Shoes ... [1766 edition]\n </a>\n </div>\n </div>\n `;\n }\n\n get isViewAvailable(): boolean {\n if (this.showTheaterExample) {\n return true;\n }\n return false;\n }\n\n render(): TemplateResult {\n const {\n isViewAvailable,\n loaded,\n showPlaceholder,\n headerOn,\n fullscreen,\n menuContents,\n menuShortcuts,\n showTheaterExample,\n } = this;\n console.log('&&&& item nav properties', {\n loaded,\n headerOn,\n isViewAvailable,\n showTheaterExample,\n showPlaceholder,\n fullscreen,\n menuContents,\n menuShortcuts,\n });\n return html`\n <h1>theater, in page</h1>\n <section>\n <ia-item-navigator\n baseHost=\"https://archive.org\"\n .item=${this.itemMD}\n .modal=${this.modalMgr}\n .sharedObserver=${this.sharedObserver}\n .loaded=${this.loaded}\n ?viewAvailable=${!!this.showTheaterExample}\n .menuContents=${this.menuContents}\n .menuShortcuts=${this.menuShortcuts}\n .viewportInFullscreen=${this.fullscreen}\n >\n ${this.headerOn ? this.headerExample : ''}\n ${this.showTheaterExample ? this.theaterExample : ''}\n </ia-item-navigator>\n </section>\n <div>\n <button @click=${this.toggleHeader}>toggle header</button>\n <button @click=${this.toggleLoader}>toggle loader</button>\n <button @click=${this.togglePlaceholder}>toggle placeholder</button>\n <button @click=${this.toggleTheaterExample}>toggle new theater</button>\n <button @click=${this.toggleImmersion}>toggle immersion</button>\n </div>\n <modal-manager></modal-manager>\n `;\n }\n\n static styles = css`\n :host([fullscreen]),\n :host([fullscreen]) section {\n height: 100vh;\n width: 100vw;\n }\n\n :host([fullscreen]) h1 {\n display: none;\n }\n\n h1 {\n color: black;\n }\n\n section {\n border: 1px solid pink;\n color: #222;\n height: calc(100vh - 200px);\n }\n\n :host,\n ia-item-navigator {\n display: block;\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .embed-link {\n height: 55px;\n border: 1px solid yellow;\n }\n\n .theater-example {\n color: white;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n margin: 10px;\n border: 5px dotted yellow;\n flex: 1;\n }\n\n div[slot='main'] {\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n\n div[slot='main'] > * {\n flex: 1;\n }\n\n modal-manager[mode='closed'] {\n display: none;\n }\n `;\n}\n"]}
|
@@ -84,11 +84,14 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
84
84
|
this.requestUpdate();
|
85
85
|
}
|
86
86
|
render() {
|
87
|
+
var _a, _b;
|
87
88
|
const displayReaderClass = this.loaded ? '' : 'hidden';
|
89
|
+
const headerHeight = ((_b = (_a = this.headerSlot) === null || _a === void 0 ? void 0 : _a.assignedNodes()[0]) === null || _b === void 0 ? void 0 : _b.offsetHeight) || 0;
|
88
90
|
return html `
|
89
91
|
<div id="frame" class=${this.menuClass}>
|
90
92
|
<slot
|
91
93
|
name="header"
|
94
|
+
style=${`height: ${headerHeight}px`}
|
92
95
|
@slotchange=${(e) => this.slotChange(e, 'header')}
|
93
96
|
></slot>
|
94
97
|
<div class="menu-and-reader">
|
@@ -230,7 +233,9 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
230
233
|
/** End Menu Shortcuts */
|
231
234
|
/** Misc Render */
|
232
235
|
get menuClass() {
|
233
|
-
|
236
|
+
var _a, _b;
|
237
|
+
const hasMenuOrShortcuts = ((_a = this.menuContents) === null || _a === void 0 ? void 0 : _a.length) || ((_b = this.menuShortcuts) === null || _b === void 0 ? void 0 : _b.length);
|
238
|
+
const drawerState = this.menuOpened && hasMenuOrShortcuts ? 'open' : '';
|
234
239
|
const fullscreenState = this.viewportInFullscreen ? 'fullscreen' : '';
|
235
240
|
return `${drawerState} ${fullscreenState} ${this.openMenuState}`;
|
236
241
|
}
|
@@ -244,8 +249,6 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
244
249
|
:host,
|
245
250
|
#frame,
|
246
251
|
.menu-and-reader {
|
247
|
-
min-height: inherit;
|
248
|
-
height: inherit;
|
249
252
|
position: relative;
|
250
253
|
overflow: hidden;
|
251
254
|
display: block;
|
@@ -253,7 +256,6 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
253
256
|
|
254
257
|
:host,
|
255
258
|
#frame,
|
256
|
-
.menu-and-reader,
|
257
259
|
.loading-area,
|
258
260
|
.loading-view {
|
259
261
|
min-height: inherit;
|
@@ -288,6 +290,7 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
288
290
|
}
|
289
291
|
|
290
292
|
.loading-view {
|
293
|
+
height: 100%;
|
291
294
|
display: flex;
|
292
295
|
align-items: center;
|
293
296
|
justify-content: center;
|
@@ -320,6 +323,7 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
320
323
|
.menu-and-reader {
|
321
324
|
position: relative;
|
322
325
|
display: flex;
|
326
|
+
flex: 1;
|
323
327
|
}
|
324
328
|
|
325
329
|
nav button {
|
@@ -382,7 +386,6 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
382
386
|
z-index: 1;
|
383
387
|
transform: translateX(0);
|
384
388
|
width: 100%;
|
385
|
-
flex: 1;
|
386
389
|
display: flex;
|
387
390
|
}
|
388
391
|
|
@@ -403,8 +406,8 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
403
406
|
}
|
404
407
|
|
405
408
|
.open.shift #reader {
|
406
|
-
width: calc(100% -
|
407
|
-
|
409
|
+
width: calc(100% - ${subnavWidth});
|
410
|
+
margin-left: ${subnavWidth};
|
408
411
|
transition: ${transitionEffect};
|
409
412
|
}
|
410
413
|
`;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"item-navigator.js","sourceRoot":"","sources":["../../src/item-navigator.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,aAAa,EACb,QAAQ,EACR,KAAK,EACL,KAAK,GAGN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAkB,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAKnE,OAAO,iCAAiC,CAAC;AAGzC,OAAO,8CAA8C,CAAC;AACtD,OAAO,UAAU,CAAC;AAgBlB,OAAO,wBAAwB,CAAC;AAGhC,IAAa,aAAa,GAA1B,MAAa,aACX,SAAQ,UAAU;IADpB;;QAc+B,kBAAa,GAAY,IAAI,CAAC;QAE/B,aAAQ,GAAG,aAAa,CAAC;QAUrD,aAAQ,GAAG,KAAK,CAAC;QAEU,iBAAY,GAA4B,EAAE,CAAC;QAE3C,kBAAa,GAA4B,EAAE,CAAC;QAGvE,yBAAoB,GAAm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;+CACe;AAEU;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;mDAA4C;AAE3C;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAA6C;AAGvE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;2DAChB;AAEf;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAAoB;AAEpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAmB;AAEd;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAsB;AAErB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDAAuC;AAET;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;6CAE5C;AAEP;IAAR,KAAK,EAAE;oDAA8C;AAErC;IAAhB,KAAK,CAAC,QAAQ,CAAC;4CAAgC;AAElB;IAA7B,KAAK,CAAC,qBAAqB,CAAC;iDAAsC;AAEvC;IAA3B,KAAK,CAAC,mBAAmB,CAAC;+CAAoC;AArDpD,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CA8dzB;SA9dY,aAAa","sourcesContent":["import {\n css,\n html,\n LitElement,\n customElement,\n property,\n state,\n query,\n PropertyValues,\n CSSResult,\n} from 'lit-element';\nimport { nothing, TemplateResult } from 'lit-html';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport {\n SharedResizeObserver,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport '@internetarchive/ia-menu-slider';\n\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/icon-ellipses/icon-ellipses';\nimport './loader';\n\nimport {\n ToggleSideMenuOpenEvent,\n ToggleSidePanelOpenEvent,\n SetSideMenuContentsEvent,\n SetSideMenuShortcutsEvent,\n loadingStateUpdatedEvent,\n ManageFullscreenEvent,\n} from './interfaces/event-interfaces';\n\nimport {\n MenuProviderInterface,\n MenuShortcutInterface,\n MenuId,\n} from './interfaces/menu-interfaces';\nimport './no-theater-available';\n\n@customElement('ia-item-navigator')\nexport class ItemNavigator\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface {\n @property({\n type: Object,\n converter: (value: string | MetadataResponse | null): MetadataResponse => {\n if (value && typeof value === 'string') {\n return new MetadataResponse(JSON.parse(atob(value)));\n }\n return value as MetadataResponse;\n },\n })\n item?: MetadataResponse;\n\n @property({ type: Boolean }) viewAvailable: Boolean = true;\n\n @property({ type: String }) baseHost = 'archive.org';\n\n @property({\n converter: (arg: string | boolean | null) => {\n if (typeof arg === 'boolean') {\n return arg;\n }\n return arg === 'true';\n },\n })\n signedIn = false;\n\n @property({ type: Array }) menuContents: MenuProviderInterface[] = [];\n\n @property({ type: Array }) menuShortcuts: MenuShortcutInterface[] = [];\n\n @property({ type: Boolean, reflect: true, attribute: true })\n viewportInFullscreen: boolean | null = null;\n\n @property({ type: Boolean }) menuOpened = false;\n\n @property({ type: String }) openMenu?: MenuId;\n\n @property({ attribute: false }) modal?: ModalManager;\n\n @property({ attribute: false }) sharedObserver?: SharedResizeObserver;\n\n @property({ type: Boolean, reflect: true, attribute: true }) loaded:\n | true\n | null = null;\n\n @state() openMenuState: 'overlay' | 'shift' = 'shift';\n\n @query('#frame') private frame!: HTMLDivElement;\n\n @query('slot[name=\"header\"]') private headerSlot!: HTMLSlotElement;\n\n @query('slot[name=\"main\"]') private mainSlot!: HTMLSlotElement;\n\n disconnectedCallback() {\n this.removeResizeObserver();\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('sharedObserver')) {\n const oldObserver = changed.get('sharedObserver') as SharedResizeObserver;\n oldObserver?.removeObserver(this.resizeObserverConfig);\n this.setResizeObserver();\n }\n }\n\n /** Shared observer */\n handleResize(entry: ResizeObserverEntry): void {\n const { width } = entry.contentRect;\n if (width <= 600) {\n this.openMenuState = 'overlay';\n return;\n }\n this.openMenuState = 'shift';\n }\n\n private setResizeObserver(): void {\n this.sharedObserver?.addObserver(this.resizeObserverConfig);\n this.sharedObserver?.addObserver({\n target: this.headerSlot,\n handler: {\n handleResize: ({ contentRect }) => {\n if (contentRect.height) {\n this.requestUpdate();\n }\n },\n },\n });\n }\n\n private removeResizeObserver(): void {\n this.sharedObserver?.removeObserver(this.resizeObserverConfig);\n }\n\n get resizeObserverConfig(): {\n handler: SharedResizeObserverResizeHandlerInterface;\n target: Element;\n } {\n return {\n handler: this,\n target: this.frame,\n };\n }\n /** End shared observer */\n\n get loaderTitle() {\n return this.viewportInFullscreen ? 'Internet Archive' : '';\n }\n\n get loadingArea() {\n return html`\n <div class=\"loading-area\">\n <div class=\"loading-view\">\n <ia-itemnav-loader .title=${this.loaderTitle}></ia-itemnav-loader>\n </div>\n </div>\n `;\n }\n\n slotChange(e: Event, type: 'header' | 'main'): void {\n const slottedContent = (e.target as HTMLSlotElement).assignedNodes()?.[0] as HTMLElement;\n\n this.dispatchEvent(\n new CustomEvent('slotChange', {\n detail: { slot: slottedContent, type },\n })\n );\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n const displayReaderClass = this.loaded ? '' : 'hidden';\n return html`\n <div id=\"frame\" class=${this.menuClass}>\n <slot\n name=\"header\"\n @slotchange=${(e: Event) => this.slotChange(e, 'header')}\n ></slot>\n <div class=\"menu-and-reader\">\n ${this.shouldRenderMenu ? this.renderSideMenu : nothing}\n <div id=\"reader\" class=${displayReaderClass}>\n ${this.renderViewport}\n </div>\n ${!this.loaded ? this.loadingArea : nothing}\n </div>\n </div>\n `;\n }\n\n get noTheaterView() {\n return html`<ia-no-theater-available\n .identifier=${this.item?.metadata?.identifier}\n @loadingStateUpdated=${this.loadingStateUpdated}\n ></ia-no-theater-available>`;\n }\n\n get renderViewport(): TemplateResult | typeof nothing {\n if (!this.viewAvailable) {\n return this.noTheaterView;\n }\n\n const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';\n return html`\n <div slot=\"main\" style=${slotVisibility}>\n <slot\n name=\"main\"\n @slotchange=${(e: Event) => this.slotChange(e, 'main')}\n ></slot>\n </div>\n `;\n }\n\n loadingStateUpdated(e: loadingStateUpdatedEvent): void {\n const { loaded } = e.detail;\n this.loaded = loaded || null;\n }\n\n /** Fullscreen Management */\n manageViewportFullscreen(e: ManageFullscreenEvent): void {\n const fullscreenStatus = !!e.detail.isFullScreen;\n this.viewportInFullscreen = !fullscreenStatus ? null : fullscreenStatus;\n\n const event = new CustomEvent('fullscreenToggled', {\n detail: e.detail,\n }) as ManageFullscreenEvent;\n\n this.dispatchEvent(event);\n }\n /** End Fullscreen Management */\n\n /** Side menu */\n get shouldRenderMenu(): boolean {\n return !!this.menuContents?.length;\n }\n\n toggleMenu(): void {\n this.menuOpened = !this.menuOpened;\n }\n\n closeMenu(): void {\n this.menuOpened = false;\n }\n\n setOpenMenu(e: ToggleSidePanelOpenEvent): void {\n const { id } = e.detail;\n this.openMenu = id !== this.openMenu ? id : undefined;\n }\n\n setMenuContents(e: SetSideMenuContentsEvent): void {\n const updatedContents = [...e.detail];\n this.menuContents = updatedContents;\n }\n\n setMenuShortcuts(e: SetSideMenuShortcutsEvent) {\n this.menuShortcuts = [...e.detail];\n }\n\n /** Toggles Side Menu & Sets viewable subpanel */\n manageSideMenuEvents(e: ToggleSideMenuOpenEvent): void {\n const { menuId, action } = e.detail;\n if (!menuId) {\n return;\n }\n\n if (action === 'open') {\n this.openShortcut(menuId);\n } else if (action === 'toggle') {\n this.openMenu = menuId;\n this.toggleMenu();\n }\n }\n\n get menuToggleButton() {\n return html`\n <button\n class=\"toggle-menu\"\n @click=${this.toggleMenu}\n title=\"Toggle theater side panels\"\n >\n <div>\n <ia-icon-ellipses\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-ellipses>\n </div>\n </button>\n `;\n }\n\n get selectedMenuId(): MenuId | '' {\n return this.openMenu || '';\n }\n\n get renderSideMenu(): TemplateResult {\n const drawerState = this.menuOpened ? '' : 'hidden';\n return html`\n <nav>\n <div class=\"minimized\">${this.shortcuts} ${this.menuToggleButton}</div>\n <div id=\"menu\" class=${drawerState}>\n <ia-menu-slider\n .menus=${this.menuContents}\n .selectedMenu=${this.selectedMenuId}\n @menuTypeSelected=${this.setOpenMenu}\n @menuSliderClosed=${this.closeMenu}\n manuallyHandleClose\n open\n ></ia-menu-slider>\n </div>\n </nav>\n `;\n }\n /** End Side menu */\n\n /** Menu Shortcuts */\n openShortcut(selectedMenuId: MenuId = ''): void {\n this.openMenu = selectedMenuId;\n this.menuOpened = true;\n }\n\n get shortcuts(): TemplateResult {\n const shortcuts = this.menuShortcuts.map(({ icon, id }) => {\n if (id === 'fullscreen') {\n return html`${icon}`;\n }\n\n return html`\n <button class=\"shortcut ${id}\" @click=\"${() => this.openShortcut(id)}\">\n ${icon}\n </button>\n `;\n });\n return html`<div class=\"shortcuts\">${shortcuts}</div>`;\n }\n /** End Menu Shortcuts */\n\n /** Misc Render */\n get menuClass(): string {\n const drawerState = this.menuOpened ? 'open' : '';\n const fullscreenState = this.viewportInFullscreen ? 'fullscreen' : '';\n return `${drawerState} ${fullscreenState} ${this.openMenuState}`;\n }\n\n static get styles(): CSSResult {\n const subnavWidth = css`var(--menuWidth, 320px)`;\n const transitionTiming = css`var(--animationTiming, 200ms)`;\n const transitionEffect = css`transform ${transitionTiming} ease-out`;\n const menuMargin = css`var(--theaterMenuMargin, 42px)`;\n const theaterBg = css`var(--theaterBgColor, #000)`;\n\n return css`\n :host,\n #frame,\n .menu-and-reader {\n min-height: inherit;\n height: inherit;\n position: relative;\n overflow: hidden;\n display: block;\n }\n\n :host,\n #frame,\n .menu-and-reader,\n .loading-area,\n .loading-view {\n min-height: inherit;\n height: inherit;\n }\n\n slot {\n display: block;\n overflow: hidden;\n width: 100%;\n }\n\n slot * {\n display: block;\n height: inherit;\n }\n\n #frame {\n background-color: ${theaterBg};\n color-scheme: dark;\n display: flex;\n flex-direction: column;\n }\n\n #frame.fullscreen {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 9;\n }\n\n .loading-view {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .loading-area {\n width: 100%;\n }\n\n ia-itemnav-loader {\n display: block;\n width: 100%;\n }\n\n .hidden {\n display: none !important;\n }\n\n button {\n cursor: pointer;\n padding: 0;\n border: 0;\n }\n\n button:focus,\n button:active {\n outline: none;\n }\n\n .menu-and-reader {\n position: relative;\n display: flex;\n }\n\n nav button {\n background: none;\n }\n\n nav .minimized {\n background: rgba(0, 0, 0, 0.7);\n padding-top: 6px;\n position: absolute;\n width: ${menuMargin};\n z-index: 2;\n left: 0;\n border-bottom-right-radius: 5%;\n }\n\n nav .minimized button {\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin-bottom: 0.2rem;\n margin: auto;\n display: inline-flex;\n vertical-align: middle;\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n width: ${menuMargin};\n height: ${menuMargin};\n }\n\n nav .minimized button.toggle-menu > * {\n border: 2px solid var(--iconStrokeColor);\n border-radius: var(--iconWidth);\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n }\n\n ia-icon-ellipses {\n width: var(--iconWidth);\n height: var(--iconHeight);\n }\n\n #menu {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 3;\n overflow: hidden;\n transform: translateX(-${subnavWidth});\n width: ${subnavWidth};\n transform: translateX(calc(${subnavWidth} * -1));\n transition: ${transitionEffect};\n }\n\n #reader {\n position: relative;\n z-index: 1;\n transform: translateX(0);\n width: 100%;\n flex: 1;\n display: flex;\n }\n\n #reader > * {\n width: 100%;\n display: flex;\n flex: 1;\n }\n\n .open.overlay #reader {\n transition: none;\n }\n\n .open #menu {\n width: ${subnavWidth};\n transform: translateX(0);\n transition: ${transitionEffect};\n }\n\n .open.shift #reader {\n width: calc(100% - var(--menuWidth));\n float: right;\n transition: ${transitionEffect};\n }\n `;\n }\n}\n"]}
|
1
|
+
{"version":3,"file":"item-navigator.js","sourceRoot":"","sources":["../../src/item-navigator.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,aAAa,EACb,QAAQ,EACR,KAAK,EACL,KAAK,GAGN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAkB,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAKnE,OAAO,iCAAiC,CAAC;AAGzC,OAAO,8CAA8C,CAAC;AACtD,OAAO,UAAU,CAAC;AAgBlB,OAAO,wBAAwB,CAAC;AAGhC,IAAa,aAAa,GAA1B,MAAa,aACX,SAAQ,UAAU;IADpB;;QAc+B,kBAAa,GAAY,IAAI,CAAC;QAE/B,aAAQ,GAAG,aAAa,CAAC;QAUrD,aAAQ,GAAG,KAAK,CAAC;QAEU,iBAAY,GAA4B,EAAE,CAAC;QAE3C,kBAAa,GAA4B,EAAE,CAAC;QAGvE,yBAAoB,GAAmB,IAAI,CAAC;QAEf,eAAU,GAAG,KAAK,CAAC;QAQa,WAAM,GAExD,IAAI,CAAC;QAEP,kBAAa,GAAwB,OAAO,CAAC;IAkbxD,CAAC;IA1aC,oBAAoB;QAClB,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,OAAuB;QAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,EAAE;YACjC,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAyB,CAAC;YAC1E,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,cAAc,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YACvD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EAAE,KAAK,EAAE,CAAC;oDAA6C;AAGvE;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;2DAChB;AAEf;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;iDAAoB;AAEpB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAmB;AAEd;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAsB;AAErB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDAAuC;AAET;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;6CAE5C;AAEP;IAAR,KAAK,EAAE;oDAA8C;AAErC;IAAhB,KAAK,CAAC,QAAQ,CAAC;4CAAgC;AAElB;IAA7B,KAAK,CAAC,qBAAqB,CAAC;iDAAsC;AAEvC;IAA3B,KAAK,CAAC,mBAAmB,CAAC;+CAAoC;AArDpD,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAiezB;SAjeY,aAAa","sourcesContent":["import {\n css,\n html,\n LitElement,\n customElement,\n property,\n state,\n query,\n PropertyValues,\n CSSResult,\n} from 'lit-element';\nimport { nothing, TemplateResult } from 'lit-html';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport {\n SharedResizeObserver,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport '@internetarchive/ia-menu-slider';\n\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/icon-ellipses/icon-ellipses';\nimport './loader';\n\nimport {\n ToggleSideMenuOpenEvent,\n ToggleSidePanelOpenEvent,\n SetSideMenuContentsEvent,\n SetSideMenuShortcutsEvent,\n loadingStateUpdatedEvent,\n ManageFullscreenEvent,\n} from './interfaces/event-interfaces';\n\nimport {\n MenuProviderInterface,\n MenuShortcutInterface,\n MenuId,\n} from './interfaces/menu-interfaces';\nimport './no-theater-available';\n\n@customElement('ia-item-navigator')\nexport class ItemNavigator\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface {\n @property({\n type: Object,\n converter: (value: string | MetadataResponse | null): MetadataResponse => {\n if (value && typeof value === 'string') {\n return new MetadataResponse(JSON.parse(atob(value)));\n }\n return value as MetadataResponse;\n },\n })\n item?: MetadataResponse;\n\n @property({ type: Boolean }) viewAvailable: Boolean = true;\n\n @property({ type: String }) baseHost = 'archive.org';\n\n @property({\n converter: (arg: string | boolean | null) => {\n if (typeof arg === 'boolean') {\n return arg;\n }\n return arg === 'true';\n },\n })\n signedIn = false;\n\n @property({ type: Array }) menuContents: MenuProviderInterface[] = [];\n\n @property({ type: Array }) menuShortcuts: MenuShortcutInterface[] = [];\n\n @property({ type: Boolean, reflect: true, attribute: true })\n viewportInFullscreen: boolean | null = null;\n\n @property({ type: Boolean }) menuOpened = false;\n\n @property({ type: String }) openMenu?: MenuId;\n\n @property({ attribute: false }) modal?: ModalManager;\n\n @property({ attribute: false }) sharedObserver?: SharedResizeObserver;\n\n @property({ type: Boolean, reflect: true, attribute: true }) loaded:\n | true\n | null = null;\n\n @state() openMenuState: 'overlay' | 'shift' = 'shift';\n\n @query('#frame') private frame!: HTMLDivElement;\n\n @query('slot[name=\"header\"]') private headerSlot!: HTMLSlotElement;\n\n @query('slot[name=\"main\"]') private mainSlot!: HTMLSlotElement;\n\n disconnectedCallback() {\n this.removeResizeObserver();\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('sharedObserver')) {\n const oldObserver = changed.get('sharedObserver') as SharedResizeObserver;\n oldObserver?.removeObserver(this.resizeObserverConfig);\n this.setResizeObserver();\n }\n }\n\n /** Shared observer */\n handleResize(entry: ResizeObserverEntry): void {\n const { width } = entry.contentRect;\n if (width <= 600) {\n this.openMenuState = 'overlay';\n return;\n }\n this.openMenuState = 'shift';\n }\n\n private setResizeObserver(): void {\n this.sharedObserver?.addObserver(this.resizeObserverConfig);\n this.sharedObserver?.addObserver({\n target: this.headerSlot,\n handler: {\n handleResize: ({ contentRect }) => {\n if (contentRect.height) {\n this.requestUpdate();\n }\n },\n },\n });\n }\n\n private removeResizeObserver(): void {\n this.sharedObserver?.removeObserver(this.resizeObserverConfig);\n }\n\n get resizeObserverConfig(): {\n handler: SharedResizeObserverResizeHandlerInterface;\n target: Element;\n } {\n return {\n handler: this,\n target: this.frame,\n };\n }\n /** End shared observer */\n\n get loaderTitle() {\n return this.viewportInFullscreen ? 'Internet Archive' : '';\n }\n\n get loadingArea() {\n return html`\n <div class=\"loading-area\">\n <div class=\"loading-view\">\n <ia-itemnav-loader .title=${this.loaderTitle}></ia-itemnav-loader>\n </div>\n </div>\n `;\n }\n\n slotChange(e: Event, type: 'header' | 'main'): void {\n const slottedContent = (e.target as HTMLSlotElement).assignedNodes()?.[0] as HTMLElement;\n\n this.dispatchEvent(\n new CustomEvent('slotChange', {\n detail: { slot: slottedContent, type },\n })\n );\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n const displayReaderClass = this.loaded ? '' : 'hidden';\n const headerHeight =\n (this.headerSlot?.assignedNodes()[0] as HTMLElement)?.offsetHeight || 0;\n return html`\n <div id=\"frame\" class=${this.menuClass}>\n <slot\n name=\"header\"\n style=${`height: ${headerHeight}px`}\n @slotchange=${(e: Event) => this.slotChange(e, 'header')}\n ></slot>\n <div class=\"menu-and-reader\">\n ${this.shouldRenderMenu ? this.renderSideMenu : nothing}\n <div id=\"reader\" class=${displayReaderClass}>\n ${this.renderViewport}\n </div>\n ${!this.loaded ? this.loadingArea : nothing}\n </div>\n </div>\n `;\n }\n\n get noTheaterView() {\n return html`<ia-no-theater-available\n .identifier=${this.item?.metadata?.identifier}\n @loadingStateUpdated=${this.loadingStateUpdated}\n ></ia-no-theater-available>`;\n }\n\n get renderViewport(): TemplateResult | typeof nothing {\n if (!this.viewAvailable) {\n return this.noTheaterView;\n }\n\n const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';\n return html`\n <div slot=\"main\" style=${slotVisibility}>\n <slot\n name=\"main\"\n @slotchange=${(e: Event) => this.slotChange(e, 'main')}\n ></slot>\n </div>\n `;\n }\n\n loadingStateUpdated(e: loadingStateUpdatedEvent): void {\n const { loaded } = e.detail;\n this.loaded = loaded || null;\n }\n\n /** Fullscreen Management */\n manageViewportFullscreen(e: ManageFullscreenEvent): void {\n const fullscreenStatus = !!e.detail.isFullScreen;\n this.viewportInFullscreen = !fullscreenStatus ? null : fullscreenStatus;\n\n const event = new CustomEvent('fullscreenToggled', {\n detail: e.detail,\n }) as ManageFullscreenEvent;\n\n this.dispatchEvent(event);\n }\n /** End Fullscreen Management */\n\n /** Side menu */\n get shouldRenderMenu(): boolean {\n return !!this.menuContents?.length;\n }\n\n toggleMenu(): void {\n this.menuOpened = !this.menuOpened;\n }\n\n closeMenu(): void {\n this.menuOpened = false;\n }\n\n setOpenMenu(e: ToggleSidePanelOpenEvent): void {\n const { id } = e.detail;\n this.openMenu = id !== this.openMenu ? id : undefined;\n }\n\n setMenuContents(e: SetSideMenuContentsEvent): void {\n const updatedContents = [...e.detail];\n this.menuContents = updatedContents;\n }\n\n setMenuShortcuts(e: SetSideMenuShortcutsEvent) {\n this.menuShortcuts = [...e.detail];\n }\n\n /** Toggles Side Menu & Sets viewable subpanel */\n manageSideMenuEvents(e: ToggleSideMenuOpenEvent): void {\n const { menuId, action } = e.detail;\n if (!menuId) {\n return;\n }\n\n if (action === 'open') {\n this.openShortcut(menuId);\n } else if (action === 'toggle') {\n this.openMenu = menuId;\n this.toggleMenu();\n }\n }\n\n get menuToggleButton() {\n return html`\n <button\n class=\"toggle-menu\"\n @click=${this.toggleMenu}\n title=\"Toggle theater side panels\"\n >\n <div>\n <ia-icon-ellipses\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-ellipses>\n </div>\n </button>\n `;\n }\n\n get selectedMenuId(): MenuId | '' {\n return this.openMenu || '';\n }\n\n get renderSideMenu(): TemplateResult {\n const drawerState = this.menuOpened ? '' : 'hidden';\n return html`\n <nav>\n <div class=\"minimized\">${this.shortcuts} ${this.menuToggleButton}</div>\n <div id=\"menu\" class=${drawerState}>\n <ia-menu-slider\n .menus=${this.menuContents}\n .selectedMenu=${this.selectedMenuId}\n @menuTypeSelected=${this.setOpenMenu}\n @menuSliderClosed=${this.closeMenu}\n manuallyHandleClose\n open\n ></ia-menu-slider>\n </div>\n </nav>\n `;\n }\n /** End Side menu */\n\n /** Menu Shortcuts */\n openShortcut(selectedMenuId: MenuId = ''): void {\n this.openMenu = selectedMenuId;\n this.menuOpened = true;\n }\n\n get shortcuts(): TemplateResult {\n const shortcuts = this.menuShortcuts.map(({ icon, id }) => {\n if (id === 'fullscreen') {\n return html`${icon}`;\n }\n\n return html`\n <button class=\"shortcut ${id}\" @click=\"${() => this.openShortcut(id)}\">\n ${icon}\n </button>\n `;\n });\n return html`<div class=\"shortcuts\">${shortcuts}</div>`;\n }\n /** End Menu Shortcuts */\n\n /** Misc Render */\n get menuClass(): string {\n const hasMenuOrShortcuts =\n this.menuContents?.length || this.menuShortcuts?.length;\n const drawerState = this.menuOpened && hasMenuOrShortcuts ? 'open' : '';\n const fullscreenState = this.viewportInFullscreen ? 'fullscreen' : '';\n return `${drawerState} ${fullscreenState} ${this.openMenuState}`;\n }\n\n static get styles(): CSSResult {\n const subnavWidth = css`var(--menuWidth, 320px)`;\n const transitionTiming = css`var(--animationTiming, 200ms)`;\n const transitionEffect = css`transform ${transitionTiming} ease-out`;\n const menuMargin = css`var(--theaterMenuMargin, 42px)`;\n const theaterBg = css`var(--theaterBgColor, #000)`;\n\n return css`\n :host,\n #frame,\n .menu-and-reader {\n position: relative;\n overflow: hidden;\n display: block;\n }\n\n :host,\n #frame,\n .loading-area,\n .loading-view {\n min-height: inherit;\n height: inherit;\n }\n\n slot {\n display: block;\n overflow: hidden;\n width: 100%;\n }\n\n slot * {\n display: block;\n height: inherit;\n }\n\n #frame {\n background-color: ${theaterBg};\n color-scheme: dark;\n display: flex;\n flex-direction: column;\n }\n\n #frame.fullscreen {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 9;\n }\n\n .loading-view {\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .loading-area {\n width: 100%;\n }\n\n ia-itemnav-loader {\n display: block;\n width: 100%;\n }\n\n .hidden {\n display: none !important;\n }\n\n button {\n cursor: pointer;\n padding: 0;\n border: 0;\n }\n\n button:focus,\n button:active {\n outline: none;\n }\n\n .menu-and-reader {\n position: relative;\n display: flex;\n flex: 1;\n }\n\n nav button {\n background: none;\n }\n\n nav .minimized {\n background: rgba(0, 0, 0, 0.7);\n padding-top: 6px;\n position: absolute;\n width: ${menuMargin};\n z-index: 2;\n left: 0;\n border-bottom-right-radius: 5%;\n }\n\n nav .minimized button {\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin-bottom: 0.2rem;\n margin: auto;\n display: inline-flex;\n vertical-align: middle;\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n width: ${menuMargin};\n height: ${menuMargin};\n }\n\n nav .minimized button.toggle-menu > * {\n border: 2px solid var(--iconStrokeColor);\n border-radius: var(--iconWidth);\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n }\n\n ia-icon-ellipses {\n width: var(--iconWidth);\n height: var(--iconHeight);\n }\n\n #menu {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 3;\n overflow: hidden;\n transform: translateX(-${subnavWidth});\n width: ${subnavWidth};\n transform: translateX(calc(${subnavWidth} * -1));\n transition: ${transitionEffect};\n }\n\n #reader {\n position: relative;\n z-index: 1;\n transform: translateX(0);\n width: 100%;\n display: flex;\n }\n\n #reader > * {\n width: 100%;\n display: flex;\n flex: 1;\n }\n\n .open.overlay #reader {\n transition: none;\n }\n\n .open #menu {\n width: ${subnavWidth};\n transform: translateX(0);\n transition: ${transitionEffect};\n }\n\n .open.shift #reader {\n width: calc(100% - ${subnavWidth});\n margin-left: ${subnavWidth};\n transition: ${transitionEffect};\n }\n `;\n }\n}\n"]}
|
package/package.json
CHANGED
package/src/item-navigator.ts
CHANGED
@@ -171,10 +171,13 @@ export class ItemNavigator
|
|
171
171
|
|
172
172
|
render(): TemplateResult {
|
173
173
|
const displayReaderClass = this.loaded ? '' : 'hidden';
|
174
|
+
const headerHeight =
|
175
|
+
(this.headerSlot?.assignedNodes()[0] as HTMLElement)?.offsetHeight || 0;
|
174
176
|
return html`
|
175
177
|
<div id="frame" class=${this.menuClass}>
|
176
178
|
<slot
|
177
179
|
name="header"
|
180
|
+
style=${`height: ${headerHeight}px`}
|
178
181
|
@slotchange=${(e: Event) => this.slotChange(e, 'header')}
|
179
182
|
></slot>
|
180
183
|
<div class="menu-and-reader">
|
@@ -335,7 +338,9 @@ export class ItemNavigator
|
|
335
338
|
|
336
339
|
/** Misc Render */
|
337
340
|
get menuClass(): string {
|
338
|
-
const
|
341
|
+
const hasMenuOrShortcuts =
|
342
|
+
this.menuContents?.length || this.menuShortcuts?.length;
|
343
|
+
const drawerState = this.menuOpened && hasMenuOrShortcuts ? 'open' : '';
|
339
344
|
const fullscreenState = this.viewportInFullscreen ? 'fullscreen' : '';
|
340
345
|
return `${drawerState} ${fullscreenState} ${this.openMenuState}`;
|
341
346
|
}
|
@@ -351,8 +356,6 @@ export class ItemNavigator
|
|
351
356
|
:host,
|
352
357
|
#frame,
|
353
358
|
.menu-and-reader {
|
354
|
-
min-height: inherit;
|
355
|
-
height: inherit;
|
356
359
|
position: relative;
|
357
360
|
overflow: hidden;
|
358
361
|
display: block;
|
@@ -360,7 +363,6 @@ export class ItemNavigator
|
|
360
363
|
|
361
364
|
:host,
|
362
365
|
#frame,
|
363
|
-
.menu-and-reader,
|
364
366
|
.loading-area,
|
365
367
|
.loading-view {
|
366
368
|
min-height: inherit;
|
@@ -395,6 +397,7 @@ export class ItemNavigator
|
|
395
397
|
}
|
396
398
|
|
397
399
|
.loading-view {
|
400
|
+
height: 100%;
|
398
401
|
display: flex;
|
399
402
|
align-items: center;
|
400
403
|
justify-content: center;
|
@@ -427,6 +430,7 @@ export class ItemNavigator
|
|
427
430
|
.menu-and-reader {
|
428
431
|
position: relative;
|
429
432
|
display: flex;
|
433
|
+
flex: 1;
|
430
434
|
}
|
431
435
|
|
432
436
|
nav button {
|
@@ -489,7 +493,6 @@ export class ItemNavigator
|
|
489
493
|
z-index: 1;
|
490
494
|
transform: translateX(0);
|
491
495
|
width: 100%;
|
492
|
-
flex: 1;
|
493
496
|
display: flex;
|
494
497
|
}
|
495
498
|
|
@@ -510,8 +513,8 @@ export class ItemNavigator
|
|
510
513
|
}
|
511
514
|
|
512
515
|
.open.shift #reader {
|
513
|
-
width: calc(100% -
|
514
|
-
|
516
|
+
width: calc(100% - ${subnavWidth});
|
517
|
+
margin-left: ${subnavWidth};
|
515
518
|
transition: ${transitionEffect};
|
516
519
|
}
|
517
520
|
`;
|