@rakeyshgidwani/roger-ui-bank-theme-stan-design 0.2.9 → 0.2.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +1 -1
- package/dist/components/ui/accessibility-demo.esm.js +30 -24
- package/dist/components/ui/accessibility-demo.js +30 -24
- package/dist/components/ui/advanced-component-architecture-demo.esm.js +235 -179
- package/dist/components/ui/advanced-component-architecture-demo.js +235 -179
- package/dist/components/ui/advanced-transition-system-demo.esm.js +110 -64
- package/dist/components/ui/advanced-transition-system-demo.js +110 -64
- package/dist/components/ui/advanced-transition-system.esm.js +166 -122
- package/dist/components/ui/advanced-transition-system.js +166 -122
- package/dist/components/ui/animation/animated-container.esm.js +52 -29
- package/dist/components/ui/animation/animated-container.js +52 -29
- package/dist/components/ui/animation/staggered-container.esm.js +18 -9
- package/dist/components/ui/animation/staggered-container.js +18 -9
- package/dist/components/ui/animation-demo.esm.js +67 -35
- package/dist/components/ui/animation-demo.js +67 -35
- package/dist/components/ui/badge.esm.js +9 -6
- package/dist/components/ui/badge.js +9 -6
- package/dist/components/ui/battery-conscious-animation-demo.esm.js +122 -87
- package/dist/components/ui/battery-conscious-animation-demo.js +122 -87
- package/dist/components/ui/border-radius-shadow-demo.esm.js +23 -12
- package/dist/components/ui/border-radius-shadow-demo.js +23 -12
- package/dist/components/ui/button.esm.js +8 -2
- package/dist/components/ui/button.js +8 -2
- package/dist/components/ui/card.esm.js +33 -8
- package/dist/components/ui/card.js +33 -8
- package/dist/components/ui/checkbox.esm.js +3 -3
- package/dist/components/ui/checkbox.js +3 -3
- package/dist/components/ui/color-preview.esm.js +68 -45
- package/dist/components/ui/color-preview.js +68 -45
- package/dist/components/ui/data-display/chart.esm.js +112 -84
- package/dist/components/ui/data-display/chart.js +112 -84
- package/dist/components/ui/data-display/data-grid-simple.esm.js +1 -1
- package/dist/components/ui/data-display/data-grid-simple.js +1 -1
- package/dist/components/ui/data-display/data-grid.esm.js +80 -67
- package/dist/components/ui/data-display/data-grid.js +80 -67
- package/dist/components/ui/data-display/list.esm.js +53 -45
- package/dist/components/ui/data-display/list.js +53 -45
- package/dist/components/ui/data-display/table.esm.js +62 -54
- package/dist/components/ui/data-display/table.js +62 -54
- package/dist/components/ui/data-display/timeline.esm.js +39 -34
- package/dist/components/ui/data-display/timeline.js +39 -34
- package/dist/components/ui/data-display/tree.esm.js +116 -84
- package/dist/components/ui/data-display/tree.js +116 -84
- package/dist/components/ui/data-display/types.esm.js +389 -364
- package/dist/components/ui/data-display/types.js +389 -364
- package/dist/components/ui/enterprise-mobile-experience-demo.esm.js +120 -70
- package/dist/components/ui/enterprise-mobile-experience-demo.js +120 -70
- package/dist/components/ui/enterprise-mobile-experience.esm.js +124 -73
- package/dist/components/ui/enterprise-mobile-experience.js +124 -73
- package/dist/components/ui/feedback/alert.esm.js +22 -15
- package/dist/components/ui/feedback/alert.js +22 -15
- package/dist/components/ui/feedback/progress.esm.js +47 -24
- package/dist/components/ui/feedback/progress.js +47 -24
- package/dist/components/ui/feedback/skeleton.esm.js +39 -29
- package/dist/components/ui/feedback/skeleton.js +39 -29
- package/dist/components/ui/feedback/toast.esm.js +62 -38
- package/dist/components/ui/feedback/toast.js +62 -38
- package/dist/components/ui/feedback/types.esm.js +83 -83
- package/dist/components/ui/feedback/types.js +83 -83
- package/dist/components/ui/font-preview.esm.js +41 -39
- package/dist/components/ui/font-preview.js +41 -39
- package/dist/components/ui/form-demo.esm.js +150 -113
- package/dist/components/ui/form-demo.js +150 -113
- package/dist/components/ui/hardware-acceleration-demo.esm.js +137 -87
- package/dist/components/ui/hardware-acceleration-demo.js +137 -87
- package/dist/components/ui/input.esm.js +4 -1
- package/dist/components/ui/input.js +4 -1
- package/dist/components/ui/layout-demo.esm.js +81 -56
- package/dist/components/ui/layout-demo.js +81 -56
- package/dist/components/ui/layouts/adaptive-layout.esm.js +27 -8
- package/dist/components/ui/layouts/adaptive-layout.js +27 -8
- package/dist/components/ui/layouts/desktop-layout.esm.js +39 -19
- package/dist/components/ui/layouts/desktop-layout.js +39 -19
- package/dist/components/ui/layouts/mobile-layout.esm.js +19 -9
- package/dist/components/ui/layouts/mobile-layout.js +19 -9
- package/dist/components/ui/layouts/tablet-layout.esm.js +28 -14
- package/dist/components/ui/layouts/tablet-layout.js +28 -14
- package/dist/components/ui/mobile-form-validation.esm.js +120 -87
- package/dist/components/ui/mobile-form-validation.js +120 -87
- package/dist/components/ui/mobile-input-demo.esm.js +19 -13
- package/dist/components/ui/mobile-input-demo.js +19 -13
- package/dist/components/ui/mobile-input.esm.js +185 -120
- package/dist/components/ui/mobile-input.js +185 -120
- package/dist/components/ui/mobile-skeleton-loading-demo.esm.js +128 -111
- package/dist/components/ui/mobile-skeleton-loading-demo.js +128 -111
- package/dist/components/ui/navigation/breadcrumb.esm.js +17 -14
- package/dist/components/ui/navigation/breadcrumb.js +17 -14
- package/dist/components/ui/navigation/index.esm.js +0 -1
- package/dist/components/ui/navigation/index.js +0 -1
- package/dist/components/ui/navigation/menu.esm.js +49 -35
- package/dist/components/ui/navigation/menu.js +49 -35
- package/dist/components/ui/navigation/navigation-demo.esm.js +81 -74
- package/dist/components/ui/navigation/navigation-demo.js +81 -74
- package/dist/components/ui/navigation/pagination.esm.js +62 -50
- package/dist/components/ui/navigation/pagination.js +62 -50
- package/dist/components/ui/navigation/sidebar.esm.js +56 -42
- package/dist/components/ui/navigation/sidebar.js +56 -42
- package/dist/components/ui/navigation/stepper.esm.js +34 -23
- package/dist/components/ui/navigation/stepper.js +34 -23
- package/dist/components/ui/navigation/tabs.esm.js +32 -21
- package/dist/components/ui/navigation/tabs.js +32 -21
- package/dist/components/ui/navigation/types.esm.js +196 -195
- package/dist/components/ui/navigation/types.js +196 -195
- package/dist/components/ui/overlay/backdrop.esm.js +17 -16
- package/dist/components/ui/overlay/backdrop.js +17 -16
- package/dist/components/ui/overlay/focus-manager.esm.js +21 -19
- package/dist/components/ui/overlay/focus-manager.js +21 -19
- package/dist/components/ui/overlay/index.esm.js +0 -2
- package/dist/components/ui/overlay/index.js +0 -2
- package/dist/components/ui/overlay/modal.esm.js +38 -34
- package/dist/components/ui/overlay/modal.js +38 -34
- package/dist/components/ui/overlay/overlay-manager.esm.js +25 -20
- package/dist/components/ui/overlay/overlay-manager.js +25 -20
- package/dist/components/ui/overlay/popover.esm.js +74 -58
- package/dist/components/ui/overlay/popover.js +74 -58
- package/dist/components/ui/overlay/portal.esm.js +7 -7
- package/dist/components/ui/overlay/portal.js +7 -7
- package/dist/components/ui/overlay/tooltip.esm.js +54 -39
- package/dist/components/ui/overlay/tooltip.js +54 -39
- package/dist/components/ui/overlay/types.esm.js +132 -131
- package/dist/components/ui/overlay/types.js +132 -131
- package/dist/components/ui/performance-demo.esm.js +135 -88
- package/dist/components/ui/performance-demo.js +135 -88
- package/dist/components/ui/semantic-input-system-demo.esm.js +117 -80
- package/dist/components/ui/semantic-input-system-demo.js +117 -80
- package/dist/components/ui/theme-customizer.esm.js +84 -52
- package/dist/components/ui/theme-customizer.js +84 -52
- package/dist/components/ui/theme-preview.esm.js +95 -43
- package/dist/components/ui/theme-preview.js +95 -43
- package/dist/components/ui/theme-switcher.esm.js +70 -44
- package/dist/components/ui/theme-switcher.js +70 -44
- package/dist/components/ui/theme-toggle.esm.js +3 -3
- package/dist/components/ui/theme-toggle.js +3 -3
- package/dist/components/ui/token-demo.esm.js +33 -21
- package/dist/components/ui/token-demo.js +33 -21
- package/dist/components/ui/touch-demo.esm.js +102 -73
- package/dist/components/ui/touch-demo.js +102 -73
- package/dist/components/ui/touch-friendly-interface-demo.esm.js +102 -64
- package/dist/components/ui/touch-friendly-interface-demo.js +102 -64
- package/dist/components/ui/touch-friendly-interface.esm.js +85 -61
- package/dist/components/ui/touch-friendly-interface.js +85 -61
- package/dist/hooks/use-accessibility-support.esm.js +115 -85
- package/dist/hooks/use-accessibility-support.js +115 -85
- package/dist/hooks/use-adaptive-layout.esm.js +56 -33
- package/dist/hooks/use-adaptive-layout.js +56 -33
- package/dist/hooks/use-advanced-patterns.esm.js +57 -42
- package/dist/hooks/use-advanced-patterns.js +57 -42
- package/dist/hooks/use-advanced-transition-system.esm.js +112 -71
- package/dist/hooks/use-advanced-transition-system.js +112 -71
- package/dist/hooks/use-animation-profile.esm.js +63 -34
- package/dist/hooks/use-animation-profile.js +63 -34
- package/dist/hooks/use-battery-animations.esm.js +80 -55
- package/dist/hooks/use-battery-animations.js +80 -55
- package/dist/hooks/use-battery-conscious-loading.esm.js +166 -123
- package/dist/hooks/use-battery-conscious-loading.js +166 -123
- package/dist/hooks/use-battery-optimization.esm.js +78 -55
- package/dist/hooks/use-battery-optimization.js +78 -55
- package/dist/hooks/use-battery-status.esm.js +73 -51
- package/dist/hooks/use-battery-status.js +73 -51
- package/dist/hooks/use-component-performance.esm.js +62 -47
- package/dist/hooks/use-component-performance.js +62 -47
- package/dist/hooks/use-device-loading-states.esm.js +152 -109
- package/dist/hooks/use-device-loading-states.js +152 -109
- package/dist/hooks/use-device.esm.js +25 -14
- package/dist/hooks/use-device.js +25 -14
- package/dist/hooks/use-enterprise-mobile-experience.esm.js +137 -88
- package/dist/hooks/use-enterprise-mobile-experience.js +137 -88
- package/dist/hooks/use-form-feedback.esm.js +124 -81
- package/dist/hooks/use-form-feedback.js +124 -81
- package/dist/hooks/use-form-performance.esm.js +127 -92
- package/dist/hooks/use-form-performance.js +127 -92
- package/dist/hooks/use-frame-rate.esm.js +56 -37
- package/dist/hooks/use-frame-rate.js +56 -37
- package/dist/hooks/use-gestures.esm.js +96 -72
- package/dist/hooks/use-gestures.js +96 -72
- package/dist/hooks/use-hardware-acceleration.esm.js +65 -37
- package/dist/hooks/use-hardware-acceleration.js +65 -37
- package/dist/hooks/use-input-accessibility.esm.js +157 -119
- package/dist/hooks/use-input-accessibility.js +157 -119
- package/dist/hooks/use-input-performance.esm.js +139 -104
- package/dist/hooks/use-input-performance.js +139 -104
- package/dist/hooks/use-layout-performance.esm.js +50 -29
- package/dist/hooks/use-layout-performance.js +50 -29
- package/dist/hooks/use-loading-accessibility.esm.js +209 -169
- package/dist/hooks/use-loading-accessibility.js +209 -169
- package/dist/hooks/use-loading-performance.esm.js +117 -93
- package/dist/hooks/use-loading-performance.js +117 -93
- package/dist/hooks/use-memory-usage.esm.js +57 -38
- package/dist/hooks/use-memory-usage.js +57 -38
- package/dist/hooks/use-mobile-form-layout.esm.js +111 -74
- package/dist/hooks/use-mobile-form-layout.js +111 -74
- package/dist/hooks/use-mobile-form-validation.esm.js +211 -144
- package/dist/hooks/use-mobile-form-validation.js +211 -144
- package/dist/hooks/use-mobile-keyboard-optimization.esm.js +154 -113
- package/dist/hooks/use-mobile-keyboard-optimization.js +154 -113
- package/dist/hooks/use-mobile-layout.esm.js +73 -51
- package/dist/hooks/use-mobile-layout.js +73 -51
- package/dist/hooks/use-mobile-optimization.esm.js +72 -44
- package/dist/hooks/use-mobile-optimization.js +72 -44
- package/dist/hooks/use-mobile-skeleton.esm.js +97 -64
- package/dist/hooks/use-mobile-skeleton.js +97 -64
- package/dist/hooks/use-mobile-touch.esm.js +128 -93
- package/dist/hooks/use-mobile-touch.js +128 -93
- package/dist/hooks/use-performance-throttling.esm.js +72 -48
- package/dist/hooks/use-performance-throttling.js +72 -48
- package/dist/hooks/use-performance.esm.js +90 -52
- package/dist/hooks/use-performance.js +90 -52
- package/dist/hooks/use-reusable-architecture.esm.js +94 -65
- package/dist/hooks/use-reusable-architecture.js +94 -65
- package/dist/hooks/use-semantic-input-types.esm.js +166 -124
- package/dist/hooks/use-semantic-input-types.js +166 -124
- package/dist/hooks/use-semantic-input.esm.js +178 -126
- package/dist/hooks/use-semantic-input.js +178 -126
- package/dist/hooks/use-tablet-layout.esm.js +67 -38
- package/dist/hooks/use-tablet-layout.js +67 -38
- package/dist/hooks/use-touch-friendly-input.esm.js +193 -149
- package/dist/hooks/use-touch-friendly-input.js +193 -149
- package/dist/hooks/use-touch-friendly-interface.esm.js +99 -67
- package/dist/hooks/use-touch-friendly-interface.js +99 -67
- package/dist/hooks/use-touch-optimization.esm.js +99 -72
- package/dist/hooks/use-touch-optimization.js +99 -72
- package/dist/index.esm.js +157 -281
- package/dist/index.js +157 -281
- package/dist/lib/utils.esm.js +1 -1
- package/dist/lib/utils.js +1 -1
- package/dist/plugins/theme-css-generator.esm.js +104 -55
- package/dist/plugins/theme-css-generator.js +104 -55
- package/dist/provider.esm.js +4 -4
- package/dist/provider.js +4 -4
- package/dist/styles.css +1 -1
- package/dist/theme.esm.js +633 -468
- package/dist/theme.js +633 -468
- package/dist/themes/ThemeContext.esm.js +15 -15
- package/dist/themes/ThemeContext.js +15 -15
- package/dist/themes/ThemeProvider.esm.js +25 -22
- package/dist/themes/ThemeProvider.js +25 -22
- package/dist/themes/accessibility.esm.js +147 -108
- package/dist/themes/accessibility.js +147 -108
- package/dist/themes/aria-patterns.esm.js +198 -162
- package/dist/themes/aria-patterns.js +198 -162
- package/dist/themes/base-themes.esm.js +14 -11
- package/dist/themes/base-themes.js +14 -11
- package/dist/themes/colorManager.esm.js +101 -83
- package/dist/themes/colorManager.js +101 -83
- package/dist/themes/examples/dark-theme.esm.js +133 -103
- package/dist/themes/examples/dark-theme.js +133 -103
- package/dist/themes/examples/minimal-theme.esm.js +83 -61
- package/dist/themes/examples/minimal-theme.js +83 -61
- package/dist/themes/focus-management.esm.js +202 -143
- package/dist/themes/focus-management.js +202 -143
- package/dist/themes/fontLoader.esm.js +28 -19
- package/dist/themes/fontLoader.js +28 -19
- package/dist/themes/high-contrast.esm.js +152 -104
- package/dist/themes/high-contrast.js +152 -104
- package/dist/themes/index.esm.js +1 -1
- package/dist/themes/index.js +1 -1
- package/dist/themes/inheritance.esm.js +35 -27
- package/dist/themes/inheritance.js +35 -27
- package/dist/themes/keyboard-navigation.esm.js +152 -123
- package/dist/themes/keyboard-navigation.js +152 -123
- package/dist/themes/motion-reduction.esm.js +193 -133
- package/dist/themes/motion-reduction.js +193 -133
- package/dist/themes/navigation.esm.js +146 -146
- package/dist/themes/navigation.js +146 -146
- package/dist/themes/screen-reader.esm.js +159 -94
- package/dist/themes/screen-reader.js +159 -94
- package/dist/themes/systemThemeDetector.esm.js +42 -34
- package/dist/themes/systemThemeDetector.js +42 -34
- package/dist/themes/themeCSSUpdater.esm.js +21 -9
- package/dist/themes/themeCSSUpdater.js +21 -9
- package/dist/themes/themePersistence.esm.js +68 -47
- package/dist/themes/themePersistence.js +68 -47
- package/dist/themes/themes/stan-design.esm.js +633 -468
- package/dist/themes/themes/stan-design.js +633 -468
- package/dist/themes/types.esm.js +301 -287
- package/dist/themes/types.js +301 -287
- package/dist/themes/useSystemTheme.esm.js +4 -4
- package/dist/themes/useSystemTheme.js +4 -4
- package/dist/themes/useTheme.esm.js +4 -4
- package/dist/themes/useTheme.js +4 -4
- package/dist/themes/validation.esm.js +128 -77
- package/dist/themes/validation.js +128 -77
- package/dist/tokens/index.esm.js +1 -2
- package/dist/tokens/index.js +1 -2
- package/dist/tokens/tokenExporter.esm.js +87 -61
- package/dist/tokens/tokenExporter.js +87 -61
- package/dist/tokens/tokenGenerator.esm.js +86 -77
- package/dist/tokens/tokenGenerator.js +86 -77
- package/dist/tokens/tokenManager.esm.js +64 -51
- package/dist/tokens/tokenManager.js +64 -51
- package/dist/tokens/tokenValidator.esm.js +193 -147
- package/dist/tokens/tokenValidator.js +193 -147
- package/dist/tokens/types.esm.js +49 -35
- package/dist/tokens/types.js +49 -35
- package/dist/utils/bundle-analyzer.esm.js +83 -65
- package/dist/utils/bundle-analyzer.js +83 -65
- package/dist/utils/bundle-splitting.esm.js +142 -117
- package/dist/utils/bundle-splitting.js +142 -117
- package/dist/utils/lazy-loading.esm.js +132 -106
- package/dist/utils/lazy-loading.js +132 -106
- package/dist/utils/performance-monitor.esm.js +170 -129
- package/dist/utils/performance-monitor.js +170 -129
- package/dist/utils/tree-shaking.esm.js +69 -61
- package/dist/utils/tree-shaking.js +69 -61
- package/package.json +1 -1
- package/src/index.ts +146 -146
|
@@ -1,50 +1,54 @@
|
|
|
1
|
-
|
|
1
|
+
import type { ThemeTokens, DesignToken, TokenType } from './types';
|
|
2
2
|
|
|
3
3
|
export interface ValidationResult {
|
|
4
|
-
isValid;
|
|
5
|
-
errors];
|
|
6
|
-
warnings];
|
|
4
|
+
isValid: boolean;
|
|
5
|
+
errors: ValidationError[];
|
|
6
|
+
warnings: ValidationWarning[];
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export interface ValidationError {
|
|
10
|
-
path;
|
|
11
|
-
message;
|
|
12
|
-
severity;
|
|
10
|
+
path: string;
|
|
11
|
+
message: string;
|
|
12
|
+
severity: 'error' | 'critical';
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
export interface ValidationWarning {
|
|
16
|
-
path;
|
|
17
|
-
message;
|
|
18
|
-
suggestion
|
|
16
|
+
path: string;
|
|
17
|
+
message: string;
|
|
18
|
+
suggestion?: string;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
export class TokenValidator {
|
|
22
22
|
/**
|
|
23
23
|
* Validates a complete theme tokens object
|
|
24
24
|
*/
|
|
25
|
-
static validateTokens(tokens)
|
|
26
|
-
const
|
|
25
|
+
static validateTokens(tokens: ThemeTokens): ValidationResult {
|
|
26
|
+
const errors: ValidationError[] = [];
|
|
27
|
+
const warnings: ValidationWarning[] = [];
|
|
27
28
|
|
|
28
29
|
// Validate basic structure
|
|
29
30
|
if (!tokens.theme) {
|
|
30
31
|
errors.push({
|
|
31
|
-
path,
|
|
32
|
-
message,
|
|
33
|
-
severity
|
|
32
|
+
path: 'theme',
|
|
33
|
+
message: 'Theme name is required',
|
|
34
|
+
severity: 'critical'
|
|
35
|
+
});
|
|
34
36
|
}
|
|
35
37
|
|
|
36
38
|
if (!tokens.version) {
|
|
37
39
|
errors.push({
|
|
38
|
-
path,
|
|
39
|
-
message,
|
|
40
|
-
severity
|
|
40
|
+
path: 'version',
|
|
41
|
+
message: 'Theme version is required',
|
|
42
|
+
severity: 'critical'
|
|
43
|
+
});
|
|
41
44
|
}
|
|
42
45
|
|
|
43
46
|
if (!tokens.tokens) {
|
|
44
47
|
errors.push({
|
|
45
|
-
path,
|
|
46
|
-
message,
|
|
47
|
-
severity
|
|
48
|
+
path: 'tokens',
|
|
49
|
+
message: 'Tokens object is required',
|
|
50
|
+
severity: 'critical'
|
|
51
|
+
});
|
|
48
52
|
}
|
|
49
53
|
|
|
50
54
|
// Validate token categories
|
|
@@ -58,7 +62,7 @@ export class TokenValidator {
|
|
|
58
62
|
}
|
|
59
63
|
|
|
60
64
|
return {
|
|
61
|
-
isValid=== 0,
|
|
65
|
+
isValid: errors.length === 0,
|
|
62
66
|
errors,
|
|
63
67
|
warnings
|
|
64
68
|
};
|
|
@@ -68,18 +72,19 @@ export class TokenValidator {
|
|
|
68
72
|
* Validates a specific token category
|
|
69
73
|
*/
|
|
70
74
|
private static validateTokenCategory(
|
|
71
|
-
category,
|
|
72
|
-
categoryName,
|
|
73
|
-
errors],
|
|
74
|
-
warnings]
|
|
75
|
+
category: any,
|
|
76
|
+
categoryName: string,
|
|
77
|
+
errors: ValidationError[],
|
|
78
|
+
warnings: ValidationWarning[]
|
|
75
79
|
) {
|
|
76
80
|
if (!category) return;
|
|
77
81
|
|
|
78
82
|
if (typeof category !== 'object') {
|
|
79
83
|
errors.push({
|
|
80
|
-
path}`,
|
|
81
|
-
message} category must be an object`,
|
|
82
|
-
severity
|
|
84
|
+
path: `tokens.${categoryName}`,
|
|
85
|
+
message: `${categoryName} category must be an object`,
|
|
86
|
+
severity: 'error'
|
|
87
|
+
});
|
|
83
88
|
return;
|
|
84
89
|
}
|
|
85
90
|
|
|
@@ -90,10 +95,10 @@ export class TokenValidator {
|
|
|
90
95
|
* Validates a token group recursively
|
|
91
96
|
*/
|
|
92
97
|
private static validateTokenGroup(
|
|
93
|
-
group,
|
|
94
|
-
path,
|
|
95
|
-
errors],
|
|
96
|
-
warnings]
|
|
98
|
+
group: any,
|
|
99
|
+
path: string,
|
|
100
|
+
errors: ValidationError[],
|
|
101
|
+
warnings: ValidationWarning[]
|
|
97
102
|
) {
|
|
98
103
|
Object.entries(group).forEach(([key, value]) => {
|
|
99
104
|
const currentPath = `${path}.${key}`;
|
|
@@ -105,9 +110,10 @@ export class TokenValidator {
|
|
|
105
110
|
this.validateTokenGroup(value, currentPath, errors, warnings);
|
|
106
111
|
} else {
|
|
107
112
|
errors.push({
|
|
108
|
-
path,
|
|
109
|
-
message}`,
|
|
110
|
-
severity
|
|
113
|
+
path: currentPath,
|
|
114
|
+
message: `Invalid token structure at ${currentPath}`,
|
|
115
|
+
severity: 'error'
|
|
116
|
+
});
|
|
111
117
|
}
|
|
112
118
|
});
|
|
113
119
|
}
|
|
@@ -116,29 +122,32 @@ export class TokenValidator {
|
|
|
116
122
|
* Validates an individual token
|
|
117
123
|
*/
|
|
118
124
|
private static validateToken(
|
|
119
|
-
token,
|
|
120
|
-
path,
|
|
121
|
-
errors],
|
|
122
|
-
warnings]
|
|
125
|
+
token: DesignToken,
|
|
126
|
+
path: string,
|
|
127
|
+
errors: ValidationError[],
|
|
128
|
+
warnings: ValidationWarning[]
|
|
123
129
|
) {
|
|
124
130
|
// Check required properties
|
|
125
131
|
if (token.value === undefined || token.value === null) {
|
|
126
132
|
errors.push({
|
|
127
133
|
path,
|
|
128
|
-
message,
|
|
129
|
-
severity
|
|
134
|
+
message: 'Token value is required',
|
|
135
|
+
severity: 'error'
|
|
136
|
+
});
|
|
130
137
|
}
|
|
131
138
|
|
|
132
139
|
if (!token.type) {
|
|
133
140
|
errors.push({
|
|
134
141
|
path,
|
|
135
|
-
message,
|
|
136
|
-
severity
|
|
142
|
+
message: 'Token type is required',
|
|
143
|
+
severity: 'error'
|
|
144
|
+
});
|
|
137
145
|
} else if (!this.isValidTokenType(token.type)) {
|
|
138
146
|
errors.push({
|
|
139
147
|
path,
|
|
140
|
-
message}`,
|
|
141
|
-
severity
|
|
148
|
+
message: `Invalid token type: ${token.type}`,
|
|
149
|
+
severity: 'error'
|
|
150
|
+
});
|
|
142
151
|
}
|
|
143
152
|
|
|
144
153
|
// Validate token type-specific values
|
|
@@ -148,16 +157,18 @@ export class TokenValidator {
|
|
|
148
157
|
if (!token.description) {
|
|
149
158
|
warnings.push({
|
|
150
159
|
path,
|
|
151
|
-
message,
|
|
152
|
-
suggestion
|
|
160
|
+
message: 'Token description is missing',
|
|
161
|
+
suggestion: 'Add a description to improve token documentation'
|
|
162
|
+
});
|
|
153
163
|
}
|
|
154
164
|
|
|
155
165
|
// Check for missing tags (warning)
|
|
156
166
|
if (!token.tags || token.tags.length === 0) {
|
|
157
167
|
warnings.push({
|
|
158
168
|
path,
|
|
159
|
-
message,
|
|
160
|
-
suggestion
|
|
169
|
+
message: 'Token tags are missing',
|
|
170
|
+
suggestion: 'Add tags to improve token categorization and searchability'
|
|
171
|
+
});
|
|
161
172
|
}
|
|
162
173
|
}
|
|
163
174
|
|
|
@@ -165,29 +176,38 @@ export class TokenValidator {
|
|
|
165
176
|
* Validates token value based on type
|
|
166
177
|
*/
|
|
167
178
|
private static validateTokenValue(
|
|
168
|
-
token,
|
|
169
|
-
path,
|
|
170
|
-
errors],
|
|
171
|
-
warnings]
|
|
179
|
+
token: DesignToken,
|
|
180
|
+
path: string,
|
|
181
|
+
errors: ValidationError[],
|
|
182
|
+
warnings: ValidationWarning[]
|
|
172
183
|
) {
|
|
173
184
|
switch (token.type) {
|
|
174
|
-
case 'color'
|
|
185
|
+
case 'color':
|
|
186
|
+
this.validateColorToken(token, path, errors, warnings);
|
|
175
187
|
break;
|
|
176
|
-
case 'fontFamily'
|
|
188
|
+
case 'fontFamily':
|
|
189
|
+
this.validateFontFamilyToken(token, path, errors, warnings);
|
|
177
190
|
break;
|
|
178
|
-
case 'fontSize'
|
|
191
|
+
case 'fontSize':
|
|
192
|
+
this.validateFontSizeToken(token, path, errors, warnings);
|
|
179
193
|
break;
|
|
180
|
-
case 'fontWeight'
|
|
194
|
+
case 'fontWeight':
|
|
195
|
+
this.validateFontWeightToken(token, path, errors, warnings);
|
|
181
196
|
break;
|
|
182
|
-
case 'lineHeight'
|
|
197
|
+
case 'lineHeight':
|
|
198
|
+
this.validateLineHeightToken(token, path, errors, warnings);
|
|
183
199
|
break;
|
|
184
|
-
case 'spacing'
|
|
200
|
+
case 'spacing':
|
|
201
|
+
this.validateSpacingToken(token, path, errors, warnings);
|
|
185
202
|
break;
|
|
186
|
-
case 'shadow'
|
|
203
|
+
case 'shadow':
|
|
204
|
+
this.validateShadowToken(token, path, errors, warnings);
|
|
187
205
|
break;
|
|
188
|
-
case 'transition'
|
|
206
|
+
case 'transition':
|
|
207
|
+
this.validateTransitionToken(token, path, errors, warnings);
|
|
189
208
|
break;
|
|
190
|
-
case 'breakpoint'
|
|
209
|
+
case 'breakpoint':
|
|
210
|
+
this.validateBreakpointToken(token, path, errors, warnings);
|
|
191
211
|
break;
|
|
192
212
|
}
|
|
193
213
|
}
|
|
@@ -196,18 +216,19 @@ export class TokenValidator {
|
|
|
196
216
|
* Validates color tokens
|
|
197
217
|
*/
|
|
198
218
|
private static validateColorToken(
|
|
199
|
-
token,
|
|
200
|
-
path,
|
|
201
|
-
errors],
|
|
202
|
-
warnings]
|
|
219
|
+
token: DesignToken,
|
|
220
|
+
path: string,
|
|
221
|
+
errors: ValidationError[],
|
|
222
|
+
warnings: ValidationWarning[]
|
|
203
223
|
) {
|
|
204
224
|
const value = token.value as string;
|
|
205
225
|
|
|
206
226
|
if (typeof value !== 'string') {
|
|
207
227
|
errors.push({
|
|
208
228
|
path,
|
|
209
|
-
message,
|
|
210
|
-
severity
|
|
229
|
+
message: 'Color token value must be a string',
|
|
230
|
+
severity: 'error'
|
|
231
|
+
});
|
|
211
232
|
return;
|
|
212
233
|
}
|
|
213
234
|
|
|
@@ -215,16 +236,17 @@ export class TokenValidator {
|
|
|
215
236
|
if (!this.isValidColor(value)) {
|
|
216
237
|
errors.push({
|
|
217
238
|
path,
|
|
218
|
-
message}`,
|
|
219
|
-
severity
|
|
239
|
+
message: `Invalid color format: ${value}`,
|
|
240
|
+
severity: 'error'
|
|
241
|
+
});
|
|
220
242
|
}
|
|
221
243
|
|
|
222
244
|
// Check for semantic color consistency
|
|
223
245
|
if (token.category === 'color' && !(token as any).semantic) {
|
|
224
246
|
warnings.push({
|
|
225
247
|
path,
|
|
226
|
-
message,
|
|
227
|
-
suggestion, secondary, accent, success, warning, error, neutral)'
|
|
248
|
+
message: 'Semantic color missing semantic property',
|
|
249
|
+
suggestion: 'Add semantic property (primary, secondary, accent, success, warning, error, neutral)'
|
|
228
250
|
});
|
|
229
251
|
}
|
|
230
252
|
}
|
|
@@ -233,25 +255,27 @@ export class TokenValidator {
|
|
|
233
255
|
* Validates font family tokens
|
|
234
256
|
*/
|
|
235
257
|
private static validateFontFamilyToken(
|
|
236
|
-
token,
|
|
237
|
-
path,
|
|
238
|
-
errors],
|
|
239
|
-
_warnings]
|
|
258
|
+
token: DesignToken,
|
|
259
|
+
path: string,
|
|
260
|
+
errors: ValidationError[],
|
|
261
|
+
_warnings: ValidationWarning[]
|
|
240
262
|
) {
|
|
241
263
|
const value = token.value as string;
|
|
242
264
|
|
|
243
265
|
if (typeof value !== 'string') {
|
|
244
266
|
errors.push({
|
|
245
267
|
path,
|
|
246
|
-
message,
|
|
247
|
-
severity
|
|
268
|
+
message: 'Font family token value must be a string',
|
|
269
|
+
severity: 'error'
|
|
270
|
+
});
|
|
248
271
|
}
|
|
249
272
|
|
|
250
273
|
if (value.trim().length === 0) {
|
|
251
274
|
errors.push({
|
|
252
275
|
path,
|
|
253
|
-
message,
|
|
254
|
-
severity
|
|
276
|
+
message: 'Font family token value cannot be empty',
|
|
277
|
+
severity: 'error'
|
|
278
|
+
});
|
|
255
279
|
}
|
|
256
280
|
}
|
|
257
281
|
|
|
@@ -259,10 +283,10 @@ export class TokenValidator {
|
|
|
259
283
|
* Validates font size tokens
|
|
260
284
|
*/
|
|
261
285
|
private static validateFontSizeToken(
|
|
262
|
-
token,
|
|
263
|
-
path,
|
|
264
|
-
errors],
|
|
265
|
-
_warnings]
|
|
286
|
+
token: DesignToken,
|
|
287
|
+
path: string,
|
|
288
|
+
errors: ValidationError[],
|
|
289
|
+
_warnings: ValidationWarning[]
|
|
266
290
|
) {
|
|
267
291
|
const value = token.value as string | number;
|
|
268
292
|
|
|
@@ -270,21 +294,24 @@ export class TokenValidator {
|
|
|
270
294
|
if (value <= 0) {
|
|
271
295
|
errors.push({
|
|
272
296
|
path,
|
|
273
|
-
message,
|
|
274
|
-
severity
|
|
297
|
+
message: 'Font size token value must be positive',
|
|
298
|
+
severity: 'error'
|
|
299
|
+
});
|
|
275
300
|
}
|
|
276
301
|
} else if (typeof value === 'string') {
|
|
277
302
|
if (!this.isValidCSSUnit(value)) {
|
|
278
303
|
errors.push({
|
|
279
304
|
path,
|
|
280
|
-
message}`,
|
|
281
|
-
severity
|
|
305
|
+
message: `Invalid font size unit: ${value}`,
|
|
306
|
+
severity: 'error'
|
|
307
|
+
});
|
|
282
308
|
}
|
|
283
309
|
} else {
|
|
284
310
|
errors.push({
|
|
285
311
|
path,
|
|
286
|
-
message,
|
|
287
|
-
severity
|
|
312
|
+
message: 'Font size token value must be a number or valid CSS unit string',
|
|
313
|
+
severity: 'error'
|
|
314
|
+
});
|
|
288
315
|
}
|
|
289
316
|
}
|
|
290
317
|
|
|
@@ -292,10 +319,10 @@ export class TokenValidator {
|
|
|
292
319
|
* Validates font weight tokens
|
|
293
320
|
*/
|
|
294
321
|
private static validateFontWeightToken(
|
|
295
|
-
token,
|
|
296
|
-
path,
|
|
297
|
-
errors],
|
|
298
|
-
_warnings]
|
|
322
|
+
token: DesignToken,
|
|
323
|
+
path: string,
|
|
324
|
+
errors: ValidationError[],
|
|
325
|
+
_warnings: ValidationWarning[]
|
|
299
326
|
) {
|
|
300
327
|
const value = token.value as string | number;
|
|
301
328
|
|
|
@@ -303,22 +330,25 @@ export class TokenValidator {
|
|
|
303
330
|
if (value < 100 || value > 900 || value % 100 !== 0) {
|
|
304
331
|
errors.push({
|
|
305
332
|
path,
|
|
306
|
-
message,
|
|
307
|
-
severity
|
|
333
|
+
message: 'Font weight token value must be a multiple of 100 between 100 and 900',
|
|
334
|
+
severity: 'error'
|
|
335
|
+
});
|
|
308
336
|
}
|
|
309
337
|
} else if (typeof value === 'string') {
|
|
310
338
|
const validWeights = ['normal', 'bold', 'lighter', 'bolder'];
|
|
311
339
|
if (!validWeights.includes(value)) {
|
|
312
340
|
errors.push({
|
|
313
341
|
path,
|
|
314
|
-
message}`,
|
|
315
|
-
severity
|
|
342
|
+
message: `Invalid font weight value: ${value}`,
|
|
343
|
+
severity: 'error'
|
|
344
|
+
});
|
|
316
345
|
}
|
|
317
346
|
} else {
|
|
318
347
|
errors.push({
|
|
319
348
|
path,
|
|
320
|
-
message,
|
|
321
|
-
severity
|
|
349
|
+
message: 'Font weight token value must be a number or valid string',
|
|
350
|
+
severity: 'error'
|
|
351
|
+
});
|
|
322
352
|
}
|
|
323
353
|
}
|
|
324
354
|
|
|
@@ -326,10 +356,10 @@ export class TokenValidator {
|
|
|
326
356
|
* Validates line height tokens
|
|
327
357
|
*/
|
|
328
358
|
private static validateLineHeightToken(
|
|
329
|
-
token,
|
|
330
|
-
path,
|
|
331
|
-
errors],
|
|
332
|
-
_warnings]
|
|
359
|
+
token: DesignToken,
|
|
360
|
+
path: string,
|
|
361
|
+
errors: ValidationError[],
|
|
362
|
+
_warnings: ValidationWarning[]
|
|
333
363
|
) {
|
|
334
364
|
const value = token.value as string | number;
|
|
335
365
|
|
|
@@ -337,21 +367,24 @@ export class TokenValidator {
|
|
|
337
367
|
if (value <= 0) {
|
|
338
368
|
errors.push({
|
|
339
369
|
path,
|
|
340
|
-
message,
|
|
341
|
-
severity
|
|
370
|
+
message: 'Line height token value must be positive',
|
|
371
|
+
severity: 'error'
|
|
372
|
+
});
|
|
342
373
|
}
|
|
343
374
|
} else if (typeof value === 'string') {
|
|
344
375
|
if (!this.isValidCSSUnit(value) && value !== 'normal') {
|
|
345
376
|
errors.push({
|
|
346
377
|
path,
|
|
347
|
-
message}`,
|
|
348
|
-
severity
|
|
378
|
+
message: `Invalid line height value: ${value}`,
|
|
379
|
+
severity: 'error'
|
|
380
|
+
});
|
|
349
381
|
}
|
|
350
382
|
} else {
|
|
351
383
|
errors.push({
|
|
352
384
|
path,
|
|
353
|
-
message,
|
|
354
|
-
severity
|
|
385
|
+
message: 'Line height token value must be a number or valid CSS unit string',
|
|
386
|
+
severity: 'error'
|
|
387
|
+
});
|
|
355
388
|
}
|
|
356
389
|
}
|
|
357
390
|
|
|
@@ -359,26 +392,28 @@ export class TokenValidator {
|
|
|
359
392
|
* Validates spacing tokens
|
|
360
393
|
*/
|
|
361
394
|
private static validateSpacingToken(
|
|
362
|
-
token,
|
|
363
|
-
path,
|
|
364
|
-
errors],
|
|
365
|
-
_warnings]
|
|
395
|
+
token: DesignToken,
|
|
396
|
+
path: string,
|
|
397
|
+
errors: ValidationError[],
|
|
398
|
+
_warnings: ValidationWarning[]
|
|
366
399
|
) {
|
|
367
400
|
const value = token.value as number;
|
|
368
401
|
|
|
369
402
|
if (typeof value !== 'number') {
|
|
370
403
|
errors.push({
|
|
371
404
|
path,
|
|
372
|
-
message,
|
|
373
|
-
severity
|
|
405
|
+
message: 'Spacing token value must be a number',
|
|
406
|
+
severity: 'error'
|
|
407
|
+
});
|
|
374
408
|
return;
|
|
375
409
|
}
|
|
376
410
|
|
|
377
411
|
if (value < 0) {
|
|
378
412
|
errors.push({
|
|
379
413
|
path,
|
|
380
|
-
message,
|
|
381
|
-
severity
|
|
414
|
+
message: 'Spacing token value cannot be negative',
|
|
415
|
+
severity: 'error'
|
|
416
|
+
});
|
|
382
417
|
}
|
|
383
418
|
}
|
|
384
419
|
|
|
@@ -386,25 +421,27 @@ export class TokenValidator {
|
|
|
386
421
|
* Validates shadow tokens
|
|
387
422
|
*/
|
|
388
423
|
private static validateShadowToken(
|
|
389
|
-
token,
|
|
390
|
-
path,
|
|
391
|
-
errors],
|
|
392
|
-
_warnings]
|
|
424
|
+
token: DesignToken,
|
|
425
|
+
path: string,
|
|
426
|
+
errors: ValidationError[],
|
|
427
|
+
_warnings: ValidationWarning[]
|
|
393
428
|
) {
|
|
394
429
|
const value = token.value as string;
|
|
395
430
|
|
|
396
431
|
if (typeof value !== 'string') {
|
|
397
432
|
errors.push({
|
|
398
433
|
path,
|
|
399
|
-
message,
|
|
400
|
-
severity
|
|
434
|
+
message: 'Shadow token value must be a string',
|
|
435
|
+
severity: 'error'
|
|
436
|
+
});
|
|
401
437
|
}
|
|
402
438
|
|
|
403
439
|
if (value.trim().length === 0) {
|
|
404
440
|
errors.push({
|
|
405
441
|
path,
|
|
406
|
-
message,
|
|
407
|
-
severity
|
|
442
|
+
message: 'Shadow token value cannot be empty',
|
|
443
|
+
severity: 'error'
|
|
444
|
+
});
|
|
408
445
|
}
|
|
409
446
|
}
|
|
410
447
|
|
|
@@ -412,25 +449,27 @@ export class TokenValidator {
|
|
|
412
449
|
* Validates transition tokens
|
|
413
450
|
*/
|
|
414
451
|
private static validateTransitionToken(
|
|
415
|
-
token,
|
|
416
|
-
path,
|
|
417
|
-
errors],
|
|
418
|
-
_warnings]
|
|
452
|
+
token: DesignToken,
|
|
453
|
+
path: string,
|
|
454
|
+
errors: ValidationError[],
|
|
455
|
+
_warnings: ValidationWarning[]
|
|
419
456
|
) {
|
|
420
457
|
const value = token.value as string;
|
|
421
458
|
|
|
422
459
|
if (typeof value !== 'string') {
|
|
423
460
|
errors.push({
|
|
424
461
|
path,
|
|
425
|
-
message,
|
|
426
|
-
severity
|
|
462
|
+
message: 'Transition token value must be a string',
|
|
463
|
+
severity: 'error'
|
|
464
|
+
});
|
|
427
465
|
}
|
|
428
466
|
|
|
429
467
|
if (value.trim().length === 0) {
|
|
430
468
|
errors.push({
|
|
431
469
|
path,
|
|
432
|
-
message,
|
|
433
|
-
severity
|
|
470
|
+
message: 'Transition token value cannot be empty',
|
|
471
|
+
severity: 'error'
|
|
472
|
+
});
|
|
434
473
|
}
|
|
435
474
|
}
|
|
436
475
|
|
|
@@ -438,33 +477,37 @@ export class TokenValidator {
|
|
|
438
477
|
* Validates breakpoint tokens
|
|
439
478
|
*/
|
|
440
479
|
private static validateBreakpointToken(
|
|
441
|
-
token,
|
|
442
|
-
path,
|
|
443
|
-
errors],
|
|
444
|
-
_warnings]
|
|
480
|
+
token: DesignToken,
|
|
481
|
+
path: string,
|
|
482
|
+
errors: ValidationError[],
|
|
483
|
+
_warnings: ValidationWarning[]
|
|
445
484
|
) {
|
|
446
485
|
const value = token.value as number;
|
|
447
486
|
|
|
448
487
|
if (typeof value !== 'number') {
|
|
449
488
|
errors.push({
|
|
450
489
|
path,
|
|
451
|
-
message,
|
|
452
|
-
severity
|
|
490
|
+
message: 'Breakpoint token value must be a number',
|
|
491
|
+
severity: 'error'
|
|
492
|
+
});
|
|
453
493
|
return;
|
|
454
494
|
}
|
|
455
495
|
|
|
456
496
|
if (value < 0) {
|
|
457
497
|
errors.push({
|
|
458
498
|
path,
|
|
459
|
-
message,
|
|
460
|
-
severity
|
|
499
|
+
message: 'Breakpoint token value cannot be negative',
|
|
500
|
+
severity: 'error'
|
|
501
|
+
});
|
|
461
502
|
}
|
|
462
503
|
}
|
|
463
504
|
|
|
464
505
|
/**
|
|
465
506
|
* Checks if a value is a valid token
|
|
466
507
|
*/
|
|
467
|
-
private static isToken(value)
|
|
508
|
+
private static isToken(value: any): value is DesignToken {
|
|
509
|
+
return value &&
|
|
510
|
+
typeof value === 'object' &&
|
|
468
511
|
'value' in value &&
|
|
469
512
|
'type' in value;
|
|
470
513
|
}
|
|
@@ -472,7 +515,8 @@ export class TokenValidator {
|
|
|
472
515
|
/**
|
|
473
516
|
* Checks if a token type is valid
|
|
474
517
|
*/
|
|
475
|
-
private static isValidTokenType(type)
|
|
518
|
+
private static isValidTokenType(type: any): type is TokenType {
|
|
519
|
+
const validTypes: TokenType[] = [
|
|
476
520
|
'color', 'fontFamily', 'fontSize', 'fontWeight', 'lineHeight',
|
|
477
521
|
'letterSpacing', 'spacing', 'borderRadius', 'shadow', 'transition',
|
|
478
522
|
'zIndex', 'breakpoint'
|
|
@@ -483,7 +527,8 @@ export class TokenValidator {
|
|
|
483
527
|
/**
|
|
484
528
|
* Checks if a color value is valid
|
|
485
529
|
*/
|
|
486
|
-
private static isValidColor(color)
|
|
530
|
+
private static isValidColor(color: string): boolean {
|
|
531
|
+
// Basic color validation - hex, rgb, rgba, named colors
|
|
487
532
|
const colorRegex = /^(#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})|rgb\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*\)|rgba\(\s*\d+\s*,\s*\d+\s*,\s*\d+\s*,\s*[\d.]+\s*\)|transparent|currentColor)$/;
|
|
488
533
|
return colorRegex.test(color);
|
|
489
534
|
}
|
|
@@ -491,7 +536,8 @@ export class TokenValidator {
|
|
|
491
536
|
/**
|
|
492
537
|
* Checks if a CSS unit is valid
|
|
493
538
|
*/
|
|
494
|
-
private static isValidCSSUnit(value)
|
|
539
|
+
private static isValidCSSUnit(value: string): boolean {
|
|
540
|
+
const unitRegex = /^[\d.]+(px|em|rem|vh|vw|%|ch|ex|in|cm|mm|pt|pc)$/;
|
|
495
541
|
return unitRegex.test(value);
|
|
496
542
|
}
|
|
497
543
|
}
|