@spwig/theme-validator 1.0.0 → 2.0.0

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.
Files changed (36) hide show
  1. package/README.md +0 -0
  2. package/dist/index.d.ts +1 -3
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +0 -2
  5. package/dist/index.js.map +1 -1
  6. package/dist/schemas/theme_manifest_schema.json +7 -65
  7. package/dist/types/manifest.d.ts +50 -82
  8. package/dist/types/manifest.d.ts.map +1 -1
  9. package/dist/types/manifest.js +1 -1
  10. package/dist/types/manifest.js.map +0 -0
  11. package/dist/types/validation-result.d.ts +0 -0
  12. package/dist/types/validation-result.d.ts.map +0 -0
  13. package/dist/types/validation-result.js +0 -0
  14. package/dist/types/validation-result.js.map +0 -0
  15. package/dist/validators/design-tokens-validator.d.ts +16 -0
  16. package/dist/validators/design-tokens-validator.d.ts.map +1 -1
  17. package/dist/validators/design-tokens-validator.js +208 -0
  18. package/dist/validators/design-tokens-validator.js.map +1 -1
  19. package/dist/validators/manifest-validator.d.ts +0 -0
  20. package/dist/validators/manifest-validator.d.ts.map +0 -0
  21. package/dist/validators/manifest-validator.js +0 -0
  22. package/dist/validators/manifest-validator.js.map +0 -0
  23. package/dist/validators/theme-validator.d.ts +11 -7
  24. package/dist/validators/theme-validator.d.ts.map +1 -1
  25. package/dist/validators/theme-validator.js +110 -84
  26. package/dist/validators/theme-validator.js.map +1 -1
  27. package/package.json +1 -1
  28. package/dist/schemas/component_manifest_schema.json +0 -221
  29. package/dist/validators/component-validator.d.ts +0 -50
  30. package/dist/validators/component-validator.d.ts.map +0 -1
  31. package/dist/validators/component-validator.js +0 -235
  32. package/dist/validators/component-validator.js.map +0 -1
  33. package/dist/validators/template-validator.d.ts +0 -34
  34. package/dist/validators/template-validator.d.ts.map +0 -1
  35. package/dist/validators/template-validator.js +0 -170
  36. package/dist/validators/template-validator.js.map +0 -1
package/README.md CHANGED
File without changes
package/dist/index.d.ts CHANGED
@@ -3,10 +3,8 @@
3
3
  * Standalone validation library for Spwig themes
4
4
  */
5
5
  export { ThemeValidator } from './validators/theme-validator.js';
6
- export { ComponentValidator } from './validators/component-validator.js';
7
6
  export { ManifestValidator } from './validators/manifest-validator.js';
8
- export { TemplateValidator } from './validators/template-validator.js';
9
7
  export { DesignTokensValidator } from './validators/design-tokens-validator.js';
10
8
  export type { ValidationResult, ValidationError, ValidationWarning, } from './types/validation-result.js';
11
- export type { ThemeManifest, ComponentManifest, PageSchema, DesignTokens, BundledComponentRef, } from './types/manifest.js';
9
+ export type { ThemeManifest, DesignTokens, } from './types/manifest.js';
12
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAGhF,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,aAAa,EACb,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,mBAAmB,GACpB,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC;AAGhF,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,iBAAiB,GAClB,MAAM,8BAA8B,CAAC;AAEtC,YAAY,EACV,aAAa,EACb,YAAY,GACb,MAAM,qBAAqB,CAAC"}
package/dist/index.js CHANGED
@@ -4,8 +4,6 @@
4
4
  */
5
5
  // Export validators
6
6
  export { ThemeValidator } from './validators/theme-validator.js';
7
- export { ComponentValidator } from './validators/component-validator.js';
8
7
  export { ManifestValidator } from './validators/manifest-validator.js';
9
- export { TemplateValidator } from './validators/template-validator.js';
10
8
  export { DesignTokensValidator } from './validators/design-tokens-validator.js';
