@internetarchive/ia-item-navigator 0.0.0-a7 → 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (65) hide show
  1. package/README.md +29 -19
  2. package/demo/app-root.ts +70 -41
  3. package/demo/index.html +1 -2
  4. package/dist/demo/app-root.d.ts +20 -9
  5. package/dist/demo/app-root.js +61 -36
  6. package/dist/demo/app-root.js.map +1 -1
  7. package/dist/src/interfaces/custom-theater-interface.d.ts +20 -0
  8. package/dist/src/interfaces/custom-theater-interface.js +2 -0
  9. package/dist/src/interfaces/custom-theater-interface.js.map +1 -0
  10. package/dist/src/interfaces/event-interfaces.d.ts +11 -21
  11. package/dist/src/interfaces/event-interfaces.js.map +1 -1
  12. package/dist/src/interfaces/menu-interfaces.d.ts +6 -7
  13. package/dist/src/interfaces/menu-interfaces.js.map +1 -1
  14. package/dist/src/interfaces/nav-controller-interface.d.ts +11 -6
  15. package/dist/src/interfaces/nav-controller-interface.js.map +1 -1
  16. package/dist/src/item-inspector/item-inspector.d.ts +0 -41
  17. package/dist/src/item-inspector/item-inspector.js +253 -222
  18. package/dist/src/item-inspector/item-inspector.js.map +1 -1
  19. package/dist/src/item-inspector/visual-mod-provider.d.ts +2 -0
  20. package/dist/src/item-inspector/visual-mod-provider.js +3 -0
  21. package/dist/src/item-inspector/visual-mod-provider.js.map +1 -1
  22. package/dist/src/item-navigator.d.ts +45 -30
  23. package/dist/src/item-navigator.js +113 -120
  24. package/dist/src/item-navigator.js.map +1 -1
  25. package/dist/src/loader.d.ts +5 -0
  26. package/dist/src/loader.js +8 -2
  27. package/dist/src/loader.js.map +1 -1
  28. package/dist/src/no-theater-available.d.ts +9 -0
  29. package/dist/src/no-theater-available.js +79 -0
  30. package/dist/src/no-theater-available.js.map +1 -0
  31. package/dist/test/book-nav-stub.d.ts +22 -0
  32. package/dist/test/book-nav-stub.js +49 -0
  33. package/dist/test/book-nav-stub.js.map +1 -0
  34. package/dist/test/ia-item-navigator.test.d.ts +2 -0
  35. package/dist/test/ia-item-navigator.test.js +317 -0
  36. package/dist/test/ia-item-navigator.test.js.map +1 -0
  37. package/dist/test/ia-stub-goody.d.ts +210 -0
  38. package/dist/test/ia-stub-goody.js +276 -0
  39. package/dist/test/ia-stub-goody.js.map +1 -0
  40. package/dist/test/ia-stub.d.ts +22 -0
  41. package/dist/test/ia-stub.js +35 -0
  42. package/dist/test/ia-stub.js.map +1 -0
  43. package/dist/test/no-theater-available.test.d.ts +1 -0
  44. package/dist/test/no-theater-available.test.js +27 -0
  45. package/dist/test/no-theater-available.test.js.map +1 -0
  46. package/package.json +4 -3
  47. package/src/interfaces/custom-theater-interface.ts +28 -0
  48. package/src/interfaces/event-interfaces.ts +15 -22
  49. package/src/interfaces/menu-interfaces.ts +9 -10
  50. package/src/item-navigator.ts +154 -151
  51. package/src/loader.ts +9 -2
  52. package/src/no-theater-available.ts +85 -0
  53. package/test/book-nav-stub.ts +47 -0
  54. package/test/ia-item-navigator.test.ts +438 -0
  55. package/test/ia-stub.ts +79 -0
  56. package/test/no-theater-available.test.ts +32 -0
  57. package/demo/demo-book-manifest.json +0 -1163
  58. package/src/interfaces/nav-controller-interface.ts +0 -18
  59. package/src/item-inspector/files-by-type/files-by-type-provider.ts +0 -43
  60. package/src/item-inspector/files-by-type/ia-files-by-type.ts +0 -100
  61. package/src/item-inspector/item-inspector.ts +0 -242
  62. package/src/item-inspector/share-provider.ts +0 -51
  63. package/src/item-inspector/visual-mod-provider.ts +0 -60
  64. package/src/item-navigator-js.js +0 -372
  65. package/test/your-webcomponent.test.ts +0 -40
