Download ave.js from Avenislo/ave: direct link, hf CLI and curl.
- Browser
- Download file 5.25 kB
-
https://huggingface.co/spaces/Avenislo/ave/resolve/main/ave.js
- Command line
-
hf download hf://spaces/Avenislo/ave/ave.js
-
curl -L -o ave.js https://huggingface.co/spaces/Avenislo/ave/resolve/main/ave.js
5.25 kB
| /** | |
| * Ave Components Library | |
| * Central import file for all Ave web components | |
| * | |
| * This file imports all components from the components directory | |
| * and provides a single entry point for the entire component library. | |
| */ | |
| // Import the design system first | |
| import { waitForDesignSystem } from './ave-styles.js'; | |
| // Import all Ave components | |
| import './ave-base-component.js'; | |
| import './ave-accordion.js'; | |
| import './ave-alert-dialog.js'; | |
| import './ave-alert.js'; | |
| import './ave-avatar.js'; | |
| import './ave-badge.js'; | |
| import './ave-breadcrumb.js'; | |
| import './ave-button.js'; | |
| import './ave-card.js'; | |
| import './ave-checkbox.js'; | |
| import './ave-combobox.js'; | |
| import './ave-dialog.js'; | |
| import './ave-dropdown-menu.js'; | |
| import './ave-form.js'; | |
| import './ave-input.js'; | |
| import './ave-label.js'; | |
| import './ave-pagination.js'; | |
| import './ave-popover.js'; | |
| import './ave-radio-group.js'; | |
| import './ave-select.js'; | |
| import './ave-sidebar.js'; | |
| import './ave-skeleton.js'; | |
| import './ave-slider.js'; | |
| import './ave-switch.js'; | |
| import './ave-table.js'; | |
| import './ave-tabs.js'; | |
| import './ave-textarea.js'; | |
| import './ave-toast.js'; | |
| import './ave-tooltip.js'; | |
| // Component registry for programmatic access | |
| export const AveComponents = { | |
| // Form Components | |
| 'ave-button': 'ave-button', | |
| 'ave-input': 'ave-input', | |
| 'ave-textarea': 'ave-textarea', | |
| 'ave-checkbox': 'ave-checkbox', | |
| 'ave-radio-group': 'ave-radio-group', | |
| 'ave-select': 'ave-select', | |
| 'ave-combobox': 'ave-combobox', | |
| 'ave-slider': 'ave-slider', | |
| 'ave-switch': 'ave-switch', | |
| 'ave-label': 'ave-label', | |
| 'ave-form': 'ave-form', | |
| // Layout Components | |
| 'ave-card': 'ave-card', | |
| 'ave-accordion': 'ave-accordion', | |
| 'ave-tabs': 'ave-tabs', | |
| 'ave-sidebar': 'ave-sidebar', | |
| 'ave-table': 'ave-table', | |
| // Feedback Components | |
| 'ave-alert': 'ave-alert', | |
| 'ave-toast': 'ave-toast', | |
| 'ave-skeleton': 'ave-skeleton', | |
| 'ave-badge': 'ave-badge', | |
| // Overlay Components | |
| 'ave-dialog': 'ave-dialog', | |
| 'ave-alert-dialog': 'ave-alert-dialog', | |
| 'ave-popover': 'ave-popover', | |
| 'ave-tooltip': 'ave-tooltip', | |
| 'ave-dropdown-menu': 'ave-dropdown-menu', | |
| // Navigation Components | |
| 'ave-breadcrumb': 'ave-breadcrumb', | |
| 'ave-pagination': 'ave-pagination', | |
| // Display Components | |
| 'ave-avatar': 'ave-avatar' | |
| }; | |
| // Component categories for organization | |
| export const ComponentCategories = { | |
| form: [ | |
| 'ave-button', 'ave-input', 'ave-textarea', 'ave-checkbox', | |
| 'ave-radio-group', 'ave-select', 'ave-combobox', 'ave-slider', | |
| 'ave-switch', 'ave-label', 'ave-form' | |
| ], | |
| layout: [ | |
| 'ave-card', 'ave-accordion', 'ave-tabs', 'ave-sidebar', 'ave-table' | |
| ], | |
| feedback: [ | |
| 'ave-alert', 'ave-toast', 'ave-skeleton', 'ave-badge' | |
| ], | |
| overlay: [ | |
| 'ave-dialog', 'ave-alert-dialog', 'ave-popover', 'ave-tooltip', 'ave-dropdown-menu' | |
| ], | |
| navigation: [ | |
| 'ave-breadcrumb', 'ave-pagination' | |
| ], | |
| display: [ | |
| 'ave-avatar' | |
| ] | |
| }; | |
| // Utility functions | |
| export const AveUtils = { | |
| /** | |
| * Check if a component is registered | |
| * @param {string} componentName - The component name to check | |
| * @returns {boolean} - Whether the component is registered | |
| */ | |
| isComponentRegistered(componentName) { | |
| return customElements.get(componentName) !== undefined; | |
| }, | |
| /** | |
| * Get all registered Ave components | |
| * @returns {string[]} - Array of registered component names | |
| */ | |
| getRegisteredComponents() { | |
| return Object.keys(AveComponents).filter(name => this.isComponentRegistered(name)); | |
| }, | |
| /** | |
| * Get components by category | |
| * @param {string} category - The category name | |
| * @returns {string[]} - Array of component names in the category | |
| */ | |
| getComponentsByCategory(category) { | |
| return ComponentCategories[category] || []; | |
| }, | |
| /** | |
| * Wait for design system to be ready | |
| * @returns {Promise} - Promise that resolves when design system is loaded | |
| */ | |
| async waitForDesignSystem() { | |
| return await waitForDesignSystem(); | |
| } | |
| }; | |
| // Initialize the library | |
| async function initializeAveComponents() { | |
| try { | |
| console.log('🚀 Starting Ave Components initialization...'); | |
| // Wait for design system to load | |
| await waitForDesignSystem(); | |
| console.log('✅ Design system loaded'); | |
| // Check which components are registered | |
| const registeredComponents = AveUtils.getRegisteredComponents(); | |
| console.log(`🎨 Ave Components Library initialized successfully`); | |
| console.log(`📦 ${registeredComponents.length} components registered`); | |
| // Dispatch ready event | |
| window.dispatchEvent(new CustomEvent('ave-components-ready', { | |
| detail: { | |
| components: AveComponents, | |
| categories: ComponentCategories, | |
| utils: AveUtils | |
| } | |
| })); | |
| } catch (error) { | |
| console.error('❌ Failed to initialize Ave Components:', error); | |
| console.error('Error details:', error.stack); | |
| } | |
| } | |
| // Auto-initialize when DOM is ready | |
| if (document.readyState === 'loading') { | |
| document.addEventListener('DOMContentLoaded', initializeAveComponents); | |
| } else { | |
| initializeAveComponents(); | |
| } | |
| // Export for global access | |
| window.AveComponents = AveComponents; | |
| window.ComponentCategories = ComponentCategories; | |
| window.AveUtils = AveUtils; | |
| export default { | |
| AveComponents, | |
| ComponentCategories, | |
| AveUtils | |
| }; | |