@internetarchive/ia-item-navigator 0.0.3 → 0.0.4-4

Sign up to get free protection for your applications and to get access to all the features.
package/demo/app-root.ts CHANGED
@@ -36,6 +36,8 @@ export class AppRoot extends LitElement {
36
36
  | boolean
37
37
  | null = null;
38
38
 
39
+ @property({ type: Boolean, reflect: true, attribute: true }) headerOn = false;
40
+
39
41
  firstUpdated() {
40
42
  this.fetchItemMD();
41
43
  console.log(
@@ -94,56 +96,80 @@ export class AppRoot extends LitElement {
94
96
  fullscreenCheck(): void {
95
97
  if (this.showFullscreen && this.itemNav) {
96
98
  this.fullscreen = true;
97
- // this.itemNav.viewportInFullscreen = true;
98
99
  }
99
100
  }
100
101
  /** End fullscreen */
101
102
 
103
+ toggleHeader() {
104
+ this.headerOn = !this.headerOn;
105
+ }
106
+
102
107
  /** Views */
103
- get theaterBlock(): TemplateResult {
108
+ get headerExample(): TemplateResult {
104
109
  return html`
105
- <ia-item-navigator
106
- baseHost="https://archive.org"
107
- .item=${this.itemMD}
108
- .modal=${this.modalMgr}
109
- .sharedObserver=${this.sharedObserver}
110
- @ViewportInFullScreen=${this.toggleFS}
111
- .viewportInFullscreen=${this.fullscreen}
112
- ></ia-item-navigator>
110
+ <div slot="theater-header">
111
+ <div class="embed-link">
112
+ <img
113
+ src="https://archive.org/images/glogo-jw.png"
114
+ alt="glowing ia logo"
115
+ />
116
+ <a href="/details/goody"
117
+ >The history of Little Goody Two-Shoes : otherwise called Mrs.
118
+ Margery Two-Shoes ... [1766 edition]</a
119
+ >
120
+ </div>
121
+ </div>
113
122
  `;
114
123
  }
115
124
 
116
- get placeholder(): TemplateResult {
117
- return html`<h2>Please hold as we fetch an item for ya</h2>`;
118
- }
119
-
120
125
  render(): TemplateResult {
121
- const theater = this.theaterReady ? this.theaterBlock : this.placeholder;
122
126
  return html`
123
127
  <h1>theater, in page</h1>
124
- ${theater}
128
+ <section>
129
+ <ia-item-navigator
130
+ baseHost="https://archive.org"
131
+ .item=${this.itemMD}
132
+ .modal=${this.modalMgr}
133
+ .sharedObserver=${this.sharedObserver}
134
+ @fullscreenToggled=${this.toggleFS}
135
+ >
136
+ ${this.headerOn ? this.headerExample : ''}
137
+ </ia-item-navigator>
138
+ </section>
139
+ <div>
140
+ <button @click=${this.toggleHeader}>toggle header</button>
141
+ </div>
125
142
  <modal-manager></modal-manager>
126
143
  `;
127
144
  }
128
145
 
129
146
  static styles = css`
130
- :host {
131
- border: 1px solid pink;
132
- color: #222;
133
- }
134
-
135
- :host([fullscreen]) {
147
+ :host([fullscreen]),
148
+ :host([fullscreen]) section {
136
149
  height: 100vh;
137
150
  width: 100vw;
138
151
  }
139
152
 
153
+ :host([fullscreen]) h1 {
154
+ display: none;
155
+ }
156
+
157
+ h1 {
158
+ color: black;
159
+ }
160
+
161
+ section {
162
+ border: 1px solid pink;
163
+ color: #222;
164
+ height: calc(100vh - 200px);
165
+ }
166
+
140
167
  :host,
141
168
  ia-item-navigator {
142
169
  display: block;
143
170
  position: relative;
144
171
  width: 100%;
145
- min-height: 64vh;
146
- height: 64vh;
172
+ height: inherit;
147
173
  }
148
174
  ia-item-navigator {
149
175
  height: inherit;
@@ -156,6 +182,11 @@ export class AppRoot extends LitElement {
156
182
  min-height: inherit;
157
183
  }
158
184
 
185
+ .embed-link {
186
+ height: 55px;
187
+ border: 1px solid yellow;
188
+ }
189
+
159
190
  modal-manager[mode='closed'] {
160
191
  display: none;
161
192
  }
@@ -14,6 +14,7 @@ export declare class AppRoot extends LitElement {
14
14
  modalMgr: ModalManager;
15
15
  sharedObserver: SharedResizeObserver;
16
16
  fullscreen: boolean | null;
17
+ headerOn: boolean;
17
18
  firstUpdated(): void;
18
19
  updated(changed: any): void;
19
20
  fetchItemMD(): Promise<void>;
@@ -26,9 +27,9 @@ export declare class AppRoot extends LitElement {
26
27
  /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */
27
28
  fullscreenCheck(): void;
28
29
  /** End fullscreen */
30
+ toggleHeader(): void;
29
31
  /** Views */
30
- get theaterBlock(): TemplateResult;
31
- get placeholder(): TemplateResult;
32
+ get headerExample(): TemplateResult;
32
33
  render(): TemplateResult;
33
34
  static styles: import("lit-element").CSSResult;
34
35
  }
@@ -15,6 +15,7 @@ let AppRoot = class AppRoot extends LitElement {
15
15
  this.encodedManifest = '';
16
16
  this.sharedObserver = new SharedResizeObserver();
17
17
  this.fullscreen = null;
18
+ this.headerOn = false;
18
19
  }
19
20
  firstUpdated() {
20
21
  this.fetchItemMD();
@@ -60,53 +61,77 @@ let AppRoot = class AppRoot extends LitElement {
60
61
  fullscreenCheck() {
61
62
  if (this.showFullscreen && this.itemNav) {
62
63
  this.fullscreen = true;
63
- // this.itemNav.viewportInFullscreen = true;
64
64
  }
65
65
  }
66
66
  /** End fullscreen */
67
+ toggleHeader() {
68
+ this.headerOn = !this.headerOn;
69
+ }
67
70
  /** Views */
68
- get theaterBlock() {
71
+ get headerExample() {
69
72
  return html `
70
- <ia-item-navigator
71
- baseHost="https://archive.org"
72
- .item=${this.itemMD}
73
- .modal=${this.modalMgr}
74
- .sharedObserver=${this.sharedObserver}
75
- @ViewportInFullScreen=${this.toggleFS}
76
- .viewportInFullscreen=${this.fullscreen}
77
- ></ia-item-navigator>
73
+ <div slot="theater-header">
74
+ <div class="embed-link">
75
+ <img
76
+ src="https://archive.org/images/glogo-jw.png"
77
+ alt="glowing ia logo"
78
+ />
79
+ <a href="/details/goody"
80
+ >The history of Little Goody Two-Shoes : otherwise called Mrs.
81
+ Margery Two-Shoes ... [1766 edition]</a
82
+ >
83
+ </div>
84
+ </div>
78
85
  `;
79
86
  }
80
- get placeholder() {
81
- return html `<h2>Please hold as we fetch an item for ya</h2>`;
82
- }
83
87
  render() {
84
- const theater = this.theaterReady ? this.theaterBlock : this.placeholder;
85
88
  return html `
86
89
  <h1>theater, in page</h1>
87
- ${theater}
90
+ <section>
91
+ <ia-item-navigator
92
+ baseHost="https://archive.org"
93
+ .item=${this.itemMD}
94
+ .modal=${this.modalMgr}
95
+ .sharedObserver=${this.sharedObserver}
96
+ @fullscreenToggled=${this.toggleFS}
97
+ >
98
+ ${this.headerOn ? this.headerExample : ''}
99
+ </ia-item-navigator>
100
+ </section>
101
+ <div>
102
+ <button @click=${this.toggleHeader}>toggle header</button>
103
+ </div>
88
104
  <modal-manager></modal-manager>
89
105
  `;
90
106
  }
91
107
  };
92
108
  AppRoot.styles = css `
93
- :host {
94
- border: 1px solid pink;
95
- color: #222;
96
- }
97
-
98
- :host([fullscreen]) {
109
+ :host([fullscreen]),
110
+ :host([fullscreen]) section {
99
111
  height: 100vh;
100
112
  width: 100vw;
101
113
  }
102
114
 
115
+ :host([fullscreen]) h1 {
116
+ display: none;
117
+ }
118
+
119
+ h1 {
120
+ color: black;
121
+ }
122
+
123
+ section {
124
+ border: 1px solid pink;
125
+ color: #222;
126
+ height: calc(100vh - 200px);
127
+ }
128
+
103
129
  :host,
104
130
  ia-item-navigator {
105
131
  display: block;
106
132
  position: relative;
107
133
  width: 100%;
108
- min-height: 64vh;
109
- height: 64vh;
134
+ height: inherit;
110
135
  }
111
136
  ia-item-navigator {
112
137
  height: inherit;
@@ -119,6 +144,11 @@ AppRoot.styles = css `
119
144
  min-height: inherit;
120
145
  }
121
146
 
147
+ .embed-link {
148
+ height: 55px;
149
+ border: 1px solid yellow;
150
+ }
151
+
122
152
  modal-manager[mode='closed'] {
123
153
  display: none;
124
154
  }
@@ -141,6 +171,9 @@ __decorate([
141
171
  __decorate([
142
172
  property({ type: Boolean, reflect: true, attribute: true })
143
173
  ], AppRoot.prototype, "fullscreen", void 0);
174
+ __decorate([
175
+ property({ type: Boolean, reflect: true, attribute: true })
176
+ ], AppRoot.prototype, "headerOn", void 0);
144
177
  AppRoot = __decorate([
145
178
  customElement('app-root')
146
179
  ], 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,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KAEV,CAAC;IACJ,CAAC;CAoCF,CAAA;AAlCQ,cAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiClB,CAAC;AAzI0B;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;AAhBL,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CA8InB;SA9IY,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 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 // this.itemNav.viewportInFullscreen = true;\n }\n }\n /** End fullscreen */\n\n /** Views */\n get theaterBlock(): TemplateResult {\n return html`\n <ia-item-navigator\n baseHost=\"https://archive.org\"\n .item=${this.itemMD}\n .modal=${this.modalMgr}\n .sharedObserver=${this.sharedObserver}\n @ViewportInFullScreen=${this.toggleFS}\n .viewportInFullscreen=${this.fullscreen}\n ></ia-item-navigator>\n `;\n }\n\n get placeholder(): TemplateResult {\n return html`<h2>Please hold as we fetch an item for ya</h2>`;\n }\n\n render(): TemplateResult {\n const theater = this.theaterReady ? this.theaterBlock : this.placeholder;\n return html`\n <h1>theater, in page</h1>\n ${theater}\n <modal-manager></modal-manager>\n `;\n }\n\n static styles = css`\n :host {\n border: 1px solid pink;\n color: #222;\n }\n\n :host([fullscreen]) {\n height: 100vh;\n width: 100vw;\n }\n\n :host,\n ia-item-navigator {\n display: block;\n position: relative;\n width: 100%;\n min-height: 64vh;\n height: 64vh;\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 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;AAE/B,IAAa,OAAO,GAApB,MAAa,OAAQ,SAAQ,UAAU;IAAvC;;QACE;;WAEG;QACyB,WAAM,GAAiC,SAAS,CAAC;QAEjD,oBAAe,GAAG,EAAE,CAAC;QAMjB,mBAAc,GAAG,IAAI,oBAAoB,EAAE,CAAC;QAEf,eAAU,GAE5D,IAAI,CAAC;QAE6C,aAAQ,GAAG,KAAK,CAAC;IA2JhF,CAAC;IAzJC,YAAY;QACV,IAAI,CAAC,WAAW,EAAE,CAAC;QACnB,OAAO,CAAC,GAAG,CACT,iCAAiC,EACjC,IAAI,CAAC,QAAQ,EACb,IAAI,CAAC,cAAc,CACpB,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAAY;QAClB,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QAChC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACzB,IAAI,CAAC,eAAe,EAAE,CAAC;SACxB;IACH,CAAC;IAED,KAAK,CAAC,WAAW;QACf,MAAM,aAAa,GAAG,aAAa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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"]}
@@ -10,7 +10,7 @@ import { ToggleSideMenuOpenEvent, ToggleSidePanelOpenEvent, SetSideMenuContentsE
10
10
  import { MenuProviderInterface, MenuShortcutInterface, MenuId } from './interfaces/menu-interfaces';
11
11
  import './no-theater-available';
12
12
  export declare enum ItemType {
13
- BOOK = "bookreader"
13
+ OPEN = "open"
14
14
  }
15
15
  export declare class ItemNavigator extends LitElement implements SharedResizeObserverResizeHandlerInterface {
16
16
  item?: MetadataResponse;
@@ -28,6 +28,7 @@ export declare class ItemNavigator extends LitElement implements SharedResizeObs
28
28
  openMenuState: 'overlay' | 'shift';
29
29
  private frame;
30
30
  private headerSlot;
31
+ private mainSlot;
31
32
  disconnectedCallback(): void;
32
33
  updated(changed: PropertyValues): void;
33
34
  /** Shared observer */
@@ -42,10 +43,9 @@ export declare class ItemNavigator extends LitElement implements SharedResizeObs
42
43
  get loaderTitle(): "" | "Internet Archive";
43
44
  get readerHeightStyle(): string;
44
45
  get loadingArea(): TemplateResult;
46
+ slotChange(e: Event, type: 'header' | 'main'): void;
45
47
  render(): TemplateResult;
46
48
  get noTheaterView(): TemplateResult;
47
- get theaterSlot(): TemplateResult;
48
- get booksViewer(): TemplateResult;
49
49
  get renderViewport(): TemplateResult | typeof nothing;
50
50
  loadingStateUpdated(e: loadingStateUpdatedEvent): void;
51
51
  /** Fullscreen Management */
@@ -8,7 +8,7 @@ import './loader';
8
8
  import './no-theater-available';
9
9
  export var ItemType;
10
10
  (function (ItemType) {
11
- ItemType["BOOK"] = "bookreader";
11
+ ItemType["OPEN"] = "open";
12
12
  })(ItemType || (ItemType = {}));
13
13
  let ItemNavigator = class ItemNavigator extends LitElement {
14
14
  constructor() {
@@ -42,8 +42,18 @@ let ItemNavigator = class ItemNavigator extends LitElement {
42
42
  this.openMenuState = 'shift';
43
43
  }
44
44
  setResizeObserver() {
45
- var _a;
45
+ var _a, _b;
46
46
  (_a = this.sharedObserver) === null || _a === void 0 ? void 0 : _a.addObserver(this.resizeObserverConfig);
47
+ (_b = this.sharedObserver) === null || _b === void 0 ? void 0 : _b.addObserver({
48
+ target: this.headerSlot,
49
+ handler: {
50
+ handleResize: ({ contentRect }) => {
51
+ if (contentRect.height) {
52
+ this.requestUpdate();
53
+ }
54
+ },
55
+ },
56
+ });
47
57
  }
48
58
  removeResizeObserver() {
49
59
  var _a;
@@ -60,9 +70,9 @@ let ItemNavigator = class ItemNavigator extends LitElement {
60
70
  return this.viewportInFullscreen ? 'Internet Archive' : '';
61
71
  }
62
72
  get readerHeightStyle() {
63
- var _a;
64
- const calcFSHeight = `calc(100vh - ${(_a = this.headerSlot) === null || _a === void 0 ? void 0 : _a.offsetHeight}px)`;
65
- return this.viewportInFullscreen ? `height: ${calcFSHeight}` : '';
73
+ var _a, _b;
74
+ const calcFSHeight = `calc(100% - ${((_a = this.headerSlot) === null || _a === void 0 ? void 0 : _a.offsetHeight) || 0}px)`;
75
+ return ((_b = this.headerSlot) === null || _b === void 0 ? void 0 : _b.offsetHeight) > 0 ? `height: ${calcFSHeight}` : '';
66
76
  }
67
77
  get loadingArea() {
68
78
  return html `
@@ -73,18 +83,25 @@ let ItemNavigator = class ItemNavigator extends LitElement {
73
83
  </div>
74
84
  `;
75
85
  }
86
+ slotChange(e, type) {
87
+ var _a;
88
+ const slottedContent = (_a = e.target.assignedNodes()) === null || _a === void 0 ? void 0 : _a[0];
89
+ this.dispatchEvent(new CustomEvent('slotChange', {
90
+ detail: { slot: slottedContent, type },
91
+ }));
92
+ this.requestUpdate();
93
+ }
76
94
  render() {
77
95
  const displayReaderClass = this.loaded ? '' : 'hidden';
78
96
  return html `
79
- <div id="frame" class=${`${this.menuClass}`}>
80
- <div class="menu-and-reader">
97
+ <div id="frame" class=${this.menuClass}>
98
+ <slot
99
+ name="theater-header"
100
+ @slotchange=${(e) => this.slotChange(e, 'header')}
101
+ ></slot>
102
+ <div class="menu-and-reader" style=${this.readerHeightStyle}>
81
103
  ${this.shouldRenderMenu ? this.renderSideMenu : nothing}
82
- <slot name="theater-header"></slot>
83
- <div
84
- id="reader"
85
- class=${displayReaderClass}
86
- style=${this.readerHeightStyle}
87
- >
104
+ <div id="reader" class=${displayReaderClass}>
88
105
  ${this.renderViewport}
89
106
  </div>
90
107
  ${!this.loaded ? this.loadingArea : nothing}
@@ -99,41 +116,23 @@ let ItemNavigator = class ItemNavigator extends LitElement {
99
116
  @loadingStateUpdated=${this.loadingStateUpdated}
100
117
  ></ia-no-theater-available>`;
101
118
  }
102
- get theaterSlot() {
103
- return html `
104
- <slot name="theater-main" style=${this.readerHeightStyle}></slot>
105
- `;
106
- }
107
- get booksViewer() {
108
- const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';
109
- return html `
110
- <book-navigator
111
- .modal=${this.modal}
112
- .baseHost=${this.baseHost}
113
- .itemMD=${this.item}
114
- ?signedIn=${this.signedIn}
115
- ?sideMenuOpen=${this.menuOpened}
116
- .sharedObserver=${this.sharedObserver}
117
- @ViewportInFullScreen=${this.manageViewportFullscreen}
118
- @loadingStateUpdated=${this.loadingStateUpdated}
119
- @updateSideMenu=${this.manageSideMenuEvents}
120
- @menuUpdated=${this.setMenuContents}
121
- @menuShortcutsUpdated=${this.setMenuShortcuts}
122
- >
123
- <div slot="theater-main" style=${slotVisibility}>
124
- ${this.theaterSlot}
125
- </div>
126
- </book-navigator>
127
- `;
128
- }
129
119
  get renderViewport() {
130
120
  if (!this.item) {
131
121
  return nothing;
132
122
  }
133
- if (this.itemType === ItemType.BOOK) {
134
- return this.booksViewer;
123
+ if (this.itemType !== ItemType.OPEN) {
124
+ return this.noTheaterView;
135
125
  }
136
- return this.noTheaterView;
126
+ const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';
127
+ return html `
128
+ <div slot="theater-main" style=${slotVisibility}>
129
+ <slot
130
+ name="theater-main"
131
+ style=${this.readerHeightStyle}
132
+ @slotchange=${(e) => this.slotChange(e, 'main')}
133
+ ></slot>
134
+ </div>
135
+ `;
137
136
  }
138
137
  loadingStateUpdated(e) {
139
138
  const { loaded } = e.detail;
@@ -151,7 +150,8 @@ let ItemNavigator = class ItemNavigator extends LitElement {
151
150
  /** End Fullscreen Management */
152
151
  /** Side menu */
153
152
  get shouldRenderMenu() {
154
- return !!this.menuContents.length;
153
+ var _a;
154
+ return !!((_a = this.menuContents) === null || _a === void 0 ? void 0 : _a.length);
155
155
  }
156
156
  toggleMenu() {
157
157
  this.menuOpened = !this.menuOpened;
@@ -275,6 +275,12 @@ let ItemNavigator = class ItemNavigator extends LitElement {
275
275
  slot {
276
276
  display: block;
277
277
  overflow: hidden;
278
+ width: 100%;
279
+ }
280
+
281
+ slot * {
282
+ display: block;
283
+ height: inherit;
278
284
  }
279
285
 
280
286
  #frame {
@@ -379,9 +385,15 @@ let ItemNavigator = class ItemNavigator extends LitElement {
379
385
  #reader {
380
386
  position: relative;
381
387
  z-index: 1;
382
- /* transition: ${transitionEffect}; */
383
388
  transform: translateX(0);
384
389
  width: 100%;
390
+ height: 100%;
391
+ }
392
+
393
+ #reader > * {
394
+ width: 100%;
395
+ display: flex;
396
+ height: 100%;
385
397
  }
386
398
 
387
399
  .open.overlay #reader {
@@ -394,7 +406,6 @@ let ItemNavigator = class ItemNavigator extends LitElement {
394
406
  transition: ${transitionEffect};
395
407
  }
396
408
 
397
- .open.shift slot[name='theater-header'],
398
409
  .open.shift #reader {
399
410
  width: calc(100% - var(--menuWidth));
400
411
  float: right;
@@ -463,6 +474,9 @@ __decorate([
463
474
  __decorate([
464
475
  query('slot[name="theater-header"]')
465
476
  ], ItemNavigator.prototype, "headerSlot", void 0);
477
+ __decorate([
478
+ query('slot[name="theater-main"]')
479
+ ], ItemNavigator.prototype, "mainSlot", void 0);
466
480
  ItemNavigator = __decorate([
467
481
  customElement('ia-item-navigator')
468
482
  ], ItemNavigator);
@@ -1 +1 @@
1
- {"version":3,"file":"item-navigator.js","sourceRoot":"","sources":["../../src/item-navigator.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,aAAa,EACb,QAAQ,EACR,KAAK,EACL,KAAK,GAGN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAkB,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAKn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qC;AAnD/D,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAkdzB;SAldY,aAAa","sourcesContent":["import {\n css,\n html,\n LitElement,\n customElement,\n property,\n state,\n query,\n PropertyValues,\n CSSResult,\n} from 'lit-element';\nimport { nothing, TemplateResult } from 'lit-html';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport {\n SharedResizeObserver,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport '@internetarchive/ia-menu-slider';\n\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/icon-ellipses/icon-ellipses';\nimport './loader';\n\nimport {\n ToggleSideMenuOpenEvent,\n ToggleSidePanelOpenEvent,\n SetSideMenuContentsEvent,\n SetSideMenuShortcutsEvent,\n loadingStateUpdatedEvent,\n ManageFullscreenEvent,\n} from './interfaces/event-interfaces';\n\nimport {\n MenuProviderInterface,\n MenuShortcutInterface,\n MenuId,\n} from './interfaces/menu-interfaces';\nimport './no-theater-available';\n\nexport enum ItemType {\n BOOK = 'bookreader',\n}\n@customElement('ia-item-navigator')\nexport class ItemNavigator\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface {\n @property({\n type: Object,\n converter: (value: string | MetadataResponse | null): MetadataResponse => {\n if (value && typeof value === 'string') {\n return new MetadataResponse(JSON.parse(atob(value)));\n }\n return value as MetadataResponse;\n },\n })\n item?: MetadataResponse;\n\n @property({ type: String }) itemType?: ItemType;\n\n @property({ type: String }) baseHost = 'archive.org';\n\n @property({\n converter: (arg: string | boolean | null) => {\n if (typeof arg === 'boolean') {\n return arg;\n }\n return arg === 'true';\n },\n })\n signedIn = false;\n\n @property({ type: Array }) menuContents: MenuProviderInterface[] = [];\n\n @property({ type: Array }) menuShortcuts: MenuShortcutInterface[] = [];\n\n @property({ type: Boolean, reflect: true, attribute: true })\n viewportInFullscreen: boolean | null = null;\n\n @property({ type: Boolean }) menuOpened = false;\n\n @property({ type: String }) openMenu?: MenuId;\n\n @property({ attribute: false }) modal?: ModalManager;\n\n @property({ attribute: false }) sharedObserver?: SharedResizeObserver;\n\n @property({ type: Boolean, reflect: true, attribute: true }) loaded:\n | true\n | null = null;\n\n @state() openMenuState: 'overlay' | 'shift' = 'shift';\n\n @query('#frame') private frame!: HTMLDivElement;\n\n @query('slot[name=\"theater-header\"]') private headerSlot!: HTMLDivElement;\n\n disconnectedCallback() {\n this.removeResizeObserver();\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('sharedObserver')) {\n const oldObserver = changed.get('sharedObserver') as SharedResizeObserver;\n oldObserver?.removeObserver(this.resizeObserverConfig);\n this.setResizeObserver();\n }\n }\n\n /** Shared observer */\n handleResize(entry: ResizeObserverEntry): void {\n const { width } = entry.contentRect;\n if (width <= 600) {\n this.openMenuState = 'overlay';\n return;\n }\n this.openMenuState = 'shift';\n }\n\n private setResizeObserver(): void {\n this.sharedObserver?.addObserver(this.resizeObserverConfig);\n }\n\n private removeResizeObserver(): void {\n this.sharedObserver?.removeObserver(this.resizeObserverConfig);\n }\n\n get resizeObserverConfig(): {\n handler: SharedResizeObserverResizeHandlerInterface;\n target: Element;\n } {\n return {\n handler: this,\n target: this.frame,\n };\n }\n /** End shared observer */\n\n get loaderTitle() {\n return this.viewportInFullscreen ? 'Internet Archive' : '';\n }\n\n get readerHeightStyle(): string {\n const calcFSHeight = `calc(100vh - ${this.headerSlot?.offsetHeight}px)`;\n return this.viewportInFullscreen ? `height: ${calcFSHeight}` : '';\n }\n\n get loadingArea() {\n return html`\n <div class=\"loading-area\">\n <div class=\"loading-view\">\n <ia-itemnav-loader .title=${this.loaderTitle}></ia-itemnav-loader>\n </div>\n </div>\n `;\n }\n\n render(): TemplateResult {\n const displayReaderClass = this.loaded ? '' : 'hidden';\n return html`\n <div id=\"frame\" class=${`${this.menuClass}`}>\n <div class=\"menu-and-reader\">\n ${this.shouldRenderMenu ? this.renderSideMenu : nothing}\n <slot name=\"theater-header\"></slot>\n <div\n id=\"reader\"\n class=${displayReaderClass}\n style=${this.readerHeightStyle}\n >\n ${this.renderViewport}\n </div>\n ${!this.loaded ? this.loadingArea : nothing}\n </div>\n </div>\n `;\n }\n\n get noTheaterView() {\n return html`<ia-no-theater-available\n .identifier=${this.item?.metadata?.identifier}\n @loadingStateUpdated=${this.loadingStateUpdated}\n ></ia-no-theater-available>`;\n }\n\n get theaterSlot() {\n return html`\n <slot name=\"theater-main\" style=${this.readerHeightStyle}></slot>\n `;\n }\n\n get booksViewer(): TemplateResult {\n const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';\n\n return html`\n <book-navigator\n .modal=${this.modal}\n .baseHost=${this.baseHost}\n .itemMD=${this.item}\n ?signedIn=${this.signedIn}\n ?sideMenuOpen=${this.menuOpened}\n .sharedObserver=${this.sharedObserver}\n @ViewportInFullScreen=${this.manageViewportFullscreen}\n @loadingStateUpdated=${this.loadingStateUpdated}\n @updateSideMenu=${this.manageSideMenuEvents}\n @menuUpdated=${this.setMenuContents}\n @menuShortcutsUpdated=${this.setMenuShortcuts}\n >\n <div slot=\"theater-main\" style=${slotVisibility}>\n ${this.theaterSlot}\n </div>\n </book-navigator>\n `;\n }\n\n get renderViewport(): TemplateResult | typeof nothing {\n if (!this.item) {\n return nothing;\n }\n if (this.itemType === ItemType.BOOK) {\n return this.booksViewer;\n }\n return this.noTheaterView;\n }\n\n loadingStateUpdated(e: loadingStateUpdatedEvent): void {\n const { loaded } = e.detail;\n this.loaded = loaded || null;\n }\n\n /** Fullscreen Management */\n manageViewportFullscreen(e: ManageFullscreenEvent): void {\n const fullscreenStatus = !!e.detail.isFullScreen;\n this.viewportInFullscreen = !fullscreenStatus ? null : fullscreenStatus;\n\n const event = new CustomEvent('fullscreenToggled', {\n detail: e.detail,\n }) as ManageFullscreenEvent;\n\n this.dispatchEvent(event);\n }\n /** End Fullscreen Management */\n\n /** Side menu */\n get shouldRenderMenu(): boolean {\n return !!this.menuContents.length;\n }\n\n toggleMenu(): void {\n this.menuOpened = !this.menuOpened;\n }\n\n closeMenu(): void {\n this.menuOpened = false;\n }\n\n setOpenMenu(e: ToggleSidePanelOpenEvent): void {\n const { id } = e.detail;\n this.openMenu = id !== this.openMenu ? id : undefined;\n }\n\n setMenuContents(e: SetSideMenuContentsEvent): void {\n const updatedContents = [...e.detail];\n this.menuContents = updatedContents;\n }\n\n setMenuShortcuts(e: SetSideMenuShortcutsEvent) {\n this.menuShortcuts = [...e.detail];\n }\n\n /** Toggles Side Menu & Sets viewable subpanel */\n manageSideMenuEvents(e: ToggleSideMenuOpenEvent): void {\n const { menuId, action } = e.detail;\n if (!menuId) {\n return;\n }\n\n if (action === 'open') {\n this.openShortcut(menuId);\n } else if (action === 'toggle') {\n this.openMenu = menuId;\n this.toggleMenu();\n }\n }\n\n get menuToggleButton() {\n return html`\n <button\n class=\"toggle-menu\"\n @click=${this.toggleMenu}\n title=\"Toggle theater side panels\"\n >\n <div>\n <ia-icon-ellipses\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-ellipses>\n </div>\n </button>\n `;\n }\n\n get selectedMenuId(): MenuId | '' {\n return this.openMenu || '';\n }\n\n get renderSideMenu(): TemplateResult {\n const drawerState = this.menuOpened ? '' : 'hidden';\n return html`\n <nav>\n <div class=\"minimized\">${this.shortcuts} ${this.menuToggleButton}</div>\n <div id=\"menu\" class=${drawerState}>\n <ia-menu-slider\n .menus=${this.menuContents}\n .selectedMenu=${this.selectedMenuId}\n @menuTypeSelected=${this.setOpenMenu}\n @menuSliderClosed=${this.closeMenu}\n manuallyHandleClose\n open\n ></ia-menu-slider>\n </div>\n </nav>\n `;\n }\n /** End Side menu */\n\n /** Menu Shortcuts */\n openShortcut(selectedMenuId: MenuId = ''): void {\n this.openMenu = selectedMenuId;\n this.menuOpened = true;\n }\n\n get shortcuts(): TemplateResult {\n const shortcuts = this.menuShortcuts.map(({ icon, id }) => {\n if (id === 'fullscreen') {\n return html`${icon}`;\n }\n\n return html`\n <button class=\"shortcut ${id}\" @click=\"${() => this.openShortcut(id)}\">\n ${icon}\n </button>\n `;\n });\n return html`<div class=\"shortcuts\">${shortcuts}</div>`;\n }\n /** End Menu Shortcuts */\n\n /** Misc Render */\n get menuClass(): string {\n const drawerState = this.menuOpened ? 'open' : '';\n const fullscreenState = this.viewportInFullscreen ? 'fullscreen' : '';\n return `${drawerState} ${fullscreenState} ${this.openMenuState}`;\n }\n\n static get styles(): CSSResult {\n const subnavWidth = css`var(--menuWidth, 320px)`;\n const transitionTiming = css`var(--animationTiming, 200ms)`;\n const transitionEffect = css`transform ${transitionTiming} ease-out`;\n const menuMargin = css`var(--theaterMenuMargin, 42px)`;\n const theaterBg = css`var(--theaterBgColor, #000)`;\n\n return css`\n :host,\n #frame,\n .menu-and-reader {\n min-height: inherit;\n height: inherit;\n position: relative;\n overflow: hidden;\n display: block;\n }\n\n :host,\n #frame,\n .menu-and-reader,\n .loading-area,\n .loading-view {\n min-height: inherit;\n height: inherit;\n }\n\n slot {\n display: block;\n overflow: hidden;\n }\n\n #frame {\n background-color: ${theaterBg};\n color-scheme: dark;\n }\n\n #frame.fullscreen {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 9;\n }\n\n .loading-view {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n ia-itemnav-loader {\n display: block;\n width: 100%;\n }\n\n .hidden {\n display: none;\n }\n\n button {\n cursor: pointer;\n padding: 0;\n border: 0;\n }\n\n button:focus,\n button:active {\n outline: none;\n }\n\n .menu-and-reader {\n position: relative;\n }\n\n nav button {\n background: none;\n }\n\n nav .minimized {\n background: rgba(0, 0, 0, 0.7);\n padding-top: 6px;\n position: absolute;\n width: ${menuMargin};\n z-index: 2;\n left: 0;\n border-bottom-right-radius: 5%;\n }\n\n nav .minimized button {\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin-bottom: 0.2rem;\n margin: auto;\n display: inline-flex;\n vertical-align: middle;\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n width: ${menuMargin};\n height: ${menuMargin};\n }\n\n nav .minimized button.toggle-menu > * {\n border: 2px solid var(--iconStrokeColor);\n border-radius: var(--iconWidth);\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n }\n\n ia-icon-ellipses {\n width: var(--iconWidth);\n height: var(--iconHeight);\n }\n\n #menu {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 3;\n overflow: hidden;\n transform: translateX(-${subnavWidth});\n width: ${subnavWidth};\n transform: translateX(calc(${subnavWidth} * -1));\n transition: ${transitionEffect};\n }\n\n #reader {\n position: relative;\n z-index: 1;\n /* transition: ${transitionEffect}; */\n transform: translateX(0);\n width: 100%;\n }\n\n .open.overlay #reader {\n transition: none;\n }\n\n .open #menu {\n width: ${subnavWidth};\n transform: translateX(0);\n transition: ${transitionEffect};\n }\n\n .open.shift slot[name='theater-header'],\n .open.shift #reader {\n width: calc(100% - var(--menuWidth));\n float: right;\n transition: ${transitionEffect};\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"item-navigator.js","sourceRoot":"","sources":["../../src/item-navigator.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,aAAa,EACb,QAAQ,EACR,KAAK,EACL,KAAK,GAGN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAkB,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAKnE,OAAO,iCAAiC,CAAC;AAGzC,OAAO,8CAA8C,CAAC;AACtD,OAAO,UAAU,CAAC;AAgBlB,OAAO,wBAAwB,CAAC;AAEhC,MAAM,CAAN,IAAY,QAEX;AAFD,WAAY,QAAQ;IAClB,yBAAa,CAAA;AACf,CAAC,EAFW,QAAQ,KAAR,QAAQ,QAEnB;AAED,IAAa,aAAa,GAA1B,MAAa,aACX,SAAQ,UAAU;IADpB;;QAgB8B,aAAQ,GAAG,aAAa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C;IAAhB,KAAK,CAAC,QAAQ,CAAC;4CAAgC;AAEV;IAArC,KAAK,CAAC,6BAA6B,CAAC;iDAAsC;AAEvC;IAAnC,KAAK,CAAC,2BAA2B,CAAC;+CAAoC;AArD5D,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAgezB;SAheY,aAAa","sourcesContent":["import {\n css,\n html,\n LitElement,\n customElement,\n property,\n state,\n query,\n PropertyValues,\n CSSResult,\n} from 'lit-element';\nimport { nothing, TemplateResult } from 'lit-html';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport {\n SharedResizeObserver,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport '@internetarchive/ia-menu-slider';\n\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/icon-ellipses/icon-ellipses';\nimport './loader';\n\nimport {\n ToggleSideMenuOpenEvent,\n ToggleSidePanelOpenEvent,\n SetSideMenuContentsEvent,\n SetSideMenuShortcutsEvent,\n loadingStateUpdatedEvent,\n ManageFullscreenEvent,\n} from './interfaces/event-interfaces';\n\nimport {\n MenuProviderInterface,\n MenuShortcutInterface,\n MenuId,\n} from './interfaces/menu-interfaces';\nimport './no-theater-available';\n\nexport enum ItemType {\n OPEN = 'open',\n}\n@customElement('ia-item-navigator')\nexport class ItemNavigator\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface {\n @property({\n type: Object,\n converter: (value: string | MetadataResponse | null): MetadataResponse => {\n if (value && typeof value === 'string') {\n return new MetadataResponse(JSON.parse(atob(value)));\n }\n return value as MetadataResponse;\n },\n })\n item?: MetadataResponse;\n\n @property({ type: String }) itemType?: ItemType;\n\n @property({ type: String }) baseHost = 'archive.org';\n\n @property({\n converter: (arg: string | boolean | null) => {\n if (typeof arg === 'boolean') {\n return arg;\n }\n return arg === 'true';\n },\n })\n signedIn = false;\n\n @property({ type: Array }) menuContents: MenuProviderInterface[] = [];\n\n @property({ type: Array }) menuShortcuts: MenuShortcutInterface[] = [];\n\n @property({ type: Boolean, reflect: true, attribute: true })\n viewportInFullscreen: boolean | null = null;\n\n @property({ type: Boolean }) menuOpened = false;\n\n @property({ type: String }) openMenu?: MenuId;\n\n @property({ attribute: false }) modal?: ModalManager;\n\n @property({ attribute: false }) sharedObserver?: SharedResizeObserver;\n\n @property({ type: Boolean, reflect: true, attribute: true }) loaded:\n | true\n | null = null;\n\n @state() openMenuState: 'overlay' | 'shift' = 'shift';\n\n @query('#frame') private frame!: HTMLDivElement;\n\n @query('slot[name=\"theater-header\"]') private headerSlot!: HTMLSlotElement;\n\n @query('slot[name=\"theater-main\"]') private mainSlot!: HTMLSlotElement;\n\n disconnectedCallback() {\n this.removeResizeObserver();\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('sharedObserver')) {\n const oldObserver = changed.get('sharedObserver') as SharedResizeObserver;\n oldObserver?.removeObserver(this.resizeObserverConfig);\n this.setResizeObserver();\n }\n }\n\n /** Shared observer */\n handleResize(entry: ResizeObserverEntry): void {\n const { width } = entry.contentRect;\n if (width <= 600) {\n this.openMenuState = 'overlay';\n return;\n }\n this.openMenuState = 'shift';\n }\n\n private setResizeObserver(): void {\n this.sharedObserver?.addObserver(this.resizeObserverConfig);\n this.sharedObserver?.addObserver({\n target: this.headerSlot,\n handler: {\n handleResize: ({ contentRect }) => {\n if (contentRect.height) {\n this.requestUpdate();\n }\n },\n },\n });\n }\n\n private removeResizeObserver(): void {\n this.sharedObserver?.removeObserver(this.resizeObserverConfig);\n }\n\n get resizeObserverConfig(): {\n handler: SharedResizeObserverResizeHandlerInterface;\n target: Element;\n } {\n return {\n handler: this,\n target: this.frame,\n };\n }\n /** End shared observer */\n\n get loaderTitle() {\n return this.viewportInFullscreen ? 'Internet Archive' : '';\n }\n\n get readerHeightStyle(): string {\n const calcFSHeight = `calc(100% - ${this.headerSlot?.offsetHeight || 0}px)`;\n\n return this.headerSlot?.offsetHeight > 0 ? `height: ${calcFSHeight}` : '';\n }\n\n get loadingArea() {\n return html`\n <div class=\"loading-area\">\n <div class=\"loading-view\">\n <ia-itemnav-loader .title=${this.loaderTitle}></ia-itemnav-loader>\n </div>\n </div>\n `;\n }\n\n slotChange(e: Event, type: 'header' | 'main'): void {\n const slottedContent = (e.target as HTMLSlotElement).assignedNodes()?.[0] as HTMLElement;\n\n this.dispatchEvent(\n new CustomEvent('slotChange', {\n detail: { slot: slottedContent, type },\n })\n );\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n const displayReaderClass = this.loaded ? '' : 'hidden';\n return html`\n <div id=\"frame\" class=${this.menuClass}>\n <slot\n name=\"theater-header\"\n @slotchange=${(e: Event) => this.slotChange(e, 'header')}\n ></slot>\n <div class=\"menu-and-reader\" style=${this.readerHeightStyle}>\n ${this.shouldRenderMenu ? this.renderSideMenu : nothing}\n <div id=\"reader\" class=${displayReaderClass}>\n ${this.renderViewport}\n </div>\n ${!this.loaded ? this.loadingArea : nothing}\n </div>\n </div>\n `;\n }\n\n get noTheaterView() {\n return html`<ia-no-theater-available\n .identifier=${this.item?.metadata?.identifier}\n @loadingStateUpdated=${this.loadingStateUpdated}\n ></ia-no-theater-available>`;\n }\n\n get renderViewport(): TemplateResult | typeof nothing {\n if (!this.item) {\n return nothing;\n }\n if (this.itemType !== ItemType.OPEN) {\n return this.noTheaterView;\n }\n\n const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';\n return html`\n <div slot=\"theater-main\" style=${slotVisibility}>\n <slot\n name=\"theater-main\"\n style=${this.readerHeightStyle}\n @slotchange=${(e: Event) => this.slotChange(e, 'main')}\n ></slot>\n </div>\n `;\n }\n\n loadingStateUpdated(e: loadingStateUpdatedEvent): void {\n const { loaded } = e.detail;\n this.loaded = loaded || null;\n }\n\n /** Fullscreen Management */\n manageViewportFullscreen(e: ManageFullscreenEvent): void {\n const fullscreenStatus = !!e.detail.isFullScreen;\n this.viewportInFullscreen = !fullscreenStatus ? null : fullscreenStatus;\n\n const event = new CustomEvent('fullscreenToggled', {\n detail: e.detail,\n }) as ManageFullscreenEvent;\n\n this.dispatchEvent(event);\n }\n /** End Fullscreen Management */\n\n /** Side menu */\n get shouldRenderMenu(): boolean {\n return !!this.menuContents?.length;\n }\n\n toggleMenu(): void {\n this.menuOpened = !this.menuOpened;\n }\n\n closeMenu(): void {\n this.menuOpened = false;\n }\n\n setOpenMenu(e: ToggleSidePanelOpenEvent): void {\n const { id } = e.detail;\n this.openMenu = id !== this.openMenu ? id : undefined;\n }\n\n setMenuContents(e: SetSideMenuContentsEvent): void {\n const updatedContents = [...e.detail];\n this.menuContents = updatedContents;\n }\n\n setMenuShortcuts(e: SetSideMenuShortcutsEvent) {\n this.menuShortcuts = [...e.detail];\n }\n\n /** Toggles Side Menu & Sets viewable subpanel */\n manageSideMenuEvents(e: ToggleSideMenuOpenEvent): void {\n const { menuId, action } = e.detail;\n if (!menuId) {\n return;\n }\n\n if (action === 'open') {\n this.openShortcut(menuId);\n } else if (action === 'toggle') {\n this.openMenu = menuId;\n this.toggleMenu();\n }\n }\n\n get menuToggleButton() {\n return html`\n <button\n class=\"toggle-menu\"\n @click=${this.toggleMenu}\n title=\"Toggle theater side panels\"\n >\n <div>\n <ia-icon-ellipses\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-ellipses>\n </div>\n </button>\n `;\n }\n\n get selectedMenuId(): MenuId | '' {\n return this.openMenu || '';\n }\n\n get renderSideMenu(): TemplateResult {\n const drawerState = this.menuOpened ? '' : 'hidden';\n return html`\n <nav>\n <div class=\"minimized\">${this.shortcuts} ${this.menuToggleButton}</div>\n <div id=\"menu\" class=${drawerState}>\n <ia-menu-slider\n .menus=${this.menuContents}\n .selectedMenu=${this.selectedMenuId}\n @menuTypeSelected=${this.setOpenMenu}\n @menuSliderClosed=${this.closeMenu}\n manuallyHandleClose\n open\n ></ia-menu-slider>\n </div>\n </nav>\n `;\n }\n /** End Side menu */\n\n /** Menu Shortcuts */\n openShortcut(selectedMenuId: MenuId = ''): void {\n this.openMenu = selectedMenuId;\n this.menuOpened = true;\n }\n\n get shortcuts(): TemplateResult {\n const shortcuts = this.menuShortcuts.map(({ icon, id }) => {\n if (id === 'fullscreen') {\n return html`${icon}`;\n }\n\n return html`\n <button class=\"shortcut ${id}\" @click=\"${() => this.openShortcut(id)}\">\n ${icon}\n </button>\n `;\n });\n return html`<div class=\"shortcuts\">${shortcuts}</div>`;\n }\n /** End Menu Shortcuts */\n\n /** Misc Render */\n get menuClass(): string {\n const drawerState = this.menuOpened ? 'open' : '';\n const fullscreenState = this.viewportInFullscreen ? 'fullscreen' : '';\n return `${drawerState} ${fullscreenState} ${this.openMenuState}`;\n }\n\n static get styles(): CSSResult {\n const subnavWidth = css`var(--menuWidth, 320px)`;\n const transitionTiming = css`var(--animationTiming, 200ms)`;\n const transitionEffect = css`transform ${transitionTiming} ease-out`;\n const menuMargin = css`var(--theaterMenuMargin, 42px)`;\n const theaterBg = css`var(--theaterBgColor, #000)`;\n\n return css`\n :host,\n #frame,\n .menu-and-reader {\n min-height: inherit;\n height: inherit;\n position: relative;\n overflow: hidden;\n display: block;\n }\n\n :host,\n #frame,\n .menu-and-reader,\n .loading-area,\n .loading-view {\n min-height: inherit;\n height: inherit;\n }\n\n slot {\n display: block;\n overflow: hidden;\n width: 100%;\n }\n\n slot * {\n display: block;\n height: inherit;\n }\n\n #frame {\n background-color: ${theaterBg};\n color-scheme: dark;\n }\n\n #frame.fullscreen {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 9;\n }\n\n .loading-view {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n ia-itemnav-loader {\n display: block;\n width: 100%;\n }\n\n .hidden {\n display: none;\n }\n\n button {\n cursor: pointer;\n padding: 0;\n border: 0;\n }\n\n button:focus,\n button:active {\n outline: none;\n }\n\n .menu-and-reader {\n position: relative;\n }\n\n nav button {\n background: none;\n }\n\n nav .minimized {\n background: rgba(0, 0, 0, 0.7);\n padding-top: 6px;\n position: absolute;\n width: ${menuMargin};\n z-index: 2;\n left: 0;\n border-bottom-right-radius: 5%;\n }\n\n nav .minimized button {\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin-bottom: 0.2rem;\n margin: auto;\n display: inline-flex;\n vertical-align: middle;\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n width: ${menuMargin};\n height: ${menuMargin};\n }\n\n nav .minimized button.toggle-menu > * {\n border: 2px solid var(--iconStrokeColor);\n border-radius: var(--iconWidth);\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n }\n\n ia-icon-ellipses {\n width: var(--iconWidth);\n height: var(--iconHeight);\n }\n\n #menu {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 3;\n overflow: hidden;\n transform: translateX(-${subnavWidth});\n width: ${subnavWidth};\n transform: translateX(calc(${subnavWidth} * -1));\n transition: ${transitionEffect};\n }\n\n #reader {\n position: relative;\n z-index: 1;\n transform: translateX(0);\n width: 100%;\n height: 100%;\n }\n\n #reader > * {\n width: 100%;\n display: flex;\n height: 100%;\n }\n\n .open.overlay #reader {\n transition: none;\n }\n\n .open #menu {\n width: ${subnavWidth};\n transform: translateX(0);\n transition: ${transitionEffect};\n }\n\n .open.shift #reader {\n width: calc(100% - var(--menuWidth));\n float: right;\n transition: ${transitionEffect};\n }\n `;\n }\n}\n"]}
@@ -39,7 +39,8 @@ let IANoTheaterAvailable = class IANoTheaterAvailable extends LitElement {
39
39
  text-align: center;
40
40
  }
41
41
  section {
42
- margin: 10% auto 0;
42
+ width: 100%;
43
+ margin: 5%;
43
44
  padding: 0 5%;
44
45
  }
45
46
  p {
@@ -1 +1 @@
1
- {"version":3,"file":"no-theater-available.js","sourceRoot":"","sources":["../../src/no-theater-available.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,QAAQ,EACR,IAAI,EAIJ,GAAG,GACJ,MAAM,aAAa,CAAC;AAGrB,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,UAAU;IAApD;;QAC8B,eAAU,GAAY,EAAE,CAAC;IAuEvD,CAAC;IArEC,UAAU;QACR,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAsB,qBAAqB,EAAE;YAC1D,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACzB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAAuB;QAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YAC7B,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;IACH,CAAC;IAED,IAAI,WAAW;QACb,OAAO,aAAa,IAAI,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;kBASG,IAAI,CAAC,WAAW;;KAE7B,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiCT,CAAC;IACJ,CAAC;CACF,CAAA;AAvE6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA0B;AAD1C,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAwEhC;SAxEY,oBAAoB","sourcesContent":["import {\n LitElement,\n customElement,\n property,\n html,\n TemplateResult,\n PropertyValues,\n CSSResult,\n css,\n} from 'lit-element';\n\n@customElement('ia-no-theater-available')\nexport class IANoTheaterAvailable extends LitElement {\n @property({ type: String }) identifier?: string = '';\n\n emitLoaded(): void {\n this.dispatchEvent(\n new CustomEvent<{ loaded: boolean }>('loadingStateUpdated', {\n detail: { loaded: true },\n })\n );\n }\n\n updated(changed: PropertyValues): void {\n if (changed.has('identifier')) {\n this.emitLoaded();\n }\n }\n\n get downloadUrl(): string {\n return `/download/${this.identifier}`;\n }\n\n render(): TemplateResult {\n return html`\n <section>\n <h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>\n <p>\n This item does not appear to have any files that can be experienced on\n Archive.org. <br />\n Please download files in this item to interact with them on your\n computer.\n </p>\n <a href=${this.downloadUrl}>Show all files</a>\n </section>\n `;\n }\n\n static get styles(): CSSResult {\n return css`\n :host {\n color: var(--primaryTextColor, #fff);\n text-align: center;\n }\n section {\n margin: 10% auto 0;\n padding: 0 5%;\n }\n p {\n font-size: 1.4rem;\n }\n a {\n color: var(--primaryTextColor, #fff);\n background-color: rgb(25, 72, 128);\n min-height: 35px;\n outline: none;\n cursor: pointer;\n line-height: normal;\n border-radius: 0.4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n display: inline-block;\n padding: 0.85rem 1.2rem;\n border: 1px solid rgb(197, 209, 223);\n white-space: nowrap;\n appearance: auto;\n box-sizing: border-box;\n user-select: none;\n text-decoration: none;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"no-theater-available.js","sourceRoot":"","sources":["../../src/no-theater-available.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,QAAQ,EACR,IAAI,EAIJ,GAAG,GACJ,MAAM,aAAa,CAAC;AAGrB,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,UAAU;IAApD;;QAC8B,eAAU,GAAY,EAAE,CAAC;IAwEvD,CAAC;IAtEC,UAAU;QACR,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAsB,qBAAqB,EAAE;YAC1D,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACzB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAAuB;QAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YAC7B,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;IACH,CAAC;IAED,IAAI,WAAW;QACb,OAAO,aAAa,IAAI,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;kBASG,IAAI,CAAC,WAAW;;KAE7B,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAkCT,CAAC;IACJ,CAAC;CACF,CAAA;AAxE6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA0B;AAD1C,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAyEhC;SAzEY,oBAAoB","sourcesContent":["import {\n LitElement,\n customElement,\n property,\n html,\n TemplateResult,\n PropertyValues,\n CSSResult,\n css,\n} from 'lit-element';\n\n@customElement('ia-no-theater-available')\nexport class IANoTheaterAvailable extends LitElement {\n @property({ type: String }) identifier?: string = '';\n\n emitLoaded(): void {\n this.dispatchEvent(\n new CustomEvent<{ loaded: boolean }>('loadingStateUpdated', {\n detail: { loaded: true },\n })\n );\n }\n\n updated(changed: PropertyValues): void {\n if (changed.has('identifier')) {\n this.emitLoaded();\n }\n }\n\n get downloadUrl(): string {\n return `/download/${this.identifier}`;\n }\n\n render(): TemplateResult {\n return html`\n <section>\n <h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>\n <p>\n This item does not appear to have any files that can be experienced on\n Archive.org. <br />\n Please download files in this item to interact with them on your\n computer.\n </p>\n <a href=${this.downloadUrl}>Show all files</a>\n </section>\n `;\n }\n\n static get styles(): CSSResult {\n return css`\n :host {\n color: var(--primaryTextColor, #fff);\n text-align: center;\n }\n section {\n width: 100%;\n margin: 5%;\n padding: 0 5%;\n }\n p {\n font-size: 1.4rem;\n }\n a {\n color: var(--primaryTextColor, #fff);\n background-color: rgb(25, 72, 128);\n min-height: 35px;\n outline: none;\n cursor: pointer;\n line-height: normal;\n border-radius: 0.4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n display: inline-block;\n padding: 0.85rem 1.2rem;\n border: 1px solid rgb(197, 209, 223);\n white-space: nowrap;\n appearance: auto;\n box-sizing: border-box;\n user-select: none;\n text-decoration: none;\n }\n `;\n }\n}\n"]}
@@ -1,2 +1 @@
1
1
  import '../src/item-navigator';
2
- import '../test/book-nav-stub';
@@ -5,7 +5,6 @@ import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
5
5
  import { ModalManager } from '@internetarchive/modal-manager';
6
6
  import { ItemType } from '../src/item-navigator';
7
7
  import '../src/item-navigator';
8
- import '../test/book-nav-stub';
9
8
  import { ItemStub, menuProvider, shortcut } from '../test/ia-stub';
10
9
  afterEach(() => {
11
10
  Sinon.restore();
@@ -16,29 +15,18 @@ describe('ItemNavigator', () => {
16
15
  var _a;
17
16
  const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
18
17
  expect((_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('ia-no-theater-available')).to.exist;
18
+ expect(el.itemType).to.not.equal(ItemType.OPEN);
19
19
  });
20
- it('shows <book-navigator> if `this.itemType = "bookreader"`', async () => {
21
- var _a;
22
- const el = await fixture(html `<ia-item-navigator
23
- .itemType=${ItemType.BOOK}
24
- .item=${new ItemStub()}
25
- .modal=${new ModalManager()}
26
- .sharedObserver=${new SharedResizeObserver()}
27
- ></ia-item-navigator>`);
28
- await el.updateComplete;
29
- el.toggleMenu();
20
+ it('opens main slot when itemType = open', async () => {
21
+ var _a, _b;
22
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
23
+ el.itemType = ItemType.OPEN;
30
24
  await el.updateComplete;
31
- const bookNavigator = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('book-navigator');
32
- await bookNavigator.updateComplete;
33
- console.log('132234234324324324');
34
- // TODO: add BookNavigator type & import via @internetarchive/bookreader
35
- // For now, let's check that the BookNavigator element and its properties exist w/ stub
36
- expect(bookNavigator).to.exist;
37
- expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.modal).to.exist;
38
- expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.baseHost).to.exist;
39
- expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.signedIn).to.be.null;
40
- expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.sharedObserver).to.exist;
41
- expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.sideMenuOpen).to.exist;
25
+ expect(el.itemType).to.equal(ItemType.OPEN);
26
+ expect((_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('ia-no-theater-available')).to.be
27
+ .null;
28
+ expect((_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('slot[name="theater-main"]')).to
29
+ .exist;
42
30
  });
43
31
  });
44
32
  describe('`el.loaded`', () => {
@@ -51,7 +39,7 @@ describe('ItemNavigator', () => {
51
39
  it('hides reader section if `!loaded`', async () => {
52
40
  var _a, _b;
53
41
  const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
54
- expect((_b = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#reader')) === null || _b === void 0 ? void 0 : _b.getAttribute('class')).to.contain('hide');
42
+ expect((_b = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#reader')) === null || _b === void 0 ? void 0 : _b.getAttribute('class')).to.contain('hidden');
55
43
  });
56
44
  it('shows reader when `loaded` ', async () => {
57
45
  var _a, _b;
@@ -90,13 +78,13 @@ describe('ItemNavigator', () => {
90
78
  expect(el.sharedObserver).to.equal(sharedObserver);
91
79
  expect(typeof el.handleResize).to.equal('function');
92
80
  });
93
- it('freshly registers handler', async () => {
81
+ it('freshly registers handlers', async () => {
94
82
  const sharedObserver = new SharedResizeObserver();
95
83
  const addObserverSpy = Sinon.spy(sharedObserver, 'addObserver');
96
84
  await fixture(html `<ia-item-navigator
97
85
  .sharedObserver=${sharedObserver}
98
86
  ></ia-item-navigator>`);
99
- expect(addObserverSpy.callCount).to.equal(1);
87
+ expect(addObserverSpy.callCount).to.equal(2);
100
88
  });
101
89
  it('removes handler when component disconnects', async () => {
102
90
  const sharedObserver = new SharedResizeObserver();
@@ -1 +1 @@
1
- {"version":3,"file":"ia-item-navigator.test.js","sourceRoot":"","sources":["../../test/ia-item-navigator.test.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAiB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,uBAAuB,CAAC;AAE/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AASnE,SAAS,CAAC,GAAG,EAAE;IACb,KAAK,CAAC,OAAO,EAAE,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;;YAC1D,MAAM,EAAE,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA,4BAA4B,IAAI,QAAQ,EAAE,uBAAuB,CACtE,CAAC;YACF,MAAM,CAAC,MAAA,EAAE,CAAC,UAAU,0CAAE,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC;QAC3E,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,0DAA0D,EAAE,KAAK,IAAI,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,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpC,MAAM,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAE1C,iBAAiB;YACjB,EAAE,CAAC,WAAW,CAAC;gBACb,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE;aACM,CAAC,CAAC;YAC/B,MAAM,EAAE,CAAC,cAAc,CAAC;YAExB,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;YACpC,MAAM,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;YAC9B,MAAM,EAAE,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA,4BAA4B,IAAI,QAAQ,EAAE,uBAAuB,CACtE,CAAC;YAEF,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC;YACrB,MAAM,EAAE,CAAC,cAAc,CAAC;YAExB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;YAEjC,EAAE,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,EAAE,CAAC,cAAc,CAAC;YAExB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable camelcase */\nimport { html, fixture, expect } from '@open-wc/testing';\nimport Sinon from 'sinon';\n\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { CustomTheaterInterface } from '../src/interfaces/custom-theater-interface';\nimport { ItemNavigator, ItemType } from '../src/item-navigator';\nimport '../src/item-navigator';\n\nimport '../test/book-nav-stub';\nimport { ItemStub, menuProvider, shortcut } from '../test/ia-stub';\nimport {\n ManageFullscreenEvent,\n ToggleSideMenuOpenEvent,\n SetSideMenuContentsEvent,\n SetSideMenuShortcutsEvent,\n ToggleSidePanelOpenEvent,\n} from '../src/interfaces/event-interfaces';\n\nafterEach(() => {\n Sinon.restore();\n});\n\ndescribe('ItemNavigator', () => {\n describe('Theaters', () => {\n it('shows <ia-no-theater-available> by default', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.exist;\n });\n\n it('shows <book-navigator> if `this.itemType = \"bookreader\"`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .itemType=${ItemType.BOOK}\n .item=${new ItemStub()}\n .modal=${new ModalManager()}\n .sharedObserver=${new SharedResizeObserver()}\n ></ia-item-navigator>`\n );\n\n await el.updateComplete;\n\n el.toggleMenu();\n await el.updateComplete;\n\n const bookNavigator = el.shadowRoot?.querySelector(\n 'book-navigator'\n ) as CustomTheaterInterface;\n await bookNavigator.updateComplete;\n\n console.log('132234234324324324');\n // TODO: add BookNavigator type & import via @internetarchive/bookreader\n // For now, let's check that the BookNavigator element and its properties exist w/ stub\n expect(bookNavigator).to.exist;\n expect(bookNavigator?.modal).to.exist;\n expect(bookNavigator?.baseHost).to.exist;\n expect(bookNavigator?.signedIn).to.be.null;\n expect(bookNavigator?.sharedObserver).to.exist;\n expect(bookNavigator?.sideMenuOpen).to.exist;\n });\n });\n describe('`el.loaded`', () => {\n it('toggles the spinning loader', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.loaded).to.be.null; // initial load\n expect(el.shadowRoot?.querySelector('ia-itemnav-loader')).to.exist;\n });\n it('hides reader section if `!loaded`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n expect(\n el.shadowRoot?.querySelector('#reader')?.getAttribute('class')\n ).to.contain('hide');\n });\n it('shows reader when `loaded` ', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n const mainTheaterSection = el.shadowRoot?.querySelector('#reader');\n expect(mainTheaterSection?.classList.contains('hide')).to.be.false;\n expect(el.loaded).to.be.true;\n // `loaded` property is reflected as DOM attribute\n expect(el.hasAttribute('loaded')).to.equal(true);\n expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.exist;\n });\n it('listens to `@loadingStateUpdated` to update `loaded`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n await el.updateComplete;\n const spy = Sinon.spy();\n el.loadingStateUpdated = spy;\n el.loaded = null;\n await el.updateComplete;\n // check base properties\n expect(el.loaded).to.equal(null);\n expect(el.item).to.be.undefined;\n\n // hydrate item\n el.item = new ItemStub();\n await el.updateComplete;\n\n // spy fires\n expect(spy.called).to.equal(true);\n expect(spy.callCount).to.equal(1);\n });\n });\n\n describe('`el.sharedObserver`', () => {\n it('uses one', async () => {\n const sharedObserver = new SharedResizeObserver();\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n expect(el.sharedObserver).to.equal(sharedObserver);\n expect(typeof el.handleResize).to.equal('function');\n });\n it('freshly registers handler', async () => {\n const sharedObserver = new SharedResizeObserver();\n const addObserverSpy = Sinon.spy(sharedObserver, 'addObserver');\n\n await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n expect(addObserverSpy.callCount).to.equal(1);\n });\n it('removes handler when component disconnects', async () => {\n const sharedObserver = new SharedResizeObserver();\n const removeObserverSpy = Sinon.spy(sharedObserver, 'removeObserver');\n\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n el.disconnectedCallback();\n await el.updateComplete;\n\n expect(removeObserverSpy.callCount).to.equal(1);\n });\n it('sets menu to overlay if container width is <= 600px', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n expect(el.openMenuState).to.equal('shift'); // as starting point\n\n const overlaySize = {\n contentRect: { width: 600 },\n } as ResizeObserverEntry;\n el.handleResize(overlaySize);\n await el.updateComplete;\n\n expect(el.openMenuState).to.equal('overlay'); // changes open menu display to an overlay\n\n const shiftSize = {\n contentRect: { width: 601 },\n } as ResizeObserverEntry;\n el.handleResize(shiftSize);\n await el.updateComplete;\n\n expect(el.openMenuState).to.equal('shift');\n });\n });\n\n describe('`el.modal`', () => {\n it('uses one', async () => {\n const modal = new ModalManager();\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .modal=${modal}></ia-item-navigator>`\n );\n expect(el.modal).to.equal(modal);\n });\n });\n\n describe('full browser window immersion \"fullscreen\"', () => {\n it('creates reflected attribute `viewportinfullscreen`', async () => {\n /** to help with external styling adjustmnents */\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.getAttribute('viewportinfullscreen')).to.be.null;\n\n el.viewportInFullscreen = true;\n await el.updateComplete;\n\n expect(el.getAttribute('viewportinfullscreen')).to.exist;\n });\n it('@ViewportInFullScreen', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.viewportInFullscreen).to.be.null;\n\n const yesFullscreenEvent = {\n detail: {\n isFullScreen: true,\n },\n } as ManageFullscreenEvent;\n el.manageViewportFullscreen(yesFullscreenEvent);\n await el.updateComplete;\n expect(el.viewportInFullscreen).to.be.true;\n\n const noFullscreenEvent = {\n detail: {\n isFullScreen: false,\n },\n } as ManageFullscreenEvent;\n el.manageViewportFullscreen(noFullscreenEvent);\n await el.updateComplete;\n expect(el.viewportInFullscreen).to.be.null;\n });\n });\n\n /* Side menu & shortcuts tests */\n describe('el.menuOpened', () => {\n it('toggles side menu open', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n\n const nav = el.shadowRoot?.querySelector('nav');\n\n expect(nav?.querySelector('#menu')).to.exist;\n // side menu starts closed\n expect(el.menuOpened).to.be.false;\n expect(nav?.querySelector('#menu')?.getAttribute('class')).to.contain(\n 'hidden'\n );\n\n // let's open menu\n el.toggleMenu();\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.true;\n expect(nav?.querySelector('#menu')?.getAttribute('class')).to.not.contain(\n 'hidden'\n );\n });\n\n it('opens menu shortcut with `@manageSideMenuEvents`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n const detail = {\n menuId: 'fullscreen',\n action: 'open',\n };\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n const frame = el.shadowRoot?.querySelector('#frame');\n // default menu open behavior is to side menu open, not overlay\n expect(frame?.getAttribute('class')).to.contain('shift');\n\n expect(el.menuOpened).to.be.false;\n expect(el.openMenu).to.be.undefined;\n expect(frame?.getAttribute('class')).to.not.contain('open');\n\n const event = new CustomEvent('updateSideMenu', {\n detail,\n }) as ToggleSideMenuOpenEvent;\n el.manageSideMenuEvents(event);\n await el.updateComplete;\n\n expect(el.shouldRenderMenu).to.be.true;\n expect(el.menuOpened).to.be.true;\n expect(el.openMenu).to.equal(detail.menuId);\n\n expect(frame?.getAttribute('class')).to.contain('open');\n\n // no menu provided\n const openShortcutSpy = Sinon.spy(el, 'openShortcut');\n const toggleMenuSpy = Sinon.spy(el, 'toggleMenu');\n\n const noMenuProvidedEvent = new CustomEvent('updateSideMenu', {\n detail: {},\n }) as any;\n el.manageSideMenuEvents(noMenuProvidedEvent);\n await el.updateComplete;\n\n expect(openShortcutSpy.called).to.be.false;\n expect(toggleMenuSpy.called).to.be.false;\n\n // toggle menu\n const toggleMenuEvent = new CustomEvent('updateSideMenu', {\n detail: { action: 'toggle', menuId: 'fullscreen' },\n }) as any;\n el.manageSideMenuEvents(toggleMenuEvent);\n await el.updateComplete;\n\n expect(toggleMenuSpy.callCount).to.equal(1);\n\n // open menu\n const openMenuEvent = new CustomEvent('updateSideMenu', {\n detail: { action: 'open', menuId: 'fullscreen' },\n }) as any;\n el.manageSideMenuEvents(openMenuEvent);\n await el.updateComplete;\n\n expect(openShortcutSpy.callCount).to.equal(1);\n });\n });\n\n describe('el.menuContents', () => {\n it('draws side menu when populated', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n expect(el.menuContents.length).to.exist;\n expect(el.shouldRenderMenu).to.be.true;\n\n const nav = el.shadowRoot?.querySelector('nav');\n expect(nav).to.exist;\n\n const menuSlider = nav?.querySelector('ia-menu-slider');\n expect(menuSlider).to.exist;\n expect(menuSlider?.getAttribute('manuallyhandleclose')).to.exist;\n expect(menuSlider?.getAttribute('open')).to.exist;\n });\n });\n\n describe('`el.menuShortcuts`', () => {\n it('displays shortcut & toggle side menu button', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n const anotherShortcut = {\n id: 'foo',\n icon: html`<i class=\"foo-shortcut\"></i>`,\n };\n el.menuContents = [menuProvider];\n el.menuShortcuts = [shortcut, anotherShortcut];\n await el.updateComplete;\n\n const nav = el.shadowRoot?.querySelector('nav');\n\n const shortcutsContainer = nav?.querySelector('.shortcuts');\n expect(el.menuShortcuts.length).to.exist;\n expect(nav).to.exist;\n expect(shortcutsContainer).to.exist;\n expect(shortcutsContainer?.querySelector('i.fullscreen-test')).to.exist;\n expect(shortcutsContainer?.querySelector('button.shortcut.foo')).to.exist;\n expect(nav?.querySelector('.toggle-menu')).to.exist;\n });\n });\n\n describe('Menu events', () => {\n it('`el.setMenuShortcuts`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.menuShortcuts.length).to.equal(0);\n\n const menuShortcuts = [shortcut];\n\n el.setMenuShortcuts({\n detail: menuShortcuts,\n } as SetSideMenuShortcutsEvent);\n await el.updateComplete;\n\n expect(el.menuShortcuts.length).to.equal(1);\n });\n it('`el.setMenuContents`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.menuContents.length).to.equal(0);\n\n el.setMenuShortcuts({\n detail: [menuProvider],\n } as SetSideMenuContentsEvent);\n await el.updateComplete;\n\n expect(el.menuShortcuts.length).to.equal(1);\n });\n it('`el.setOpenMenu`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.setOpenMenu({\n detail: { id: 'foo' },\n } as ToggleSidePanelOpenEvent);\n await el.updateComplete;\n\n expect(el.openMenu).to.equal('foo');\n expect(el.selectedMenuId).to.equal('foo');\n\n // toggles it off\n el.setOpenMenu({\n detail: { id: 'foo' },\n } as ToggleSidePanelOpenEvent);\n await el.updateComplete;\n\n expect(el.openMenu).to.be.undefined;\n expect(el.selectedMenuId).to.equal('');\n });\n it('`el.closeMenu`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuOpened = true;\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.true;\n\n el.closeMenu();\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.false;\n });\n });\n});\n"]}
1
+ {"version":3,"file":"ia-item-navigator.test.js","sourceRoot":"","sources":["../../test/ia-item-navigator.test.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE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AC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;YAEjC,EAAE,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,EAAE,CAAC,cAAc,CAAC;YAExB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable camelcase */\nimport { html, fixture, expect } from '@open-wc/testing';\nimport Sinon from 'sinon';\n\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { ItemNavigator, ItemType } from '../src/item-navigator';\nimport '../src/item-navigator';\n\nimport { ItemStub, menuProvider, shortcut } from '../test/ia-stub';\nimport {\n ManageFullscreenEvent,\n ToggleSideMenuOpenEvent,\n SetSideMenuContentsEvent,\n SetSideMenuShortcutsEvent,\n ToggleSidePanelOpenEvent,\n} from '../src/interfaces/event-interfaces';\n\nafterEach(() => {\n Sinon.restore();\n});\n\ndescribe('ItemNavigator', () => {\n describe('Theaters', () => {\n it('shows <ia-no-theater-available> by default', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.exist;\n expect(el.itemType).to.not.equal(ItemType.OPEN);\n });\n it('opens main slot when itemType = open', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n el.itemType = ItemType.OPEN;\n await el.updateComplete;\n\n expect(el.itemType).to.equal(ItemType.OPEN);\n expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.be\n .null;\n expect(el.shadowRoot?.querySelector('slot[name=\"theater-main\"]')).to\n .exist;\n });\n });\n describe('`el.loaded`', () => {\n it('toggles the spinning loader', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.loaded).to.be.null; // initial load\n expect(el.shadowRoot?.querySelector('ia-itemnav-loader')).to.exist;\n });\n it('hides reader section if `!loaded`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n expect(\n el.shadowRoot?.querySelector('#reader')?.getAttribute('class')\n ).to.contain('hidden');\n });\n it('shows reader when `loaded` ', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n const mainTheaterSection = el.shadowRoot?.querySelector('#reader');\n expect(mainTheaterSection?.classList.contains('hide')).to.be.false;\n expect(el.loaded).to.be.true;\n // `loaded` property is reflected as DOM attribute\n expect(el.hasAttribute('loaded')).to.equal(true);\n expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.exist;\n });\n it('listens to `@loadingStateUpdated` to update `loaded`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n await el.updateComplete;\n const spy = Sinon.spy();\n el.loadingStateUpdated = spy;\n el.loaded = null;\n await el.updateComplete;\n // check base properties\n expect(el.loaded).to.equal(null);\n expect(el.item).to.be.undefined;\n\n // hydrate item\n el.item = new ItemStub();\n await el.updateComplete;\n\n // spy fires\n expect(spy.called).to.equal(true);\n expect(spy.callCount).to.equal(1);\n });\n });\n\n describe('`el.sharedObserver`', () => {\n it('uses one', async () => {\n const sharedObserver = new SharedResizeObserver();\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n expect(el.sharedObserver).to.equal(sharedObserver);\n expect(typeof el.handleResize).to.equal('function');\n });\n it('freshly registers handlers', async () => {\n const sharedObserver = new SharedResizeObserver();\n const addObserverSpy = Sinon.spy(sharedObserver, 'addObserver');\n\n await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n expect(addObserverSpy.callCount).to.equal(2);\n });\n it('removes handler when component disconnects', async () => {\n const sharedObserver = new SharedResizeObserver();\n const removeObserverSpy = Sinon.spy(sharedObserver, 'removeObserver');\n\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n el.disconnectedCallback();\n await el.updateComplete;\n\n expect(removeObserverSpy.callCount).to.equal(1);\n });\n it('sets menu to overlay if container width is <= 600px', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n expect(el.openMenuState).to.equal('shift'); // as starting point\n\n const overlaySize = {\n contentRect: { width: 600 },\n } as ResizeObserverEntry;\n el.handleResize(overlaySize);\n await el.updateComplete;\n\n expect(el.openMenuState).to.equal('overlay'); // changes open menu display to an overlay\n\n const shiftSize = {\n contentRect: { width: 601 },\n } as ResizeObserverEntry;\n el.handleResize(shiftSize);\n await el.updateComplete;\n\n expect(el.openMenuState).to.equal('shift');\n });\n });\n\n describe('`el.modal`', () => {\n it('uses one', async () => {\n const modal = new ModalManager();\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .modal=${modal}></ia-item-navigator>`\n );\n expect(el.modal).to.equal(modal);\n });\n });\n\n describe('full browser window immersion \"fullscreen\"', () => {\n it('creates reflected attribute `viewportinfullscreen`', async () => {\n /** to help with external styling adjustmnents */\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.getAttribute('viewportinfullscreen')).to.be.null;\n\n el.viewportInFullscreen = true;\n await el.updateComplete;\n\n expect(el.getAttribute('viewportinfullscreen')).to.exist;\n });\n it('@ViewportInFullScreen', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.viewportInFullscreen).to.be.null;\n\n const yesFullscreenEvent = {\n detail: {\n isFullScreen: true,\n },\n } as ManageFullscreenEvent;\n el.manageViewportFullscreen(yesFullscreenEvent);\n await el.updateComplete;\n expect(el.viewportInFullscreen).to.be.true;\n\n const noFullscreenEvent = {\n detail: {\n isFullScreen: false,\n },\n } as ManageFullscreenEvent;\n el.manageViewportFullscreen(noFullscreenEvent);\n await el.updateComplete;\n expect(el.viewportInFullscreen).to.be.null;\n });\n });\n\n /* Side menu & shortcuts tests */\n describe('el.menuOpened', () => {\n it('toggles side menu open', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n\n const nav = el.shadowRoot?.querySelector('nav');\n\n expect(nav?.querySelector('#menu')).to.exist;\n // side menu starts closed\n expect(el.menuOpened).to.be.false;\n expect(nav?.querySelector('#menu')?.getAttribute('class')).to.contain(\n 'hidden'\n );\n\n // let's open menu\n el.toggleMenu();\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.true;\n expect(nav?.querySelector('#menu')?.getAttribute('class')).to.not.contain(\n 'hidden'\n );\n });\n\n it('opens menu shortcut with `@manageSideMenuEvents`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n const detail = {\n menuId: 'fullscreen',\n action: 'open',\n };\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n const frame = el.shadowRoot?.querySelector('#frame');\n // default menu open behavior is to side menu open, not overlay\n expect(frame?.getAttribute('class')).to.contain('shift');\n\n expect(el.menuOpened).to.be.false;\n expect(el.openMenu).to.be.undefined;\n expect(frame?.getAttribute('class')).to.not.contain('open');\n\n const event = new CustomEvent('updateSideMenu', {\n detail,\n }) as ToggleSideMenuOpenEvent;\n el.manageSideMenuEvents(event);\n await el.updateComplete;\n\n expect(el.shouldRenderMenu).to.be.true;\n expect(el.menuOpened).to.be.true;\n expect(el.openMenu).to.equal(detail.menuId);\n\n expect(frame?.getAttribute('class')).to.contain('open');\n\n // no menu provided\n const openShortcutSpy = Sinon.spy(el, 'openShortcut');\n const toggleMenuSpy = Sinon.spy(el, 'toggleMenu');\n\n const noMenuProvidedEvent = new CustomEvent('updateSideMenu', {\n detail: {},\n }) as any;\n el.manageSideMenuEvents(noMenuProvidedEvent);\n await el.updateComplete;\n\n expect(openShortcutSpy.called).to.be.false;\n expect(toggleMenuSpy.called).to.be.false;\n\n // toggle menu\n const toggleMenuEvent = new CustomEvent('updateSideMenu', {\n detail: { action: 'toggle', menuId: 'fullscreen' },\n }) as any;\n el.manageSideMenuEvents(toggleMenuEvent);\n await el.updateComplete;\n\n expect(toggleMenuSpy.callCount).to.equal(1);\n\n // open menu\n const openMenuEvent = new CustomEvent('updateSideMenu', {\n detail: { action: 'open', menuId: 'fullscreen' },\n }) as any;\n el.manageSideMenuEvents(openMenuEvent);\n await el.updateComplete;\n\n expect(openShortcutSpy.callCount).to.equal(1);\n });\n });\n\n describe('el.menuContents', () => {\n it('draws side menu when populated', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n expect(el.menuContents.length).to.exist;\n expect(el.shouldRenderMenu).to.be.true;\n\n const nav = el.shadowRoot?.querySelector('nav');\n expect(nav).to.exist;\n\n const menuSlider = nav?.querySelector('ia-menu-slider');\n expect(menuSlider).to.exist;\n expect(menuSlider?.getAttribute('manuallyhandleclose')).to.exist;\n expect(menuSlider?.getAttribute('open')).to.exist;\n });\n });\n\n describe('`el.menuShortcuts`', () => {\n it('displays shortcut & toggle side menu button', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n const anotherShortcut = {\n id: 'foo',\n icon: html`<i class=\"foo-shortcut\"></i>`,\n };\n el.menuContents = [menuProvider];\n el.menuShortcuts = [shortcut, anotherShortcut];\n await el.updateComplete;\n\n const nav = el.shadowRoot?.querySelector('nav');\n\n const shortcutsContainer = nav?.querySelector('.shortcuts');\n expect(el.menuShortcuts.length).to.exist;\n expect(nav).to.exist;\n expect(shortcutsContainer).to.exist;\n expect(shortcutsContainer?.querySelector('i.fullscreen-test')).to.exist;\n expect(shortcutsContainer?.querySelector('button.shortcut.foo')).to.exist;\n expect(nav?.querySelector('.toggle-menu')).to.exist;\n });\n });\n\n describe('Menu events', () => {\n it('`el.setMenuShortcuts`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.menuShortcuts.length).to.equal(0);\n\n const menuShortcuts = [shortcut];\n\n el.setMenuShortcuts({\n detail: menuShortcuts,\n } as SetSideMenuShortcutsEvent);\n await el.updateComplete;\n\n expect(el.menuShortcuts.length).to.equal(1);\n });\n it('`el.setMenuContents`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.menuContents.length).to.equal(0);\n\n el.setMenuShortcuts({\n detail: [menuProvider],\n } as SetSideMenuContentsEvent);\n await el.updateComplete;\n\n expect(el.menuShortcuts.length).to.equal(1);\n });\n it('`el.setOpenMenu`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.setOpenMenu({\n detail: { id: 'foo' },\n } as ToggleSidePanelOpenEvent);\n await el.updateComplete;\n\n expect(el.openMenu).to.equal('foo');\n expect(el.selectedMenuId).to.equal('foo');\n\n // toggles it off\n el.setOpenMenu({\n detail: { id: 'foo' },\n } as ToggleSidePanelOpenEvent);\n await el.updateComplete;\n\n expect(el.openMenu).to.be.undefined;\n expect(el.selectedMenuId).to.equal('');\n });\n it('`el.closeMenu`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuOpened = true;\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.true;\n\n el.closeMenu();\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.false;\n });\n });\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-item-navigator",
3
- "version": "0.0.3",
3
+ "version": "0.0.4-4",
4
4
  "description": "Internet Archive's Item Navigator, visually eplore an item's contents.",
5
5
  "author": "Internet Archive",
6
6
  "license": "AGPL-3.0-only",
@@ -27,7 +27,6 @@
27
27
  "@internetarchive/icon-share": "^1.1.3",
28
28
  "@internetarchive/icon-visual-adjustment": "^1.1.3",
29
29
  "@internetarchive/modal-manager": "^0.1.0",
30
- "@internetarchive/promised-singleton": "^0.3.0-alpha.1",
31
30
  "@internetarchive/search-service": "^0.1.2",
32
31
  "@internetarchive/shared-resize-observer": "^0.0.1",
33
32
  "@types/resize-observer-browser": "^0.1.6",
@@ -38,7 +38,7 @@ import {
38
38
  import './no-theater-available';
39
39
 
40
40
  export enum ItemType {
41
- BOOK = 'bookreader',
41
+ OPEN = 'open',
42
42
  }
43
43
  @customElement('ia-item-navigator')
44
44
  export class ItemNavigator
@@ -92,7 +92,9 @@ export class ItemNavigator
92
92
 
93
93
  @query('#frame') private frame!: HTMLDivElement;
94
94
 
95
- @query('slot[name="theater-header"]') private headerSlot!: HTMLDivElement;
95
+ @query('slot[name="theater-header"]') private headerSlot!: HTMLSlotElement;
96
+
97
+ @query('slot[name="theater-main"]') private mainSlot!: HTMLSlotElement;
96
98
 
97
99
  disconnectedCallback() {
98
100
  this.removeResizeObserver();
@@ -118,6 +120,16 @@ export class ItemNavigator
118
120
 
119
121
  private setResizeObserver(): void {
120
122
  this.sharedObserver?.addObserver(this.resizeObserverConfig);
123
+ this.sharedObserver?.addObserver({
124
+ target: this.headerSlot,
125
+ handler: {
126
+ handleResize: ({ contentRect }) => {
127
+ if (contentRect.height) {
128
+ this.requestUpdate();
129
+ }
130
+ },
131
+ },
132
+ });
121
133
  }
122
134
 
123
135
  private removeResizeObserver(): void {
@@ -140,8 +152,9 @@ export class ItemNavigator
140
152
  }
141
153
 
142
154
  get readerHeightStyle(): string {
143
- const calcFSHeight = `calc(100vh - ${this.headerSlot?.offsetHeight}px)`;
144
- return this.viewportInFullscreen ? `height: ${calcFSHeight}` : '';
155
+ const calcFSHeight = `calc(100% - ${this.headerSlot?.offsetHeight || 0}px)`;
156
+
157
+ return this.headerSlot?.offsetHeight > 0 ? `height: ${calcFSHeight}` : '';
145
158
  }
146
159
 
147
160
  get loadingArea() {
@@ -154,18 +167,28 @@ export class ItemNavigator
154
167
  `;
155
168
  }
156
169
 
170
+ slotChange(e: Event, type: 'header' | 'main'): void {
171
+ const slottedContent = (e.target as HTMLSlotElement).assignedNodes()?.[0] as HTMLElement;
172
+
173
+ this.dispatchEvent(
174
+ new CustomEvent('slotChange', {
175
+ detail: { slot: slottedContent, type },
176
+ })
177
+ );
178
+ this.requestUpdate();
179
+ }
180
+
157
181
  render(): TemplateResult {
158
182
  const displayReaderClass = this.loaded ? '' : 'hidden';
159
183
  return html`
160
- <div id="frame" class=${`${this.menuClass}`}>
161
- <div class="menu-and-reader">
184
+ <div id="frame" class=${this.menuClass}>
185
+ <slot
186
+ name="theater-header"
187
+ @slotchange=${(e: Event) => this.slotChange(e, 'header')}
188
+ ></slot>
189
+ <div class="menu-and-reader" style=${this.readerHeightStyle}>
162
190
  ${this.shouldRenderMenu ? this.renderSideMenu : nothing}
163
- <slot name="theater-header"></slot>
164
- <div
165
- id="reader"
166
- class=${displayReaderClass}
167
- style=${this.readerHeightStyle}
168
- >
191
+ <div id="reader" class=${displayReaderClass}>
169
192
  ${this.renderViewport}
170
193
  </div>
171
194
  ${!this.loaded ? this.loadingArea : nothing}
@@ -181,44 +204,24 @@ export class ItemNavigator
181
204
  ></ia-no-theater-available>`;
182
205
  }
183
206
 
184
- get theaterSlot() {
185
- return html`
186
- <slot name="theater-main" style=${this.readerHeightStyle}></slot>
187
- `;
188
- }
189
-
190
- get booksViewer(): TemplateResult {
191
- const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';
192
-
193
- return html`
194
- <book-navigator
195
- .modal=${this.modal}
196
- .baseHost=${this.baseHost}
197
- .itemMD=${this.item}
198
- ?signedIn=${this.signedIn}
199
- ?sideMenuOpen=${this.menuOpened}
200
- .sharedObserver=${this.sharedObserver}
201
- @ViewportInFullScreen=${this.manageViewportFullscreen}
202
- @loadingStateUpdated=${this.loadingStateUpdated}
203
- @updateSideMenu=${this.manageSideMenuEvents}
204
- @menuUpdated=${this.setMenuContents}
205
- @menuShortcutsUpdated=${this.setMenuShortcuts}
206
- >
207
- <div slot="theater-main" style=${slotVisibility}>
208
- ${this.theaterSlot}
209
- </div>
210
- </book-navigator>
211
- `;
212
- }
213
-
214
207
  get renderViewport(): TemplateResult | typeof nothing {
215
208
  if (!this.item) {
216
209
  return nothing;
217
210
  }
218
- if (this.itemType === ItemType.BOOK) {
219
- return this.booksViewer;
211
+ if (this.itemType !== ItemType.OPEN) {
212
+ return this.noTheaterView;
220
213
  }
221
- return this.noTheaterView;
214
+
215
+ const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';
216
+ return html`
217
+ <div slot="theater-main" style=${slotVisibility}>
218
+ <slot
219
+ name="theater-main"
220
+ style=${this.readerHeightStyle}
221
+ @slotchange=${(e: Event) => this.slotChange(e, 'main')}
222
+ ></slot>
223
+ </div>
224
+ `;
222
225
  }
223
226
 
224
227
  loadingStateUpdated(e: loadingStateUpdatedEvent): void {
@@ -241,7 +244,7 @@ export class ItemNavigator
241
244
 
242
245
  /** Side menu */
243
246
  get shouldRenderMenu(): boolean {
244
- return !!this.menuContents.length;
247
+ return !!this.menuContents?.length;
245
248
  }
246
249
 
247
250
  toggleMenu(): void {
@@ -380,6 +383,12 @@ export class ItemNavigator
380
383
  slot {
381
384
  display: block;
382
385
  overflow: hidden;
386
+ width: 100%;
387
+ }
388
+
389
+ slot * {
390
+ display: block;
391
+ height: inherit;
383
392
  }
384
393
 
385
394
  #frame {
@@ -484,9 +493,15 @@ export class ItemNavigator
484
493
  #reader {
485
494
  position: relative;
486
495
  z-index: 1;
487
- /* transition: ${transitionEffect}; */
488
496
  transform: translateX(0);
489
497
  width: 100%;
498
+ height: 100%;
499
+ }
500
+
501
+ #reader > * {
502
+ width: 100%;
503
+ display: flex;
504
+ height: 100%;
490
505
  }
491
506
 
492
507
  .open.overlay #reader {
@@ -499,7 +514,6 @@ export class ItemNavigator
499
514
  transition: ${transitionEffect};
500
515
  }
501
516
 
502
- .open.shift slot[name='theater-header'],
503
517
  .open.shift #reader {
504
518
  width: calc(100% - var(--menuWidth));
505
519
  float: right;
@@ -53,7 +53,8 @@ export class IANoTheaterAvailable extends LitElement {
53
53
  text-align: center;
54
54
  }
55
55
  section {
56
- margin: 10% auto 0;
56
+ width: 100%;
57
+ margin: 5%;
57
58
  padding: 0 5%;
58
59
  }
59
60
  p {
@@ -4,11 +4,9 @@ import Sinon from 'sinon';
4
4
 
5
5
  import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
6
6
  import { ModalManager } from '@internetarchive/modal-manager';
7
- import { CustomTheaterInterface } from '../src/interfaces/custom-theater-interface';
8
7
  import { ItemNavigator, ItemType } from '../src/item-navigator';
9
8
  import '../src/item-navigator';
10
9
 
11
- import '../test/book-nav-stub';
12
10
  import { ItemStub, menuProvider, shortcut } from '../test/ia-stub';
13
11
  import {
14
12
  ManageFullscreenEvent,
@@ -29,37 +27,20 @@ describe('ItemNavigator', () => {
29
27
  html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`
30
28
  );
31
29
  expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.exist;
30
+ expect(el.itemType).to.not.equal(ItemType.OPEN);
32
31
  });
33
-
34
- it('shows <book-navigator> if `this.itemType = "bookreader"`', async () => {
32
+ it('opens main slot when itemType = open', async () => {
35
33
  const el = await fixture<ItemNavigator>(
36
- html`<ia-item-navigator
37
- .itemType=${ItemType.BOOK}
38
- .item=${new ItemStub()}
39
- .modal=${new ModalManager()}
40
- .sharedObserver=${new SharedResizeObserver()}
41
- ></ia-item-navigator>`
34
+ html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`
42
35
  );
43
-
44
- await el.updateComplete;
45
-
46
- el.toggleMenu();
36
+ el.itemType = ItemType.OPEN;
47
37
  await el.updateComplete;
48
38
 
49
- const bookNavigator = el.shadowRoot?.querySelector(
50
- 'book-navigator'
51
- ) as CustomTheaterInterface;
52
- await bookNavigator.updateComplete;
53
-
54
- console.log('132234234324324324');
55
- // TODO: add BookNavigator type & import via @internetarchive/bookreader
56
- // For now, let's check that the BookNavigator element and its properties exist w/ stub
57
- expect(bookNavigator).to.exist;
58
- expect(bookNavigator?.modal).to.exist;
59
- expect(bookNavigator?.baseHost).to.exist;
60
- expect(bookNavigator?.signedIn).to.be.null;
61
- expect(bookNavigator?.sharedObserver).to.exist;
62
- expect(bookNavigator?.sideMenuOpen).to.exist;
39
+ expect(el.itemType).to.equal(ItemType.OPEN);
40
+ expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.be
41
+ .null;
42
+ expect(el.shadowRoot?.querySelector('slot[name="theater-main"]')).to
43
+ .exist;
63
44
  });
64
45
  });
65
46
  describe('`el.loaded`', () => {
@@ -77,7 +58,7 @@ describe('ItemNavigator', () => {
77
58
 
78
59
  expect(
79
60
  el.shadowRoot?.querySelector('#reader')?.getAttribute('class')
80
- ).to.contain('hide');
61
+ ).to.contain('hidden');
81
62
  });
82
63
  it('shows reader when `loaded` ', async () => {
83
64
  const el = await fixture<ItemNavigator>(
@@ -127,7 +108,7 @@ describe('ItemNavigator', () => {
127
108
  expect(el.sharedObserver).to.equal(sharedObserver);
128
109
  expect(typeof el.handleResize).to.equal('function');
129
110
  });
130
- it('freshly registers handler', async () => {
111
+ it('freshly registers handlers', async () => {
131
112
  const sharedObserver = new SharedResizeObserver();
132
113
  const addObserverSpy = Sinon.spy(sharedObserver, 'addObserver');
133
114
 
@@ -137,7 +118,7 @@ describe('ItemNavigator', () => {
137
118
  ></ia-item-navigator>`
138
119
  );
139
120
 
140
- expect(addObserverSpy.callCount).to.equal(1);
121
+ expect(addObserverSpy.callCount).to.equal(2);
141
122
  });
142
123
  it('removes handler when component disconnects', async () => {
143
124
  const sharedObserver = new SharedResizeObserver();
@@ -1,47 +0,0 @@
1
- import { ModalManager } from '@internetarchive/modal-manager';
2
- import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
3
- import { html, customElement, LitElement, property } from 'lit-element';
4
- import { MetadataResponse } from '@internetarchive/search-service';
5
- import {
6
- MenuProviderInterface,
7
- MenuShortcutInterface,
8
- } from '../src/interfaces/menu-interfaces';
9
- import { CustomTheaterInterface } from '../src/interfaces/custom-theater-interface';
10
- @customElement('book-navigator')
11
- export class BookNavigator
12
- extends LitElement
13
- implements CustomTheaterInterface {
14
- @property({ attribute: false }) modal?: ModalManager;
15
-
16
- @property({ type: Object }) itemMD?: MetadataResponse;
17
-
18
- @property({ type: String }) baseHost?: string;
19
-
20
- @property({ type: Boolean, reflect: true }) signedIn?: boolean | null = null;
21
-
22
- @property({ type: Boolean }) sideMenuOpen!: boolean;
23
-
24
- @property({ attribute: false }) sharedObserver?: SharedResizeObserver;
25
-
26
- @property({ type: Array }) menuProviders?: MenuProviderInterface[];
27
-
28
- @property({ type: Array }) menuShortcuts?: MenuShortcutInterface[];
29
-
30
- emitLoadingStatusUpdate() {}
31
-
32
- addMenuShortcut(menuId: string) {
33
- return menuId;
34
- }
35
-
36
- removeMenuShortcut(menuId: string) {
37
- return menuId;
38
- }
39
-
40
- sortMenuShortcuts() {}
41
-
42
- emitMenuShortcutsUpdated() {}
43
-
44
- render() {
45
- return html` <p>foo</p> `;
46
- }
47
- }