File size: 3,356 Bytes
3bcb678
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
```javascript
class TabsContainer extends HTMLElement {
    constructor() {
        super();
        this.attachShadow({ mode: 'open' });
    }

    connectedCallback() {
        this.render();
        this.attachEvents();
    }

    render() {
        this.shadowRoot.innerHTML = `
            <style>
                :host {
                    display: block;
                }
                .tabs-header {
                    display: flex;
                    gap: 1px;
                    border-bottom: 2px solid #1e293b;
                    margin-bottom: 1.5rem;
                }
                .tab-button {
                    padding: 0.75rem 1.5rem;
                    background: transparent;
                    border: none;
                    color: #94a3b8;
                    cursor: pointer;
                    font-size: 14px;
                    font-weight: 500;
                    transition: all 0.2s;
                    position: relative;
                }
                .tab-button:hover {
                    color: #e2e8f0;
                }
                .tab-button.active {
                    color: #10b981;
                }
                .tab-button.active::after {
                    content: '';
                    position: absolute;
                    bottom: -2px;
                    left: 0;
                    right: 0;
                    height: 2px;
                    background: #10b981;
                }
                .tab-panel {
                    display: none;
                }
                .tab-panel.active {
                    display: block;
                }
                ::slotted(tab-panel) {
                    display: none;
                }
                ::slotted(tab-panel[active]) {
                    display: block;
                }
            </style>
            <div class="tabs-header">
                <button class="tab-button active" data-tab="general">General</button>
                <button class="tab-button" data-tab="performance">Performance</button>
                <button class="tab-button" data-tab="security">Security</button>
                <button class="tab-button" data-tab="advanced">Advanced</button>
            </div>
            <slot></slot>
        `;
    }

    attachEvents() {
        const buttons = this.shadowRoot.querySelectorAll('.tab-button');
        const panels = this.querySelectorAll('tab-panel');

        buttons.forEach(button => {
            button.addEventListener('click', () => {
                const tabId = button.dataset.tab;

                buttons.forEach(b => b.classList.remove('active'));
                button.classList.add('active');

                panels.forEach(panel => {
                    panel.removeAttribute('active');
                    if (panel.id === tabId) {
                        panel.setAttribute('active', '');
                    }
                });
            });
        });
    }
}

customElements.define('tabs-container', TabsContainer);

class TabPanel extends HTMLElement {
    connectedCallback() {
        this.style.display = this.hasAttribute('active') ? 'block' : 'none';
    }

    static get observedAttributes() {
        return
___METADATA_START___
{"repoId":"00Boobs00/omniloop-ai","isNew":false,"userName":"00Boobs00"}
___METADATA_END___