@@ -1 +1 @@
1
- {"version":3,"file":"item-inspector.js","sourceRoot":"","sources":["../../../src/item-inspector/item-inspector.ts"],"names":[],"mappings":";AAAA,+BAA+B;AAC/B,OAAO,EACL,GAAG,EACH,IAAI,EACJ,UAAU,EACV,aAAa,EACb,QAAQ,EACR,KAAK,GACN,MAAM,aAAa,CAAC;AAUrB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,mBAAm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AA7M6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAEL;AAEM;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDAAkC;AAEjC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAAsC;AAEtC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;sDAAuC;AAEpC;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;qDAAsB;AAErB;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAyB;AAE5C;IAAR,KAAK,EAAE;kDAAuB;AAEtB;IAAR,KAAK,EAAE;+CAAyB;AAExB;IAAR,KAAK,EAAE;sDAAwC;AAnBrC,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA8M3B;SA9MY,eAAe","sourcesContent":["/* eslint-disable no-console */\nimport {\n css,\n html,\n LitElement,\n customElement,\n property,\n state,\n} from 'lit-element';\nimport { MetadataResponse } from '@internetarchive/search-service';\n\nimport { IntNavController } from '../interfaces/nav-controller-interface';\nimport {\n IntMenuProvider,\n IntMenuShortcut,\n} from '../interfaces/menu-interfaces';\nimport { IntManageFullscreenEvent } from '../interfaces/event-interfaces';\n\nimport { ShareProvider } from './share-provider';\nimport { FilesByTypeProvider } from './files-by-type/files-by-type-provider';\nimport { VisualModsProvider } from './visual-mod-provider';\n\n// eslint-disable-next-line no-shadow\nenum ItemInspectorEvents {\n menuUpdated = 'menuUpdated',\n updateSideMenu = 'updateSideMenu',\n PostInit = 'PostInit',\n ViewportInFullScreen = 'ViewportInFullScreen',\n}\n\ninterface menuProvidersInt {\n [menuId: string]: IntMenuProvider;\n}\n\n@customElement('ia-item-inspector')\nexport class IaItemInspector extends LitElement implements IntNavController {\n @property({ type: Object }) itemMD: MetadataResponse = {\n metadata: {},\n } as MetadataResponse;\n\n @property({ type: String }) baseHost = 'https://archive.org';\n\n @property({ type: Object }) menuProviders: menuProvidersInt = {};\n\n @property({ type: Array }) menuShortcuts: IntMenuShortcut[] = [];\n\n @property({ type: Boolean }) sideMenuOpen = false;\n\n @property({ type: Boolean }) fullscreenState = false;\n\n @state() fileCount: number = 0;\n\n @state() loaded: boolean = false;\n\n @state() private shortcutOrder = ['visualMods'];\n\n firstUpdated() {\n this.loaded = true;\n }\n\n updated(changed: any) {\n if (changed.has('loaded')) {\n setTimeout(() => this.emitLoadingStatusUpdate(this.loaded), 1000);\n }\n\n if (changed.has('itemMD') && this.itemMD) {\n this.parseItemInfo();\n this.setMenu();\n }\n\n if (changed.has('menuProviders') || changed.has('menuShortcuts')) {\n this.updateMenuContents();\n }\n }\n\n render() {\n const { identifier = '' } = this.itemMD?.metadata;\n return html`\n <section>\n <div>\n <h2>${identifier}</h2>\n </div>\n <img src=${this.imageUrl} alt=${`${identifier} thumbnail`} />\n <p style=\"font-size: 20px;\">\n Bacon ipsum dolor amet flank chicken leberkas sausage, meatball pork belly jowl. Chislic bacon salami frankfurter shankle drumstick andouille ball tip alcatra. Fatback beef ribs chicken, jerky ground round hamburger pork chop biltong. Shoulder short loin rump jerky kielbasa pork porchetta fatback ribeye pork belly sirloin chislic turducken corned beef tri-tip. Chuck pancetta meatball tail, spare ribs ham hock capicola pig. Ham hock hamburger chicken tri-tip venison swine burgdoggen boudin meatloaf pastrami chuck. Tri-tip spare ribs drumstick, tail rump hamburger burgdoggen swine t-bone tongue andouille chislic alcatra.\n\nPork loin jowl frankfurter, doner meatball short loin ham hock filet mignon hamburger rump turkey bresaola shoulder sirloin flank. Ribeye sausage pig t-bone bacon frankfurter cupim capicola fatback pastrami ball tip pork belly. Picanha pancetta andouille flank shankle venison tri-tip tail, kevin turkey turducken chicken. Bacon picanha swine frankfurter, prosciutto chislic doner alcatra pork loin corned beef jowl biltong meatball chuck. Bacon burgdoggen pig fatback cupim t-bone. Cow pork loin bresaola brisket shoulder filet mignon chicken. Sirloin bresaola porchetta beef capicola meatloaf brisket shankle jerky turkey pork tri-tip swine kevin salami.\n\nMeatball t-bone doner venison. Pig tri-tip chuck, shank chicken pork chop landjaeger spare ribs jerky swine ham hock buffalo sirloin. Leberkas pancetta tenderloin, meatloaf buffalo rump pastrami chuck. Jerky cupim porchetta, tenderloin chuck andouille venison pork salami. Chuck strip steak cupim, turducken ham hock kielbasa shoulder porchetta chislic short loin tri-tip biltong cow corned beef.\n </p>\n </section>\n `;\n }\n\n addMenuShortcut(menuId: keyof menuProvidersInt) {\n if (this.menuShortcuts.find(m => m.id === menuId)) {\n return;\n }\n\n const shortcut = this.menuProviders[menuId];\n this.menuShortcuts.push(shortcut);\n this.sortMenuShortcuts();\n this.emitMenuShortcutsUpdated();\n }\n\n /**\n * Removes a provider object from the menuShortcuts array and emits a\n * menuShortcutsUpdated event.\n */\n removeMenuShortcut(menuId: string) {\n this.menuShortcuts = this.menuShortcuts.filter(m => m.id !== menuId);\n this.emitMenuShortcutsUpdated();\n }\n\n /**\n * Sorts the menuShortcuts property by comparing each provider's id to\n * the id in each iteration over the shortcutOrder array.\n */\n sortMenuShortcuts() {\n this.menuShortcuts = this.shortcutOrder.reduce(\n (shortcuts: IntMenuShortcut[], id) => {\n const menu = this.menuShortcuts.find(m => m.id === id);\n\n // eslint-disable-next-line no-param-reassign\n if (menu) {\n const newShortcuts = [...shortcuts, menu];\n // eslint-disable-next-line no-param-reassign\n shortcuts = newShortcuts;\n }\n return shortcuts;\n },\n []\n );\n }\n\n emitMenuShortcutsUpdated() {\n const event = new CustomEvent('menuShortcutsUpdated', {\n detail: this.menuShortcuts,\n });\n this.dispatchEvent(event);\n }\n\n setMenu() {\n const menuProviders = {\n share: new ShareProvider({\n item: this.itemMD,\n baseHost: this.baseHost,\n subPrefix: '',\n }),\n filesByType: new FilesByTypeProvider({\n item: this.itemMD,\n baseHost: this.baseHost,\n subPrefix: '',\n }),\n visualMods: new VisualModsProvider({\n updated: (modType: string) => {\n if (modType === 'toggleFullscreen') {\n this.updateFullscreenState();\n }\n },\n item: this.itemMD,\n baseHost: this.baseHost,\n subPrefix: '',\n // maybe DOM root for class configs?\n }),\n };\n\n this.menuProviders = menuProviders;\n this.addMenuShortcut('visualMods');\n }\n\n updateFullscreenState() {\n const isFullScreen = !this.fullscreenState;\n this.fullscreenState = isFullScreen;\n\n const event = new CustomEvent('ViewportInFullScreen', {\n detail: { isFullScreen },\n } as IntManageFullscreenEvent);\n this.dispatchEvent(event);\n }\n\n updateMenuContents() {\n const { share, filesByType, visualMods } = this.menuProviders;\n const availableMenus = [filesByType, share, visualMods].filter(\n menu => !!menu\n );\n\n const event = new CustomEvent(ItemInspectorEvents.menuUpdated, {\n detail: availableMenus,\n });\n\n this.dispatchEvent(event);\n }\n\n emitLoadingStatusUpdate(loaded: boolean) {\n const event = new CustomEvent('loadingStateUpdated', {\n detail: { loaded },\n });\n this.dispatchEvent(event);\n }\n\n parseItemInfo() {\n this.fileCount = this.itemMD?.files?.length || 0;\n }\n\n get imageUrl() {\n const { metadata = {} } = this.itemMD;\n const url = `${this.baseHost}/download/${metadata?.identifier}/__ia_thumb.jpg`;\n return url;\n }\n\n static get styles() {\n const main = css`\n :host {\n display: block;\n width: 100%;\n margin: 0 auto;\n position: relative;\n overflow: auto;\n background-color: black;\n color: var(--primaryTextColor, #fff);\n }\n\n :host,\n section {\n min-height: inherit;\n height: inherit;\n }\n\n section {\n margin: auto;\n width: 100%;\n text-align: center;\n }\n\n img {\n border: 1px solid var(--primaryTextColor, #fff);\n }\n `;\n return [main];\n }\n}\n"]}
1
+ {"version":3,"file":"item-inspector.js","sourceRoot":"","sources":["../../../src/item-inspector/item-inspector.ts"],"names":[],"mappings":";AAAA,kCAAkC;AAClC,WAAW;AACX,SAAS;AACT,UAAU;AACV,gBAAgB;AAChB,mBAAmB;AACnB,cAAc;AACd,WAAW;AACX,wBAAwB;AACxB,sEAAsE;AAEtE,WAAW;AACX,2BAA2B;AAC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AmC;AACnC,yBAAyB;AACzB,+CAA+C;AAC/C,YAAY;AACZ,SAAS;AAET,0CAA0C;AAC1C,0CAA0C;AAC1C,MAAM;AAEN,8BAA8B;AAC9B,kDAAkD;AAClD,2CAA2C;AAE3C,8DAA8D;AAC9D,kCAAkC;AAClC,sCAAsC;AACtC,iCAAiC;AACjC,MAAM;AAEN,2BAA2B;AAC3B,qEAAqE;AACrE,sEAAsE;AACtE,uBAAuB;AACvB,SAAS;AAET,uEAAuE;AACvE,gCAAgC;AAChC,UAAU;AAEV,iCAAiC;AACjC,MAAM;AAEN,+CAA+C;AAC/C,6DAA6D;AAC7D,4BAA4B;AAC5B,UAAU;AACV,iCAAiC;AACjC,MAAM;AAEN,sBAAsB;AACtB,wDAAwD;AACxD,MAAM;AAEN,qBAAqB;AACrB,6CAA6C;AAC7C,sFAAsF;AACtF,kBAAkB;AAClB,MAAM;AAEN,0BAA0B;AAC1B,wBAAwB;AACxB,gBAAgB;AAChB,0BAA0B;AAC1B,uBAAuB;AACvB,0BAA0B;AAC1B,8BAA8B;AAC9B,0BAA0B;AAC1B,mCAAmC;AACnC,gDAAgD;AAChD,UAAU;AAEV,eAAe;AACf,kBAAkB;AAClB,+BAA+B;AAC/B,2BAA2B;AAC3B,UAAU;AAEV,kBAAkB;AAClB,wBAAwB;AACxB,uBAAuB;AACvB,8BAA8B;AAC9B,UAAU;AAEV,cAAc;AACd,2DAA2D;AAC3D,UAAU;AACV,SAAS;AACT,qBAAqB;AACrB,MAAM;AACN,IAAI","sourcesContent":["// /* eslint-disable no-console */\n// import {\n// css,\n// html,\n// LitElement,\n// customElement,\n// property,\n// state,\n// } from 'lit-element';\n// import { MetadataResponse } from '@internetarchive/search-service';\n\n// import {\n// ModalManagerInterface,\n// ModalConfig,\n// } from '@internetarchive/modal-manager';\n// import { SharedResizeObserverInterface } from '@internetarchive/shared-resize-observer';\n// import { IntNavController } from '../interfaces/nav-controller-interface';\n// import {\n// IntMenuProvider,\n// IntMenuShortcut,\n// } from '../interfaces/menu-interfaces';\n// import { IntManageFullscreenEvent } from '../interfaces/event-interfaces';\n\n// import { ShareProvider } from './share-provider';\n// import { FilesByTypeProvider } from './files-by-type/files-by-type-provider';\n// import { VisualModsProvider } from './visual-mod-provider';\n\n// // eslint-disable-next-line no-shadow\n// enum ItemInspectorEvents {\n// menuUpdated = 'menuUpdated',\n// updateSideMenu = 'updateSideMenu',\n// PostInit = 'PostInit',\n// ViewportInFullScreen = 'ViewportInFullScreen',\n// }\n\n// interface menuProvidersInt {\n// [menuId: string]: IntMenuProvider;\n// }\n\n// @customElement('ia-item-inspector')\n// export class IaItemInspector extends LitElement implements IntNavController {\n// @property({ type: Object }) itemMD: MetadataResponse = {\n// metadata: {},\n// } as MetadataResponse;\n\n// @property({ type: String }) baseHost = 'https://archive.org';\n\n// @property({ type: Object }) menuProviders: menuProvidersInt = {};\n\n// @property({ type: Array }) menuShortcuts: IntMenuShortcut[] = [];\n\n// @property({ type: Boolean }) sideMenuOpen = false;\n\n// @property({ type: Boolean }) fullscreenState = false;\n\n// @property({ attribute: false }) modal!: ModalManagerInterface;\n\n// @property({ attribute: false }) sharedRO!: SharedResizeObserverInterface;\n\n// @state() fileCount: number = 0;\n\n// @state() loaded: boolean = false;\n\n// @state() private shortcutOrder = ['visualMods'];\n\n// firstUpdated() {\n// this.loaded = true;\n// console.log('modal', this.modal);\n// }\n\n// updated(changed: any) {\n// if (changed.has('loaded')) {\n// setTimeout(() => this.emitLoadingStatusUpdate(this.loaded), 1000);\n// }\n\n// if (changed.has('itemMD') && this.itemMD) {\n// this.parseItemInfo();\n// this.setMenu();\n// }\n\n// if (changed.has('menuProviders') || changed.has('menuShortcuts')) {\n// this.updateMenuContents();\n// }\n// }\n\n// modalClosedCallback() {\n// console.log('item-inspector, modal closed');\n// }\n\n// openModal() {\n// const config = new ModalConfig();\n// const customModalContent = html`\n// Can contain any markup, including web components. Event listeners also\n// work. Try clicking on the picture.\n// <div style=\"text-align: center\">\n// <a href=\"https://fillmurray.com\" style=\"display: block\">Fill Murray</a>\n// <img src=\"100x100.jpg\" alt=\"foo\" />\n// </div>\n// `;\n\n// this.modal.showModal({\n// config,\n// customModalContent,\n// userClosedModalCallback: this.modalClosedCallback,\n// });\n// }\n\n// render() {\n// const { identifier = '' } = this.itemMD?.metadata;\n// return html`\n// <section>\n// <div>\n// <h2>${identifier}</h2>\n// </div>\n// <img src=${this.imageUrl} alt=${`${identifier} thumbnail`} />\n// <button @click=${() => this.openModal()}>open modal</button>\n// <p style=\"font-size: 20px;\">\n// Bacon ipsum dolor amet flank chicken leberkas sausage, meatball pork\n// belly jowl. Chislic bacon salami frankfurter shankle drumstick\n// andouille ball tip alcatra. Fatback beef ribs chicken, jerky ground\n// round hamburger pork chop biltong. Shoulder short loin rump jerky\n// kielbasa pork porchetta fatback ribeye pork belly sirloin chislic\n// turducken corned beef tri-tip. Chuck pancetta meatball tail, spare\n// ribs ham hock capicola pig. Ham hock hamburger chicken tri-tip venison\n// swine burgdoggen boudin meatloaf pastrami chuck. Tri-tip spare ribs\n// drumstick, tail rump hamburger burgdoggen swine t-bone tongue\n// andouille chislic alcatra. Pork loin jowl frankfurter, doner meatball\n// short loin ham hock filet mignon hamburger rump turkey bresaola\n// shoulder sirloin flank. Ribeye sausage pig t-bone bacon frankfurter\n// cupim capicola fatback pastrami ball tip pork belly. Picanha pancetta\n// andouille flank shankle venison tri-tip tail, kevin turkey turducken\n// chicken. Bacon picanha swine frankfurter, prosciutto chislic doner\n// alcatra pork loin corned beef jowl biltong meatball chuck. Bacon\n// burgdoggen pig fatback cupim t-bone. Cow pork loin bresaola brisket\n// shoulder filet mignon chicken. Sirloin bresaola porchetta beef\n// capicola meatloaf brisket shankle jerky turkey pork tri-tip swine\n// kevin salami. Meatball t-bone doner venison. Pig tri-tip chuck, shank\n// chicken pork chop landjaeger spare ribs jerky swine ham hock buffalo\n// sirloin. Leberkas pancetta tenderloin, meatloaf buffalo rump pastrami\n// chuck. Jerky cupim porchetta, tenderloin chuck andouille venison pork\n// salami. Chuck strip steak cupim, turducken ham hock kielbasa shoulder\n// porchetta chislic short loin tri-tip biltong cow corned beef.\n// </p>\n// </section>\n// `;\n// }\n\n// addMenuShortcut(menuId: keyof menuProvidersInt) {\n// if (this.menuShortcuts.find(m => m.id === menuId)) {\n// return;\n// }\n\n// const shortcut = this.menuProviders[menuId];\n// this.menuShortcuts.push(shortcut);\n// this.sortMenuShortcuts();\n// this.emitMenuShortcutsUpdated();\n// }\n\n// /**\n// * Removes a provider object from the menuShortcuts array and emits a\n// * menuShortcutsUpdated event.\n// */\n// removeMenuShortcut(menuId: string) {\n// this.menuShortcuts = this.menuShortcuts.filter(m => m.id !== menuId);\n// this.emitMenuShortcutsUpdated();\n// }\n\n// /**\n// * Sorts the menuShortcuts property by comparing each provider's id to\n// * the id in each iteration over the shortcutOrder array.\n// */\n// sortMenuShortcuts() {\n// this.menuShortcuts = this.shortcutOrder.reduce(\n// (shortcuts: IntMenuShortcut[], id) => {\n// const menu = this.menuShortcuts.find(m => m.id === id);\n\n// // eslint-disable-next-line no-param-reassign\n// if (menu) {\n// const newShortcuts = [...shortcuts, menu];\n// // eslint-disable-next-line no-param-reassign\n// shortcuts = newShortcuts;\n// }\n// return shortcuts;\n// },\n// []\n// );\n// }\n\n// emitMenuShortcutsUpdated() {\n// const event = new CustomEvent('menuShortcutsUpdated', {\n// detail: this.menuShortcuts,\n// });\n// this.dispatchEvent(event);\n// }\n\n// setMenu() {\n// const menuProviders = {\n// share: new ShareProvider({\n// item: this.itemMD,\n// baseHost: this.baseHost,\n// subPrefix: '',\n// }),\n// filesByType: new FilesByTypeProvider({\n// item: this.itemMD,\n// baseHost: this.baseHost,\n// subPrefix: '',\n// }),\n// visualMods: new VisualModsProvider({\n// updated: (modType: string) => {\n// if (modType === 'toggleFullscreen') {\n// this.updateFullscreenState();\n// }\n// },\n// item: this.itemMD,\n// baseHost: this.baseHost,\n// subPrefix: '',\n// // maybe DOM root for class configs?\n// }),\n// };\n\n// this.menuProviders = menuProviders;\n// this.addMenuShortcut('visualMods');\n// }\n\n// updateFullscreenState() {\n// const isFullScreen = !this.fullscreenState;\n// this.fullscreenState = isFullScreen;\n\n// const event = new CustomEvent('ViewportInFullScreen', {\n// detail: { isFullScreen },\n// } as IntManageFullscreenEvent);\n// this.dispatchEvent(event);\n// }\n\n// updateMenuContents() {\n// const { share, filesByType, visualMods } = this.menuProviders;\n// const availableMenus = [filesByType, share, visualMods].filter(\n// menu => !!menu\n// );\n\n// const event = new CustomEvent(ItemInspectorEvents.menuUpdated, {\n// detail: availableMenus,\n// });\n\n// this.dispatchEvent(event);\n// }\n\n// emitLoadingStatusUpdate(loaded: boolean) {\n// const event = new CustomEvent('loadingStateUpdated', {\n// detail: { loaded },\n// });\n// this.dispatchEvent(event);\n// }\n\n// parseItemInfo() {\n// this.fileCount = this.itemMD?.files?.length || 0;\n// }\n\n// get imageUrl() {\n// const { metadata = {} } = this.itemMD;\n// const url = `${this.baseHost}/download/${metadata?.identifier}/__ia_thumb.jpg`;\n// return url;\n// }\n\n// static get styles() {\n// const main = css`\n// :host {\n// display: block;\n// width: 100%;\n// margin: 0 auto;\n// position: relative;\n// overflow: auto;\n// background-color: black;\n// color: var(--primaryTextColor, #fff);\n// }\n\n// :host,\n// section {\n// min-height: inherit;\n// height: inherit;\n// }\n\n// section {\n// margin: auto;\n// width: 100%;\n// text-align: center;\n// }\n\n// img {\n// border: 1px solid var(--primaryTextColor, #fff);\n// }\n// `;\n// return [main];\n// }\n// }\n"]}
@@ -13,5 +13,7 @@ export declare class VisualModsProvider implements IntMenuProvider {
13
13
  encodedSubPrefix: string;
14
14
  updated: any;
15
15
  constructor(providerArgs: IntProviderArgs);
16
+ openModal(): void;
17
+ closeModal(): void;
16
18
  toggleFullscreen(): void;
17
19
  }
