yyf_aka-web-components
Version:
A collection of modern Web Components including counter, data table and custom button components
46 lines (38 loc) • 1.28 kB
JavaScript
/**
* Web Components Demo Package
* A collection of modern Web Components including counter and data table components
*
* @version 1.0.0
* @license MIT
*/
// Import components
import CounterComponent from './components/counter-component.js';
import DataTable from './components/data-table.js';
import CustomButton from './components/custom-button.js';
// Export named components
export { CounterComponent, DataTable, CustomButton };
// Export all components as default
export default {
CounterComponent,
DataTable,
CustomButton
};
// Auto-register components if in browser environment
if (typeof window !== 'undefined' && window.customElements) {
// Register components
if (!window.customElements.get('counter-component')) {
window.customElements.define('counter-component', CounterComponent);
}
if (!window.customElements.get('data-table')) {
window.customElements.define('data-table', DataTable);
}
if (!window.customElements.get('custom-button')) {
window.customElements.define('custom-button', CustomButton);
}
}
// Also export as global for UMD builds
if (typeof globalThis !== 'undefined') {
globalThis.CounterComponent = CounterComponent;
globalThis.DataTable = DataTable;
globalThis.CustomButton = CustomButton;
}