@internetarchive/ia-item-navigator 0.0.4-4 → 0.0.5
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/README.md +1 -12
- package/demo/app-root.ts +180 -23
- package/demo/index.html +4 -0
- package/dist/demo/app-root.d.ts +16 -4
- package/dist/demo/app-root.js +163 -30
- package/dist/demo/app-root.js.map +1 -1
- package/dist/src/item-navigator.d.ts +1 -5
- package/dist/src/item-navigator.js +30 -32
- package/dist/src/item-navigator.js.map +1 -1
- package/dist/test/ia-item-navigator.test.js +12 -14
- package/dist/test/ia-item-navigator.test.js.map +1 -1
- package/package.json +1 -1
- package/src/item-navigator.ts +28 -31
- package/test/ia-item-navigator.test.ts +13 -15
package/README.md
CHANGED
@@ -13,10 +13,7 @@ The Item Navigator helps instantiate all of the components one needs to create a
|
|
13
13
|
|
14
14
|
The Item Navigator's primary responsibility is to display the side menus, shortcuts, and the theater in browser window immersion "fullscreen".
|
15
15
|
|
16
|
-
The
|
17
|
-
Currently supported:
|
18
|
-
- bookreader's `<book-navigator>`
|
19
|
-
- no theater available
|
16
|
+
The main slot is shown by default. If item has no theater, add `viewAvailable = false` property to show placeholder.
|
20
17
|
|
21
18
|
## Usage
|
22
19
|
Generic:
|
@@ -24,14 +21,6 @@ Generic:
|
|
24
21
|
const iaItem = <MetadataResponse>;
|
25
22
|
<ia-item-navigator .item=${iaItem}></ia-item-navigator>
|
26
23
|
```
|
27
|
-
For `<book-navigator>`:
|
28
|
-
```
|
29
|
-
const iaItem = <MetadataResponse>;
|
30
|
-
<ia-item-navigator .item=${iaItem} .itemType="bookreader">
|
31
|
-
<div slot="theater-header"><p>foo header</p></div>
|
32
|
-
<div slot="theater-main"><div id="BookReader"></div></div>
|
33
|
-
</ia-item-navigator>
|
34
|
-
```
|
35
24
|
|
36
25
|
## Local Demo with `web-dev-server`
|
37
26
|
```bash
|
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();
|
@@ -45,6 +65,8 @@ export class AppRoot extends LitElement {
|
|
45
65
|
this.modalMgr,
|
46
66
|
this.sharedObserver
|
47
67
|
);
|
68
|
+
|
69
|
+
this.itemNav.viewAvailable = false;
|
48
70
|
}
|
49
71
|
|
50
72
|
updated(changed: any) {
|
@@ -101,28 +123,143 @@ export class AppRoot extends LitElement {
|
|
101
123
|
/** End fullscreen */
|
102
124
|
|
103
125
|
toggleHeader() {
|
104
|
-
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];
|
105
201
|
}
|
106
202
|
|
107
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
|
+
|
108
218
|
get headerExample(): TemplateResult {
|
109
219
|
return html`
|
110
|
-
<div slot="
|
220
|
+
<div slot="header">
|
111
221
|
<div class="embed-link">
|
112
222
|
<img
|
113
223
|
src="https://archive.org/images/glogo-jw.png"
|
114
224
|
alt="glowing ia logo"
|
115
225
|
/>
|
116
|
-
<a href="/details/goody"
|
117
|
-
|
118
|
-
Margery Two-Shoes ... [1766 edition]
|
119
|
-
>
|
226
|
+
<a href="/details/goody">
|
227
|
+
The history of Little Goody Two-Shoes : otherwise called Mrs.
|
228
|
+
Margery Two-Shoes ... [1766 edition]
|
229
|
+
</a>
|
120
230
|
</div>
|
121
231
|
</div>
|
122
232
|
`;
|
123
233
|
}
|
124
234
|
|
235
|
+
get isViewAvailable(): boolean {
|
236
|
+
if (this.showTheaterExample) {
|
237
|
+
return true;
|
238
|
+
}
|
239
|
+
return false;
|
240
|
+
}
|
241
|
+
|
125
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
|
+
});
|
126
263
|
return html`
|
127
264
|
<h1>theater, in page</h1>
|
128
265
|
<section>
|
@@ -131,13 +268,22 @@ export class AppRoot extends LitElement {
|
|
131
268
|
.item=${this.itemMD}
|
132
269
|
.modal=${this.modalMgr}
|
133
270
|
.sharedObserver=${this.sharedObserver}
|
134
|
-
|
271
|
+
.loaded=${this.loaded}
|
272
|
+
?viewAvailable=${!!this.showTheaterExample}
|
273
|
+
.menuContents=${this.menuContents}
|
274
|
+
.menuShortcuts=${this.menuShortcuts}
|
275
|
+
.viewportInFullscreen=${this.fullscreen}
|
135
276
|
>
|
136
277
|
${this.headerOn ? this.headerExample : ''}
|
278
|
+
${this.showTheaterExample ? this.theaterExample : ''}
|
137
279
|
</ia-item-navigator>
|
138
280
|
</section>
|
139
281
|
<div>
|
140
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>
|
141
287
|
</div>
|
142
288
|
<modal-manager></modal-manager>
|
143
289
|
`;
|
@@ -169,17 +315,7 @@ export class AppRoot extends LitElement {
|
|
169
315
|
display: block;
|
170
316
|
position: relative;
|
171
317
|
width: 100%;
|
172
|
-
height: inherit;
|
173
|
-
}
|
174
|
-
ia-item-navigator {
|
175
|
-
height: inherit;
|
176
|
-
min-height: inherit;
|
177
|
-
}
|
178
|
-
div {
|
179
|
-
position: relative;
|
180
|
-
overflow: hidden;
|
181
318
|
height: 100%;
|
182
|
-
min-height: inherit;
|
183
319
|
}
|
184
320
|
|
185
321
|
.embed-link {
|
@@ -187,6 +323,27 @@ export class AppRoot extends LitElement {
|
|
187
323
|
border: 1px solid yellow;
|
188
324
|
}
|
189
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
|
+
|
190
347
|
modal-manager[mode='closed'] {
|
191
348
|
display: none;
|
192
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,18 +8,20 @@ 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();
|
22
23
|
console.log('<app-root> component has loaded', this.modalMgr, this.sharedObserver);
|
24
|
+
this.itemNav.viewAvailable = false;
|
23
25
|
}
|
24
26
|
updated(changed) {
|
25
27
|
console.log('changed', changed);
|
@@ -65,26 +67,122 @@ let AppRoot = class AppRoot extends LitElement {
|
|
65
67
|
}
|
66
68
|
/** End fullscreen */
|
67
69
|
toggleHeader() {
|
68
|
-
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];
|
69
137
|
}
|
70
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
|
+
}
|
71
152
|
get headerExample() {
|
72
153
|
return html `
|
73
|
-
<div slot="
|
154
|
+
<div slot="header">
|
74
155
|
<div class="embed-link">
|
75
156
|
<img
|
76
157
|
src="https://archive.org/images/glogo-jw.png"
|
77
158
|
alt="glowing ia logo"
|
78
159
|
/>
|
79
|
-
<a href="/details/goody"
|
80
|
-
|
81
|
-
Margery Two-Shoes ... [1766 edition]
|
82
|
-
>
|
160
|
+
<a href="/details/goody">
|
161
|
+
The history of Little Goody Two-Shoes : otherwise called Mrs.
|
162
|
+
Margery Two-Shoes ... [1766 edition]
|
163
|
+
</a>
|
83
164
|
</div>
|
84
165
|
</div>
|
85
166
|
`;
|
86
167
|
}
|
168
|
+
get isViewAvailable() {
|
169
|
+
if (this.showTheaterExample) {
|
170
|
+
return true;
|
171
|
+
}
|
172
|
+
return false;
|
173
|
+
}
|
87
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
|
+
});
|
88
186
|
return html `
|
89
187
|
<h1>theater, in page</h1>
|
90
188
|
<section>
|
@@ -93,13 +191,22 @@ let AppRoot = class AppRoot extends LitElement {
|
|
93
191
|
.item=${this.itemMD}
|
94
192
|
.modal=${this.modalMgr}
|
95
193
|
.sharedObserver=${this.sharedObserver}
|
96
|
-
|
194
|
+
.loaded=${this.loaded}
|
195
|
+
?viewAvailable=${!!this.showTheaterExample}
|
196
|
+
.menuContents=${this.menuContents}
|
197
|
+
.menuShortcuts=${this.menuShortcuts}
|
198
|
+
.viewportInFullscreen=${this.fullscreen}
|
97
199
|
>
|
98
200
|
${this.headerOn ? this.headerExample : ''}
|
201
|
+
${this.showTheaterExample ? this.theaterExample : ''}
|
99
202
|
</ia-item-navigator>
|
100
203
|
</section>
|
101
204
|
<div>
|
102
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>
|
103
210
|
</div>
|
104
211
|
<modal-manager></modal-manager>
|
105
212
|
`;
|
@@ -131,17 +238,7 @@ AppRoot.styles = css `
|
|
131
238
|
display: block;
|
132
239
|
position: relative;
|
133
240
|
width: 100%;
|
134
|
-
height: inherit;
|
135
|
-
}
|
136
|
-
ia-item-navigator {
|
137
|
-
height: inherit;
|
138
|
-
min-height: inherit;
|
139
|
-
}
|
140
|
-
div {
|
141
|
-
position: relative;
|
142
|
-
overflow: hidden;
|
143
241
|
height: 100%;
|
144
|
-
min-height: inherit;
|
145
242
|
}
|
146
243
|
|
147
244
|
.embed-link {
|
@@ -149,6 +246,27 @@ AppRoot.styles = css `
|
|
149
246
|
border: 1px solid yellow;
|
150
247
|
}
|
151
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
|
+
|
152
270
|
modal-manager[mode='closed'] {
|
153
271
|
display: none;
|
154
272
|
}
|
@@ -159,21 +277,36 @@ __decorate([
|
|
159
277
|
__decorate([
|
160
278
|
property({ type: String })
|
161
279
|
], AppRoot.prototype, "encodedManifest", void 0);
|
162
|
-
__decorate([
|
163
|
-
query('ia-item-navigator')
|
164
|
-
], AppRoot.prototype, "itemNav", void 0);
|
165
|
-
__decorate([
|
166
|
-
query('modal-manager')
|
167
|
-
], AppRoot.prototype, "modalMgr", void 0);
|
168
280
|
__decorate([
|
169
281
|
property({ attribute: false })
|
170
282
|
], AppRoot.prototype, "sharedObserver", void 0);
|
171
283
|
__decorate([
|
172
|
-
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 })
|
173
291
|
], AppRoot.prototype, "fullscreen", void 0);
|
174
292
|
__decorate([
|
175
|
-
property({
|
293
|
+
property({ reflect: true, attribute: true })
|
176
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);
|
177
310
|
AppRoot = __decorate([
|
178
311
|
customElement('app-root')
|
179
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,o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;;;;;;;;;;;;;;;;;;GA+ClB,CAAC;AAxK0B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;uCAAkD;AAEjD;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAsB;AAErB;IAA3B,KAAK,CAAC,mBAAmB,CAAC;wCAAiC;AAEpC;IAAvB,KAAK,CAAC,eAAe,CAAC;yCAAyB;AAEhB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAA6C;AAEf;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;2CAE5C;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,CA6KnB;SA7KY,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\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=\"theater-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]</a\n >\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 @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,G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AAE,MAAM,EAAE,CAAC;gDAAsB;AAEjB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAA6C;AAG5E;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;6CACF;AAG1C;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CACA;AAEE;IAA7C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;2CAE7B;AAE8B;IAA7C,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,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"]}
|