Skip to content

Commit 94a9bbc

Browse files
committed
Remove template
1 parent 706d4e6 commit 94a9bbc

File tree

1 file changed

+47
-51
lines changed

1 file changed

+47
-51
lines changed

src/js/orbit-arc.js

+47-51
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,54 @@
1-
2-
const template = document.createElement('template')
3-
template.innerHTML = `
4-
<style>
5-
:host {
6-
--o-fill: var(--o-gray-light);
7-
--o-stroke: var(--o-fill);
8-
--o-stroke-width: 1;
9-
--o-color: currentcolor;
10-
}
11-
:host(:hover){
12-
--o-fill: var(--o-gray-light);
13-
--o-stroke: var(--o-fill);
14-
--o-stroke-width: 1;
15-
--o-color: currentcolor;
16-
}
17-
svg {
18-
width: 100%;
19-
height: 100%;
20-
overflow: visible;
21-
pointer-events: none;
22-
}
23-
svg * {
24-
pointer-events: visiblePainted;
25-
}
26-
#orbitShape {
27-
fill: var(--o-fill);
28-
stroke: var(--o-stroke);
29-
stroke-width: var(--o-stroke-width);
30-
transition: all 0.3s;
31-
stroke-linejoin: round;
32-
}
33-
text {
34-
fill: var(--o-color);
35-
}
36-
#orbitPath {
37-
fill: transparent;
38-
stroke: none;
39-
stroke-width: 0;
40-
}
41-
</style>
42-
<svg viewBox="0 0 100 100">
43-
<path id="orbitShape" shape-rendering="geometricPrecision" vector-effect="non-scaling-stroke"></path>
44-
<path id="orbitPath" shape-rendering="geometricPrecision" vector-effect="non-scaling-stroke" ></path>
45-
<text>
46-
<textPath href="#orbitPath" alignment-baseline="middle"></textPath>
47-
</text>
48-
</svg>
49-
`
50-
511
export class OrbitArc extends HTMLElement {
522
constructor() {
533
super()
544
this.attachShadow({ mode: 'open' })
55-
this.shadowRoot.appendChild(template.content.cloneNode(true))
5+
this.shadowRoot.innerHTML = `
6+
<style>
7+
:host {
8+
--o-fill: var(--o-gray-light);
9+
--o-stroke: var(--o-fill);
10+
--o-stroke-width: 1;
11+
--o-color: currentcolor;
12+
}
13+
:host(:hover){
14+
--o-fill: var(--o-gray-light);
15+
--o-stroke: var(--o-fill);
16+
--o-stroke-width: 1;
17+
--o-color: currentcolor;
18+
}
19+
svg {
20+
width: 100%;
21+
height: 100%;
22+
overflow: visible;
23+
pointer-events: none;
24+
}
25+
svg * {
26+
pointer-events: visiblePainted;
27+
}
28+
#orbitShape {
29+
fill: var(--o-fill);
30+
stroke: var(--o-stroke);
31+
stroke-width: var(--o-stroke-width);
32+
transition: all 0.3s;
33+
stroke-linejoin: round;
34+
}
35+
text {
36+
fill: var(--o-color);
37+
}
38+
#orbitPath {
39+
fill: transparent;
40+
stroke: none;
41+
stroke-width: 0;
42+
}
43+
</style>
44+
<svg viewBox="0 0 100 100">
45+
<path id="orbitShape" shape-rendering="geometricPrecision" vector-effect="non-scaling-stroke"></path>
46+
<path id="orbitPath" shape-rendering="geometricPrecision" vector-effect="non-scaling-stroke" ></path>
47+
<text>
48+
<textPath href="#orbitPath" alignment-baseline="middle"></textPath>
49+
</text>
50+
</svg>
51+
`
5652
}
5753

5854
connectedCallback() {

0 commit comments

Comments
 (0)