Update index.js

This commit is contained in:
Natxo
2026-03-31 12:45:58 +02:00
committed by GitHub
parent 21e8c5167a
commit a0bc8a2953

View File

@@ -1,4 +1,3 @@
// 1. IMPORTAMOS TODO INTERNAMENTE
import * as ButtonModule from './Button.js'; import * as ButtonModule from './Button.js';
import * as InputModule from './Input.js'; import * as InputModule from './Input.js';
import * as SelectModule from './Select.js'; import * as SelectModule from './Select.js';
@@ -30,8 +29,6 @@ import * as AlertModule from './Alert.js';
import * as ToastModule from './Toast.js'; import * as ToastModule from './Toast.js';
import * as LoadingModule from './Loading.js'; import * as LoadingModule from './Loading.js';
// 2. EXPORTACIONES INDIVIDUALES (Named Exports)
// Esto permite: import { Button, Table } from './components/index.js'
export * from './Button.js'; export * from './Button.js';
export * from './Input.js'; export * from './Input.js';
export * from './Select.js'; export * from './Select.js';
@@ -63,7 +60,6 @@ export * from './Alert.js';
export * from './Toast.js'; export * from './Toast.js';
export * from './Loading.js'; export * from './Loading.js';
// 3. OBJETO COLECTIVO PARA LA INSTALACIÓN GLOBAL
const Components = { const Components = {
...ButtonModule, ...InputModule, ...SelectModule, ...AutocompleteModule, ...ButtonModule, ...InputModule, ...SelectModule, ...AutocompleteModule,
...CheckboxModule, ...RadioModule, ...RangeModule, ...RatingModule, ...CheckboxModule, ...RadioModule, ...RangeModule, ...RatingModule,
@@ -75,13 +71,11 @@ const Components = {
...ToastModule, ...LoadingModule ...ToastModule, ...LoadingModule
}; };
// 4. EXPORTACIÓN POR DEFECTO CON MÉTODO .install()
export default { export default {
...Components, ...Components,
install: (target = window) => { install: (target = window) => {
Object.entries(Components).forEach(([name, component]) => { Object.entries(Components).forEach(([name, component]) => {
target[name] = component; target[name] = component;
}); });
console.log("🚀 SigproUI: Componentes instalados en window.");
} }
}; };