@@ -34,8 +34,11 @@ export class VisualModsProvider {
34
34
  this.updated = updated;
35
35
  this.component = html `<ia-visual-mods
36
36
  @fullscreenToggle=${() => this === null || this === void 0 ? void 0 : this.updated('toggleFullscreen')}
37
+ @openModa=${this.openModal}
37
38
  ></ia-visual-mods>`;
38
39
  }
40
+ openModal() { }
41
+ closeModal() { }
39
42
  toggleFullscreen() {
40
43
  this.updated('toggleFullscreen');
41
44
  }
@@ -1 +1 @@
1
- {"version":3,"file":"visual-mod-provider.js","sourceRoot":"","sources":["../../../src/item-inspector/visual-mod-provider.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,yCAAyC;;AAEzC,OAAO,EAAE,IAAI,EAAkB,aAAa,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9E,OAAO,qCAAqC,CAAC;AAC7C,OAAO,gEAAgE,CAAC;AAOxE,IAAM,UAAU,GAAhB,MAAM,UAAW,SAAQ,UAAU;IACjC,gBAAgB;QACd,IAAI,CAAC,aAAa,CAAC,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACpD,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;uBACQ,IAAI,CAAC,gBAAgB;eAC7B,CAAC;IACd,CAAC;CACF,CAAA;AAVK,UAAU;IADf,aAAa,CAAC,gBAAgB,CAAC;GAC1B,UAAU,CAUf;AAED,MAAM,OAAO,kBAAkB;IAqB7B,YAAY,YAA6B;QApBzC,SAAI,GAAQ,IAAI,CAAC;QAEjB,aAAQ,GAAW,qBAAqB,CAAC;QAEzC,SAAI,GAAmB,IAAI,CAAA;;gCAEG,CAAC;QAE/B,OAAE,GAAW,YAAY,CAAC;QAE1B,UAAK,GAAW,sBAAsB,CAAC;QAEvC,cAAS,GAA0B,IAAI,CAAC;QAExC,cAAS,GAAW,EAAE,CAAC;QAEvB,qBAAgB,GAAW,EAAE,CAAC;QAE9B,YAAO,GAAQ,GAAG,EAAE,GAAE,CAAC,CAAC;QAGtB,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,SAAS,GAAG,EAAE,EAAE,OAAO,EAAE,GAAG,YAAY,CAAC;QAEjE,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QAEvB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAA;0BACC,GAAG,EAAE,CAAC,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,OAAO,CAAC,kBAAkB,CAAC;uBAC1C,CAAC;IACtB,CAAC;IAED,gBAAgB;QACd,IAAI,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACnC,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable max-classes-per-file */\n\nimport { html, TemplateResult, customElement, LitElement } from 'lit-element';\n\nimport '@internetarchive/ia-sharing-options';\nimport '@internetarchive/icon-visual-adjustment/icon-visual-adjustment';\nimport {\n IntMenuProvider,\n IntProviderArgs,\n} from '../interfaces/menu-interfaces';\n\n@customElement('ia-visual-mods')\nclass VisualMods extends LitElement {\n toggleFullscreen() {\n this.dispatchEvent(new Event('fullscreenToggle'));\n }\n\n render() {\n return html`<section>\n <button @click=${this.toggleFullscreen}>Toggle Fullscreen</button>\n </section>`;\n }\n}\n\nexport class VisualModsProvider implements IntMenuProvider {\n item: any = null;\n\n baseHost: string = 'https://archive.org';\n\n icon: TemplateResult = html`<ia-icon-visual-adjustment\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-visual-adjustment>`;\n\n id: string = 'visualMods';\n\n label: string = 'Visual Modifications';\n\n component: TemplateResult | null = null;\n\n subPrefix: string = '';\n\n encodedSubPrefix: string = '';\n\n updated: any = () => {};\n\n constructor(providerArgs: IntProviderArgs) {\n const { item, baseHost, subPrefix = '', updated } = providerArgs;\n\n this.updated = updated;\n\n this.component = html`<ia-visual-mods\n @fullscreenToggle=${() => this?.updated('toggleFullscreen')}\n ></ia-visual-mods>`;\n }\n\n toggleFullscreen() {\n this.updated('toggleFullscreen');\n }\n}\n"]}
1
+ {"version":3,"file":"visual-mod-provider.js","sourceRoot":"","sources":["../../../src/item-inspector/visual-mod-provider.ts"],"names":[],"mappings":"AAAA,sDAAsD;AACtD,yCAA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AC,kBAAkB,CAAC,CAAC;IACnC,CAAC;CACF","sourcesContent":["/* eslint-disable @typescript-eslint/no-unused-vars */\n/* eslint-disable max-classes-per-file */\n\nimport { html, TemplateResult, customElement, LitElement } from 'lit-element';\n\nimport '@internetarchive/ia-sharing-options';\nimport '@internetarchive/icon-visual-adjustment/icon-visual-adjustment';\nimport {\n IntMenuProvider,\n IntProviderArgs,\n} from '../interfaces/menu-interfaces';\n\n@customElement('ia-visual-mods')\nclass VisualMods extends LitElement {\n toggleFullscreen() {\n this.dispatchEvent(new Event('fullscreenToggle'));\n }\n\n render() {\n return html`<section>\n <button @click=${this.toggleFullscreen}>Toggle Fullscreen</button>\n </section>`;\n }\n}\n\nexport class VisualModsProvider implements IntMenuProvider {\n item: any = null;\n\n baseHost: string = 'https://archive.org';\n\n icon: TemplateResult = html`<ia-icon-visual-adjustment\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-visual-adjustment>`;\n\n id: string = 'visualMods';\n\n label: string = 'Visual Modifications';\n\n component: TemplateResult | null = null;\n\n subPrefix: string = '';\n\n encodedSubPrefix: string = '';\n\n updated: any = () => {};\n\n constructor(providerArgs: IntProviderArgs) {\n const { item, baseHost, subPrefix = '', updated } = providerArgs;\n\n this.updated = updated;\n\n this.component = html`<ia-visual-mods\n @fullscreenToggle=${() => this?.updated('toggleFullscreen')}\n @openModa=${this.openModal}\n ></ia-visual-mods>`;\n }\n\n openModal() {}\n\n closeModal() {}\n\n toggleFullscreen() {\n this.updated('toggleFullscreen');\n }\n}\n"]}
@@ -1,59 +1,74 @@
1
- import { LitElement } from 'lit-element';
1
+ import { LitElement, PropertyValues, CSSResult } from 'lit-element';
2
2
  import { nothing, TemplateResult } from 'lit-html';
