UNPKG

@agentdao/core

Version:

Core functionality, skills, and ready-made UI components for AgentDAO - Web3 subscriptions, content generation, social media, help support, live chat, RSS fetching, web search, and agent pricing integration

154 lines (150 loc) 4.74 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.defaultTheme = exports.darkTheme = exports.lightTheme = void 0; exports.createTheme = createTheme; exports.getTheme = getTheme; exports.generateCSSVariables = generateCSSVariables; // Default light theme exports.lightTheme = { colors: { primary: '#3B82F6', secondary: '#6B7280', background: '#FFFFFF', surface: '#F9FAFB', text: '#111827', textSecondary: '#6B7280', border: '#E5E7EB', error: '#EF4444', success: '#10B981', warning: '#F59E0B', }, spacing: { xs: '0.25rem', sm: '0.5rem', md: '1rem', lg: '1.5rem', xl: '2rem', }, borderRadius: { sm: '0.25rem', md: '0.5rem', lg: '0.75rem', }, typography: { fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif', fontSize: { xs: '0.75rem', sm: '0.875rem', md: '1rem', lg: '1.125rem', xl: '1.25rem', }, }, }; // Default dark theme exports.darkTheme = { colors: { primary: '#60A5FA', secondary: '#9CA3AF', background: '#111827', surface: '#1F2937', text: '#F9FAFB', textSecondary: '#D1D5DB', border: '#374151', error: '#F87171', success: '#34D399', warning: '#FBBF24', }, spacing: { xs: '0.25rem', sm: '0.5rem', md: '1rem', lg: '1.5rem', xl: '2rem', }, borderRadius: { sm: '0.25rem', md: '0.5rem', lg: '0.75rem', }, typography: { fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif', fontSize: { xs: '0.75rem', sm: '0.875rem', md: '1rem', lg: '1.125rem', xl: '1.25rem', }, }, }; // Default theme (light) exports.defaultTheme = exports.lightTheme; // Create custom theme function createTheme(overrides) { return { ...exports.defaultTheme, ...overrides, colors: { ...exports.defaultTheme.colors, ...overrides.colors, }, spacing: { ...exports.defaultTheme.spacing, ...overrides.spacing, }, borderRadius: { ...exports.defaultTheme.borderRadius, ...overrides.borderRadius, }, typography: { ...exports.defaultTheme.typography, ...overrides.typography, fontSize: { ...exports.defaultTheme.typography.fontSize, ...overrides.typography?.fontSize, }, }, }; } // Get theme based on preference function getTheme(preference) { // Auto-detect theme based on system preference if (typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined') { const isDark = window.matchMedia('(prefers-color-scheme: dark)').matches; if (preference === 'auto') { return isDark ? exports.darkTheme : exports.lightTheme; } return preference === 'dark' ? exports.darkTheme : exports.lightTheme; } return exports.lightTheme; } // Generate CSS variables from theme function generateCSSVariables(theme) { return ` --agentdao-primary: ${theme.colors.primary}; --agentdao-secondary: ${theme.colors.secondary}; --agentdao-background: ${theme.colors.background}; --agentdao-surface: ${theme.colors.surface}; --agentdao-text: ${theme.colors.text}; --agentdao-text-secondary: ${theme.colors.textSecondary}; --agentdao-border: ${theme.colors.border}; --agentdao-error: ${theme.colors.error}; --agentdao-success: ${theme.colors.success}; --agentdao-warning: ${theme.colors.warning}; --agentdao-spacing-xs: ${theme.spacing.xs}; --agentdao-spacing-sm: ${theme.spacing.sm}; --agentdao-spacing-md: ${theme.spacing.md}; --agentdao-spacing-lg: ${theme.spacing.lg}; --agentdao-spacing-xl: ${theme.spacing.xl}; --agentdao-radius-sm: ${theme.borderRadius.sm}; --agentdao-radius-md: ${theme.borderRadius.md}; --agentdao-radius-lg: ${theme.borderRadius.lg}; --agentdao-font-family: ${theme.typography.fontFamily}; --agentdao-font-size-xs: ${theme.typography.fontSize.xs}; --agentdao-font-size-sm: ${theme.typography.fontSize.sm}; --agentdao-font-size-md: ${theme.typography.fontSize.md}; --agentdao-font-size-lg: ${theme.typography.fontSize.lg}; --agentdao-font-size-xl: ${theme.typography.fontSize.xl}; `; }