@internetarchive/elements 0.2.14-webdev-8969.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +20 -0
- package/dist/src/elements/ia-item-navigator/ia-item-navigator.d.ts +97 -0
- package/dist/src/elements/ia-item-navigator/ia-item-navigator.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/ia-item-navigator.js +588 -0
- package/dist/src/elements/ia-item-navigator/ia-item-navigator.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.d.ts +39 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.js +249 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-button.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.d.ts +55 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.js +394 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-menu-slider.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.d.ts +20 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.js +102 -0
- package/dist/src/elements/ia-item-navigator/ia-itemnav-no-theater-available.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/icons/collapse-sidebar.svg +7 -0
- package/dist/src/elements/ia-item-navigator/icons/ellipses.svg +7 -0
- package/dist/src/elements/ia-item-navigator/icons.d.ts +13 -0
- package/dist/src/elements/ia-item-navigator/icons.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/icons.js +16 -0
- package/dist/src/elements/ia-item-navigator/icons.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.d.ts +41 -0
- package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.js +2 -0
- package/dist/src/elements/ia-item-navigator/interfaces/event-interfaces.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.d.ts +23 -0
- package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.js +2 -0
- package/dist/src/elements/ia-item-navigator/interfaces/menu-interfaces.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.d.ts +47 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.js +352 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.d.ts +22 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.js +137 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.d.ts +40 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.js +217 -0
- package/dist/src/elements/ia-item-navigator/menus/ia-itemnav-viewable-files-panel.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/email.svg +6 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/facebook.svg +6 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/link.svg +6 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/list.svg +3 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/pinterest.svg +6 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/share.svg +6 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/sort-asc.svg +22 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/sort-desc.svg +21 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/sort-neutral.svg +13 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/tumblr.svg +6 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/twitter.svg +6 -0
- package/dist/src/elements/ia-item-navigator/menus/icons/viewable-files.svg +6 -0
- package/dist/src/elements/ia-item-navigator/menus/models.d.ts +17 -0
- package/dist/src/elements/ia-item-navigator/menus/models.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/menus/models.js +2 -0
- package/dist/src/elements/ia-item-navigator/menus/models.js.map +1 -0
- package/dist/src/elements/ia-item-navigator/menus/share-icons.d.ts +16 -0
- package/dist/src/elements/ia-item-navigator/menus/share-icons.d.ts.map +1 -0
- package/dist/src/elements/ia-item-navigator/menus/share-icons.js +23 -0
- package/dist/src/elements/ia-item-navigator/menus/share-icons.js.map +1 -0
- package/dist/src/elements/ia-playback-controls/ia-playback-controls.d.ts +12 -3
- package/dist/src/elements/ia-playback-controls/ia-playback-controls.d.ts.map +1 -1
- package/dist/src/elements/ia-playback-controls/ia-playback-controls.js +26 -9
- package/dist/src/elements/ia-playback-controls/ia-playback-controls.js.map +1 -1
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.d.ts +51 -5
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.d.ts.map +1 -1
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.js +156 -16
- package/dist/src/elements/ia-status-indicator/ia-status-indicator.js.map +1 -1
- package/dist/src/elements/ia-status-indicator/icons/audio.svg +5 -0
- package/dist/src/elements/ia-status-indicator/icons/collection.svg +5 -0
- package/dist/src/elements/ia-status-indicator/icons/etree.svg +5 -0
- package/dist/src/elements/ia-status-indicator/icons/images.svg +6 -0
- package/dist/src/elements/ia-status-indicator/icons/search.svg +10 -0
- package/dist/src/elements/ia-status-indicator/icons/software.svg +6 -0
- package/dist/src/elements/ia-status-indicator/icons/texts.svg +6 -0
- package/dist/src/elements/ia-status-indicator/icons/tv.svg +5 -0
- package/dist/src/elements/ia-status-indicator/icons/video.svg +6 -0
- package/dist/src/elements/ia-status-indicator/icons/web.svg +6 -0
- package/dist/src/elements/ia-transcript-view/ia-transcript-view.d.ts +6 -0
- package/dist/src/elements/ia-transcript-view/ia-transcript-view.d.ts.map +1 -1
- package/dist/src/elements/ia-transcript-view/ia-transcript-view.js +20 -1
- package/dist/src/elements/ia-transcript-view/ia-transcript-view.js.map +1 -1
- package/dist/src/elements/index.d.ts +4 -0
- package/dist/src/elements/index.d.ts.map +1 -1
- package/dist/src/elements/index.js +4 -0
- package/dist/src/elements/index.js.map +1 -1
- package/dist/src/util/masked-icon.d.ts +24 -0
- package/dist/src/util/masked-icon.d.ts.map +1 -0
- package/dist/src/util/masked-icon.js +30 -0
- package/dist/src/util/masked-icon.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-item-navigator/interfaces/event-interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,MAAM,EACP,MAAM,mBAAmB,CAAC;AAE3B,sCAAsC;AACtC,MAAM,WAAW,uBAAwB,SAAQ,WAAW;IAC1D,IAAI,EAAE,gBAAgB,CAAC;IACvB,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,EAAE,CAAC;QAChC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,EAAE,CAAC;KAChC,CAAC;CACH;AAED,sBAAsB;AACtB,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,IAAI,EAAE,kBAAkB,CAAC;IACzB,MAAM,EAAE;QACN,EAAE,EAAE,MAAM,GAAG,EAAE,CAAC;KACjB,CAAC;CACH;AAED,wCAAwC;AACxC,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED,4CAA4C;AAC5C,MAAM,WAAW,yBAA0B,SAAQ,WAAW;IAC5D,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,qBAAqB,EAAE,CAAC;CACjC;AAED,8BAA8B;AAC9B,MAAM,WAAW,qBAAsB,SAAQ,WAAW;IACxD,IAAI,EAAE,sBAAsB,CAAC;IAC7B,MAAM,EAAE;QACN,YAAY,EAAE,OAAO,CAAC;KACvB,CAAC;CACH;AAED,2BAA2B;AAC3B,MAAM,WAAW,wBAAyB,SAAQ,WAAW;IAC3D,IAAI,EAAE,qBAAqB,CAAC;IAC5B,MAAM,EAAE;QACN,MAAM,EAAE,OAAO,CAAC;KACjB,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"event-interfaces.js","sourceRoot":"","sources":["../../../../../src/elements/ia-item-navigator/interfaces/event-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import {\n MenuProviderInterface,\n MenuShortcutInterface,\n MenuId,\n} from './menu-interfaces';\n\n/** Toggles Menu && Sets open panel */\nexport interface ToggleSideMenuOpenEvent extends CustomEvent {\n type: 'updateSideMenu';\n detail: {\n menuId: MenuId | undefined | '';\n action: 'open' | 'toggle' | '';\n };\n}\n\n/** Sets open panel */\nexport interface ToggleSidePanelOpenEvent extends CustomEvent {\n type: 'menuTypeSelected';\n detail: {\n id: MenuId | '';\n };\n}\n\n/** Sets menu order that is displayed */\nexport interface SetSideMenuContentsEvent extends CustomEvent {\n type: 'menuUpdated';\n detail: MenuProviderInterface[];\n}\n\n/** Sets menu shortcuts that is displayed */\nexport interface SetSideMenuShortcutsEvent extends CustomEvent {\n type: 'menuUpdated';\n detail: MenuShortcutInterface[];\n}\n\n/** Toggles fullscreen mode */\nexport interface ManageFullscreenEvent extends CustomEvent {\n type: 'ViewportInFullScreen';\n detail: {\n isFullScreen: boolean;\n };\n}\n\n/** Toggles loading view */\nexport interface LoadingStateUpdatedEvent extends CustomEvent {\n type: 'loadingStateUpdated';\n detail: {\n loaded: boolean;\n };\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TemplateResult } from 'lit';
|
|
2
|
+
export type MenuId = string;
|
|
3
|
+
export interface MenuShortcutInterface {
|
|
4
|
+
icon: TemplateResult;
|
|
5
|
+
id: MenuId;
|
|
6
|
+
label: string;
|
|
7
|
+
}
|
|
8
|
+
export interface MenuDetailsInterface extends MenuShortcutInterface {
|
|
9
|
+
menuDetails?: TemplateResult;
|
|
10
|
+
selected?: boolean;
|
|
11
|
+
followable?: boolean;
|
|
12
|
+
href?: string;
|
|
13
|
+
component?: TemplateResult;
|
|
14
|
+
}
|
|
15
|
+
export interface MenuProviderInterface extends MenuDetailsInterface {
|
|
16
|
+
/** archive.org item identifier. */
|
|
17
|
+
identifier: string;
|
|
18
|
+
baseHost: string;
|
|
19
|
+
subPrefix: string;
|
|
20
|
+
updated?: unknown;
|
|
21
|
+
actionButton?: TemplateResult;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=menu-interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-interfaces.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-item-navigator/interfaces/menu-interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAErC,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC;AAC5B,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,cAAc,CAAC;IACrB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,oBAAqB,SAAQ,qBAAqB;IACjE,WAAW,CAAC,EAAE,cAAc,CAAC;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,cAAc,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAsB,SAAQ,oBAAoB;IACjE,mCAAmC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,cAAc,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-interfaces.js","sourceRoot":"","sources":["../../../../../src/elements/ia-item-navigator/interfaces/menu-interfaces.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateResult } from 'lit';\n\nexport type MenuId = string;\nexport interface MenuShortcutInterface {\n icon: TemplateResult;\n id: MenuId;\n label: string;\n}\n\nexport interface MenuDetailsInterface extends MenuShortcutInterface {\n menuDetails?: TemplateResult;\n selected?: boolean;\n followable?: boolean;\n href?: string;\n component?: TemplateResult;\n}\n\nexport interface MenuProviderInterface extends MenuDetailsInterface {\n /** archive.org item identifier. */\n identifier: string;\n baseHost: string;\n subPrefix: string;\n updated?: unknown;\n actionButton?: TemplateResult;\n}\n"]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { LitElement, nothing, PropertyValues, TemplateResult, type CSSResultGroup } from 'lit';
|
|
2
|
+
import { shareIcon } from './share-icons.js';
|
|
3
|
+
type ShareOption = {
|
|
4
|
+
name: string;
|
|
5
|
+
icon: TemplateResult | string;
|
|
6
|
+
url: string;
|
|
7
|
+
};
|
|
8
|
+
/** Icon for the share menu shortcut / menu entry. */
|
|
9
|
+
export { shareIcon };
|
|
10
|
+
/**
|
|
11
|
+
* The "share this item" side panel: social sharing links (Twitter, Facebook,
|
|
12
|
+
* Tumblr, Pinterest, email) plus copyable iframe / bbcode embed snippets.
|
|
13
|
+
* Sharing options are derived from the item identifier/metadata and rebuilt
|
|
14
|
+
* whenever `sharingOptions` is reset to empty.
|
|
15
|
+
*/
|
|
16
|
+
export declare class IAItemNavSharePanel extends LitElement {
|
|
17
|
+
baseHost: string;
|
|
18
|
+
creator: string;
|
|
19
|
+
description: string;
|
|
20
|
+
embedOptionsVisible: boolean;
|
|
21
|
+
identifier: string;
|
|
22
|
+
sharingOptions: ShareOption[];
|
|
23
|
+
type: string;
|
|
24
|
+
renderHeader: boolean;
|
|
25
|
+
fileSubPrefix: string;
|
|
26
|
+
private copyNoteTimeouts;
|
|
27
|
+
updated(changed: PropertyValues): void;
|
|
28
|
+
loadProviders(): void;
|
|
29
|
+
/**
|
|
30
|
+
* Copies the embed snippet in the clicked `.code` block, preferring the async
|
|
31
|
+
* Clipboard API and falling back to the legacy `execCommand` path for
|
|
32
|
+
* browsers that lack it, then briefly flashes the "Copied" note.
|
|
33
|
+
*/
|
|
34
|
+
private copyToClipboard;
|
|
35
|
+
get iframeEmbed(): string;
|
|
36
|
+
get bbcodeEmbed(): string;
|
|
37
|
+
get helpURL(): string;
|
|
38
|
+
get header(): TemplateResult | typeof nothing;
|
|
39
|
+
render(): TemplateResult;
|
|
40
|
+
static get styles(): CSSResultGroup;
|
|
41
|
+
}
|
|
42
|
+
declare global {
|
|
43
|
+
interface HTMLElementTagNameMap {
|
|
44
|
+
'ia-itemnav-share-panel': IAItemNavSharePanel;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=ia-itemnav-share-panel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ia-itemnav-share-panel.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-item-navigator/menus/ia-itemnav-share-panel.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACd,KAAK,cAAc,EACpB,MAAM,KAAK,CAAC;AAGb,OAAO,EACL,SAAS,EAOV,MAAM,eAAe,CAAC;AAEvB,KAAK,WAAW,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,cAAc,GAAG,MAAM,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF,qDAAqD;AACrD,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB;;;;;GAKG;AACH,qBACa,mBAAoB,SAAQ,UAAU;IACrB,QAAQ,SAAiB;IAEzB,OAAO,SAAM;IAEb,WAAW,SAAM;IAEhB,mBAAmB,UAAS;IAE7B,UAAU,SAAM;IAEjB,cAAc,EAAE,WAAW,EAAE,CAAM;IAElC,IAAI,SAAM;IAET,YAAY,UAAS;IAEtB,aAAa,SAAM;IAE/C,OAAO,CAAC,gBAAgB,CAGpB;IAEJ,OAAO,CAAC,OAAO,EAAE,cAAc,GAAG,IAAI;IAMtC,aAAa,IAAI,IAAI;IA+DrB;;;;OAIG;YACW,eAAe;IAuB7B,IAAI,WAAW,IAAI,MAAM,CAMxB;IAED,IAAI,WAAW,IAAI,MAAM,CAExB;IAED,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED,IAAI,MAAM,IAAI,cAAc,GAAG,OAAO,OAAO,CAG5C;IAED,MAAM,IAAI,cAAc;IAwCxB,MAAM,KAAK,MAAM,IAAI,cAAc,CAwJlC;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,wBAAwB,EAAE,mBAAmB,CAAC;KAC/C;CACF"}
|
|
@@ -0,0 +1,352 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement, nothing, } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import themeStyles from '../../../themes/theme-styles.js';
|
|
5
|
+
import { shareIcon, twitterIcon, facebookIcon, tumblrIcon, pinterestIcon, emailIcon, linkIcon, } from './share-icons.js';
|
|
6
|
+
/** Icon for the share menu shortcut / menu entry. */
|
|
7
|
+
export { shareIcon };
|
|
8
|
+
/**
|
|
9
|
+
* The "share this item" side panel: social sharing links (Twitter, Facebook,
|
|
10
|
+
* Tumblr, Pinterest, email) plus copyable iframe / bbcode embed snippets.
|
|
11
|
+
* Sharing options are derived from the item identifier/metadata and rebuilt
|
|
12
|
+
* whenever `sharingOptions` is reset to empty.
|
|
13
|
+
*/
|
|
14
|
+
let IAItemNavSharePanel = class IAItemNavSharePanel extends LitElement {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.baseHost = 'archive.org';
|
|
18
|
+
this.creator = '';
|
|
19
|
+
this.description = '';
|
|
20
|
+
this.embedOptionsVisible = false;
|
|
21
|
+
this.identifier = '';
|
|
22
|
+
this.sharingOptions = [];
|
|
23
|
+
this.type = '';
|
|
24
|
+
this.renderHeader = false;
|
|
25
|
+
this.fileSubPrefix = '';
|
|
26
|
+
this.copyNoteTimeouts = new WeakMap();
|
|
27
|
+
}
|
|
28
|
+
updated(changed) {
|
|
29
|
+
if (changed.has('sharingOptions') && !this.sharingOptions.length) {
|
|
30
|
+
this.loadProviders();
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
loadProviders() {
|
|
34
|
+
let shareUrl = `https://${this.baseHost}/details/${this.identifier}`;
|
|
35
|
+
if (this.fileSubPrefix) {
|
|
36
|
+
shareUrl += `/${this.fileSubPrefix}`;
|
|
37
|
+
}
|
|
38
|
+
const shareBlurb = [
|
|
39
|
+
this.description,
|
|
40
|
+
this.creator,
|
|
41
|
+
'Free Download, Borrow, and Streaming',
|
|
42
|
+
'Internet Archive',
|
|
43
|
+
]
|
|
44
|
+
.filter(Boolean)
|
|
45
|
+
.join(' : ');
|
|
46
|
+
this.sharingOptions = [
|
|
47
|
+
{
|
|
48
|
+
name: 'Twitter',
|
|
49
|
+
icon: twitterIcon,
|
|
50
|
+
url: `https://twitter.com/intent/tweet?${new URLSearchParams({
|
|
51
|
+
url: shareUrl,
|
|
52
|
+
text: shareBlurb,
|
|
53
|
+
via: 'internetarchive',
|
|
54
|
+
})}`,
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'Facebook',
|
|
58
|
+
icon: facebookIcon,
|
|
59
|
+
url: `https://www.facebook.com/sharer/sharer.php?${new URLSearchParams({
|
|
60
|
+
u: shareUrl,
|
|
61
|
+
})}`,
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'Tumblr',
|
|
65
|
+
icon: tumblrIcon,
|
|
66
|
+
url: `https://www.tumblr.com/widgets/share/tool/preview?${new URLSearchParams({
|
|
67
|
+
posttype: 'link',
|
|
68
|
+
canonicalUrl: shareUrl,
|
|
69
|
+
title: shareBlurb,
|
|
70
|
+
})}`,
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'Pinterest',
|
|
74
|
+
icon: pinterestIcon,
|
|
75
|
+
url: `http://www.pinterest.com/pin/create/button/?${new URLSearchParams({
|
|
76
|
+
url: shareUrl,
|
|
77
|
+
description: shareBlurb,
|
|
78
|
+
})}`,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: 'Email',
|
|
82
|
+
icon: emailIcon,
|
|
83
|
+
url: `mailto:?${new URLSearchParams({
|
|
84
|
+
subject: shareBlurb,
|
|
85
|
+
body: shareUrl,
|
|
86
|
+
})}`,
|
|
87
|
+
},
|
|
88
|
+
];
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Copies the embed snippet in the clicked `.code` block, preferring the async
|
|
92
|
+
* Clipboard API and falling back to the legacy `execCommand` path for
|
|
93
|
+
* browsers that lack it, then briefly flashes the "Copied" note.
|
|
94
|
+
*/
|
|
95
|
+
async copyToClipboard(event) {
|
|
96
|
+
const currentTarget = event.currentTarget;
|
|
97
|
+
const textarea = currentTarget.querySelector('textarea');
|
|
98
|
+
const note = currentTarget.querySelector('small');
|
|
99
|
+
if (!textarea || !note)
|
|
100
|
+
return;
|
|
101
|
+
try {
|
|
102
|
+
await navigator.clipboard.writeText(textarea.value);
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
// Fallback for browsers without the async Clipboard API.
|
|
106
|
+
textarea.select();
|
|
107
|
+
document.execCommand('copy');
|
|
108
|
+
textarea.blur();
|
|
109
|
+
}
|
|
110
|
+
note.classList.add('visible');
|
|
111
|
+
clearTimeout(this.copyNoteTimeouts.get(note));
|
|
112
|
+
this.copyNoteTimeouts.set(note, setTimeout(() => note.classList.remove('visible'), 4000));
|
|
113
|
+
}
|
|
114
|
+
get iframeEmbed() {
|
|
115
|
+
return `<iframe
|
|
116
|
+
src="https://${this.baseHost}/embed/${this.identifier}"
|
|
117
|
+
width="560" height="384" frameborder="0"
|
|
118
|
+
webkitallowfullscreen="true" mozallowfullscreen="true" allowfullscreen
|
|
119
|
+
></iframe>`;
|
|
120
|
+
}
|
|
121
|
+
get bbcodeEmbed() {
|
|
122
|
+
return `[archiveorg ${this.identifier} width=560 height=384 frameborder=0 webkitallowfullscreen=true mozallowfullscreen=true]`;
|
|
123
|
+
}
|
|
124
|
+
get helpURL() {
|
|
125
|
+
return `https://${this.baseHost}/help/audio.php?identifier=${this.identifier}`;
|
|
126
|
+
}
|
|
127
|
+
get header() {
|
|
128
|
+
const header = html `<header><h3>Share this ${this.type}</h3></header>`;
|
|
129
|
+
return this.renderHeader ? header : nothing;
|
|
130
|
+
}
|
|
131
|
+
render() {
|
|
132
|
+
return html `
|
|
133
|
+
${this.header}
|
|
134
|
+
<div>
|
|
135
|
+
${this.sharingOptions.map((option) => html `<a class="share-option" href=${option.url} target="_blank">
|
|
136
|
+
${option.icon} ${option.name}
|
|
137
|
+
</a>`)}
|
|
138
|
+
<details>
|
|
139
|
+
<summary class="share-option">
|
|
140
|
+
${linkIcon} Get an embeddable link
|
|
141
|
+
</summary>
|
|
142
|
+
<div class="embed">
|
|
143
|
+
<h4>Embed</h4>
|
|
144
|
+
<div class="code" @click=${this.copyToClipboard}>
|
|
145
|
+
<textarea readonly>${this.iframeEmbed}</textarea>
|
|
146
|
+
<small>Copied to clipboard</small>
|
|
147
|
+
</div>
|
|
148
|
+
<h4>
|
|
149
|
+
Embed for wordpress.com hosted blogs and archive.org item
|
|
150
|
+
<description> tags
|
|
151
|
+
</h4>
|
|
152
|
+
<div class="code" @click=${this.copyToClipboard}>
|
|
153
|
+
<textarea readonly>${this.bbcodeEmbed}</textarea>
|
|
154
|
+
<small>Copied to clipboard</small>
|
|
155
|
+
</div>
|
|
156
|
+
<p>
|
|
157
|
+
Want more?
|
|
158
|
+
<a href=${this.helpURL}
|
|
159
|
+
>Advanced embedding details, examples, and help</a
|
|
160
|
+
>!
|
|
161
|
+
</p>
|
|
162
|
+
</div>
|
|
163
|
+
</details>
|
|
164
|
+
</div>
|
|
165
|
+
`;
|
|
166
|
+
}
|
|
167
|
+
static get styles() {
|
|
168
|
+
return [
|
|
169
|
+
themeStyles,
|
|
170
|
+
css `
|
|
171
|
+
:host {
|
|
172
|
+
--item-navigator-text-color--: var(
|
|
173
|
+
--item-navigator-text-color,
|
|
174
|
+
var(--true-white)
|
|
175
|
+
);
|
|
176
|
+
--item-navigator-border-color--: var(
|
|
177
|
+
--item-navigator-border-color,
|
|
178
|
+
#4b4b4b
|
|
179
|
+
);
|
|
180
|
+
/* Icons follow the adjustable text color by default. */
|
|
181
|
+
--item-navigator-icon-color--: var(
|
|
182
|
+
--item-navigator-icon-color,
|
|
183
|
+
var(--item-navigator-text-color--)
|
|
184
|
+
);
|
|
185
|
+
--item-navigator-share-embed-bg--: var(
|
|
186
|
+
--item-navigator-share-embed-bg,
|
|
187
|
+
#151515
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
display: block;
|
|
191
|
+
height: 100%;
|
|
192
|
+
overflow-y: auto;
|
|
193
|
+
/* 10px base (petabox scale); internal sizing is em against it. */
|
|
194
|
+
--item-navigator-base-font-size--: var(
|
|
195
|
+
--item-navigator-base-font-size,
|
|
196
|
+
10px
|
|
197
|
+
);
|
|
198
|
+
font-size: var(--item-navigator-base-font-size--);
|
|
199
|
+
color: var(--item-navigator-text-color--);
|
|
200
|
+
box-sizing: border-box;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
header {
|
|
204
|
+
display: flex;
|
|
205
|
+
align-items: baseline;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
h3 {
|
|
209
|
+
padding: 0;
|
|
210
|
+
margin: 0 1em 0 0;
|
|
211
|
+
font-size: 1.6em;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
h4 {
|
|
215
|
+
font-size: 1.4em;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
:host > div {
|
|
219
|
+
padding: 1em 0;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.share-option {
|
|
223
|
+
display: block;
|
|
224
|
+
padding: 0.5em 0;
|
|
225
|
+
font-size: 1.6em;
|
|
226
|
+
text-decoration: none;
|
|
227
|
+
color: var(--item-navigator-text-color--);
|
|
228
|
+
cursor: pointer;
|
|
229
|
+
transition: background-color 0.2s;
|
|
230
|
+
border-radius: 6px;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
.share-option:hover {
|
|
234
|
+
background-color: rgba(255, 255, 255, 0.05);
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
.share-option > * {
|
|
238
|
+
display: inline-block;
|
|
239
|
+
padding: 0.2em;
|
|
240
|
+
margin-right: 1em;
|
|
241
|
+
vertical-align: middle;
|
|
242
|
+
border: 1px solid var(--item-navigator-border-color--);
|
|
243
|
+
border-radius: 7px;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
.share-option .ia-icon {
|
|
247
|
+
/* Reset to the base so the icon (em) doesn't compound against the
|
|
248
|
+
share-option's enlarged font-size. */
|
|
249
|
+
font-size: var(--item-navigator-base-font-size--);
|
|
250
|
+
width: 2em;
|
|
251
|
+
height: 2em;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* Our glyphs are masked spans: the mask supplies the shape, this
|
|
255
|
+
supplies the paint. */
|
|
256
|
+
span.ia-icon {
|
|
257
|
+
background-color: var(--item-navigator-icon-color--);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/* Host-supplied icons may still be inline svg, so keep theming those
|
|
261
|
+
the original way. */
|
|
262
|
+
.ia-icon .fill-color {
|
|
263
|
+
fill: var(--item-navigator-icon-color--);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
/* Hide the triangle that appears on details tags */
|
|
267
|
+
summary::marker {
|
|
268
|
+
content: '';
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
summary::-webkit-details-marker {
|
|
272
|
+
display: none;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
.embed {
|
|
276
|
+
padding-right: 5px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.embed a {
|
|
280
|
+
color: var(--item-navigator-text-color--);
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
.code {
|
|
284
|
+
position: relative;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
textarea {
|
|
288
|
+
display: block;
|
|
289
|
+
width: 100%;
|
|
290
|
+
height: 120px;
|
|
291
|
+
padding: 0.8em 1em;
|
|
292
|
+
box-sizing: border-box;
|
|
293
|
+
resize: none;
|
|
294
|
+
cursor: pointer;
|
|
295
|
+
font: normal 1.4em var(--base-font-family);
|
|
296
|
+
color: var(--item-navigator-text-color--);
|
|
297
|
+
background: var(--item-navigator-share-embed-bg--);
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
small {
|
|
301
|
+
position: absolute;
|
|
302
|
+
bottom: 0;
|
|
303
|
+
left: 0;
|
|
304
|
+
height: 3em;
|
|
305
|
+
padding: 0.5em 1em;
|
|
306
|
+
box-sizing: border-box;
|
|
307
|
+
font: normal 1.2em/2em var(--base-font-family);
|
|
308
|
+
color: var(--item-navigator-share-embed-bg--);
|
|
309
|
+
background: var(--item-navigator-text-color--);
|
|
310
|
+
opacity: 0;
|
|
311
|
+
transition: opacity 300ms linear;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
small.visible {
|
|
315
|
+
opacity: 1;
|
|
316
|
+
}
|
|
317
|
+
`,
|
|
318
|
+
];
|
|
319
|
+
}
|
|
320
|
+
};
|
|
321
|
+
__decorate([
|
|
322
|
+
property({ type: String })
|
|
323
|
+
], IAItemNavSharePanel.prototype, "baseHost", void 0);
|
|
324
|
+
__decorate([
|
|
325
|
+
property({ type: String })
|
|
326
|
+
], IAItemNavSharePanel.prototype, "creator", void 0);
|
|
327
|
+
__decorate([
|
|
328
|
+
property({ type: String })
|
|
329
|
+
], IAItemNavSharePanel.prototype, "description", void 0);
|
|
330
|
+
__decorate([
|
|
331
|
+
property({ type: Boolean })
|
|
332
|
+
], IAItemNavSharePanel.prototype, "embedOptionsVisible", void 0);
|
|
333
|
+
__decorate([
|
|
334
|
+
property({ type: String })
|
|
335
|
+
], IAItemNavSharePanel.prototype, "identifier", void 0);
|
|
336
|
+
__decorate([
|
|
337
|
+
property({ type: Array })
|
|
338
|
+
], IAItemNavSharePanel.prototype, "sharingOptions", void 0);
|
|
339
|
+
__decorate([
|
|
340
|
+
property({ type: String })
|
|
341
|
+
], IAItemNavSharePanel.prototype, "type", void 0);
|
|
342
|
+
__decorate([
|
|
343
|
+
property({ type: Boolean })
|
|
344
|
+
], IAItemNavSharePanel.prototype, "renderHeader", void 0);
|
|
345
|
+
__decorate([
|
|
346
|
+
property({ type: String })
|
|
347
|
+
], IAItemNavSharePanel.prototype, "fileSubPrefix", void 0);
|
|
348
|
+
IAItemNavSharePanel = __decorate([
|
|
349
|
+
customElement('ia-itemnav-share-panel')
|
|
350
|
+
], IAItemNavSharePanel);
|
|
351
|
+
export { IAItemNavSharePanel };
|
|
352
|
+
//# sourceMappingURL=ia-itemnav-share-panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ia-itemn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E,CAAC;iDAAW;AAET;IAA5B,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;yDAAsB;AAEtB;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;0DAAoB;AAjBpC,mBAAmB;IAD/B,aAAa,CAAC,wBAAwB,CAAC;GAC3B,mBAAmB,CA+U/B","sourcesContent":["import {\n css,\n html,\n LitElement,\n nothing,\n PropertyValues,\n TemplateResult,\n type CSSResultGroup,\n} from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport themeStyles from '@src/themes/theme-styles';\nimport {\n shareIcon,\n twitterIcon,\n facebookIcon,\n tumblrIcon,\n pinterestIcon,\n emailIcon,\n linkIcon,\n} from './share-icons';\n\ntype ShareOption = {\n name: string;\n icon: TemplateResult | string;\n url: string;\n};\n\n/** Icon for the share menu shortcut / menu entry. */\nexport { shareIcon };\n\n/**\n * The \"share this item\" side panel: social sharing links (Twitter, Facebook,\n * Tumblr, Pinterest, email) plus copyable iframe / bbcode embed snippets.\n * Sharing options are derived from the item identifier/metadata and rebuilt\n * whenever `sharingOptions` is reset to empty.\n */\n@customElement('ia-itemnav-share-panel')\nexport class IAItemNavSharePanel 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 private copyNoteTimeouts = new WeakMap<\n Element,\n ReturnType<typeof setTimeout>\n >();\n\n updated(changed: PropertyValues): void {\n if (changed.has('sharingOptions') && !this.sharingOptions.length) {\n this.loadProviders();\n }\n }\n\n loadProviders(): void {\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: twitterIcon,\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: facebookIcon,\n url: `https://www.facebook.com/sharer/sharer.php?${new URLSearchParams({\n u: shareUrl,\n })}`,\n },\n {\n name: 'Tumblr',\n icon: tumblrIcon,\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: pinterestIcon,\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: emailIcon,\n url: `mailto:?${new URLSearchParams({\n subject: shareBlurb,\n body: shareUrl,\n })}`,\n },\n ];\n }\n\n /**\n * Copies the embed snippet in the clicked `.code` block, preferring the async\n * Clipboard API and falling back to the legacy `execCommand` path for\n * browsers that lack it, then briefly flashes the \"Copied\" note.\n */\n private async copyToClipboard(event: MouseEvent): Promise<void> {\n const currentTarget = event.currentTarget as HTMLElement;\n const textarea = currentTarget.querySelector('textarea');\n const note = currentTarget.querySelector('small');\n if (!textarea || !note) return;\n\n try {\n await navigator.clipboard.writeText(textarea.value);\n } catch {\n // Fallback for browsers without the async Clipboard API.\n textarea.select();\n document.execCommand('copy');\n textarea.blur();\n }\n\n note.classList.add('visible');\n clearTimeout(this.copyNoteTimeouts.get(note));\n this.copyNoteTimeouts.set(\n note,\n setTimeout(() => note.classList.remove('visible'), 4000),\n );\n }\n\n get iframeEmbed(): string {\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(): string {\n return `[archiveorg ${this.identifier} width=560 height=384 frameborder=0 webkitallowfullscreen=true mozallowfullscreen=true]`;\n }\n\n get helpURL(): string {\n return `https://${this.baseHost}/help/audio.php?identifier=${this.identifier}`;\n }\n\n get header(): TemplateResult | typeof nothing {\n const header = html`<header><h3>Share this ${this.type}</h3></header>`;\n return this.renderHeader ? header : nothing;\n }\n\n render(): TemplateResult {\n return html`\n ${this.header}\n <div>\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 ${linkIcon} Get an embeddable link\n </summary>\n <div class=\"embed\">\n <h4>Embed</h4>\n <div class=\"code\" @click=${this.copyToClipboard}>\n <textarea readonly>${this.iframeEmbed}</textarea>\n <small>Copied to clipboard</small>\n </div>\n <h4>\n Embed for wordpress.com hosted blogs and archive.org item\n <description> tags\n </h4>\n <div class=\"code\" @click=${this.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 </div>\n `;\n }\n\n static get styles(): CSSResultGroup {\n return [\n themeStyles,\n css`\n :host {\n --item-navigator-text-color--: var(\n --item-navigator-text-color,\n var(--true-white)\n );\n --item-navigator-border-color--: var(\n --item-navigator-border-color,\n #4b4b4b\n );\n /* Icons follow the adjustable text color by default. */\n --item-navigator-icon-color--: var(\n --item-navigator-icon-color,\n var(--item-navigator-text-color--)\n );\n --item-navigator-share-embed-bg--: var(\n --item-navigator-share-embed-bg,\n #151515\n );\n\n display: block;\n height: 100%;\n overflow-y: auto;\n /* 10px base (petabox scale); internal sizing is em against it. */\n --item-navigator-base-font-size--: var(\n --item-navigator-base-font-size,\n 10px\n );\n font-size: var(--item-navigator-base-font-size--);\n color: var(--item-navigator-text-color--);\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 1em 0 0;\n font-size: 1.6em;\n }\n\n h4 {\n font-size: 1.4em;\n }\n\n :host > div {\n padding: 1em 0;\n }\n\n .share-option {\n display: block;\n padding: 0.5em 0;\n font-size: 1.6em;\n text-decoration: none;\n color: var(--item-navigator-text-color--);\n cursor: pointer;\n transition: background-color 0.2s;\n border-radius: 6px;\n }\n\n .share-option:hover {\n background-color: rgba(255, 255, 255, 0.05);\n }\n\n .share-option > * {\n display: inline-block;\n padding: 0.2em;\n margin-right: 1em;\n vertical-align: middle;\n border: 1px solid var(--item-navigator-border-color--);\n border-radius: 7px;\n }\n\n .share-option .ia-icon {\n /* Reset to the base so the icon (em) doesn't compound against the\n share-option's enlarged font-size. */\n font-size: var(--item-navigator-base-font-size--);\n width: 2em;\n height: 2em;\n }\n\n /* Our glyphs are masked spans: the mask supplies the shape, this\n supplies the paint. */\n span.ia-icon {\n background-color: var(--item-navigator-icon-color--);\n }\n\n /* Host-supplied icons may still be inline svg, so keep theming those\n the original way. */\n .ia-icon .fill-color {\n fill: var(--item-navigator-icon-color--);\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(--item-navigator-text-color--);\n }\n\n .code {\n position: relative;\n }\n\n textarea {\n display: block;\n width: 100%;\n height: 120px;\n padding: 0.8em 1em;\n box-sizing: border-box;\n resize: none;\n cursor: pointer;\n font: normal 1.4em var(--base-font-family);\n color: var(--item-navigator-text-color--);\n background: var(--item-navigator-share-embed-bg--);\n }\n\n small {\n position: absolute;\n bottom: 0;\n left: 0;\n height: 3em;\n padding: 0.5em 1em;\n box-sizing: border-box;\n font: normal 1.2em/2em var(--base-font-family);\n color: var(--item-navigator-share-embed-bg--);\n background: var(--item-navigator-text-color--);\n opacity: 0;\n transition: opacity 300ms linear;\n }\n\n small.visible {\n opacity: 1;\n }\n `,\n ];\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'ia-itemnav-share-panel': IAItemNavSharePanel;\n }\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { LitElement, type CSSResultGroup, TemplateResult } from 'lit';
|
|
2
|
+
import type { FileSortOption, ViewableFileInfo } from './models.js';
|
|
3
|
+
/**
|
|
4
|
+
* A tri-state sort toggle for the viewable-files panel header. Cycles
|
|
5
|
+
* default → title ascending → title descending → default, sorting the supplied
|
|
6
|
+
* file list and emitting `fileListSorted` on each change.
|
|
7
|
+
*/
|
|
8
|
+
export declare class IAItemNavSortFilesButton extends LitElement {
|
|
9
|
+
fileListRaw: ViewableFileInfo[];
|
|
10
|
+
fileListSorted: ViewableFileInfo[];
|
|
11
|
+
sortOrderBy: FileSortOption;
|
|
12
|
+
render(): TemplateResult;
|
|
13
|
+
get sortButton(): TemplateResult;
|
|
14
|
+
sortVolumes(sortType: FileSortOption): void;
|
|
15
|
+
static get styles(): CSSResultGroup;
|
|
16
|
+
}
|
|
17
|
+
declare global {
|
|
18
|
+
interface HTMLElementTagNameMap {
|
|
19
|
+
'ia-itemnav-sort-files-button': IAItemNavSortFilesButton;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=ia-itemnav-sort-files-button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ia-itemnav-sort-files-button.d.ts","sourceRoot":"","sources":["../../../../../src/elements/ia-item-navigator/menus/ia-itemnav-sort-files-button.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,UAAU,EACV,KAAK,cAAc,EACnB,cAAc,EACf,MAAM,KAAK,CAAC;AAOb,OAAO,KAAK,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAQjE;;;;GAIG;AACH,qBACa,wBAAyB,SAAQ,UAAU;IAC3B,WAAW,EAAE,gBAAgB,EAAE,CAAM;IAErC,cAAc,EAAE,gBAAgB,EAAE,CAAM;IAExB,WAAW,EAAE,cAAc,CAC1D;IAEZ,MAAM,IAAI,cAAc;IAIxB,IAAI,UAAU,IAAI,cAAc,CAgC/B;IAED,WAAW,CAAC,QAAQ,EAAE,cAAc,GAAG,IAAI;IAsB3C,MAAM,KAAK,MAAM,IAAI,cAAc,CA4ClC;CACF;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,8BAA8B,EAAE,wBAAwB,CAAC;KAC1D;CACF"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { __decorate } from "tslib";
|
|
2
|
+
import { css, html, LitElement, } from 'lit';
|
|
3
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
4
|
+
import themeStyles from '../../../themes/theme-styles.js';
|
|
5
|
+
import { maskedIcon } from '../../../util/masked-icon.js';
|
|
6
|
+
import sortAscUrl from './icons/sort-asc.svg';
|
|
7
|
+
import sortDescUrl from './icons/sort-desc.svg';
|
|
8
|
+
import sortNeutralUrl from './icons/sort-neutral.svg';
|
|
9
|
+
const sortAscIcon = maskedIcon(sortAscUrl);
|
|
10
|
+
const sortDescIcon = maskedIcon(sortDescUrl);
|
|
11
|
+
const sortNeutralIcon = maskedIcon(sortNeutralUrl);
|
|
12
|
+
/**
|
|
13
|
+
* A tri-state sort toggle for the viewable-files panel header. Cycles
|
|
14
|
+
* default → title ascending → title descending → default, sorting the supplied
|
|
15
|
+
* file list and emitting `fileListSorted` on each change.
|
|
16
|
+
*/
|
|
17
|
+
let IAItemNavSortFilesButton = class IAItemNavSortFilesButton extends LitElement {
|
|
18
|
+
constructor() {
|
|
19
|
+
super(...arguments);
|
|
20
|
+
this.fileListRaw = [];
|
|
21
|
+
this.fileListSorted = [];
|
|
22
|
+
this.sortOrderBy = 'default';
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
return html `<div class="sort-multi-file-list">${this.sortButton}</div>`;
|
|
26
|
+
}
|
|
27
|
+
get sortButton() {
|
|
28
|
+
const sortIcons = {
|
|
29
|
+
default: html `
|
|
30
|
+
<button
|
|
31
|
+
class="sort-by neutral-icon"
|
|
32
|
+
aria-label="Sort volumes in initial order"
|
|
33
|
+
@click=${() => this.sortVolumes('title_asc')}
|
|
34
|
+
>
|
|
35
|
+
${sortNeutralIcon}
|
|
36
|
+
</button>
|
|
37
|
+
`,
|
|
38
|
+
title_asc: html `
|
|
39
|
+
<button
|
|
40
|
+
class="sort-by asc-icon"
|
|
41
|
+
aria-label="Sort volumes in ascending order"
|
|
42
|
+
@click=${() => this.sortVolumes('title_desc')}
|
|
43
|
+
>
|
|
44
|
+
${sortAscIcon}
|
|
45
|
+
</button>
|
|
46
|
+
`,
|
|
47
|
+
title_desc: html `
|
|
48
|
+
<button
|
|
49
|
+
class="sort-by desc-icon"
|
|
50
|
+
aria-label="Sort volumes in descending order"
|
|
51
|
+
@click=${() => this.sortVolumes('default')}
|
|
52
|
+
>
|
|
53
|
+
${sortDescIcon}
|
|
54
|
+
</button>
|
|
55
|
+
`,
|
|
56
|
+
};
|
|
57
|
+
return sortIcons[this.sortOrderBy];
|
|
58
|
+
}
|
|
59
|
+
sortVolumes(sortType) {
|
|
60
|
+
this.sortOrderBy = sortType;
|
|
61
|
+
const sortedFiles = [...this.fileListRaw].sort((a, b) => {
|
|
62
|
+
if (sortType === 'title_asc')
|
|
63
|
+
return a.title.localeCompare(b.title);
|
|
64
|
+
if (sortType === 'title_desc')
|
|
65
|
+
return b.title.localeCompare(a.title);
|
|
66
|
+
return (a.orig_sort ?? 0) - (b.orig_sort ?? 0);
|
|
67
|
+
});
|
|
68
|
+
this.dispatchEvent(new CustomEvent('fileListSorted', {
|
|
69
|
+
detail: {
|
|
70
|
+
sortType,
|
|
71
|
+
sortedFiles,
|
|
72
|
+
},
|
|
73
|
+
bubbles: true,
|
|
74
|
+
composed: true,
|
|
75
|
+
}));
|
|
76
|
+
this.fileListSorted = sortedFiles;
|
|
77
|
+
}
|
|
78
|
+
static get styles() {
|
|
79
|
+
return [
|
|
80
|
+
themeStyles,
|
|
81
|
+
css `
|
|
82
|
+
:host {
|
|
83
|
+
/* Every glyph is square, so one knob sizes both axes. Matches the
|
|
84
|
+
panel header's close button, which sits beside this one. */
|
|
85
|
+
--item-navigator-header-icon-size--: var(
|
|
86
|
+
--item-navigator-header-icon-size,
|
|
87
|
+
2em
|
|
88
|
+
);
|
|
89
|
+
--item-navigator-icon-color--: var(
|
|
90
|
+
--item-navigator-icon-color,
|
|
91
|
+
var(--item-navigator-text-color, var(--true-white))
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
/* 10px base (petabox scale); internal sizing is em against it. */
|
|
95
|
+
--item-navigator-base-font-size--: var(
|
|
96
|
+
--item-navigator-base-font-size,
|
|
97
|
+
10px
|
|
98
|
+
);
|
|
99
|
+
font-size: var(--item-navigator-base-font-size--);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
button.sort-by {
|
|
103
|
+
padding: 0;
|
|
104
|
+
background-color: transparent;
|
|
105
|
+
border: 0;
|
|
106
|
+
cursor: pointer;
|
|
107
|
+
display: inline-flex;
|
|
108
|
+
/* Buttons don't inherit font-size, and the UA default would make the
|
|
109
|
+
em-sized glyph larger than the close button beside it. */
|
|
110
|
+
font: inherit;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/* The glyph is a masked span: the mask supplies the shape, this
|
|
114
|
+
supplies the paint. */
|
|
115
|
+
button.sort-by .ia-icon {
|
|
116
|
+
width: var(--item-navigator-header-icon-size--);
|
|
117
|
+
height: var(--item-navigator-header-icon-size--);
|
|
118
|
+
background-color: var(--item-navigator-icon-color--);
|
|
119
|
+
}
|
|
120
|
+
`,
|
|
121
|
+
];
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
__decorate([
|
|
125
|
+
property({ type: Array })
|
|
126
|
+
], IAItemNavSortFilesButton.prototype, "fileListRaw", void 0);
|
|
127
|
+
__decorate([
|
|
128
|
+
property({ type: Array })
|
|
129
|
+
], IAItemNavSortFilesButton.prototype, "fileListSorted", void 0);
|
|
130
|
+
__decorate([
|
|
131
|
+
property({ type: String, reflect: true })
|
|
132
|
+
], IAItemNavSortFilesButton.prototype, "sortOrderBy", void 0);
|
|
133
|
+
IAItemNavSortFilesButton = __decorate([
|
|
134
|
+
customElement('ia-itemnav-sort-files-button')
|
|
135
|
+
], IAItemNavSortFilesButton);
|
|
136
|
+
export { IAItemNavSortFilesButton };
|
|
137
|
+
//# sourceMappingURL=ia-itemnav-sort-files-button.js.map
|