@internetarchive/ia-item-navigator 0.0.4 → 0.1.1

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/demo/app-root.ts CHANGED
@@ -1,13 +1,6 @@
1
1
  /* eslint-disable no-restricted-globals */
2
- import {
3
- html,
4
- css,
5
- LitElement,
6
- customElement,
7
- property,
8
- query,
9
- TemplateResult,
10
- } from 'lit-element';
2
+ import { html, css, LitElement, TemplateResult } from 'lit';
3
+ import { customElement, property, query } from 'lit/decorators.js';
11
4
  import {
12
5
  MetadataResponse,
13
6
  SearchService,
@@ -17,26 +10,46 @@ import { ModalManager } from '@internetarchive/modal-manager';
17
10
  import '@internetarchive/modal-manager';
18
11
  import { ItemNavigator } from '../src/item-navigator';
19
12
  import '../src/item-navigator';
13
+ import {
14
+ MenuShortcutInterface,
15
+ MenuDetailsInterface,
16
+ } from '../src/interfaces/menu-interfaces';
20
17
  @customElement('app-root')
21
18
  export class AppRoot extends LitElement {
22
19
  /**
23
20
  * Example controller to connect to `<ia-item-navigator>`
24
21
  */
25
- @property({ type: Object }) itemMD: MetadataResponse | undefined = undefined;
22
+ @property({ type: Object }) itemMD?: MetadataResponse;
26
23
 
27
24
  @property({ type: String }) encodedManifest = '';
28
25
 
29
- @query('ia-item-navigator') private itemNav!: ItemNavigator;
26
+ @property({ attribute: false }) sharedObserver = new SharedResizeObserver();
30
27
 
31
- @query('modal-manager') modalMgr!: ModalManager;
28
+ @property({ type: Array, attribute: false })
29
+ menuContents: MenuDetailsInterface[] = [];
32
30
 
33
- @property({ attribute: false }) sharedObserver = new SharedResizeObserver();
31
+ @property({ type: Array, attribute: false })
32
+ menuShortcuts: MenuShortcutInterface[] = [];
34
33
 
35
- @property({ type: Boolean, reflect: true, attribute: true }) fullscreen:
34
+ @property({ reflect: true, attribute: true }) fullscreen:
36
35
  | boolean
37
36
  | null = null;
38
37
 
39
- @property({ type: Boolean, reflect: true, attribute: true }) headerOn = false;
38
+ @property({ reflect: true, attribute: true }) headerOn: true | null = null;
39
+
40
+ @property({ reflect: true, attribute: true }) loaded = true;
41
+
42
+ @property({ reflect: true, attribute: true }) showPlaceholder:
43
+ | true
44
+ | null = null;
45
+
46
+ @property({ reflect: true, attribute: true }) showTheaterExample:
47
+ | true
48
+ | null = true;
49
+
50
+ @query('ia-item-navigator') private itemNav!: ItemNavigator;
51
+
52
+ @query('modal-manager') modalMgr!: ModalManager;
40
53
 
41
54
  firstUpdated() {
42
55
  this.fetchItemMD();
@@ -103,10 +116,98 @@ export class AppRoot extends LitElement {
103
116
  /** End fullscreen */
104
117
 
105
118
  toggleHeader() {
106
- this.headerOn = !this.headerOn;
119
+ this.headerOn = this.headerOn ? null : true;
120
+ }
121
+
122
+ toggleLoader() {
123
+ this.loaded = !this.loaded;
124
+ }
125
+
126
+ togglePlaceholder() {
127
+ this.toggleLoader();
128
+ const show = this.showPlaceholder ? null : true;
129
+ this.showPlaceholder = show;
130
+ }
131
+
132
+ toggleImmersion() {
133
+ const nextState = this.fullscreen ? null : true;
134
+ if (!nextState) {
135
+ this.menuShortcuts = [];
136
+ return;
137
+ }
138
+ this.menuShortcuts = [
139
+ {
140
+ icon: html`<button
141
+ @click=${() => {
142
+ this.fullscreen = null;
143
+ this.menuContents = [];
144
+ this.menuShortcuts = [];
145
+ }}
146
+ >
147
+ Exit
148
+ </button>`,
149
+ id: 'exit',
150
+ },
151
+ ];
152
+ this.menuContents = [
153
+ {
154
+ icon: html`<button
155
+ @click=${() => {
156
+ this.fullscreen = null;
157
+ }}
158
+ >
159
+ Exit
160
+ </button>`,
161
+ id: 'exit',
162
+ label: 'Exit',
163
+ selected: false,
164
+ },
165
+ ];
166
+
167
+ this.fullscreen = nextState;
168
+ }
169
+
170
+ toggleTheaterExample() {
171
+ if (this.showTheaterExample) {
172
+ // turn on placeholder
173
+ this.showPlaceholder = true;
174
+ // turn off example
175
+ this.showTheaterExample = null;
176
+
177
+ this.menuContents = [];
178
+ this.menuShortcuts = [];
179
+ return;
180
+ }
181
+
182
+ // turn off placeholder
183
+ this.showPlaceholder = null;
184
+ this.showTheaterExample = true;
185
+
186
+ const x = {
187
+ icon: html`<p style="color: red">Allo</p>`,
188
+ id: 'a',
189
+ label: 'Hello world',
190
+ menuDetails: html`<h3>Wheee!</h3>`,
191
+ } as any;
192
+ this.menuContents = [x];
193
+ this.menuShortcuts = [x];
107
194
  }
108
195
 
109
196
  /** Views */
197
+ get theaterExample(): TemplateResult {
198
+ return html`
199
+ <div slot="main">
200
+ <div class="theater-example">
201
+ <img
202
+ alt="cat theater"
203
+ src="https://archive.org/download/encyclopediaofca0000poll_t2e2/__ia_thumb.jpg"
204
+ />
205
+ <h3>Welcome to Cat Theater</h3>
206
+ </div>
207
+ </div>
208
+ `;
209
+ }
210
+
110
211
  get headerExample(): TemplateResult {
111
212
  return html`
112
213
  <div slot="header">
@@ -124,7 +225,34 @@ export class AppRoot extends LitElement {
124
225
  `;
125
226
  }
126
227
 
228
+ get isViewAvailable(): boolean {
229
+ if (this.showTheaterExample) {
230
+ return true;
231
+ }
232
+ return false;
233
+ }
234
+
127
235
  render(): TemplateResult {
236
+ const {
237
+ isViewAvailable,
238
+ loaded,
239
+ showPlaceholder,
240
+ headerOn,
241
+ fullscreen,
242
+ menuContents,
243
+ menuShortcuts,
244
+ showTheaterExample,
245
+ } = this;
246
+ console.log('&&&& item nav properties', {
247
+ loaded,
248
+ headerOn,
249
+ isViewAvailable,
250
+ showTheaterExample,
251
+ showPlaceholder,
252
+ fullscreen,
253
+ menuContents,
254
+ menuShortcuts,
255
+ });
128
256
  return html`
129
257
  <h1>theater, in page</h1>
130
258
  <section>
@@ -133,14 +261,22 @@ export class AppRoot extends LitElement {
133
261
  .item=${this.itemMD}
134
262
  .modal=${this.modalMgr}
135
263
  .sharedObserver=${this.sharedObserver}
136
- .loaded=${true}
137
- @fullscreenToggled=${this.toggleFS}
264
+ .loaded=${this.loaded}
265
+ ?viewAvailable=${!!this.showTheaterExample}
266
+ .menuContents=${this.menuContents}
267
+ .menuShortcuts=${this.menuShortcuts}
268
+ .viewportInFullscreen=${this.fullscreen}
138
269
  >
139
270
  ${this.headerOn ? this.headerExample : ''}
271
+ ${this.showTheaterExample ? this.theaterExample : ''}
140
272
  </ia-item-navigator>
141
273
  </section>
142
274
  <div>
143
275
  <button @click=${this.toggleHeader}>toggle header</button>
276
+ <button @click=${this.toggleLoader}>toggle loader</button>
277
+ <button @click=${this.togglePlaceholder}>toggle placeholder</button>
278
+ <button @click=${this.toggleTheaterExample}>toggle new theater</button>
279
+ <button @click=${this.toggleImmersion}>toggle immersion</button>
144
280
  </div>
145
281
  <modal-manager></modal-manager>
146
282
  `;
@@ -172,17 +308,7 @@ export class AppRoot extends LitElement {
172
308
  display: block;
173
309
  position: relative;
174
310
  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
311
  height: 100%;
185
- min-height: inherit;
186
312
  }
187
313
 
188
314
  .embed-link {
@@ -190,6 +316,27 @@ export class AppRoot extends LitElement {
190
316
  border: 1px solid yellow;
191
317
  }
192
318
 
319
+ .theater-example {
320
+ color: white;
321
+ display: flex;
322
+ justify-content: center;
323
+ align-items: center;
324
+ flex-direction: column;
325
+ margin: 10px;
326
+ border: 5px dotted yellow;
327
+ flex: 1;
328
+ }
329
+
330
+ div[slot='main'] {
331
+ height: 100%;
332
+ display: flex;
333
+ flex-direction: column;
334
+ }
335
+
336
+ div[slot='main'] > * {
337
+ flex: 1;
338
+ }
339
+
193
340
  modal-manager[mode='closed'] {
194
341
  display: none;
195
342
  }
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 */
@@ -1,20 +1,26 @@
1
- import { LitElement, TemplateResult } from 'lit-element';
1
+ import { LitElement, TemplateResult } from 'lit';
2
2
  import { MetadataResponse } from '@internetarchive/search-service';
3
3
  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: MetadataResponse | undefined;
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: boolean;
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
- static styles: import("lit-element").CSSResult;
46
+ static styles: import("lit").CSSResult;
35
47
  }
@@ -1,6 +1,7 @@
1
1
  import { __decorate } from "tslib";
2
2
  /* eslint-disable no-restricted-globals */
3
- import { html, css, LitElement, customElement, property, query, } from 'lit-element';
3
+ import { html, css, LitElement } from 'lit';
4
+ import { customElement, property, query } from 'lit/decorators.js';
4
5
  import { SearchService, } from '@internetarchive/search-service';
5
6
  import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
6
7
  import '@internetarchive/modal-manager';
@@ -8,14 +9,15 @@ import '../src/item-navigator';
8
9
  let AppRoot = class AppRoot extends LitElement {
9
10
  constructor() {
10
11
  super(...arguments);
11
- /**
12
- * Example controller to connect to `<ia-item-navigator>`
13
- */
14
- this.itemMD = undefined;
15
12
  this.encodedManifest = '';
16
13
  this.sharedObserver = new SharedResizeObserver();
14
+ this.menuContents = [];
15
+ this.menuShortcuts = [];
17
16
  this.fullscreen = null;
18
- this.headerOn = false;
17
+ this.headerOn = null;
18
+ this.loaded = true;
19
+ this.showPlaceholder = null;
20
+ this.showTheaterExample = true;
19
21
  }
20
22
  firstUpdated() {
21
23
  this.fetchItemMD();
@@ -66,9 +68,88 @@ let AppRoot = class AppRoot extends LitElement {
66
68
  }
67
69
  /** End fullscreen */
68
70
  toggleHeader() {
69
- this.headerOn = !this.headerOn;
71
+ this.headerOn = this.headerOn ? null : true;
72
+ }
73
+ toggleLoader() {
74
+ this.loaded = !this.loaded;
75
+ }
76
+ togglePlaceholder() {
77
+ this.toggleLoader();
78
+ const show = this.showPlaceholder ? null : true;
79
+ this.showPlaceholder = show;
80
+ }
81
+ toggleImmersion() {
82
+ const nextState = this.fullscreen ? null : true;
83
+ if (!nextState) {
84
+ this.menuShortcuts = [];
85
+ return;
86
+ }
87
+ this.menuShortcuts = [
88
+ {
89
+ icon: html `<button
90
+ @click=${() => {
91
+ this.fullscreen = null;
92
+ this.menuContents = [];
93
+ this.menuShortcuts = [];
94
+ }}
95
+ >
96
+ Exit
97
+ </button>`,
98
+ id: 'exit',
99
+ },
100
+ ];
101
+ this.menuContents = [
102
+ {
103
+ icon: html `<button
104
+ @click=${() => {
105
+ this.fullscreen = null;
106
+ }}
107
+ >
108
+ Exit
109
+ </button>`,
110
+ id: 'exit',
111
+ label: 'Exit',
112
+ selected: false,
113
+ },
114
+ ];
115
+ this.fullscreen = nextState;
116
+ }
117
+ toggleTheaterExample() {
118
+ if (this.showTheaterExample) {
119
+ // turn on placeholder
120
+ this.showPlaceholder = true;
121
+ // turn off example
122
+ this.showTheaterExample = null;
123
+ this.menuContents = [];
124
+ this.menuShortcuts = [];
125
+ return;
126
+ }
127
+ // turn off placeholder
128
+ this.showPlaceholder = null;
129
+ this.showTheaterExample = true;
130
+ const x = {
131
+ icon: html `<p style="color: red">Allo</p>`,
132
+ id: 'a',
133
+ label: 'Hello world',
134
+ menuDetails: html `<h3>Wheee!</h3>`,
135
+ };
136
+ this.menuContents = [x];
137
+ this.menuShortcuts = [x];
70
138
  }
71
139
  /** Views */
140
+ get theaterExample() {
141
+ return html `
142
+ <div slot="main">
143
+ <div class="theater-example">
144
+ <img
145
+ alt="cat theater"
146
+ src="https://archive.org/download/encyclopediaofca0000poll_t2e2/__ia_thumb.jpg"
147
+ />
148
+ <h3>Welcome to Cat Theater</h3>
149
+ </div>
150
+ </div>
151
+ `;
152
+ }
72
153
  get headerExample() {
73
154
  return html `
74
155
  <div slot="header">
@@ -85,7 +166,24 @@ let AppRoot = class AppRoot extends LitElement {
85
166
  </div>
86
167
  `;
87
168
  }
169
+ get isViewAvailable() {
170
+ if (this.showTheaterExample) {
171
+ return true;
172
+ }
173
+ return false;
174
+ }
88
175
  render() {
176
+ const { isViewAvailable, loaded, showPlaceholder, headerOn, fullscreen, menuContents, menuShortcuts, showTheaterExample, } = this;
177
+ console.log('&&&& item nav properties', {
178
+ loaded,
179
+ headerOn,
180
+ isViewAvailable,
181
+ showTheaterExample,
182
+ showPlaceholder,
183
+ fullscreen,
184
+ menuContents,
185
+ menuShortcuts,
186
+ });
89
187
  return html `
90
188
  <h1>theater, in page</h1>
91
189
  <section>
@@ -94,14 +192,22 @@ let AppRoot = class AppRoot extends LitElement {
94
192
  .item=${this.itemMD}
95
193
  .modal=${this.modalMgr}
96
194
  .sharedObserver=${this.sharedObserver}
97
- .loaded=${true}
98
- @fullscreenToggled=${this.toggleFS}
195
+ .loaded=${this.loaded}
196
+ ?viewAvailable=${!!this.showTheaterExample}
197
+ .menuContents=${this.menuContents}
198
+ .menuShortcuts=${this.menuShortcuts}
199
+ .viewportInFullscreen=${this.fullscreen}
99
200
  >
100
201
  ${this.headerOn ? this.headerExample : ''}
202
+ ${this.showTheaterExample ? this.theaterExample : ''}
101
203
  </ia-item-navigator>
102
204
  </section>
103
205
  <div>
104
206
  <button @click=${this.toggleHeader}>toggle header</button>
207
+ <button @click=${this.toggleLoader}>toggle loader</button>
208
+ <button @click=${this.togglePlaceholder}>toggle placeholder</button>
209
+ <button @click=${this.toggleTheaterExample}>toggle new theater</button>
210
+ <button @click=${this.toggleImmersion}>toggle immersion</button>
105
211
  </div>
106
212
  <modal-manager></modal-manager>
107
213
  `;
@@ -133,17 +239,7 @@ AppRoot.styles = css `
133
239
  display: block;
134
240
  position: relative;
135
241
  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
242
  height: 100%;
146
- min-height: inherit;
147
243
  }
148
244
 
149
245
  .embed-link {
@@ -151,6 +247,27 @@ AppRoot.styles = css `
151
247
  border: 1px solid yellow;
152
248
  }
153
249
 
250
+ .theater-example {
251
+ color: white;
252
+ display: flex;
253
+ justify-content: center;
254
+ align-items: center;
255
+ flex-direction: column;
256
+ margin: 10px;
257
+ border: 5px dotted yellow;
258
+ flex: 1;
259
+ }
260
+
261
+ div[slot='main'] {
262
+ height: 100%;
263
+ display: flex;
264
+ flex-direction: column;
265
+ }
266
+
267
+ div[slot='main'] > * {
268
+ flex: 1;
269
+ }
270
+
154
271
  modal-manager[mode='closed'] {
155
272
  display: none;
156
273
  }
@@ -161,21 +278,36 @@ __decorate([
161
278
  __decorate([
162
279
  property({ type: String })
163
280
  ], 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
281
  __decorate([
171
282
  property({ attribute: false })
172
283
  ], AppRoot.prototype, "sharedObserver", void 0);
173
284
  __decorate([
174
- property({ type: Boolean, reflect: true, attribute: true })
285
+ property({ type: Array, attribute: false })
286
+ ], AppRoot.prototype, "menuContents", void 0);
287
+ __decorate([
288
+ property({ type: Array, attribute: false })
289
+ ], AppRoot.prototype, "menuShortcuts", void 0);
290
+ __decorate([
291
+ property({ reflect: true, attribute: true })
175
292
  ], AppRoot.prototype, "fullscreen", void 0);
176
293
  __decorate([
177
- property({ type: Boolean, reflect: true, attribute: true })
294
+ property({ reflect: true, attribute: true })
178
295
  ], AppRoot.prototype, "headerOn", void 0);
296
+ __decorate([
297
+ property({ reflect: true, attribute: true })
298
+ ], AppRoot.prototype, "loaded", void 0);
299
+ __decorate([
300
+ property({ reflect: true, attribute: true })
301
+ ], AppRoot.prototype, "showPlaceholder", void 0);
302
+ __decorate([
303
+ property({ reflect: true, attribute: true })
304
+ ], AppRoot.prototype, "showTheaterExample", void 0);
305
+ __decorate([
306
+ query('ia-item-navigator')
307
+ ], AppRoot.prototype, "itemNav", void 0);
308
+ __decorate([
309
+ query('modal-manager')
310
+ ], AppRoot.prototype, "modalMgr", void 0);
179
311
  AppRoot = __decorate([
180
312
  customElement('app-root')
181
313
  ], 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,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AAC,CAAC,CAAC,EAAE;;;;yBAI1B,IAAI,CAAC,YAAY;;;KAGrC,CAAC;IACJ,CAAC;CAkDF,CAAA;AAhDQ,cAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+ClB,CAAC;AA3K0B;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,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,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,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,EAA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\nimport { customElement, property, query } from 'lit/decorators.js';\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"]}
@@ -1,4 +1,4 @@
1
- import { LitElement } from 'lit-element';
1
+ import { LitElement } from 'lit';
2
2
  import { MetadataResponse } from '@internetarchive/search-service';
3
3
  import { ModalManager } from '@internetarchive/modal-manager';
4
4
  import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
@@ -1 +1 @@
1
- {"version":3,"file":"custom-theater-interface.js","sourceRoot":"","sources":["../../../src/interfaces/custom-theater-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { LitElement } from 'lit-element';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport {\n MenuProviderInterface,\n MenuShortcutInterface,\n} from './menu-interfaces';\n\nexport interface CustomTheaterInterface extends LitElement {\n baseHost?: string;\n itemMD?: MetadataResponse;\n menuProviders?: MenuProviderInterface[];\n menuShortcuts?: MenuShortcutInterface[];\n sideMenuOpen: boolean;\n\n signedIn?: boolean | null;\n\n sharedObserver?: SharedResizeObserver;\n modal?: ModalManager;\n\n emitLoadingStatusUpdate: (loaded: boolean) => void;\n\n addMenuShortcut: (menuId: string) => void;\n removeMenuShortcut: (menuId: string) => void;\n sortMenuShortcuts: () => void;\n emitMenuShortcutsUpdated: () => void;\n}\n"]}
1
+ {"version":3,"file":"custom-theater-interface.js","sourceRoot":"","sources":["../../../src/interfaces/custom-theater-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { LitElement } from 'lit';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport {\n MenuProviderInterface,\n MenuShortcutInterface,\n} from './menu-interfaces';\n\nexport interface CustomTheaterInterface extends LitElement {\n baseHost?: string;\n itemMD?: MetadataResponse;\n menuProviders?: MenuProviderInterface[];\n menuShortcuts?: MenuShortcutInterface[];\n sideMenuOpen: boolean;\n\n signedIn?: boolean | null;\n\n sharedObserver?: SharedResizeObserver;\n modal?: ModalManager;\n\n emitLoadingStatusUpdate: (loaded: boolean) => void;\n\n addMenuShortcut: (menuId: string) => void;\n removeMenuShortcut: (menuId: string) => void;\n sortMenuShortcuts: () => void;\n emitMenuShortcutsUpdated: () => void;\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { TemplateResult } from 'lit-html';
1
+ import { TemplateResult } from 'lit';
2
2
  import { MetadataResponse } from '@internetarchive/search-service';
3
3
  export declare type MenuId = string;
4
4
  export interface MenuShortcutInterface {
@@ -1 +1 @@
1
- {"version":3,"file":"menu-interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/menu-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult } from 'lit-html';\nimport { MetadataResponse } from '@internetarchive/search-service';\n\nexport type MenuId = string;\nexport interface MenuShortcutInterface {\n icon: TemplateResult;\n id: MenuId;\n}\n\nexport interface MenuDetailsInterface extends MenuShortcutInterface {\n label: string;\n menuDetails?: TemplateResult;\n selected?: boolean;\n followable?: boolean;\n href?: string;\n}\n\nexport interface MenuProviderBaseConfigInterface {\n item: MetadataResponse;\n baseHost: string;\n subPrefix: string;\n updated?: any;\n}\nexport interface MenuProviderInterface\n extends MenuProviderBaseConfigInterface,\n MenuDetailsInterface,\n MenuShortcutInterface {}\n"]}
1
+ {"version":3,"file":"menu-interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/menu-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult } from 'lit';\nimport { MetadataResponse } from '@internetarchive/search-service';\n\nexport type MenuId = string;\nexport interface MenuShortcutInterface {\n icon: TemplateResult;\n id: MenuId;\n}\n\nexport interface MenuDetailsInterface extends MenuShortcutInterface {\n label: string;\n menuDetails?: TemplateResult;\n selected?: boolean;\n followable?: boolean;\n href?: string;\n}\n\nexport interface MenuProviderBaseConfigInterface {\n item: MetadataResponse;\n baseHost: string;\n subPrefix: string;\n updated?: any;\n}\nexport interface MenuProviderInterface\n extends MenuProviderBaseConfigInterface,\n MenuDetailsInterface,\n MenuShortcutInterface {}\n"]}