11
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAoB;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,oBAAoB;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "title": "Theme Package Manifest Schema",
4
- "description": "Schema for Spwig theme package manifests with bundled components",
4
+ "description": "Schema for Spwig v2.0 theme package manifests",
5
5
  "type": "object",
6
6
  "required": [
7
7
  "name",
@@ -41,78 +41,20 @@
41
41
  "maxLength": 100,
42
42
  "description": "Theme author/vendor name"
43
43
  },
44
+ "sdk_version": {
45
+ "type": "string",
46
+ "description": "SDK version used to create this theme (e.g., '2.0')"
47
+ },
44
48
  "license": {
45
49
  "type": "string",
46
50
  "enum": ["MIT", "Apache-2.0", "GPL-3.0", "Proprietary"],
47
51
  "default": "Proprietary",
48
52
  "description": "Theme license type"
49
53
  },
50
- "bundled_components": {
51
- "type": "array",
52
- "items": {
53
- "type": "object",
54
- "required": ["type", "name", "path"],
55
- "properties": {
56
- "type": {
57
- "type": "string",
58
- "enum": ["header", "footer", "section", "utility"],
59
- "description": "Component type"
60
- },
61
- "name": {
62
- "type": "string",
63
- "pattern": "^[a-z][a-z0-9_-]*$",
64
- "description": "Component name"
65
- },
66
- "path": {
67
- "type": "string",
68
- "pattern": "^components/",
69
- "description": "Relative path to component directory"
70
- }
71
- }
72
- },
73
- "description": "List of components bundled with this theme"
74
- },
75
- "page_schemas": {
76
- "type": "object",
77
- "properties": {
78
- "home": {
79
- "type": "string",
80
- "description": "Path to home page schema"
81
- },
82
- "product": {
83
- "type": "string",
84
- "description": "Path to product page schema"
85
- },
86
- "collection": {
87
- "type": "string",
88
- "description": "Path to collection page schema"
89
- },
90
- "cart": {
91
- "type": "string",
92
- "description": "Path to cart page schema"
93
- },
94
- "checkout": {
95
- "type": "string",
96
- "description": "Path to checkout page schema"
97
- },
98
- "landing": {
99
- "type": "string",
100
- "description": "Path to landing page schema"
101
- }
102
- },
103
- "additionalProperties": {
104
- "type": "string"
105
- },
106
- "description": "Page schema file paths"
107
- },
108
- "design_tokens": {
109
- "type": "string",
110
- "description": "Path to design tokens file (colors, fonts, spacing)"
111
- },
112
54
  "preview_image": {
113
55
  "type": "string",
114
56
  "pattern": "^.+\\.(png|jpg|jpeg|webp)$",
115
- "description": "Theme preview image filename"
57
+ "description": "Theme preview image filename (recommended: 600x800px, max 5MB)"
116
58
  },
117
59
  "screenshots": {
118
60
  "type": "array",
@@ -121,7 +63,7 @@
121
63
  "pattern": "^.+\\.(png|jpg|jpeg|webp)$"
122
64
  },
123
65
  "maxItems": 10,
124
- "description": "Screenshot filenames for theme showcase"
66
+ "description": "Screenshot filenames for theme showcase (recommended: 1200x800px, max 5MB each)"
125
67
  },
126
68
  "demo_url": {
127
69
  "type": "string",
@@ -1,17 +1,6 @@
1
1
  /**
2
- * Type definitions for theme and component manifests
2
+ * Type definitions for theme manifests
3
3
  */
4
- /**
5
- * Reference to a bundled component in theme manifest
6
- */
7
- export interface BundledComponentRef {
8
- /** Component type */
9
- type: 'header' | 'footer' | 'section' | 'utility';
10
- /** Component name */
11
- name: string;
12
- /** Relative path to component directory */
13
- path: string;
14
- }
15
4
  /**
16
5
  * Changelog entry
17
6
  */
@@ -39,17 +28,6 @@ export interface ColorScheme {
39
28
  [key: string]: string | undefined;
40
29
  };
41
30
  }
