@internetarchive/ia-item-navigator 1.0.4 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. package/.github/workflows/ci.yml +4 -5
  2. package/.github/workflows/gh-pages-main.yml +39 -0
  3. package/.github/workflows/pr-preview.yml +38 -0
  4. package/demo/app-root.ts +13 -13
  5. package/dist/demo/app-root.d.ts +47 -47
  6. package/dist/demo/app-root.js +200 -199
  7. package/dist/demo/app-root.js.map +1 -1
  8. package/dist/index.d.ts +3 -3
  9. package/dist/index.js +3 -3
  10. package/dist/src/interfaces/custom-theater-interface.d.ts +20 -20
  11. package/dist/src/interfaces/custom-theater-interface.js +1 -1
  12. package/dist/src/interfaces/event-interfaces.d.ts +40 -40
  13. package/dist/src/interfaces/event-interfaces.js +1 -1
  14. package/dist/src/interfaces/menu-interfaces.d.ts +23 -22
  15. package/dist/src/interfaces/menu-interfaces.js +1 -1
  16. package/dist/src/interfaces/menu-interfaces.js.map +1 -1
  17. package/dist/src/item-navigator.d.ts +69 -69
  18. package/dist/src/item-navigator.js +259 -257
  19. package/dist/src/item-navigator.js.map +1 -1
  20. package/dist/src/loader.d.ts +9 -13
  21. package/dist/src/loader.js +35 -31
  22. package/dist/src/loader.js.map +1 -1
  23. package/dist/src/menu-slider/ia-menu-slider.d.ts +31 -30
  24. package/dist/src/menu-slider/ia-menu-slider.js +123 -124
  25. package/dist/src/menu-slider/ia-menu-slider.js.map +1 -1
  26. package/dist/src/menu-slider/menu-button.d.ts +19 -19
  27. package/dist/src/menu-slider/menu-button.js +75 -75
  28. package/dist/src/menu-slider/menu-button.js.map +1 -1
  29. package/dist/src/menu-slider/styles/menu-button.d.ts +2 -2
  30. package/dist/src/menu-slider/styles/menu-button.js +2 -2
  31. package/dist/src/menu-slider/styles/menu-slider.d.ts +2 -2
  32. package/dist/src/menu-slider/styles/menu-slider.js +5 -5
  33. package/dist/src/no-theater-available.d.ts +9 -9
  34. package/dist/src/no-theater-available.js +35 -35
  35. package/dist/src/no-theater-available.js.map +1 -1
  36. package/dist/test/ia-item-navigator.test.d.ts +1 -1
  37. package/dist/test/ia-item-navigator.test.js +296 -296
  38. package/dist/test/ia-item-navigator.test.js.map +1 -1
  39. package/dist/test/ia-stub.d.ts +22 -22
  40. package/dist/test/ia-stub.js +34 -34
  41. package/dist/test/no-theater-available.test.d.ts +1 -1
  42. package/dist/test/no-theater-available.test.js +22 -22
  43. package/dist/test/no-theater-available.test.js.map +1 -1
  44. package/dist/vite.config.d.ts +2 -0
  45. package/dist/vite.config.js +25 -0
  46. package/dist/vite.config.js.map +1 -0
  47. package/package.json +35 -21
  48. package/src/interfaces/menu-interfaces.ts +3 -1
  49. package/src/item-navigator.ts +9 -4
  50. package/src/loader.ts +5 -7
  51. package/src/menu-slider/ia-menu-slider.ts +17 -17
  52. package/src/menu-slider/menu-button.ts +3 -3
  53. package/src/no-theater-available.ts +1 -1
  54. package/test/ia-item-navigator.test.ts +24 -24
  55. package/test/iaux-item-navigator.test.txt +417 -0
  56. package/test/iaux-sharing-options.test.txt +84 -0
  57. package/test/no-theater-available.test.ts +2 -2
  58. package/tsconfig.json +2 -1
  59. package/vite.config.ts +25 -0
