igniteui-theming 25.1.0 → 25.2.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 (128) hide show
  1. package/dist/index.d.ts +75 -0
  2. package/dist/index.js +12 -0
  3. package/dist/json/components/bootstrap.json +1 -0
  4. package/dist/json/components/fluent.json +1 -0
  5. package/dist/json/components/indigo.json +1 -0
  6. package/dist/json/components/material.json +1 -0
  7. package/{json → dist/json}/components/themes.json +31 -1
  8. package/dist/mcp/generators/css.d.ts +7 -4
  9. package/dist/mcp/generators/css.js +129 -104
  10. package/dist/mcp/generators/sass.js +227 -254
  11. package/dist/mcp/index.js +259 -323
  12. package/dist/mcp/knowledge/color-usage.js +524 -502
  13. package/dist/mcp/knowledge/colors.js +61 -50
  14. package/dist/mcp/knowledge/component-metadata.js +697 -598
  15. package/dist/mcp/knowledge/component-themes.js +70 -57
  16. package/dist/mcp/knowledge/custom-palettes.js +4 -9
  17. package/dist/mcp/knowledge/docs/colors/guidance.js +4 -0
  18. package/dist/mcp/knowledge/docs/colors/usage.js +4 -0
  19. package/dist/mcp/knowledge/docs/layout/functions/border-radius.js +4 -0
  20. package/dist/mcp/knowledge/docs/layout/functions/pad.js +4 -0
  21. package/dist/mcp/knowledge/docs/layout/functions/sizable.js +4 -0
  22. package/dist/mcp/knowledge/docs/layout/mixins/sizable.js +4 -0
  23. package/dist/mcp/knowledge/docs/layout/mixins/sizing.js +4 -0
  24. package/dist/mcp/knowledge/docs/layout/mixins/spacing.js +4 -0
  25. package/dist/mcp/knowledge/docs/layout/overview.js +4 -0
  26. package/dist/mcp/knowledge/docs/setup/platform.js +4 -0
  27. package/dist/mcp/knowledge/elevations.d.ts +1 -1
  28. package/dist/mcp/knowledge/elevations.js +26 -12
  29. package/dist/mcp/knowledge/index.js +23 -87
  30. package/dist/mcp/knowledge/layout-docs.d.ts +1 -1
  31. package/dist/mcp/knowledge/multipliers.js +5 -0
  32. package/dist/mcp/knowledge/palettes.js +29 -17
  33. package/dist/mcp/knowledge/platforms/angular.js +98 -120
  34. package/dist/mcp/knowledge/platforms/blazor.js +39 -34
  35. package/dist/mcp/knowledge/platforms/common.js +83 -68
  36. package/dist/mcp/knowledge/platforms/index.js +265 -242
  37. package/dist/mcp/knowledge/platforms/react.js +43 -35
  38. package/dist/mcp/knowledge/platforms/webcomponents.js +266 -292
  39. package/dist/mcp/knowledge/sass-api.js +1 -0
  40. package/dist/mcp/knowledge/typography.js +13 -5
  41. package/dist/mcp/resources/index.js +1 -0
  42. package/dist/mcp/resources/presets.js +409 -508
  43. package/dist/mcp/theming/dist/json/colors/meta/multipliers.js +50 -0
  44. package/dist/mcp/theming/dist/json/colors/presets/palettes.js +85 -0
  45. package/dist/mcp/theming/dist/json/components/themes.js +5792 -0
  46. package/dist/mcp/theming/dist/json/elevations/indigo.js +29 -0
  47. package/dist/mcp/theming/dist/json/elevations/material.js +3 -0
  48. package/dist/mcp/theming/dist/json/typography/presets/typescales.js +621 -0
  49. package/dist/mcp/tools/descriptions.js +98 -154
  50. package/dist/mcp/tools/handlers/color.js +58 -56
  51. package/dist/mcp/tools/handlers/component-theme.js +163 -225
  52. package/dist/mcp/tools/handlers/component-tokens.js +159 -219
  53. package/dist/mcp/tools/handlers/custom-palette.js +138 -179
  54. package/dist/mcp/tools/handlers/elevations.js +27 -28
  55. package/dist/mcp/tools/handlers/index.js +11 -0
  56. package/dist/mcp/tools/handlers/layout.js +125 -176
  57. package/dist/mcp/tools/handlers/palette.js +105 -120
  58. package/dist/mcp/tools/handlers/platform.js +289 -311
  59. package/dist/mcp/tools/handlers/resource.js +22 -31
  60. package/dist/mcp/tools/handlers/theme.js +86 -103
  61. package/dist/mcp/tools/handlers/typography.js +29 -30
  62. package/dist/mcp/tools/index.js +13 -0
  63. package/dist/mcp/tools/schemas.js +239 -218
  64. package/dist/mcp/utils/color.js +277 -239
  65. package/dist/mcp/utils/preprocessing.js +57 -30
  66. package/dist/mcp/utils/result.js +43 -45
  67. package/dist/mcp/utils/sass.js +271 -191
  68. package/dist/mcp/utils/theming-resolve.d.ts +19 -0
  69. package/dist/mcp/utils/theming-resolve.js +57 -0
  70. package/dist/mcp/utils/types.js +96 -53
  71. package/dist/mcp/validators/custom-palette.js +218 -243
  72. package/dist/mcp/validators/index.js +3 -0
  73. package/dist/mcp/validators/palette.js +231 -229
  74. package/dist/tailwind/utilities/bootstrap.css +1 -0
  75. package/dist/tailwind/utilities/fluent.css +1 -0
  76. package/dist/tailwind/utilities/indigo.css +1 -0
  77. package/dist/tailwind/utilities/material.css +1 -0
  78. package/package.json +45 -64
  79. package/sass/json/README.md +12 -7
  80. package/sass/themes/_mixins.scss +1 -0
  81. package/sass/themes/components/button-group/_button-group-theme.scss +42 -0
  82. package/sass/themes/components/grid/_grid-theme.scss +1 -1
  83. package/sass/themes/schemas/components/dark/_button-group.scss +173 -50
  84. package/sass/themes/schemas/components/dark/_grid.scss +0 -16
  85. package/sass/themes/schemas/components/light/_button-group.scss +221 -99
  86. package/sass/themes/schemas/components/light/_grid.scss +14 -20
  87. package/LICENSE +0 -21
  88. package/README.md +0 -391
  89. package/dist/mcp/json/colors/presets/palettes.json.js +0 -13
  90. package/dist/mcp/json/components/themes.json.js +0 -143
  91. package/dist/mcp/json/elevations/indigo.json.js +0 -8
  92. package/dist/mcp/json/elevations/material.json.js +0 -8
  93. package/dist/mcp/json/typography/presets/typescales.json.js +0 -17
  94. package/dist/mcp/knowledge/docs/colors/guidance.md.js +0 -4
  95. package/dist/mcp/knowledge/docs/colors/usage.md.js +0 -4
  96. package/dist/mcp/knowledge/docs/layout/functions/border-radius.md.js +0 -4
  97. package/dist/mcp/knowledge/docs/layout/functions/pad.md.js +0 -4
  98. package/dist/mcp/knowledge/docs/layout/functions/sizable.md.js +0 -4
  99. package/dist/mcp/knowledge/docs/layout/mixins/sizable.md.js +0 -4
  100. package/dist/mcp/knowledge/docs/layout/mixins/sizing.md.js +0 -4
  101. package/dist/mcp/knowledge/docs/layout/mixins/spacing.md.js +0 -4
  102. package/dist/mcp/knowledge/docs/layout/overview.md.js +0 -4
  103. package/dist/mcp/knowledge/docs/setup/platform.md.js +0 -4
  104. package/dist/mcp/vite-env.d.ts +0 -18
  105. package/index.js +0 -5
  106. package/json/components/bootstrap.json +0 -1
  107. package/json/components/fluent.json +0 -1
  108. package/json/components/indigo.json +0 -1
  109. package/json/components/material.json +0 -1
  110. package/tailwind/utilities/bootstrap.css +0 -1
  111. package/tailwind/utilities/fluent.css +0 -1
  112. package/tailwind/utilities/indigo.css +0 -1
  113. package/tailwind/utilities/material.css +0 -1
  114. /package/{json → dist/json}/colors/meta/multipliers.json +0 -0
  115. /package/{json → dist/json}/colors/meta/palette.json +0 -0
  116. /package/{json → dist/json}/colors/presets/palettes.json +0 -0
  117. /package/{json → dist/json}/elevations/indigo.json +0 -0
  118. /package/{json → dist/json}/elevations/material.json +0 -0
  119. /package/{json → dist/json}/typography/presets/typescales.json +0 -0
  120. /package/{tailwind → dist/tailwind}/themes/base.css +0 -0
  121. /package/{tailwind → dist/tailwind}/themes/dark/bootstrap.css +0 -0
  122. /package/{tailwind → dist/tailwind}/themes/dark/fluent.css +0 -0
  123. /package/{tailwind → dist/tailwind}/themes/dark/indigo.css +0 -0
  124. /package/{tailwind → dist/tailwind}/themes/dark/material.css +0 -0
  125. /package/{tailwind → dist/tailwind}/themes/light/bootstrap.css +0 -0
  126. /package/{tailwind → dist/tailwind}/themes/light/fluent.css +0 -0
  127. /package/{tailwind → dist/tailwind}/themes/light/indigo.css +0 -0
  128. /package/{tailwind → dist/tailwind}/themes/light/material.css +0 -0
