File size: 3,959 Bytes
0751b83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
class QuantumProcess extends HTMLElement {
    constructor() {
        super();
        this.attachShadow({ mode: 'open' });
        this.shadowRoot.innerHTML = `
            <style>
                :host {
                    display: block;
                    background: rgba(40, 40, 60, 0.9);
                    border-radius: 8px;
                    padding: 15px;
                    margin-bottom: 15px;
                    border-left: 4px solid var(--system-accent);
                    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
                }
                
                .process-header {
                    display: flex;
                    align-items: center;
                    margin-bottom: 10px;
                }
                
                .process-icon {
                    margin-right: 10px;
                    color: var(--system-accent);
                }
                
                .process-title {
                    flex: 1;
                    font-weight: 500;
                }
                
                .process-pid {
                    opacity: 0.7;
                    font-size: 0.8em;
                }
                
                .process-stats {
                    display: flex;
                    gap: 15px;
                    margin-top: 10px;
                }
                
                .stat {
                    display: flex;
                    flex-direction: column;
                }
                
                .stat-value {
                    font-weight: 500;
                }
                
                .stat-label {
                    font-size: 0.7em;
                    opacity: 0.7;
                }
                
                .process-controls {
                    display: flex;
                    gap: 10px;
                    margin-top: 15px;
                }
                
                .control-btn {
                    padding: 5px 10px;
                    border-radius: 4px;
                    border: none;
                    cursor: pointer;
                    font-size: 0.8em;
                }
                
                .suspend {
                    background: var(--system-warning);
                }
                
                .terminate {
                    background: var(--system-danger);
                }
            </style>
            <div class="process-header">
                <i class="process-icon fas fa-microchip"></i>
                <div class="process-title"><slot name="name"></slot></div>
                <div class="process-pid">PID: <slot name="pid"></slot></div>
            </div>
            <div class="process-stats">
                <div class="stat">
                    <span class="stat-value"><slot name="cpu">0%</slot></span>
                    <span class="stat-label">CPU</span>
                </div>
                <div class="stat">
                    <span class="stat-value"><slot name="memory">0MB</slot></span>
                    <span class="stat-label">Memory</span>
                </div>
                <div class="stat">
                    <span class="stat-value"><slot name="uptime">00:00</slot></span>
                    <span class="stat-label">Uptime</span>
                </div>
            </div>
            <div class="process-controls">
                <button class="control-btn suspend">Suspend</button>
                <button class="control-btn terminate">Terminate</button>
            </div>
        `;
    }
    
    connectedCallback() {
        this.shadowRoot.querySelector('.terminate').addEventListener('click', () => {
            this.dispatchEvent(new CustomEvent('terminate', {
                bubbles: true,
                composed: true,
                detail: { pid: this.getAttribute('data-pid') }
            }));
        });
    }
}

customElements.define('quantum-process', QuantumProcess);