import * as futuristic from "./futuristicui";
import { defaultTheme } from "./default-theme";

/**
 * BismillahCSS UI Core Logic Library
 * Designed for pure performance and spatial design intelligence.
 */
export const bLibrary = {
    ...futuristic,
    theme: defaultTheme,

    /**
     * Initialize all Bismillah Primitives on a page.
     * Auto-detects elements with specific classes.
     */
    init: () => {
        if (typeof document === 'undefined') return;

        // Primitives mapping
        const mappings: Record<string, (el: HTMLElement) => void> = {
            '.b-spotlight': futuristic.bSpotlight,
            '.b-magnetic': futuristic.bMagnetic,
            '.b-glare': futuristic.bGlare,
            '.b-reveal': futuristic.bReveal,
            '.b-text-reveal': futuristic.bTextReveal,
            '.b-floating-nav': (el) => futuristic.bFloatingNav(el),
            '.b-card-futu': futuristic.bCard,
            '.b-btn-futu': futuristic.bButton,
            '.b-input-futu': futuristic.bTextField,
            '.b-circular-progress': futuristic.bCircularProgress,
        };

        Object.entries(mappings).forEach(([selector, initFn]) => {
            document.querySelectorAll<HTMLElement>(selector).forEach(el => initFn(el));
        });

        console.log('%c BismillahCSS Primitives Initialized ', 'background: #00f2ff; color: #000; font-weight: bold; border-radius: 4px; padding: 2px 8px;');
    }
};

export default bLibrary;