@@ -1,252 +1,275 @@
1
- import { existsSync, readFileSync, readdirSync } from "node:fs";
1
+ import "./blazor.js";
2
+ import "./react.js";
3
+ import "./webcomponents.js";
4
+ import "./angular.js";
2
5
  import { resolve } from "node:path";
3
- import "../colors.js";
4
- import "../component-metadata.js";
5
- import "../custom-palettes.js";
6
- import "../../utils/types.js";
7
- import "../palettes.js";
8
- const IGNITE_PACKAGE_PATTERNS = {
9
- angular: ["igniteui-angular", "@infragistics/igniteui-angular"],
10
- webcomponents: [
11
- "igniteui-webcomponents",
12
- "@infragistics/igniteui-webcomponents"
13
- ],
14
- react: ["igniteui-react", "@infragistics/igniteui-react"],
15
- blazor: [],
16
- // Blazor uses NuGet, not npm - detected via .csproj
17
- generic: []
18
- // Generic is platform-agnostic; not detectable from packages
6
+ import { existsSync, readFileSync, readdirSync } from "node:fs";
7
+ //#region src/knowledge/platforms/index.ts
8
+ /**
9
+ * Platform-specific knowledge for theme generation
10
+ *
11
+ * This module exports platform-specific configurations and generators
12
+ * for all supported Ignite UI platforms:
13
+ * - Ignite UI for Angular
14
+ * - Ignite UI for Web Components
15
+ * - Ignite UI for React
16
+ * - Ignite UI for Blazor
17
+ *
18
+ * It also provides platform detection functionality with multi-signal analysis
19
+ * for automatic platform identification from project files.
20
+ */
21
+ /**
22
+ * Ignite UI package patterns for each platform.
23
+ * These are HIGH confidence indicators (100).
24
+ */
25
+ var IGNITE_PACKAGE_PATTERNS = {
26
+ angular: ["igniteui-angular", "@infragistics/igniteui-angular"],
27
+ webcomponents: ["igniteui-webcomponents", "@infragistics/igniteui-webcomponents"],
28
+ react: ["igniteui-react", "@infragistics/igniteui-react"],
29
+ blazor: [],
30
+ generic: []
19
31
  };
20
- const FRAMEWORK_PACKAGE_PATTERNS = {
21
- "@angular/core": "angular",
22
- lit: "webcomponents",
23
- react: "react",
24
- "react-dom": "react"
32
+ /**
33
+ * Framework package patterns for fallback detection.
34
+ * These are LOW confidence indicators (40) - only used when no Ignite UI package found.
35
+ */
36
+ var FRAMEWORK_PACKAGE_PATTERNS = {
37
+ "@angular/core": "angular",
38
+ lit: "webcomponents",
39
+ react: "react",
40
+ "react-dom": "react"
25
41
  };
42
+ /**
43
+ * Detect platform from config files in the project root.
44
+ * Fast detection that only checks root directory, no deep scanning.
45
+ *
46
+ * @param projectRoot - Path to the project root directory
47
+ * @returns Array of detected config file signals
48
+ */
26
49
  function detectConfigFiles(projectRoot = ".") {
27
- const signals = [];
28
- const root = resolve(projectRoot);
29
- if (existsSync(resolve(root, "angular.json"))) {
30
- signals.push({ platform: "angular", file: "angular.json", confidence: 80 });
31
- }
32
- for (const viteConfig of [
33
- "vite.config.ts",
34
- "vite.config.js",
35
- "vite.config.mts",
36
- "vite.config.mjs"
37
- ]) {
38
- const configPath = resolve(root, viteConfig);
39
- if (existsSync(configPath)) {
40
- try {
41
- const content = readFileSync(configPath, "utf-8");
42
- if (content.includes("@vitejs/plugin-react") || content.includes("plugin-react")) {
43
- signals.push({ platform: "react", file: viteConfig, confidence: 80 });
44
- break;
45
- }
46
- } catch {
47
- }
48
- }
49
- }
50
- for (const nextConfig of [
51
- "next.config.js",
52
- "next.config.mjs",
53
- "next.config.ts"
54
- ]) {
55
- if (existsSync(resolve(root, nextConfig))) {
56
- signals.push({ platform: "react", file: nextConfig, confidence: 80 });
57
- break;
58
- }
59
- }
60
- try {
61
- const files = readdirSync(root);
62
- const csprojFiles = files.filter((f) => f.endsWith(".csproj")).slice(0, 5);
63
- for (const csproj of csprojFiles) {
64
- try {
65
- const content = readFileSync(resolve(root, csproj), "utf-8");
66
- if (content.includes("IgniteUI.Blazor")) {
67
- signals.push({ platform: "blazor", file: csproj, confidence: 100 });
68
- break;
69
- }
70
- if (content.includes("Microsoft.NET.Sdk.BlazorWebAssembly") || content.includes("Microsoft.NET.Sdk.Razor")) {
71
- signals.push({ platform: "blazor", file: csproj, confidence: 40 });
72
- break;
73
- }
74
- } catch {
75
- }
76
- }
77
- } catch {
78
- }
79
- return signals;
50
+ const signals = [];
51
+ const root = resolve(projectRoot);
52
+ if (existsSync(resolve(root, "angular.json"))) signals.push({
53
+ platform: "angular",
54
+ file: "angular.json",
55
+ confidence: 80
56
+ });
57
+ for (const viteConfig of [
58
+ "vite.config.ts",
59
+ "vite.config.js",
60
+ "vite.config.mts",
61
+ "vite.config.mjs"
62
+ ]) {
63
+ const configPath = resolve(root, viteConfig);
64
+ if (existsSync(configPath)) try {
65
+ const content = readFileSync(configPath, "utf-8");
66
+ if (content.includes("@vitejs/plugin-react") || content.includes("plugin-react")) {
67
+ signals.push({
68
+ platform: "react",
69
+ file: viteConfig,
70
+ confidence: 80
71
+ });
72
+ break;
73
+ }
74
+ } catch {}
75
+ }
76
+ for (const nextConfig of [
77
+ "next.config.js",
78
+ "next.config.mjs",
79
+ "next.config.ts"
80
+ ]) if (existsSync(resolve(root, nextConfig))) {
81
+ signals.push({
82
+ platform: "react",
83
+ file: nextConfig,
84
+ confidence: 80
85
+ });
86
+ break;
87
+ }
88
+ try {
89
+ const csprojFiles = readdirSync(root).filter((f) => f.endsWith(".csproj")).slice(0, 5);
90
+ for (const csproj of csprojFiles) try {
91
+ const content = readFileSync(resolve(root, csproj), "utf-8");
92
+ if (content.includes("IgniteUI.Blazor")) {
93
+ signals.push({
94
+ platform: "blazor",
95
+ file: csproj,
96
+ confidence: 100
97
+ });
98
+ break;
99
+ }
100
+ if (content.includes("Microsoft.NET.Sdk.BlazorWebAssembly") || content.includes("Microsoft.NET.Sdk.Razor")) {
101
+ signals.push({
102
+ platform: "blazor",
103
+ file: csproj,
104
+ confidence: 40
105
+ });
106
+ break;
107
+ }
108
+ } catch {}
109
+ } catch {}
110
+ return signals;
80
111
  }
112
+ /**
113
+ * Detect platform from package.json dependencies and project config files.
114
+ *
115
+ * Uses a multi-signal approach with confidence scoring:
116
+ * 1. Ignite UI packages (HIGH - 100): Definitive platform match
117
+ * 2. Config files (MEDIUM-HIGH - 80): Strong platform indicator
118
+ * 3. Framework packages (LOW - 40): Fallback when no Ignite UI found
119
+ *
120
+ * When multiple platforms are detected with significant confidence (≥60),
121
+ * returns an ambiguous result asking the user to specify explicitly.
122
+ *
123
+ * @param dependencies - package.json dependencies
124
+ * @param devDependencies - package.json devDependencies
125
+ * @param projectRoot - Project root directory for config file detection
126
+ * @returns Platform detection result with signals and confidence
127
+ */
81
128
  function detectPlatformFromDependencies(dependencies = {}, devDependencies = {}, projectRoot = ".") {
82
- const allDeps = { ...dependencies, ...devDependencies };
83
- const signals = [];
84
- const platformScores = /* @__PURE__ */ new Map();
85
- for (const [platform, patterns] of Object.entries(
86
- IGNITE_PACKAGE_PATTERNS
87
- )) {
88
- for (const pattern of patterns) {
89
- if (pattern in allDeps) {
90
- signals.push({
91
- type: "ignite_package",
92
- package: pattern,
93
- confidence: 100
94
- });
95
- const current = platformScores.get(platform) || 0;
96
- platformScores.set(platform, Math.max(current, 100));
97
- }
98
- }
99
- }
100
- const configSignals = detectConfigFiles(projectRoot);
101
- for (const signal of configSignals) {
102
- signals.push({
103
- type: "config_file",
104
- file: signal.file,
105
- confidence: signal.confidence
106
- });
107
- const current = platformScores.get(signal.platform) || 0;
108
- platformScores.set(signal.platform, Math.max(current, signal.confidence));
109
- }
110
- for (const [pkg, platform] of Object.entries(FRAMEWORK_PACKAGE_PATTERNS)) {
111
- if (pkg in allDeps) {
112
- const currentScore = platformScores.get(platform) || 0;
113
- if (currentScore < 60) {
114
- signals.push({
115
- type: "framework_package",
116
- package: pkg,
117
- confidence: 40
118
- });
119
- platformScores.set(platform, Math.max(currentScore, 40));
120
- }
121
- }
122
- }
123
- const hasIgniteProduct = signals.some((s) => s.type === "ignite_package") || signals.some((s) => s.type === "config_file" && s.confidence === 100);
124
- if (platformScores.size === 0) {
125
- return {
126
- platform: "generic",
127
- confidence: "none",
128
- signals: [],
129
- reason: "No Ignite UI packages, framework packages, or config files detected. Using generic (standalone) mode."
130
- };
131
- }
132
- if (!hasIgniteProduct) {
133
- return {
134
- platform: "generic",
135
- confidence: "low",
136
- signals,
137
- reason: "No Ignite UI product package detected. Framework or config signals found but no Ignite UI product in use. Using generic (standalone) mode."
138
- };
139
- }
140
- const sorted = Array.from(platformScores.entries()).sort(
141
- (a, b) => b[1] - a[1]
142
- );
143
- const [topPlatform, topScore] = sorted[0];
144
- const ambiguousThreshold = 60;
145
- const significantPlatforms = sorted.filter(
146
- ([, score]) => score >= ambiguousThreshold
147
- );
148
- if (significantPlatforms.length > 1) {
149
- const alternatives = significantPlatforms.map(
150
- ([platform, score]) => {
151
- const platformSignals = signals.filter((s) => {
152
- if (s.type === "ignite_package") {
153
- return IGNITE_PACKAGE_PATTERNS[platform]?.includes(s.package);
154
- }
155
- if (s.type === "config_file") {
156
- return configSignals.some(
157
- (cs) => cs.platform === platform && cs.file === s.file
158
- );
159
- }
160
- if (s.type === "framework_package") {
161
- return FRAMEWORK_PACKAGE_PATTERNS[s.package] === platform;
162
- }
163
- return false;
164
- });
165
- return {
166
- platform,
167
- confidence: score,
168
- signals: platformSignals
169
- };
170
- }
171
- );
172
- return {
173
- platform: null,
174
- confidence: "none",
175
- ambiguous: true,
176
- alternatives,
177
- signals,
178
- reason: `Multiple platforms detected: ${alternatives.map((a) => a.platform).join(", ")}. Please specify platform explicitly.`
179
- };
180
- }
181
- let confidenceLevel;
182
- if (topScore >= 80) {
183
- confidenceLevel = "high";
184
- } else if (topScore >= 60) {
185
- confidenceLevel = "medium";
186
- } else {
187
- confidenceLevel = "low";
188
- }
189
- const detectedPackageSignal = signals.find(
190
- (s) => s.type === "ignite_package" && IGNITE_PACKAGE_PATTERNS[topPlatform]?.includes(s.package)
191
- );
192
- return {
193
- platform: topPlatform,
194
- confidence: confidenceLevel,
195
- signals,
196
- detectedPackage: detectedPackageSignal?.package,
197
- reason: `Detected ${topPlatform} with ${confidenceLevel} confidence (score: ${topScore})`
198
- };
129
+ const allDeps = {
130
+ ...dependencies,
131
+ ...devDependencies
132
+ };
133
+ const signals = [];
134
+ const platformScores = /* @__PURE__ */ new Map();
135
+ for (const [platform, patterns] of Object.entries(IGNITE_PACKAGE_PATTERNS)) for (const pattern of patterns) if (pattern in allDeps) {
136
+ signals.push({
137
+ type: "ignite_package",
138
+ package: pattern,
139
+ confidence: 100
140
+ });
141
+ const current = platformScores.get(platform) || 0;
142
+ platformScores.set(platform, Math.max(current, 100));
143
+ }
144
+ const configSignals = detectConfigFiles(projectRoot);
145
+ for (const signal of configSignals) {
146
+ signals.push({
147
+ type: "config_file",
148
+ file: signal.file,
149
+ confidence: signal.confidence
150
+ });
151
+ const current = platformScores.get(signal.platform) || 0;
152
+ platformScores.set(signal.platform, Math.max(current, signal.confidence));
153
+ }
154
+ for (const [pkg, platform] of Object.entries(FRAMEWORK_PACKAGE_PATTERNS)) if (pkg in allDeps) {
155
+ const currentScore = platformScores.get(platform) || 0;
156
+ if (currentScore < 60) {
157
+ signals.push({
158
+ type: "framework_package",
159
+ package: pkg,
160
+ confidence: 40
161
+ });
162
+ platformScores.set(platform, Math.max(currentScore, 40));
163
+ }
164
+ }
165
+ const hasIgniteProduct = signals.some((s) => s.type === "ignite_package") || signals.some((s) => s.type === "config_file" && s.confidence === 100);
166
+ if (platformScores.size === 0) return {
167
+ platform: "generic",
168
+ confidence: "none",
169
+ signals: [],
170
+ reason: "No Ignite UI packages, framework packages, or config files detected. Using generic (standalone) mode."
171
+ };
172
+ if (!hasIgniteProduct) return {
173
+ platform: "generic",
174
+ confidence: "low",
175
+ signals,
176
+ reason: "No Ignite UI product package detected. Framework or config signals found but no Ignite UI product in use. Using generic (standalone) mode."
177
+ };
178
+ const sorted = Array.from(platformScores.entries()).sort((a, b) => b[1] - a[1]);
179
+ const [topPlatform, topScore] = sorted[0];
180
+ const ambiguousThreshold = 60;
181
+ const significantPlatforms = sorted.filter(([, score]) => score >= ambiguousThreshold);
182
+ if (significantPlatforms.length > 1) {
183
+ const alternatives = significantPlatforms.map(([platform, score]) => {
184
+ return {
185
+ platform,
186
+ confidence: score,
187
+ signals: signals.filter((s) => {
188
+ if (s.type === "ignite_package") return IGNITE_PACKAGE_PATTERNS[platform]?.includes(s.package);
189
+ if (s.type === "config_file") return configSignals.some((cs) => cs.platform === platform && cs.file === s.file);
190
+ if (s.type === "framework_package") return FRAMEWORK_PACKAGE_PATTERNS[s.package] === platform;
191
+ return false;
192
+ })
193
+ };
194
+ });
195
+ return {
196
+ platform: null,
197
+ confidence: "none",
198
+ ambiguous: true,
199
+ alternatives,
200
+ signals,
201
+ reason: `Multiple platforms detected: ${alternatives.map((a) => a.platform).join(", ")}. Please specify platform explicitly.`
202
+ };
203
+ }
204
+ let confidenceLevel;
205
+ if (topScore >= 80) confidenceLevel = "high";
206
+ else if (topScore >= 60) confidenceLevel = "medium";
207
+ else confidenceLevel = "low";
208
+ const detectedPackageSignal = signals.find((s) => s.type === "ignite_package" && IGNITE_PACKAGE_PATTERNS[topPlatform]?.includes(s.package));
209
+ return {
210
+ platform: topPlatform,
211
+ confidence: confidenceLevel,
212
+ signals,
213
+ detectedPackage: detectedPackageSignal?.package,
214
+ reason: `Detected ${topPlatform} with ${confidenceLevel} confidence (score: ${topScore})`
215
+ };
199
216
  }
217
+ /**
218
+ * Determine if a detected package is a licensed @infragistics package.
219
+ * Only applies to Angular - other platforms always use the free igniteui-theming package.
220
+ *
221
+ * @param detectedPackage - The package name detected from package.json
222
+ * @returns True if the package is a licensed @infragistics package
223
+ */
200
224
  function isLicensedPackage(detectedPackage) {
201
- return detectedPackage?.startsWith("@infragistics/") ?? false;
225
+ return detectedPackage?.startsWith("@infragistics/") ?? false;
202
226
  }
203
- const PLATFORM_METADATA = {
204
- angular: {
205
- id: "angular",
206
- name: "Ignite UI for Angular",
207
- shortName: "Angular",
208
- packageName: "igniteui-angular",
209
- licensedPackageName: "@infragistics/igniteui-angular",
210
- themingModule: "igniteui-angular/theming",
211
- licensedThemingModule: "@infragistics/igniteui-angular/theming",
212
- description: "Uses core() and theme() mixins from igniteui-angular/theming module. Requires ig-typography CSS class on root element. Available as OSS (igniteui-angular) or licensed (@infragistics/igniteui-angular) package."
213
- },
214
- webcomponents: {
215
- id: "webcomponents",
216
- name: "Ignite UI for Web Components",
217
- shortName: "Web Components",
218
- packageName: "igniteui-webcomponents",
219
- themingModule: "igniteui-theming",
220
- description: "Uses igniteui-theming directly with palette(), typography(), and elevations() mixins. Supports runtime theme switching via configureTheme(). The igniteui-theming package is always free/OSS."
221
- },
222
- react: {
223
- id: "react",
224
- name: "Ignite UI for React",
225
- shortName: "React",
226
- packageName: "igniteui-react",
227
- themingModule: "igniteui-theming",
228
- description: "Uses igniteui-theming directly with palette(), typography(), and elevations() mixins. Common with Vite or Next.js projects. The igniteui-theming package is always free/OSS."
229
- },
230
- blazor: {
231
- id: "blazor",
232
- name: "Ignite UI for Blazor",
233
- shortName: "Blazor",
234
- packageName: "IgniteUI.Blazor",
235
- themingModule: "igniteui-theming",
236
- description: "Uses igniteui-theming for Sass compilation in .NET Blazor projects. Theme styles are compiled to CSS and referenced in Blazor components. The igniteui-theming package is always free/OSS."
237
- },
238
- generic: {
239
- id: "generic",
240
- name: "Ignite UI Theming (Standalone)",
241
- shortName: "Generic",
242
- packageName: "igniteui-theming",
243
- themingModule: "igniteui-theming",
244
- description: "Platform-agnostic output using igniteui-theming directly. For projects that do not use a specific Ignite UI product framework (Angular, Web Components, React, or Blazor). Supports palette, typography, elevations, and theme generation. Component theming is not available in generic mode."
245
- }
246
- };
247
- export {
248
- PLATFORM_METADATA,
249
- detectConfigFiles,
250
- detectPlatformFromDependencies,
251
- isLicensedPackage
227
+ /**
228
+ * Platform metadata for display purposes
229
+ */
230
+ var PLATFORM_METADATA = {
231
+ angular: {
232
+ id: "angular",
233
+ name: "Ignite UI for Angular",
234
+ shortName: "Angular",
235
+ packageName: "igniteui-angular",
236
+ licensedPackageName: "@infragistics/igniteui-angular",
237
+ themingModule: "igniteui-angular/theming",
238
+ licensedThemingModule: "@infragistics/igniteui-angular/theming",
239
+ description: "Uses core() and theme() mixins from igniteui-angular/theming module. Requires ig-typography CSS class on root element. Available as OSS (igniteui-angular) or licensed (@infragistics/igniteui-angular) package."
240
+ },
241
+ webcomponents: {
242
+ id: "webcomponents",
243
+ name: "Ignite UI for Web Components",
244
+ shortName: "Web Components",
245
+ packageName: "igniteui-webcomponents",
246
+ themingModule: "igniteui-theming",
247
+ description: "Uses igniteui-theming directly with palette(), typography(), and elevations() mixins. Supports runtime theme switching via configureTheme(). The igniteui-theming package is always free/OSS."
248
+ },
249
+ react: {
250
+ id: "react",
251
+ name: "Ignite UI for React",
252
+ shortName: "React",
253
+ packageName: "igniteui-react",
254
+ themingModule: "igniteui-theming",
255
+ description: "Uses igniteui-theming directly with palette(), typography(), and elevations() mixins. Common with Vite or Next.js projects. The igniteui-theming package is always free/OSS."
256
+ },
257
+ blazor: {
258
+ id: "blazor",
259
+ name: "Ignite UI for Blazor",
260
+ shortName: "Blazor",
261
+ packageName: "IgniteUI.Blazor",
262
+ themingModule: "igniteui-theming",
263
+ description: "Uses igniteui-theming for Sass compilation in .NET Blazor projects. Theme styles are compiled to CSS and referenced in Blazor components. The igniteui-theming package is always free/OSS."
264
+ },
265
+ generic: {
266
+ id: "generic",
267
+ name: "Ignite UI Theming (Standalone)",
268
+ shortName: "Generic",
269
+ packageName: "igniteui-theming",
270
+ themingModule: "igniteui-theming",
271
+ description: "Platform-agnostic output using igniteui-theming directly. For projects that do not use a specific Ignite UI product framework (Angular, Web Components, React, or Blazor). Supports palette, typography, elevations, and theme generation. Component theming is not available in generic mode."
272
+ }
252
273
  };
274
+ //#endregion
275
+ export { PLATFORM_METADATA, detectConfigFiles, detectPlatformFromDependencies, isLicensedPackage };
@@ -1,31 +1,36 @@
1
- const REACT_PLATFORM = {
2
- id: "react",
3
- name: "Ignite UI for React",
4
- packageName: "igniteui-react",
5
- /**
6
- * The Sass module to import for theming
7
- */
8
- themingModule: "igniteui-theming",
9
- /**
10
- * Detection patterns in package.json dependencies
11
- */
12
- detectionPatterns: ["igniteui-react", "@infragistics/igniteui-react"],
13
- /**
14
- * Config files that indicate a React project
15
- */
16
- configFiles: [
17
- "vite.config.ts",
18
- "vite.config.js",
19
- "next.config.js",
20
- "next.config.mjs"
21
- ],
22
- /**
23
- * No required root class (themes apply via CSS variables on :root)
24
- */
25
- rootClass: null
1
+ //#region src/knowledge/platforms/react.ts
2
+ /**
3
+ * Ignite UI for React Platform Knowledge
4
+ *
5
+ * This module contains platform-specific information for generating
6
+ * valid Sass theme code for Ignite UI for React applications.
7
+ *
8
+ * Key characteristics:
9
+ * - Uses `igniteui-theming` directly (same as Web Components)
10
+ * - No `core()` or `theme()` mixins - uses individual mixins: `palette()`, `typography()`, `elevations()`
11
+ * - Commonly used with Vite, Next.js, or Create React App
12
+ * - Components use CSS variables for theming (--ig-* naming convention)
13
+ * - Theming approach is identical to Web Components
14
+ */
15
+ var REACT_PLATFORM = {
16
+ id: "react",
17
+ name: "Ignite UI for React",
18
+ packageName: "igniteui-react",
19
+ themingModule: "igniteui-theming",
20
+ detectionPatterns: ["igniteui-react", "@infragistics/igniteui-react"],
21
+ configFiles: [
22
+ "vite.config.ts",
23
+ "vite.config.js",
24
+ "next.config.js",
25
+ "next.config.mjs"
26
+ ],
27
+ rootClass: null
26
28
  };
27
- const REACT_USAGE_EXAMPLES = {
28
- basic: `
29
+ /**
30
+ * Example usage documentation for React
31
+ */
32
+ var REACT_USAGE_EXAMPLES = {
33
+ basic: `
29
34
  // Basic Material Light Theme for React (Vite)
30
35
  // In your styles.scss or theme.scss file:
31
36
 
@@ -51,7 +56,7 @@ const REACT_USAGE_EXAMPLES = {
51
56
  );
52
57
  @include spacing();
53
58
  `,
54
- viteConfig: `
59
+ viteConfig: `
55
60
  // vite.config.ts - Sass configuration for Ignite UI theming
56
61
  import { defineConfig } from 'vite';
57
62
  import react from '@vitejs/plugin-react';
@@ -68,7 +73,7 @@ export default defineConfig({
68
73
  },
69
74
  });
70
75
  `,
71
- nextjsConfig: `
76
+ nextjsConfig: `
72
77
  // next.config.js - Sass configuration for Next.js
73
78
  const path = require('path');
74
79
 
@@ -78,7 +83,7 @@ module.exports = {
78
83
  },
79
84
  };
80
85
  `,
81
- customPalette: `
86
+ customPalette: `
82
87
  // Custom Palette Theme for React
83
88
  @use 'igniteui-theming' as *;
84
89
  @use 'igniteui-theming/sass/typography/presets/material' as *;
@@ -106,7 +111,7 @@ $my-palette: palette(
106
111
  );
107
112
  @include spacing();
108
113
  `,
109
- darkTheme: `
114
+ darkTheme: `
110
115
  // Dark Indigo Theme for React
111
116
  @use 'igniteui-theming' as *;
112
117
  @use 'igniteui-theming/sass/typography/presets/indigo' as *;
@@ -129,7 +134,10 @@ $my-palette: palette(
129
134
  @include spacing();
130
135
  `
131
136
  };
132
- export {
133
- REACT_PLATFORM,
134
- REACT_USAGE_EXAMPLES
135
- };
137
+ /**
138
+ * Note: React uses the same Sass code generation as Web Components.
139
+ * The generateWebComponentsThemeSass function from webcomponents.ts can be reused for React.
140
+ * The only difference is in how the Sass files are imported and bundled (Vite vs Angular CLI).
141
+ */
142
+ //#endregion
143
+ export { REACT_PLATFORM, REACT_USAGE_EXAMPLES };