File size: 2,983 Bytes
96af7c9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/**

 * Simple verification script for theme consistency

 * Validates: Requirements 1.4, 5.3, 14.3

 */

const fs = require('fs');
const path = require('path');

console.log('='.repeat(70));
console.log('Theme Consistency Verification');
console.log('Feature: admin-ui-modernization, Property 1');
console.log('='.repeat(70));
console.log('');

// Read CSS file
const cssPath = path.join(__dirname, '..', 'static', 'css', 'design-tokens.css');
const cssContent = fs.readFileSync(cssPath, 'utf-8');

// Required properties
const requiredProps = [
    'color-primary', 'color-accent', 'color-success', 'color-warning', 'color-error',
    'bg-primary', 'bg-secondary', 'text-primary', 'text-secondary',
    'glass-bg', 'glass-border', 'border-color',
    'gradient-primary', 'gradient-glass',
    'font-family-primary', 'font-size-base', 'font-weight-normal',
    'line-height-normal', 'letter-spacing-normal',
    'spacing-xs', 'spacing-sm', 'spacing-md', 'spacing-lg', 'spacing-xl',
    'shadow-sm', 'shadow-md', 'shadow-lg',
    'blur-sm', 'blur-md', 'blur-lg',
    'transition-fast', 'transition-base', 'ease-in-out'
];

// Check dark theme (:root)
console.log('Checking Dark Theme (:root)...');
let darkMissing = [];
for (const prop of requiredProps) {
    const regex = new RegExp(`--${prop}:\\s*[^;]+;`);
    if (!regex.test(cssContent)) {
        darkMissing.push(prop);
    }
}

if (darkMissing.length === 0) {
    console.log('βœ“ All required properties defined in dark theme');
} else {
    console.log(`βœ— Missing ${darkMissing.length} properties in dark theme:`);
    darkMissing.forEach(p => console.log(`  - ${p}`));
}
console.log('');

// Check light theme
console.log('Checking Light Theme ([data-theme="light"])...');
const lightRequiredProps = [
    'bg-primary', 'bg-secondary', 'text-primary', 'text-secondary',
    'glass-bg', 'glass-border', 'border-color'
];

let lightMissing = [];
const lightThemeMatch = cssContent.match(/\[data-theme="light"\]\s*{([^}]*)}/s);
if (lightThemeMatch) {
    const lightBlock = lightThemeMatch[1];
    for (const prop of lightRequiredProps) {
        const regex = new RegExp(`--${prop}:\\s*[^;]+;`);
        if (!regex.test(lightBlock)) {
            lightMissing.push(prop);
        }
    }
}

if (lightMissing.length === 0) {
    console.log('βœ“ All required overrides defined in light theme');
} else {
    console.log(`βœ— Missing ${lightMissing.length} overrides in light theme:`);
    lightMissing.forEach(p => console.log(`  - ${p}`));
}
console.log('');

// Summary
console.log('='.repeat(70));
if (darkMissing.length === 0 && lightMissing.length === 0) {
    console.log('βœ“ VERIFICATION PASSED');
    console.log('All required CSS custom properties are properly defined.');
    process.exit(0);
} else {
    console.log('βœ— VERIFICATION FAILED');
    console.log('Some required properties are missing.');
    process.exit(1);
}