| class ApiConnector extends HTMLElement { | |
| connectedCallback() { | |
| this.attachShadow({ mode: 'open' }); | |
| this.shadowRoot.innerHTML = ` | |
| <style> | |
| :host { | |
| display: block; | |
| margin: 1rem 0; | |
| } | |
| .connector { | |
| border: 1px solid #e5e7eb; | |
| border-radius: 8px; | |
| padding: 1rem; | |
| background: #f9fafb; | |
| transition: box-shadow 0.2s; | |
| } | |
| .connector:hover { | |
| box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08); | |
| } | |
| .header { | |
| display: flex; | |
| align-items: center; | |
| margin-bottom: 0.5rem; | |
| } | |
| .icon { | |
| width: 24px; | |
| height: 24px; | |
| margin-right: 0.5rem; | |
| flex-shrink: 0; | |
| } | |
| h3 { | |
| margin: 0; | |
| font-size: 1rem; | |
| font-weight: 600; | |
| } | |
| .actions { | |
| display: flex; | |
| gap: 0.5rem; | |
| margin-top: 0.75rem; | |
| } | |
| button { | |
| padding: 0.25rem 0.5rem; | |
| font-size: 0.875rem; | |
| border-radius: 4px; | |
| cursor: pointer; | |
| transition: all 0.15s; | |
| } | |
| .connect { | |
| background: #3b82f6; | |
| color: white; | |
| border: none; | |
| } | |
| .connect:hover { | |
| background: #2563eb; | |
| } | |
| .docs { | |
| background: white; | |
| border: 1px solid #e5e7eb; | |
| } | |
| .docs:hover { | |
| background: #f3f4f6; | |
| } | |
| </style> | |
| <div class="connector"> | |
| <div class="header"> | |
| <svg class="icon" viewBox="0 0 24 24" fill="none" stroke="#3b82f6" stroke-width="2"> | |
| <path d="M12 2L2 7l10 5 10-5-10-5z"/> | |
| <path d="M2 17l10 5 10-5"/> | |
| <path d="M2 12l10 5 10-5"/> | |
| </svg> | |
| <h3><slot name="name">API Connector</slot></h3> | |
| </div> | |
| <div><slot name="description">Connect to external APIs</slot></div> | |
| <div class="actions"> | |
| <button class="connect">Connect</button> | |
| <button class="docs">Docs</button> | |
| </div> | |
| </div> | |
| `; | |
| } | |
| } | |
| customElements.define('api-connector', ApiConnector); | |