@internetarchive/ia-item-navigator 2.1.1 → 2.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. package/dist/demo/app-root.js.map +1 -1
  2. package/dist/src/iaux-item-navigator.js.map +1 -1
  3. package/dist/src/loader.d.ts +4 -4
  4. package/dist/src/menu-slider/ia-menu-slider.d.ts +4 -4
  5. package/dist/src/menu-slider/ia-menu-slider.js.map +1 -1
  6. package/dist/src/menu-slider/menu-button.d.ts +4 -4
  7. package/dist/src/menus/share-panel.d.ts +14 -7
  8. package/dist/src/menus/share-panel.js +113 -89
  9. package/dist/src/menus/share-panel.js.map +1 -1
  10. package/dist/src/menus/viewable-files.js.map +1 -1
  11. package/dist/src/no-theater-available.js.map +1 -1
  12. package/dist/test/iaux-sharing-options.test.js +5 -13
  13. package/dist/test/iaux-sharing-options.test.js.map +1 -1
  14. package/package.json +1 -1
  15. package/src/menus/share-panel.ts +126 -99
  16. package/test/iaux-sharing-options.test.ts +4 -21
  17. package/dist/src/menus/share-providers/email.d.ts +0 -11
  18. package/dist/src/menus/share-providers/email.js +0 -15
  19. package/dist/src/menus/share-providers/email.js.map +0 -1
  20. package/dist/src/menus/share-providers/facebook.d.ts +0 -11
  21. package/dist/src/menus/share-providers/facebook.js +0 -15
  22. package/dist/src/menus/share-providers/facebook.js.map +0 -1
  23. package/dist/src/menus/share-providers/pinterest.d.ts +0 -11
  24. package/dist/src/menus/share-providers/pinterest.js +0 -15
  25. package/dist/src/menus/share-providers/pinterest.js.map +0 -1
  26. package/dist/src/menus/share-providers/provider.d.ts +0 -20
  27. package/dist/src/menus/share-providers/provider.js +0 -37
  28. package/dist/src/menus/share-providers/provider.js.map +0 -1
  29. package/dist/src/menus/share-providers/share-provider-interface.d.ts +0 -13
  30. package/dist/src/menus/share-providers/share-provider-interface.js +0 -2
  31. package/dist/src/menus/share-providers/share-provider-interface.js.map +0 -1
  32. package/dist/src/menus/share-providers/tumblr.d.ts +0 -11
  33. package/dist/src/menus/share-providers/tumblr.js +0 -15
  34. package/dist/src/menus/share-providers/tumblr.js.map +0 -1
  35. package/dist/src/menus/share-providers/twitter.d.ts +0 -11
  36. package/dist/src/menus/share-providers/twitter.js +0 -15
  37. package/dist/src/menus/share-providers/twitter.js.map +0 -1
  38. package/src/menus/share-providers/email.ts +0 -23
  39. package/src/menus/share-providers/facebook.ts +0 -23
  40. package/src/menus/share-providers/pinterest.ts +0 -23
  41. package/src/menus/share-providers/provider.ts +0 -63
  42. package/src/menus/share-providers/share-provider-interface.ts +0 -17
  43. package/src/menus/share-providers/tumblr.ts +0 -23
  44. package/src/menus/share-providers/twitter.ts +0 -23
  45. package/test/ia-sharing-options.test.js +0 -78
