Repository navigation
Expand file tree
/
Copy pathcasper-menu-separator.js
More file actions
80 lines (67 loc) · 2.36 KB
/
Copy pathcasper-menu-separator.js
File metadata and controls
80 lines (67 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/*
- Copyright (c) 2018 Cloudware S.A. All rights reserved.
-
- This file is part of casper-context-menu.
-
- casper-context-menu is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- casper-context-menu is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with casper-context-menu. If not, see <http://www.gnu.org/licenses/>.
-
*/
import { PolymerElement, html } from '@polymer/polymer/polymer-element.js';
import { afterNextRender } from '@polymer/polymer/lib/utils/render-status.js';
class CasperMenuSeparator extends PolymerElement {
static get template() {
return html`
<style>
:host {
/*background: var(--primary-background-color, white);*/
/*border-radius: var(--radius-primary, 6px);*/
/*box-shadow: rgba(0, 0, 0, 0.24) -2px 5px 12px 0px, rgba(0, 0, 0, 0.12) 0px 0px 12px 0px;*/
overflow: hidden;
}
.inner {
color: var(--primary-color);
font-size: 13px; /*var(--default-header-size, 13px);*/
padding: 6px 12px 6px 12px;
margin: 0px;
/*text-transform: uppercase;*/
cursor: default;
text-align: left;
background-color: #efefef;
font-weight: bold;
}
.inner.empty {
padding: 2px 12px 0px 12px;
}
paper-listbox {
/* color: var(--primary-text-color, gray); */
border-radius: var(--radius-primary, 6px);
padding: 0px;
}
</style>
<div class="inner"><slot></slot></div>
`;
}
static get is () {
return 'casper-menu-separator';
}
ready () {
super.ready();
afterNextRender(this, () => {
if (this.shadowRoot.querySelector('slot:not([name])').assignedNodes().length === 0) {
this.shadowRoot.querySelector(".inner").classList.add("empty");
}
});
}
}
customElements.define(CasperMenuSeparator.is, CasperMenuSeparator);