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.
- package/dist/index.d.ts +75 -0
- package/dist/index.js +12 -0
- package/dist/json/components/bootstrap.json +1 -0
- package/dist/json/components/fluent.json +1 -0
- package/dist/json/components/indigo.json +1 -0
- package/dist/json/components/material.json +1 -0
- package/{json → dist/json}/components/themes.json +31 -1
- package/dist/mcp/generators/css.d.ts +7 -4
- package/dist/mcp/generators/css.js +129 -104
- package/dist/mcp/generators/sass.js +227 -254
- package/dist/mcp/index.js +259 -323
- package/dist/mcp/knowledge/color-usage.js +524 -502
- package/dist/mcp/knowledge/colors.js +61 -50
- package/dist/mcp/knowledge/component-metadata.js +697 -598
- package/dist/mcp/knowledge/component-themes.js +70 -57
- package/dist/mcp/knowledge/custom-palettes.js +4 -9
- package/dist/mcp/knowledge/docs/colors/guidance.js +4 -0
- package/dist/mcp/knowledge/docs/colors/usage.js +4 -0
- package/dist/mcp/knowledge/docs/layout/functions/border-radius.js +4 -0
- package/dist/mcp/knowledge/docs/layout/functions/pad.js +4 -0
- package/dist/mcp/knowledge/docs/layout/functions/sizable.js +4 -0
- package/dist/mcp/knowledge/docs/layout/mixins/sizable.js +4 -0
- package/dist/mcp/knowledge/docs/layout/mixins/sizing.js +4 -0
- package/dist/mcp/knowledge/docs/layout/mixins/spacing.js +4 -0
- package/dist/mcp/knowledge/docs/layout/overview.js +4 -0
- package/dist/mcp/knowledge/docs/setup/platform.js +4 -0
- package/dist/mcp/knowledge/elevations.d.ts +1 -1
- package/dist/mcp/knowledge/elevations.js +26 -12
- package/dist/mcp/knowledge/index.js +23 -87
- package/dist/mcp/knowledge/layout-docs.d.ts +1 -1
- package/dist/mcp/knowledge/multipliers.js +5 -0
- package/dist/mcp/knowledge/palettes.js +29 -17
- package/dist/mcp/knowledge/platforms/angular.js +98 -120
- package/dist/mcp/knowledge/platforms/blazor.js +39 -34
- package/dist/mcp/knowledge/platforms/common.js +83 -68
- package/dist/mcp/knowledge/platforms/index.js +265 -242
- package/dist/mcp/knowledge/platforms/react.js +43 -35
- package/dist/mcp/knowledge/platforms/webcomponents.js +266 -292
- package/dist/mcp/knowledge/sass-api.js +1 -0
- package/dist/mcp/knowledge/typography.js +13 -5
- package/dist/mcp/resources/index.js +1 -0
- package/dist/mcp/resources/presets.js +409 -508
- package/dist/mcp/theming/dist/json/colors/meta/multipliers.js +50 -0
- package/dist/mcp/theming/dist/json/colors/presets/palettes.js +85 -0
- package/dist/mcp/theming/dist/json/components/themes.js +5792 -0
- package/dist/mcp/theming/dist/json/elevations/indigo.js +29 -0
- package/dist/mcp/theming/dist/json/elevations/material.js +3 -0
- package/dist/mcp/theming/dist/json/typography/presets/typescales.js +621 -0
- package/dist/mcp/tools/descriptions.js +98 -154
- package/dist/mcp/tools/handlers/color.js +58 -56
- package/dist/mcp/tools/handlers/component-theme.js +163 -225
- package/dist/mcp/tools/handlers/component-tokens.js +159 -219
- package/dist/mcp/tools/handlers/custom-palette.js +138 -179
- package/dist/mcp/tools/handlers/elevations.js +27 -28
- package/dist/mcp/tools/handlers/index.js +11 -0
- package/dist/mcp/tools/handlers/layout.js +125 -176
- package/dist/mcp/tools/handlers/palette.js +105 -120
- package/dist/mcp/tools/handlers/platform.js +289 -311
- package/dist/mcp/tools/handlers/resource.js +22 -31
- package/dist/mcp/tools/handlers/theme.js +86 -103
- package/dist/mcp/tools/handlers/typography.js +29 -30
- package/dist/mcp/tools/index.js +13 -0
- package/dist/mcp/tools/schemas.js +239 -218
- package/dist/mcp/utils/color.js +277 -239
- package/dist/mcp/utils/preprocessing.js +57 -30
- package/dist/mcp/utils/result.js +43 -45
- package/dist/mcp/utils/sass.js +271 -191
- package/dist/mcp/utils/theming-resolve.d.ts +19 -0
- package/dist/mcp/utils/theming-resolve.js +57 -0
- package/dist/mcp/utils/types.js +96 -53
- package/dist/mcp/validators/custom-palette.js +218 -243
- package/dist/mcp/validators/index.js +3 -0
- package/dist/mcp/validators/palette.js +231 -229
- package/dist/tailwind/utilities/bootstrap.css +1 -0
- package/dist/tailwind/utilities/fluent.css +1 -0
- package/dist/tailwind/utilities/indigo.css +1 -0
- package/dist/tailwind/utilities/material.css +1 -0
- package/package.json +45 -64
- package/sass/json/README.md +12 -7
- package/sass/themes/_mixins.scss +1 -0
- package/sass/themes/components/button-group/_button-group-theme.scss +42 -0
- package/sass/themes/components/grid/_grid-theme.scss +1 -1
- package/sass/themes/schemas/components/dark/_button-group.scss +173 -50
- package/sass/themes/schemas/components/dark/_grid.scss +0 -16
- package/sass/themes/schemas/components/light/_button-group.scss +221 -99
- package/sass/themes/schemas/components/light/_grid.scss +14 -20
- package/LICENSE +0 -21
- package/README.md +0 -391
- package/dist/mcp/json/colors/presets/palettes.json.js +0 -13
- package/dist/mcp/json/components/themes.json.js +0 -143
- package/dist/mcp/json/elevations/indigo.json.js +0 -8
- package/dist/mcp/json/elevations/material.json.js +0 -8
- package/dist/mcp/json/typography/presets/typescales.json.js +0 -17
- package/dist/mcp/knowledge/docs/colors/guidance.md.js +0 -4
- package/dist/mcp/knowledge/docs/colors/usage.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/functions/border-radius.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/functions/pad.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/functions/sizable.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/mixins/sizable.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/mixins/sizing.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/mixins/spacing.md.js +0 -4
- package/dist/mcp/knowledge/docs/layout/overview.md.js +0 -4
- package/dist/mcp/knowledge/docs/setup/platform.md.js +0 -4
- package/dist/mcp/vite-env.d.ts +0 -18
- package/index.js +0 -5
- package/json/components/bootstrap.json +0 -1
- package/json/components/fluent.json +0 -1
- package/json/components/indigo.json +0 -1
- package/json/components/material.json +0 -1
- package/tailwind/utilities/bootstrap.css +0 -1
- package/tailwind/utilities/fluent.css +0 -1
- package/tailwind/utilities/indigo.css +0 -1
- package/tailwind/utilities/material.css +0 -1
- /package/{json → dist/json}/colors/meta/multipliers.json +0 -0
- /package/{json → dist/json}/colors/meta/palette.json +0 -0
- /package/{json → dist/json}/colors/presets/palettes.json +0 -0
- /package/{json → dist/json}/elevations/indigo.json +0 -0
- /package/{json → dist/json}/elevations/material.json +0 -0
- /package/{json → dist/json}/typography/presets/typescales.json +0 -0
- /package/{tailwind → dist/tailwind}/themes/base.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/bootstrap.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/fluent.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/indigo.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/dark/material.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/light/bootstrap.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/light/fluent.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/light/indigo.css +0 -0
- /package/{tailwind → dist/tailwind}/themes/light/material.css +0 -0
|
@@ -1,252 +1,275 @@
|
|
|
1
|
-
import
|
|
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 "
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
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
|
-
|
|
225
|
+
return detectedPackage?.startsWith("@infragistics/") ?? false;
|
|
202
226
|
}
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
-
|
|
28
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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 };
|