/** * Ziya App Configuration Composable * Provides centralized configuration values for the entire application * * @example * ```ts * const { config, getDevServerUrl, isDevelopment } = useZiyaConfig() * console.log(config.app.name) // 'Ziya' * ``` */ interface ZiyaAppConfig { name: string; version: string; description: string; author: string; } interface ZiyaDevelopmentConfig { nuxtPort: number; nuxtHost: string; electronDevTools: boolean; } interface ZiyaWindowConfig { minHeight: number; minWidth: number; maxHeight: number; maxWidth: number; defaultHeight: number; defaultWidth: number; } interface ZiyaThemeConfig { defaultPalette: number; defaultDarkMode: boolean; availablePalettes: number[]; } interface ZiyaConfigValues { app: ZiyaAppConfig; development: ZiyaDevelopmentConfig; window: ZiyaWindowConfig; theme: ZiyaThemeConfig; } const ZIYA_CONFIG: ZiyaConfigValues = { app: { name: 'Ziya', version: '1.0.0', description: 'One stop shop trading solution', author: 'bismillahDAO', }, development: { nuxtPort: 3000, nuxtHost: 'localhost', electronDevTools: true, }, window: { minHeight: 800, minWidth: 1080, maxHeight: 1080, maxWidth: 1920, defaultHeight: 1024, defaultWidth: 1280, }, theme: { defaultPalette: 1, defaultDarkMode: false, availablePalettes: Array.from({ length: 24 }, (_, i) => i + 1), }, }; /** * Get development server URL based on configuration */ const getDevServerUrl = (): string => { const { nuxtHost, nuxtPort } = ZIYA_CONFIG.development; return `http://${nuxtHost}:${nuxtPort}`; }; /** * Environment detection utilities */ const isDevelopment = process.env.NODE_ENV === 'development'; const isProduction = process.env.NODE_ENV === 'production'; const isClient = import.meta.client; /** * Main composable function that provides Ziya app configuration * * @returns Object containing configuration values and helper functions */ export const useZiyaConfig = () => { return { config: ZIYA_CONFIG, // Helper functions getDevServerUrl, // Environment flags isDevelopment, isProduction, isClient, }; }; // Default export for convenience export default useZiyaConfig; // Export types for external use export type { ZiyaAppConfig, ZiyaConfigValues, ZiyaDevelopmentConfig, ZiyaThemeConfig, ZiyaWindowConfig };