@internetarchive/ia-item-navigator 0.0.0 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. package/README.md +29 -19
  2. package/demo/app-root.ts +113 -22
  3. package/demo/index.html +12 -4
  4. package/dist/demo/app-root.d.ts +27 -7
  5. package/dist/demo/app-root.js +98 -23
  6. package/dist/demo/app-root.js.map +1 -1
  7. package/dist/src/interfaces/custom-theater-interface.d.ts +20 -0
  8. package/dist/src/interfaces/custom-theater-interface.js +2 -0
  9. package/dist/src/interfaces/custom-theater-interface.js.map +1 -0
  10. package/dist/src/interfaces/event-interfaces.d.ts +13 -23
  11. package/dist/src/interfaces/event-interfaces.js.map +1 -1
  12. package/dist/src/interfaces/menu-interfaces.d.ts +7 -7
  13. package/dist/src/interfaces/menu-interfaces.js.map +1 -1
  14. package/dist/src/interfaces/nav-controller-interface.d.ts +11 -6
  15. package/dist/src/interfaces/nav-controller-interface.js.map +1 -1
  16. package/dist/src/item-inspector/files-by-type/files-by-type-provider.js +5 -3
  17. package/dist/src/item-inspector/files-by-type/files-by-type-provider.js.map +1 -1
  18. package/dist/src/item-inspector/files-by-type/ia-files-by-type.d.ts +1 -0
  19. package/dist/src/item-inspector/files-by-type/ia-files-by-type.js +14 -0
  20. package/dist/src/item-inspector/files-by-type/ia-files-by-type.js.map +1 -1
  21. package/dist/src/item-inspector/item-inspector.d.ts +0 -31
  22. package/dist/src/item-inspector/item-inspector.js +253 -181
  23. package/dist/src/item-inspector/item-inspector.js.map +1 -1
  24. package/dist/src/item-inspector/visual-mod-provider.d.ts +19 -0
  25. package/dist/src/item-inspector/visual-mod-provider.js +46 -0
  26. package/dist/src/item-inspector/visual-mod-provider.js.map +1 -0
  27. package/dist/src/item-navigator.d.ts +50 -28
  28. package/dist/src/item-navigator.js +216 -132
  29. package/dist/src/item-navigator.js.map +1 -1
  30. package/dist/src/loader.d.ts +5 -0
  31. package/dist/src/loader.js +8 -2
  32. package/dist/src/loader.js.map +1 -1
  33. package/dist/src/no-theater-available.d.ts +9 -0
  34. package/dist/src/no-theater-available.js +79 -0
  35. package/dist/src/no-theater-available.js.map +1 -0
  36. package/dist/test/book-nav-stub.d.ts +22 -0
  37. package/dist/test/book-nav-stub.js +49 -0
  38. package/dist/test/book-nav-stub.js.map +1 -0
  39. package/dist/test/ia-item-navigator.test.d.ts +2 -0
  40. package/dist/test/ia-item-navigator.test.js +317 -0
  41. package/dist/test/ia-item-navigator.test.js.map +1 -0
  42. package/dist/test/ia-stub-goody.d.ts +210 -0
  43. package/dist/test/ia-stub-goody.js +276 -0
  44. package/dist/test/ia-stub-goody.js.map +1 -0
  45. package/dist/test/ia-stub.d.ts +22 -0
  46. package/dist/test/ia-stub.js +35 -0
  47. package/dist/test/ia-stub.js.map +1 -0
  48. package/dist/test/no-theater-available.test.d.ts +1 -0
  49. package/dist/test/no-theater-available.test.js +27 -0
  50. package/dist/test/no-theater-available.test.js.map +1 -0
  51. package/package.json +14 -5
  52. package/src/interfaces/custom-theater-interface.ts +28 -0
  53. package/src/interfaces/event-interfaces.ts +17 -24
  54. package/src/interfaces/menu-interfaces.ts +10 -9
  55. package/src/item-navigator.ts +257 -155
  56. package/src/loader.ts +9 -2
  57. package/src/no-theater-available.ts +85 -0
  58. package/test/book-nav-stub.ts +47 -0
  59. package/test/ia-item-navigator.test.ts +438 -0
  60. package/test/ia-stub.ts +79 -0
  61. package/test/no-theater-available.test.ts +32 -0
  62. package/demo/demo-book-manifest.json +0 -1163
  63. package/demo/demo-item-md.json +0 -247
  64. package/src/interfaces/nav-controller-interface.ts +0 -18
  65. package/src/item-inspector/files-by-type/files-by-type-provider.ts +0 -41
  66. package/src/item-inspector/files-by-type/ia-files-by-type.ts +0 -84
  67. package/src/item-inspector/item-inspector.ts +0 -202
  68. package/src/item-inspector/share-provider.ts +0 -51
  69. package/src/item-navigator-js.js +0 -372
  70. package/test/your-webcomponent.test.ts +0 -40
