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