@internetarchive/ia-item-navigator 0.0.0-a14 → 0.0.0-a16
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/src/interfaces/custom-theater-interface.d.ts +20 -0
- package/dist/src/interfaces/custom-theater-interface.js +2 -0
- package/dist/src/interfaces/custom-theater-interface.js.map +1 -0
- package/dist/src/interfaces/event-interfaces.d.ts +9 -9
- package/dist/src/interfaces/event-interfaces.js.map +1 -1
- package/dist/src/interfaces/menu-interfaces.d.ts +4 -6
- package/dist/src/interfaces/menu-interfaces.js.map +1 -1
- package/dist/src/interfaces/nav-controller-interface.d.ts +9 -13
- package/dist/src/interfaces/nav-controller-interface.js.map +1 -1
- package/dist/src/item-navigator.d.ts +14 -13
- package/dist/src/item-navigator.js +10 -5
- package/dist/src/item-navigator.js.map +1 -1
- package/dist/test/book-nav-stub.d.ts +11 -6
- package/dist/test/book-nav-stub.js +10 -3
- package/dist/test/book-nav-stub.js.map +1 -1
- package/dist/test/ia-item-navigator.test.js +5 -9
- package/dist/test/ia-item-navigator.test.js.map +1 -1
- package/dist/test/ia-stub.d.ts +3 -3
- package/dist/test/ia-stub.js.map +1 -1
- package/package.json +1 -1
- package/src/interfaces/{nav-controller-interface.ts → custom-theater-interface.ts} +12 -15
- package/src/interfaces/event-interfaces.ts +13 -9
- package/src/interfaces/menu-interfaces.ts +7 -9
- package/src/item-navigator.ts +31 -25
- package/test/book-nav-stub.ts +20 -8
- package/test/ia-item-navigator.test.ts +19 -24
- package/test/ia-stub.ts +4 -4
@@ -0,0 +1,20 @@
|
|
1
|
+
import { LitElement } from 'lit-element';
|
2
|
+
import { MetadataResponse } from '@internetarchive/search-service';
|
3
|
+
import { ModalManager } from '@internetarchive/modal-manager';
|
4
|
+
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
5
|
+
import { MenuProviderInterface, MenuShortcutInterface } from './menu-interfaces';
|
6
|
+
export interface CustomTheaterInterface extends LitElement {
|
7
|
+
baseHost?: string;
|
8
|
+
itemMD?: MetadataResponse;
|
9
|
+
menuProviders?: MenuProviderInterface[];
|
10
|
+
menuShortcuts?: MenuShortcutInterface[];
|
11
|
+
sideMenuOpen: boolean;
|
12
|
+
signedIn?: boolean | null;
|
13
|
+
sharedObserver?: SharedResizeObserver;
|
14
|
+
modal?: ModalManager;
|
15
|
+
emitLoadingStatusUpdate: (loaded: boolean) => void;
|
16
|
+
addMenuShortcut: (menuId: string) => void;
|
17
|
+
removeMenuShortcut: (menuId: string) => void;
|
18
|
+
sortMenuShortcuts: () => void;
|
19
|
+
emitMenuShortcutsUpdated: () => void;
|
20
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"custom-theater-interface.js","sourceRoot":"","sources":["../../../src/interfaces/custom-theater-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { LitElement } from 'lit-element';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport {\n MenuProviderInterface,\n MenuShortcutInterface,\n} from './menu-interfaces';\n\nexport interface CustomTheaterInterface extends LitElement {\n baseHost?: string;\n itemMD?: MetadataResponse;\n menuProviders?: MenuProviderInterface[];\n menuShortcuts?: MenuShortcutInterface[];\n sideMenuOpen: boolean;\n\n signedIn?: boolean | null;\n\n sharedObserver?: SharedResizeObserver;\n modal?: ModalManager;\n\n emitLoadingStatusUpdate: (loaded: boolean) => void;\n\n addMenuShortcut: (menuId: string) => void;\n removeMenuShortcut: (menuId: string) => void;\n sortMenuShortcuts: () => void;\n emitMenuShortcutsUpdated: () => void;\n}\n"]}
|
@@ -1,6 +1,6 @@
|
|
1
|
-
import {
|
1
|
+
import { MenuProviderInterface, MenuShortcutInterface, MenuId } from './menu-interfaces';
|
2
2
|
/** Toggles Menu && Sets open panel */
|
3
|
-
export interface
|
3
|
+
export interface ToggleSideMenuOpenEvent extends CustomEvent {
|
4
4
|
type: 'updateSideMenu';
|
5
5
|
detail: {
|
6
6
|
menuId: MenuId | undefined | '';
|
@@ -8,31 +8,31 @@ export interface IntManageSideMenuEvent extends CustomEvent {
|
|
8
8
|
};
|
9
9
|
}
|
10
10
|
/** Sets open panel */
|
11
|
-
export interface
|
11
|
+
export interface ToggleSidePanelOpenEvent extends CustomEvent {
|
12
12
|
type: 'menuTypeSelected';
|
13
13
|
detail: {
|
14
14
|
id: MenuId | '';
|
15
15
|
};
|
16
16
|
}
|
17
17
|
/** Sets menu order that is displayed */
|
18
|
-
export interface
|
18
|
+
export interface SetSideMenuContentsEvent extends CustomEvent {
|
19
19
|
type: 'menuUpdated';
|
20
|
-
detail:
|
20
|
+
detail: MenuProviderInterface[];
|
21
21
|
}
|
22
22
|
/** Sets menu shortcuts that is displayed */
|
23
|
-
export interface
|
23
|
+
export interface SetSideMenuShortcutsEvent extends CustomEvent {
|
24
24
|
type: 'menuUpdated';
|
25
|
-
detail:
|
25
|
+
detail: MenuShortcutInterface[];
|
26
26
|
}
|
27
27
|
/** Toggles fullscreen mode */
|
28
|
-
export interface
|
28
|
+
export interface ManageFullscreenEvent extends CustomEvent {
|
29
29
|
type: 'ViewportInFullScreen';
|
30
30
|
detail: {
|
31
31
|
isFullScreen: boolean;
|
32
32
|
};
|
33
33
|
}
|
34
34
|
/** Toggles loading view */
|
35
|
-
export interface
|
35
|
+
export interface loadingStateUpdatedEvent extends CustomEvent {
|
36
36
|
type: 'loadingStateUpdated';
|
37
37
|
detail: {
|
38
38
|
loaded: boolean;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"event-interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/event-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import {
|
1
|
+
{"version":3,"file":"event-interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/event-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import {\n MenuProviderInterface,\n MenuShortcutInterface,\n MenuId,\n} from './menu-interfaces';\n\n/** Toggles Menu && Sets open panel */\nexport interface ToggleSideMenuOpenEvent extends CustomEvent {\n type: 'updateSideMenu';\n detail: {\n menuId: MenuId | undefined | '';\n action: 'open' | 'toggle' | '';\n };\n}\n\n/** Sets open panel */\nexport interface ToggleSidePanelOpenEvent extends CustomEvent {\n type: 'menuTypeSelected';\n detail: {\n id: MenuId | '';\n };\n}\n\n/** Sets menu order that is displayed */\nexport interface SetSideMenuContentsEvent extends CustomEvent {\n type: 'menuUpdated';\n detail: MenuProviderInterface[];\n}\n\n/** Sets menu shortcuts that is displayed */\nexport interface SetSideMenuShortcutsEvent extends CustomEvent {\n type: 'menuUpdated';\n detail: MenuShortcutInterface[];\n}\n\n/** Toggles fullscreen mode */\nexport interface ManageFullscreenEvent extends CustomEvent {\n type: 'ViewportInFullScreen';\n detail: {\n isFullScreen: boolean;\n };\n}\n\n/** Toggles loading view */\nexport interface loadingStateUpdatedEvent extends CustomEvent {\n type: 'loadingStateUpdated';\n detail: {\n loaded: boolean;\n };\n}\n"]}
|
@@ -1,24 +1,22 @@
|
|
1
1
|
import { TemplateResult } from 'lit-html';
|
2
2
|
import { MetadataResponse } from '@internetarchive/search-service';
|
3
3
|
export declare type MenuId = string;
|
4
|
-
export interface
|
4
|
+
export interface MenuShortcutInterface {
|
5
5
|
icon: TemplateResult;
|
6
6
|
id: MenuId;
|
7
7
|
}
|
8
|
-
export interface
|
9
|
-
icon: TemplateResult;
|
10
|
-
id: MenuId;
|
8
|
+
export interface MenuDetailsInterface extends MenuShortcutInterface {
|
11
9
|
label: string;
|
12
10
|
menuDetails?: TemplateResult;
|
13
11
|
selected?: boolean;
|
14
12
|
followable?: boolean;
|
15
13
|
href?: string;
|
16
14
|
}
|
17
|
-
export interface
|
15
|
+
export interface MenuProviderBaseConfigInterface {
|
18
16
|
item: MetadataResponse;
|
19
17
|
baseHost: string;
|
20
18
|
subPrefix: string;
|
21
19
|
updated?: any;
|
22
20
|
}
|
23
|
-
export interface
|
21
|
+
export interface MenuProviderInterface extends MenuProviderBaseConfigInterface, MenuDetailsInterface, MenuShortcutInterface {
|
24
22
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"menu-interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/menu-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult } from 'lit-html';\nimport { MetadataResponse } from '@internetarchive/search-service';\n\nexport type MenuId = string;\nexport interface
|
1
|
+
{"version":3,"file":"menu-interfaces.js","sourceRoot":"","sources":["../../../src/interfaces/menu-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult } from 'lit-html';\nimport { MetadataResponse } from '@internetarchive/search-service';\n\nexport type MenuId = string;\nexport interface MenuShortcutInterface {\n icon: TemplateResult;\n id: MenuId;\n}\n\nexport interface MenuDetailsInterface extends MenuShortcutInterface {\n label: string;\n menuDetails?: TemplateResult;\n selected?: boolean;\n followable?: boolean;\n href?: string;\n}\n\nexport interface MenuProviderBaseConfigInterface {\n item: MetadataResponse;\n baseHost: string;\n subPrefix: string;\n updated?: any;\n}\nexport interface MenuProviderInterface\n extends MenuProviderBaseConfigInterface,\n MenuDetailsInterface,\n MenuShortcutInterface {}\n"]}
|
@@ -2,23 +2,19 @@ import { LitElement } from 'lit-element';
|
|
2
2
|
import { MetadataResponse } from '@internetarchive/search-service';
|
3
3
|
import { ModalManager } from '@internetarchive/modal-manager';
|
4
4
|
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
5
|
-
import { IntMenuShortcut } from './menu-interfaces';
|
6
|
-
export interface
|
7
|
-
baseHost
|
8
|
-
itemMD
|
9
|
-
menuProviders
|
10
|
-
menuShortcuts
|
5
|
+
import { IntMenuProvider, IntMenuShortcut } from './menu-interfaces';
|
6
|
+
export interface CustomTheaterInterface extends LitElement {
|
7
|
+
baseHost?: string;
|
8
|
+
itemMD?: MetadataResponse;
|
9
|
+
menuProviders?: IntMenuProvider[];
|
10
|
+
menuShortcuts?: IntMenuShortcut[];
|
11
11
|
sideMenuOpen: boolean;
|
12
|
-
signedIn
|
13
|
-
sharedObserver
|
14
|
-
modal
|
12
|
+
signedIn?: boolean | null;
|
13
|
+
sharedObserver?: SharedResizeObserver;
|
14
|
+
modal?: ModalManager;
|
15
15
|
emitLoadingStatusUpdate: (loaded: boolean) => void;
|
16
16
|
addMenuShortcut: (menuId: string) => void;
|
17
17
|
removeMenuShortcut: (menuId: string) => void;
|
18
18
|
sortMenuShortcuts: () => void;
|
19
19
|
emitMenuShortcutsUpdated: () => void;
|
20
|
-
book: MetadataResponse;
|
21
|
-
}
|
22
|
-
export interface BookNavigator extends IntNavController {
|
23
|
-
book: MetadataResponse;
|
24
20
|
}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"nav-controller-interface.js","sourceRoot":"","sources":["../../../src/interfaces/nav-controller-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { LitElement } from 'lit-element';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { IntMenuShortcut } from './menu-interfaces';\n\nexport interface
|
1
|
+
{"version":3,"file":"nav-controller-interface.js","sourceRoot":"","sources":["../../../src/interfaces/nav-controller-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { LitElement } from 'lit-element';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { IntMenuProvider, IntMenuShortcut } from './menu-interfaces';\n\nexport interface CustomTheaterInterface extends LitElement {\n baseHost?: string;\n itemMD?: MetadataResponse;\n menuProviders?: IntMenuProvider[];\n menuShortcuts?: IntMenuShortcut[];\n sideMenuOpen: boolean;\n\n signedIn?: boolean | null;\n\n sharedObserver?: SharedResizeObserver;\n modal?: ModalManager;\n\n emitLoadingStatusUpdate: (loaded: boolean) => void;\n\n addMenuShortcut: (menuId: string) => void;\n removeMenuShortcut: (menuId: string) => void;\n sortMenuShortcuts: () => void;\n emitMenuShortcutsUpdated: () => void;\n}\n"]}
|
@@ -3,11 +3,11 @@ import { nothing, TemplateResult } from 'lit-html';
|
|
3
3
|
import { MetadataResponse } from '@internetarchive/search-service';
|
4
4
|
import { SharedResizeObserver, SharedResizeObserverResizeHandlerInterface } from '@internetarchive/shared-resize-observer';
|
5
5
|
import '@internetarchive/ia-menu-slider';
|
6
|
-
import {
|
6
|
+
import { ModalManager } from '@internetarchive/modal-manager';
|
7
7
|
import '@internetarchive/icon-ellipses/icon-ellipses';
|
8
8
|
import './loader';
|
9
|
-
import {
|
10
|
-
import {
|
9
|
+
import { ToggleSideMenuOpenEvent, ToggleSidePanelOpenEvent, SetSideMenuContentsEvent, SetSideMenuShortcutsEvent, loadingStateUpdatedEvent, ManageFullscreenEvent } from './interfaces/event-interfaces';
|
10
|
+
import { MenuProviderInterface, MenuShortcutInterface, MenuId } from './interfaces/menu-interfaces';
|
11
11
|
import './no-theater-available';
|
12
12
|
export declare enum ItemType {
|
13
13
|
BOOK = "bookreader"
|
@@ -17,12 +17,12 @@ export declare class ItemNavigator extends LitElement implements SharedResizeObs
|
|
17
17
|
itemType?: ItemType;
|
18
18
|
baseHost: string;
|
19
19
|
signedIn: boolean;
|
20
|
-
menuContents:
|
21
|
-
menuShortcuts:
|
20
|
+
menuContents: MenuProviderInterface[];
|
21
|
+
menuShortcuts: MenuShortcutInterface[];
|
22
22
|
viewportInFullscreen: boolean | null;
|
23
23
|
menuOpened: boolean;
|
24
|
-
openMenu
|
25
|
-
modal?:
|
24
|
+
openMenu?: MenuId;
|
25
|
+
modal?: ModalManager;
|
26
26
|
sharedObserver?: SharedResizeObserver;
|
27
27
|
loaded: true | null;
|
28
28
|
openMenuState: 'overlay' | 'shift';
|
@@ -47,20 +47,21 @@ export declare class ItemNavigator extends LitElement implements SharedResizeObs
|
|
47
47
|
get theaterSlot(): TemplateResult;
|
48
48
|
get booksViewer(): TemplateResult;
|
49
49
|
get renderViewport(): TemplateResult | typeof nothing;
|
50
|
-
loadingStateUpdated(e:
|
50
|
+
loadingStateUpdated(e: loadingStateUpdatedEvent): void;
|
51
51
|
/** Fullscreen Management */
|
52
|
-
manageViewportFullscreen(e:
|
52
|
+
manageViewportFullscreen(e: ManageFullscreenEvent): void;
|
53
53
|
/** End Fullscreen Management */
|
54
54
|
/** Side menu */
|
55
55
|
get shouldRenderMenu(): boolean;
|
56
56
|
toggleMenu(): void;
|
57
57
|
closeMenu(): void;
|
58
|
-
setOpenMenu(e:
|
59
|
-
setMenuContents(e:
|
60
|
-
setMenuShortcuts(e:
|
58
|
+
setOpenMenu(e: ToggleSidePanelOpenEvent): void;
|
59
|
+
setMenuContents(e: SetSideMenuContentsEvent): void;
|
60
|
+
setMenuShortcuts(e: SetSideMenuShortcutsEvent): void;
|
61
61
|
/** Toggles Side Menu & Sets viewable subpanel */
|
62
|
-
manageSideMenuEvents(e:
|
62
|
+
manageSideMenuEvents(e: ToggleSideMenuOpenEvent): void;
|
63
63
|
get menuToggleButton(): TemplateResult;
|
64
|
+
get selectedMenuId(): MenuId | '';
|
64
65
|
get renderSideMenu(): TemplateResult;
|
65
66
|
/** End Side menu */
|
66
67
|
/** Menu Shortcuts */
|
@@ -19,7 +19,6 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
19
19
|
this.menuShortcuts = [];
|
20
20
|
this.viewportInFullscreen = null;
|
21
21
|
this.menuOpened = false;
|
22
|
-
this.openMenu = '';
|
23
22
|
this.loaded = null;
|
24
23
|
this.openMenuState = 'shift';
|
25
24
|
}
|
@@ -28,6 +27,8 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
28
27
|
}
|
29
28
|
updated(changed) {
|
30
29
|
if (changed.has('sharedObserver')) {
|
30
|
+
const oldObserver = changed.get('sharedObserver');
|
31
|
+
oldObserver === null || oldObserver === void 0 ? void 0 : oldObserver.removeObserver(this.resizeObserverConfig);
|
31
32
|
this.setResizeObserver();
|
32
33
|
}
|
33
34
|
}
|
@@ -42,7 +43,6 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
42
43
|
}
|
43
44
|
setResizeObserver() {
|
44
45
|
var _a;
|
45
|
-
this.removeResizeObserver();
|
46
46
|
(_a = this.sharedObserver) === null || _a === void 0 ? void 0 : _a.addObserver(this.resizeObserverConfig);
|
47
47
|
}
|
48
48
|
removeResizeObserver() {
|
@@ -75,6 +75,8 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
75
75
|
}
|
76
76
|
render() {
|
77
77
|
const displayReaderClass = this.loaded ? '' : 'hide';
|
78
|
+
console.log('render selectedMenuId', this.selectedMenuId);
|
79
|
+
console.log('render openMenu', this.openMenu);
|
78
80
|
return html `
|
79
81
|
<div id="frame" class=${`${this.menuClass}`}>
|
80
82
|
<div class="menu-and-reader">
|
@@ -110,7 +112,7 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
110
112
|
<book-navigator
|
111
113
|
.modal=${this.modal}
|
112
114
|
.baseHost=${this.baseHost}
|
113
|
-
.
|
115
|
+
.itemMD=${this.item}
|
114
116
|
?signedIn=${this.signedIn}
|
115
117
|
?sideMenuOpen=${this.menuOpened}
|
116
118
|
.sharedObserver=${this.sharedObserver}
|
@@ -161,7 +163,7 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
161
163
|
}
|
162
164
|
setOpenMenu(e) {
|
163
165
|
const { id } = e.detail;
|
164
|
-
this.openMenu = id
|
166
|
+
this.openMenu = id !== this.openMenu ? id : undefined;
|
165
167
|
}
|
166
168
|
setMenuContents(e) {
|
167
169
|
const updatedContents = [...e.detail];
|
@@ -199,6 +201,9 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
199
201
|
</button>
|
200
202
|
`;
|
201
203
|
}
|
204
|
+
get selectedMenuId() {
|
205
|
+
return this.openMenu || '';
|
206
|
+
}
|
202
207
|
get renderSideMenu() {
|
203
208
|
const drawerState = this.menuOpened ? '' : 'hidden';
|
204
209
|
return html `
|
@@ -207,7 +212,7 @@ let ItemNavigator = class ItemNavigator extends LitElement {
|
|
207
212
|
<div id="menu" class=${drawerState}>
|
208
213
|
<ia-menu-slider
|
209
214
|
.menus=${this.menuContents}
|
210
|
-
.selectedMenu=${this.
|
215
|
+
.selectedMenu=${this.selectedMenuId}
|
211
216
|
@menuTypeSelected=${this.setOpenMenu}
|
212
217
|
@menuSliderClosed=${this.closeMenu}
|
213
218
|
manuallyHandleClose
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"item-navigator.js","sourceRoot":"","sources":["../../src/item-navigator.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,aAAa,EACb,QAAQ,EACR,KAAK,EACL,KAAK,GAGN,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,OAAO,EAAkB,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAKnE,OAAO,iCAAiC,CAAC;AAGzC,OAAO,8CAA8C,CAAC;AACtD,OAAO,UAAU,CAAC;AAgBlB,OAAO,wBAAwB,CAAC;AAEhC,MAAM,CAAN,IAAY,QAEX;AAFD,WAAY,QAAQ;IAClB,+BAAmB,CAAA;AACrB,CAAC,EAFW,QAAQ,KAAR,QAAQ,QAEnB;AAED,IAAa,aAAa,GAA1B,MAAa,aACX,SAAQ,UAAU;IADpB;;QAgB8B,aAAQ,GAAG,aAAa,CAAC;QAUrD,aAAQ,GAAG,KAAK,CAAC;QAEU,iBAAY,GAAsB,EAAE,CAAC;QAErC,kBAAa,GAAsB,EAAE,CAAC;QAGjE,yBAAoB,GAAmB,IAAI,CAAC;QAEf,eAAU,GAAG,KAAK,CAAC;QAEpB,aAAQ,GAAgB,EAAE,CAAC;QAMM,WAAM,GAExD,IAAI,CAAC;QAEP,kBAAa,GAAwB,OAAO,CAAC;IAmaxD,CAAC;IA7ZC,oBAAoB;QAClB,IAAI,CAAC,oBAAoB,EAAE,CAAC;IAC9B,CAAC;IAED,OAAO,CAAC,OAAuB;QAC7B,IAAI,O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vB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAA+B;AAE9B;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDAAuC;AAET;IAA5D,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;6CAE5C;AAEP;IAAR,KAAK,EAAE;oDAA8C;AAErC;IAAhB,KAAK,CAAC,QAAQ,CAAC;4CAAgC;AAEV;IAArC,KAAK,CAAC,6BAA6B,CAAC;iDAAqC;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 { ModalManagerInterface } from '@internetarchive/modal-manager';\nimport '@internetarchive/icon-ellipses/icon-ellipses';\nimport './loader';\n\nimport {\n IntManageSideMenuEvent,\n IntSetOpenMenuEvent,\n IntSetMenuContentsEvent,\n IntSetMenuShortcutsEvent,\n IntLoadingStateUpdatedEvent,\n IntManageFullscreenEvent,\n} from './interfaces/event-interfaces';\n\nimport {\n IntMenuProvider,\n IntMenuShortcut,\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: IntMenuProvider[] = [];\n\n @property({ type: Array }) menuShortcuts: IntMenuShortcut[] = [];\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?: ModalManagerInterface;\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 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.removeResizeObserver();\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 ? '' : 'hide';\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 .book=${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: IntLoadingStateUpdatedEvent): void {\n const { loaded } = e.detail;\n this.loaded = loaded || null;\n }\n\n /** Fullscreen Management */\n manageViewportFullscreen(e: IntManageFullscreenEvent): 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 IntManageFullscreenEvent;\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: IntSetOpenMenuEvent): void {\n const { id } = e.detail;\n this.openMenu = id === this.openMenu ? '' : id;\n }\n\n setMenuContents(e: IntSetMenuContentsEvent): void {\n const updatedContents = [...e.detail];\n this.menuContents = updatedContents;\n }\n\n setMenuShortcuts(e: IntSetMenuShortcutsEvent) {\n this.menuShortcuts = [...e.detail];\n }\n\n /** Toggles Side Menu & Sets viewable subpanel */\n manageSideMenuEvents(e: IntManageSideMenuEvent): 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 renderSideMenu(): TemplateResult {\n const drawerState = this.menuOpened ? '' : 'hidden';\n\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.openMenu}\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 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-area {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n height: inherit;\n min-height: inherit;\n }\n\n .loading-view {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: inherit;\n height: inherit;\n }\n\n ia-itemnav-loader {\n display: block;\n width: 100%;\n }\n\n .hidden {\n height: 1px;\n width: 1px;\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,E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AAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;6CAE5C;AAEP;IAAR,KAAK,EAAE;oDAA8C;AAErC;IAAhB,KAAK,CAAC,QAAQ,CAAC;4CAAgC;AAEV;IAArC,KAAK,CAAC,6BAA6B,CAAC;iDAAqC;AAnD/D,aAAa;IADzB,aAAa,CAAC,mBAAmB,CAAC;GACtB,aAAa,CAwdzB;SAxdY,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 ? '' : 'hide';\n console.log('render selectedMenuId', this.selectedMenuId);\n console.log('render openMenu', this.openMenu);\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 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-area {\n position: absolute;\n top: 0;\n left: 0;\n right: 0;\n bottom: 0;\n height: inherit;\n min-height: inherit;\n }\n\n .loading-view {\n display: flex;\n align-items: center;\n justify-content: center;\n min-height: inherit;\n height: inherit;\n }\n\n ia-itemnav-loader {\n display: block;\n width: 100%;\n }\n\n .hidden {\n height: 1px;\n width: 1px;\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,14 +1,19 @@
|
|
1
|
-
import {
|
2
|
-
import { MetadataResponse } from '@internetarchive/search-service';
|
1
|
+
import { ModalManager } from '@internetarchive/modal-manager';
|
3
2
|
import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
|
4
3
|
import { LitElement } from 'lit-element';
|
5
|
-
|
6
|
-
|
4
|
+
import { MetadataResponse } from '@internetarchive/search-service';
|
5
|
+
import { MenuProviderInterface, MenuShortcutInterface } from '../src/interfaces/menu-interfaces';
|
6
|
+
import { CustomTheaterInterface } from '../src/interfaces/custom-theater-interface';
|
7
|
+
export declare class BookNavigator extends LitElement implements CustomTheaterInterface {
|
8
|
+
modal?: ModalManager;
|
9
|
+
itemMD?: MetadataResponse;
|
7
10
|
baseHost?: string;
|
8
|
-
book?: MetadataResponse;
|
9
11
|
signedIn?: boolean | null;
|
10
|
-
sideMenuOpen
|
12
|
+
sideMenuOpen: boolean;
|
11
13
|
sharedObserver?: SharedResizeObserver;
|
14
|
+
menuProviders?: MenuProviderInterface[];
|
15
|
+
menuShortcuts?: MenuShortcutInterface[];
|
16
|
+
emitLoadingStatusUpdate(): void;
|
12
17
|
addMenuShortcut(menuId: string): string;
|
13
18
|
removeMenuShortcut(menuId: string): string;
|
14
19
|
sortMenuShortcuts(): void;
|
@@ -5,6 +5,7 @@ let BookNavigator = class BookNavigator extends LitElement {
|
|
5
5
|
super(...arguments);
|
6
6
|
this.signedIn = null;
|
7
7
|
}
|
8
|
+
emitLoadingStatusUpdate() { }
|
8
9
|
addMenuShortcut(menuId) {
|
9
10
|
return menuId;
|
10
11
|
}
|
@@ -20,12 +21,12 @@ let BookNavigator = class BookNavigator extends LitElement {
|
|
20
21
|
__decorate([
|
21
22
|
property({ attribute: false })
|
22
23
|
], BookNavigator.prototype, "modal", void 0);
|
24
|
+
__decorate([
|
25
|
+
property({ type: Object })
|
26
|
+
], BookNavigator.prototype, "itemMD", void 0);
|
23
27
|
__decorate([
|
24
28
|
property({ type: String })
|
25
29
|
], BookNavigator.prototype, "baseHost", void 0);
|
26
|
-
__decorate([
|
27
|
-
property({ type: Object })
|
28
|
-
], BookNavigator.prototype, "book", void 0);
|
29
30
|
__decorate([
|
30
31
|
property({ type: Boolean, reflect: true })
|
31
32
|
], BookNavigator.prototype, "signedIn", void 0);
|
@@ -35,6 +36,12 @@ __decorate([
|
|
35
36
|
__decorate([
|
36
37
|
property({ attribute: false })
|
37
38
|
], BookNavigator.prototype, "sharedObserver", void 0);
|
39
|
+
__decorate([
|
40
|
+
property({ type: Array })
|
41
|
+
], BookNavigator.prototype, "menuProviders", void 0);
|
42
|
+
__decorate([
|
43
|
+
property({ type: Array })
|
44
|
+
], BookNavigator.prototype, "menuShortcuts", void 0);
|
38
45
|
BookNavigator = __decorate([
|
39
46
|
customElement('book-navigator')
|
40
47
|
], BookNavigator);
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"book-nav-stub.js","sourceRoot":"","sources":["../../test/book-nav-stub.ts"],"names":[],"mappings":";
|
1
|
+
{"version":3,"file":"book-nav-stub.js","sourceRoot":"","sources":["../../test/book-nav-stub.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQxE,IAAa,aAAa,GAA1B,MAAa,aACX,SAAQ,UAAU;IADpB;;QAS8C,aAAQ,GAAoB,IAAI,CAAC;IA2B/E,CAAC;IAjBC,uBAAuB,KAAI,CAAC;IAE5B,eAAe,CAAC,MAAc;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,kBAAkB,CAAC,MAAc;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,iBAAiB,KAAI,CAAC;IAEtB,wBAAwB,KAAI,CAAC;IAE7B,MAAM;QACJ,OAAO,IAAI,CAAA,cAAc,CAAC;IAC5B,CAAC;CACF,CAAA;AAjCiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAsB;AAEzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAA2B;AAE1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAmB;AAEF;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkC;AAEhD;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAwB;AAEpB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDAAuC;AAE3C;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAyC;AAExC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAyC;AAjBxD,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAoCzB;SApCY,aAAa","sourcesContent":["import { ModalManager } from '@internetarchive/modal-manager';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { html, customElement, LitElement, property } from 'lit-element';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport {\n MenuProviderInterface,\n MenuShortcutInterface,\n} from '../src/interfaces/menu-interfaces';\nimport { CustomTheaterInterface } from '../src/interfaces/custom-theater-interface';\n@customElement('book-navigator')\nexport class BookNavigator\n extends LitElement\n implements CustomTheaterInterface {\n @property({ attribute: false }) modal?: ModalManager;\n\n @property({ type: Object }) itemMD?: MetadataResponse;\n\n @property({ type: String }) baseHost?: string;\n\n @property({ type: Boolean, reflect: true }) signedIn?: boolean | null = null;\n\n @property({ type: Boolean }) sideMenuOpen!: boolean;\n\n @property({ attribute: false }) sharedObserver?: SharedResizeObserver;\n\n @property({ type: Array }) menuProviders?: MenuProviderInterface[];\n\n @property({ type: Array }) menuShortcuts?: MenuShortcutInterface[];\n\n emitLoadingStatusUpdate() {}\n\n addMenuShortcut(menuId: string) {\n return menuId;\n }\n\n removeMenuShortcut(menuId: string) {\n return menuId;\n }\n\n sortMenuShortcuts() {}\n\n emitMenuShortcutsUpdated() {}\n\n render() {\n return html` <p>foo</p> `;\n }\n}\n"]}
|
@@ -36,7 +36,6 @@ describe('ItemNavigator', () => {
|
|
36
36
|
expect(bookNavigator).to.exist;
|
37
37
|
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.modal).to.exist;
|
38
38
|
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.baseHost).to.exist;
|
39
|
-
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.book).to.exist;
|
40
39
|
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.signedIn).to.be.null;
|
41
40
|
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.sharedObserver).to.exist;
|
42
41
|
expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.sideMenuOpen).to.exist;
|
@@ -94,12 +93,9 @@ describe('ItemNavigator', () => {
|
|
94
93
|
it('freshly registers handler', async () => {
|
95
94
|
const sharedObserver = new SharedResizeObserver();
|
96
95
|
const addObserverSpy = Sinon.spy(sharedObserver, 'addObserver');
|
97
|
-
const removeObserverSpy = Sinon.spy(sharedObserver, 'removeObserver');
|
98
96
|
await fixture(html `<ia-item-navigator
|
99
97
|
.sharedObserver=${sharedObserver}
|
100
98
|
></ia-item-navigator>`);
|
101
|
-
// always calls to remove first, for posterity
|
102
|
-
expect(removeObserverSpy.callCount).to.equal(1);
|
103
99
|
expect(addObserverSpy.callCount).to.equal(1);
|
104
100
|
});
|
105
101
|
it('removes handler when component disconnects', async () => {
|
@@ -108,11 +104,9 @@ describe('ItemNavigator', () => {
|
|
108
104
|
const el = await fixture(html `<ia-item-navigator
|
109
105
|
.sharedObserver=${sharedObserver}
|
110
106
|
></ia-item-navigator>`);
|
111
|
-
// called during setup `setResizeObserver`
|
112
|
-
expect(removeObserverSpy.callCount).to.equal(1);
|
113
107
|
el.disconnectedCallback();
|
114
108
|
await el.updateComplete;
|
115
|
-
expect(removeObserverSpy.callCount).to.equal(
|
109
|
+
expect(removeObserverSpy.callCount).to.equal(1);
|
116
110
|
});
|
117
111
|
it('sets menu to overlay if container width is <= 600px', async () => {
|
118
112
|
const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
|
@@ -199,7 +193,7 @@ describe('ItemNavigator', () => {
|
|
199
193
|
// default menu open behavior is to side menu open, not overlay
|
200
194
|
expect(frame === null || frame === void 0 ? void 0 : frame.getAttribute('class')).to.contain('shift');
|
201
195
|
expect(el.menuOpened).to.be.false;
|
202
|
-
expect(el.openMenu).to.be.
|
196
|
+
expect(el.openMenu).to.be.undefined;
|
203
197
|
expect(frame === null || frame === void 0 ? void 0 : frame.getAttribute('class')).to.not.contain('open');
|
204
198
|
const event = new CustomEvent('updateSideMenu', {
|
205
199
|
detail,
|
@@ -300,12 +294,14 @@ describe('ItemNavigator', () => {
|
|
300
294
|
});
|
301
295
|
await el.updateComplete;
|
302
296
|
expect(el.openMenu).to.equal('foo');
|
297
|
+
expect(el.selectedMenuId).to.equal('foo');
|
303
298
|
// toggles it off
|
304
299
|
el.setOpenMenu({
|
305
300
|
detail: { id: 'foo' },
|
306
301
|
});
|
307
302
|
await el.updateComplete;
|
308
|
-
expect(el.openMenu).to.
|
303
|
+
expect(el.openMenu).to.be.undefined;
|
304
|
+
expect(el.selectedMenuId).to.equal('');
|
309
305
|
});
|
310
306
|
it('`el.closeMenu`', async () => {
|
311
307
|
const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
|