File size: 2,361 Bytes
c9ae51a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8ca2022
 
c9ae51a
8ca2022
c9ae51a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
class CustomNode extends HTMLElement {
  connectedCallback() {
    this.attachShadow({ mode: 'open' });
    this.shadowRoot.innerHTML = `
      <style>
        .node-container {
          background: rgba(15, 23, 42, 0.9);
          border: 1px solid rgba(71, 85, 105, 0.5);
          border-radius: 0.5rem;
          padding: 1rem;
          min-width: 200px;
          box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
          transition: all 0.2s ease;
        }
        .node-container:hover {
          border-color: #22c55e;
          box-shadow: 0 10px 15px -3px rgba(34, 197, 94, 0.1);
        }
.node-header {
          display: flex;
          align-items: center;
          margin-bottom: 0.75rem;
        }
        
        .node-icon {
          width: 2rem;
          height: 2rem;
          display: flex;
          align-items: center;
          justify-content: center;
          background: rgba(251, 146, 60, 0.1);
          border-radius: 0.25rem;
          margin-right: 0.75rem;
          color: #fb923c;
        }
        
        .node-title {
          font-weight: 600;
          color: #e2e8f0;
        }
        
        .node-body {
          font-size: 0.875rem;
          color: #94a3b8;
        }
        
        .node-status {
          height: 0.5rem;
          width: 0.5rem;
          border-radius: 50%;
          margin-left: auto;
        }
        
        .status-idle {
          background-color: #64748b;
        }
        
        .status-running {
          background-color: #f59e0b;
          animation: pulse 1.5s infinite;
        }
        
        .status-success {
          background-color: #10b981;
        }
        
        .status-error {
          background-color: #ef4444;
        }
        
        @keyframes pulse {
          0%, 100% {
            opacity: 1;
          }
          50% {
            opacity: 0.5;
          }
        }
      </style>
      
      <div class="node-container">
        <div class="node-header">
          <div class="node-icon">
            <i data-feather="code"></i>
          </div>
          <div class="node-title">Node</div>
          <div class="node-status status-idle"></div>
        </div>
        <div class="node-body">
          Drag handles to connect nodes
        </div>
      </div>
    `;
  }
}

customElements.define('custom-node', CustomNode);