@@ -1 +1 @@
1
- {"version":3,"file":"share-panel.js","sourceRoot":"","sources":["../../../src/menus/share-panel.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,eAAe,MAAM,2BAA2B,CAAC;AAIxD,MAAM,eAAe,GAAG,CAAC,OAAyB,EAAE,EAAE;IACpD,MAAM,aAAa,GAAG,OAAO,CAAC,aAA4B,CAAC;IAC3D,MAAM,QAAQ,GAAG,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,aAAa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,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;yDAAoB;AAjBpC,kBAAkB;IAD9B,aAAa,CAAC,qBAAqB,CAAC;GACxB,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-in-share-panel')\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`&lt;iframe\n src=\"https://${this.baseHost}/embed/${this.identifier}\" width=\"560\"\n height=\"384\" frameborder=\"0\" webkitallowfullscreen=\"true\"\n mozallowfullscreen=\"true\" allowfullscreen&gt;&lt;/iframe&gt;`;\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 &lt;description&gt; 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"]}
1
+ {"version":3,"file":"share-panel.js","sourceRoot":"","sources":["../../../src/menus/share-panel.ts"],"names":[],"mappings":";AAAA,0DAA0D;AAC1D,kCAAkC;AAClC,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,wCAAwC,CAAC;AAChD,OAAO,4CAA4C,CAAC;AACpD,OAAO,8CAA8C,CAAC;AACtD,OAAO,0CAA0C,CAAC;AAClD,OAAO,gDAAgD,CAAC;AACxD,OAAO,wCAAwC,CAAC;AAChD,OAAO,sCAAsC,CAAC;AAQ9C,MAAM,eAAe,GAAG,CAAC,KAAiB,EAAE,EAAE;IAC5C,MAAM,aAAa,GAAG,KAAK,CAAC,aAA4B,CAAC;IACzD,MAAM,QAAQ,GAAG,aAAa,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACzD,MAAM,IAAI,GAAG,aAAa,CAAC,aAAa,CAAC,OAAO,CAAQ,CAAC;IACzD,QAAS,CAAC,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,QAAS,CAAC,IAAI,EAAE,CAAC;IACjB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9B,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC3B,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAmB,IAAI,CAAA;;kBAE/B,CAAC;AAGZ,IAAM,kBAAkB,GAAxB,MAAM,kBAAm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AjBpC,kBAAkB;IAD9B,aAAa,CAAC,qBAAqB,CAAC;GACxB,kBAAkB,CAwQ9B","sourcesContent":["/* eslint-disable lit-a11y/click-events-have-key-events */\n/* eslint-disable lit-a11y/list */\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-share/icon-share';\nimport '@internetarchive/icon-twitter/icon-twitter';\nimport '@internetarchive/icon-facebook/icon-facebook';\nimport '@internetarchive/icon-tumblr/icon-tumblr';\nimport '@internetarchive/icon-pinterest/icon-pinterest';\nimport '@internetarchive/icon-email/icon-email';\nimport '@internetarchive/icon-link/icon-link';\n\ntype ShareOption = {\n name: string;\n icon: TemplateResult | string;\n url: string;\n};\n\nconst copyToClipboard = (event: MouseEvent) => {\n const currentTarget = event.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-in-share-panel')\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: ShareOption[] = [];\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 let shareUrl = `https://${this.baseHost}/details/${this.identifier}`;\n if (this.fileSubPrefix) {\n shareUrl += `/${this.fileSubPrefix}`;\n }\n const shareBlurb = [\n this.description,\n this.creator,\n 'Free Download, Borrow, and Streaming',\n 'Internet Archive',\n ]\n .filter(Boolean)\n .join(' : ');\n\n this.sharingOptions = [\n {\n name: 'Twitter',\n icon: html`<ia-icon-twitter></ia-icon-twitter>`,\n url: `https://twitter.com/intent/tweet?${new URLSearchParams({\n url: shareUrl,\n text: shareBlurb,\n via: 'internetarchive',\n })}`,\n },\n {\n name: 'Facebook',\n icon: html`<ia-icon-facebook></ia-icon-facebook>`,\n url: `https://www.facebook.com/sharer/sharer.php?${new URLSearchParams({\n u: shareUrl,\n })}`,\n },\n {\n name: 'Tumblr',\n icon: html`<ia-icon-tumblr></ia-icon-tumblr>`,\n url: `https://www.tumblr.com/widgets/share/tool/preview?${new URLSearchParams(\n {\n posttype: 'link',\n canonicalUrl: shareUrl,\n title: shareBlurb,\n },\n )}`,\n },\n {\n name: 'Pinterest',\n icon: html`<ia-icon-pinterest></ia-icon-pinterest>`,\n url: `http://www.pinterest.com/pin/create/button/?${new URLSearchParams(\n {\n url: shareUrl,\n description: shareBlurb,\n },\n )}`,\n },\n {\n name: 'Email',\n icon: html`<ia-icon-email></ia-icon-email>`,\n url: `mailto:?${new URLSearchParams({\n subject: shareBlurb,\n body: shareUrl,\n })}`,\n },\n ];\n }\n\n get iframeEmbed() {\n return `<iframe\n src=\"https://${this.baseHost}/embed/${this.identifier}\"\n width=\"560\" height=\"384\" frameborder=\"0\"\n webkitallowfullscreen=\"true\" mozallowfullscreen=\"true\" allowfullscreen\n ></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 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 <main>\n ${this.sharingOptions.map(\n option =>\n html` <a class=\"share-option\" href=\"${option.url}\" target=\"_blank\">\n ${option.icon} ${option.name}\n </a>`,\n )}\n <details>\n <summary class=\"share-option\">\n <ia-icon-link></ia-icon-link>\n Get an embeddable link\n </summary>\n <div class=\"embed\">\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 &lt;description&gt; 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 </details>\n </main>\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 main {\n padding: 1rem 0;\n }\n\n .share-option {\n display: block;\n padding: 0.5rem 0;\n font-size: 1.6rem;\n text-decoration: none;\n color: var(--shareLinkColor);\n cursor: pointer;\n }\n\n .share-option > * {\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 /* Hide the triangle that appears on details tags */\n summary::marker {\n content: '';\n }\n\n summary::-webkit-details-marker {\n display: none;\n }\n\n .embed {\n padding-right: 5px;\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"]}
@@ -1 +1 @@
1
- {"version":3,"file":"viewable-files.js","sourceRoot":"","sources":["../../../src/menus/viewable-files.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,kCAAkC;AAClC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA0B,CAAC;AAElD,aAAa;AACb,MAAM,WAAW,GAAG,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BvB,CAAC;AACF,MAAM,YAAY,GAAG,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BxB,CAAC;AACF,MAAM,eAAe,GAAG,IAAI,CAAA;;;;;;;;;;;;;;;;;;;;CAoB3B,CAAC;AAcF,wCAAwC;AACxC,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAA;;;;;;;;;;;;;;;;CAgBpC,CAAC;AAEF,0DAA0D;AAEnD,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,UAAU;IAA5C;;QACsB,gBAAW,GAAU,EAAE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able max-classes-per-file */\n/* eslint-disable lit-a11y/list */\nimport { css, html, LitElement, nothing, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\n\n// sort icons\nconst sortAscIcon = html`\n <svg\n name=\"sort-asc\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n width=\"18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g fill=\"none\" fill-rule=\"evenodd\">\n <path\n d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\"\n fill=\"#fff\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\"\n fill=\"#fff\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612\"\n stroke=\"#fff\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"1.661538\"\n transform=\"matrix(1 0 0 -1 0 18.692308)\"\n />\n </g>\n </svg>\n`;\nconst sortDescIcon = html`\n <svg\n name=\"sort-desc\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n width=\"18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g fill=\"none\" fill-rule=\"evenodd\">\n <path\n d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\"\n fill=\"#fff\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\"\n fill=\"#fff\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612\"\n stroke=\"#fff\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"1.661538\"\n />\n </g>\n </svg>\n`;\nconst sortNeutralIcon = html`\n <svg\n name=\"sort-neutral\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n width=\"18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g fill=\"#fff\" fill-rule=\"evenodd\">\n <path\n d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\"\n fill-rule=\"nonzero\"\n />\n <circle cx=\"13\" cy=\"9\" r=\"2\" />\n </g>\n </svg>\n`;\n\ntype sortOptions = 'title_asc' | 'title_desc' | 'default';\n\ntype ItemInfo = {\n url_path: string;\n image: string;\n title: string;\n author: string;\n file_subprefix: string;\n file_source: string;\n file_origin?: string;\n};\n\n/* icon for menu shortcut & menu icon */\nexport const viewableFilesIcon = html`\n <svg\n height=\"24\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"volumesTitleID volumesDescID\"\n >\n <title id=\"volumesTitleID\">Viewable Files</title>\n <g fill=\"#ffffff\">\n <path\n fill=\"#ffffff\"\n d=\"m9.83536396 0h10.07241114c.1725502.47117517.3378411.76385809.4958725.87804878.1295523.11419069.3199719.1998337.5712586.25692905.2512868.05709534.4704647.08564301.6575337.08564301h.2806036v15.24362526h-4.3355343v3.8106985h-4.44275v3.7250554h-12.01318261c-.27306495 0-.50313194-.085643-.69020098-.256929-.18706903-.1712861-.30936193-.3425721-.36687867-.5138581l-.06449694-.2785477v-14.2159091c0-.32815965.08627512-.5922949.25882537-.79240577.17255024-.20011086.34510049-.32150776.51765073-.36419068l.25882537-.0640244h3.36472977v-2.54767184c0-.31374722.08627513-.57067627.25882537-.77078714.17255025-.20011086.34510049-.32150776.51765074-.36419068l.25882536-.06402439h3.36472978v-2.56929047c0-.32815964.08627512-.5922949.25882537-.79240576.17255024-.20011087.34510049-.31430156.51765073-.34257207zm10.78355264 15.6294346v-13.53076498c-.2730649-.08536585-.4456152-.16380266-.5176507-.23531042-.1725502-.1424612-.2730649-.27078714-.3015441-.38497783v13.36031043h-9.87808272c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144124-.08962561.006929-.13988296.0640244-.05025735.0570953-.07538603.1427383-.07538603.256929s.02149898.210643.06449694.289357c.04299795.078714.08599591.1322062.12899387.1604767l.06449693.0216187h10.71905571zm-10.2449613-2.4412417h7.98003v-11.60421286h-7.98003zm1.6827837-9.41990022h4.6153002c.1725502 0 .3199718.05349224.4422647.16047672s.1834393.23891353.1834393.39578714c0 .15687362-.0611464.28519956-.1834393.38497783s-.2697145.1496674-.4422647.1496674h-4.6153002c-.1725503 0-.3199719-.04988913-.4422647-.1496674-.1222929-.09977827-.1834394-.22810421-.1834394-.38497783 0-.15687361.0611465-.28880266.1834394-.39578714.1222928-.10698448.2697144-.16047672.4422647-.16047672zm-6.08197737 13.50997782h7.72120467v-.8131929h-3.79610541c-.27306495 0-.49950224-.085643-.67931188-.256929-.17980964-.1712861-.29847284-.3425721-.35598958-.5138581l-.06449694-.2785477v-10.02023282h-2.82530086zm6.77217827-11.36890243h3.2139578c.1295522 0 .240956.05709534.3342113.17128603.0932554.11419069.139883.24972284.139883.40659645 0 .15687362-.0466276.28880267-.139883.39578714-.0932553.10698448-.2046591.16047672-.3342113.16047672h-3.2139578c-.1295523 0-.2373264-.05349224-.3233223-.16047672-.0859959-.10698447-.1289938-.23891352-.1289938-.39578714 0-.15687361.0429979-.29240576.1289938-.40659645s.19377-.17128603.3233223-.17128603zm-11.15043132 15.11557653h7.69942646v-.7491685h-3.79610539c-.25854616 0-.48135376-.0892462-.66842279-.2677384-.18706904-.1784922-.30936193-.3605876-.36687868-.546286l-.06449694-.2569291v-10.04101994h-2.80352266zm14.62237682-4.5606985h-.8191949v2.1410754h-9.89986085s-.04299796.0285477-.12899387.085643c-.08599592.0570954-.12201369.1427384-.10805331.2569291 0 .1141907.01786928.210643.05360784.289357.03573856.0787139.07538603.125.1189424.138858l.06449694.0432373h10.71905575v-2.9542683zm-4.3991936 3.8106985h-.8191949v2.077051h-9.8563045c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144125-.08962561.0105321-.13988296.0748337-.05025735.0643015-.07538603.1607538-.07538603.289357 0 .1141906.02149898.2070399.06449694.2785476.04299795.0715078.08599591.1141907.12899387.1280488l.06449693.0216186h10.69811519v-2.8686252z\"\n />\n </g>\n </svg>\n`;\n\n/* <iaux-in-sort-files-button> side panel header button */\n@customElement('iaux-in-sort-files-button')\nexport class IauxSortFilesButton extends LitElement {\n @property({ type: Array }) fileListRaw: any[] = [];\n\n @property({ type: Array }) fileListSorted: any[] = [];\n\n @property({ type: String, reflect: true }) sortOrderBy: sortOptions =\n 'default';\n\n render() {\n return html`<div class=\"sort-multi-file-list\">${this.sortButton}</div>`;\n }\n\n get sortButton() {\n const sortIcons = {\n default: html`\n <button\n class=\"sort-by neutral-icon\"\n aria-label=\"Sort volumes in initial order\"\n @click=${() => this.sortVolumes('title_asc')}\n >\n ${sortNeutralIcon}\n </button>\n `,\n title_asc: html`\n <button\n class=\"sort-by asc-icon\"\n aria-label=\"Sort volumes in ascending order\"\n @click=${() => this.sortVolumes('title_desc')}\n >\n ${sortAscIcon}\n </button>\n `,\n title_desc: html`\n <button\n class=\"sort-by desc-icon\"\n aria-label=\"Sort volumes in descending order\"\n @click=${() => this.sortVolumes('default')}\n >\n ${sortDescIcon}\n </button>\n `,\n };\n\n return sortIcons[this.sortOrderBy];\n }\n\n sortVolumes(sortType: sortOptions) {\n this.sortOrderBy = sortType;\n let sortedFiles = [];\n\n sortedFiles = this.fileListRaw.sort((a, b) => {\n if (sortType === 'title_asc') return a.title.localeCompare(b.title);\n if (sortType === 'title_desc') return b.title.localeCompare(a.title);\n return a.orig_sort - b.orig_sort;\n });\n\n this.dispatchEvent(\n new CustomEvent('fileListSorted', {\n detail: {\n sortType,\n sortedFiles,\n },\n bubbles: true,\n composed: true,\n }),\n );\n this.fileListSorted = sortedFiles;\n }\n\n static get styles() {\n return css`\n button.sort-by {\n padding: 0px;\n background-color: transparent;\n border: 0px;\n --iconWidth: var(--menuSliderHeaderIconWidth);\n --iconHeight: var(--menuSliderHeaderIconHeight);\n }\n `;\n }\n}\n\n/* <iaux-in-viewable-files-panel> side panel menu */\n@customElement('iaux-in-viewable-files-panel')\nexport class IauxViewableFiles extends LitElement {\n @property({ type: String }) baseHost: string = 'archive.org';\n\n @property({ type: String }) sortOrderBy:\n | 'default'\n | 'title_asc'\n | 'title_desc' = 'default';\n\n @property({ type: String }) subPrefix: string = '';\n\n @property({ type: Array }) fileList: any[] = [];\n\n @property({ type: Boolean, reflect: true }) addSortToUrl = false;\n\n firstUpdated() {\n const activeFile = this.shadowRoot!.querySelector('.content.active') as any;\n // allow for css animations to run before scrolling to active file\n setTimeout(() => {\n // scroll active file into view if needed\n // note:\n // - `scrollIntoViewIfNeeded` handles auto-scroll gracefully for Chrome, Safari\n // - `scrollIntoView` handles auto-scroll for almost all the browsers. specifially FF.\n if (activeFile?.scrollIntoViewIfNeeded) {\n // `scrollIntoViewIfNeeded` auto-scroll only if element not is visible area\n activeFile?.scrollIntoViewIfNeeded(true);\n } else {\n // `scrollIntoView` always auto-scroll to center of visible area\n activeFile?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n }\n }, 350);\n }\n\n volumeItemWithImageTitle(item: ItemInfo) {\n const hrefUrl = this.fileUrl(item);\n\n return html`\n <li class=\"content active\">\n <div class=\"separator\"></div>\n <a class=\"container\" href=\"${hrefUrl}\">\n <div class=\"image\">\n <img src=\"${item.image}\" alt=\"preview\" />\n </div>\n <div class=\"text\">\n <p class=\"item-title\">${item.title}</p>\n <small>by: ${item.author}</small>\n </div>\n </a>\n </li>\n `;\n }\n\n fileUrl(item: ItemInfo) {\n const baseUrl = `//${this.baseHost}${item.url_path}`;\n let hrefUrl = baseUrl;\n if (this.addSortToUrl) {\n hrefUrl =\n this.sortOrderBy === 'default'\n ? `${baseUrl}`\n : `${baseUrl}?sort=${this.sortOrderBy}`;\n }\n return hrefUrl;\n }\n\n get pdfLabel(): TemplateResult {\n return html`<span class=\"pdf-label\"\n ><span class=\"sr-only\">view this</span> PDF</span\n >`;\n }\n\n fileLi(item: ItemInfo): TemplateResult {\n const activeClass = this.subPrefix === item.file_subprefix ? ' active' : '';\n const hrefUrl = this.fileUrl(item);\n const isPdf = (item.file_source ?? '').match(/^[^+]+\\.pdf$/i);\n\n return html`\n <li>\n <div class=\"separator\"></div>\n <div class=\"content${activeClass}\">\n <a href=${hrefUrl}>\n <p class=\"item-title\">\n ${item.title}${isPdf ? this.pdfLabel : nothing}\n </p>\n </a>\n </div>\n </li>\n `;\n }\n\n get fileListTemplate(): TemplateResult {\n const filesDisplay = repeat(\n this.fileList,\n file => file?.file_prefix,\n this.fileLi.bind(this),\n );\n return html`\n <ul>\n ${filesDisplay}\n <div class=\"separator\"></div>\n </ul>\n `;\n }\n\n render() {\n return html` ${this.fileList.length ? this.fileListTemplate : nothing} `;\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n overflow-y: auto;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n margin-top: 14px;\n margin-bottom: 2rem;\n --activeBorderWidth: 2px;\n }\n\n a {\n color: #ffffff;\n text-decoration: none;\n }\n\n img {\n width: 35px;\n height: 45px;\n }\n\n ul {\n padding: 0;\n list-style: none;\n margin: var(--activeBorderWidth) 0.5rem 1rem 0;\n }\n\n ul > li:first-child .separator {\n display: none;\n }\n\n li {\n cursor: pointer;\n position: relative;\n }\n\n li .content {\n padding: 2px 0 4px 2px;\n border: var(--activeBorderWidth) solid transparent;\n padding: 0.2rem 0 0.4rem 0.2rem;\n }\n\n li .content.active {\n border: var(--activeBorderWidth) solid #538bc5;\n }\n\n li.content a {\n display: flex;\n }\n\n small {\n font-style: italic;\n white-space: initial;\n }\n\n .container {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .item-title {\n margin-block-start: 0em;\n margin-block-end: 0em;\n font-size: 14px;\n font-weight: bold;\n word-wrap: break-word;\n padding-left: 5px;\n }\n\n .separator {\n background-color: var(--secondaryBGColor);\n width: 98%;\n margin: 1px auto;\n height: 1px;\n }\n\n .text {\n padding-left: 10px;\n }\n\n .icon {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: 0.7rem;\n border: 1px solid var(--primaryTextColor);\n border-radius: 2px;\n background: var(--activeButtonBg) 50% 50% no-repeat;\n }\n\n .pdf-label {\n border: 1px solid;\n padding: 2px 5px;\n border-radius: 20px;\n display: inline-block;\n margin-left: 5px;\n font-size: 0.9rem;\n }\n\n .pdf-label .sr-only {\n position: absolute;\n clip: rect(1px, 1px, 1px, 1px);\n padding: 0;\n border: 0;\n height: 1px;\n width: 1px;\n overflow: hidden;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"viewable-files.js","sourceRoot":"","sources":["../../../src/menus/viewable-files.ts"],"names":[],"mappings":";AAAA,yCAAyC;AACzC,kCAAkC;AAClC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAkB,MAAM,KAAK,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,0BAA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IACJ,CAAC;CACF,CAAA;AA7N6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;mDAAkC;AAEjC;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;sDAGE;AAED;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;oDAAwB;AAExB;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;mDAAsB;AAEJ;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;uDAAsB;AAZtD,iBAAiB;IAD7B,aAAa,CAAC,8BAA8B,CAAC;GACjC,iBAAiB,CA8N7B","sourcesContent":["/* eslint-disable max-classes-per-file */\n/* eslint-disable lit-a11y/list */\nimport { css, html, LitElement, nothing, TemplateResult } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\n\n// sort icons\nconst sortAscIcon = html`\n <svg\n name=\"sort-asc\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n width=\"18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g fill=\"none\" fill-rule=\"evenodd\">\n <path\n d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\"\n fill=\"#fff\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\"\n fill=\"#fff\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612\"\n stroke=\"#fff\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"1.661538\"\n transform=\"matrix(1 0 0 -1 0 18.692308)\"\n />\n </g>\n </svg>\n`;\nconst sortDescIcon = html`\n <svg\n name=\"sort-desc\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n width=\"18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g fill=\"none\" fill-rule=\"evenodd\">\n <path\n d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\"\n fill=\"#fff\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\"\n fill=\"#fff\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m10.3846154 11.0769231 2.7692308 5.5384615 2.7692307-5.5384615m-2.7692307 4.1538461v-13.15384612\"\n stroke=\"#fff\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\"\n stroke-width=\"1.661538\"\n />\n </g>\n </svg>\n`;\nconst sortNeutralIcon = html`\n <svg\n name=\"sort-neutral\"\n height=\"18\"\n viewBox=\"0 0 18 18\"\n width=\"18\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <g fill=\"#fff\" fill-rule=\"evenodd\">\n <path\n d=\"m2.32514544 8.30769231.7756949-2.08468003h2.92824822l.75630252 2.08468003h1.01809955l-2.70523594-6.92307693h-1.01809955l-2.69553976 6.92307693zm3.41305753-2.86037492h-2.34647705l1.17323853-3.22883h.01939237z\"\n fill-rule=\"nonzero\"\n />\n <path\n d=\"m7.1689722 16.6153846v-.7756949h-4.4117647l4.29541047-5.3716871v-.77569491h-5.06140918v.77569491h3.97543633l-4.30510666 5.3716871v.7756949z\"\n fill-rule=\"nonzero\"\n />\n <circle cx=\"13\" cy=\"9\" r=\"2\" />\n </g>\n </svg>\n`;\n\ntype sortOptions = 'title_asc' | 'title_desc' | 'default';\n\ntype ItemInfo = {\n url_path: string;\n image: string;\n title: string;\n author: string;\n file_subprefix: string;\n file_source: string;\n file_origin?: string;\n};\n\n/* icon for menu shortcut & menu icon */\nexport const viewableFilesIcon = html`\n <svg\n height=\"24\"\n viewBox=\"0 0 24 24\"\n width=\"24\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"volumesTitleID volumesDescID\"\n >\n <title id=\"volumesTitleID\">Viewable Files</title>\n <g fill=\"#ffffff\">\n <path\n fill=\"#ffffff\"\n d=\"m9.83536396 0h10.07241114c.1725502.47117517.3378411.76385809.4958725.87804878.1295523.11419069.3199719.1998337.5712586.25692905.2512868.05709534.4704647.08564301.6575337.08564301h.2806036v15.24362526h-4.3355343v3.8106985h-4.44275v3.7250554h-12.01318261c-.27306495 0-.50313194-.085643-.69020098-.256929-.18706903-.1712861-.30936193-.3425721-.36687867-.5138581l-.06449694-.2785477v-14.2159091c0-.32815965.08627512-.5922949.25882537-.79240577.17255024-.20011086.34510049-.32150776.51765073-.36419068l.25882537-.0640244h3.36472977v-2.54767184c0-.31374722.08627513-.57067627.25882537-.77078714.17255025-.20011086.34510049-.32150776.51765074-.36419068l.25882536-.06402439h3.36472978v-2.56929047c0-.32815964.08627512-.5922949.25882537-.79240576.17255024-.20011087.34510049-.31430156.51765073-.34257207zm10.78355264 15.6294346v-13.53076498c-.2730649-.08536585-.4456152-.16380266-.5176507-.23531042-.1725502-.1424612-.2730649-.27078714-.3015441-.38497783v13.36031043h-9.87808272c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144124-.08962561.006929-.13988296.0640244-.05025735.0570953-.07538603.1427383-.07538603.256929s.02149898.210643.06449694.289357c.04299795.078714.08599591.1322062.12899387.1604767l.06449693.0216187h10.71905571zm-10.2449613-2.4412417h7.98003v-11.60421286h-7.98003zm1.6827837-9.41990022h4.6153002c.1725502 0 .3199718.05349224.4422647.16047672s.1834393.23891353.1834393.39578714c0 .15687362-.0611464.28519956-.1834393.38497783s-.2697145.1496674-.4422647.1496674h-4.6153002c-.1725503 0-.3199719-.04988913-.4422647-.1496674-.1222929-.09977827-.1834394-.22810421-.1834394-.38497783 0-.15687361.0611465-.28880266.1834394-.39578714.1222928-.10698448.2697144-.16047672.4422647-.16047672zm-6.08197737 13.50997782h7.72120467v-.8131929h-3.79610541c-.27306495 0-.49950224-.085643-.67931188-.256929-.17980964-.1712861-.29847284-.3425721-.35598958-.5138581l-.06449694-.2785477v-10.02023282h-2.82530086zm6.77217827-11.36890243h3.2139578c.1295522 0 .240956.05709534.3342113.17128603.0932554.11419069.139883.24972284.139883.40659645 0 .15687362-.0466276.28880267-.139883.39578714-.0932553.10698448-.2046591.16047672-.3342113.16047672h-3.2139578c-.1295523 0-.2373264-.05349224-.3233223-.16047672-.0859959-.10698447-.1289938-.23891352-.1289938-.39578714 0-.15687361.0429979-.29240576.1289938-.40659645s.19377-.17128603.3233223-.17128603zm-11.15043132 15.11557653h7.69942646v-.7491685h-3.79610539c-.25854616 0-.48135376-.0892462-.66842279-.2677384-.18706904-.1784922-.30936193-.3605876-.36687868-.546286l-.06449694-.2569291v-10.04101994h-2.80352266zm14.62237682-4.5606985h-.8191949v2.1410754h-9.89986085s-.04299796.0285477-.12899387.085643c-.08599592.0570954-.12201369.1427384-.10805331.2569291 0 .1141907.01786928.210643.05360784.289357.03573856.0787139.07538603.125.1189424.138858l.06449694.0432373h10.71905575v-2.9542683zm-4.3991936 3.8106985h-.8191949v2.077051h-9.8563045c0 .0144124-.02149898.0144124-.06449694 0-.04299795-.0144125-.08962561.0105321-.13988296.0748337-.05025735.0643015-.07538603.1607538-.07538603.289357 0 .1141906.02149898.2070399.06449694.2785476.04299795.0715078.08599591.1141907.12899387.1280488l.06449693.0216186h10.69811519v-2.8686252z\"\n />\n </g>\n </svg>\n`;\n\n/* <iaux-in-sort-files-button> side panel header button */\n@customElement('iaux-in-sort-files-button')\nexport class IauxSortFilesButton extends LitElement {\n @property({ type: Array }) fileListRaw: any[] = [];\n\n @property({ type: Array }) fileListSorted: any[] = [];\n\n @property({ type: String, reflect: true }) sortOrderBy: sortOptions =\n 'default';\n\n render() {\n return html`<div class=\"sort-multi-file-list\">${this.sortButton}</div>`;\n }\n\n get sortButton() {\n const sortIcons = {\n default: html`\n <button\n class=\"sort-by neutral-icon\"\n aria-label=\"Sort volumes in initial order\"\n @click=${() => this.sortVolumes('title_asc')}\n >\n ${sortNeutralIcon}\n </button>\n `,\n title_asc: html`\n <button\n class=\"sort-by asc-icon\"\n aria-label=\"Sort volumes in ascending order\"\n @click=${() => this.sortVolumes('title_desc')}\n >\n ${sortAscIcon}\n </button>\n `,\n title_desc: html`\n <button\n class=\"sort-by desc-icon\"\n aria-label=\"Sort volumes in descending order\"\n @click=${() => this.sortVolumes('default')}\n >\n ${sortDescIcon}\n </button>\n `,\n };\n\n return sortIcons[this.sortOrderBy];\n }\n\n sortVolumes(sortType: sortOptions) {\n this.sortOrderBy = sortType;\n let sortedFiles = [];\n\n sortedFiles = this.fileListRaw.sort((a, b) => {\n if (sortType === 'title_asc') return a.title.localeCompare(b.title);\n if (sortType === 'title_desc') return b.title.localeCompare(a.title);\n return a.orig_sort - b.orig_sort;\n });\n\n this.dispatchEvent(\n new CustomEvent('fileListSorted', {\n detail: {\n sortType,\n sortedFiles,\n },\n bubbles: true,\n composed: true,\n }),\n );\n this.fileListSorted = sortedFiles;\n }\n\n static get styles() {\n return css`\n button.sort-by {\n padding: 0px;\n background-color: transparent;\n border: 0px;\n --iconWidth: var(--menuSliderHeaderIconWidth);\n --iconHeight: var(--menuSliderHeaderIconHeight);\n }\n `;\n }\n}\n\n/* <iaux-in-viewable-files-panel> side panel menu */\n@customElement('iaux-in-viewable-files-panel')\nexport class IauxViewableFiles extends LitElement {\n @property({ type: String }) baseHost: string = 'archive.org';\n\n @property({ type: String }) sortOrderBy:\n | 'default'\n | 'title_asc'\n | 'title_desc' = 'default';\n\n @property({ type: String }) subPrefix: string = '';\n\n @property({ type: Array }) fileList: any[] = [];\n\n @property({ type: Boolean, reflect: true }) addSortToUrl = false;\n\n firstUpdated() {\n const activeFile = this.shadowRoot!.querySelector('.content.active') as any;\n // allow for css animations to run before scrolling to active file\n setTimeout(() => {\n // scroll active file into view if needed\n // note:\n // - `scrollIntoViewIfNeeded` handles auto-scroll gracefully for Chrome, Safari\n // - `scrollIntoView` handles auto-scroll for almost all the browsers. specifially FF.\n if (activeFile?.scrollIntoViewIfNeeded) {\n // `scrollIntoViewIfNeeded` auto-scroll only if element not is visible area\n activeFile?.scrollIntoViewIfNeeded(true);\n } else {\n // `scrollIntoView` always auto-scroll to center of visible area\n activeFile?.scrollIntoView({\n behavior: 'smooth',\n block: 'nearest',\n inline: 'nearest',\n });\n }\n }, 350);\n }\n\n volumeItemWithImageTitle(item: ItemInfo) {\n const hrefUrl = this.fileUrl(item);\n\n return html`\n <li class=\"content active\">\n <div class=\"separator\"></div>\n <a class=\"container\" href=\"${hrefUrl}\">\n <div class=\"image\">\n <img src=\"${item.image}\" alt=\"preview\" />\n </div>\n <div class=\"text\">\n <p class=\"item-title\">${item.title}</p>\n <small>by: ${item.author}</small>\n </div>\n </a>\n </li>\n `;\n }\n\n fileUrl(item: ItemInfo) {\n const baseUrl = `//${this.baseHost}${item.url_path}`;\n let hrefUrl = baseUrl;\n if (this.addSortToUrl) {\n hrefUrl =\n this.sortOrderBy === 'default'\n ? `${baseUrl}`\n : `${baseUrl}?sort=${this.sortOrderBy}`;\n }\n return hrefUrl;\n }\n\n get pdfLabel(): TemplateResult {\n return html`<span class=\"pdf-label\"\n ><span class=\"sr-only\">view this</span> PDF</span\n >`;\n }\n\n fileLi(item: ItemInfo): TemplateResult {\n const activeClass = this.subPrefix === item.file_subprefix ? ' active' : '';\n const hrefUrl = this.fileUrl(item);\n const isPdf = (item.file_source ?? '').match(/^[^+]+\\.pdf$/i);\n\n return html`\n <li>\n <div class=\"separator\"></div>\n <div class=\"content${activeClass}\">\n <a href=${hrefUrl}>\n <p class=\"item-title\">\n ${item.title}${isPdf ? this.pdfLabel : nothing}\n </p>\n </a>\n </div>\n </li>\n `;\n }\n\n get fileListTemplate(): TemplateResult {\n const filesDisplay = repeat(\n this.fileList,\n file => file?.file_prefix,\n this.fileLi.bind(this),\n );\n return html`\n <ul>\n ${filesDisplay}\n <div class=\"separator\"></div>\n </ul>\n `;\n }\n\n render() {\n return html` ${this.fileList.length ? this.fileListTemplate : nothing} `;\n }\n\n static get styles() {\n return css`\n :host {\n display: block;\n overflow-y: auto;\n box-sizing: border-box;\n color: var(--primaryTextColor);\n margin-top: 14px;\n margin-bottom: 2rem;\n --activeBorderWidth: 2px;\n }\n\n a {\n color: #ffffff;\n text-decoration: none;\n }\n\n img {\n width: 35px;\n height: 45px;\n }\n\n ul {\n padding: 0;\n list-style: none;\n margin: var(--activeBorderWidth) 0.5rem 1rem 0;\n }\n\n ul > li:first-child .separator {\n display: none;\n }\n\n li {\n cursor: pointer;\n position: relative;\n }\n\n li .content {\n padding: 2px 0 4px 2px;\n border: var(--activeBorderWidth) solid transparent;\n padding: 0.2rem 0 0.4rem 0.2rem;\n }\n\n li .content.active {\n border: var(--activeBorderWidth) solid #538bc5;\n }\n\n li.content a {\n display: flex;\n }\n\n small {\n font-style: italic;\n white-space: initial;\n }\n\n .container {\n display: flex;\n align-items: center;\n justify-content: center;\n }\n\n .item-title {\n margin-block-start: 0em;\n margin-block-end: 0em;\n font-size: 14px;\n font-weight: bold;\n word-wrap: break-word;\n padding-left: 5px;\n }\n\n .separator {\n background-color: var(--secondaryBGColor);\n width: 98%;\n margin: 1px auto;\n height: 1px;\n }\n\n .text {\n padding-left: 10px;\n }\n\n .icon {\n display: inline-block;\n width: 14px;\n height: 14px;\n margin-left: 0.7rem;\n border: 1px solid var(--primaryTextColor);\n border-radius: 2px;\n background: var(--activeButtonBg) 50% 50% no-repeat;\n }\n\n .pdf-label {\n border: 1px solid;\n padding: 2px 5px;\n border-radius: 20px;\n display: inline-block;\n margin-left: 5px;\n font-size: 0.9rem;\n }\n\n .pdf-label .sr-only {\n position: absolute;\n clip: rect(1px, 1px, 1px, 1px);\n padding: 0;\n border: 0;\n height: 1px;\n width: 1px;\n overflow: hidden;\n }\n `;\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"no-theater-available.js","sourceRoot":"","sources":["../../src/no-theater-available.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EAIJ,GAAG,GACJ,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGrD,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU;IAA7C;;QACuB,eAAU,GAAY,EAAE,CAAC;IAuEvD,CAAC;IArEC,UAAU;QACR,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAsB,qBAAqB,EAAE;YAC1D,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACzB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAAuB;QAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YAC7B,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;IACH,CAAC;IAED,IAAI,WAAW;QACb,OAAO,aAAa,IAAI,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;kBASG,IAAI,CAAC,WAAW;;KAE7B,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiCT,CAAC;IACJ,CAAC;CACF,CAAA;AAvE6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA0B;AAD1C,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAwEhC","sourcesContent":["import {\n LitElement,\n html,\n TemplateResult,\n PropertyValues,\n CSSResult,\n css,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\n@customElement('ia-no-theater-available')\nexport class IANoTheaterAvailable extends LitElement {\n @property({ type: String }) identifier?: string = '';\n\n emitLoaded(): void {\n this.dispatchEvent(\n new CustomEvent<{ loaded: boolean }>('loadingStateUpdated', {\n detail: { loaded: true },\n }),\n );\n }\n\n updated(changed: PropertyValues): void {\n if (changed.has('identifier')) {\n this.emitLoaded();\n }\n }\n\n get downloadUrl(): string {\n return `/download/${this.identifier}`;\n }\n\n render(): TemplateResult {\n return html`\n <section>\n <h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>\n <p>\n This item does not appear to have any files that can be experienced on\n Archive.org. <br />\n Please download files in this item to interact with them on your\n computer.\n </p>\n <a href=${this.downloadUrl}>Show all files</a>\n </section>\n `;\n }\n\n static get styles(): CSSResult {\n return css`\n :host {\n color: var(--primaryTextColor, #fff);\n text-align: center;\n }\n section {\n width: 100%;\n margin: 5%;\n padding: 0 5%;\n }\n p {\n font-size: 1.4rem;\n }\n a {\n color: var(--primaryTextColor, #fff);\n background-color: rgb(25, 72, 128);\n min-height: 35px;\n cursor: pointer;\n line-height: normal;\n border-radius: 0.4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n display: inline-block;\n padding: 0.85rem 1.2rem;\n border: 1px solid rgb(197, 209, 223);\n white-space: nowrap;\n appearance: auto;\n box-sizing: border-box;\n user-select: none;\n text-decoration: none;\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"no-theater-available.js","sourceRoot":"","sources":["../../src/no-theater-available.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,IAAI,EAIJ,GAAG,GACJ,MAAM,KAAK,CAAC;AACb,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAGrD,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,UAAU;IAA7C;;QACuB,eAAU,GAAY,EAAE,CAAC;IAuEvD,CAAC;IArEC,UAAU;QACR,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAsB,qBAAqB,EAAE;YAC1D,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACzB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAAuB;QAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YAC9B,IAAI,CAAC,UAAU,EAAE,CAAC;QACpB,CAAC;IACH,CAAC;IAED,IAAI,WAAW;QACb,OAAO,aAAa,IAAI,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;kBASG,IAAI,CAAC,WAAW;;KAE7B,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiCT,CAAC;IACJ,CAAC;CACF,CAAA;AAvE6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA0B;AAD1C,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAwEhC","sourcesContent":["import {\n LitElement,\n html,\n TemplateResult,\n PropertyValues,\n CSSResult,\n css,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\n\n@customElement('ia-no-theater-available')\nexport class IANoTheaterAvailable extends LitElement {\n @property({ type: String }) identifier?: string = '';\n\n emitLoaded(): void {\n this.dispatchEvent(\n new CustomEvent<{ loaded: boolean }>('loadingStateUpdated', {\n detail: { loaded: true },\n }),\n );\n }\n\n updated(changed: PropertyValues): void {\n if (changed.has('identifier')) {\n this.emitLoaded();\n }\n }\n\n get downloadUrl(): string {\n return `/download/${this.identifier}`;\n }\n\n render(): TemplateResult {\n return html`\n <section>\n <h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>\n <p>\n This item does not appear to have any files that can be experienced on\n Archive.org. <br />\n Please download files in this item to interact with them on your\n computer.\n </p>\n <a href=${this.downloadUrl}>Show all files</a>\n </section>\n `;\n }\n\n static get styles(): CSSResult {\n return css`\n :host {\n color: var(--primaryTextColor, #fff);\n text-align: center;\n }\n section {\n width: 100%;\n margin: 5%;\n padding: 0 5%;\n }\n p {\n font-size: 1.4rem;\n }\n a {\n color: var(--primaryTextColor, #fff);\n background-color: rgb(25, 72, 128);\n min-height: 35px;\n cursor: pointer;\n line-height: normal;\n border-radius: 0.4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n display: inline-block;\n padding: 0.85rem 1.2rem;\n border: 1px solid rgb(197, 209, 223);\n white-space: nowrap;\n appearance: auto;\n box-sizing: border-box;\n user-select: none;\n text-decoration: none;\n }\n `;\n }\n}\n"]}
@@ -27,18 +27,13 @@ describe('<iaux-in-share-panel>', () => {
27
27
  it('renders buttons for each sharing method', async () => {
28
28
  const el = (await fixture(container()));
29
29
  await el.updateComplete;
30
- el.sharingOptions.forEach(option => {
31
- const button = el.shadowRoot && el.shadowRoot.querySelector(`a.${option.class}`);
30
+ el.sharingOptions.forEach((option, i) => {
31
+ var _a;
32
+ const button = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelectorAll('a')[i];
32
33
  expect(button).to.exist;
33
34
  expect(button === null || button === void 0 ? void 0 : button.getAttribute('href')).to.equal(option.url);
34
35
  });
35
36
  });
36
- it('toggles visibility of embed options', async () => {
37
- const el = (await fixture(container()));
38
- el.toggleEmbedOptions(new Event('click'));
39
- await el.updateComplete;
40
- expect(el.embedOptionsVisible).to.equal(true);
41
- });
42
37
  it('does not show internal header by default', async () => {
43
38
  var _a;
44
39
  const el = (await fixture(container()));
@@ -52,12 +47,9 @@ describe('<iaux-in-share-panel>', () => {
52
47
  expect((_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('header')).to.not.be.null;
53
48
  });
54
49
  it('sets file subprefix to end of share URLs if present', async () => {
55
- const optionalFileSubprefix = 'foo- bar - 123-';
56
- const el = (await fixture(container(optionalFileSubprefix)));
50
+ const el = (await fixture(container('foo 123')));
57
51
  el.sharingOptions.forEach(option => {
58
- if (option.name !== 'Tumblr') {
59
- expect(option.url).to.contain(encodeURIComponent(optionalFileSubprefix));
60
- }
52
+ expect(option.url).to.contain('foo+123');
61
53
  });
62
54
  });
63
55
  });
@@ -1 +1 @@
1
- {"version":3,"file":"iaux-sharing-options.test.js","sourceRoot":"","sources":["../../test/iaux-sharing-options.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,0BAA0B,CAAC;AAGlC,MAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC;AACxB,MAAM,OAAO,GAAG,gBAAgB,CAAC;AACjC,MAAM,WAAW,GACf,oGAAoG,CAAC;AAEvG,MAAM,SAAS,GAAG,CAAC,qBAAqB,GAAG,EAAE,EAAE,EAAE,CAC/C,IAAI,CAAA;kBACY,UAAU;YAChB,QAAQ;eACL,OAAO;mBACH,WAAW;;qBAET,qBAAqB;0BAChB,CAAC;AAE3B,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC,CAAuB,CAAC;QAE9D,MAAM,CAAC,E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C,CAAC","sourcesContent":["import { html, fixture, expect } from '@open-wc/testing';\nimport sinon from 'sinon';\nimport '../src/menus/share-panel';\nimport type { IauxSharingOptions } from '../src/menus/share-panel';\n\nconst identifier = 'goody';\nconst itemType = 'book';\nconst creator = 'Welsh, Charles';\nconst description =\n 'The history of Little Goody Two-Shoes : otherwise called Mrs. Margery Two-Shoes ... [1766 edition]';\n\nconst container = (optionalFileSubprefix = '') =>\n html`<iaux-in-share-panel\n identifier=\"${identifier}\"\n type=\"${itemType}\"\n creator=\"${creator}\"\n description=\"${description}\"\n baseHost=\"archive.org\"\n fileSubPrefix=\"${optionalFileSubprefix}\"\n ></iaux-in-share-panel>`;\n\ndescribe('<iaux-in-share-panel>', () => {\n afterEach(() => {\n sinon.restore();\n });\n\n it('sets default properties', async () => {\n const el = (await fixture(container())) as IauxSharingOptions;\n\n expect(el.identifier).to.equal(identifier);\n expect(el.type).to.equal(itemType);\n expect(el.creator).to.equal(creator);\n expect(el.description).to.equal(description);\n });\n\n it('renders buttons for each sharing method', async () => {\n const el = (await fixture(container())) as IauxSharingOptions;\n\n await el.updateComplete;\n\n el.sharingOptions.forEach(option => {\n const button =\n el.shadowRoot && el.shadowRoot.querySelector(`a.${option.class}`);\n expect(button).to.exist;\n expect(button?.getAttribute('href')).to.equal(option.url);\n });\n });\n\n it('toggles visibility of embed options', async () => {\n const el = (await fixture(container())) as IauxSharingOptions;\n\n el.toggleEmbedOptions(new Event('click'));\n await el.updateComplete;\n\n expect(el.embedOptionsVisible).to.equal(true);\n });\n\n it('does not show internal header by default', async () => {\n const el = (await fixture(container())) as IauxSharingOptions;\n expect(el.shadowRoot?.querySelector('header')).to.be.null;\n });\n\n it('does shows internal header when requested', async () => {\n const el = (await fixture(container())) as IauxSharingOptions;\n el.renderHeader = true;\n await el.updateComplete;\n expect(el.shadowRoot?.querySelector('header')).to.not.be.null;\n });\n\n it('sets file subprefix to end of share URLs if present', async () => {\n const optionalFileSubprefix = 'foo- bar - 123-';\n const el = (await fixture(\n container(optionalFileSubprefix),\n )) as IauxSharingOptions;\n\n el.sharingOptions.forEach(option => {\n if (option.name !== 'Tumblr') {\n expect(option.url).to.contain(\n encodeURIComponent(optionalFileSubprefix),\n );\n }\n });\n });\n});\n"]}
1
+ {"version":3,"file":"iaux-sharing-options.test.js","sourceRoot":"","sources":["../../test/iaux-sharing-options.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,0BAA0B,CAAC;AAGlC,MAAM,UAAU,GAAG,OAAO,CAAC;AAC3B,MAAM,QAAQ,GAAG,MAAM,CAAC;AACxB,MAAM,OAAO,GAAG,gBAAgB,CAAC;AACjC,MAAM,WAAW,GACf,oGAAoG,CAAC;AAEvG,MAAM,SAAS,GAAG,CAAC,qBAAqB,GAAG,EAAE,EAAE,EAAE,CAC/C,IAAI,CAAA;kBACY,UAAU;YAChB,QAAQ;eACL,OAAO;mBACH,WAAW;;qBAET,qBAAqB;0BAChB,CAAC;AAE3B,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,SAAS,CAAC,GAAG,EAAE;QACb,KAAK,CAAC,OAAO,EAAE,CAAC;IAClB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,SAAS,EAAE,CAAC,CAAuB,CAAC;QAE9D,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;QACnC,MAAM,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;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AAE,CAAC,UAAU,0CAAE,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,KAAK,IAAI,EAAE;QACnE,MAAM,EAAE,GAAG,CAAC,MAAM,OAAO,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAuB,CAAC;QAEvE,EAAE,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;YACjC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;QAC3C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { html, fixture, expect } from '@open-wc/testing';\nimport sinon from 'sinon';\nimport '../src/menus/share-panel';\nimport type { IauxSharingOptions } from '../src/menus/share-panel';\n\nconst identifier = 'goody';\nconst itemType = 'book';\nconst creator = 'Welsh, Charles';\nconst description =\n 'The history of Little Goody Two-Shoes : otherwise called Mrs. Margery Two-Shoes ... [1766 edition]';\n\nconst container = (optionalFileSubprefix = '') =>\n html`<iaux-in-share-panel\n identifier=\"${identifier}\"\n type=\"${itemType}\"\n creator=\"${creator}\"\n description=\"${description}\"\n baseHost=\"archive.org\"\n fileSubPrefix=\"${optionalFileSubprefix}\"\n ></iaux-in-share-panel>`;\n\ndescribe('<iaux-in-share-panel>', () => {\n afterEach(() => {\n sinon.restore();\n });\n\n it('sets default properties', async () => {\n const el = (await fixture(container())) as IauxSharingOptions;\n\n expect(el.identifier).to.equal(identifier);\n expect(el.type).to.equal(itemType);\n expect(el.creator).to.equal(creator);\n expect(el.description).to.equal(description);\n });\n\n it('renders buttons for each sharing method', async () => {\n const el = (await fixture(container())) as IauxSharingOptions;\n\n await el.updateComplete;\n\n el.sharingOptions.forEach((option, i) => {\n const button = el.shadowRoot?.querySelectorAll('a')[i];\n expect(button).to.exist;\n expect(button?.getAttribute('href')).to.equal(option.url);\n });\n });\n\n it('does not show internal header by default', async () => {\n const el = (await fixture(container())) as IauxSharingOptions;\n expect(el.shadowRoot?.querySelector('header')).to.be.null;\n });\n\n it('does shows internal header when requested', async () => {\n const el = (await fixture(container())) as IauxSharingOptions;\n el.renderHeader = true;\n await el.updateComplete;\n expect(el.shadowRoot?.querySelector('header')).to.not.be.null;\n });\n\n it('sets file subprefix to end of share URLs if present', async () => {\n const el = (await fixture(container('foo 123'))) as IauxSharingOptions;\n\n el.sharingOptions.forEach(option => {\n expect(option.url).to.contain('foo+123');\n });\n });\n});\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@internetarchive/ia-item-navigator",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "Internet Archive's Item Navigator, visually explore an item's contents.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,7 +1,5 @@
1
1
  /* eslint-disable lit-a11y/click-events-have-key-events */
2
2
  /* eslint-disable lit-a11y/list */
3
- import { classMap } from 'lit/directives/class-map.js';
4
- import { ifDefined } from 'lit/directives/if-defined.js';
5
3
  import {
6
4
  css,
7
5
  CSSResult,
@@ -12,19 +10,22 @@ import {
12
10
  TemplateResult,
13
11
  } from 'lit';
14
12
  import { customElement, property } from 'lit/decorators.js';
15
- import '@internetarchive/icon-link/icon-link';
16
13
  import '@internetarchive/icon-share/icon-share';
14
+ import '@internetarchive/icon-twitter/icon-twitter';
15
+ import '@internetarchive/icon-facebook/icon-facebook';
16
+ import '@internetarchive/icon-tumblr/icon-tumblr';
17
+ import '@internetarchive/icon-pinterest/icon-pinterest';
18
+ import '@internetarchive/icon-email/icon-email';
19
+ import '@internetarchive/icon-link/icon-link';
17
20
 
18
- import EmailProvider from './share-providers/email';
19
- import FacebookProvider from './share-providers/facebook';
20
- import PinterestProvider from './share-providers/pinterest';
21
- import TumblrProvider from './share-providers/tumblr';
22
- import TwitterProvider from './share-providers/twitter';
23
- import { ProviderParams } from './share-providers/share-provider-interface';
24
- import type Provider from './share-providers/provider';
21
+ type ShareOption = {
22
+ name: string;
23
+ icon: TemplateResult | string;
24
+ url: string;
25
+ };
25
26
 
26
- const copyToClipboard = (options: Record<any, any>) => {
27
- const currentTarget = options.currentTarget as HTMLElement;
27
+ const copyToClipboard = (event: MouseEvent) => {
28
+ const currentTarget = event.currentTarget as HTMLElement;
28
29
  const textarea = currentTarget.querySelector('textarea');
29
30
  const note = currentTarget.querySelector('small') as any;
30
31
  textarea!.select();
@@ -51,7 +52,7 @@ export class IauxSharingOptions extends LitElement {
51
52
 
52
53
  @property({ type: String }) identifier = '';
53
54
 
54
- @property({ type: Array }) sharingOptions: Provider[] = [];
55
+ @property({ type: Array }) sharingOptions: ShareOption[] = [];
55
56
 
56
57
  @property({ type: String }) type = '';
57
58
 
@@ -66,55 +67,74 @@ export class IauxSharingOptions extends LitElement {
66
67
  }
67
68
 
68
69
  loadProviders() {
69
- const { baseHost, creator, description, identifier, type, fileSubPrefix } =
70
- this;
71
- const params = {
72
- baseHost,
73
- creator,
74
- description,
75
- identifier,
76
- type,
77
- fileSubPrefix,
78
- } as unknown as ProviderParams;
70
+ let shareUrl = `https://${this.baseHost}/details/${this.identifier}`;
71
+ if (this.fileSubPrefix) {
72
+ shareUrl += `/${this.fileSubPrefix}`;
73
+ }
74
+ const shareBlurb = [
75
+ this.description,
76
+ this.creator,
77
+ 'Free Download, Borrow, and Streaming',
78
+ 'Internet Archive',
79
+ ]
80
+ .filter(Boolean)
81
+ .join(' : ');
79
82
 
80
83
  this.sharingOptions = [
81
- new TwitterProvider(params),
82
- new FacebookProvider(params),
83
- new TumblrProvider(params),
84
- new PinterestProvider(params),
85
- new EmailProvider(params),
84
+ {
85
+ name: 'Twitter',
86
+ icon: html`<ia-icon-twitter></ia-icon-twitter>`,
87
+ url: `https://twitter.com/intent/tweet?${new URLSearchParams({
88
+ url: shareUrl,
89
+ text: shareBlurb,
90
+ via: 'internetarchive',
91
+ })}`,
92
+ },
93
+ {
94
+ name: 'Facebook',
95
+ icon: html`<ia-icon-facebook></ia-icon-facebook>`,
96
+ url: `https://www.facebook.com/sharer/sharer.php?${new URLSearchParams({
97
+ u: shareUrl,
98
+ })}`,
99
+ },
100
+ {
101
+ name: 'Tumblr',
102
+ icon: html`<ia-icon-tumblr></ia-icon-tumblr>`,
103
+ url: `https://www.tumblr.com/widgets/share/tool/preview?${new URLSearchParams(
104
+ {
105
+ posttype: 'link',
106
+ canonicalUrl: shareUrl,
107
+ title: shareBlurb,
108
+ },
109
+ )}`,
110
+ },
111
+ {
112
+ name: 'Pinterest',
113
+ icon: html`<ia-icon-pinterest></ia-icon-pinterest>`,
114
+ url: `http://www.pinterest.com/pin/create/button/?${new URLSearchParams(
115
+ {
116
+ url: shareUrl,
117
+ description: shareBlurb,
118
+ },
119
+ )}`,
120
+ },
121
+ {
122
+ name: 'Email',
123
+ icon: html`<ia-icon-email></ia-icon-email>`,
124
+ url: `mailto:?${new URLSearchParams({
125
+ subject: shareBlurb,
126
+ body: shareUrl,
127
+ })}`,
128
+ },
86
129
  ];
87
130
  }
88
131
 
89
- get sharingItems() {
90
- return this.sharingOptions.map(
91
- option =>
92
- html`<li>
93
- <a
94
- class="${ifDefined(option.class)}"
95
- href="${option.url}"
96
- target="_blank"
97
- >
98
- ${option.icon} ${option.name}
99
- </a>
100
- </li>`,
101
- );
102
- }
103
-
104
- get embedOption() {
105
- return html`<li>
106
- <a href="#" @click=${this.toggleEmbedOptions}>
107
- <ia-icon-link></ia-icon-link>
108
- Get an embeddable link
109
- </a>
110
- </li>`;
111
- }
112
-
113
132
  get iframeEmbed() {
114
- return html`&lt;iframe
115
- src="https://${this.baseHost}/embed/${this.identifier}" width="560"
116
- height="384" frameborder="0" webkitallowfullscreen="true"
117
- mozallowfullscreen="true" allowfullscreen&gt;&lt;/iframe&gt;`;
133
+ return `<iframe
134
+ src="https://${this.baseHost}/embed/${this.identifier}"
135
+ width="560" height="384" frameborder="0"
136
+ webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen
137
+ ></iframe>`;
118
138
  }
119
139
 
120
140
  get bbcodeEmbed() {
@@ -125,11 +145,6 @@ export class IauxSharingOptions extends LitElement {
125
145
  return `https://${this.baseHost}/help/audio.php?identifier=${this.identifier}`;
126
146
  }
127
147
 
128
- toggleEmbedOptions(e: Event) {
129
- e.preventDefault();
130
- this.embedOptionsVisible = !this.embedOptionsVisible;
131
- }
132
-
133
148
  get header() {
134
149
  const header = html`<header><h3>Share this ${this.type}</h3></header>`;
135
150
  return this.renderHeader ? header : nothing;
@@ -138,32 +153,41 @@ export class IauxSharingOptions extends LitElement {
138
153
  render() {
139
154
  return html`
140
155
  ${this.header}
141
- <ul>
142
- ${this.sharingItems} ${this.embedOption}
143
- <div
144
- class=${classMap({ visible: this.embedOptionsVisible, embed: true })}
145
- >
146
- <h4>Embed</h4>
147
- <div class="code" @click=${copyToClipboard}>
148
- <textarea readonly>${this.iframeEmbed}</textarea>
149
- <small>Copied to clipboard</small>
150
- </div>
151
- <h4>
152
- Embed for wordpress.com hosted blogs and archive.org item
153
- &lt;description&gt; tags
154
- </h4>
155
- <div class="code" @click=${copyToClipboard}>
156
- <textarea readonly>${this.bbcodeEmbed}</textarea>
157
- <small>Copied to clipboard</small>
156
+ <main>
157
+ ${this.sharingOptions.map(
158
+ option =>
159
+ html` <a class="share-option" href="${option.url}" target="_blank">
160
+ ${option.icon} ${option.name}
161
+ </a>`,
162
+ )}
163
+ <details>
164
+ <summary class="share-option">
165
+ <ia-icon-link></ia-icon-link>
166
+ Get an embeddable link
167
+ </summary>
168
+ <div class="embed">
169
+ <h4>Embed</h4>
170
+ <div class="code" @click=${copyToClipboard}>
171
+ <textarea readonly>${this.iframeEmbed}</textarea>
172
+ <small>Copied to clipboard</small>
173
+ </div>
174
+ <h4>
175
+ Embed for wordpress.com hosted blogs and archive.org item
176
+ &lt;description&gt; tags
177
+ </h4>
178
+ <div class="code" @click=${copyToClipboard}>
179
+ <textarea readonly>${this.bbcodeEmbed}</textarea>
180
+ <small>Copied to clipboard</small>
181
+ </div>
182
+ <p>
183
+ Want more?
184
+ <a href=${this.helpURL}
185
+ >Advanced embedding details, examples, and help</a
186
+ >!
187
+ </p>
158
188
  </div>
159
- <p>
160
- Want more?
161
- <a href=${this.helpURL}
162
- >Advanced embedding details, examples, and help</a
163
- >!
164
- </p>
165
- </div>
166
- </ul>
189
+ </details>
190
+ </main>
167
191
  `;
168
192
  }
169
193
 
@@ -198,22 +222,20 @@ export class IauxSharingOptions extends LitElement {
198
222
  font-size: 1.4rem;
199
223
  }
200
224
 
201
- ul {
202
- padding: 0 0 2rem 0;
203
- list-style: none;
225
+ main {
226
+ padding: 1rem 0;
204
227
  }
205
228
 
206
- li {
207
- padding: 0 0 1rem 0;
208
- }
209
-
210
- li a {
229
+ .share-option {
230
+ display: block;
231
+ padding: 0.5rem 0;
211
232
  font-size: 1.6rem;
212
233
  text-decoration: none;
213
234
  color: var(--shareLinkColor);
235
+ cursor: pointer;
214
236
  }
215
237
 
216
- li a * {
238
+ .share-option > * {
217
239
  display: inline-block;
218
240
  padding: 0.2rem;
219
241
  margin-right: 1rem;
@@ -223,12 +245,17 @@ export class IauxSharingOptions extends LitElement {
223
245
  background: var(--shareIconBg);
224
246
  }
225
247
 
226
- .embed {
248
+ /* Hide the triangle that appears on details tags */
249
+ summary::marker {
250
+ content: '';
251
+ }
252
+
253
+ summary::-webkit-details-marker {
227
254
  display: none;
228
255
  }
229
- .embed.visible {
230
- display: block;
231
- width: 95%;
256
+
257
+ .embed {
258
+ padding-right: 5px;
232
259
  }
233
260
 
234
261
  .embed a {
@@ -38,23 +38,13 @@ describe('<iaux-in-share-panel>', () => {
38
38
 
39
39
  await el.updateComplete;
40
40
 
41
- el.sharingOptions.forEach(option => {
42
- const button =
43
- el.shadowRoot && el.shadowRoot.querySelector(`a.${option.class}`);
41
+ el.sharingOptions.forEach((option, i) => {
42
+ const button = el.shadowRoot?.querySelectorAll('a')[i];
44
43
  expect(button).to.exist;
45
44
  expect(button?.getAttribute('href')).to.equal(option.url);
46
45
  });
47
46
  });
48
47
 
49
- it('toggles visibility of embed options', async () => {
50
- const el = (await fixture(container())) as IauxSharingOptions;
51
-
52
- el.toggleEmbedOptions(new Event('click'));
53
- await el.updateComplete;
54
-
55
- expect(el.embedOptionsVisible).to.equal(true);
56
- });
57
-
58
48
  it('does not show internal header by default', async () => {
59
49
  const el = (await fixture(container())) as IauxSharingOptions;
60
50
  expect(el.shadowRoot?.querySelector('header')).to.be.null;
@@ -68,17 +58,10 @@ describe('<iaux-in-share-panel>', () => {
68
58
  });
69
59
 
70
60
  it('sets file subprefix to end of share URLs if present', async () => {
71
- const optionalFileSubprefix = 'foo- bar - 123-';
72
- const el = (await fixture(
73
- container(optionalFileSubprefix),
74
- )) as IauxSharingOptions;
61
+ const el = (await fixture(container('foo 123'))) as IauxSharingOptions;
75
62
 
76
63
  el.sharingOptions.forEach(option => {
77
- if (option.name !== 'Tumblr') {
78
- expect(option.url).to.contain(
79
- encodeURIComponent(optionalFileSubprefix),
80
- );
81
- }
64
+ expect(option.url).to.contain('foo+123');
82
65
  });
83
66
  });
84
67
  });
@@ -1,11 +0,0 @@
1
- import '@internetarchive/icon-email/icon-email';
2
- import { TemplateResult } from 'lit';
3
- import Provider from './provider';
4
- import type { ProviderParams } from './share-provider-interface';
5
- export default class extends Provider {
6
- name: string;
7
- icon: TemplateResult;
8
- class: string;
9
- constructor(params: ProviderParams);
10
- get url(): string;
11
- }
@@ -1,15 +0,0 @@
1
- import '@internetarchive/icon-email/icon-email';
2
- import { html } from 'lit';
3
- import Provider from './provider';
4
- export default class extends Provider {
5
- constructor(params) {
6
- super(params);
7
- this.name = 'Email';
8
- this.icon = html `<ia-icon-email></ia-icon-email>`;
9
- this.class = 'email';
10
- }
11
- get url() {
12
- return `mailto:?body=https://${this.baseHost}/details/${this.itemPath}&subject=${this.description} : ${this.creator}${this.promoCopy}`;
13
- }
14
- }
15
- //# sourceMappingURL=email.js.map