@internetarchive/ia-item-navigator 1.0.3 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/demo/app-root.d.ts +47 -47
- package/dist/demo/app-root.js +199 -199
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/src/interfaces/custom-theater-interface.d.ts +20 -20
- package/dist/src/interfaces/custom-theater-interface.js +1 -1
- package/dist/src/interfaces/event-interfaces.d.ts +40 -40
- package/dist/src/interfaces/event-interfaces.js +1 -1
- package/dist/src/interfaces/menu-interfaces.d.ts +22 -22
- package/dist/src/interfaces/menu-interfaces.js +1 -1
- package/dist/src/item-navigator.d.ts +69 -69
- package/dist/src/item-navigator.js +256 -256
- package/dist/src/item-navigator.js.map +1 -1
- package/dist/src/loader.d.ts +13 -13
- package/dist/src/loader.js +31 -31
- package/dist/src/menu-slider/ia-menu-slider.d.ts +30 -0
- package/dist/src/menu-slider/ia-menu-slider.js +160 -0
- package/dist/src/menu-slider/ia-menu-slider.js.map +1 -0
- package/dist/src/menu-slider/menu-button.d.ts +19 -0
- package/dist/src/menu-slider/menu-button.js +91 -0
- package/dist/src/menu-slider/menu-button.js.map +1 -0
- package/dist/src/menu-slider/styles/menu-button.d.ts +2 -0
- package/dist/src/menu-slider/styles/menu-button.js +79 -0
- package/dist/src/menu-slider/styles/menu-button.js.map +1 -0
- package/dist/src/menu-slider/styles/menu-slider.d.ts +2 -0
- package/dist/src/menu-slider/styles/menu-slider.js +118 -0
- package/dist/src/menu-slider/styles/menu-slider.js.map +1 -0
- package/dist/src/no-theater-available.d.ts +9 -9
- package/dist/src/no-theater-available.js +35 -35
- package/dist/test/ia-item-navigator.test.d.ts +1 -1
- package/dist/test/ia-item-navigator.test.js +296 -296
- package/dist/test/ia-stub.d.ts +22 -22
- package/dist/test/ia-stub.js +34 -34
- package/dist/test/no-theater-available.test.d.ts +1 -1
- package/dist/test/no-theater-available.test.js +22 -22
- package/index.ts +2 -0
- package/package.json +3 -3
- package/src/item-navigator.ts +2 -2
- package/src/menu-slider/ia-menu-slider.ts +161 -0
- package/src/menu-slider/menu-button.ts +80 -0
- package/src/menu-slider/styles/menu-button.ts +79 -0
- package/src/menu-slider/styles/menu-slider.ts +119 -0
- package/test/ia-menu-slider.test.js +273 -0
- package/dist/src/event-interfaces.d.ts +0 -37
- package/dist/src/event-interfaces.js +0 -2
- package/dist/src/event-interfaces.js.map +0 -1
- package/dist/src/grouped-files-provider.d.ts +0 -0
- package/dist/src/grouped-files-provider.js +0 -2
- package/dist/src/grouped-files-provider.js.map +0 -1
- package/dist/src/interfaces/nav-controller-interface.d.ts +0 -20
- package/dist/src/interfaces/nav-controller-interface.js +0 -2
- package/dist/src/interfaces/nav-controller-interface.js.map +0 -1
- package/dist/src/item-inspector/files-by-type/files-by-type-provider.d.ts +0 -14
- package/dist/src/item-inspector/files-by-type/files-by-type-provider.js +0 -29
- package/dist/src/item-inspector/files-by-type/files-by-type-provider.js.map +0 -1
- package/dist/src/item-inspector/files-by-type/ia-files-by-type.d.ts +0 -16
- package/dist/src/item-inspector/files-by-type/ia-files-by-type.js +0 -95
- package/dist/src/item-inspector/files-by-type/ia-files-by-type.js.map +0 -1
- package/dist/src/item-inspector/files-by-type/ia-grouped-files-by-type.d.ts +0 -0
- package/dist/src/item-inspector/files-by-type/ia-grouped-files-by-type.js +0 -2
- package/dist/src/item-inspector/files-by-type/ia-grouped-files-by-type.js.map +0 -1
- package/dist/src/item-inspector/grouped-files/files-by-type-provider.d.ts +0 -15
- package/dist/src/item-inspector/grouped-files/files-by-type-provider.js +0 -33
- package/dist/src/item-inspector/grouped-files/files-by-type-provider.js.map +0 -1
- package/dist/src/item-inspector/grouped-files/grouped-files-provider.d.ts +0 -15
- package/dist/src/item-inspector/grouped-files/grouped-files-provider.js +0 -33
- package/dist/src/item-inspector/grouped-files/grouped-files-provider.js.map +0 -1
- package/dist/src/item-inspector/grouped-files/ia-grouped-files-by-type.d.ts +0 -0
- package/dist/src/item-inspector/grouped-files/ia-grouped-files-by-type.js +0 -2
- package/dist/src/item-inspector/grouped-files/ia-grouped-files-by-type.js.map +0 -1
- package/dist/src/item-inspector/grouped-files/ia-grouped-files.d.ts +0 -0
- package/dist/src/item-inspector/grouped-files/ia-grouped-files.js +0 -2
- package/dist/src/item-inspector/grouped-files/ia-grouped-files.js.map +0 -1
- package/dist/src/item-inspector/grouped-files-provider.d.ts +0 -15
- package/dist/src/item-inspector/grouped-files-provider.js +0 -33
- package/dist/src/item-inspector/grouped-files-provider.js.map +0 -1
- package/dist/src/item-inspector/item-inspector.d.ts +0 -0
- package/dist/src/item-inspector/item-inspector.js +0 -254
- package/dist/src/item-inspector/item-inspector.js.map +0 -1
- package/dist/src/item-inspector/share-provider.d.ts +0 -15
- package/dist/src/item-inspector/share-provider.js +0 -35
- package/dist/src/item-inspector/share-provider.js.map +0 -1
- package/dist/src/item-inspector/visual-mod-provider.d.ts +0 -19
- package/dist/src/item-inspector/visual-mod-provider.js +0 -46
- package/dist/src/item-inspector/visual-mod-provider.js.map +0 -1
- package/dist/src/item-inspector.d.ts +0 -24
- package/dist/src/item-inspector.js +0 -92
- package/dist/src/item-inspector.js.map +0 -1
- package/dist/src/menu-interfaces.d.ts +0 -16
- package/dist/src/menu-interfaces.js +0 -2
- package/dist/src/menu-interfaces.js.map +0 -1
- package/dist/src/nav-controller-interface.d.ts +0 -9
- package/dist/src/nav-controller-interface.js +0 -2
- package/dist/src/nav-controller-interface.js.map +0 -1
- package/dist/src/your-webcomponent.d.ts +0 -8
- package/dist/src/your-webcomponent.js +0 -37
- package/dist/src/your-webcomponent.js.map +0 -1
- package/dist/test/book-nav-stub.d.ts +0 -22
- package/dist/test/book-nav-stub.js +0 -49
- package/dist/test/book-nav-stub.js.map +0 -1
- package/dist/test/ia-stub-goody.d.ts +0 -210
- package/dist/test/ia-stub-goody.js +0 -276
- package/dist/test/ia-stub-goody.js.map +0 -1
- package/dist/test/your-webcomponent.test.d.ts +0 -0
- package/dist/test/your-webcomponent.test.js +0 -33
- package/dist/test/your-webcomponent.test.js.map +0 -1
package/dist/test/ia-stub.js
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
import { html } from 'lit';
|
2
|
-
export class ItemStub {
|
3
|
-
constructor() {
|
4
|
-
this.rawResponse = '';
|
5
|
-
this.created = 1;
|
6
|
-
this.d1 = 'hello';
|
7
|
-
this.d2 = 'boop';
|
8
|
-
this.dir = 'whee';
|
9
|
-
this.files = [];
|
10
|
-
this.files_count = 0;
|
11
|
-
this.item_last_updated = 2020;
|
12
|
-
this.item_size = 111;
|
13
|
-
this.metadata = { identifier: 'foo' };
|
14
|
-
this.server = 'foo-server';
|
15
|
-
this.uniq = 2;
|
16
|
-
this.workable_servers = ['abc'];
|
17
|
-
}
|
18
|
-
}
|
19
|
-
export const shortcut = {
|
20
|
-
id: 'fullscreen',
|
21
|
-
icon: html `<i class="fas fullscreen-test"></i>`,
|
22
|
-
};
|
23
|
-
export const menuProvider = {
|
24
|
-
...shortcut,
|
25
|
-
label: 'foo',
|
26
|
-
menuDetails: html `<div>foo</div>`,
|
27
|
-
selected: true,
|
28
|
-
followable: false,
|
29
|
-
href: 'https://archive.foo',
|
30
|
-
item: new ItemStub(),
|
31
|
-
baseHost: 'https://archive.foo',
|
32
|
-
subPrefix: 'bar',
|
33
|
-
updated: () => { },
|
34
|
-
};
|
1
|
+
import { html } from 'lit';
|
2
|
+
export class ItemStub {
|
3
|
+
constructor() {
|
4
|
+
this.rawResponse = '';
|
5
|
+
this.created = 1;
|
6
|
+
this.d1 = 'hello';
|
7
|
+
this.d2 = 'boop';
|
8
|
+
this.dir = 'whee';
|
9
|
+
this.files = [];
|
10
|
+
this.files_count = 0;
|
11
|
+
this.item_last_updated = 2020;
|
12
|
+
this.item_size = 111;
|
13
|
+
this.metadata = { identifier: 'foo' };
|
14
|
+
this.server = 'foo-server';
|
15
|
+
this.uniq = 2;
|
16
|
+
this.workable_servers = ['abc'];
|
17
|
+
}
|
18
|
+
}
|
19
|
+
export const shortcut = {
|
20
|
+
id: 'fullscreen',
|
21
|
+
icon: html `<i class="fas fullscreen-test"></i>`,
|
22
|
+
};
|
23
|
+
export const menuProvider = {
|
24
|
+
...shortcut,
|
25
|
+
label: 'foo',
|
26
|
+
menuDetails: html `<div>foo</div>`,
|
27
|
+
selected: true,
|
28
|
+
followable: false,
|
29
|
+
href: 'https://archive.foo',
|
30
|
+
item: new ItemStub(),
|
31
|
+
baseHost: 'https://archive.foo',
|
32
|
+
subPrefix: 'bar',
|
33
|
+
updated: () => { },
|
34
|
+
};
|
35
35
|
//# sourceMappingURL=ia-stub.js.map
|
@@ -1 +1 @@
|
|
1
|
-
import '../src/no-theater-available';
|
1
|
+
import '../src/no-theater-available';
|
@@ -1,27 +1,27 @@
|
|
1
|
-
import { html, fixture, expect } from '@open-wc/testing';
|
2
|
-
import '../src/no-theater-available';
|
3
|
-
describe('IANoTheaterAvailable', () => {
|
4
|
-
it('Fires `loadingStateUpdated` on identifier change', async () => {
|
1
|
+
import { html, fixture, expect } from '@open-wc/testing';
|
2
|
+
import '../src/no-theater-available';
|
3
|
+
describe('IANoTheaterAvailable', () => {
|
4
|
+
it('Fires `loadingStateUpdated` on identifier change', async () => {
|
5
5
|
const el = await fixture(html `<ia-no-theater-available
|
6
6
|
.identifier=${`foo`}
|
7
|
-
></ia-no-theater-available>`);
|
8
|
-
let eventFired = false;
|
9
|
-
el.addEventListener('loadingStateUpdated', () => {
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
11
|
-
eventFired = true;
|
12
|
-
});
|
13
|
-
expect(eventFired).to.be.false;
|
14
|
-
el.identifier = 'bar';
|
15
|
-
await el.updateComplete;
|
16
|
-
expect(eventFired).to.be.true;
|
17
|
-
});
|
18
|
-
it('Has link to item download page', async () => {
|
19
|
-
var _a, _b;
|
7
|
+
></ia-no-theater-available>`);
|
8
|
+
let eventFired = false;
|
9
|
+
el.addEventListener('loadingStateUpdated', () => {
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
11
|
+
eventFired = true;
|
12
|
+
});
|
13
|
+
expect(eventFired).to.be.false;
|
14
|
+
el.identifier = 'bar';
|
15
|
+
await el.updateComplete;
|
16
|
+
expect(eventFired).to.be.true;
|
17
|
+
});
|
18
|
+
it('Has link to item download page', async () => {
|
19
|
+
var _a, _b;
|
20
20
|
const el = await fixture(html `<ia-no-theater-available
|
21
21
|
.identifier=${`foo`}
|
22
|
-
></ia-no-theater-available>`);
|
23
|
-
expect(el.downloadUrl).to.equal('/download/foo');
|
24
|
-
expect((_b = (_a = el === null || el === void 0 ? void 0 : el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('a')) === null || _b === void 0 ? void 0 : _b.href).to.contain(el.downloadUrl);
|
25
|
-
});
|
26
|
-
});
|
22
|
+
></ia-no-theater-available>`);
|
23
|
+
expect(el.downloadUrl).to.equal('/download/foo');
|
24
|
+
expect((_b = (_a = el === null || el === void 0 ? void 0 : el.shadowRoot) === null || _a === void 0 ? void 0 : _a.querySelector('a')) === null || _b === void 0 ? void 0 : _b.href).to.contain(el.downloadUrl);
|
25
|
+
});
|
26
|
+
});
|
27
27
|
//# sourceMappingURL=no-theater-available.test.js.map
|
package/index.ts
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@internetarchive/ia-item-navigator",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.4",
|
4
4
|
"description": "Internet Archive's Item Navigator, visually explore an item's contents.",
|
5
5
|
"repository": {
|
6
6
|
"type": "git",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
"test:watch": "tsc && concurrently -k -r \"tsc --watch --preserveWatchOutput\" \"wtr --watch\""
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
|
-
"@internetarchive/
|
28
|
+
"@internetarchive/icon-collapse-sidebar": "^1.3.4",
|
29
29
|
"@internetarchive/icon-ellipses": "^1.3.4",
|
30
30
|
"@internetarchive/icon-share": "^1.3.4",
|
31
31
|
"@internetarchive/icon-visual-adjustment": "^1.3.4",
|
@@ -75,7 +75,7 @@
|
|
75
75
|
],
|
76
76
|
"import/no-unresolved": "off",
|
77
77
|
"import/extensions": [
|
78
|
-
"
|
78
|
+
"off",
|
79
79
|
{
|
80
80
|
"js": "never",
|
81
81
|
"ts": "never"
|
package/src/item-navigator.ts
CHANGED
@@ -13,10 +13,10 @@ import {
|
|
13
13
|
SharedResizeObserver,
|
14
14
|
SharedResizeObserverResizeHandlerInterface,
|
15
15
|
} from '@internetarchive/shared-resize-observer';
|
16
|
-
import '@internetarchive/ia-menu-slider';
|
17
|
-
|
18
16
|
import { ModalManager } from '@internetarchive/modal-manager';
|
19
17
|
import '@internetarchive/icon-ellipses/icon-ellipses';
|
18
|
+
|
19
|
+
import './menu-slider/ia-menu-slider';
|
20
20
|
import './loader';
|
21
21
|
|
22
22
|
import {
|
@@ -0,0 +1,161 @@
|
|
1
|
+
import { LitElement, html, nothing } from 'lit';
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
3
|
+
import menuSliderCSS from './styles/menu-slider';
|
4
|
+
import '@internetarchive/icon-collapse-sidebar';
|
5
|
+
import './menu-button';
|
6
|
+
|
7
|
+
const sliderEvents = {
|
8
|
+
closeDrawer: 'menuSliderClosed',
|
9
|
+
};
|
10
|
+
|
11
|
+
@customElement('ia-menu-slider')
|
12
|
+
export class IaMenuSlider extends LitElement {
|
13
|
+
static get styles() {
|
14
|
+
return menuSliderCSS;
|
15
|
+
}
|
16
|
+
|
17
|
+
@property({ type: Array }) menus = [];
|
18
|
+
|
19
|
+
@property({ type: Boolean }) open = false;
|
20
|
+
|
21
|
+
@property({ type: Boolean }) manuallyHandleClose = false;
|
22
|
+
|
23
|
+
@property({ type: String }) selectedMenu = '';
|
24
|
+
|
25
|
+
@property({ type: Object }) selectedMenuAction = nothing;
|
26
|
+
|
27
|
+
@property({ type: Boolean }) animateMenuOpen = false;
|
28
|
+
|
29
|
+
updated() {
|
30
|
+
const { actionButton } =
|
31
|
+
this.selectedMenuDetails || ({} as Record<string, any>);
|
32
|
+
const actionButtonHasChanged = actionButton !== this.selectedMenuAction;
|
33
|
+
if (actionButtonHasChanged) {
|
34
|
+
this.selectedMenuAction = actionButton || nothing;
|
35
|
+
}
|
36
|
+
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Event handler, captures state of selected menu
|
40
|
+
*/
|
41
|
+
setSelectedMenu({ detail }: CustomEvent) {
|
42
|
+
const { id } = detail;
|
43
|
+
this.selectedMenu = this.selectedMenu === id ? '' : id;
|
44
|
+
const { actionButton } =
|
45
|
+
this.selectedMenuDetails || ({} as Record<string, any>);
|
46
|
+
this.selectedMenuAction = actionButton || nothing;
|
47
|
+
}
|
48
|
+
|
49
|
+
/**
|
50
|
+
* closes menu drawer
|
51
|
+
*/
|
52
|
+
closeMenu() {
|
53
|
+
if (!this.manuallyHandleClose) {
|
54
|
+
this.open = false;
|
55
|
+
}
|
56
|
+
const { closeDrawer } = sliderEvents;
|
57
|
+
const drawerClosed = new CustomEvent(closeDrawer, {
|
58
|
+
detail: this.selectedMenuDetails,
|
59
|
+
});
|
60
|
+
this.dispatchEvent(drawerClosed);
|
61
|
+
}
|
62
|
+
|
63
|
+
get selectedMenuDetails() {
|
64
|
+
const selectedMenu = this.menus.find(
|
65
|
+
menu => (menu as any).id === this.selectedMenu
|
66
|
+
);
|
67
|
+
return selectedMenu;
|
68
|
+
}
|
69
|
+
|
70
|
+
get selectedMenuComponent() {
|
71
|
+
const menuItem = this.selectedMenuDetails;
|
72
|
+
return menuItem && (menuItem as any)?.component
|
73
|
+
? (menuItem as any).component
|
74
|
+
: html``;
|
75
|
+
}
|
76
|
+
|
77
|
+
/* render */
|
78
|
+
|
79
|
+
get sliderDetailsClass() {
|
80
|
+
const animate = this.animateMenuOpen ? 'animate' : '';
|
81
|
+
const state = this.open ? 'open' : '';
|
82
|
+
return `${animate} ${state}`;
|
83
|
+
}
|
84
|
+
|
85
|
+
get selectedMenuClass() {
|
86
|
+
return this.selectedMenu ? 'open' : '';
|
87
|
+
}
|
88
|
+
|
89
|
+
get menuItems() {
|
90
|
+
return this.menus.map(
|
91
|
+
(menu: Record<string, any>) =>
|
92
|
+
html`
|
93
|
+
<li>
|
94
|
+
<menu-button
|
95
|
+
@menuTypeSelected=${this.setSelectedMenu}
|
96
|
+
.icon=${menu.icon}
|
97
|
+
.label=${menu.label}
|
98
|
+
.menuDetails=${menu.menuDetails}
|
99
|
+
.id=${menu.id}
|
100
|
+
.selected=${menu.id === this.selectedMenu}
|
101
|
+
.followable=${menu.followable}
|
102
|
+
.href=${menu.href}
|
103
|
+
></menu-button>
|
104
|
+
</li>
|
105
|
+
`
|
106
|
+
);
|
107
|
+
}
|
108
|
+
|
109
|
+
get renderMenuHeader() {
|
110
|
+
const { label = '', menuDetails = '' } =
|
111
|
+
this.selectedMenuDetails || ({} as Record<string, any>);
|
112
|
+
const headerClass = this.selectedMenuAction ? 'with-secondary-action' : '';
|
113
|
+
const actionBlock = this.selectedMenuAction
|
114
|
+
? html`<span class="custom-action">${this.selectedMenuAction}</span>`
|
115
|
+
: nothing;
|
116
|
+
return html`
|
117
|
+
<header class="${headerClass}">
|
118
|
+
<div class="details">
|
119
|
+
<h3>${label}</h3>
|
120
|
+
<span class="extra-details">${menuDetails}</span>
|
121
|
+
</div>
|
122
|
+
${actionBlock} ${this.closeButton}
|
123
|
+
</header>
|
124
|
+
`;
|
125
|
+
}
|
126
|
+
|
127
|
+
get closeButton() {
|
128
|
+
return html`
|
129
|
+
<button
|
130
|
+
class="close"
|
131
|
+
aria-label="Close this menu"
|
132
|
+
@click=${this.closeMenu}
|
133
|
+
>
|
134
|
+
<ia-icon-collapse-sidebar></ia-icon-collapse-sidebar>
|
135
|
+
</button>
|
136
|
+
`;
|
137
|
+
}
|
138
|
+
|
139
|
+
/** @inheritdoc */
|
140
|
+
render() {
|
141
|
+
return html`
|
142
|
+
<div class="main">
|
143
|
+
<div class="menu ${this.sliderDetailsClass}">
|
144
|
+
${this.closeButton}
|
145
|
+
<ul class="menu-list">
|
146
|
+
${this.menuItems}
|
147
|
+
</ul>
|
148
|
+
<div
|
149
|
+
class="content ${this.selectedMenuClass}"
|
150
|
+
@menuTypeSelected=${this.setSelectedMenu}
|
151
|
+
>
|
152
|
+
${this.renderMenuHeader}
|
153
|
+
<section>
|
154
|
+
<div class="selected-menu">${this.selectedMenuComponent}</div>
|
155
|
+
</section>
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
</div>
|
159
|
+
`;
|
160
|
+
}
|
161
|
+
}
|
@@ -0,0 +1,80 @@
|
|
1
|
+
import { html, LitElement } from 'lit';
|
2
|
+
import { customElement, property } from 'lit/decorators.js';
|
3
|
+
import menuButtonCSS from './styles/menu-button';
|
4
|
+
|
5
|
+
@customElement('menu-button')
|
6
|
+
export class MenuButton extends LitElement {
|
7
|
+
static get styles() {
|
8
|
+
return menuButtonCSS;
|
9
|
+
}
|
10
|
+
|
11
|
+
@property({ type: String }) icon = '';
|
12
|
+
|
13
|
+
@property({ type: String }) href = '';
|
14
|
+
|
15
|
+
@property({ type: String }) label = '';
|
16
|
+
|
17
|
+
@property({ type: String }) menuDetails = '';
|
18
|
+
|
19
|
+
@property({ type: String }) id = '';
|
20
|
+
|
21
|
+
@property({ type: Boolean }) selected = false;
|
22
|
+
|
23
|
+
@property({ type: Boolean }) followable = false;
|
24
|
+
|
25
|
+
onClick(e: Event) {
|
26
|
+
e.preventDefault();
|
27
|
+
this.dispatchMenuTypeSelectedEvent();
|
28
|
+
}
|
29
|
+
|
30
|
+
dispatchMenuTypeSelectedEvent() {
|
31
|
+
this.dispatchEvent(
|
32
|
+
new CustomEvent('menuTypeSelected', {
|
33
|
+
bubbles: true,
|
34
|
+
composed: true,
|
35
|
+
detail: {
|
36
|
+
id: this.id,
|
37
|
+
},
|
38
|
+
})
|
39
|
+
);
|
40
|
+
}
|
41
|
+
|
42
|
+
get buttonClass() {
|
43
|
+
return this.selected ? 'selected' : '';
|
44
|
+
}
|
45
|
+
|
46
|
+
get iconClass() {
|
47
|
+
return this.selected ? 'active' : '';
|
48
|
+
}
|
49
|
+
|
50
|
+
get menuItem() {
|
51
|
+
return html`
|
52
|
+
<span class="icon ${this.iconClass}"> ${this.icon} </span>
|
53
|
+
<span class="label">${this.label}</span>
|
54
|
+
<span class="menu-details">${this.menuDetails}</span>
|
55
|
+
`;
|
56
|
+
}
|
57
|
+
|
58
|
+
get linkButton() {
|
59
|
+
return html`
|
60
|
+
<a
|
61
|
+
href="${this.href}"
|
62
|
+
class="menu-item ${this.buttonClass}"
|
63
|
+
@click=${this.followable ? undefined : this.onClick}
|
64
|
+
>${this.menuItem}</a
|
65
|
+
>
|
66
|
+
`;
|
67
|
+
}
|
68
|
+
|
69
|
+
get clickButton() {
|
70
|
+
return html`
|
71
|
+
<button class="menu-item ${this.buttonClass}" @click=${this.onClick}>
|
72
|
+
${this.menuItem}
|
73
|
+
</button>
|
74
|
+
`;
|
75
|
+
}
|
76
|
+
|
77
|
+
render() {
|
78
|
+
return this.href ? this.linkButton : this.clickButton;
|
79
|
+
}
|
80
|
+
}
|
@@ -0,0 +1,79 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
|
3
|
+
export default css`
|
4
|
+
a {
|
5
|
+
display: inline-block;
|
6
|
+
text-decoration: none;
|
7
|
+
}
|
8
|
+
|
9
|
+
.menu-item {
|
10
|
+
display: inline-flex;
|
11
|
+
width: 100%;
|
12
|
+
padding: 0;
|
13
|
+
font-size: 1.6rem;
|
14
|
+
text-align: left;
|
15
|
+
background: transparent;
|
16
|
+
-webkit-box-align: center;
|
17
|
+
-ms-flex-align: center;
|
18
|
+
align-items: center;
|
19
|
+
border: none;
|
20
|
+
cursor: pointer;
|
21
|
+
}
|
22
|
+
|
23
|
+
button.menu-item {
|
24
|
+
-webkit-appearance: none;
|
25
|
+
appearance: none;
|
26
|
+
border-radius: 0;
|
27
|
+
}
|
28
|
+
|
29
|
+
.menu-item:focus {
|
30
|
+
outline: none;
|
31
|
+
}
|
32
|
+
|
33
|
+
.label {
|
34
|
+
display: var(--menuButtonLabelDisplay, none);
|
35
|
+
padding: 0;
|
36
|
+
font-weight: 400;
|
37
|
+
color: var(--primaryTextColor);
|
38
|
+
text-align: left;
|
39
|
+
vertical-align: middle;
|
40
|
+
margin-left: 1rem;
|
41
|
+
}
|
42
|
+
|
43
|
+
.menu-details {
|
44
|
+
color: var(--primaryTextColor);
|
45
|
+
display: inline-block;
|
46
|
+
margin-left: 0.5rem;
|
47
|
+
font-style: italic;
|
48
|
+
font-size: 1.5rem;
|
49
|
+
}
|
50
|
+
|
51
|
+
.menu-item > .icon {
|
52
|
+
position: relative;
|
53
|
+
display: inline-flex;
|
54
|
+
z-index: 2;
|
55
|
+
min-width: 4.2rem;
|
56
|
+
max-width: 4.2rem;
|
57
|
+
height: 4.2rem;
|
58
|
+
vertical-align: middle;
|
59
|
+
-webkit-box-align: center;
|
60
|
+
-ms-flex-align: center;
|
61
|
+
align-items: center;
|
62
|
+
-webkit-box-pack: center;
|
63
|
+
-ms-flex-pack: center;
|
64
|
+
justify-content: center;
|
65
|
+
}
|
66
|
+
|
67
|
+
.menu-item.selected .icon {
|
68
|
+
background-color: var(--activeButtonBg);
|
69
|
+
border-radius: 1rem 0 0 1rem;
|
70
|
+
}
|
71
|
+
|
72
|
+
.icon .fill-color {
|
73
|
+
fill: #999;
|
74
|
+
}
|
75
|
+
|
76
|
+
.icon.active .fill-color {
|
77
|
+
fill: #fff;
|
78
|
+
}
|
79
|
+
`;
|
@@ -0,0 +1,119 @@
|
|
1
|
+
import { css } from 'lit';
|
2
|
+
|
3
|
+
const menuButtonWidth = css`42px`;
|
4
|
+
const sliderWidth = css`var(--menuWidth, 320px)`;
|
5
|
+
const transitionTiming = css`var(--animationTiming, 200ms)`;
|
6
|
+
|
7
|
+
export default css`
|
8
|
+
.main {
|
9
|
+
overflow: hidden;
|
10
|
+
width: 100%;
|
11
|
+
height: 100%;
|
12
|
+
}
|
13
|
+
|
14
|
+
.animate {
|
15
|
+
transition: transform ${transitionTiming} ease-out;
|
16
|
+
}
|
17
|
+
|
18
|
+
.menu {
|
19
|
+
position: absolute;
|
20
|
+
top: 0;
|
21
|
+
left: 0;
|
22
|
+
bottom: 0;
|
23
|
+
width: ${sliderWidth};
|
24
|
+
padding: 0.5rem 0.5rem 0 0;
|
25
|
+
box-sizing: border-box;
|
26
|
+
font-size: 1.4rem;
|
27
|
+
color: var(--primaryTextColor);
|
28
|
+
background: var(--menuSliderBg);
|
29
|
+
transform: translateX(calc(${sliderWidth} * -1));
|
30
|
+
}
|
31
|
+
|
32
|
+
.menu > button.close {
|
33
|
+
right: 0.7rem;
|
34
|
+
}
|
35
|
+
|
36
|
+
button {
|
37
|
+
outline: none;
|
38
|
+
cursor: pointer;
|
39
|
+
}
|
40
|
+
|
41
|
+
header {
|
42
|
+
margin: 0 0 0.5rem 0;
|
43
|
+
}
|
44
|
+
|
45
|
+
header * {
|
46
|
+
margin: 0;
|
47
|
+
display: inline-block;
|
48
|
+
}
|
49
|
+
header button {
|
50
|
+
outline: none;
|
51
|
+
cursor: pointer;
|
52
|
+
}
|
53
|
+
|
54
|
+
header.with-secondary-action .details {
|
55
|
+
width: 80%;
|
56
|
+
}
|
57
|
+
|
58
|
+
header .details {
|
59
|
+
font-weight: bold;
|
60
|
+
width: 88%;
|
61
|
+
}
|
62
|
+
|
63
|
+
header .custom-action > *,
|
64
|
+
button.close {
|
65
|
+
padding: 0;
|
66
|
+
background-color: transparent;
|
67
|
+
border: 0;
|
68
|
+
--iconWidth: var(--menuSliderHeaderIconWidth);
|
69
|
+
--iconHeight: var(--menuSliderHeaderIconHeight);
|
70
|
+
}
|
71
|
+
|
72
|
+
header .custom-action,
|
73
|
+
button.close {
|
74
|
+
position: absolute;
|
75
|
+
}
|
76
|
+
button.close {
|
77
|
+
right: 0.5rem;
|
78
|
+
}
|
79
|
+
|
80
|
+
button.close * {
|
81
|
+
float: right;
|
82
|
+
}
|
83
|
+
|
84
|
+
.content {
|
85
|
+
position: absolute;
|
86
|
+
top: 0;
|
87
|
+
right: 0;
|
88
|
+
bottom: 0;
|
89
|
+
left: ${menuButtonWidth};
|
90
|
+
z-index: 1;
|
91
|
+
transform: translateX(calc(${sliderWidth} * -1));
|
92
|
+
transition: transform ${transitionTiming} ease-out;
|
93
|
+
background: var(--activeButtonBg);
|
94
|
+
border-right: 0.2rem solid;
|
95
|
+
border-color: var(--subpanelRightBorderColor);
|
96
|
+
padding: 0.5rem 0 0 0.5rem;
|
97
|
+
display: flex;
|
98
|
+
flex-direction: column;
|
99
|
+
}
|
100
|
+
|
101
|
+
.open {
|
102
|
+
transform: translateX(0);
|
103
|
+
}
|
104
|
+
|
105
|
+
.menu-list {
|
106
|
+
padding: 0;
|
107
|
+
margin: 0;
|
108
|
+
list-style: none;
|
109
|
+
background: var(--menuSliderBg);
|
110
|
+
}
|
111
|
+
.menu-list li {
|
112
|
+
margin-bottom: 0.2rem;
|
113
|
+
}
|
114
|
+
|
115
|
+
.content > section {
|
116
|
+
overflow: auto;
|
117
|
+
overscroll-behavior: contain;
|
118
|
+
}
|
119
|
+
`;
|