@@ -1,143 +1,144 @@
1
- import { __decorate } from "tslib";
2
- /* eslint-disable no-restricted-globals */
3
- import { html, css, LitElement } from 'lit';
4
- import { customElement, property, query } from 'lit/decorators.js';
5
- import { SearchService, } from '@internetarchive/search-service';
6
- import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
7
- import '@internetarchive/modal-manager';
8
- import '../src/item-navigator';
9
- let AppRoot = class AppRoot extends LitElement {
10
- constructor() {
11
- super(...arguments);
12
- this.encodedManifest = '';
13
- this.sharedObserver = new SharedResizeObserver();
14
- this.menuContents = [];
15
- this.menuShortcuts = [];
16
- this.fullscreen = null;
17
- this.headerOn = null;
18
- this.loaded = true;
19
- this.showPlaceholder = null;
20
- this.showTheaterExample = true;
21
- }
22
- firstUpdated() {
23
- this.fetchItemMD();
24
- console.log('<app-root> component has loaded', this.modalMgr, this.sharedObserver);
25
- this.itemNav.viewAvailable = false;
26
- }
27
- updated(changed) {
28
- console.log('changed', changed);
29
- if (changed.has('itemMD')) {
30
- this.fullscreenCheck();
31
- }
32
- }
33
- async fetchItemMD() {
34
- const searchService = SearchService.default;
35
- const mdResponse = await searchService.fetchMetadata('ux-team-books');
36
- if (mdResponse.error) {
37
- console.log('MD Fetch error: ', mdResponse.error);
38
- window.confirm('There was an error fetching response, please check dev console');
39
- return;
40
- }
41
- console.log('mdResponse.success', JSON.stringify(mdResponse.success));
42
- this.itemMD = mdResponse.success;
43
- }
44
- get theaterReady() {
45
- return this.modalMgr && this.sharedObserver && !!this.itemMD;
46
- }
47
- get urlParams() {
48
- return new URLSearchParams(location.search.slice(1));
49
- }
50
- /** Fullscreen */
51
- get showFullscreen() {
52
- return this.urlParams.get('view') === 'theater';
53
- }
54
- /** sets url query param `view=theater` to toggle fullscreen */
55
- toggleFS() {
56
- if (this.urlParams.get('view')) {
57
- location.search = '';
58
- }
59
- else {
60
- location.search = 'view=theater';
61
- }
62
- }
63
- /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */
64
- fullscreenCheck() {
65
- if (this.showFullscreen && this.itemNav) {
66
- this.fullscreen = true;
67
- }
68
- }
69
- /** End fullscreen */
70
- toggleHeader() {
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
- {
1
+ import { __decorate } from "tslib";
2
+ /* eslint-disable no-restricted-globals */
3
+ import { html, css, LitElement } from 'lit';
4
+ import { customElement, property, query } from 'lit/decorators.js';
5
+ import { SearchService, } from '@internetarchive/search-service';
6
+ import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
7
+ import '@internetarchive/modal-manager';
8
+ import '../src/item-navigator';
9
+ let AppRoot = class AppRoot extends LitElement {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.encodedManifest = '';
13
+ this.sharedObserver = new SharedResizeObserver();
14
+ this.menuContents = [];
15
+ this.menuShortcuts = [];
16
+ this.fullscreen = null;
17
+ this.headerOn = null;
18
+ this.loaded = true;
19
+ this.showPlaceholder = null;
20
+ this.showTheaterExample = true;
21
+ }
22
+ firstUpdated() {
23
+ this.fetchItemMD();
24
+ console.log('<app-root> component has loaded', this.modalMgr, this.sharedObserver);
25
+ this.itemNav.viewAvailable = false;
26
+ }
27
+ updated(changed) {
28
+ console.log('changed', changed);
29
+ if (changed.has('itemMD')) {
30
+ this.fullscreenCheck();
31
+ }
32
+ }
33
+ async fetchItemMD() {
34
+ const searchService = SearchService.default;
35
+ const mdResponse = await searchService.fetchMetadata('ux-team-books');
36
+ if (mdResponse.error) {
37
+ console.log('MD Fetch error: ', mdResponse.error);
38
+ window.confirm('There was an error fetching response, please check dev console');
39
+ return;
40
+ }
41
+ console.log('mdResponse.success', JSON.stringify(mdResponse.success));
42
+ this.itemMD = mdResponse.success;
43
+ }
44
+ get theaterReady() {
45
+ return this.modalMgr && this.sharedObserver && !!this.itemMD;
46
+ }
47
+ get urlParams() {
48
+ return new URLSearchParams(location.search.slice(1));
49
+ }
50
+ /** Fullscreen */
51
+ get showFullscreen() {
52
+ return this.urlParams.get('view') === 'theater';
53
+ }
54
+ /** sets url query param `view=theater` to toggle fullscreen */
55
+ toggleFS() {
56
+ if (this.urlParams.get('view')) {
57
+ location.search = '';
58
+ }
59
+ else {
60
+ location.search = 'view=theater';
61
+ }
62
+ }
63
+ /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */
64
+ fullscreenCheck() {
65
+ if (this.showFullscreen && this.itemNav) {
66
+ this.fullscreen = true;
67
+ }
68
+ }
69
+ /** End fullscreen */
70
+ toggleHeader() {
71
+ this.headerOn = this.headerOn ? null : true;
72
+ }
73
+ toggleLoader() {
74
+ const nextState = this.loaded === true ? null : true;
75
+ this.loaded = nextState;
76
+ }
77
+ togglePlaceholder() {
78
+ this.toggleLoader();
79
+ const show = this.showPlaceholder ? null : true;
80
+ this.showPlaceholder = show;
81
+ }
82
+ toggleImmersion() {
83
+ const nextState = this.fullscreen ? null : true;
84
+ if (!nextState) {
85
+ this.menuShortcuts = [];
86
+ return;
87
+ }
88
+ this.menuShortcuts = [
89
+ {
89
90
  icon: html `<button
90
- @click=${() => {
91
- this.fullscreen = null;
92
- this.menuContents = [];
93
- this.menuShortcuts = [];
91
+ @click=${() => {
92
+ this.fullscreen = null;
93
+ this.menuContents = [];
94
+ this.menuShortcuts = [];
94
95
  }}
95
96
  >
96
97
  Exit
97
- </button>`,
98
- id: 'exit',
99
- },
100
- ];
101
- this.menuContents = [
102
- {
98
+ </button>`,
99
+ id: 'exit',
100
+ },
101
+ ];
102
+ this.menuContents = [
103
+ {
103
104
  icon: html `<button
104
- @click=${() => {
105
- this.fullscreen = null;
105
+ @click=${() => {
106
+ this.fullscreen = null;
106
107
  }}
107
108
  >
108
109
  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];
138
- }
139
- /** Views */
140
- get theaterExample() {
110
+ </button>`,
111
+ id: 'exit',
112
+ label: 'Exit',
113
+ selected: false,
114
+ },
115
+ ];
116
+ this.fullscreen = nextState;
117
+ }
118
+ toggleTheaterExample() {
119
+ if (this.showTheaterExample) {
120
+ // turn on placeholder
121
+ this.showPlaceholder = true;
122
+ // turn off example
123
+ this.showTheaterExample = null;
124
+ this.menuContents = [];
125
+ this.menuShortcuts = [];
126
+ return;
127
+ }
128
+ // turn off placeholder
129
+ this.showPlaceholder = null;
130
+ this.showTheaterExample = true;
131
+ const x = {
132
+ icon: html `<p style="color: red">Allo</p>`,
133
+ id: 'a',
134
+ label: 'Hello world',
135
+ menuDetails: html `<h3>Wheee!</h3>`,
136
+ };
137
+ this.menuContents = [x];
138
+ this.menuShortcuts = [x];
139
+ }
140
+ /** Views */
141
+ get theaterExample() {
141
142
  return html `
142
143
  <div slot="main">
143
144
  <div class="theater-example">
@@ -148,9 +149,9 @@ let AppRoot = class AppRoot extends LitElement {
148
149
  <h3>Welcome to Cat Theater</h3>
149
150
  </div>
150
151
  </div>
151
- `;
152
- }
153
- get headerExample() {
152
+ `;
153
+ }
154
+ get headerExample() {
154
155
  return html `
155
156
  <div slot="header">
156
157
  <div class="embed-link">
@@ -164,26 +165,26 @@ let AppRoot = class AppRoot extends LitElement {
164
165
  </a>
165
166
  </div>
166
167
  </div>
167
- `;
168
- }
169
- get isViewAvailable() {
170
- if (this.showTheaterExample) {
171
- return true;
172
- }
173
- return false;
174
- }
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
- });
168
+ `;
169
+ }
170
+ get isViewAvailable() {
171
+ if (this.showTheaterExample) {
172
+ return true;
173
+ }
174
+ return false;
175
+ }
176
+ render() {
177
+ const { isViewAvailable, loaded, showPlaceholder, headerOn, fullscreen, menuContents, menuShortcuts, showTheaterExample, } = this;
178
+ console.log('&&&& item nav properties', {
179
+ loaded,
180
+ headerOn,
181
+ isViewAvailable,
182
+ showTheaterExample,
183
+ showPlaceholder,
184
+ fullscreen,
185
+ menuContents,
186
+ menuShortcuts,
187
+ });
187
188
  return html `
188
189
  <h1>theater, in page</h1>
189
190
  <section>
@@ -210,9 +211,9 @@ let AppRoot = class AppRoot extends LitElement {
210
211
  <button @click=${this.toggleImmersion}>toggle immersion</button>
211
212
  </div>
212
213
  <modal-manager></modal-manager>
213
- `;
214
- }
215
- };
214
+ `;
215
+ }
216
+ };
216
217
  AppRoot.styles = css `
217
218
  :host([fullscreen]),
218
219
  :host([fullscreen]) section {
@@ -271,45 +272,45 @@ AppRoot.styles = css `
271
272
  modal-manager[mode='closed'] {
272
273
  display: none;
273
274
  }
274
- `;
275
- __decorate([
276
- property({ type: Object })
277
- ], AppRoot.prototype, "itemMD", void 0);
278
- __decorate([
279
- property({ type: String })
280
- ], AppRoot.prototype, "encodedManifest", void 0);
281
- __decorate([
282
- property({ attribute: false })
283
- ], AppRoot.prototype, "sharedObserver", void 0);
284
- __decorate([
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 })
292
- ], AppRoot.prototype, "fullscreen", void 0);
293
- __decorate([
294
- property({ reflect: true, attribute: true })
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);
311
- AppRoot = __decorate([
312
- customElement('app-root')
313
- ], AppRoot);
314
- export { AppRoot };
275
+ `;
276
+ __decorate([
277
+ property({ type: Object })
278
+ ], AppRoot.prototype, "itemMD", void 0);
279
+ __decorate([
280
+ property({ type: String })
281
+ ], AppRoot.prototype, "encodedManifest", void 0);
282
+ __decorate([
283
+ property({ attribute: false })
284
+ ], AppRoot.prototype, "sharedObserver", void 0);
285
+ __decorate([
286
+ property({ type: Array, attribute: false })
287
+ ], AppRoot.prototype, "menuContents", void 0);
288
+ __decorate([
289
+ property({ type: Array, attribute: false })
290
+ ], AppRoot.prototype, "menuShortcuts", void 0);
291
+ __decorate([
292
+ property({ reflect: true, attribute: true })
293
+ ], AppRoot.prototype, "fullscreen", void 0);
294
+ __decorate([
295
+ property({ reflect: true, attribute: true })
296
+ ], AppRoot.prototype, "headerOn", void 0);
297
+ __decorate([
298
+ property({ reflect: true, attribute: true })
299
+ ], AppRoot.prototype, "loaded", void 0);
300
+ __decorate([
301
+ property({ reflect: true, attribute: true })
302
+ ], AppRoot.prototype, "showPlaceholder", void 0);
303
+ __decorate([
304
+ property({ reflect: true, attribute: true })
305
+ ], AppRoot.prototype, "showTheaterExample", void 0);
306
+ __decorate([
307
+ query('ia-item-navigator')
308
+ ], AppRoot.prototype, "itemNav", void 0);
309
+ __decorate([
310
+ query('modal-manager')
311
+ ], AppRoot.prototype, "modalMgr", void 0);
312
+ AppRoot = __decorate([
313
+ customElement('app-root')
314
+ ], AppRoot);
315
+ export { AppRoot };
315
316
  //# sourceMappingURL=app-root.js.map
@@ -1 +1 @@
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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;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 { html, css, LitElement, TemplateResult } from 'lit';\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
+ {"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;AAOxB,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QAMuB,oBAAe,GAAG,EAAE,CAAC;QAEjB,mBAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC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LitElement, TemplateResult } from 'lit';\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 MenuProviderInterface,\n} from '../src/interfaces/menu-interfaces';\n\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: MenuProviderInterface[] = [];\n\n @property({ type: Array, attribute: false })\n menuShortcuts: MenuShortcutInterface[] = [];\n\n @property({ reflect: true, attribute: true }) fullscreen: boolean | null =\n null;\n\n @property({ reflect: true, attribute: true }) headerOn: true | null = null;\n\n @property({ reflect: true, attribute: true }) loaded: true | null = true;\n\n @property({ reflect: true, attribute: true }) showPlaceholder: true | null =\n 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 const nextState = this.loaded === true ? null : true;\n this.loaded = nextState;\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 ] as any as MenuProviderInterface[];\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"]}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { ItemNavigator } from './src/item-navigator';
2
- export { MenuButton } from './src/menu-slider/menu-button';
3
- export { IaMenuSlider } from './src/menu-slider/ia-menu-slider';
1
+ export { ItemNavigator } from './src/item-navigator';
2
+ export { MenuButton } from './src/menu-slider/menu-button';
3
+ export { IaMenuSlider } from './src/menu-slider/ia-menu-slider';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ItemNavigator } from './src/item-navigator';
2
- export { MenuButton } from './src/menu-slider/menu-button';
3
- export { IaMenuSlider } from './src/menu-slider/ia-menu-slider';
1
+ export { ItemNavigator } from './src/item-navigator';
2
+ export { MenuButton } from './src/menu-slider/menu-button';
3
+ export { IaMenuSlider } from './src/menu-slider/ia-menu-slider';
4
4
  //# sourceMappingURL=index.js.map
@@ -1,20 +1,20 @@
1
- import { LitElement } from 'lit';
2
- import { MetadataResponse } from '@internetarchive/search-service';
3
- import { ModalManager } from '@internetarchive/modal-manager';
4
- import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
5
- import { MenuProviderInterface, MenuShortcutInterface } from './menu-interfaces';
6
- export interface CustomTheaterInterface extends LitElement {
7
- baseHost?: string;
8
- itemMD?: MetadataResponse;
9
- menuProviders?: MenuProviderInterface[];
10
- menuShortcuts?: MenuShortcutInterface[];
11
- sideMenuOpen: boolean;
12
- signedIn?: boolean | null;
13
- sharedObserver?: SharedResizeObserver;
14
- modal?: ModalManager;
15
- emitLoadingStatusUpdate: (loaded: boolean) => void;
16
- addMenuShortcut: (menuId: string) => void;
17
- removeMenuShortcut: (menuId: string) => void;
18
- sortMenuShortcuts: () => void;
19
- emitMenuShortcutsUpdated: () => void;
20
- }
1
+ import { LitElement } from 'lit';
2
+ import { MetadataResponse } from '@internetarchive/search-service';
3
+ import { ModalManager } from '@internetarchive/modal-manager';
4
+ import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
5
+ import { MenuProviderInterface, MenuShortcutInterface } from './menu-interfaces';
6
+ export interface CustomTheaterInterface extends LitElement {
7
+ baseHost?: string;
8
+ itemMD?: MetadataResponse;
9
+ menuProviders?: MenuProviderInterface[];
10
+ menuShortcuts?: MenuShortcutInterface[];
11
+ sideMenuOpen: boolean;
12
+ signedIn?: boolean | null;
13
+ sharedObserver?: SharedResizeObserver;
14
+ modal?: ModalManager;
15
+ emitLoadingStatusUpdate: (loaded: boolean) => void;
16
+ addMenuShortcut: (menuId: string) => void;
17
+ removeMenuShortcut: (menuId: string) => void;
18
+ sortMenuShortcuts: () => void;
19
+ emitMenuShortcutsUpdated: () => void;
20
+ }
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=custom-theater-interface.js.map
@@ -1,40 +1,40 @@
1
- import { MenuProviderInterface, MenuShortcutInterface, MenuId } from './menu-interfaces';
2
- /** Toggles Menu && Sets open panel */
3
- export interface ToggleSideMenuOpenEvent extends CustomEvent {
4
- type: 'updateSideMenu';
5
- detail: {
6
- menuId: MenuId | undefined | '';
7
- action: 'open' | 'toggle' | '';
8
- };
9
- }
10
- /** Sets open panel */
11
- export interface ToggleSidePanelOpenEvent extends CustomEvent {
12
- type: 'menuTypeSelected';
13
- detail: {
14
- id: MenuId | '';
15
- };
16
- }
17
- /** Sets menu order that is displayed */
18
- export interface SetSideMenuContentsEvent extends CustomEvent {
19
- type: 'menuUpdated';
20
- detail: MenuProviderInterface[];
21
- }
22
- /** Sets menu shortcuts that is displayed */
23
- export interface SetSideMenuShortcutsEvent extends CustomEvent {
24
- type: 'menuUpdated';
25
- detail: MenuShortcutInterface[];
26
- }
27
- /** Toggles fullscreen mode */
28
- export interface ManageFullscreenEvent extends CustomEvent {
29
- type: 'ViewportInFullScreen';
30
- detail: {
31
- isFullScreen: boolean;
32
- };
33
- }
34
- /** Toggles loading view */
35
- export interface loadingStateUpdatedEvent extends CustomEvent {
36
- type: 'loadingStateUpdated';
37
- detail: {
38
- loaded: boolean;
39
- };
40
- }
1
+ import { MenuProviderInterface, MenuShortcutInterface, MenuId } from './menu-interfaces';
2
+ /** Toggles Menu && Sets open panel */
3
+ export interface ToggleSideMenuOpenEvent extends CustomEvent {
4
+ type: 'updateSideMenu';
5
+ detail: {
6
+ menuId: MenuId | undefined | '';
7
+ action: 'open' | 'toggle' | '';
8
+ };
9
+ }
10
+ /** Sets open panel */
11
+ export interface ToggleSidePanelOpenEvent extends CustomEvent {
12
+ type: 'menuTypeSelected';
13
+ detail: {
14
+ id: MenuId | '';
15
+ };
16
+ }
17
+ /** Sets menu order that is displayed */
18
+ export interface SetSideMenuContentsEvent extends CustomEvent {
19
+ type: 'menuUpdated';
20
+ detail: MenuProviderInterface[];
21
+ }
22
+ /** Sets menu shortcuts that is displayed */
23
+ export interface SetSideMenuShortcutsEvent extends CustomEvent {
24
+ type: 'menuUpdated';
25
+ detail: MenuShortcutInterface[];
26
+ }
27
+ /** Toggles fullscreen mode */
28
+ export interface ManageFullscreenEvent extends CustomEvent {
29
+ type: 'ViewportInFullScreen';
30
+ detail: {
31
+ isFullScreen: boolean;
32
+ };
33
+ }
34
+ /** Toggles loading view */
35
+ export interface loadingStateUpdatedEvent extends CustomEvent {
36
+ type: 'loadingStateUpdated';
37
+ detail: {
38
+ loaded: boolean;
39
+ };
40
+ }
@@ -1,2 +1,2 @@
1
- export {};
1
+ export {};
2
2
  //# sourceMappingURL=event-interfaces.js.map