// alpineManager.js
import Alpine from "alpinejs";

class AlpineManager {
    constructor() {
        this.components = {};
    }

    register(name, component) {
        this.components[name] = component;
    }

    registerAll() {
        console.log(this.components);
        for (const [name, component] of Object.entries(this.components)) {
            console.log(name, component);
            Alpine.data(name, component);
        }
    }
}

// instance singleton
const alpineManager = new AlpineManager();
export default alpineManager;
