/** * bare-v2 JavaScript API * Main entry point that exposes all modules under the global `bare` object */ import { createToast } from './toast'; import { createTheme } from './theme'; import { createDropdown } from './dropdown'; import { createNavigation } from './navigation'; import { initToc } from './toc'; import type { BareAPI } from './types'; // Get version from package.json (will be replaced during build) const version = typeof __VERSION__ !== 'undefined' ? __VERSION__ : '2.0.6'; /** * Initialize and expose the bare API */ function initBare(): BareAPI { const theme = createTheme(); const toast = createToast(); const dropdown = createDropdown(); const navigation = createNavigation(); // Initialize theme system theme.init(); // Initialize dropdowns (click-based by default on mobile) dropdown.init(); // Initialize navigation systems navigation.init(); // Initialize TOC initToc(); const api: BareAPI = { toast, theme, dropdown, navigation, version, }; return api; } // Auto-initialize when script loads const bare = initBare(); // Expose globally if (typeof window !== 'undefined') { window.bare = bare; } // Also export for module usage export default bare; export { bare };