File size: 2,088 Bytes
620be6a
5ae24f3
 
 
 
 
 
 
 
 
 
620be6a
5ae24f3
620be6a
5ae24f3
 
 
 
 
 
 
 
 
 
 
 
620be6a
 
 
 
 
 
5ae24f3
620be6a
5ae24f3
 
 
 
 
 
 
 
620be6a
 
 
 
5ae24f3
620be6a
5ae24f3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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

class CommandManager extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        :host {
          display: block;
          background-color: #f1f1f1;
          border-bottom: 1px solid #ddd;
          font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
          box-shadow: 0 1px 3px rgba(0,0,0,0.1);
        }
.tab-container {
          display: flex;
          padding: 0.2rem 1rem;
          background-color: #e5e5e5;
          border-bottom: 1px solid #ddd;
        }
        .tab {
          padding: 0.5rem 1rem;
          background: none;
          border: none;
          cursor: pointer;
          border-right: 1px solid #ddd;
          font-size: 0.8rem;
          transition: all 0.2s ease;
          position: relative;
        }

        .tab:hover {
          background-color: #e0e0e0;
        }
.tab.active {
          background-color: #f1f1f1;
          border-bottom: 2px solid #1a73e8;
        }
        .toolbar {
          display: flex;
          gap: 0.5rem;
          padding: 0.5rem 1rem;
          flex-wrap: wrap;
          border-top: 1px solid #e0e0e0;
          background-color: white;
          min-height: 60px;
          align-items: center;
        }
</style>
      <div class="tab-container">
        <button class="tab active">Features</button>
        <button class="tab">Sketch</button>
        <button class="tab">Evaluate</button>
        <button class="tab">DimXpert</button>
      </div>
      <div class="toolbar">
        <slot></slot>
      </div>
    `;

    this.shadowRoot.querySelectorAll('.tab').forEach(tab => {
      tab.addEventListener('click', () => {
        this.shadowRoot.querySelectorAll('.tab').forEach(t => t.classList.remove('active'));
        tab.classList.add('active');
        this.dispatchEvent(new CustomEvent('tab-change', { 
          detail: { tab: tab.textContent },
          bubbles: true,
          composed: true 
        }));
      });
    });
  }
}
customElements.define('command-manager', CommandManager);