// Pure helpers shared by the runtime theme installer (theme/index.ts) and // the build-time codegen (vite.config.ts). Single source of truth for the // element-plus override map and the global variable constants — neither // place hardcodes variable names. export const globalVariables: Record = { 'input-font-size': '0.875rem', 'input-font-weight': '500', 'select-option-height': '2rem', 'base-border-radius': '0.25rem' } export function overrideElementTheme (theme: Record): Record { return { ...theme, 'el-color-primary': theme['el-color-primary'] ?? theme.primary, 'el-color-success': theme['el-color-success'] ?? theme.success, 'el-color-warning': theme['el-color-warning'] ?? theme.warning, 'el-color-danger': theme['el-color-danger'] ?? theme.error, 'el-color-error': theme['el-color-error'] ?? theme.error, 'el-color-info': theme['el-color-info'] ?? theme['secondary'], 'el-fill-color': theme['el-fill-color'] ?? theme['field-bg'], 'el-text-color-primary': theme['el-text-color-primary'] ?? theme['default-text'], 'el-text-color-regular': theme['el-text-color-regular'] ?? theme['default-text'], 'el-text-color-placeholder': theme['el-text-color-placeholder'] ?? theme.placeholders, 'el-disabled-text-color': theme['el-disabled-text-color'] ?? theme['inactive-text'], 'el-text-color-disabled': theme['el-text-color-disabled'] ?? theme['inactive-text'], transparent: 'transparent', white: '#FFFFFF', black: '#000000', current: 'currentColor' } } export function mergeThemeWithDefaults (theme: Record): Record { return { ...overrideElementTheme(theme), ...globalVariables } }