@@ -1 +1 @@
1
- {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/loader.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAG/B,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,UAAU;IAC7C,IAAI,WAAW;QACb,OAAO,GAAG,CAAA;;;;;;KAMT,CAAC;IACJ,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,GAAG,CAAA;;;;;;;;;;;UAWJ,IAAI,CAAC,IAAI;;;;;;;;KAQd,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;UAEL,IAAI,CAAC,MAAM;;;KAGhB,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCT,CAAC;IACJ,CAAC;CACF,CAAA;AAxFY,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CAwF3B;SAxFY,eAAe","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport { css, html, LitElement, customElement } from 'lit-element';\nimport { svg } from 'lit-html';\n\n@customElement('ia-itemnav-loader')\nexport class IAItemNavLoader extends LitElement {\n get bookIconSvg() {\n return svg`\n <g class=\"bookIcon\" transform=\"matrix(1 0 0 -1 28 67.362264)\">\n <path d=\"m44.71698 31.6981124v-29.99320678s-18.0956599.30735848-18.6322637-.7171698c-.0633962-.12226414-1.890566-.59207545-2.9745282-.59207545-1.3228302 0-3.5122641 0-4.1286791.74547168-.9707547 1.17452827-18.82811278.71660375-18.82811278.71660375v30.040754l1.83849052.7867924.29094339-28.48188608s15.94981097.15339622 17.09094297-1.10716978c.8145283-.90056602 4.997547-.91641507 5.3450942-.3526415.9611321 1.55716977 14.7101883 1.31716978 17.6077354 1.45981128l.3266038 28.22830118z\"/>\n <path d=\"m40.1129424 33.5957539h-12.8337733c-1.8690565 0-3.1098112-.7545283-3.9299999-1.6279245v-26.70452764l1.2362264-.00792453c.4584906.72962262 3.0922641 1.39415091 3.0922641 1.39415091h10.1298111s1.0381131.01754717 1.5141509.47377357c.5643396.54056602.7913207 1.36981129.7913207 1.36981129z\"/>\n <path d=\"m17.3354713 33.5957539h-12.8337733v-25.37660316s0-.75283017.49358489-1.14113205c.52867924-.41433961 1.3415094-.42849055 1.3415094-.42849055h10.59905631s2.2075471-.52698112 3.0928301-1.39415091l1.2.00792453v26.74245214c-.8201886.8581132-2.0530188 1.59-3.8932074 1.59\"/>\n </g>\n `;\n }\n\n get icon() {\n return this.bookIconSvg;\n }\n\n get loader() {\n return svg`\n <svg\n height=\"100\"\n viewBox=\"0 0 100 100\"\n width=\"100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"item-loading\"\n >\n <title id=\"item-loading\">Currently loading viewer.</title>\n <desc>Please wait while we load theater.</desc>\n <g fill=\"#333\" fill-rule=\"evenodd\" class=\"book-icon\">\n ${this.icon}\n <path\n class=\"ring\"\n d=\"m17.8618849 11.6970233c18.5864635-15.59603144 45.6875867-15.59603102 64.2740497.000001 1.9271446 1.6170806 2.1785128 4.4902567.5614466 6.4174186-1.6170661 1.9271618-4.4902166 2.1785323-6.4173612.5614517-15.1996922-12.75416882-37.3625282-12.75416916-52.5622206-.000001-15.19969387 12.7541707-19.04823077 34.5805019-9.1273354 51.7641499 9.9208955 17.183646 30.7471499 24.7638499 49.3923323 17.9774983 18.6451823-6.7863521 29.7266014-25.9801026 26.2811129-45.5206248-.436848-2.4775114 1.2174186-4.8400696 3.6949079-5.2769215 2.4774893-.4368518 4.8400264 1.2174296 5.2768744 3.694941 4.2132065 23.8945096-9.3373563 47.3649806-32.137028 55.6634567-22.799672 8.2984758-48.2663986-.9707372-60.39785211-21.9832155-12.1314534-21.012481-7.42539173-47.7021198 11.16107351-63.2981544z\"\n fill-rule=\"nonzero\"\n />\n </g>\n </svg>\n `;\n }\n\n render() {\n return html`\n <div class=\"place-holder\">\n ${this.loader}\n <h3>Loading viewer</h3>\n </div>\n `;\n }\n\n static get styles() {\n return css`\n .place-holder {\n width: 30%;\n margin: auto;\n text-align: center;\n color: var(--primaryTextColor);\n }\n\n .place-holder {\n position: relative;\n }\n\n .place-holder svg {\n display: block;\n width: 60%;\n max-width: 100px;\n height: auto;\n margin: auto;\n }\n\n svg * {\n fill: var(--primaryTextColor);\n }\n\n svg .ring {\n animation: rotate 1.3s infinite linear;\n transform-origin: 50px 50px;\n transform-box: fill-box;\n display: block; // transform won't work on inline style\n }\n\n @keyframes rotate {\n 0% {\n -moz-transform: rotate(-360deg);\n -webkit-transform: rotate(-360deg);\n transform: rotate(-360deg);\n }\n }\n `;\n }\n}\n"]}
1
+ {"version":3,"file":"loader.js","sourceRoot":"","sources":["../../src/loader.ts"],"names":[],"mappings":";AAAA,2CAA2C;AAC3C,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC;AAGxC,IAAa,eAAe,GAA5B,MAAa,eAAgB,SAAQ,UAAU;IAC7C,MAAM,KAAK,UAAU;QACnB,OAAO;YACL,KAAK,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SACxB,CAAC;IACJ,CAAC;IAED,IAAI,WAAW;QACb,OAAO,GAAG,CAAA;;;;;;KAMT,CAAC;IACJ,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,WAAW,CAAC;IAC1B,CAAC;IAED,IAAI,MAAM;QACR,OAAO,GAAG,CAAA;;;;;;;;;;;UAWJ,IAAI,CAAC,IAAI;;;;;;;;KAQd,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAA,OAAO,IAAI,CAAC,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;QAClE,OAAO,IAAI,CAAA;;UAEL,KAAK,IAAI,IAAI,CAAC,MAAM;;;KAGzB,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAsCT,CAAC;IACJ,CAAC;CACF,CAAA;AA/FY,eAAe;IAD3B,aAAa,CAAC,mBAAmB,CAAC;GACtB,eAAe,CA+F3B;SA/FY,eAAe","sourcesContent":["/* eslint-disable class-methods-use-this */\nimport { css, html, LitElement, customElement } from 'lit-element';\nimport { svg, nothing } from 'lit-html';\n\n@customElement('ia-itemnav-loader')\nexport class IAItemNavLoader extends LitElement {\n static get properties() {\n return {\n title: { type: String },\n };\n }\n\n get bookIconSvg() {\n return svg`\n <g class=\"bookIcon\" transform=\"matrix(1 0 0 -1 28 67.362264)\">\n <path d=\"m44.71698 31.6981124v-29.99320678s-18.0956599.30735848-18.6322637-.7171698c-.0633962-.12226414-1.890566-.59207545-2.9745282-.59207545-1.3228302 0-3.5122641 0-4.1286791.74547168-.9707547 1.17452827-18.82811278.71660375-18.82811278.71660375v30.040754l1.83849052.7867924.29094339-28.48188608s15.94981097.15339622 17.09094297-1.10716978c.8145283-.90056602 4.997547-.91641507 5.3450942-.3526415.9611321 1.55716977 14.7101883 1.31716978 17.6077354 1.45981128l.3266038 28.22830118z\"/>\n <path d=\"m40.1129424 33.5957539h-12.8337733c-1.8690565 0-3.1098112-.7545283-3.9299999-1.6279245v-26.70452764l1.2362264-.00792453c.4584906.72962262 3.0922641 1.39415091 3.0922641 1.39415091h10.1298111s1.0381131.01754717 1.5141509.47377357c.5643396.54056602.7913207 1.36981129.7913207 1.36981129z\"/>\n <path d=\"m17.3354713 33.5957539h-12.8337733v-25.37660316s0-.75283017.49358489-1.14113205c.52867924-.41433961 1.3415094-.42849055 1.3415094-.42849055h10.59905631s2.2075471-.52698112 3.0928301-1.39415091l1.2.00792453v26.74245214c-.8201886.8581132-2.0530188 1.59-3.8932074 1.59\"/>\n </g>\n `;\n }\n\n get icon() {\n return this.bookIconSvg;\n }\n\n get loader() {\n return svg`\n <svg\n height=\"100\"\n viewBox=\"0 0 100 100\"\n width=\"100\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-labelledby=\"item-loading\"\n >\n <title id=\"item-loading\">Currently loading viewer.</title>\n <desc>Please wait while we load theater.</desc>\n <g fill=\"#333\" fill-rule=\"evenodd\" class=\"book-icon\">\n ${this.icon}\n <path\n class=\"ring\"\n d=\"m17.8618849 11.6970233c18.5864635-15.59603144 45.6875867-15.59603102 64.2740497.000001 1.9271446 1.6170806 2.1785128 4.4902567.5614466 6.4174186-1.6170661 1.9271618-4.4902166 2.1785323-6.4173612.5614517-15.1996922-12.75416882-37.3625282-12.75416916-52.5622206-.000001-15.19969387 12.7541707-19.04823077 34.5805019-9.1273354 51.7641499 9.9208955 17.183646 30.7471499 24.7638499 49.3923323 17.9774983 18.6451823-6.7863521 29.7266014-25.9801026 26.2811129-45.5206248-.436848-2.4775114 1.2174186-4.8400696 3.6949079-5.2769215 2.4774893-.4368518 4.8400264 1.2174296 5.2768744 3.694941 4.2132065 23.8945096-9.3373563 47.3649806-32.137028 55.6634567-22.799672 8.2984758-48.2663986-.9707372-60.39785211-21.9832155-12.1314534-21.012481-7.42539173-47.7021198 11.16107351-63.2981544z\"\n fill-rule=\"nonzero\"\n />\n </g>\n </svg>\n `;\n }\n\n render() {\n const title = this.title ? html`<h2>${this.title}</h2>` : nothing;\n return html`\n <div class=\"place-holder\">\n ${title} ${this.loader}\n <h3>Loading viewer</h3>\n </div>\n `;\n }\n\n static get styles() {\n return css`\n .place-holder {\n width: 30%;\n margin: auto;\n text-align: center;\n color: var(--primaryTextColor);\n }\n\n .place-holder {\n position: relative;\n }\n\n .place-holder svg {\n display: block;\n width: 60%;\n max-width: 100px;\n height: auto;\n margin: auto;\n }\n\n svg * {\n fill: var(--primaryTextColor);\n }\n\n svg .ring {\n animation: rotate 1.3s infinite linear;\n transform-origin: 50px 50px;\n transform-box: fill-box;\n display: block; // transform won't work on inline style\n }\n\n @keyframes rotate {\n 0% {\n -moz-transform: rotate(-360deg);\n -webkit-transform: rotate(-360deg);\n transform: rotate(-360deg);\n }\n }\n `;\n }\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import { LitElement, TemplateResult, PropertyValues, CSSResult } from 'lit-element';
2
+ export declare class IANoTheaterAvailable extends LitElement {
3
+ identifier?: string;
4
+ emitLoaded(): void;
5
+ updated(changed: PropertyValues): void;
6
+ get downloadUrl(): string;
7
+ render(): TemplateResult;
8
+ static get styles(): CSSResult;
9
+ }
@@ -0,0 +1,79 @@
1
+ import { __decorate } from "tslib";
2
+ import { LitElement, customElement, property, html, css, } from 'lit-element';
3
+ let IANoTheaterAvailable = class IANoTheaterAvailable extends LitElement {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.identifier = '';
7
+ }
8
+ emitLoaded() {
9
+ this.dispatchEvent(new CustomEvent('loadingStateUpdated', {
10
+ detail: { loaded: true },
11
+ }));
12
+ }
13
+ updated(changed) {
14
+ if (changed.has('identifier')) {
15
+ this.emitLoaded();
16
+ }
17
+ }
18
+ get downloadUrl() {
19
+ return `/download/${this.identifier}`;
20
+ }
21
+ render() {
22
+ return html `
23
+ <section>
24
+ <h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>
25
+ <p>
26
+ This item does not appear to have any files that can be experienced on
27
+ Archive.org. <br />
28
+ Please download files in this item to interact with them on your
29
+ computer.
30
+ </p>
31
+ <a href=${this.downloadUrl}>Show all files</a>
32
+ </section>
33
+ `;
34
+ }
35
+ static get styles() {
36
+ return css `
37
+ :host {
38
+ color: var(--primaryTextColor, #fff);
39
+ text-align: center;
40
+ }
41
+ section {
42
+ margin: 10% auto 0;
43
+ padding: 0 5%;
44
+ }
45
+ p {
46
+ font-size: 1.4rem;
47
+ }
48
+ a {
49
+ color: var(--primaryTextColor, #fff);
50
+ background-color: rgb(25, 72, 128);
51
+ min-height: 35px;
52
+ outline: none;
53
+ cursor: pointer;
54
+ line-height: normal;
55
+ border-radius: 0.4rem;
56
+ text-align: center;
57
+ vertical-align: middle;
58
+ font-size: 1.4rem;
59
+ font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
60
+ display: inline-block;
61
+ padding: 0.85rem 1.2rem;
62
+ border: 1px solid rgb(197, 209, 223);
63
+ white-space: nowrap;
64
+ appearance: auto;
65
+ box-sizing: border-box;
66
+ user-select: none;
67
+ text-decoration: none;
68
+ }
69
+ `;
70
+ }
71
+ };
72
+ __decorate([
73
+ property({ type: String })
74
+ ], IANoTheaterAvailable.prototype, "identifier", void 0);
75
+ IANoTheaterAvailable = __decorate([
76
+ customElement('ia-no-theater-available')
77
+ ], IANoTheaterAvailable);
78
+ export { IANoTheaterAvailable };
79
+ //# sourceMappingURL=no-theater-available.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"no-theater-available.js","sourceRoot":"","sources":["../../src/no-theater-available.ts"],"names":[],"mappings":";AAAA,OAAO,EACL,UAAU,EACV,aAAa,EACb,QAAQ,EACR,IAAI,EAIJ,GAAG,GACJ,MAAM,aAAa,CAAC;AAGrB,IAAa,oBAAoB,GAAjC,MAAa,oBAAqB,SAAQ,UAAU;IAApD;;QAC8B,eAAU,GAAY,EAAE,CAAC;IAuEvD,CAAC;IArEC,UAAU;QACR,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CAAsB,qBAAqB,EAAE;YAC1D,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE;SACzB,CAAC,CACH,CAAC;IACJ,CAAC;IAED,OAAO,CAAC,OAAuB;QAC7B,IAAI,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE;YAC7B,IAAI,CAAC,UAAU,EAAE,CAAC;SACnB;IACH,CAAC;IAED,IAAI,WAAW;QACb,OAAO,aAAa,IAAI,CAAC,UAAU,EAAE,CAAC;IACxC,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAA;;;;;;;;;kBASG,IAAI,CAAC,WAAW;;KAE7B,CAAC;IACJ,CAAC;IAED,MAAM,KAAK,MAAM;QACf,OAAO,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;KAiCT,CAAC;IACJ,CAAC;CACF,CAAA;AAvE6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;wDAA0B;AAD1C,oBAAoB;IADhC,aAAa,CAAC,yBAAyB,CAAC;GAC5B,oBAAoB,CAwEhC;SAxEY,oBAAoB","sourcesContent":["import {\n LitElement,\n customElement,\n property,\n html,\n TemplateResult,\n PropertyValues,\n CSSResult,\n css,\n} from 'lit-element';\n\n@customElement('ia-no-theater-available')\nexport class IANoTheaterAvailable extends LitElement {\n @property({ type: String }) identifier?: string = '';\n\n emitLoaded(): void {\n this.dispatchEvent(\n new CustomEvent<{ loaded: boolean }>('loadingStateUpdated', {\n detail: { loaded: true },\n })\n );\n }\n\n updated(changed: PropertyValues): void {\n if (changed.has('identifier')) {\n this.emitLoaded();\n }\n }\n\n get downloadUrl(): string {\n return `/download/${this.identifier}`;\n }\n\n render(): TemplateResult {\n return html`\n <section>\n <h2>THERE IS NO PREVIEW AVAILABLE FOR THIS ITEM</h2>\n <p>\n This item does not appear to have any files that can be experienced on\n Archive.org. <br />\n Please download files in this item to interact with them on your\n computer.\n </p>\n <a href=${this.downloadUrl}>Show all files</a>\n </section>\n `;\n }\n\n static get styles(): CSSResult {\n return css`\n :host {\n color: var(--primaryTextColor, #fff);\n text-align: center;\n }\n section {\n margin: 10% auto 0;\n padding: 0 5%;\n }\n p {\n font-size: 1.4rem;\n }\n a {\n color: var(--primaryTextColor, #fff);\n background-color: rgb(25, 72, 128);\n min-height: 35px;\n outline: none;\n cursor: pointer;\n line-height: normal;\n border-radius: 0.4rem;\n text-align: center;\n vertical-align: middle;\n font-size: 1.4rem;\n font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;\n display: inline-block;\n padding: 0.85rem 1.2rem;\n border: 1px solid rgb(197, 209, 223);\n white-space: nowrap;\n appearance: auto;\n box-sizing: border-box;\n user-select: none;\n text-decoration: none;\n }\n `;\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { ModalManager } from '@internetarchive/modal-manager';
2
+ import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
3
+ import { LitElement } from 'lit-element';
4
+ import { MetadataResponse } from '@internetarchive/search-service';
5
+ import { MenuProviderInterface, MenuShortcutInterface } from '../src/interfaces/menu-interfaces';
6
+ import { CustomTheaterInterface } from '../src/interfaces/custom-theater-interface';
7
+ export declare class BookNavigator extends LitElement implements CustomTheaterInterface {
8
+ modal?: ModalManager;
9
+ itemMD?: MetadataResponse;
10
+ baseHost?: string;
11
+ signedIn?: boolean | null;
12
+ sideMenuOpen: boolean;
13
+ sharedObserver?: SharedResizeObserver;
14
+ menuProviders?: MenuProviderInterface[];
15
+ menuShortcuts?: MenuShortcutInterface[];
16
+ emitLoadingStatusUpdate(): void;
17
+ addMenuShortcut(menuId: string): string;
18
+ removeMenuShortcut(menuId: string): string;
19
+ sortMenuShortcuts(): void;
20
+ emitMenuShortcutsUpdated(): void;
21
+ render(): import("lit-element").TemplateResult;
22
+ }
@@ -0,0 +1,49 @@
1
+ import { __decorate } from "tslib";
2
+ import { html, customElement, LitElement, property } from 'lit-element';
3
+ let BookNavigator = class BookNavigator extends LitElement {
4
+ constructor() {
5
+ super(...arguments);
6
+ this.signedIn = null;
7
+ }
8
+ emitLoadingStatusUpdate() { }
9
+ addMenuShortcut(menuId) {
10
+ return menuId;
11
+ }
12
+ removeMenuShortcut(menuId) {
13
+ return menuId;
14
+ }
15
+ sortMenuShortcuts() { }
16
+ emitMenuShortcutsUpdated() { }
17
+ render() {
18
+ return html ` <p>foo</p> `;
19
+ }
20
+ };
21
+ __decorate([
22
+ property({ attribute: false })
23
+ ], BookNavigator.prototype, "modal", void 0);
24
+ __decorate([
25
+ property({ type: Object })
26
+ ], BookNavigator.prototype, "itemMD", void 0);
27
+ __decorate([
28
+ property({ type: String })
29
+ ], BookNavigator.prototype, "baseHost", void 0);
30
+ __decorate([
31
+ property({ type: Boolean, reflect: true })
32
+ ], BookNavigator.prototype, "signedIn", void 0);
33
+ __decorate([
34
+ property({ type: Boolean })
35
+ ], BookNavigator.prototype, "sideMenuOpen", void 0);
36
+ __decorate([
37
+ property({ attribute: false })
38
+ ], BookNavigator.prototype, "sharedObserver", void 0);
39
+ __decorate([
40
+ property({ type: Array })
41
+ ], BookNavigator.prototype, "menuProviders", void 0);
42
+ __decorate([
43
+ property({ type: Array })
44
+ ], BookNavigator.prototype, "menuShortcuts", void 0);
45
+ BookNavigator = __decorate([
46
+ customElement('book-navigator')
47
+ ], BookNavigator);
48
+ export { BookNavigator };
49
+ //# sourceMappingURL=book-nav-stub.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"book-nav-stub.js","sourceRoot":"","sources":["../../test/book-nav-stub.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAQxE,IAAa,aAAa,GAA1B,MAAa,aACX,SAAQ,UAAU;IADpB;;QAS8C,aAAQ,GAAoB,IAAI,CAAC;IA2B/E,CAAC;IAjBC,uBAAuB,KAAI,CAAC;IAE5B,eAAe,CAAC,MAAc;QAC5B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,kBAAkB,CAAC,MAAc;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,iBAAiB,KAAI,CAAC;IAEtB,wBAAwB,KAAI,CAAC;IAE7B,MAAM;QACJ,OAAO,IAAI,CAAA,cAAc,CAAC;IAC5B,CAAC;CACF,CAAA;AAjCiC;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;4CAAsB;AAEzB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;6CAA2B;AAE1B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;+CAAmB;AAEF;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAkC;AAEhD;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;mDAAwB;AAEpB;IAA/B,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;qDAAuC;AAE3C;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAyC;AAExC;IAA1B,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;oDAAyC;AAjBxD,aAAa;IADzB,aAAa,CAAC,gBAAgB,CAAC;GACnB,aAAa,CAoCzB;SApCY,aAAa","sourcesContent":["import { ModalManager } from '@internetarchive/modal-manager';\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { html, customElement, LitElement, property } from 'lit-element';\nimport { MetadataResponse } from '@internetarchive/search-service';\nimport {\n MenuProviderInterface,\n MenuShortcutInterface,\n} from '../src/interfaces/menu-interfaces';\nimport { CustomTheaterInterface } from '../src/interfaces/custom-theater-interface';\n@customElement('book-navigator')\nexport class BookNavigator\n extends LitElement\n implements CustomTheaterInterface {\n @property({ attribute: false }) modal?: ModalManager;\n\n @property({ type: Object }) itemMD?: MetadataResponse;\n\n @property({ type: String }) baseHost?: string;\n\n @property({ type: Boolean, reflect: true }) signedIn?: boolean | null = null;\n\n @property({ type: Boolean }) sideMenuOpen!: boolean;\n\n @property({ attribute: false }) sharedObserver?: SharedResizeObserver;\n\n @property({ type: Array }) menuProviders?: MenuProviderInterface[];\n\n @property({ type: Array }) menuShortcuts?: MenuShortcutInterface[];\n\n emitLoadingStatusUpdate() {}\n\n addMenuShortcut(menuId: string) {\n return menuId;\n }\n\n removeMenuShortcut(menuId: string) {\n return menuId;\n }\n\n sortMenuShortcuts() {}\n\n emitMenuShortcutsUpdated() {}\n\n render() {\n return html` <p>foo</p> `;\n }\n}\n"]}
@@ -0,0 +1,2 @@
1
+ import '../src/item-navigator';
2
+ import '../test/book-nav-stub';
@@ -0,0 +1,317 @@
1
+ /* eslint-disable camelcase */
2
+ import { html, fixture, expect } from '@open-wc/testing';
3
+ import Sinon from 'sinon';
4
+ import { SharedResizeObserver } from '@internetarchive/shared-resize-observer';
5
+ import { ModalManager } from '@internetarchive/modal-manager';
6
+ import { ItemType } from '../src/item-navigator';
7
+ import '../src/item-navigator';
8
+ import '../test/book-nav-stub';
9
+ import { ItemStub, menuProvider, shortcut } from '../test/ia-stub';
10
+ afterEach(() => {
11
+ Sinon.restore();
12
+ });
13
+ describe('ItemNavigator', () => {
14
+ describe('Theaters', () => {
15
+ it('shows <ia-no-theater-available> by default', async () => {
16
+ var _a;
17
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
18
+ expect((_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('ia-no-theater-available')).to.exist;
19
+ });
20
+ it('shows <book-navigator> if `this.itemType = "bookreader"`', async () => {
21
+ var _a;
22
+ const el = await fixture(html `<ia-item-navigator
23
+ .itemType=${ItemType.BOOK}
24
+ .item=${new ItemStub()}
25
+ .modal=${new ModalManager()}
26
+ .sharedObserver=${new SharedResizeObserver()}
27
+ ></ia-item-navigator>`);
28
+ await el.updateComplete;
29
+ el.toggleMenu();
30
+ await el.updateComplete;
31
+ const bookNavigator = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('book-navigator');
32
+ await bookNavigator.updateComplete;
33
+ console.log('132234234324324324');
34
+ // TODO: add BookNavigator type & import via @internetarchive/bookreader
35
+ // For now, let's check that the BookNavigator element and its properties exist w/ stub
36
+ expect(bookNavigator).to.exist;
37
+ expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.modal).to.exist;
38
+ expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.baseHost).to.exist;
39
+ expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.signedIn).to.be.null;
40
+ expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.sharedObserver).to.exist;
41
+ expect(bookNavigator === null || bookNavigator === void 0 ? void 0 : bookNavigator.sideMenuOpen).to.exist;
42
+ });
43
+ });
44
+ describe('`el.loaded`', () => {
45
+ it('toggles the spinning loader', async () => {
46
+ var _a;
47
+ const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
48
+ expect(el.loaded).to.be.null; // initial load
49
+ expect((_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('ia-itemnav-loader')).to.exist;
50
+ });
51
+ it('hides reader section if `!loaded`', async () => {
52
+ var _a, _b;
53
+ const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
54
+ expect((_b = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#reader')) === null || _b === void 0 ? void 0 : _b.getAttribute('class')).to.contain('hide');
55
+ });
56
+ it('shows reader when `loaded` ', async () => {
57
+ var _a, _b;
58
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
59
+ const mainTheaterSection = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#reader');
60
+ expect(mainTheaterSection === null || mainTheaterSection === void 0 ? void 0 : mainTheaterSection.classList.contains('hide')).to.be.false;
61
+ expect(el.loaded).to.be.true;
62
+ // `loaded` property is reflected as DOM attribute
63
+ expect(el.hasAttribute('loaded')).to.equal(true);
64
+ expect((_b = el.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('ia-no-theater-available')).to.exist;
65
+ });
66
+ it('listens to `@loadingStateUpdated` to update `loaded`', async () => {
67
+ const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
68
+ await el.updateComplete;
69
+ const spy = Sinon.spy();
70
+ el.loadingStateUpdated = spy;
71
+ el.loaded = null;
72
+ await el.updateComplete;
73
+ // check base properties
74
+ expect(el.loaded).to.equal(null);
75
+ expect(el.item).to.be.undefined;
76
+ // hydrate item
77
+ el.item = new ItemStub();
78
+ await el.updateComplete;
79
+ // spy fires
80
+ expect(spy.called).to.equal(true);
81
+ expect(spy.callCount).to.equal(1);
82
+ });
83
+ });
84
+ describe('`el.sharedObserver`', () => {
85
+ it('uses one', async () => {
86
+ const sharedObserver = new SharedResizeObserver();
87
+ const el = await fixture(html `<ia-item-navigator
88
+ .sharedObserver=${sharedObserver}
89
+ ></ia-item-navigator>`);
90
+ expect(el.sharedObserver).to.equal(sharedObserver);
91
+ expect(typeof el.handleResize).to.equal('function');
92
+ });
93
+ it('freshly registers handler', async () => {
94
+ const sharedObserver = new SharedResizeObserver();
95
+ const addObserverSpy = Sinon.spy(sharedObserver, 'addObserver');
96
+ await fixture(html `<ia-item-navigator
97
+ .sharedObserver=${sharedObserver}
98
+ ></ia-item-navigator>`);
99
+ expect(addObserverSpy.callCount).to.equal(1);
100
+ });
101
+ it('removes handler when component disconnects', async () => {
102
+ const sharedObserver = new SharedResizeObserver();
103
+ const removeObserverSpy = Sinon.spy(sharedObserver, 'removeObserver');
104
+ const el = await fixture(html `<ia-item-navigator
105
+ .sharedObserver=${sharedObserver}
106
+ ></ia-item-navigator>`);
107
+ el.disconnectedCallback();
108
+ await el.updateComplete;
109
+ expect(removeObserverSpy.callCount).to.equal(1);
110
+ });
111
+ it('sets menu to overlay if container width is <= 600px', async () => {
112
+ const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
113
+ expect(el.openMenuState).to.equal('shift'); // as starting point
114
+ const overlaySize = {
115
+ contentRect: { width: 600 },
116
+ };
117
+ el.handleResize(overlaySize);
118
+ await el.updateComplete;
119
+ expect(el.openMenuState).to.equal('overlay'); // changes open menu display to an overlay
120
+ const shiftSize = {
121
+ contentRect: { width: 601 },
122
+ };
123
+ el.handleResize(shiftSize);
124
+ await el.updateComplete;
125
+ expect(el.openMenuState).to.equal('shift');
126
+ });
127
+ });
128
+ describe('`el.modal`', () => {
129
+ it('uses one', async () => {
130
+ const modal = new ModalManager();
131
+ const el = await fixture(html `<ia-item-navigator .modal=${modal}></ia-item-navigator>`);
132
+ expect(el.modal).to.equal(modal);
133
+ });
134
+ });
135
+ describe('full browser window immersion "fullscreen"', () => {
136
+ it('creates reflected attribute `viewportinfullscreen`', async () => {
137
+ /** to help with external styling adjustmnents */
138
+ const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
139
+ expect(el.getAttribute('viewportinfullscreen')).to.be.null;
140
+ el.viewportInFullscreen = true;
141
+ await el.updateComplete;
142
+ expect(el.getAttribute('viewportinfullscreen')).to.exist;
143
+ });
144
+ it('@ViewportInFullScreen', async () => {
145
+ const el = await fixture(html `<ia-item-navigator></ia-item-navigator>`);
146
+ expect(el.viewportInFullscreen).to.be.null;
147
+ const yesFullscreenEvent = {
148
+ detail: {
149
+ isFullScreen: true,
150
+ },
151
+ };
152
+ el.manageViewportFullscreen(yesFullscreenEvent);
153
+ await el.updateComplete;
154
+ expect(el.viewportInFullscreen).to.be.true;
155
+ const noFullscreenEvent = {
156
+ detail: {
157
+ isFullScreen: false,
158
+ },
159
+ };
160
+ el.manageViewportFullscreen(noFullscreenEvent);
161
+ await el.updateComplete;
162
+ expect(el.viewportInFullscreen).to.be.null;
163
+ });
164
+ });
165
+ /* Side menu & shortcuts tests */
166
+ describe('el.menuOpened', () => {
167
+ it('toggles side menu open', async () => {
168
+ var _a, _b, _c;
169
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
170
+ el.menuContents = [menuProvider];
171
+ await el.updateComplete;
172
+ const nav = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('nav');
173
+ expect(nav === null || nav === void 0 ? void 0 : nav.querySelector('#menu')).to.exist;
174
+ // side menu starts closed
175
+ expect(el.menuOpened).to.be.false;
176
+ expect((_b = nav === null || nav === void 0 ? void 0 : nav.querySelector('#menu')) === null || _b === void 0 ? void 0 : _b.getAttribute('class')).to.contain('hidden');
177
+ // let's open menu
178
+ el.toggleMenu();
179
+ await el.updateComplete;
180
+ expect(el.menuOpened).to.be.true;
181
+ expect((_c = nav === null || nav === void 0 ? void 0 : nav.querySelector('#menu')) === null || _c === void 0 ? void 0 : _c.getAttribute('class')).to.not.contain('hidden');
182
+ });
183
+ it('opens menu shortcut with `@manageSideMenuEvents`', async () => {
184
+ var _a;
185
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
186
+ const detail = {
187
+ menuId: 'fullscreen',
188
+ action: 'open',
189
+ };
190
+ el.menuContents = [menuProvider];
191
+ await el.updateComplete;
192
+ const frame = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('#frame');
193
+ // default menu open behavior is to side menu open, not overlay
194
+ expect(frame === null || frame === void 0 ? void 0 : frame.getAttribute('class')).to.contain('shift');
195
+ expect(el.menuOpened).to.be.false;
196
+ expect(el.openMenu).to.be.undefined;
197
+ expect(frame === null || frame === void 0 ? void 0 : frame.getAttribute('class')).to.not.contain('open');
198
+ const event = new CustomEvent('updateSideMenu', {
199
+ detail,
200
+ });
201
+ el.manageSideMenuEvents(event);
202
+ await el.updateComplete;
203
+ expect(el.shouldRenderMenu).to.be.true;
204
+ expect(el.menuOpened).to.be.true;
205
+ expect(el.openMenu).to.equal(detail.menuId);
206
+ expect(frame === null || frame === void 0 ? void 0 : frame.getAttribute('class')).to.contain('open');
207
+ // no menu provided
208
+ const openShortcutSpy = Sinon.spy(el, 'openShortcut');
209
+ const toggleMenuSpy = Sinon.spy(el, 'toggleMenu');
210
+ const noMenuProvidedEvent = new CustomEvent('updateSideMenu', {
211
+ detail: {},
212
+ });
213
+ el.manageSideMenuEvents(noMenuProvidedEvent);
214
+ await el.updateComplete;
215
+ expect(openShortcutSpy.called).to.be.false;
216
+ expect(toggleMenuSpy.called).to.be.false;
217
+ // toggle menu
218
+ const toggleMenuEvent = new CustomEvent('updateSideMenu', {
219
+ detail: { action: 'toggle', menuId: 'fullscreen' },
220
+ });
221
+ el.manageSideMenuEvents(toggleMenuEvent);
222
+ await el.updateComplete;
223
+ expect(toggleMenuSpy.callCount).to.equal(1);
224
+ // open menu
225
+ const openMenuEvent = new CustomEvent('updateSideMenu', {
226
+ detail: { action: 'open', menuId: 'fullscreen' },
227
+ });
228
+ el.manageSideMenuEvents(openMenuEvent);
229
+ await el.updateComplete;
230
+ expect(openShortcutSpy.callCount).to.equal(1);
231
+ });
232
+ });
233
+ describe('el.menuContents', () => {
234
+ it('draws side menu when populated', async () => {
235
+ var _a;
236
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
237
+ el.menuContents = [menuProvider];
238
+ await el.updateComplete;
239
+ expect(el.menuContents.length).to.exist;
240
+ expect(el.shouldRenderMenu).to.be.true;
241
+ const nav = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('nav');
242
+ expect(nav).to.exist;
243
+ const menuSlider = nav === null || nav === void 0 ? void 0 : nav.querySelector('ia-menu-slider');
244
+ expect(menuSlider).to.exist;
245
+ expect(menuSlider === null || menuSlider === void 0 ? void 0 : menuSlider.getAttribute('manuallyhandleclose')).to.exist;
246
+ expect(menuSlider === null || menuSlider === void 0 ? void 0 : menuSlider.getAttribute('open')).to.exist;
247
+ });
248
+ });
249
+ describe('`el.menuShortcuts`', () => {
250
+ it('displays shortcut & toggle side menu button', async () => {
251
+ var _a;
252
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
253
+ const anotherShortcut = {
254
+ id: 'foo',
255
+ icon: html `<i class="foo-shortcut"></i>`,
256
+ };
257
+ el.menuContents = [menuProvider];
258
+ el.menuShortcuts = [shortcut, anotherShortcut];
259
+ await el.updateComplete;
260
+ const nav = (_a = el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('nav');
261
+ const shortcutsContainer = nav === null || nav === void 0 ? void 0 : nav.querySelector('.shortcuts');
262
+ expect(el.menuShortcuts.length).to.exist;
263
+ expect(nav).to.exist;
264
+ expect(shortcutsContainer).to.exist;
265
+ expect(shortcutsContainer === null || shortcutsContainer === void 0 ? void 0 : shortcutsContainer.querySelector('i.fullscreen-test')).to.exist;
266
+ expect(shortcutsContainer === null || shortcutsContainer === void 0 ? void 0 : shortcutsContainer.querySelector('button.shortcut.foo')).to.exist;
267
+ expect(nav === null || nav === void 0 ? void 0 : nav.querySelector('.toggle-menu')).to.exist;
268
+ });
269
+ });
270
+ describe('Menu events', () => {
271
+ it('`el.setMenuShortcuts`', async () => {
272
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
273
+ expect(el.menuShortcuts.length).to.equal(0);
274
+ const menuShortcuts = [shortcut];
275
+ el.setMenuShortcuts({
276
+ detail: menuShortcuts,
277
+ });
278
+ await el.updateComplete;
279
+ expect(el.menuShortcuts.length).to.equal(1);
280
+ });
281
+ it('`el.setMenuContents`', async () => {
282
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
283
+ expect(el.menuContents.length).to.equal(0);
284
+ el.setMenuShortcuts({
285
+ detail: [menuProvider],
286
+ });
287
+ await el.updateComplete;
288
+ expect(el.menuShortcuts.length).to.equal(1);
289
+ });
290
+ it('`el.setOpenMenu`', async () => {
291
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
292
+ el.setOpenMenu({
293
+ detail: { id: 'foo' },
294
+ });
295
+ await el.updateComplete;
296
+ expect(el.openMenu).to.equal('foo');
297
+ expect(el.selectedMenuId).to.equal('foo');
298
+ // toggles it off
299
+ el.setOpenMenu({
300
+ detail: { id: 'foo' },
301
+ });
302
+ await el.updateComplete;
303
+ expect(el.openMenu).to.be.undefined;
304
+ expect(el.selectedMenuId).to.equal('');
305
+ });
306
+ it('`el.closeMenu`', async () => {
307
+ const el = await fixture(html `<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`);
308
+ el.menuOpened = true;
309
+ await el.updateComplete;
310
+ expect(el.menuOpened).to.be.true;
311
+ el.closeMenu();
312
+ await el.updateComplete;
313
+ expect(el.menuOpened).to.be.false;
314
+ });
315
+ });
316
+ });
317
+ //# sourceMappingURL=ia-item-navigator.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ia-item-navigator.test.js","sourceRoot":"","sources":["../../test/ia-item-navigator.test.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACzD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAE9D,OAAO,EAAiB,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,uBAAuB,CAAC;AAE/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AASnE,SAAS,CAAC,GAAG,EAAE;IACb,KAAK,CAAC,OAAO,EAAE,CAAC;AAClB,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;QACxB,EAAE,CAAC,4CAA4C,EAAE,KAAK,IAAI,EAAE;;YAC1D,MAAM,EAAE,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA,4BAA4B,IAAI,QAAQ,EAAE,uBAAuB,CACtE,CAAC;YACF,MAAM,CAAC,MAAA,EAAE,CAAC,UAAU,0CAAE,aAAa,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAA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MAAM,EAAE,CAAC,cAAc,CAAC;YAExB,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YACpC,MAAM,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAE1C,iBAAiB;YACjB,EAAE,CAAC,WAAW,CAAC;gBACb,MAAM,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE;aACM,CAAC,CAAC;YAC/B,MAAM,EAAE,CAAC,cAAc,CAAC;YAExB,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,SAAS,CAAC;YACpC,MAAM,CAAC,EAAE,CAAC,cAAc,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,gBAAgB,EAAE,KAAK,IAAI,EAAE;YAC9B,MAAM,EAAE,GAAG,MAAM,OAAO,CACtB,IAAI,CAAA,4BAA4B,IAAI,QAAQ,EAAE,uBAAuB,CACtE,CAAC;YAEF,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC;YACrB,MAAM,EAAE,CAAC,cAAc,CAAC;YAExB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC;YAEjC,EAAE,CAAC,SAAS,EAAE,CAAC;YACf,MAAM,EAAE,CAAC,cAAc,CAAC;YAExB,MAAM,CAAC,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;QACpC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["/* eslint-disable camelcase */\nimport { html, fixture, expect } from '@open-wc/testing';\nimport Sinon from 'sinon';\n\nimport { SharedResizeObserver } from '@internetarchive/shared-resize-observer';\nimport { ModalManager } from '@internetarchive/modal-manager';\nimport { CustomTheaterInterface } from '../src/interfaces/custom-theater-interface';\nimport { ItemNavigator, ItemType } from '../src/item-navigator';\nimport '../src/item-navigator';\n\nimport '../test/book-nav-stub';\nimport { ItemStub, menuProvider, shortcut } from '../test/ia-stub';\nimport {\n ManageFullscreenEvent,\n ToggleSideMenuOpenEvent,\n SetSideMenuContentsEvent,\n SetSideMenuShortcutsEvent,\n ToggleSidePanelOpenEvent,\n} from '../src/interfaces/event-interfaces';\n\nafterEach(() => {\n Sinon.restore();\n});\n\ndescribe('ItemNavigator', () => {\n describe('Theaters', () => {\n it('shows <ia-no-theater-available> by default', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.exist;\n });\n\n it('shows <book-navigator> if `this.itemType = \"bookreader\"`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .itemType=${ItemType.BOOK}\n .item=${new ItemStub()}\n .modal=${new ModalManager()}\n .sharedObserver=${new SharedResizeObserver()}\n ></ia-item-navigator>`\n );\n\n await el.updateComplete;\n\n el.toggleMenu();\n await el.updateComplete;\n\n const bookNavigator = el.shadowRoot?.querySelector(\n 'book-navigator'\n ) as CustomTheaterInterface;\n await bookNavigator.updateComplete;\n\n console.log('132234234324324324');\n // TODO: add BookNavigator type & import via @internetarchive/bookreader\n // For now, let's check that the BookNavigator element and its properties exist w/ stub\n expect(bookNavigator).to.exist;\n expect(bookNavigator?.modal).to.exist;\n expect(bookNavigator?.baseHost).to.exist;\n expect(bookNavigator?.signedIn).to.be.null;\n expect(bookNavigator?.sharedObserver).to.exist;\n expect(bookNavigator?.sideMenuOpen).to.exist;\n });\n });\n describe('`el.loaded`', () => {\n it('toggles the spinning loader', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.loaded).to.be.null; // initial load\n expect(el.shadowRoot?.querySelector('ia-itemnav-loader')).to.exist;\n });\n it('hides reader section if `!loaded`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n expect(\n el.shadowRoot?.querySelector('#reader')?.getAttribute('class')\n ).to.contain('hide');\n });\n it('shows reader when `loaded` ', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n const mainTheaterSection = el.shadowRoot?.querySelector('#reader');\n expect(mainTheaterSection?.classList.contains('hide')).to.be.false;\n expect(el.loaded).to.be.true;\n // `loaded` property is reflected as DOM attribute\n expect(el.hasAttribute('loaded')).to.equal(true);\n expect(el.shadowRoot?.querySelector('ia-no-theater-available')).to.exist;\n });\n it('listens to `@loadingStateUpdated` to update `loaded`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n await el.updateComplete;\n const spy = Sinon.spy();\n el.loadingStateUpdated = spy;\n el.loaded = null;\n await el.updateComplete;\n // check base properties\n expect(el.loaded).to.equal(null);\n expect(el.item).to.be.undefined;\n\n // hydrate item\n el.item = new ItemStub();\n await el.updateComplete;\n\n // spy fires\n expect(spy.called).to.equal(true);\n expect(spy.callCount).to.equal(1);\n });\n });\n\n describe('`el.sharedObserver`', () => {\n it('uses one', async () => {\n const sharedObserver = new SharedResizeObserver();\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n expect(el.sharedObserver).to.equal(sharedObserver);\n expect(typeof el.handleResize).to.equal('function');\n });\n it('freshly registers handler', async () => {\n const sharedObserver = new SharedResizeObserver();\n const addObserverSpy = Sinon.spy(sharedObserver, 'addObserver');\n\n await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n expect(addObserverSpy.callCount).to.equal(1);\n });\n it('removes handler when component disconnects', async () => {\n const sharedObserver = new SharedResizeObserver();\n const removeObserverSpy = Sinon.spy(sharedObserver, 'removeObserver');\n\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator\n .sharedObserver=${sharedObserver}\n ></ia-item-navigator>`\n );\n\n el.disconnectedCallback();\n await el.updateComplete;\n\n expect(removeObserverSpy.callCount).to.equal(1);\n });\n it('sets menu to overlay if container width is <= 600px', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n\n expect(el.openMenuState).to.equal('shift'); // as starting point\n\n const overlaySize = {\n contentRect: { width: 600 },\n } as ResizeObserverEntry;\n el.handleResize(overlaySize);\n await el.updateComplete;\n\n expect(el.openMenuState).to.equal('overlay'); // changes open menu display to an overlay\n\n const shiftSize = {\n contentRect: { width: 601 },\n } as ResizeObserverEntry;\n el.handleResize(shiftSize);\n await el.updateComplete;\n\n expect(el.openMenuState).to.equal('shift');\n });\n });\n\n describe('`el.modal`', () => {\n it('uses one', async () => {\n const modal = new ModalManager();\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .modal=${modal}></ia-item-navigator>`\n );\n expect(el.modal).to.equal(modal);\n });\n });\n\n describe('full browser window immersion \"fullscreen\"', () => {\n it('creates reflected attribute `viewportinfullscreen`', async () => {\n /** to help with external styling adjustmnents */\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.getAttribute('viewportinfullscreen')).to.be.null;\n\n el.viewportInFullscreen = true;\n await el.updateComplete;\n\n expect(el.getAttribute('viewportinfullscreen')).to.exist;\n });\n it('@ViewportInFullScreen', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator></ia-item-navigator>`\n );\n expect(el.viewportInFullscreen).to.be.null;\n\n const yesFullscreenEvent = {\n detail: {\n isFullScreen: true,\n },\n } as ManageFullscreenEvent;\n el.manageViewportFullscreen(yesFullscreenEvent);\n await el.updateComplete;\n expect(el.viewportInFullscreen).to.be.true;\n\n const noFullscreenEvent = {\n detail: {\n isFullScreen: false,\n },\n } as ManageFullscreenEvent;\n el.manageViewportFullscreen(noFullscreenEvent);\n await el.updateComplete;\n expect(el.viewportInFullscreen).to.be.null;\n });\n });\n\n /* Side menu & shortcuts tests */\n describe('el.menuOpened', () => {\n it('toggles side menu open', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n\n const nav = el.shadowRoot?.querySelector('nav');\n\n expect(nav?.querySelector('#menu')).to.exist;\n // side menu starts closed\n expect(el.menuOpened).to.be.false;\n expect(nav?.querySelector('#menu')?.getAttribute('class')).to.contain(\n 'hidden'\n );\n\n // let's open menu\n el.toggleMenu();\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.true;\n expect(nav?.querySelector('#menu')?.getAttribute('class')).to.not.contain(\n 'hidden'\n );\n });\n\n it('opens menu shortcut with `@manageSideMenuEvents`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n const detail = {\n menuId: 'fullscreen',\n action: 'open',\n };\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n const frame = el.shadowRoot?.querySelector('#frame');\n // default menu open behavior is to side menu open, not overlay\n expect(frame?.getAttribute('class')).to.contain('shift');\n\n expect(el.menuOpened).to.be.false;\n expect(el.openMenu).to.be.undefined;\n expect(frame?.getAttribute('class')).to.not.contain('open');\n\n const event = new CustomEvent('updateSideMenu', {\n detail,\n }) as ToggleSideMenuOpenEvent;\n el.manageSideMenuEvents(event);\n await el.updateComplete;\n\n expect(el.shouldRenderMenu).to.be.true;\n expect(el.menuOpened).to.be.true;\n expect(el.openMenu).to.equal(detail.menuId);\n\n expect(frame?.getAttribute('class')).to.contain('open');\n\n // no menu provided\n const openShortcutSpy = Sinon.spy(el, 'openShortcut');\n const toggleMenuSpy = Sinon.spy(el, 'toggleMenu');\n\n const noMenuProvidedEvent = new CustomEvent('updateSideMenu', {\n detail: {},\n }) as any;\n el.manageSideMenuEvents(noMenuProvidedEvent);\n await el.updateComplete;\n\n expect(openShortcutSpy.called).to.be.false;\n expect(toggleMenuSpy.called).to.be.false;\n\n // toggle menu\n const toggleMenuEvent = new CustomEvent('updateSideMenu', {\n detail: { action: 'toggle', menuId: 'fullscreen' },\n }) as any;\n el.manageSideMenuEvents(toggleMenuEvent);\n await el.updateComplete;\n\n expect(toggleMenuSpy.callCount).to.equal(1);\n\n // open menu\n const openMenuEvent = new CustomEvent('updateSideMenu', {\n detail: { action: 'open', menuId: 'fullscreen' },\n }) as any;\n el.manageSideMenuEvents(openMenuEvent);\n await el.updateComplete;\n\n expect(openShortcutSpy.callCount).to.equal(1);\n });\n });\n\n describe('el.menuContents', () => {\n it('draws side menu when populated', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuContents = [menuProvider];\n await el.updateComplete;\n expect(el.menuContents.length).to.exist;\n expect(el.shouldRenderMenu).to.be.true;\n\n const nav = el.shadowRoot?.querySelector('nav');\n expect(nav).to.exist;\n\n const menuSlider = nav?.querySelector('ia-menu-slider');\n expect(menuSlider).to.exist;\n expect(menuSlider?.getAttribute('manuallyhandleclose')).to.exist;\n expect(menuSlider?.getAttribute('open')).to.exist;\n });\n });\n\n describe('`el.menuShortcuts`', () => {\n it('displays shortcut & toggle side menu button', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n const anotherShortcut = {\n id: 'foo',\n icon: html`<i class=\"foo-shortcut\"></i>`,\n };\n el.menuContents = [menuProvider];\n el.menuShortcuts = [shortcut, anotherShortcut];\n await el.updateComplete;\n\n const nav = el.shadowRoot?.querySelector('nav');\n\n const shortcutsContainer = nav?.querySelector('.shortcuts');\n expect(el.menuShortcuts.length).to.exist;\n expect(nav).to.exist;\n expect(shortcutsContainer).to.exist;\n expect(shortcutsContainer?.querySelector('i.fullscreen-test')).to.exist;\n expect(shortcutsContainer?.querySelector('button.shortcut.foo')).to.exist;\n expect(nav?.querySelector('.toggle-menu')).to.exist;\n });\n });\n\n describe('Menu events', () => {\n it('`el.setMenuShortcuts`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.menuShortcuts.length).to.equal(0);\n\n const menuShortcuts = [shortcut];\n\n el.setMenuShortcuts({\n detail: menuShortcuts,\n } as SetSideMenuShortcutsEvent);\n await el.updateComplete;\n\n expect(el.menuShortcuts.length).to.equal(1);\n });\n it('`el.setMenuContents`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n expect(el.menuContents.length).to.equal(0);\n\n el.setMenuShortcuts({\n detail: [menuProvider],\n } as SetSideMenuContentsEvent);\n await el.updateComplete;\n\n expect(el.menuShortcuts.length).to.equal(1);\n });\n it('`el.setOpenMenu`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.setOpenMenu({\n detail: { id: 'foo' },\n } as ToggleSidePanelOpenEvent);\n await el.updateComplete;\n\n expect(el.openMenu).to.equal('foo');\n expect(el.selectedMenuId).to.equal('foo');\n\n // toggles it off\n el.setOpenMenu({\n detail: { id: 'foo' },\n } as ToggleSidePanelOpenEvent);\n await el.updateComplete;\n\n expect(el.openMenu).to.be.undefined;\n expect(el.selectedMenuId).to.equal('');\n });\n it('`el.closeMenu`', async () => {\n const el = await fixture<ItemNavigator>(\n html`<ia-item-navigator .item=${new ItemStub()}></ia-item-navigator>`\n );\n\n el.menuOpened = true;\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.true;\n\n el.closeMenu();\n await el.updateComplete;\n\n expect(el.menuOpened).to.be.false;\n });\n });\n});\n"]}