import * as plugins from './plugins.js'; // Import all elements import './elements/index.js'; // Import services import { apiService } from './services/index.js'; // Initialize the application const initApp = async () => { console.log('TsView UI initializing...'); // Wait for custom elements to be defined await customElements.whenDefined('tsview-app'); // Only create the app element if it doesn't already exist in HTML if (!document.querySelector('tsview-app')) { const app = document.createElement('tsview-app'); document.body.appendChild(app); } console.log('TsView UI ready'); }; // Auto-init when DOM is ready if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', initApp); } else { initApp(); }