File size: 1,184 Bytes
3e93c1d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
// Loading Spinner Web Component
class LoadingSpinner extends HTMLElement {
    constructor() {
        super();
        this.attachShadow({ mode: 'open' });
    }
    
    connectedCallback() {
        const size = this.getAttribute('size') || '40';
        const color = this.getAttribute('color') || '#f59e0b';
        
        this.shadowRoot.innerHTML = `
            <style>
                :host {
                    display: inline-block;
                }
                
                .spinner {
                    animation: rotate 2s linear infinite;
                    width: ${size}px;
                    height: ${size}px;
                }
                
                .circle {
                    stroke: ${color};
                    stroke-width: 3;
                    stroke-linecap: round;
                    animation: dash 1.5s ease-in-out infinite;
                    fill: none;
                }
                
                @keyframes rotate {
                    100% { transform: rotate(360deg); }
                }
                
                @keyframes dash {
                    0% {
                        stroke-dasharray: 1,