42
- /**
43
- * Component dependency
44
- */
45
- export interface ComponentDependency {
46
- /** Component name */
47
- name: string;
48
- /** Minimum version (optional) */
49
- min_version?: string;
50
- /** Maximum version (optional) */
51
- max_version?: string;
52
- }
53
31
  /**
54
32
  * Theme manifest structure
55
33
  */
@@ -64,22 +42,10 @@ export interface ThemeManifest {
64
42
  description: string;
65
43
  /** Author/vendor name */
66
44
  author: string;
45
+ /** SDK version (e.g., "2.0") */
46
+ sdk_version?: string;
67
47
  /** License type */
68
48
  license?: 'MIT' | 'Apache-2.0' | 'GPL-3.0' | 'Proprietary';
69
- /** Bundled components */
70
- bundled_components?: BundledComponentRef[];
71
- /** Page schema paths */
72
- page_schemas?: {
73
- home?: string;
74
- product?: string;
75
- collection?: string;
76
- cart?: string;
77
- checkout?: string;
78
- landing?: string;
79
- [key: string]: string | undefined;
80
- };
81
- /** Design tokens file path */
82
- design_tokens?: string;
83
49
  /** Preview image filename */
84
50
  preview_image?: string;
85
51
  /** Screenshot filenames */
@@ -112,52 +78,42 @@ export interface ThemeManifest {
112
78
  checksum?: string;
113
79
  }
114
80
  /**
115
- * Component manifest structure
81
+ * Element-specific token categories
82
+ * These provide default styling for page builder elements
116
83
  */
117
- export interface ComponentManifest {
118
- /** Component identifier */
119
- name: string;
120
- /** Semantic version */
121
- version: string;
122
- /** Human-readable name */
123
- display_name: string;
124
- /** Component description */
125
- description: string;
126
- /** Author name */
127
- author: string;
128
- /** Tier compatibility */
129
- tier_compatibility: ('A' | 'B' | 'C')[];
130
- /** Allowed regions */
131
- regions: string[];
132
- /** Component category */
133
- category: string;
134
- /** Searchable tags */
135
- tags?: string[];
136
- /** Asset declarations */
137
- assets?: {
138
- css?: string[];
139
- js?: string[];
140
- images?: string[];
141
- };
142
- /** Supported locales */
143
- locales?: string[];
144
- /** Preview image filename */
145
- preview?: string;
146
- /** Dependencies */
147
- dependencies?: ComponentDependency[];
148
- /** Props schema (optional, can be in separate file) */
149
- props_schema?: Record<string, any>;
150
- }
151
- /**
152
- * Page schema structure (simplified - actual structure is flexible)
153
- */
154
- export interface PageSchema {
155
- /** Page type */
156
- page_type: string;
157
- /** Layout sections */
158
- sections: any[];
159
- /** Other page-specific config */
160
- [key: string]: any;
84
+ export interface ElementTokens {
85
+ /** Hero section defaults */
86
+ hero?: Record<string, string>;
87
+ /** Button element defaults */
88
+ button?: Record<string, string>;
89
+ /** Card styling (shared by product cards, testimonials, etc.) */
90
+ card?: Record<string, string>;
91
+ /** Divider element defaults */
92
+ divider?: Record<string, string>;
93
+ /** Form input styling */
94
+ form?: Record<string, string>;
95
+ /** Accordion/FAQ styling */
96
+ accordion?: Record<string, string>;
97
+ /** Modal/popup styling */
98
+ modal?: Record<string, string>;
99
+ /** Countdown timer styling */
100
+ countdown?: Record<string, string>;
101
+ /** Testimonial element styling */
102
+ testimonial?: Record<string, string>;
103
+ /** Blog element styling */
104
+ blog?: Record<string, string>;
105
+ /** Product display styling */
106
+ product?: Record<string, string>;
107
+ /** Voucher/coupon code styling */
108
+ voucher?: Record<string, string>;
109
+ /** Heading element defaults */
110
+ heading?: Record<string, string>;
111
+ /** Image element defaults */
112
+ image?: Record<string, string>;
113
+ /** Gallery element defaults */
114
+ gallery?: Record<string, string>;
115
+ /** Other element categories */
116
+ [key: string]: Record<string, string> | undefined;
161
117
  }
162
118
  /**
163
119
  * Design tokens structure
@@ -175,8 +131,20 @@ export interface DesignTokens {
175
131
  shadows?: Record<string, string>;
176
132
  /** Border radius values */
177
133
  borderRadius?: Record<string, string>;
134
+ /** Border width values */
135
+ borders?: Record<string, string>;
178
136
  /** Transitions */
179
137
  transitions?: Record<string, string>;
138
+ /** Z-index values */
139
+ 'z-index'?: Record<string, string>;
140
+ /** Container settings */
141
+ container?: Record<string, string>;
142
+ /** Menu tokens for navigation styling */
143
+ menu?: Record<string, string>;
144
+ /** Search component tokens */
145
+ search?: Record<string, string>;
146
+ /** Element-specific tokens for page builder elements */
147
+ elements?: ElementTokens;
180
148
  /** Other design tokens */
181
149
  [key: string]: any;
182
150
  }
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/types/manifest.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,qBAAqB;IACrB,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC;IAClD,qBAAqB;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,sBAAsB;IACtB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,0CAA0C;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,MAAM,EAAE;QACN,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,MAAM,CAAC,EAA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C,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACtC,0BAA0B;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACjC,kBAAkB;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,qBAAqB;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,yCAAyC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,wDAAwD;IACxD,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,0BAA0B;IAC1B,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Type definitions for theme and component manifests
2
+ * Type definitions for theme manifests
3
3
  */
4
4
  export {};
5
5
  //# sourceMappingURL=manifest.js.map
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -34,6 +34,22 @@ export declare class DesignTokensValidator {
34
34
  * Validate spacing tokens
35
35
  */
36
36
  private validateSpacing;
37
+ /**
38
+ * Validate menu tokens
39
+ */
40
+ private validateMenu;
41
+ /**
42
+ * Validate element tokens
43
+ */
44
+ private validateElements;
45
+ /**
46
+ * Validate a token value that may be flat or responsive
47
+ * @param name - Token name
48
+ * @param value - Token value (string or breakpoint object)
49
+ * @param category - Token category (e.g., 'menu', 'typography')
50
+ * @param tokensPath - Path to tokens file for error reporting
51
+ */
52
+ private validateTokenValue;
37
53
  /**
38
54
  * Check for recommended properties
39
55
  */
@@ -1 +1 @@
1
- {"version":3,"file":"design-tokens-validator.d.ts","sourceRoot":"","sources":["../../src/validators/design-tokens-validator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,gBAAgB,EAKjB,MAAM,+BAA+B,CAAC;AAGvC,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,QAAQ,CAA2B;IAE3C;;OAEG;IACG,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IA0C7D;;OAEG;YACW,UAAU;IASxB;;OAEG;YACW,UAAU;IAsBxB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAoB9B;;OAEG;IACH,OAAO,CAAC,cAAc;IAgDtB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA8B1B;;OAEG;IACH,OAAO,CAAC,eAAe;IA2BvB;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA4BlC;;OAEG;IACH,OAAO,CAAC,WAAW;CAOpB"}
1
+ {"version":3,"file":"design-tokens-validator.d.ts","sourceRoot":"","sources":["../../src/validators/design-tokens-validator.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACL,gBAAgB,EAKjB,MAAM,+BAA+B,CAAC;AA6FvC,qBAAa,qBAAqB;IAChC,OAAO,CAAC,MAAM,CAAyB;IACvC,OAAO,CAAC,QAAQ,CAA2B;IAE3C;;OAEG;IACG,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAoD7D;;OAEG;YACW,UAAU;IASxB;;OAEG;YACW,UAAU;IAsBxB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAoB9B;;OAEG;IACH,OAAO,CAAC,cAAc;IAgDtB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IA8B1B;;OAEG;IACH,OAAO,CAAC,eAAe;IA2BvB;;OAEG;IACH,OAAO,CAAC,YAAY;IAoCpB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAkDxB;;;;;;OAMG;IACH,OAAO,CAAC,kBAAkB;IA0F1B;;OAEG;IACH,OAAO,CAAC,0BAA0B;IA4BlC;;OAEG;IACH,OAAO,CAAC,WAAW;CAOpB"}
@@ -4,6 +4,94 @@
4
4
  */
5
5
  import fs from 'fs-extra';
6
6
  import { createError, createWarning, } from '../types/validation-result.js';
7
+ // Valid breakpoint names for responsive tokens
8
+ const VALID_BREAKPOINTS = ['mobile', 'tablet', 'desktop', 'sm', 'md', 'lg', 'xl', '2xl'];
9
+ // Recommended tokens for each element category
10
+ const ELEMENT_TOKEN_RECOMMENDATIONS = {
11
+ hero: [
12
+ 'min-height',
13
+ 'padding-y',
14
+ 'padding-x',
15
+ 'title-size',
16
+ 'subtitle-size',
17
+ 'text-color',
18
+ 'overlay-color',
19
+ ],
20
+ button: [
21
+ 'radius',
22
+ 'padding-x-sm',
23
+ 'padding-y-sm',
24
+ 'padding-x-md',
25
+ 'padding-y-md',
26
+ 'padding-x-lg',
27
+ 'padding-y-lg',
28
+ 'font-weight',
29
+ ],
30
+ card: ['bg', 'border', 'radius', 'shadow', 'shadow-hover', 'padding'],
31
+ divider: ['color', 'thickness', 'spacing'],
32
+ form: [
33
+ 'input-bg',
34
+ 'input-border',
35
+ 'input-focus-border',
36
+ 'input-radius',
37
+ 'input-padding',
38
+ 'input-disabled-bg',
39
+ 'input-placeholder-color',
40
+ 'label-color',
41
+ 'label-size',
42
+ 'error-color',
43
+ 'help-color',
44
+ 'primary-color',
45
+ 'primary-hover',
46
+ 'success-color',
47
+ 'warning-color',
48
+ 'text-color',
49
+ 'text-muted',
50
+ 'bg-color',
51
+ 'bg-light',
52
+ 'border-color',
53
+ 'focus-shadow',
54
+ 'title-size',
55
+ 'heading-size',
56
+ 'base-size',
57
+ 'small-size',
58
+ 'tiny-size',
59
+ 'font-weight-bold',
60
+ 'font-weight-medium',
61
+ 'line-height-relaxed',
62
+ 'spacing-lg',
63
+ 'spacing-md',
64
+ 'spacing-sm',
65
+ 'spacing-xs',
66
+ 'container-max-width',
67
+ 'container-padding',
68
+ 'shadow',
69
+ 'transition',
70
+ 'button-padding-x',
71
+ 'button-padding-y',
72
+ 'button-radius',
73
+ 'checkbox-size',
74
+ 'checkbox-radius',
75
+ 'radio-size',
76
+ 'star-empty-color',
77
+ 'star-filled-color',
78
+ 'nps-button-height',
79
+ 'likert-min-width',
80
+ 'progress-height',
81
+ 'step-circle-size',
82
+ 'step-circle-size-mobile',
83
+ ],
84
+ accordion: ['header-bg', 'header-hover-bg', 'border', 'content-bg', 'padding'],
85
+ modal: ['backdrop-color', 'bg', 'radius', 'shadow', 'padding', 'max-width'],
86
+ countdown: ['number-size', 'number-color', 'label-size', 'label-color', 'bg'],
87
+ testimonial: ['bg', 'border', 'quote-color', 'author-color', 'radius'],
88
+ blog: ['card-radius', 'card-shadow', 'meta-color', 'title-color'],
89
+ product: ['card-radius', 'card-shadow', 'card-shadow-hover', 'price-color', 'grid-gap'],
90
+ voucher: ['code-bg', 'code-border', 'code-font', 'code-color'],
91
+ heading: ['h1-size', 'h2-size', 'h3-size', 'color', 'line-height'],
92
+ image: ['radius', 'shadow'],
93
+ gallery: ['gap', 'radius'],
94
+ };
7
95
  export class DesignTokensValidator {
8
96
  errors = [];
9
97
  warnings = [];
@@ -37,6 +125,14 @@ export class DesignTokensValidator {
37
125
  if (tokens.spacing) {
38
126
  this.validateSpacing(tokens.spacing, tokensPath);
39
127
  }
128
+ // Validate menu tokens
129
+ if (tokens.menu) {
130
+ this.validateMenu(tokens.menu, tokensPath);
131
+ }
132
+ // Validate element tokens
133
+ if (tokens.elements) {
134
+ this.validateElements(tokens.elements, tokensPath);
135
+ }
40
136
  // Check for recommended properties
41
137
  this.checkRecommendedProperties(tokens, tokensPath);
42
138
  return this.buildResult();
@@ -168,6 +264,118 @@ export class DesignTokensValidator {
168
264
  }
169
265
  }
170
266
  }
267
+ /**
268
+ * Validate menu tokens
269
+ */
270
+ validateMenu(menu, tokensPath) {
271
+ // Check for recommended menu tokens
272
+ const recommendedMenuTokens = [
273
+ 'text-color',
274
+ 'text-hover-color',
275
+ 'background-hover',
276
+ 'dropdown-background',
277
+ 'item-gap',
278
+ 'link-padding-x',
279
+ 'link-padding-y',
280
+ 'font-size',
281
+ 'border-radius',
282
+ 'animation-duration',
283
+ ];
284
+ const missingTokens = recommendedMenuTokens.filter((token) => !(token in menu));
285
+ if (missingTokens.length > 0) {
286
+ this.warnings.push(createWarning('incomplete_menu_tokens', `Missing recommended menu tokens: ${missingTokens.slice(0, 5).join(', ')}${missingTokens.length > 5 ? '...' : ''}`, {
287
+ path: tokensPath,
288
+ suggestion: 'Add these menu tokens for complete navigation styling',
289
+ }));
290
+ }
291
+ // Validate each menu token value (supports both flat and responsive values)
292
+ for (const [name, value] of Object.entries(menu)) {
293
+ this.validateTokenValue(name, value, 'menu', tokensPath);
294
+ }
295
+ }
296
+ /**
297
+ * Validate element tokens
298
+ */
299
+ validateElements(elements, tokensPath) {
300
+ for (const [category, categoryTokens] of Object.entries(elements)) {
301
+ if (!categoryTokens)
302
+ continue;
303
+ // Check if it's a known element category
304
+ const isKnownCategory = category in ELEMENT_TOKEN_RECOMMENDATIONS;
305
+ if (!isKnownCategory) {
306
+ this.warnings.push(createWarning('unknown_element_category', `Unknown element category: "${category}". This may be intentional for custom elements.`, {
307
+ path: tokensPath,
308
+ suggestion: `Known categories: ${Object.keys(ELEMENT_TOKEN_RECOMMENDATIONS).join(', ')}`,
309
+ }));
310
+ }
311
+ // Validate each token value in the category
312
+ for (const [tokenName, tokenValue] of Object.entries(categoryTokens)) {
313
+ this.validateTokenValue(tokenName, tokenValue, `elements.${category}`, tokensPath);
314
+ }
315
+ // Check for recommended tokens in known categories
316
+ if (isKnownCategory) {
317
+ const recommended = ELEMENT_TOKEN_RECOMMENDATIONS[category];
318
+ const missing = recommended.filter((token) => !(token in categoryTokens));
319
+ if (missing.length > 0 && missing.length < recommended.length) {
320
+ // Only warn if they have some tokens but are missing others
321
+ this.warnings.push(createWarning('incomplete_element_tokens', `Element "${category}" is missing some recommended tokens: ${missing.slice(0, 3).join(', ')}${missing.length > 3 ? '...' : ''}`, {
322
+ path: tokensPath,
323
+ suggestion: 'Add these tokens for complete element styling',
324
+ }));
325
+ }
326
+ }
327
+ }
328
+ }
329
+ /**
330
+ * Validate a token value that may be flat or responsive
331
+ * @param name - Token name
332
+ * @param value - Token value (string or breakpoint object)
333
+ * @param category - Token category (e.g., 'menu', 'typography')
334
+ * @param tokensPath - Path to tokens file for error reporting
335
+ */
336
+ validateTokenValue(name, value, category, tokensPath) {
337
+ // Flat value (string) - check for --theme- prefix in var() references
338
+ if (typeof value === 'string') {
339
+ // Check for var() references without --theme- prefix
340
+ if (value.includes('var(--') && !value.includes('var(--theme-')) {
341
+ this.warnings.push(createWarning('missing_theme_prefix', `${category} token "${name}" uses var() without --theme- prefix: ${value}`, {
342
+ path: tokensPath,
343
+ suggestion: 'Use --theme- prefix for all theme variables (e.g., var(--theme-color-primary))',
344
+ }));
345
+ }
346
+ return;
347
+ }
348
+ // Responsive value (object with breakpoint keys)
349
+ if (typeof value === 'object' && value !== null) {
350
+ const keys = Object.keys(value);
351
+ // Must have at least one breakpoint
352
+ if (keys.length === 0) {
353
+ this.errors.push(createError('empty_responsive_token', `${category} token "${name}" is an empty object. Provide at least one breakpoint value.`, { path: tokensPath }));
354
+ return;
355
+ }
356
+ // Validate breakpoint names
357
+ for (const breakpoint of keys) {
358
+ if (!VALID_BREAKPOINTS.includes(breakpoint)) {
359
+ this.errors.push(createError('invalid_breakpoint', `${category} token "${name}" has invalid breakpoint "${breakpoint}". Valid breakpoints: ${VALID_BREAKPOINTS.join(', ')}`, { path: tokensPath }));
360
+ }
361
+ // Validate that breakpoint value is a string
362
+ const breakpointValue = value[breakpoint];
363
+ if (typeof breakpointValue !== 'string') {
364
+ this.errors.push(createError('invalid_breakpoint_value', `${category} token "${name}.${breakpoint}" must be a string, got ${typeof breakpointValue}`, { path: tokensPath }));
365
+ }
366
+ else if (breakpointValue.includes('var(--') && !breakpointValue.includes('var(--theme-')) {
367
+ // Check for var() references without --theme- prefix in responsive values
368
+ this.warnings.push(createWarning('missing_theme_prefix', `${category} token "${name}.${breakpoint}" uses var() without --theme- prefix: ${breakpointValue}`, {
369
+ path: tokensPath,
370
+ suggestion: 'Use --theme- prefix for all theme variables (e.g., var(--theme-color-primary))',
371
+ }));
372
+ }
373
+ }
374
+ return;
375
+ }
376
+ // Invalid type
377
+ this.errors.push(createError('invalid_token_type', `${category} token "${name}" must be a string or responsive object, got ${typeof value}`, { path: tokensPath }));
378
+ }
171
379
  /**
172
380
  * Check for recommended properties
173
381
  */