3
3
  import { MetadataResponse } from '@internetarchive/search-service';
4
- import { SharedResizeObserverResizeHandlerInterface } from '@internetarchive/shared-resize-observer';
5
- import { ModalManagerInterface } from '@internetarchive/modal-manager';
4
+ import { SharedResizeObserver, SharedResizeObserverResizeHandlerInterface } from '@internetarchive/shared-resize-observer';
5
+ import '@internetarchive/ia-menu-slider';
6
+ import { ModalManager } from '@internetarchive/modal-manager';
6
7
  import '@internetarchive/icon-ellipses/icon-ellipses';
7
8
  import './loader';
8
- import { IntOpenModalEvent, IntManageSideMenuEvent, IntSetOpenMenuEvent, IntSetMenuContentsEvent, IntSetMenuShortcutsEvent, IntLoadingStateUpdatedEvent, IntManageFullscreenEvent } from './interfaces/event-interfaces';
9
- import { IntMenuProvider, IntMenuShortcut } from './interfaces/menu-interfaces';
9
+ import { ToggleSideMenuOpenEvent, ToggleSidePanelOpenEvent, SetSideMenuContentsEvent, SetSideMenuShortcutsEvent, loadingStateUpdatedEvent, ManageFullscreenEvent } from './interfaces/event-interfaces';
10
+ import { MenuProviderInterface, MenuShortcutInterface, MenuId } from './interfaces/menu-interfaces';
11
+ import './no-theater-available';
12
+ export declare enum ItemType {
13
+ BOOK = "bookreader"
14
+ }
10
15
  export declare class ItemNavigator extends LitElement implements SharedResizeObserverResizeHandlerInterface {
11
- item: MetadataResponse | undefined;
12
- itemType: string;
16
+ item?: MetadataResponse;
17
+ itemType?: ItemType;
13
18
  baseHost: string;
14
19
  signedIn: boolean;
15
- menuContents: IntMenuProvider[];
16
- menuShortcuts: IntMenuShortcut[];
17
- viewportInFullscreen: boolean;
20
+ menuContents: MenuProviderInterface[];
21
+ menuShortcuts: MenuShortcutInterface[];
22
+ viewportInFullscreen: boolean | null;
18
23
  menuOpened: boolean;
19
- openMenu: string;
20
- modal: ModalManagerInterface | undefined;
21
- private sharedObserver?;
22
- private loaded;
23
- private openMenuState;
24
+ openMenu?: MenuId;
25
+ modal?: ModalManager;
26
+ sharedObserver?: SharedResizeObserver;
27
+ loaded: true | null;
28
+ openMenuState: 'overlay' | 'shift';
24
29
  private frame;
30
+ private headerSlot;
25
31
  disconnectedCallback(): void;
26
- firstUpdated(): void;
32
+ updated(changed: PropertyValues): void;
33
+ /** Shared observer */
27
34
  handleResize(entry: ResizeObserverEntry): void;
28
- private startResizeObserver;
35
+ private setResizeObserver;
36
+ private removeResizeObserver;
37
+ get resizeObserverConfig(): {
38
+ handler: SharedResizeObserverResizeHandlerInterface;
39
+ target: Element;
40
+ };
41
+ /** End shared observer */
42
+ get loaderTitle(): "" | "Internet Archive";
43
+ get readerHeightStyle(): string;
44
+ get loadingArea(): TemplateResult;
29
45
  render(): TemplateResult;
30
- get BooksViewer(): TemplateResult;
46
+ get noTheaterView(): TemplateResult;
47
+ get theaterSlot(): TemplateResult;
48
+ get booksViewer(): TemplateResult;
31
49
  get renderViewport(): TemplateResult | typeof nothing;
32
- loadingStateUpdated(e: IntLoadingStateUpdatedEvent): void;
33
- openModal(e: IntOpenModalEvent): void;
34
- closeModal(): void;
35
- /** Creates modal DOM & attaches to `<body>` */
36
- private createModal;
50
+ loadingStateUpdated(e: loadingStateUpdatedEvent): void;
37
51
  /** Fullscreen Management */
38
- manageViewportFullscreen(e: IntManageFullscreenEvent): void;
52
+ manageViewportFullscreen(e: ManageFullscreenEvent): void;
39
53
  /** End Fullscreen Management */
40
54
  /** Side menu */
41
55
  get shouldRenderMenu(): boolean;
42
56
  toggleMenu(): void;
43
57
  closeMenu(): void;
44
- setOpenMenu(e: IntSetOpenMenuEvent): void;
45
- setMenuContents(e: IntSetMenuContentsEvent): void;
46
- setMenuShortcuts(e: IntSetMenuShortcutsEvent): void;
58
+ setOpenMenu(e: ToggleSidePanelOpenEvent): void;
59
+ setMenuContents(e: SetSideMenuContentsEvent): void;
60
+ setMenuShortcuts(e: SetSideMenuShortcutsEvent): void;
47
61
  /** Toggles Side Menu & Sets viewable subpanel */
48
- manageSideMenuEvents(e: IntManageSideMenuEvent): void;
62
+ manageSideMenuEvents(e: ToggleSideMenuOpenEvent): void;
49
63
  get menuToggleButton(): TemplateResult;
64
+ get selectedMenuId(): MenuId | '';
50
65
  get renderSideMenu(): TemplateResult;
51
66
  /** End Side menu */
52
67
  /** Menu Shortcuts */
53
- openShortcut(selectedMenuId?: string): void;
68
+ openShortcut(selectedMenuId?: MenuId): void;
54
69
  get shortcuts(): TemplateResult;
55
70
  /** End Menu Shortcuts */
56
71
  /** Misc Render */
57
72
  get menuClass(): string;
58
- static get styles(): import("lit-element").CSSResult;
73
+ static get styles(): CSSResult;
59
74
  }
