@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 +0,0 @@
1
- {"version":3,"file":"email.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/email.ts"],"names":[],"mappings":"AAAA,OAAO,wCAAwC,CAAC;AAChD,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,CAAC,OAAO,MAAO,SAAQ,QAAQ;IAOnC,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,iCAAiC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,OAAO,CAAC;IACvB,CAAC;IAED,IAAa,GAAG;QACd,OAAO,wBAAwB,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,WAAW,MAAM,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;IACzI,CAAC;CACF","sourcesContent":["import '@internetarchive/icon-email/icon-email';\nimport { TemplateResult, html } from 'lit';\nimport Provider from './provider';\nimport type { ProviderParams } from './share-provider-interface';\n\nexport default class extends Provider {\n name: string;\n\n icon: TemplateResult;\n\n class: string;\n\n constructor(params: ProviderParams) {\n super(params);\n this.name = 'Email';\n this.icon = html`<ia-icon-email></ia-icon-email>`;\n this.class = 'email';\n }\n\n override get url(): string {\n return `mailto:?body=https://${this.baseHost}/details/${this.itemPath}&subject=${this.description} : ${this.creator}${this.promoCopy}`;\n }\n}\n"]}
@@ -1,11 +0,0 @@
1
- import '@internetarchive/icon-facebook/icon-facebook';
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-facebook/icon-facebook';
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 = 'Facebook';
8
- this.icon = html `<ia-icon-facebook></ia-icon-facebook>`;
9
- this.class = 'facebook';
10
- }
11
- get url() {
12
- return `https://www.facebook.com/sharer/sharer.php?u=https://${this.baseHost}/details/${this.itemPath}`;
13
- }
14
- }
15
- //# sourceMappingURL=facebook.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"facebook.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/facebook.ts"],"names":[],"mappings":"AAAA,OAAO,8CAA8C,CAAC;AACtD,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,CAAC,OAAO,MAAO,SAAQ,QAAQ;IAOnC,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,uCAAuC,CAAC;QACxD,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC;IAC1B,CAAC;IAED,IAAa,GAAG;QACd,OAAO,wDAAwD,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC1G,CAAC;CACF","sourcesContent":["import '@internetarchive/icon-facebook/icon-facebook';\nimport { TemplateResult, html } from 'lit';\nimport Provider from './provider';\nimport type { ProviderParams } from './share-provider-interface';\n\nexport default class extends Provider {\n name: string;\n\n icon: TemplateResult;\n\n class: string;\n\n constructor(params: ProviderParams) {\n super(params);\n this.name = 'Facebook';\n this.icon = html`<ia-icon-facebook></ia-icon-facebook>`;\n this.class = 'facebook';\n }\n\n override get url(): string {\n return `https://www.facebook.com/sharer/sharer.php?u=https://${this.baseHost}/details/${this.itemPath}`;\n }\n}\n"]}
@@ -1,11 +0,0 @@
1
- import '@internetarchive/icon-pinterest/icon-pinterest';
2
- import { TemplateResult } from 'lit';
3
- import Provider from './provider';
4
- import { 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-pinterest/icon-pinterest';
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 = 'Pinterest';
8
- this.icon = html `<ia-icon-pinterest></ia-icon-pinterest>`;
9
- this.class = 'pinterest';
10
- }
11
- get url() {
12
- return `http://www.pinterest.com/pin/create/button/?url=https://${this.baseHost}/details/${this.itemPath}&description=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
13
- }
14
- }
15
- //# sourceMappingURL=pinterest.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pinterest.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/pinterest.ts"],"names":[],"mappings":"AAAA,OAAO,gDAAgD,CAAC;AACxD,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,CAAC,OAAO,MAAO,SAAQ,QAAQ;IAOnC,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,yCAAyC,CAAC;QAC1D,IAAI,CAAC,KAAK,GAAG,WAAW,CAAC;IAC3B,CAAC;IAED,IAAa,GAAG;QACd,OAAO,2DAA2D,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,QAAQ,gBAAgB,IAAI,CAAC,kBAAkB,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACvM,CAAC;CACF","sourcesContent":["import '@internetarchive/icon-pinterest/icon-pinterest';\nimport { TemplateResult, html } from 'lit';\nimport Provider from './provider';\nimport { ProviderParams } from './share-provider-interface';\n\nexport default class extends Provider {\n name: string;\n\n icon: TemplateResult;\n\n class: string;\n\n constructor(params: ProviderParams) {\n super(params);\n this.name = 'Pinterest';\n this.icon = html`<ia-icon-pinterest></ia-icon-pinterest>`;\n this.class = 'pinterest';\n }\n\n override get url(): string {\n return `http://www.pinterest.com/pin/create/button/?url=https://${this.baseHost}/details/${this.itemPath}&description=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n"]}
@@ -1,20 +0,0 @@
1
- import { TemplateResult } from 'lit';
2
- import { ProviderParams } from './share-provider-interface';
3
- export default class Provider {
4
- promoCopy: string;
5
- description: string;
6
- creator: string;
7
- fileSubPrefix: string;
8
- identifier: string;
9
- baseHost: string;
10
- name: string | undefined;
11
- icon: TemplateResult | string | undefined;
12
- class: string | undefined;
13
- constructor(params: ProviderParams);
14
- get encodedDescription(): string;
15
- get encodedCreator(): string;
16
- get encodedPromoCopy(): string;
17
- get itemPath(): string;
18
- get url(): string;
19
- encodeString(str: string): string;
20
- }
@@ -1,37 +0,0 @@
1
- export default class Provider {
2
- constructor(params) {
3
- this.promoCopy =
4
- ' : Free Download, Borrow, and Streaming : Internet Archive';
5
- this.description = (params === null || params === void 0 ? void 0 : params.description) || '';
6
- this.creator = (params === null || params === void 0 ? void 0 : params.creator) || '';
7
- this.fileSubPrefix = (params === null || params === void 0 ? void 0 : params.fileSubPrefix) || '';
8
- this.identifier = (params === null || params === void 0 ? void 0 : params.identifier) || '';
9
- this.baseHost = (params === null || params === void 0 ? void 0 : params.baseHost) || '';
10
- }
11
- get encodedDescription() {
12
- return this.encodeString(this.description);
13
- }
14
- get encodedCreator() {
15
- return this.encodeString(this.creator);
16
- }
17
- get encodedPromoCopy() {
18
- return this.encodeString(this.promoCopy);
19
- }
20
- get itemPath() {
21
- const encodedFileSubPrefix = this.fileSubPrefix
22
- ? encodeURIComponent(this.fileSubPrefix)
23
- : '';
24
- return encodedFileSubPrefix
25
- ? `${this.identifier}/${encodedFileSubPrefix}`
26
- : this.identifier;
27
- }
28
- get url() {
29
- return `https://${this.baseHost}/details/${this.itemPath}`;
30
- }
31
- encodeString(str) {
32
- if (!str)
33
- return '';
34
- return encodeURIComponent(str.replace(/\s/g, '+')).replace(/%2B/g, '+');
35
- }
36
- }
37
- //# sourceMappingURL=provider.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/provider.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAmB3B,YAAY,MAAsB;QAChC,IAAI,CAAC,SAAS;YACZ,4DAA4D,CAAC;QAE/D,IAAI,CAAC,WAAW,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,WAAW,KAAI,EAAE,CAAC;QAC7C,IAAI,CAAC,OAAO,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,OAAO,KAAI,EAAE,CAAC;QACrC,IAAI,CAAC,aAAa,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,aAAa,KAAI,EAAE,CAAC;QACjD,IAAI,CAAC,UAAU,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,UAAU,KAAI,EAAE,CAAC;QAC3C,IAAI,CAAC,QAAQ,GAAG,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,QAAQ,KAAI,EAAE,CAAC;IACzC,CAAC;IAED,IAAI,kBAAkB;QACpB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAC7C,CAAC;IAED,IAAI,cAAc;QAChB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAED,IAAI,gBAAgB;QAClB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,QAAQ;QACV,MAAM,oBAAoB,GAAG,IAAI,CAAC,aAAa;YAC7C,CAAC,CAAC,kBAAkB,CAAC,IAAI,CAAC,aAAa,CAAC;YACxC,CAAC,CAAC,EAAE,CAAC;QACP,OAAO,oBAAoB;YACzB,CAAC,CAAC,GAAG,IAAI,CAAC,UAAU,IAAI,oBAAoB,EAAE;YAC9C,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC;IACtB,CAAC;IAED,IAAI,GAAG;QACL,OAAO,WAAW,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,QAAQ,EAAE,CAAC;IAC7D,CAAC;IAED,YAAY,CAAC,GAAW;QACtB,IAAI,CAAC,GAAG;YAAE,OAAO,EAAE,CAAC;QACpB,OAAO,kBAAkB,CAAC,GAAG,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1E,CAAC;CACF","sourcesContent":["import { TemplateResult } from 'lit';\nimport { ProviderParams } from './share-provider-interface';\n\nexport default class Provider {\n promoCopy: string;\n\n description: string;\n\n creator: string;\n\n fileSubPrefix: string;\n\n identifier: string;\n\n baseHost: string;\n\n name: string | undefined;\n\n icon: TemplateResult | string | undefined;\n\n class: string | undefined;\n\n constructor(params: ProviderParams) {\n this.promoCopy =\n ' : Free Download, Borrow, and Streaming : Internet Archive';\n\n this.description = params?.description || '';\n this.creator = params?.creator || '';\n this.fileSubPrefix = params?.fileSubPrefix || '';\n this.identifier = params?.identifier || '';\n this.baseHost = params?.baseHost || '';\n }\n\n get encodedDescription(): string {\n return this.encodeString(this.description);\n }\n\n get encodedCreator(): string {\n return this.encodeString(this.creator);\n }\n\n get encodedPromoCopy(): string {\n return this.encodeString(this.promoCopy);\n }\n\n get itemPath(): string {\n const encodedFileSubPrefix = this.fileSubPrefix\n ? encodeURIComponent(this.fileSubPrefix)\n : '';\n return encodedFileSubPrefix\n ? `${this.identifier}/${encodedFileSubPrefix}`\n : this.identifier;\n }\n\n get url(): string {\n return `https://${this.baseHost}/details/${this.itemPath}`;\n }\n\n encodeString(str: string): string {\n if (!str) return '';\n return encodeURIComponent(str.replace(/\\s/g, '+')).replace(/%2B/g, '+');\n }\n}\n"]}
@@ -1,13 +0,0 @@
1
- import { TemplateResult } from 'lit';
2
- export type ProviderParams = {
3
- class: string;
4
- icon: TemplateResult | string;
5
- name: string;
6
- promoCopy: string;
7
- description: string;
8
- creator: string;
9
- fileSubPrefix: string;
10
- identifier: string;
11
- baseHost: string;
12
- itemPath: string;
13
- };
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=share-provider-interface.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"share-provider-interface.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/share-provider-interface.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult } from 'lit';\n\nexport type ProviderParams = {\n class: string;\n icon: TemplateResult | string;\n name: string;\n\n promoCopy: string;\n description: string;\n creator: string;\n\n // ia item\n fileSubPrefix: string;\n identifier: string;\n baseHost: string;\n itemPath: string;\n};\n"]}
@@ -1,11 +0,0 @@
1
- import '@internetarchive/icon-tumblr/icon-tumblr';
2
- import { TemplateResult } from 'lit';
3
- import Provider from './provider';
4
- import { 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-tumblr/icon-tumblr';
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 = 'Tumblr';
8
- this.icon = html `<ia-icon-tumblr></ia-icon-tumblr>`;
9
- this.class = 'tumblr';
10
- }
11
- get url() {
12
- return `https://www.tumblr.com/share/video?embed=%3Ciframe+width%3D%22640%22+height%3D%22480%22+frameborder%3D%220%22+allowfullscreen+src%3D%22https%3A%2F%2F${this.baseHost}%2Fembed%2F%22+webkitallowfullscreen%3D%22true%22+mozallowfullscreen%3D%22true%22%26gt%3B%26lt%3B%2Fiframe%3E&name=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
13
- }
14
- }
15
- //# sourceMappingURL=tumblr.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tumblr.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/tumblr.ts"],"names":[],"mappings":"AAAA,OAAO,0CAA0C,CAAC;AAClD,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,CAAC,OAAO,MAAO,SAAQ,QAAQ;IAOnC,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC;QACrB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,mCAAmC,CAAC;QACpD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC;IACxB,CAAC;IAED,IAAa,GAAG;QACd,OAAO,wJAAwJ,IAAI,CAAC,QAAQ,sHAAsH,IAAI,CAAC,kBAAkB,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACjX,CAAC;CACF","sourcesContent":["import '@internetarchive/icon-tumblr/icon-tumblr';\nimport { TemplateResult, html } from 'lit';\nimport Provider from './provider';\nimport { ProviderParams } from './share-provider-interface';\n\nexport default class extends Provider {\n name: string;\n\n icon: TemplateResult;\n\n class: string;\n\n constructor(params: ProviderParams) {\n super(params);\n this.name = 'Tumblr';\n this.icon = html`<ia-icon-tumblr></ia-icon-tumblr>`;\n this.class = 'tumblr';\n }\n\n override get url(): string {\n return `https://www.tumblr.com/share/video?embed=%3Ciframe+width%3D%22640%22+height%3D%22480%22+frameborder%3D%220%22+allowfullscreen+src%3D%22https%3A%2F%2F${this.baseHost}%2Fembed%2F%22+webkitallowfullscreen%3D%22true%22+mozallowfullscreen%3D%22true%22%26gt%3B%26lt%3B%2Fiframe%3E&name=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n"]}
@@ -1,11 +0,0 @@
1
- import '@internetarchive/icon-twitter/icon-twitter';
2
- import { TemplateResult } from 'lit';
3
- import Provider from './provider';
4
- import { ProviderParams } from './share-provider-interface';
5
- export default class TwitterProvider 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-twitter/icon-twitter';
2
- import { html } from 'lit';
3
- import Provider from './provider';
4
- export default class TwitterProvider extends Provider {
5
- constructor(params) {
6
- super(params);
7
- this.name = 'Twitter';
8
- this.icon = html `<ia-icon-twitter></ia-icon-twitter>`;
9
- this.class = 'twitter';
10
- }
11
- get url() {
12
- return `https://twitter.com/intent/tweet?url=https://${this.baseHost}/details/${this.itemPath}&via=internetarchive&text=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
13
- }
14
- }
15
- //# sourceMappingURL=twitter.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"twitter.js","sourceRoot":"","sources":["../../../../src/menus/share-providers/twitter.ts"],"names":[],"mappings":"AAAA,OAAO,4CAA4C,CAAC;AACpD,OAAO,EAAkB,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3C,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,QAAQ;IAOnD,YAAY,MAAsB;QAChC,KAAK,CAAC,MAAM,CAAC,CAAC;QACd,IAAI,CAAC,IAAI,GAAG,SAAS,CAAC;QACtB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA,qCAAqC,CAAC;QACtD,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;IACzB,CAAC;IAED,IAAa,GAAG;QACd,OAAO,gDAAgD,IAAI,CAAC,QAAQ,YAAY,IAAI,CAAC,QAAQ,6BAA6B,IAAI,CAAC,kBAAkB,QAAQ,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;IACzM,CAAC;CACF","sourcesContent":["import '@internetarchive/icon-twitter/icon-twitter';\nimport { TemplateResult, html } from 'lit';\nimport Provider from './provider';\nimport { ProviderParams } from './share-provider-interface';\n\nexport default class TwitterProvider extends Provider {\n name: string;\n\n icon: TemplateResult;\n\n class: string;\n\n constructor(params: ProviderParams) {\n super(params);\n this.name = 'Twitter';\n this.icon = html`<ia-icon-twitter></ia-icon-twitter>`;\n this.class = 'twitter';\n }\n\n override get url(): string {\n return `https://twitter.com/intent/tweet?url=https://${this.baseHost}/details/${this.itemPath}&via=internetarchive&text=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;\n }\n}\n"]}
@@ -1,23 +0,0 @@
1
- import '@internetarchive/icon-email/icon-email';
2
- import { TemplateResult, html } from 'lit';
3
- import Provider from './provider';
4
- import type { ProviderParams } from './share-provider-interface';
5
-
6
- export default class extends Provider {
7
- name: string;
8
-
9
- icon: TemplateResult;
10
-
11
- class: string;
12
-
13
- constructor(params: ProviderParams) {
14
- super(params);
15
- this.name = 'Email';
16
- this.icon = html`<ia-icon-email></ia-icon-email>`;
17
- this.class = 'email';
18
- }
19
-
20
- override get url(): string {
21
- return `mailto:?body=https://${this.baseHost}/details/${this.itemPath}&subject=${this.description} : ${this.creator}${this.promoCopy}`;
22
- }
23
- }
@@ -1,23 +0,0 @@
1
- import '@internetarchive/icon-facebook/icon-facebook';
2
- import { TemplateResult, html } from 'lit';
3
- import Provider from './provider';
4
- import type { ProviderParams } from './share-provider-interface';
5
-
6
- export default class extends Provider {
7
- name: string;
8
-
9
- icon: TemplateResult;
10
-
11
- class: string;
12
-
13
- constructor(params: ProviderParams) {
14
- super(params);
15
- this.name = 'Facebook';
16
- this.icon = html`<ia-icon-facebook></ia-icon-facebook>`;
17
- this.class = 'facebook';
18
- }
19
-
20
- override get url(): string {
21
- return `https://www.facebook.com/sharer/sharer.php?u=https://${this.baseHost}/details/${this.itemPath}`;
22
- }
23
- }
@@ -1,23 +0,0 @@
1
- import '@internetarchive/icon-pinterest/icon-pinterest';
2
- import { TemplateResult, html } from 'lit';
3
- import Provider from './provider';
4
- import { ProviderParams } from './share-provider-interface';
5
-
6
- export default class extends Provider {
7
- name: string;
8
-
9
- icon: TemplateResult;
10
-
11
- class: string;
12
-
13
- constructor(params: ProviderParams) {
14
- super(params);
15
- this.name = 'Pinterest';
16
- this.icon = html`<ia-icon-pinterest></ia-icon-pinterest>`;
17
- this.class = 'pinterest';
18
- }
19
-
20
- override get url(): string {
21
- return `http://www.pinterest.com/pin/create/button/?url=https://${this.baseHost}/details/${this.itemPath}&description=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
22
- }
23
- }
@@ -1,63 +0,0 @@
1
- import { TemplateResult } from 'lit';
2
- import { ProviderParams } from './share-provider-interface';
3
-
4
- export default class Provider {
5
- promoCopy: string;
6
-
7
- description: string;
8
-
9
- creator: string;
10
-
11
- fileSubPrefix: string;
12
-
13
- identifier: string;
14
-
15
- baseHost: string;
16
-
17
- name: string | undefined;
18
-
19
- icon: TemplateResult | string | undefined;
20
-
21
- class: string | undefined;
22
-
23
- constructor(params: ProviderParams) {
24
- this.promoCopy =
25
- ' : Free Download, Borrow, and Streaming : Internet Archive';
26
-
27
- this.description = params?.description || '';
28
- this.creator = params?.creator || '';
29
- this.fileSubPrefix = params?.fileSubPrefix || '';
30
- this.identifier = params?.identifier || '';
31
- this.baseHost = params?.baseHost || '';
32
- }
33
-
34
- get encodedDescription(): string {
35
- return this.encodeString(this.description);
36
- }
37
-
38
- get encodedCreator(): string {
39
- return this.encodeString(this.creator);
40
- }
41
-
42
- get encodedPromoCopy(): string {
43
- return this.encodeString(this.promoCopy);
44
- }
45
-
46
- get itemPath(): string {
47
- const encodedFileSubPrefix = this.fileSubPrefix
48
- ? encodeURIComponent(this.fileSubPrefix)
49
- : '';
50
- return encodedFileSubPrefix
51
- ? `${this.identifier}/${encodedFileSubPrefix}`
52
- : this.identifier;
53
- }
54
-
55
- get url(): string {
56
- return `https://${this.baseHost}/details/${this.itemPath}`;
57
- }
58
-
59
- encodeString(str: string): string {
60
- if (!str) return '';
61
- return encodeURIComponent(str.replace(/\s/g, '+')).replace(/%2B/g, '+');
62
- }
63
- }
@@ -1,17 +0,0 @@
1
- import { TemplateResult } from 'lit';
2
-
3
- export type ProviderParams = {
4
- class: string;
5
- icon: TemplateResult | string;
6
- name: string;
7
-
8
- promoCopy: string;
9
- description: string;
10
- creator: string;
11
-
12
- // ia item
13
- fileSubPrefix: string;
14
- identifier: string;
15
- baseHost: string;
16
- itemPath: string;
17
- };
@@ -1,23 +0,0 @@
1
- import '@internetarchive/icon-tumblr/icon-tumblr';
2
- import { TemplateResult, html } from 'lit';
3
- import Provider from './provider';
4
- import { ProviderParams } from './share-provider-interface';
5
-
6
- export default class extends Provider {
7
- name: string;
8
-
9
- icon: TemplateResult;
10
-
11
- class: string;
12
-
13
- constructor(params: ProviderParams) {
14
- super(params);
15
- this.name = 'Tumblr';
16
- this.icon = html`<ia-icon-tumblr></ia-icon-tumblr>`;
17
- this.class = 'tumblr';
18
- }
19
-
20
- override get url(): string {
21
- return `https://www.tumblr.com/share/video?embed=%3Ciframe+width%3D%22640%22+height%3D%22480%22+frameborder%3D%220%22+allowfullscreen+src%3D%22https%3A%2F%2F${this.baseHost}%2Fembed%2F%22+webkitallowfullscreen%3D%22true%22+mozallowfullscreen%3D%22true%22%26gt%3B%26lt%3B%2Fiframe%3E&name=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
22
- }
23
- }
@@ -1,23 +0,0 @@
1
- import '@internetarchive/icon-twitter/icon-twitter';
2
- import { TemplateResult, html } from 'lit';
3
- import Provider from './provider';
4
- import { ProviderParams } from './share-provider-interface';
5
-
6
- export default class TwitterProvider extends Provider {
7
- name: string;
8
-
9
- icon: TemplateResult;
10
-
11
- class: string;
12
-
13
- constructor(params: ProviderParams) {
14
- super(params);
15
- this.name = 'Twitter';
16
- this.icon = html`<ia-icon-twitter></ia-icon-twitter>`;
17
- this.class = 'twitter';
18
- }
19
-
20
- override get url(): string {
21
- return `https://twitter.com/intent/tweet?url=https://${this.baseHost}/details/${this.itemPath}&via=internetarchive&text=${this.encodedDescription}+%3A+${this.encodedCreator}${this.encodedPromoCopy}`;
22
- }
23
- }
@@ -1,78 +0,0 @@
1
- import { html, fixture, expect } from '@open-wc/testing';
2
- import sinon from 'sinon';
3
- import '../src/ia-sharing-options.js';
4
-
5
- const identifier = 'goody';
6
- const itemType = 'book';
7
- const creator = 'Welsh, Charles';
8
- const description = 'The history of Little Goody Two-Shoes : otherwise called Mrs. Margery Two-Shoes ... [1766 edition]';
9
-
10
- const container = (optionalFileSubprefix = '') => (
11
- html`<ia-sharing-options
12
- identifier="${identifier}"
13
- type="${itemType}"
14
- creator="${creator}"
15
- description="${description}"
16
- baseHost="archive.org"
17
- fileSubPrefix="${optionalFileSubprefix}"
18
- ></ia-sharing-options>`
19
- );
20
-
21
- describe('<ia-sharing-options>', () => {
22
- afterEach(() => {
23
- sinon.restore();
24
- });
25
-
26
- it('sets default properties', async () => {
27
- const el = await fixture(container());
28
-
29
- expect(el.identifier).to.equal(identifier);
30
- expect(el.type).to.equal(itemType);
31
- expect(el.creator).to.equal(creator);
32
- expect(el.description).to.equal(description);
33
- });
34
-
35
- it('renders buttons for each sharing method', async () => {
36
- const el = await fixture(container());
37
-
38
- await el.updateComplete;
39
-
40
- el.sharingOptions.forEach((option) => {
41
- const button = el.shadowRoot.querySelector(`a.${option.class}`);
42
- expect(button).to.exist;
43
- expect(button.getAttribute('href')).to.equal(option.url);
44
- });
45
- });
46
-
47
- it('toggles visibility of embed options', async () => {
48
- const el = await fixture(container());
49
-
50
- el.toggleEmbedOptions(new Event('click'));
51
- await el.updateComplete;
52
-
53
- expect(el.embedOptionsVisible).to.equal(true);
54
- });
55
-
56
- it('does not show internal header by default', async () => {
57
- const el = await fixture(container());
58
- expect(el.shadowRoot.querySelector('header')).to.be.null;
59
- });
60
-
61
- it('does shows internal header when requested', async () => {
62
- const el = await fixture(container());
63
- el.renderHeader = true;
64
- await el.updateComplete;
65
- expect(el.shadowRoot.querySelector('header')).to.not.be.null;
66
- });
67
-
68
- it('sets file subprefix to end of share URLs if present', async () => {
69
- const optionalFileSubprefix = 'foo- bar - 123-';
70
- const el = await fixture(container(optionalFileSubprefix));
71
-
72
- el.sharingOptions.forEach((option) => {
73
- if (option.name !== 'Tumblr') {
74
- expect(option.url).to.contain(encodeURIComponent(optionalFileSubprefix));
75
- }
76
- });
77
- });
78
- });