@internetarchive/ia-item-navigator 1.1.1 → 2.0.0-alpha2
Sign up to get free protection for your applications and to get access to all the features.
- package/demo/app-root.ts +190 -28
- package/dist/demo/app-root.d.ts +7 -3
- package/dist/demo/app-root.js +158 -22
- package/dist/demo/app-root.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +6 -1
- package/dist/index.js.map +1 -1
- package/dist/src/{item-navigator.js → iaux-item-navigator.js} +3 -10
- package/dist/src/iaux-item-navigator.js.map +1 -0
- package/dist/src/menus/iaux-sharing-options.d.ts +28 -0
- package/dist/src/menus/iaux-sharing-options.js +277 -0
- package/dist/src/menus/iaux-sharing-options.js.map +1 -0
- package/dist/src/menus/iaux-viewable-files.d.ts +32 -0
- package/dist/src/menus/iaux-viewable-files.js +367 -0
- package/dist/src/menus/iaux-viewable-files.js.map +1 -0
- package/dist/src/menus/share-providers/email.d.ts +11 -0
- package/dist/src/menus/share-providers/email.js +15 -0
- package/dist/src/menus/share-providers/email.js.map +1 -0
- package/dist/src/menus/share-providers/facebook.d.ts +11 -0
- package/dist/src/menus/share-providers/facebook.js +15 -0
- package/dist/src/menus/share-providers/facebook.js.map +1 -0
- package/dist/src/menus/share-providers/pinterest.d.ts +11 -0
- package/dist/src/menus/share-providers/pinterest.js +15 -0
- package/dist/src/menus/share-providers/pinterest.js.map +1 -0
- package/dist/src/menus/share-providers/provider.d.ts +20 -0
- package/dist/src/menus/share-providers/provider.js +37 -0
- package/dist/src/menus/share-providers/provider.js.map +1 -0
- package/dist/src/menus/share-providers/share-provider-interface.d.ts +13 -0
- package/dist/src/menus/share-providers/share-provider-interface.js +2 -0
- package/dist/src/menus/share-providers/share-provider-interface.js.map +1 -0
- package/dist/src/menus/share-providers/tumblr.d.ts +11 -0
- package/dist/src/menus/share-providers/tumblr.js +15 -0
- package/dist/src/menus/share-providers/tumblr.js.map +1 -0
- package/dist/src/menus/share-providers/twitter.d.ts +11 -0
- package/dist/src/menus/share-providers/twitter.js +15 -0
- package/dist/src/menus/share-providers/twitter.js.map +1 -0
- package/dist/test/iaux-item-navigator.test.d.ts +1 -0
- package/dist/test/{ia-item-navigator.test.js → iaux-item-navigator.test.js} +49 -27
- package/dist/test/iaux-item-navigator.test.js.map +1 -0
- package/dist/test/iaux-sharing-options.test.d.ts +1 -0
- package/dist/test/iaux-sharing-options.test.js +64 -0
- package/dist/test/iaux-sharing-options.test.js.map +1 -0
- package/index.ts +10 -1
- package/package.json +11 -4
- package/src/{item-navigator.ts → iaux-item-navigator.ts} +2 -10
- package/src/menus/foo.json +84 -0
- package/src/menus/iaux-sharing-options.ts +281 -0
- package/src/menus/iaux-viewable-files.ts +377 -0
- package/src/menus/share-providers/email.ts +23 -0
- package/src/menus/share-providers/facebook.ts +23 -0
- package/src/menus/share-providers/pinterest.ts +23 -0
- package/src/menus/share-providers/provider.ts +63 -0
- package/src/menus/share-providers/share-provider-interface.ts +17 -0
- package/src/menus/share-providers/tumblr.ts +23 -0
- package/src/menus/share-providers/twitter.ts +23 -0
- package/test/ia-sharing-options.test.js +78 -0
- package/test/{iaux-item-navigator.test.txt → iaux-item-navigator.test.ts} +46 -24
- package/dist/src/item-navigator.js.map +0 -1
- package/dist/test/ia-item-navigator.test.d.ts +0 -1
- package/dist/test/ia-item-navigator.test.js.map +0 -1
- package/test/ia-item-navigator.test.ts +0 -417
- /package/dist/src/{item-navigator.d.ts → iaux-item-navigator.d.ts} +0 -0
- /package/test/{iaux-sharing-options.test.txt → iaux-sharing-options.test.ts} +0 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"app-root.js","sourceRoot":"","sources":["../../demo/app-root.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAEL,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC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,SAAS,EAAE,IAAI,EAAE,CAAC;mDAE7B;AAEoB;IAAnC,KAAK,CAAC,mBAAmB,CAAC;wCAAiC;AAEpC;IAAvB,KAAK,CAAC,eAAe,CAAC;yCAAyB;AAhCrC,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAqUnB","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport { html, css, LitElement, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport {\n MetadataResponse,\n SearchService,\n} from '@internetarchive/search-service';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/modal-manager';\nimport { ItemNavigator } from '../src/item-navigator';\nimport '../src/item-navigator';\nimport {\n MenuShortcutInterface,\n MenuProviderInterface,\n} from '../src/interfaces/menu-interfaces';\n\n@customElement('app-root')\nexport class AppRoot extends LitElement {\n /**\n * Example controller to connect to `<ia-item-navigator>`\n */\n @property({ type: Object }) itemMD?: MetadataResponse;\n\n @property({ type: String }) encodedManifest = '';\n\n @property({ attribute: false }) sharedObserver = new SharedResizeObserver();\n\n @property({ type: Array, attribute: false })\n menuContents: MenuProviderInterface[] = [];\n\n @property({ type: Array, attribute: false })\n menuShortcuts: MenuShortcutInterface[] = [];\n\n @property({ reflect: true, attribute: true }) fullscreen: boolean | null =\n null;\n\n @property({ reflect: true, attribute: true }) headerOn: true | null = null;\n\n @property({ reflect: true, attribute: true }) loaded: true | null = true;\n\n @property({ reflect: true, attribute: true }) showPlaceholder: true | null =\n null;\n\n @property({ reflect: true, attribute: true }) showTheaterExample:\n | true\n | null = true;\n\n @query('ia-item-navigator') private itemNav!: ItemNavigator;\n\n @query('modal-manager') modalMgr!: ModalManager;\n\n firstUpdated() {\n this.fetchItemMD();\n console.log(\n '<app-root> component has loaded',\n this.modalMgr,\n this.sharedObserver,\n );\n\n this.itemNav.viewAvailable = false;\n }\n\n updated(changed: any) {\n console.log('changed', changed);\n if (changed.has('itemMD')) {\n this.fullscreenCheck();\n }\n }\n\n async fetchItemMD() {\n const searchService = SearchService.default;\n const mdResponse = await searchService.fetchMetadata('ux-team-books');\n\n if (mdResponse.error) {\n console.log('MD Fetch error: ', mdResponse.error);\n (window as any).confirm(\n 'There was an error fetching response, please check dev console',\n );\n return;\n }\n\n console.log('mdResponse.success', JSON.stringify(mdResponse.success));\n this.itemMD = mdResponse.success;\n }\n\n get theaterReady(): boolean {\n return this.modalMgr && this.sharedObserver && !!this.itemMD;\n }\n\n get urlParams(): URLSearchParams {\n return new URLSearchParams(location.search.slice(1));\n }\n\n /** Fullscreen */\n get showFullscreen(): boolean {\n return this.urlParams.get('view') === 'theater';\n }\n\n /** sets url query param `view=theater` to toggle fullscreen */\n toggleFS(): void {\n if (this.urlParams.get('view')) {\n location.search = '';\n } else {\n location.search = 'view=theater';\n }\n }\n\n /** toggles attr: `<ia-item-navigator viewportinfullscreen>` */\n fullscreenCheck(): void {\n if (this.showFullscreen && this.itemNav) {\n this.fullscreen = true;\n }\n }\n /** End fullscreen */\n\n toggleHeader() {\n this.headerOn = this.headerOn ? null : true;\n }\n\n toggleLoader() {\n const nextState = this.loaded === true ? null : true;\n this.loaded = nextState;\n }\n\n togglePlaceholder() {\n this.toggleLoader();\n const show = this.showPlaceholder ? null : true;\n this.showPlaceholder = show;\n }\n\n toggleImmersion() {\n const nextState = this.fullscreen ? null : true;\n if (!nextState) {\n this.menuShortcuts = [];\n return;\n }\n this.menuShortcuts = [\n {\n icon: html`<button\n @click=${() => {\n this.fullscreen = null;\n this.menuContents = [];\n this.menuShortcuts = [];\n }}\n >\n Exit\n </button>`,\n id: 'exit',\n },\n ];\n this.menuContents = [\n {\n icon: html`<button\n @click=${() => {\n this.fullscreen = null;\n }}\n >\n Exit\n </button>`,\n id: 'exit',\n label: 'Exit',\n selected: false,\n },\n ] as any as MenuProviderInterface[];\n\n this.fullscreen = nextState;\n }\n\n toggleTheaterExample() {\n if (this.showTheaterExample) {\n // turn on placeholder\n this.showPlaceholder = true;\n // turn off example\n this.showTheaterExample = null;\n\n this.menuContents = [];\n this.menuShortcuts = [];\n return;\n }\n\n // turn off placeholder\n this.showPlaceholder = null;\n this.showTheaterExample = true;\n\n const x = {\n icon: html`<p style=\"color: red\">Allo</p>`,\n id: 'a',\n label: 'Hello world',\n menuDetails: html`<h3>Wheee!</h3>`,\n } as any;\n this.menuContents = [x];\n this.menuShortcuts = [x];\n }\n\n /** Views */\n get theaterExample(): TemplateResult {\n return html`\n <div slot=\"main\">\n <div class=\"theater-example\">\n <img\n alt=\"cat theater\"\n src=\"https://archive.org/download/encyclopediaofca0000poll_t2e2/__ia_thumb.jpg\"\n />\n <h3>Welcome to Cat Theater</h3>\n </div>\n </div>\n `;\n }\n\n get headerExample(): TemplateResult {\n return html`\n <div slot=\"header\">\n <div class=\"embed-link\">\n <img\n src=\"https://archive.org/images/glogo-jw.png\"\n alt=\"glowing ia logo\"\n />\n <a href=\"/details/goody\">\n The history of Little Goody Two-Shoes : otherwise called Mrs.\n Margery Two-Shoes ... [1766 edition]\n </a>\n </div>\n </div>\n `;\n }\n\n get isViewAvailable(): boolean {\n if (this.showTheaterExample) {\n return true;\n }\n return false;\n }\n\n render(): TemplateResult {\n const {\n isViewAvailable,\n loaded,\n showPlaceholder,\n headerOn,\n fullscreen,\n menuContents,\n menuShortcuts,\n showTheaterExample,\n } = this;\n console.log('&&&& item nav properties', {\n loaded,\n headerOn,\n isViewAvailable,\n showTheaterExample,\n showPlaceholder,\n fullscreen,\n menuContents,\n menuShortcuts,\n });\n return html`\n <h1>theater, in page</h1>\n <section>\n <ia-item-navigator\n baseHost=\"https://archive.org\"\n .item=${this.itemMD}\n .modal=${this.modalMgr}\n .sharedObserver=${this.sharedObserver}\n .loaded=${this.loaded}\n ?viewAvailable=${!!this.showTheaterExample}\n .menuContents=${this.menuContents}\n .menuShortcuts=${this.menuShortcuts}\n .viewportInFullscreen=${this.fullscreen}\n >\n ${this.headerOn ? this.headerExample : ''}\n ${this.showTheaterExample ? this.theaterExample : ''}\n </ia-item-navigator>\n </section>\n <div>\n <button @click=${this.toggleHeader}>toggle header</button>\n <button @click=${this.toggleLoader}>toggle loader</button>\n <button @click=${this.togglePlaceholder}>toggle placeholder</button>\n <button @click=${this.toggleTheaterExample}>toggle new theater</button>\n <button @click=${this.toggleImmersion}>toggle immersion</button>\n </div>\n <modal-manager></modal-manager>\n `;\n }\n\n static styles = css`\n :host([fullscreen]),\n :host([fullscreen]) section {\n height: 100vh;\n width: 100vw;\n }\n\n :host([fullscreen]) h1 {\n display: none;\n }\n\n h1 {\n color: black;\n }\n\n section {\n border: 1px solid pink;\n color: #222;\n height: calc(100vh - 200px);\n }\n\n :host,\n ia-item-navigator {\n display: block;\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .embed-link {\n height: 55px;\n border: 1px solid yellow;\n }\n\n .theater-example {\n color: white;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n margin: 10px;\n border: 5px dotted yellow;\n flex: 1;\n }\n\n div[slot='main'] {\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n\n div[slot='main'] > * {\n flex: 1;\n }\n\n modal-manager[mode='closed'] {\n display: none;\n }\n `;\n}\n"]}
|
1
|
+
{"version":3,"file":"app-root.js","sourceRoot":"","sources":["../../demo/app-root.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,UAAU,EAAkB,MAAM,KAAK,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAEL,aAAa,GACd,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAE/E,OAAO,gCAAgC,CAAC;AAExC,OAAO,4BAA4B,CAAC;AACpC,OAAO,mCAAmC,CAAC;AAK3C,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC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ADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;8CACA;AAEiB;IAA5D,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;2CAE5C;AAE6C;IAA5D,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yCAE5C;AAE6C;IAA5D,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;uCAE5C;AAE6C;IAA5D,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;gDAE5C;AAGhB;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDACrB;AAEZ;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;kDAAqC;AAEzB;IAArC,KAAK,CAAC,qBAAqB,CAAC;wCAAiC;AAEtC;IAAvB,KAAK,CAAC,eAAe,CAAC;yCAAyB;AAvCrC,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CA6XnB","sourcesContent":["/* eslint-disable no-restricted-globals */\nimport { html, css, LitElement, TemplateResult } from 'lit';\nimport { customElement, property, query } from 'lit/decorators.js';\nimport {\n MetadataResponse,\n SearchService,\n} from '@internetarchive/search-service';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/modal-manager';\nimport type { ItemNavigator } from '../src/iaux-item-navigator';\nimport '../src/iaux-item-navigator';\nimport '../src/menus/iaux-sharing-options';\nimport {\n MenuShortcutInterface,\n MenuProviderInterface,\n} from '../src/interfaces/menu-interfaces';\nimport { iauxShareIcon } from '../src/menus/iaux-sharing-options';\nimport { viewableFilesIcon } from '../src/menus/iaux-viewable-files';\n\nconst fileList = [\n {\n url_path: '/details/masterbookofamericanfolksong00shep',\n file_subprefix: '01-The Master Book of American Folk Song',\n title: 'The Master Book of American Folk Song',\n file_source: '/01-The Master Book of American Folk Song_jp2.zip',\n orig_sort: 0,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/02-Encyclopedia%20of%20the%20Traditional%20Music%20and%20Folk%20Songs%20of%20the%20United%20States%20Index%20A%20through%20M',\n file_subprefix:\n '02-Encyclopedia of the Traditional Music and Folk Songs of the United States Index A through M',\n title:\n 'Encyclopedia of the Traditional Music and Folk Songs of the United States Index A through M',\n file_source:\n '/02-Encyclopedia of the Traditional Music and Folk Songs of the United States Index A through M_jp2.zip',\n orig_sort: 1,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/03-Encyclopedia%20of%20the%20Traditional%20Music%20and%20Folk%20Songs%20of%20the%20United%20States%20Index%20N%20through%20Z',\n file_subprefix:\n '03-Encyclopedia of the Traditional Music and Folk Songs of the United States Index N through Z',\n title:\n 'Encyclopedia of the Traditional Music and Folk Songs of the United States Index N through Z',\n file_source:\n '/03-Encyclopedia of the Traditional Music and Folk Songs of the United States Index N through Z_jp2.zip',\n orig_sort: 2,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/04-Letters%20to%20Riley%20Shepard',\n file_subprefix: '04-Letters to Riley Shepard',\n title: 'Letters to Riley Shepard',\n file_source: '/04-Letters to Riley Shepard_jp2.zip',\n orig_sort: 3,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%201',\n file_subprefix: 'Master Book of American Folk Song Vol. 1',\n title: 'Master Book of American Folk Song Vol. 1.pdf',\n file_source: '/Master Book of American Folk Song Vol. 1_jp2.zip',\n orig_sort: 4,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%202',\n file_subprefix: 'Master Book of American Folk Song Vol. 2',\n title: 'Master Book of American Folk Song Vol. 2.pdf',\n file_source: '/Master Book of American Folk Song Vol. 2_jp2.zip',\n orig_sort: 5,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%203',\n file_subprefix: 'Master Book of American Folk Song Vol. 3',\n title: 'Master Book of American Folk Song Vol. 3.pdf',\n file_source: '/Master Book of American Folk Song Vol. 3_jp2.zip',\n orig_sort: 6,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%204',\n file_subprefix: 'Master Book of American Folk Song Vol. 4',\n title: 'Master Book of American Folk Song Vol. 4.pdf',\n file_source: '/Master Book of American Folk Song Vol. 4_jp2.zip',\n orig_sort: 7,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%205',\n file_subprefix: 'Master Book of American Folk Song Vol. 5',\n title: 'Master Book of American Folk Song Vol. 5',\n file_source: '/Master Book of American Folk Song Vol. 5_jp2.zip',\n orig_sort: 8,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%206',\n file_subprefix: 'Master Book of American Folk Song Vol. 6',\n title: 'Master Book of American Folk Song Vol. 6.pdf',\n file_source: '/Master Book of American Folk Song Vol. 6_jp2.zip',\n orig_sort: 9,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%207',\n file_subprefix: 'Master Book of American Folk Song Vol. 7',\n title: 'Master Book of American Folk Song Vol. 7.pdf',\n file_source: '/Master Book of American Folk Song Vol. 7_jp2.zip',\n orig_sort: 10,\n },\n {\n url_path:\n '/details/masterbookofamericanfolksong00shep/Master%20Book%20of%20American%20Folk%20Song%20Vol.%208',\n file_subprefix: 'Master Book of American Folk Song Vol. 8',\n title: 'Master Book of American Folk Song Vol. 8.pdf',\n file_source: '/Master Book of American Folk Song Vol. 8_jp2.zip',\n orig_sort: 11,\n },\n];\n@customElement('app-root')\nexport class AppRoot extends LitElement {\n /**\n * Example controller to connect to `<iaux-item-navigator>`\n */\n @property({ type: Object }) itemMD?: MetadataResponse;\n\n @property({ type: String }) encodedManifest = '';\n\n @property({ attribute: false }) sharedObserver = new SharedResizeObserver();\n\n @property({ type: Array, attribute: false })\n menuContents: MenuProviderInterface[] = [];\n\n @property({ type: Array, attribute: false })\n menuShortcuts: MenuShortcutInterface[] = [];\n\n @property({ reflect: true, attribute: true, type: Boolean }) fullscreen:\n | boolean\n | null = null;\n\n @property({ reflect: true, attribute: true, type: Boolean }) headerOn:\n | true\n | null = null;\n\n @property({ reflect: true, attribute: true, type: Boolean }) loaded:\n | true\n | null = null;\n\n @property({ reflect: true, attribute: true, type: Boolean }) showPlaceholder:\n | true\n | null = null;\n\n @property({ reflect: true, attribute: true, type: Boolean })\n showTheaterExample: true | null = null;\n\n @property({ type: Array }) fileListToDisplay: any[] = fileList;\n\n @query('iaux-item-navigator') private itemNav!: ItemNavigator;\n\n @query('modal-manager') modalMgr!: ModalManager;\n\n firstUpdated() {\n this.fetchItemMD();\n console.log(\n '<app-root> component has loaded',\n this.modalMgr,\n this.sharedObserver,\n );\n\n this.itemNav.viewAvailable = false;\n }\n\n updated(changed: any) {\n console.log('changed', changed);\n if (changed.has('itemMD')) {\n this.fullscreenCheck();\n }\n\n if (changed.has('fileList')) {\n this.drawMenus();\n }\n }\n\n async fetchItemMD() {\n const searchService = SearchService.default;\n\n // masterbookofamericanfolksong00shep => multiple files\n // ux-team-books => item\n const mdResponse = await searchService.fetchMetadata(\n 'masterbookofamericanfolksong00shep',\n );\n\n if (mdResponse.error) {\n console.log('MD Fetch error: ', mdResponse.error);\n (window as any).confirm(\n 'There was an error fetching response, please check dev console',\n );\n return;\n }\n\n console.log('mdResponse.success', JSON.stringify(mdResponse.success));\n this.itemMD = mdResponse.success;\n this.toggleTheaterExample();\n }\n\n get theaterReady(): boolean {\n return this.modalMgr && this.sharedObserver && !!this.itemMD;\n }\n\n get urlParams(): URLSearchParams {\n return new URLSearchParams(location.search.slice(1));\n }\n\n /** Fullscreen */\n get showFullscreen(): boolean {\n return this.urlParams.get('view') === 'theater';\n }\n\n /** sets url query param `view=theater` to toggle fullscreen */\n toggleFS(): void {\n if (this.urlParams.get('view')) {\n location.search = '';\n } else {\n location.search = 'view=theater';\n }\n }\n\n /** toggles attr: `<iaux-item-navigator viewportinfullscreen>` */\n fullscreenCheck(): void {\n if (this.showFullscreen && this.itemNav) {\n this.fullscreen = true;\n }\n }\n /** End fullscreen */\n\n toggleHeader() {\n this.headerOn = this.headerOn ? null : true;\n }\n\n toggleLoader() {\n const nextState = this.loaded === true ? null : true;\n this.loaded = nextState;\n }\n\n togglePlaceholder() {\n this.toggleLoader();\n const show = this.showPlaceholder ? null : true;\n this.showPlaceholder = show;\n }\n\n toggleImmersion() {\n const nextState = this.fullscreen ? null : true;\n if (!nextState) {\n this.menuShortcuts = [];\n return;\n }\n this.menuShortcuts = [\n {\n icon: html`<button\n @click=${() => {\n this.fullscreen = null;\n this.menuContents = [];\n this.menuShortcuts = [];\n }}\n >\n Exit\n </button>`,\n id: 'exit',\n },\n ];\n this.menuContents = [\n {\n icon: html`<button\n @click=${() => {\n this.fullscreen = null;\n }}\n >\n Exit\n </button>`,\n id: 'exit',\n label: 'Exit',\n selected: false,\n },\n ] as any as MenuProviderInterface[];\n\n this.fullscreen = nextState;\n }\n\n toggleTheaterExample() {\n if (this.showTheaterExample) {\n // turn on placeholder\n this.showPlaceholder = true;\n // turn off example\n this.showTheaterExample = null;\n\n this.menuContents = [];\n this.menuShortcuts = [];\n return;\n }\n\n // turn off placeholder\n this.showPlaceholder = null;\n this.showTheaterExample = true;\n this.drawMenus();\n }\n\n drawMenus() {\n const shareMenu = {\n icon: iauxShareIcon,\n label: 'Share this item',\n id: 'share',\n component: html`<iaux-sharing-options\n .identifier=${this.itemMD?.metadata.identifier || 'ux-team-books'}\n .type=${`book`}\n .creator=${`UX Team`}\n .description=${'list of test books'}\n .baseHost=${'archive.org'}\n .fileSubPrefix=${''}\n ></iaux-sharing-options>`,\n } as unknown as MenuProviderInterface;\n\n const filesNewArr = [...fileList];\n const viewableFilesMenu = {\n id: 'viewable-files',\n icon: viewableFilesIcon,\n label: `Viewable Files (${fileList.length})`,\n baseHost: 'archive.org',\n item: this.itemMD as MetadataResponse,\n subPrefix: '',\n // sorter\n actionButton: html`<iaux-sort-viewable-files\n @fileListSorted=${(e: CustomEvent) => this.sortFilesCallback(e)}\n .fileListRaw=${fileList}\n ></iaux-sort-viewable-files>`,\n component: html`<iaux-viewable-files\n .fileList=${filesNewArr}\n ></iaux-viewable-files> `,\n };\n\n this.menuContents = [viewableFilesMenu, shareMenu];\n this.menuShortcuts = [viewableFilesMenu, shareMenu];\n }\n\n async sortFilesCallback(e: CustomEvent) {\n const { sortType, sortedFiles } = e.detail;\n this.fileListToDisplay = sortedFiles;\n console.log('fileListSorted', { sortType, sortedFiles });\n await this.updateComplete;\n console.log('fileListSortedasyncd', { sortType, sortedFiles });\n this.drawMenus();\n // debugger;\n }\n\n /** Views */\n get theaterExample(): TemplateResult {\n return html`\n <div slot=\"main\">\n <div class=\"theater-example\">\n <img\n alt=\"cat theater\"\n src=\"https://archive.org/download/masterbookofamericanfolksong00shep/__ia_thumb.jpg\"\n />\n <h3>Welcome to Cat Theater</h3>\n </div>\n </div>\n `;\n }\n\n get headerExample(): TemplateResult {\n return html`\n <div slot=\"header\">\n <div class=\"embed-link\">\n <img\n src=\"https://archive.org/images/glogo-jw.png\"\n alt=\"glowing ia logo\"\n />\n <a href=\"/details/goody\">\n The history of Little Goody Two-Shoes : otherwise called Mrs.\n Margery Two-Shoes ... [1766 edition]\n </a>\n </div>\n </div>\n `;\n }\n\n get isViewAvailable(): boolean {\n if (this.showTheaterExample) {\n return true;\n }\n return false;\n }\n\n render(): TemplateResult {\n const {\n isViewAvailable,\n loaded,\n showPlaceholder,\n headerOn,\n fullscreen,\n menuContents,\n menuShortcuts,\n showTheaterExample,\n } = this;\n console.log('&&&& item nav properties', {\n loaded,\n headerOn,\n isViewAvailable,\n showTheaterExample,\n showPlaceholder,\n fullscreen,\n menuContents,\n menuShortcuts,\n });\n return html`\n <h1>theater, in page</h1>\n <section>\n <iaux-item-navigator\n baseHost=\"https://archive.org\"\n .item=${this.itemMD}\n .modal=${this.modalMgr}\n .sharedObserver=${this.sharedObserver}\n .loaded=${this.loaded}\n ?viewAvailable=${!!this.showTheaterExample}\n .menuContents=${this.menuContents}\n .menuShortcuts=${this.menuShortcuts}\n .viewportInFullscreen=${this.fullscreen}\n >\n ${this.headerOn ? this.headerExample : ''}\n ${this.showTheaterExample ? this.theaterExample : ''}\n </iaux-item-navigator>\n </section>\n <div>\n <button @click=${this.toggleHeader}>toggle header</button>\n <button @click=${this.toggleLoader}>toggle loader</button>\n <button @click=${this.togglePlaceholder}>toggle placeholder</button>\n <button @click=${this.toggleTheaterExample}>toggle new theater</button>\n <button @click=${this.toggleImmersion}>toggle immersion</button>\n </div>\n <modal-manager></modal-manager>\n `;\n }\n\n static styles = css`\n :host([fullscreen]),\n :host([fullscreen]) section {\n height: 100vh;\n width: 100vw;\n }\n\n :host([fullscreen]) h1 {\n display: none;\n }\n\n h1 {\n color: black;\n }\n\n section {\n border: 1px solid pink;\n color: #222;\n height: calc(100vh - 200px);\n }\n\n :host,\n iaux-item-navigator {\n display: block;\n position: relative;\n width: 100%;\n height: 100%;\n }\n\n .embed-link {\n height: 55px;\n border: 1px solid yellow;\n }\n\n .theater-example {\n color: white;\n display: flex;\n justify-content: center;\n align-items: center;\n flex-direction: column;\n margin: 10px;\n border: 5px dotted yellow;\n flex: 1;\n }\n\n div[slot='main'] {\n height: 100%;\n display: flex;\n flex-direction: column;\n }\n\n div[slot='main'] > * {\n flex: 1;\n }\n\n modal-manager[mode='closed'] {\n display: none;\n }\n `;\n}\n"]}
|
package/dist/index.d.ts
CHANGED
@@ -1,3 +1,7 @@
|
|
1
|
-
export { ItemNavigator } from './src/item-navigator';
|
1
|
+
export { ItemNavigator } from './src/iaux-item-navigator';
|
2
2
|
export { MenuButton } from './src/menu-slider/menu-button';
|
3
3
|
export { IaMenuSlider } from './src/menu-slider/ia-menu-slider';
|
4
|
+
export { IauxSharingOptions, iauxShareIcon, } from './src/menus/iaux-sharing-options';
|
5
|
+
export { viewableFilesIcon } from './src/menus/iaux-viewable-files';
|
6
|
+
export { IauxViewableFiles } from './src/menus/iaux-viewable-files';
|
7
|
+
export { IauxSortFilesButton } from './src/menus/iaux-viewable-files';
|
package/dist/index.js
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
export { ItemNavigator } from './src/item-navigator';
|
1
|
+
export { ItemNavigator } from './src/iaux-item-navigator';
|
2
2
|
export { MenuButton } from './src/menu-slider/menu-button';
|
3
3
|
export { IaMenuSlider } from './src/menu-slider/ia-menu-slider';
|
4
|
+
// side menus
|
5
|
+
export { IauxSharingOptions, iauxShareIcon, } from './src/menus/iaux-sharing-options';
|
6
|
+
export { viewableFilesIcon } from './src/menus/iaux-viewable-files';
|
7
|
+
export { IauxViewableFiles } from './src/menus/iaux-viewable-files';
|
8
|
+
export { IauxSortFilesButton } from './src/menus/iaux-viewable-files';
|
4
9
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAEhE,aAAa;AACb,OAAO,EACL,kBAAkB,EAClB,aAAa,GACd,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC","sourcesContent":["export { ItemNavigator } from './src/iaux-item-navigator';\nexport { MenuButton } from './src/menu-slider/menu-button';\nexport { IaMenuSlider } from './src/menu-slider/ia-menu-slider';\n\n// side menus\nexport {\n IauxSharingOptions,\n iauxShareIcon,\n} from './src/menus/iaux-sharing-options';\nexport { viewableFilesIcon } from './src/menus/iaux-viewable-files';\nexport { IauxViewableFiles } from './src/menus/iaux-viewable-files';\nexport { IauxSortFilesButton } from './src/menus/iaux-viewable-files';\n"]}
|
@@ -432,14 +432,7 @@ __decorate([
|
|
432
432
|
property({ type: String })
|
433
433
|
], ItemNavigator.prototype, "baseHost", void 0);
|
434
434
|
__decorate([
|
435
|
-
property({
|
436
|
-
converter: (arg) => {
|
437
|
-
if (typeof arg === 'boolean') {
|
438
|
-
return arg;
|
439
|
-
}
|
440
|
-
return arg === 'true';
|
441
|
-
},
|
442
|
-
})
|
435
|
+
property({ type: Boolean })
|
443
436
|
], ItemNavigator.prototype, "signedIn", void 0);
|
444
437
|
__decorate([
|
445
438
|
property({ type: Array })
|
@@ -478,7 +471,7 @@ __decorate([
|
|
478
471
|
query('slot[name="main"]')
|
479
472
|
], ItemNavigator.prototype, "mainSlot", void 0);
|
480
473
|
ItemNavigator = __decorate([
|
481
|
-
customElement('
|
474
|
+
customElement('iaux-item-navigator')
|
482
475
|
], ItemNavigator);
|
483
476
|
export { ItemNavigator };
|
484
|
-
//# sourceMappingURL=item-navigator.js.map
|
477
|
+
//# sourceMappingURL=iaux-item-navigator.js.map
|
@@ -0,0 +1 @@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AE,CAAC;+CAAmB;AAEd;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAsB;AAErB;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;AAE7B;IAAxB,KAAK,CAAC,QAAQ,CAAC;4CAAgC;AAEV;IAArC,KAAK,CAAC,qBAAqB,CAAC;iDAAsC;AAE/B;IAAnC,KAAK,CAAC,mBAAmB,CAAC;+CAAoC;AA9CpD,aAAa;IADzB,aAAa,CAAC,qBAAqB,CAAC;GACxB,aAAa,CA6dzB","sourcesContent":["import {\n css,\n html,\n LitElement,\n PropertyValues,\n CSSResult,\n TemplateResult,\n nothing,\n} from 'lit';\nimport { customElement, property, state, query } from 'lit/decorators.js';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport {\n SharedResizeObserver,\n SharedResizeObserverResizeHandlerInterface,\n} from '@internetarchive/shared-resize-observer';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport '@internetarchive/icon-ellipses/icon-ellipses';\n\nimport './menu-slider/ia-menu-slider';\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\n@customElement('iaux-item-navigator')\nexport class ItemNavigator\n extends LitElement\n implements SharedResizeObserverResizeHandlerInterface\n{\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: Boolean }) viewAvailable: Boolean = true;\n\n @property({ type: String }) baseHost = 'archive.org';\n\n @property({ type: Boolean }) 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=\"header\"]') private headerSlot!: HTMLSlotElement;\n\n @query('slot[name=\"main\"]') private mainSlot!: HTMLSlotElement;\n\n disconnectedCallback() {\n this.removeResizeObserver();\n }\n\n updated(changed: PropertyValues) {\n if (changed.has('sharedObserver')) {\n const oldObserver = changed.get('sharedObserver') as SharedResizeObserver;\n oldObserver?.removeObserver(this.resizeObserverConfig);\n this.setResizeObserver();\n }\n }\n\n /** Shared observer */\n handleResize(entry: ResizeObserverEntry): void {\n const { width } = entry.contentRect;\n if (width <= 600) {\n this.openMenuState = 'overlay';\n return;\n }\n this.openMenuState = 'shift';\n }\n\n private setResizeObserver(): void {\n this.sharedObserver?.addObserver(this.resizeObserverConfig);\n this.sharedObserver?.addObserver({\n target: this.headerSlot,\n handler: {\n handleResize: ({ contentRect }) => {\n if (contentRect.height) {\n this.requestUpdate();\n }\n },\n },\n });\n }\n\n private removeResizeObserver(): void {\n this.sharedObserver?.removeObserver(this.resizeObserverConfig);\n }\n\n get resizeObserverConfig(): {\n handler: SharedResizeObserverResizeHandlerInterface;\n target: Element;\n } {\n return {\n handler: this,\n target: this.frame,\n };\n }\n /** End shared observer */\n\n get loaderTitle() {\n return this.viewportInFullscreen ? 'Internet Archive' : '';\n }\n\n get loadingArea() {\n return html`\n <div class=\"loading-area\">\n <div class=\"loading-view\">\n <ia-itemnav-loader\n .loaderMessage=${this.loaderTitle}\n ></ia-itemnav-loader>\n </div>\n </div>\n `;\n }\n\n slotChange(e: Event, type: 'header' | 'main'): void {\n const slottedContent = (\n e.target as HTMLSlotElement\n ).assignedNodes()?.[0] as HTMLElement;\n\n this.dispatchEvent(\n new CustomEvent('slotChange', {\n detail: { slot: slottedContent, type },\n }),\n );\n this.requestUpdate();\n }\n\n render(): TemplateResult {\n const displayReaderClass = this.loaded ? '' : 'hidden';\n const headerHeight =\n (this.headerSlot?.assignedNodes()[0] as HTMLElement)?.offsetHeight || 0;\n return html`\n <div id=\"frame\" class=${this.menuClass}>\n <slot\n name=\"header\"\n style=${`height: ${headerHeight}px`}\n @slotchange=${(e: Event) => this.slotChange(e, 'header')}\n ></slot>\n <div class=\"menu-and-reader\">\n ${this.shouldRenderMenu ? this.renderSideMenu : nothing}\n <div id=\"reader\" class=${displayReaderClass}>\n ${this.renderViewport}\n </div>\n ${!this.loaded ? this.loadingArea : nothing}\n </div>\n </div>\n `;\n }\n\n get noTheaterView() {\n return html`<ia-no-theater-available\n .identifier=${this.item?.metadata?.identifier}\n @loadingStateUpdated=${this.loadingStateUpdated}\n ></ia-no-theater-available>`;\n }\n\n get renderViewport(): TemplateResult | typeof nothing {\n if (!this.viewAvailable) {\n return this.noTheaterView;\n }\n\n const slotVisibility = !this.loaded ? 'opacity: 0;' : 'opacity: 1;';\n return html`\n <div slot=\"main\" style=${slotVisibility}>\n <slot\n name=\"main\"\n @slotchange=${(e: Event) => this.slotChange(e, 'main')}\n ></slot>\n </div>\n `;\n }\n\n loadingStateUpdated(e: loadingStateUpdatedEvent): void {\n const { loaded } = e.detail;\n this.loaded = loaded || null;\n }\n\n /** Fullscreen Management */\n manageViewportFullscreen(e: ManageFullscreenEvent): void {\n const fullscreenStatus = !!e.detail.isFullScreen;\n this.viewportInFullscreen = !fullscreenStatus ? null : fullscreenStatus;\n\n const event = new CustomEvent('fullscreenToggled', {\n detail: e.detail,\n }) as ManageFullscreenEvent;\n\n this.dispatchEvent(event);\n }\n /** End Fullscreen Management */\n\n /** Side menu */\n get shouldRenderMenu(): boolean {\n return !!this.menuContents?.length;\n }\n\n toggleMenu(): void {\n this.menuOpened = !this.menuOpened;\n }\n\n closeMenu(): void {\n this.menuOpened = false;\n }\n\n setOpenMenu(e: ToggleSidePanelOpenEvent): void {\n const { id } = e.detail;\n this.openMenu = id !== this.openMenu ? id : undefined;\n }\n\n setMenuContents(e: SetSideMenuContentsEvent): void {\n const updatedContents = [...e.detail];\n this.menuContents = updatedContents;\n }\n\n setMenuShortcuts(e: SetSideMenuShortcutsEvent) {\n this.menuShortcuts = [...e.detail];\n }\n\n /** Toggles Side Menu & Sets viewable subpanel */\n manageSideMenuEvents(e: ToggleSideMenuOpenEvent): void {\n const { menuId, action } = e.detail;\n if (!menuId) {\n return;\n }\n\n if (action === 'open') {\n this.openShortcut(menuId);\n } else if (action === 'toggle') {\n this.openMenu = menuId;\n this.toggleMenu();\n }\n }\n\n get menuToggleButton() {\n return html`\n <button\n class=\"toggle-menu\"\n @click=${this.toggleMenu}\n title=\"Toggle theater side panels\"\n >\n <div>\n <ia-icon-ellipses\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-ellipses>\n </div>\n </button>\n `;\n }\n\n get selectedMenuId(): MenuId | '' {\n return this.openMenu || '';\n }\n\n get renderSideMenu(): TemplateResult {\n const drawerState = this.menuOpened ? '' : 'hidden';\n return html`\n <nav>\n <div class=\"minimized\">${this.shortcuts} ${this.menuToggleButton}</div>\n <div id=\"menu\" class=${drawerState}>\n <ia-menu-slider\n .menus=${this.menuContents}\n .selectedMenu=${this.selectedMenuId}\n @menuTypeSelected=${this.setOpenMenu}\n @menuSliderClosed=${this.closeMenu}\n manuallyHandleClose\n open\n ></ia-menu-slider>\n </div>\n </nav>\n `;\n }\n /** End Side menu */\n\n /** Menu Shortcuts */\n openShortcut(selectedMenuId: MenuId = ''): void {\n this.openMenu = selectedMenuId;\n this.menuOpened = true;\n }\n\n get shortcuts(): TemplateResult {\n const shortcuts = this.menuShortcuts.map(({ icon, id }) => {\n if (id === 'fullscreen') {\n return html`${icon}`;\n }\n\n return html`\n <button class=\"shortcut ${id}\" @click=\"${() => this.openShortcut(id)}\">\n ${icon}\n </button>\n `;\n });\n return html`<div class=\"shortcuts\">${shortcuts}</div>`;\n }\n /** End Menu Shortcuts */\n\n /** Misc Render */\n get menuClass(): string {\n const hasMenuOrShortcuts =\n this.menuContents?.length || this.menuShortcuts?.length;\n const drawerState = this.menuOpened && hasMenuOrShortcuts ? '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 position: relative;\n overflow: hidden;\n display: block;\n }\n\n :host,\n #frame,\n .loading-area,\n .loading-view {\n min-height: inherit;\n height: inherit;\n }\n\n slot {\n display: block;\n width: 100%;\n }\n\n slot * {\n display: block;\n height: inherit;\n }\n\n #frame {\n background-color: ${theaterBg};\n color-scheme: dark;\n display: flex;\n flex-direction: column;\n }\n\n #frame.fullscreen {\n position: fixed;\n top: 0;\n bottom: 0;\n left: 0;\n right: 0;\n z-index: 9;\n }\n\n .loading-view {\n height: 100%;\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .loading-area {\n width: 100%;\n }\n\n ia-itemnav-loader {\n display: block;\n width: 100%;\n }\n\n .hidden {\n display: none !important;\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 display: flex;\n flex: 1;\n }\n\n nav button {\n background: none;\n }\n\n nav .minimized {\n background: rgba(0, 0, 0, 0.7);\n padding-top: 6px;\n position: absolute;\n width: ${menuMargin};\n z-index: 2;\n left: 0;\n border-bottom-right-radius: 5%;\n }\n\n nav .minimized button {\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin-bottom: 0.2rem;\n margin: auto;\n display: inline-flex;\n vertical-align: middle;\n -webkit-box-align: center;\n align-items: center;\n -webkit-box-pack: center;\n justify-content: center;\n width: ${menuMargin};\n height: ${menuMargin};\n }\n\n nav .minimized button.toggle-menu > * {\n border: 2px solid var(--iconStrokeColor);\n border-radius: var(--iconWidth);\n width: var(--iconWidth);\n height: var(--iconHeight);\n margin: auto;\n }\n\n ia-icon-ellipses {\n width: var(--iconWidth);\n height: var(--iconHeight);\n }\n\n #menu {\n position: absolute;\n top: 0;\n bottom: 0;\n left: 0;\n z-index: 3;\n overflow: hidden;\n transform: translateX(-${subnavWidth});\n width: ${subnavWidth};\n transform: translateX(calc(${subnavWidth} * -1));\n transition: ${transitionEffect};\n }\n\n #reader {\n position: relative;\n z-index: 1;\n transform: translateX(0);\n width: 100%;\n display: flex;\n }\n\n #reader > * {\n width: 100%;\n display: flex;\n flex: 1;\n }\n\n .open.overlay #reader {\n transition: none;\n }\n\n .open #menu {\n width: ${subnavWidth};\n transform: translateX(0);\n transition: ${transitionEffect};\n }\n\n .open.shift #reader {\n width: calc(100% - ${subnavWidth});\n margin-left: ${subnavWidth};\n transition: ${transitionEffect};\n }\n `;\n }\n}\n"]}
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import { CSSResult, LitElement, nothing, PropertyValues, TemplateResult } from 'lit';
|
2
|
+
import '@internetarchive/icon-link/icon-link';
|
3
|
+
import '@internetarchive/icon-share/icon-share';
|
4
|
+
import type Provider from './share-providers/provider';
|
5
|
+
export declare const iauxShareIcon: TemplateResult;
|
6
|
+
export declare class IauxSharingOptions extends LitElement {
|
7
|
+
baseHost: string;
|
8
|
+
creator: string;
|
9
|
+
description: string;
|
10
|
+
embedOptionsVisible: boolean;
|
11
|
+
identifier: string;
|
12
|
+
sharingOptions: Provider[];
|
13
|
+
type: string;
|
14
|
+
renderHeader: boolean;
|
15
|
+
fileSubPrefix: string;
|
16
|
+
updated(changed: PropertyValues): void;
|
17
|
+
loadProviders(): void;
|
18
|
+
get sharingItems(): TemplateResult<1>[];
|
19
|
+
get embedOption(): TemplateResult<1>;
|
20
|
+
get iframeEmbed(): TemplateResult<1>;
|
21
|
+
get bbcodeEmbed(): string;
|
22
|
+
get helpURL(): string;
|
23
|
+
toggleEmbedOptions(e: Event): void;
|
24
|
+
get header(): TemplateResult<1> | typeof nothing;
|
25
|
+
render(): TemplateResult<1>;
|
26
|
+
get providerIcon(): TemplateResult;
|
27
|
+
static get styles(): CSSResult;
|
28
|
+
}
|
@@ -0,0 +1,277 @@
|
|
1
|
+
import { __decorate } from "tslib";
|
2
|
+
/* eslint-disable lit-a11y/click-events-have-key-events */
|
3
|
+
/* eslint-disable lit-a11y/list */
|
4
|
+
import { classMap } from 'lit/directives/class-map.js';
|
5
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
6
|
+
import { css, html, LitElement, nothing, } from 'lit';
|
7
|
+
import { customElement, property } from 'lit/decorators.js';
|
8
|
+
import '@internetarchive/icon-link/icon-link';
|
9
|
+
import '@internetarchive/icon-share/icon-share';
|
10
|
+
import EmailProvider from './share-providers/email';
|
11
|
+
import FacebookProvider from './share-providers/facebook';
|
12
|
+
import PinterestProvider from './share-providers/pinterest';
|
13
|
+
import TumblrProvider from './share-providers/tumblr';
|
14
|
+
import TwitterProvider from './share-providers/twitter';
|
15
|
+
const copyToClipboard = (options) => {
|
16
|
+
const currentTarget = options.currentTarget;
|
17
|
+
const textarea = currentTarget.querySelector('textarea');
|
18
|
+
const note = currentTarget.querySelector('small');
|
19
|
+
textarea.select();
|
20
|
+
document.execCommand('copy');
|
21
|
+
textarea.blur();
|
22
|
+
note.classList.add('visible');
|
23
|
+
clearTimeout(note.timeout);
|
24
|
+
note.timeout = setTimeout(() => note.classList.remove('visible'), 4000);
|
25
|
+
};
|
26
|
+
export const iauxShareIcon = html `<ia-icon-share
|
27
|
+
style="width: var(--iconWidth); height: var(--iconHeight);"
|
28
|
+
></ia-icon-share>`;
|
29
|
+
let IauxSharingOptions = class IauxSharingOptions extends LitElement {
|
30
|
+
constructor() {
|
31
|
+
super(...arguments);
|
32
|
+
this.baseHost = 'archive.org';
|
33
|
+
this.creator = '';
|
34
|
+
this.description = '';
|
35
|
+
this.embedOptionsVisible = false;
|
36
|
+
this.identifier = '';
|
37
|
+
this.sharingOptions = [];
|
38
|
+
this.type = '';
|
39
|
+
this.renderHeader = false;
|
40
|
+
this.fileSubPrefix = '';
|
41
|
+
}
|
42
|
+
updated(changed) {
|
43
|
+
if (changed.has('sharingOptions') && !this.sharingOptions.length) {
|
44
|
+
this.loadProviders();
|
45
|
+
}
|
46
|
+
}
|
47
|
+
loadProviders() {
|
48
|
+
const { baseHost, creator, description, identifier, type, fileSubPrefix } = this;
|
49
|
+
const params = {
|
50
|
+
baseHost,
|
51
|
+
creator,
|
52
|
+
description,
|
53
|
+
identifier,
|
54
|
+
type,
|
55
|
+
fileSubPrefix,
|
56
|
+
};
|
57
|
+
this.sharingOptions = [
|
58
|
+
new TwitterProvider(params),
|
59
|
+
new FacebookProvider(params),
|
60
|
+
new TumblrProvider(params),
|
61
|
+
new PinterestProvider(params),
|
62
|
+
new EmailProvider(params),
|
63
|
+
];
|
64
|
+
}
|
65
|
+
get sharingItems() {
|
66
|
+
return this.sharingOptions.map(option => html `<li>
|
67
|
+
<a
|
68
|
+
class="${ifDefined(option.class)}"
|
69
|
+
href="${option.url}"
|
70
|
+
target="_blank"
|
71
|
+
>
|
72
|
+
${option.icon} ${option.name}
|
73
|
+
</a>
|
74
|
+
</li>`);
|
75
|
+
}
|
76
|
+
get embedOption() {
|
77
|
+
return html `<li>
|
78
|
+
<a href="#" @click=${this.toggleEmbedOptions}>
|
79
|
+
<ia-icon-link></ia-icon-link>
|
80
|
+
Get an embeddable link
|
81
|
+
</a>
|
82
|
+
</li>`;
|
83
|
+
}
|
84
|
+
get iframeEmbed() {
|
85
|
+
return html `<iframe
|
86
|
+
src="https://${this.baseHost}/embed/${this.identifier}" width="560"
|
87
|
+
height="384" frameborder="0" webkitallowfullscreen="true"
|
88
|
+
mozallowfullscreen="true" allowfullscreen></iframe>`;
|
89
|
+
}
|
90
|
+
get bbcodeEmbed() {
|
91
|
+
return `[archiveorg ${this.identifier} width=560 height=384 frameborder=0 webkitallowfullscreen=true mozallowfullscreen=true]`;
|
92
|
+
}
|
93
|
+
get helpURL() {
|
94
|
+
return `https://${this.baseHost}/help/audio.php?identifier=${this.identifier}`;
|
95
|
+
}
|
96
|
+
toggleEmbedOptions(e) {
|
97
|
+
e.preventDefault();
|
98
|
+
this.embedOptionsVisible = !this.embedOptionsVisible;
|
99
|
+
}
|
100
|
+
get header() {
|
101
|
+
const header = html `<header><h3>Share this ${this.type}</h3></header>`;
|
102
|
+
return this.renderHeader ? header : nothing;
|
103
|
+
}
|
104
|
+
render() {
|
105
|
+
return html `
|
106
|
+
${this.header}
|
107
|
+
<ul>
|
108
|
+
${this.sharingItems} ${this.embedOption}
|
109
|
+
<div
|
110
|
+
class=${classMap({ visible: this.embedOptionsVisible, embed: true })}
|
111
|
+
>
|
112
|
+
<h4>Embed</h4>
|
113
|
+
<div class="code" @click=${copyToClipboard}>
|
114
|
+
<textarea readonly>${this.iframeEmbed}</textarea>
|
115
|
+
<small>Copied to clipboard</small>
|
116
|
+
</div>
|
117
|
+
<h4>
|
118
|
+
Embed for wordpress.com hosted blogs and archive.org item
|
119
|
+
<description> tags
|
120
|
+
</h4>
|
121
|
+
<div class="code" @click=${copyToClipboard}>
|
122
|
+
<textarea readonly>${this.bbcodeEmbed}</textarea>
|
123
|
+
<small>Copied to clipboard</small>
|
124
|
+
</div>
|
125
|
+
<p>
|
126
|
+
Want more?
|
127
|
+
<a href=${this.helpURL}
|
128
|
+
>Advanced embedding details, examples, and help</a
|
129
|
+
>!
|
130
|
+
</p>
|
131
|
+
</div>
|
132
|
+
</ul>
|
133
|
+
`;
|
134
|
+
}
|
135
|
+
get providerIcon() {
|
136
|
+
return html `<ia-icon-share
|
137
|
+
style="width: var(--iconWidth); height: var(--iconHeight);"
|
138
|
+
></ia-icon-share>`;
|
139
|
+
}
|
140
|
+
static get styles() {
|
141
|
+
return css `
|
142
|
+
:host {
|
143
|
+
display: block;
|
144
|
+
height: 100%;
|
145
|
+
overflow-y: auto;
|
146
|
+
font-size: 1.4rem;
|
147
|
+
box-sizing: border-box;
|
148
|
+
}
|
149
|
+
|
150
|
+
header {
|
151
|
+
display: flex;
|
152
|
+
align-items: baseline;
|
153
|
+
}
|
154
|
+
|
155
|
+
h3 {
|
156
|
+
padding: 0;
|
157
|
+
margin: 0 1rem 0 0;
|
158
|
+
font-size: 1.6rem;
|
159
|
+
}
|
160
|
+
|
161
|
+
h4 {
|
162
|
+
font-size: 1.4rem;
|
163
|
+
}
|
164
|
+
|
165
|
+
ul {
|
166
|
+
padding: 0 0 2rem 0;
|
167
|
+
list-style: none;
|
168
|
+
}
|
169
|
+
|
170
|
+
li {
|
171
|
+
padding: 0 0 1rem 0;
|
172
|
+
}
|
173
|
+
|
174
|
+
li a {
|
175
|
+
font-size: 1.6rem;
|
176
|
+
text-decoration: none;
|
177
|
+
color: var(--shareLinkColor);
|
178
|
+
}
|
179
|
+
|
180
|
+
li a * {
|
181
|
+
display: inline-block;
|
182
|
+
padding: 0.2rem;
|
183
|
+
margin-right: 1rem;
|
184
|
+
vertical-align: middle;
|
185
|
+
border: 1px solid var(--shareIconBorder);
|
186
|
+
border-radius: 7px;
|
187
|
+
background: var(--shareIconBg);
|
188
|
+
}
|
189
|
+
|
190
|
+
.embed {
|
191
|
+
display: none;
|
192
|
+
}
|
193
|
+
.embed.visible {
|
194
|
+
display: block;
|
195
|
+
width: 95%;
|
196
|
+
}
|
197
|
+
|
198
|
+
.embed a {
|
199
|
+
color: var(--shareLinkColor);
|
200
|
+
}
|
201
|
+
|
202
|
+
.code {
|
203
|
+
position: relative;
|
204
|
+
}
|
205
|
+
|
206
|
+
textarea {
|
207
|
+
display: block;
|
208
|
+
width: 100%;
|
209
|
+
height: 120px;
|
210
|
+
padding: 0.8rem 1rem;
|
211
|
+
box-sizing: border-box;
|
212
|
+
resize: none;
|
213
|
+
cursor: pointer;
|
214
|
+
font:
|
215
|
+
normal 1.4rem 'Helvetica Neue',
|
216
|
+
Helvetica,
|
217
|
+
Arial,
|
218
|
+
sans-serif;
|
219
|
+
color: var(--textareaColor, #fff);
|
220
|
+
background: var(--textareaBg, #151515);
|
221
|
+
}
|
222
|
+
|
223
|
+
small {
|
224
|
+
position: absolute;
|
225
|
+
bottom: 0;
|
226
|
+
left: 0;
|
227
|
+
height: 3rem;
|
228
|
+
padding: 0.5rem 1rem;
|
229
|
+
box-sizing: border-box;
|
230
|
+
font:
|
231
|
+
normal 1.2rem/2rem 'Helvetica Neue',
|
232
|
+
Helvetica,
|
233
|
+
Arial,
|
234
|
+
sans-serif;
|
235
|
+
color: var(--textareaBg, #151515);
|
236
|
+
background: var(--textareaColor, #fff);
|
237
|
+
opacity: 0;
|
238
|
+
transition: opacity 300ms linear;
|
239
|
+
}
|
240
|
+
small.visible {
|
241
|
+
opacity: 1;
|
242
|
+
}
|
243
|
+
`;
|
244
|
+
}
|
245
|
+
};
|
246
|
+
__decorate([
|
247
|
+
property({ type: String })
|
248
|
+
], IauxSharingOptions.prototype, "baseHost", void 0);
|
249
|
+
__decorate([
|
250
|
+
property({ type: String })
|
251
|
+
], IauxSharingOptions.prototype, "creator", void 0);
|
252
|
+
__decorate([
|
253
|
+
property({ type: String })
|
254
|
+
], IauxSharingOptions.prototype, "description", void 0);
|
255
|
+
__decorate([
|
256
|
+
property({ type: Boolean })
|
257
|
+
], IauxSharingOptions.prototype, "embedOptionsVisible", void 0);
|
258
|
+
__decorate([
|
259
|
+
property({ type: String })
|
260
|
+
], IauxSharingOptions.prototype, "identifier", void 0);
|
261
|
+
__decorate([
|
262
|
+
property({ type: Array })
|
263
|
+
], IauxSharingOptions.prototype, "sharingOptions", void 0);
|
264
|
+
__decorate([
|
265
|
+
property({ type: String })
|
266
|
+
], IauxSharingOptions.prototype, "type", void 0);
|
267
|
+
__decorate([
|
268
|
+
property({ type: Boolean })
|
269
|
+
], IauxSharingOptions.prototype, "renderHeader", void 0);
|
270
|
+
__decorate([
|
271
|
+
property({ type: String })
|
272
|
+
], IauxSharingOptions.prototype, "fileSubPrefix", void 0);
|
273
|
+
IauxSharingOptions = __decorate([
|
274
|
+
customElement('iaux-sharing-options')
|
275
|
+
], IauxSharingOptions);
|
276
|
+
export { IauxSharingOptions };
|
277
|
+
//# sourceMappingURL=iaux-sharing-options.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"iaux-sharing-options.js","sourceRoot":"","sources":["../../../src/menus/iaux-sharing-options.ts"],"names":[],"mappings":";AAAA,0DAA0D;AAC1D,kCAAkC;AAClC,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EACL,GAAG,EAEH,IAAI,EACJ,UAAU,EACV,OAAO,GAGR,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,sCAAsC,CAAC;AAC9C,OAAO,wCAAwC,CAAC;AAEhD,OAAO,aAAa,MAAM,yBAAyB,CAAC;AACpD,OAAO,gBAAgB,MAAM,4BAA4B,CAAC;AAC1D,OAAO,iBAAiB,MAAM,6BAA6B,CAAC;AAC5D,OAAO,cAAc,MAAM,0BAA0B,CAAC;AACtD,OAAO,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AAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;0DAAiC;AAE/B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;gDAAW;AAET;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;wDAAsB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAoB;AAjBpC,kBAAkB;IAD9B,aAAa,CAAC,sBAAsB,CAAC;GACzB,kBAAkB,CA8O9B","sourcesContent":["/* eslint-disable lit-a11y/click-events-have-key-events */\n/* eslint-disable lit-a11y/list */\nimport { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport {\n css,\n CSSResult,\n html,\n LitElement,\n nothing,\n PropertyValues,\n TemplateResult,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport '@internetarchive/icon-link/icon-link';\nimport '@internetarchive/icon-share/icon-share';\n\nimport EmailProvider from './share-providers/email';\nimport FacebookProvider from './share-providers/facebook';\nimport PinterestProvider from './share-providers/pinterest';\nimport TumblrProvider from './share-providers/tumblr';\nimport TwitterProvider from './share-providers/twitter';\nimport { ProviderParams } from './share-providers/share-provider-interface';\nimport type Provider from './share-providers/provider';\n\nconst copyToClipboard = (options: Record<any, any>) => {\n const currentTarget = options.currentTarget as HTMLElement;\n const textarea = currentTarget.querySelector('textarea');\n const note = currentTarget.querySelector('small') as any;\n textarea!.select();\n document.execCommand('copy');\n textarea!.blur();\n note.classList.add('visible');\n clearTimeout(note.timeout);\n note.timeout = setTimeout(() => note.classList.remove('visible'), 4000);\n};\n\nexport const iauxShareIcon: TemplateResult = html`<ia-icon-share\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n></ia-icon-share>`;\n\n@customElement('iaux-sharing-options')\nexport class IauxSharingOptions extends LitElement {\n @property({ type: String }) baseHost = 'archive.org';\n\n @property({ type: String }) creator = '';\n\n @property({ type: String }) description = '';\n\n @property({ type: Boolean }) embedOptionsVisible = false;\n\n @property({ type: String }) identifier = '';\n\n @property({ type: Array }) sharingOptions: Provider[] = [];\n\n @property({ type: String }) type = '';\n\n @property({ type: Boolean }) renderHeader = false;\n\n @property({ type: String }) fileSubPrefix = '';\n\n updated(changed: PropertyValues) {\n if (changed.has('sharingOptions') && !this.sharingOptions.length) {\n this.loadProviders();\n }\n }\n\n loadProviders() {\n const { baseHost, creator, description, identifier, type, fileSubPrefix } =\n this;\n const params = {\n baseHost,\n creator,\n description,\n identifier,\n type,\n fileSubPrefix,\n } as unknown as ProviderParams;\n\n this.sharingOptions = [\n new TwitterProvider(params),\n new FacebookProvider(params),\n new TumblrProvider(params),\n new PinterestProvider(params),\n new EmailProvider(params),\n ];\n }\n\n get sharingItems() {\n return this.sharingOptions.map(\n option =>\n html`<li>\n <a\n class=\"${ifDefined(option.class)}\"\n href=\"${option.url}\"\n target=\"_blank\"\n >\n ${option.icon} ${option.name}\n </a>\n </li>`,\n );\n }\n\n get embedOption() {\n return html`<li>\n <a href=\"#\" @click=${this.toggleEmbedOptions}>\n <ia-icon-link></ia-icon-link>\n Get an embeddable link\n </a>\n </li>`;\n }\n\n get iframeEmbed() {\n return html`<iframe\n src=\"https://${this.baseHost}/embed/${this.identifier}\" width=\"560\"\n height=\"384\" frameborder=\"0\" webkitallowfullscreen=\"true\"\n mozallowfullscreen=\"true\" allowfullscreen></iframe>`;\n }\n\n get bbcodeEmbed() {\n return `[archiveorg ${this.identifier} width=560 height=384 frameborder=0 webkitallowfullscreen=true mozallowfullscreen=true]`;\n }\n\n get helpURL() {\n return `https://${this.baseHost}/help/audio.php?identifier=${this.identifier}`;\n }\n\n toggleEmbedOptions(e: Event) {\n e.preventDefault();\n this.embedOptionsVisible = !this.embedOptionsVisible;\n }\n\n get header() {\n const header = html`<header><h3>Share this ${this.type}</h3></header>`;\n return this.renderHeader ? header : nothing;\n }\n\n render() {\n return html`\n ${this.header}\n <ul>\n ${this.sharingItems} ${this.embedOption}\n <div\n class=${classMap({ visible: this.embedOptionsVisible, embed: true })}\n >\n <h4>Embed</h4>\n <div class=\"code\" @click=${copyToClipboard}>\n <textarea readonly>${this.iframeEmbed}</textarea>\n <small>Copied to clipboard</small>\n </div>\n <h4>\n Embed for wordpress.com hosted blogs and archive.org item\n <description> tags\n </h4>\n <div class=\"code\" @click=${copyToClipboard}>\n <textarea readonly>${this.bbcodeEmbed}</textarea>\n <small>Copied to clipboard</small>\n </div>\n <p>\n Want more?\n <a href=${this.helpURL}\n >Advanced embedding details, examples, and help</a\n >!\n </p>\n </div>\n </ul>\n `;\n }\n\n get providerIcon(): TemplateResult {\n return html`<ia-icon-share\n style=\"width: var(--iconWidth); height: var(--iconHeight);\"\n ></ia-icon-share>`;\n }\n\n static get styles(): CSSResult {\n return css`\n :host {\n display: block;\n height: 100%;\n overflow-y: auto;\n font-size: 1.4rem;\n box-sizing: border-box;\n }\n\n header {\n display: flex;\n align-items: baseline;\n }\n\n h3 {\n padding: 0;\n margin: 0 1rem 0 0;\n font-size: 1.6rem;\n }\n\n h4 {\n font-size: 1.4rem;\n }\n\n ul {\n padding: 0 0 2rem 0;\n list-style: none;\n }\n\n li {\n padding: 0 0 1rem 0;\n }\n\n li a {\n font-size: 1.6rem;\n text-decoration: none;\n color: var(--shareLinkColor);\n }\n\n li a * {\n display: inline-block;\n padding: 0.2rem;\n margin-right: 1rem;\n vertical-align: middle;\n border: 1px solid var(--shareIconBorder);\n border-radius: 7px;\n background: var(--shareIconBg);\n }\n\n .embed {\n display: none;\n }\n .embed.visible {\n display: block;\n width: 95%;\n }\n\n .embed a {\n color: var(--shareLinkColor);\n }\n\n .code {\n position: relative;\n }\n\n textarea {\n display: block;\n width: 100%;\n height: 120px;\n padding: 0.8rem 1rem;\n box-sizing: border-box;\n resize: none;\n cursor: pointer;\n font:\n normal 1.4rem 'Helvetica Neue',\n Helvetica,\n Arial,\n sans-serif;\n color: var(--textareaColor, #fff);\n background: var(--textareaBg, #151515);\n }\n\n small {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 3rem;\n padding: 0.5rem 1rem;\n box-sizing: border-box;\n font:\n normal 1.2rem/2rem 'Helvetica Neue',\n Helvetica,\n Arial,\n sans-serif;\n color: var(--textareaBg, #151515);\n background: var(--textareaColor, #fff);\n opacity: 0;\n transition: opacity 300ms linear;\n }\n small.visible {\n opacity: 1;\n }\n `;\n }\n}\n"]}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { LitElement, TemplateResult } from 'lit';
|
2
|
+
export declare const viewableFilesIcon: TemplateResult<1>;
|
3
|
+
type sortOptions = 'title_asc' | 'title_desc' | 'default';
|
4
|
+
type ItemInfo = {
|
5
|
+
url_path: string;
|
6
|
+
image: string;
|
7
|
+
title: string;
|
8
|
+
author: string;
|
9
|
+
file_subprefix: string;
|
10
|
+
};
|
11
|
+
export declare class IauxSortFilesButton extends LitElement {
|
12
|
+
fileListRaw: any[];
|
13
|
+
fileListSorted: any[];
|
14
|
+
sortOrderBy: sortOptions;
|
15
|
+
render(): TemplateResult<1>;
|
16
|
+
get sortButton(): TemplateResult<1>;
|
17
|
+
sortVolumes(sortType: sortOptions): void;
|
18
|
+
static get styles(): import("lit").CSSResult;
|
19
|
+
}
|
20
|
+
export declare class IauxViewableFiles extends LitElement {
|
21
|
+
hostUrl: string;
|
22
|
+
sortOrderBy: 'default' | 'title_asc' | 'title_desc';
|
23
|
+
subPrefix: string;
|
24
|
+
fileList: any[];
|
25
|
+
firstUpdated(): void;
|
26
|
+
volumeItemWithImageTitle(item: ItemInfo): TemplateResult<1>;
|
27
|
+
fileLi(item: ItemInfo): TemplateResult<1>;
|
28
|
+
get fileListTemplate(): TemplateResult;
|
29
|
+
render(): TemplateResult<1>;
|
30
|
+
static get styles(): import("lit").CSSResult;
|
31
|
+
}
|
32
|
+
export {};
|