@@ -2,41 +2,37 @@ import { __decorate } from "tslib";
2
2
  import { css, html, LitElement, customElement, property, state, query, } from 'lit-element';
3
3
  import { nothing } from 'lit-html';
4
4
  import { MetadataResponse } from '@internetarchive/search-service';
5
- import { PromisedSingleton } from '@internetarchive/promised-singleton';
6
- import { SharedResizeObserver, } from '@internetarchive/shared-resize-observer';
7
- // @ts-ignore
8
- import { IAMenuSlider } from '@internetarchive/ia-menu-slider';
5
+ import '@internetarchive/ia-menu-slider';
9
6
  import '@internetarchive/icon-ellipses/icon-ellipses';
10
7
  import './loader';
8
+ import './no-theater-available';
9
+ export var ItemType;
10
+ (function (ItemType) {
11
+ ItemType["BOOK"] = "bookreader";
12
+ })(ItemType || (ItemType = {}));
11
13
  let ItemNavigator = class ItemNavigator extends LitElement {
12
14
  constructor() {
13
15
  super(...arguments);
14
- this.item = undefined;
15
- this.itemType = '';
16
16
  this.baseHost = 'archive.org';
17
17
  this.signedIn = false;
18
18
  this.menuContents = [];
19
19
  this.menuShortcuts = [];
20
- this.viewportInFullscreen = false;
20
+ this.viewportInFullscreen = null;
21
21
  this.menuOpened = false;
22
- this.openMenu = '';
23
- this.modal = undefined;
24
- this.loaded = false;
22
+ this.loaded = null;
25
23
  this.openMenuState = 'shift';
26
24
  }
27
25
  disconnectedCallback() {
28
- var _a;
29
- (_a = this.sharedObserver) === null || _a === void 0 ? void 0 : _a.removeObserver({
30
- handler: this,
31
- target: this.frame,
32
- });
26
+ this.removeResizeObserver();
33
27
  }
34
- firstUpdated() {
35
- if (!this.modal) {
36
- this.createModal();
28
+ updated(changed) {
29
+ if (changed.has('sharedObserver')) {
30
+ const oldObserver = changed.get('sharedObserver');
31
+ oldObserver === null || oldObserver === void 0 ? void 0 : oldObserver.removeObserver(this.resizeObserverConfig);
32
+ this.setResizeObserver();
37
33
  }
38
- this.startResizeObserver();
39
34
  }
35
+ /** Shared observer */
40
36
  handleResize(entry) {
41
37
  const { width } = entry.contentRect;
42
38
  if (width <= 600) {
@@ -45,50 +41,76 @@ let ItemNavigator = class ItemNavigator extends LitElement {
45
41
  }
46
42
  this.openMenuState = 'shift';
47
43
  }
48
- async startResizeObserver() {
44
+ setResizeObserver() {
49
45
  var _a;
50
- const ro = new PromisedSingleton({
51
- generator: async () => {
52
- return new SharedResizeObserver();
53
- },
54
- });
55
- this.sharedObserver = await ro.get();
56
- (_a = this.sharedObserver) === null || _a === void 0 ? void 0 : _a.addObserver({
46
+ (_a = this.sharedObserver) === null || _a === void 0 ? void 0 : _a.addObserver(this.resizeObserverConfig);
47
+ }
48
+ removeResizeObserver() {
49
+ var _a;
50
+ (_a = this.sharedObserver) === null || _a === void 0 ? void 0 : _a.removeObserver(this.resizeObserverConfig);
51
+ }
52
+ get resizeObserverConfig() {
53
+ return {
57
54
  handler: this,
58
55
  target: this.frame,
59
- });
56
+ };
57
+ }
58
+ /** End shared observer */
59
+ get loaderTitle() {
60
+ return this.viewportInFullscreen ? 'Internet Archive' : '';
61
+ }
62
+ 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}` : '';
66
+ }
67
+ get loadingArea() {
68
+ return html `
69
+ <div class="loading-area">
70
+ <div class="loading-view">
71
+ <ia-itemnav-loader .title=${this.loaderTitle}></ia-itemnav-loader>
72
+ </div>
73
+ </div>
74
+ `;
60
75
  }
61
76
  render() {
62
77
  const displayReaderClass = this.loaded ? '' : 'hide';
63
78
  return html `
64
- <div id="frame" class=${this.menuClass}>
65
- <slot name="item-nav-header"></slot>
79
+ <div id="frame" class=${`${this.menuClass}`}>
66
80
  <div class="menu-and-reader">
67
81
  ${this.shouldRenderMenu ? this.renderSideMenu : nothing}
68
- <div id="reader" class=${displayReaderClass}>
82
+ <slot name="theater-header"></slot>
83
+ <div
84
+ id="reader"
85
+ class=${displayReaderClass}
86
+ style=${this.readerHeightStyle}
87
+ >
69
88
  ${this.renderViewport}
70
89
  </div>
71
- <div class="loading-area">
72
- <div class="loading-view">
73
- <ia-itemnav-loader></ia-itemnav-loader>
74
- </div>
75
- </div>
90
+ ${!this.loaded ? this.loadingArea : nothing}
76
91
  </div>
77
- ${!this.loaded
78
- ? html ` <div class="loading-area">
79
- <div class="loading-view">
80
- <ia-itemnav-loader></ia-itemnav-loader>
81
- </div>
82
- </div>`
83
- : nothing}
84
92
  </div>
85
93
  `;
86
94
  }
87
- get BooksViewer() {
95
+ get noTheaterView() {
96
+ var _a, _b;
97
+ return html `<ia-no-theater-available
98
+ .identifier=${(_b = (_a = this.item) === null || _a === void 0 ? void 0 : _a.metadata) === null || _b === void 0 ? void 0 : _b.identifier}
99
+ @loadingStateUpdated=${this.loadingStateUpdated}
100
+ ></ia-no-theater-available>`;
101
+ }
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;';
88
109
  return html `
89
110
  <book-navigator
111
+ .modal=${this.modal}
90
112
  .baseHost=${this.baseHost}
91
- .book=${this.item}
113
+ .itemMD=${this.item}
92
114
  ?signedIn=${this.signedIn}
93
115
  ?sideMenuOpen=${this.menuOpened}
94
116
  .sharedObserver=${this.sharedObserver}
@@ -97,11 +119,9 @@ let ItemNavigator = class ItemNavigator extends LitElement {
97
119
  @updateSideMenu=${this.manageSideMenuEvents}
98
120
  @menuUpdated=${this.setMenuContents}
99
121
  @menuShortcutsUpdated=${this.setMenuShortcuts}
100
- @openModal=${this.openModal}
101
- @closeModal=${this.closeModal}
102
122
  >
103
- <div slot="bookreader">
104
- <slot name="bookreader"></slot>
123
+ <div slot="theater-main" style=${slotVisibility}>
124
+ ${this.theaterSlot}
105
125
  </div>
106
126
  </book-navigator>
107
127
  `;
@@ -110,52 +130,23 @@ let ItemNavigator = class ItemNavigator extends LitElement {
110
130
  if (!this.item) {
111
131
  return nothing;
112
132
  }
113
- if (this.itemType === 'bookreader') {
114
- return this.BooksViewer;
133
+ if (this.itemType === ItemType.BOOK) {
134
+ return this.booksViewer;
115
135
  }
116
- return html ` <ia-item-inspector
117
- .itemMD=${this.item}
118
- @updateSideMenu=${this.manageSideMenuEvents}
119
- @menuUpdated=${this.setMenuContents}
120
- @ViewportInFullScreen=${this.manageViewportFullscreen}
121
- @menuShortcutsUpdated=${this.setMenuShortcuts}
122
- @openModal=${this.openModal}
123
- @closeModal=${this.closeModal}
124
- @loadingStateUpdated=${this.loadingStateUpdated}
125
- ></ia-item-inspector>`;
136
+ return this.noTheaterView;
126
137
  }
127
138
  loadingStateUpdated(e) {
128
139
  const { loaded } = e.detail;
129
- this.loaded = !!loaded;
140
+ this.loaded = loaded || null;
130
141
  }
131
- /* Modal management */
132
- openModal(e) {
133
- var _a;
134
- const { config, customModalContent } = e.detail;
135
- if (!config || !customModalContent) {
136
- return;
137
- }
138
- (_a = this.modal) === null || _a === void 0 ? void 0 : _a.showModal({
139
- config,
140
- customModalContent,
141
- });
142
- }
143
- closeModal() {
144
- var _a;
145
- (_a = this.modal) === null || _a === void 0 ? void 0 : _a.closeModal();
146
- }
147
- /** Creates modal DOM & attaches to `<body>` */
148
- createModal() {
149
- this.modal = document.createElement('modal-manager');
150
- document.body.appendChild(this.modal);
151
- }
152
- /* End Modal management */
153
142
  /** Fullscreen Management */
154
143
  manageViewportFullscreen(e) {
155
- this.viewportInFullscreen = !!e.detail.isFullScreen;
156
- this.dispatchEvent(new CustomEvent('ViewportInFullScreen', {
144
+ const fullscreenStatus = !!e.detail.isFullScreen;
145
+ this.viewportInFullscreen = !fullscreenStatus ? null : fullscreenStatus;
146
+ const event = new CustomEvent('fullscreenToggled', {
157
147
  detail: e.detail,
158
- }));
148
+ });
149
+ this.dispatchEvent(event);
159
150
  }
160
151
  /** End Fullscreen Management */
161
152
  /** Side menu */
@@ -170,7 +161,7 @@ let ItemNavigator = class ItemNavigator extends LitElement {
170
161
  }
171
162
  setOpenMenu(e) {
172
163
  const { id } = e.detail;
173
- this.openMenu = id === this.openMenu ? '' : id;
164
+ this.openMenu = id !== this.openMenu ? id : undefined;
174
165
  }
175
166
  setMenuContents(e) {
176
167
  const updatedContents = [...e.detail];
@@ -182,18 +173,18 @@ let ItemNavigator = class ItemNavigator extends LitElement {
182
173
  /** Toggles Side Menu & Sets viewable subpanel */
183
174
  manageSideMenuEvents(e) {
184
175
  const { menuId, action } = e.detail;
185
- if (menuId) {
186
- if (action === 'open') {
187
- this.openShortcut(menuId);
188
- }
189
- else if (action === 'toggle') {
190
- this.openMenu = menuId;
191
- this.toggleMenu();
192
- }
176
+ if (!menuId) {
177
+ return;
178
+ }
179
+ if (action === 'open') {
180
+ this.openShortcut(menuId);
181
+ }
182
+ else if (action === 'toggle') {
183
+ this.openMenu = menuId;
184
+ this.toggleMenu();
193
185
  }
194
186
  }
195
187
  get menuToggleButton() {
196
- // <ia-icon icon="ellipses" style="width: var(--iconWidth); height: var(--iconHeight);"></ia-icon>
197
188
  return html `
198
189
  <button
199
190
  class="toggle-menu"
@@ -208,6 +199,9 @@ let ItemNavigator = class ItemNavigator extends LitElement {
208
199
  </button>
209
200
  `;
210
201
  }
202
+ get selectedMenuId() {
203
+ return this.openMenu || '';
204
+ }
211
205
  get renderSideMenu() {
212
206
  const drawerState = this.menuOpened ? '' : 'hidden';
213
207
  return html `
@@ -216,7 +210,7 @@ let ItemNavigator = class ItemNavigator extends LitElement {
216
210
  <div id="menu" class=${drawerState}>
217
211
  <ia-menu-slider
218
212
  .menus=${this.menuContents}
219
- .selectedMenu=${this.openMenu}
213
+ .selectedMenu=${this.selectedMenuId}
220
214
  @menuTypeSelected=${this.setOpenMenu}
221
215
  @menuSliderClosed=${this.closeMenu}
222
216
  manuallyHandleClose
@@ -233,11 +227,16 @@ let ItemNavigator = class ItemNavigator extends LitElement {
233
227
  this.menuOpened = true;
234
228
  }
235
229
  get shortcuts() {
236
- const shortcuts = this.menuShortcuts.map(({ icon, id }) => html `
230
+ const shortcuts = this.menuShortcuts.map(({ icon, id }) => {
231
+ if (id === 'fullscreen') {
232
+ return html `${icon}`;
233
+ }
234
+ return html `
237
235
  <button class="shortcut ${id}" @click="${() => this.openShortcut(id)}">
238
236
  ${icon}
239
237
  </button>
240
- `);
238
+ `;
239
+ });
241
240
  return html `<div class="shortcuts">${shortcuts}</div>`;
242
241
  }
243
242
  /** End Menu Shortcuts */
@@ -256,7 +255,6 @@ let ItemNavigator = class ItemNavigator extends LitElement {
256
255
  return css `
257
256
  :host,
258
257
  #frame,
259
- #reader,
260
258
  .menu-and-reader {
261
259
  min-height: inherit;
262
260
  height: inherit;
@@ -265,8 +263,14 @@ let ItemNavigator = class ItemNavigator extends LitElement {
265
263
  display: block;
266
264
  }
267
265
 
266
+ slot {
267
+ display: block;
268
+ overflow: hidden;
269
+ }
270
+
268
271
  #frame {
269
272
  background-color: ${theaterBg};
273
+ color-scheme: dark;
270
274
  }
271
275
 
272
276
  #frame.fullscreen {
@@ -278,11 +282,6 @@ let ItemNavigator = class ItemNavigator extends LitElement {
278
282
  z-index: 9;
279
283
  }
280
284
 
281
- #frame.fullscreen,
282
- #frame.fullscreen #reader {
283
- height: 100vh;
284
- }
285
-
286
285
  .loading-area {
287
286
  position: absolute;
288
287
  top: 0;
@@ -399,6 +398,7 @@ let ItemNavigator = class ItemNavigator extends LitElement {
399
398
  transition: ${transitionEffect};
400
399
  }
401
400
 
401
+ .open.shift slot[name='theater-header'],
402
402
  .open.shift #reader {
403
403
  width: calc(100% - var(--menuWidth));
404
404
  float: right;
@@ -435,22 +435,13 @@ __decorate([
435
435
  })
436
436
  ], ItemNavigator.prototype, "signedIn", void 0);
437
437
  __decorate([
438
- property({
439
- type: Array,
440
- hasChanged: (newVal, oldVal) => {
441
- if (newVal !== oldVal) {
442
- return true;
443
- }
444
- return false;
445
- },
446
- }),
447
438
  property({ type: Array })
448
439
  ], ItemNavigator.prototype, "menuContents", void 0);
449
440
  __decorate([
450
441
  property({ type: Array })
451
442
  ], ItemNavigator.prototype, "menuShortcuts", void 0);
452
443
  __decorate([
453
- property({ type: Boolean, reflect: true })
444
+ property({ type: Boolean, reflect: true, attribute: true })
454
445
  ], ItemNavigator.prototype, "viewportInFullscreen", void 0);
455
446
  __decorate([
456
447
  property({ type: Boolean })
@@ -459,13 +450,13 @@ __decorate([
459
450
  property({ type: String })
460
451
  ], ItemNavigator.prototype, "openMenu", void 0);
461
452
  __decorate([
462
- property({ type: Object })
453
+ property({ attribute: false })
463
454
  ], ItemNavigator.prototype, "modal", void 0);
464
455
  __decorate([
465
456
  property({ attribute: false })
466
457
  ], ItemNavigator.prototype, "sharedObserver", void 0);
467
458
  __decorate([
468
- state()
459
+ property({ type: Boolean, reflect: true, attribute: true })
469
460
  ], ItemNavigator.prototype, "loaded", void 0);
470
461
  __decorate([
471
462
  state()
@@ -473,9 +464,11 @@ __decorate([
473
464
  __decorate([
474
465
  query('#frame')
475
466
  ], ItemNavigator.prototype, "frame", void 0);
467
+ __decorate([
468
+ query('slot[name="theater-header"]')
469
+ ], ItemNavigator.prototype, "headerSlot", void 0);
476
470
  ItemNavigator = __decorate([
477
- customElement('item-navigator')
471
+ customElement('ia-item-navigator')
478
472
  ], ItemNavigator);
479
473
  export { ItemNavigator };
480
- customElements.define('ia-menu-slider', IAMenuSlider);
481
474
  //# sourceMappingURL=item-navigator.js.map