class TourGuide extends HTMLElement { constructor() { super(); this.steps = [ { target: '.step-1', content: 'This is the main dashboard.', }, { target: '.step-2', content: 'Here you can see your recent activity.', }, { target: '.step-3', content: 'Click here to create a new item.', } ]; this.currentStep = 0; this.isRunning = false; } connectedCallback() { this.render(); this.setupEventListeners(); } render() { this.innerHTML = ` `; } setupEventListeners() { this.querySelector('.tour-button').addEventListener('click', () => this.startTour()); } startTour() { this.isRunning = true; this.currentStep = 0; this.showStep(); } showStep() { // Remove any existing tooltips this.removeTooltips(); const step = this.steps[this.currentStep]; const targetElement = document.querySelector(step.target); if (!targetElement) { console.warn(`Target element not found: ${step.target}`); this.nextStep(); return; } // Create overlay const overlay = document.createElement('div'); overlay.className = 'tour-overlay'; document.body.appendChild(overlay); // Position tooltip const rect = targetElement.getBoundingClientRect(); const tooltip = document.createElement('div'); tooltip.className = 'tour-tooltip'; tooltip.style.top = `${rect.bottom + window.scrollY + 10}px`; tooltip.style.left = `${rect.left + window.scrollX}px`; tooltip.innerHTML = `