-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
58 lines (57 loc) · 1.49 KB
/
index.js
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
// src/wc-icon-rule.js
var WCIconRule = class extends HTMLElement {
constructor() {
super();
this.__shadowRoot = this.attachShadow({mode: "open"});
const template = document.createElement("template");
template.innerHTML = WCIconRule.template();
this.__shadowRoot.appendChild(template.content.cloneNode(true));
}
connectedCallback() {
this.setAttribute("role", "presentation");
for (const child of this.children) {
child.setAttribute("role", "none");
}
}
static template() {
return `
<style>
:host {
display: block;
overflow: hidden;
text-align: center;
}
:host:before,
:host:after {
content: "";
display: inline-block;
vertical-align: middle;
position: relative;
width: 50%;
border-top-style: var(--hr-style, solid);
border-top-width: var(--hr-width, 1px);
border-color: var(--hr-color, #000);
}
:host:before {
right: var(--space-around, 1em);
margin-left: -50%;
}
:host:after {
left: var(--space-around, 1em);
margin-right: -50%;
}
::slotted(*) {
display: inline-block;
width: var(--width, 32px);
height: var(--height, 32px);
vertical-align: middle;
}
</style>
<slot></slot>
`;
}
};
customElements.define("wc-icon-rule", WCIconRule);
export {
WCIconRule
};