igniteui-theming 25.0.0 → 25.0.1
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/README.md +2 -2
- package/dist/mcp/generators/css.js +1 -8
- package/dist/mcp/generators/sass.d.ts +1 -1
- package/dist/mcp/generators/sass.js +26 -3
- package/dist/mcp/index.js +3 -3
- package/dist/mcp/knowledge/docs/setup/platform.md.js +4 -0
- package/dist/mcp/knowledge/index.d.ts +1 -1
- package/dist/mcp/knowledge/index.js +1 -4
- package/dist/mcp/knowledge/platform-setup.d.ts +2 -0
- package/dist/mcp/knowledge/platforms/index.d.ts +8 -11
- package/dist/mcp/knowledge/platforms/index.js +22 -14
- package/dist/mcp/knowledge/platforms/react.d.ts +2 -2
- package/dist/mcp/knowledge/platforms/react.js +3 -3
- package/dist/mcp/knowledge/sass-api.d.ts +2 -2
- package/dist/mcp/resources/presets.d.ts +12 -0
- package/dist/mcp/resources/presets.js +44 -1
- package/dist/mcp/tools/descriptions.d.ts +8 -8
- package/dist/mcp/tools/descriptions.js +25 -7
- package/dist/mcp/tools/handlers/component-theme.js +23 -5
- package/dist/mcp/tools/handlers/custom-palette.js +2 -1
- package/dist/mcp/tools/handlers/elevations.js +2 -1
- package/dist/mcp/tools/handlers/layout.js +1 -1
- package/dist/mcp/tools/handlers/palette.js +2 -3
- package/dist/mcp/tools/handlers/platform.js +247 -86
- package/dist/mcp/tools/handlers/theme.js +3 -0
- package/dist/mcp/tools/handlers/typography.js +2 -1
- package/dist/mcp/tools/schemas.d.ts +31 -31
- package/dist/mcp/utils/sass.d.ts +20 -0
- package/dist/mcp/utils/sass.js +16 -0
- package/dist/mcp/utils/types.d.ts +2 -1
- package/dist/mcp/utils/types.js +2 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -152,7 +152,7 @@ The MCP server works with any MCP-compatible client. Here are setup instructions
|
|
|
152
152
|
|
|
153
153
|
```json
|
|
154
154
|
{
|
|
155
|
-
"
|
|
155
|
+
"servers": {
|
|
156
156
|
"igniteui-theming": {
|
|
157
157
|
"command": "node",
|
|
158
158
|
"args": ["/absolute/path/to/igniteui-theming/dist/mcp/index.js"]
|
|
@@ -165,7 +165,7 @@ The MCP server works with any MCP-compatible client. Here are setup instructions
|
|
|
165
165
|
|
|
166
166
|
```json
|
|
167
167
|
{
|
|
168
|
-
"
|
|
168
|
+
"servers": {
|
|
169
169
|
"igniteui-theming": {
|
|
170
170
|
"command": "npx",
|
|
171
171
|
"args": ["-y", "igniteui-theming", "igniteui-theming-mcp"]
|
|
@@ -78,12 +78,7 @@ function formatCssOutput(css, description) {
|
|
|
78
78
|
return header + css;
|
|
79
79
|
}
|
|
80
80
|
async function generateComponentThemeCss(options) {
|
|
81
|
-
const {
|
|
82
|
-
getComponentTheme,
|
|
83
|
-
getComponentSelector,
|
|
84
|
-
getVariablePrefix,
|
|
85
|
-
SCHEMA_PRESETS
|
|
86
|
-
} = await import("../knowledge/index.js");
|
|
81
|
+
const { getComponentTheme, getComponentSelector, SCHEMA_PRESETS } = await import("../knowledge/index.js");
|
|
87
82
|
const { toVariableName } = await import("../utils/sass.js");
|
|
88
83
|
const theme = getComponentTheme(options.component);
|
|
89
84
|
if (!theme) {
|
|
@@ -104,8 +99,6 @@ async function generateComponentThemeCss(options) {
|
|
|
104
99
|
options.platform
|
|
105
100
|
);
|
|
106
101
|
const selector = options.selector || (defaultSelectors.length > 0 ? defaultSelectors[0] : options.component);
|
|
107
|
-
const prefix = getVariablePrefix(options.platform);
|
|
108
|
-
`${prefix}-${options.component}`;
|
|
109
102
|
const sassCode = `
|
|
110
103
|
@use 'sass/themes' as *;
|
|
111
104
|
@use 'sass/themes/schemas' as *;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CreateElevationsInput, CreatePaletteInput, CreateThemeInput, CreateTypographyInput, DesignSystem, GeneratedCode, Platform, ThemeVariant } from '../utils/types.js';
|
|
2
2
|
export type { ElevationsCodeOptions, PaletteCodeOptions, PaletteCodeResult, TypographyCodeOptions, } from '../utils/sass.js';
|
|
3
|
-
export { generateElevationsCode, generateHeader, generatePaletteCode, generateTypographyCode, generateUseStatement, quoteFontFamily, toVariableName, } from '../utils/sass.js';
|
|
3
|
+
export { generateElevationsCode, generateHeader, generatePaletteCode, generatePresetImports, generateTypographyCode, generateUseStatement, quoteFontFamily, toVariableName, } from '../utils/sass.js';
|
|
4
4
|
/**
|
|
5
5
|
* Generate a palette definition.
|
|
6
6
|
*/
|
|
@@ -4,7 +4,7 @@ import { generateAngularThemeSass } from "../knowledge/platforms/angular.js";
|
|
|
4
4
|
import { SCHEMAS } from "../knowledge/platforms/common.js";
|
|
5
5
|
import { generateWebComponentsThemeSass } from "../knowledge/platforms/webcomponents.js";
|
|
6
6
|
import { TYPOGRAPHY_PRESETS } from "../knowledge/typography.js";
|
|
7
|
-
import { toVariableName,
|
|
7
|
+
import { generateUseStatement, toVariableName, generatePresetImports, generateHeader, quoteFontFamily } from "../utils/sass.js";
|
|
8
8
|
import { generateElevationsCode, generatePaletteCode, generateTypographyCode } from "../utils/sass.js";
|
|
9
9
|
function generatePalette(input) {
|
|
10
10
|
const variant = input.variant ?? "light";
|
|
@@ -42,8 +42,16 @@ function generateTypography(input) {
|
|
|
42
42
|
const typeScaleVar = `$${designSystem}-type-scale`;
|
|
43
43
|
const preset = TYPOGRAPHY_PRESETS[designSystem];
|
|
44
44
|
const typeface = input.fontFamily || preset.typeface;
|
|
45
|
+
const presetImports = generatePresetImports({
|
|
46
|
+
platform: input.platform,
|
|
47
|
+
includeTypography: true
|
|
48
|
+
});
|
|
49
|
+
const imports = [
|
|
50
|
+
generateUseStatement(input.platform, input.licensed),
|
|
51
|
+
...presetImports
|
|
52
|
+
].join("\n");
|
|
45
53
|
const code = `${generateHeader(`Typography setup using ${designSystem} type scale`)}
|
|
46
|
-
${
|
|
54
|
+
${imports}
|
|
47
55
|
|
|
48
56
|
// Typography setup with ${designSystem} type scale
|
|
49
57
|
@include typography(
|
|
@@ -60,8 +68,16 @@ ${generateUseStatement(input.platform, input.licensed)}
|
|
|
60
68
|
function generateElevations(input) {
|
|
61
69
|
const preset = input.designSystem ?? "material";
|
|
62
70
|
const elevationsVar = `$${preset}-elevations`;
|
|
71
|
+
const presetImports = generatePresetImports({
|
|
72
|
+
platform: input.platform,
|
|
73
|
+
includeElevations: true
|
|
74
|
+
});
|
|
75
|
+
const imports = [
|
|
76
|
+
generateUseStatement(input.platform, input.licensed),
|
|
77
|
+
...presetImports
|
|
78
|
+
].join("\n");
|
|
63
79
|
const code = `${generateHeader(`Elevations setup using ${preset} preset`)}
|
|
64
|
-
${
|
|
80
|
+
${imports}
|
|
65
81
|
|
|
66
82
|
// Elevations setup with ${preset} shadows
|
|
67
83
|
@include elevations(${elevationsVar});
|
|
@@ -165,12 +181,18 @@ function generateGenericTheme(input, designSystem, variant) {
|
|
|
165
181
|
} else {
|
|
166
182
|
paletteArgs.push(`$surface: ${variant === "dark" ? "#222222" : "white"}`);
|
|
167
183
|
}
|
|
184
|
+
const presetImports = generatePresetImports({
|
|
185
|
+
platform: input.platform,
|
|
186
|
+
includeTypography,
|
|
187
|
+
includeElevations
|
|
188
|
+
});
|
|
168
189
|
const sections = [
|
|
169
190
|
generateHeader(
|
|
170
191
|
`Complete ${variant} theme based on ${designSystem} design system`
|
|
171
192
|
),
|
|
172
193
|
'// NOTE: Specify platform ("angular" or "webcomponents") for optimized output',
|
|
173
194
|
generateUseStatement(input.platform, input.licensed),
|
|
195
|
+
...presetImports,
|
|
174
196
|
"",
|
|
175
197
|
`// ${themeName} palette`,
|
|
176
198
|
`${paletteVar}: palette(`,
|
|
@@ -263,6 +285,7 @@ export {
|
|
|
263
285
|
generateHeader,
|
|
264
286
|
generatePalette,
|
|
265
287
|
generatePaletteCode,
|
|
288
|
+
generatePresetImports,
|
|
266
289
|
generateTheme,
|
|
267
290
|
generateTypography,
|
|
268
291
|
generateTypographyCode,
|
package/dist/mcp/index.js
CHANGED
|
@@ -21,7 +21,7 @@ import { SHADE_LEVELS, ACCENT_SHADE_LEVELS, PALETTE_COLOR_GROUPS } from "./utils
|
|
|
21
21
|
function createServer() {
|
|
22
22
|
const server = new McpServer({
|
|
23
23
|
name: "igniteui-theming",
|
|
24
|
-
version: "v25.0.
|
|
24
|
+
version: "v25.0.1",
|
|
25
25
|
description: "Generate Sass theming code for Ignite UI components - create palettes, typography, elevations, and complete themes"
|
|
26
26
|
});
|
|
27
27
|
registerTools(server);
|
|
@@ -276,7 +276,7 @@ function buildReadResourceDescription() {
|
|
|
276
276
|
const groups = {
|
|
277
277
|
Platforms: [],
|
|
278
278
|
Presets: [],
|
|
279
|
-
|
|
279
|
+
Guidance: [],
|
|
280
280
|
"Layout Docs": []
|
|
281
281
|
};
|
|
282
282
|
for (const r of RESOURCE_DEFINITIONS) {
|
|
@@ -285,7 +285,7 @@ function buildReadResourceDescription() {
|
|
|
285
285
|
} else if (r.uri.includes("://presets/")) {
|
|
286
286
|
groups.Presets.push(r);
|
|
287
287
|
} else if (r.uri.includes("://guidance/")) {
|
|
288
|
-
groups
|
|
288
|
+
groups.Guidance.push(r);
|
|
289
289
|
} else if (r.uri.includes("://docs/")) {
|
|
290
290
|
groups["Layout Docs"].push(r);
|
|
291
291
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
const PLATFORM_SETUP_MARKDOWN = "# Platform Setup Guide\n\nThis document is an instruction resource for AI agents using the Ignite UI Theming MCP. It describes how to detect, configure, and work with target platforms. Follow these rules when helping a user set up theming in their project.\n\n---\n\n## Step 1: Always Detect First\n\n**ALWAYS** call `detect_platform` before generating any theme code. Do not assume a platform; do not skip detection even if the user mentions a framework by name — detection confirms the actual project setup and returns Sass configuration guidance.\n\n```\ndetect_platform({ packageJsonPath: \"./package.json\" })\n```\n\nThe result determines every subsequent tool call's `platform` parameter.\n\n---\n\n## Step 2: Interpret the Detection Result\n\n### High-confidence product detection\n\nWhen `confidence` is `\"high\"` and `platform` is one of `angular`, `webcomponents`, `react`, or `blazor`:\n\n- Use the returned `platform` value in all subsequent tool calls.\n- Use the `platformInfo.themingModule` value for Sass import guidance.\n- If `licensed` is `true` (Angular only), also pass `licensed: true` to theme generation tools.\n\n### Generic (standalone) mode\n\nWhen `platform` is `\"generic\"`:\n\n- No Ignite UI product framework was found. The project can still use `igniteui-theming` directly.\n- Use `platform: \"generic\"` in all subsequent tool calls.\n- The Sass import is `@use 'igniteui-theming' as *;`.\n\n**Tool eligibility in generic mode:**\n\n| Tool | Available | Notes |\n| ----------------------------- | --------- | -------------------------------------- |\n| `create_palette` | YES | Full functionality |\n| `create_custom_palette` | YES | Full functionality |\n| `create_typography` | YES | Full functionality |\n| `create_elevations` | YES | Full functionality |\n| `create_theme` | YES | Full functionality |\n| `set_size` | YES | Use `scope`, not `component` |\n| `set_spacing` | YES | Use `scope`, not `component` |\n| `set_roundness` | YES | Use `scope`, not `component` |\n| `get_color` | YES | Full functionality |\n| `read_resource` | YES | Full functionality |\n| `create_component_theme` | **NO** | Requires Ignite UI component selectors |\n| `get_component_design_tokens` | **NO** | Requires Ignite UI components |\n\n**IMPORTANT:** For layout tools (`set_size`, `set_spacing`, `set_roundness`) in generic mode, do NOT use the `component` parameter — it resolves Ignite UI component selectors that don't exist in the project. Use `scope` with a custom CSS selector, or omit both for `:root` targeting.\n\n### Ambiguous detection\n\nWhen `ambiguous` is `true` and `platform` is `null`:\n\n- Multiple Ignite UI products were detected (e.g., both Angular and React packages).\n- Do NOT guess. Ask the user which platform to target.\n- Present the `alternatives` array from the result so the user can choose.\n\n### Null / error state\n\nWhen `platform` is `null` and `ambiguous` is not `true`:\n\n- Something went wrong (package.json unreadable, invalid structure).\n- Report the `reason` to the user and ask them to specify a platform manually.\n- Suggest `\"generic\"` if they don't use an Ignite UI product.\n\n---\n\n## Step 3: Configure Sass Load Paths\n\nIf the user will consume **Sass output** (not CSS), they need `node_modules` in their Sass compiler's load paths so that `@use 'igniteui-theming' as *;` resolves correctly.\n\nThe `detect_platform` response includes config-file signals. Use them to give the right guidance:\n\n### Angular (`angular.json` detected)\n\n```json\n// In angular.json → architect → build → options:\n\"stylePreprocessorOptions\": {\n \"includePaths\": [\"node_modules\"]\n}\n```\n\n### Vite (`vite.config.*` detected)\n\n```js\n// In vite.config.ts/js:\nexport default defineConfig({\n css: {\n preprocessorOptions: {\n scss: {\n loadPaths: ['node_modules'],\n },\n },\n },\n});\n```\n\n### Next.js (`next.config.*` detected)\n\n```js\n// In next.config.js/mjs/ts:\nmodule.exports = {\n sassOptions: {\n loadPaths: ['node_modules'],\n },\n};\n```\n\n### Other / unknown build tools\n\nIf no recognizable config file was detected, instruct the user to add `node_modules` to their Sass compiler's `loadPaths`. Angular CLI is the exception — it uses `includePaths` in `angular.json`. Investigate the project's build configuration to find the right setting.\n\n### When load paths are NOT needed\n\n- **CSS output**: CSS output is compiled server-side by the MCP. No local Sass toolchain or load path configuration is required. The user can paste the CSS output directly.\n- **Angular with Ignite UI for Angular**: The `igniteui-angular/theming` module is already resolved by Angular's build system when the package is installed.\n\n---\n\n## Step 4: Handle the igniteui-theming Dependency\n\nCheck whether `igniteui-theming` (or a product package like `igniteui-angular`) is in the project's dependencies.\n\n### Package IS installed\n\n- Sass output will work once load paths are configured.\n- CSS output works regardless.\n\n### Package is NOT installed\n\n- **CSS output** still works — the MCP compiles it server-side. Recommend this path for quick results.\n- **Sass output** requires the package to be resolvable. The user must either:\n - Run `npm install igniteui-theming` (or the product-specific package), OR\n - Ensure the package is available via `loadPaths` from a parent `node_modules`.\n\nWhen in doubt, suggest CSS output first — it has zero local dependencies.\n\n---\n\n## Step 5: Recommended Workflow\n\nAfter detection and setup, follow this order for a complete theme:\n\n1. **`detect_platform`** — Determine platform and configuration needs.\n2. **`create_palette`** or **`create_custom_palette`** — Define the color system.\n - Read `theming://guidance/colors/rules` first if unsure about surface/gray color choices.\n3. **`create_typography`** — Set up the type scale (optional but recommended).\n4. **`create_elevations`** — Configure shadows (optional).\n5. **`create_theme`** — Generate the complete theme that brings everything together.\n6. **Layout tools** — Use `set_size`, `set_spacing`, `set_roundness` if the user wants to customize layout tokens.\n7. **`create_component_theme`** — Customize individual component appearances (only for product platforms, NOT generic).\n\n### Output format decision\n\n- Offer **CSS output** when the user wants quick, dependency-free results or is working in a non-Sass environment.\n- Offer **Sass output** when the user has a Sass toolchain set up and wants the flexibility of Sass variables and functions.\n- When both are viable, mention both options and let the user choose.\n\n---\n\n## Platform-Specific Notes\n\n### Angular\n\n- Uses `igniteui-angular/theming` (free) or `@infragistics/igniteui-angular/theming` (licensed) (not `igniteui-theming` directly).\n- Licensed packages use `@infragistics/igniteui-angular/theming` — pass `licensed: true`.\n- Requires `core()` mixin before `theme()` mixin.\n- Typography requires the `ig-typography` CSS class on the root element.\n- Read `theming://platforms/angular` for full platform configuration and usage examples.\n\n### Web Components\n\n- Uses `igniteui-theming` directly.\n- Provides runtime theming via `defineComponents()` and `register()` APIs.\n- Read `theming://platforms/webcomponents` for configuration and runtime config.\n\n### React\n\n- Uses `igniteui-theming` directly (same as Web Components).\n- Read `theming://platforms/react` for configuration and usage examples.\n\n### Blazor\n\n- Uses `igniteui-theming` directly (same as Web Components).\n- Detection relies on `.csproj` files with IgniteUI.Blazor references.\n- Read `theming://platforms/blazor` for configuration and usage examples.\n\n### Generic (Standalone)\n\n- Uses `igniteui-theming` directly.\n- No Ignite UI components — all theme output applies globally via CSS custom properties.\n- Component-specific tools are not available.\n- Layout tools work only with `:root` or custom `scope` selectors.\n- Read `theming://platforms/generic` for presets available in this mode.\n\n### Preset imports for non-Angular platforms\n\nFor all non-Angular platforms (Web Components, React, Blazor, Generic), using preset variables such as `$material-type-scale`, `$indigo-type-scale`, `$material-elevations`, or `$indigo-elevations` requires additional `@use` imports beyond the base `@use 'igniteui-theming' as *;`:\n\n```scss\n// Base module (always required)\n@use 'igniteui-theming' as *;\n\n// Typography presets (required for $<designSystem>-type-scale variables)\n@use 'igniteui-theming/sass/typography/presets' as *;\n\n// Elevation presets (required for $material-elevations / $indigo-elevations)\n@use 'igniteui-theming/sass/elevations/presets' as *;\n```\n\nThe MCP tools (`create_typography`, `create_elevations`, `create_theme`) automatically include these imports in their generated Sass output. Angular is not affected — its `igniteui-angular/theming` module re-exports all presets.\n\n---\n\n## Related Resources\n\n| Resource | URI | When to read |\n| ------------------- | ----------------------------------- | ---------------------------------- |\n| Supported Platforms | `theming://platforms` | To list all platforms and metadata |\n| Color Guidance | `theming://guidance/colors` | Before creating palettes |\n| Color Rules | `theming://guidance/colors/rules` | For surface/gray color decisions |\n| Spacing & Sizing | `theming://docs/spacing-and-sizing` | Before using layout tools |\n";
|
|
2
|
+
export {
|
|
3
|
+
PLATFORM_SETUP_MARKDOWN as default
|
|
4
|
+
};
|
|
@@ -11,6 +11,6 @@ export { BORDER_RADIUS_FUNCTION_DOC, LAYOUT_OVERVIEW_DOC, PAD_FUNCTION_DOC, SIZA
|
|
|
11
11
|
export { ACCENT_SHADE_LEVELS, type AccentShadeLevel, COLOR_MULTIPLIERS, GRAYSCALE_MULTIPLIERS, SHADE_LEVELS, type ShadeLevel, type ShadeMultipliers, } from './multipliers.js';
|
|
12
12
|
export { DARK_PALETTE_PRESETS, LIGHT_PALETTE_PRESETS, PALETTE_PRESETS, type PaletteColors, type PalettePresetName, } from './palettes.js';
|
|
13
13
|
export { ELEVATIONS as ELEVATIONS_PRESETS, PALETTE_PRESETS_PATHS, PALETTES as PALETTES_PRESETS, SCHEMAS as SCHEMA_PRESETS, TYPE_SCALES as TYPE_SCALE_PRESETS, TYPEFACES as TYPEFACE_PRESETS, TYPOGRAPHY_PRESETS_PATHS, } from './platforms/common.js';
|
|
14
|
-
export { ANGULAR_PLATFORM, ANGULAR_USAGE_EXAMPLES, type AngularThemeTemplate, BLAZOR_PLATFORM, BLAZOR_USAGE_EXAMPLES, type ConfigFileDetectionSignal, type CoreMixinOptions, type DetectionSignal, detectConfigFiles, detectPlatformFromDependencies, type FrameworkDetectionSignal, generateAngularThemeSass, generateWebComponentsThemeSass,
|
|
14
|
+
export { ANGULAR_PLATFORM, ANGULAR_USAGE_EXAMPLES, type AngularThemeTemplate, BLAZOR_PLATFORM, BLAZOR_USAGE_EXAMPLES, type ConfigFileDetectionSignal, type CoreMixinOptions, type DetectionSignal, detectConfigFiles, detectPlatformFromDependencies, type FrameworkDetectionSignal, generateAngularThemeSass, generateWebComponentsThemeSass, isLicensedPackage, type PackageDetectionSignal, PLATFORM_METADATA, type Platform, type PlatformAlternative, type PlatformDetectionResult, REACT_PLATFORM, REACT_USAGE_EXAMPLES, type ThemeMixinOptions, WEBCOMPONENTS_PLATFORM, WEBCOMPONENTS_RUNTIME_CONFIG, WEBCOMPONENTS_USAGE_EXAMPLES, type WebComponentsThemeTemplate, } from './platforms/index.js';
|
|
15
15
|
export { CORE_MIXIN, type CoreMixinParams, CSS_VARIABLE_PATTERNS, ELEVATIONS_MIXIN, type ElevationsMixinParams, getElevationsVariable, getImportPath, getPaletteColorGroups, IMPORT_PATHS, isMixinSupported, PALETTE_FUNCTION, PALETTE_MIXIN, type PaletteFunctionParams, type PaletteMixinParams, SHADES_FUNCTION, type ShadesFunctionParams, SPACING_MIXIN, THEME_MIXIN, type ThemeMixinParams, TYPOGRAPHY_MIXIN, type TypographyMixinParams, VARIABLE_PATTERNS, } from './sass-api.js';
|
|
16
16
|
export { type DesignSystem, TYPE_SCALE_CATEGORIES, TYPOGRAPHY_PRESETS, type TypeScale, type TypeScaleCategory, type TypeStyle, } from './typography.js';
|
|
@@ -17,8 +17,7 @@ import { ACCENT_SHADE_LEVELS, SHADE_LEVELS } from "../utils/types.js";
|
|
|
17
17
|
import { DARK_PALETTE_PRESETS, LIGHT_PALETTE_PRESETS, PALETTE_PRESETS } from "./palettes.js";
|
|
18
18
|
import { SCHEMAS } from "./platforms/common.js";
|
|
19
19
|
import { ELEVATIONS, PALETTES, PALETTE_PRESETS_PATHS, TYPEFACES, TYPE_SCALES, TYPOGRAPHY_PRESETS_PATHS } from "./platforms/common.js";
|
|
20
|
-
import {
|
|
21
|
-
import { PLATFORM_METADATA, PLATFORM_VARIABLE_PREFIX, detectConfigFiles, detectPlatformFromDependencies, isLicensedPackage } from "./platforms/index.js";
|
|
20
|
+
import { PLATFORM_METADATA, detectConfigFiles, detectPlatformFromDependencies, isLicensedPackage } from "./platforms/index.js";
|
|
22
21
|
import { TYPOGRAPHY_PRESETS } from "./typography.js";
|
|
23
22
|
import { ANGULAR_PLATFORM, ANGULAR_USAGE_EXAMPLES, generateAngularThemeSass } from "./platforms/angular.js";
|
|
24
23
|
import { BLAZOR_PLATFORM, BLAZOR_USAGE_EXAMPLES } from "./platforms/blazor.js";
|
|
@@ -54,7 +53,6 @@ export {
|
|
|
54
53
|
PALETTE_PRESETS,
|
|
55
54
|
PALETTE_PRESETS_PATHS,
|
|
56
55
|
PLATFORM_METADATA,
|
|
57
|
-
PLATFORM_VARIABLE_PREFIX,
|
|
58
56
|
REACT_PLATFORM,
|
|
59
57
|
REACT_USAGE_EXAMPLES,
|
|
60
58
|
SCHEMAS as SCHEMA_PRESETS,
|
|
@@ -82,7 +80,6 @@ export {
|
|
|
82
80
|
getCompoundComponentInfo,
|
|
83
81
|
getTokenDerivationsForChild,
|
|
84
82
|
getTokenNames,
|
|
85
|
-
getVariablePrefix,
|
|
86
83
|
getVariants,
|
|
87
84
|
hasVariants,
|
|
88
85
|
isComponentAvailable,
|
|
@@ -92,17 +92,6 @@ export declare function detectConfigFiles(projectRoot?: string): ConfigFileSigna
|
|
|
92
92
|
* @returns Platform detection result with signals and confidence
|
|
93
93
|
*/
|
|
94
94
|
export declare function detectPlatformFromDependencies(dependencies?: Record<string, string>, devDependencies?: Record<string, string>, projectRoot?: string): PlatformDetectionResult;
|
|
95
|
-
/**
|
|
96
|
-
* CSS variable prefix for each platform.
|
|
97
|
-
* Angular uses 'igx-' prefix, all other platforms use 'ig-' prefix.
|
|
98
|
-
*/
|
|
99
|
-
export declare const PLATFORM_VARIABLE_PREFIX: Record<Platform, string>;
|
|
100
|
-
/**
|
|
101
|
-
* Get the CSS variable prefix for a given platform
|
|
102
|
-
* @param platform - The platform to get the prefix for
|
|
103
|
-
* @returns The CSS variable prefix (e.g., 'igx' for Angular, 'ig' for others)
|
|
104
|
-
*/
|
|
105
|
-
export declare function getVariablePrefix(platform: Platform): string;
|
|
106
95
|
/**
|
|
107
96
|
* Determine if a detected package is a licensed @infragistics package.
|
|
108
97
|
* Only applies to Angular - other platforms always use the free igniteui-theming package.
|
|
@@ -149,4 +138,12 @@ export declare const PLATFORM_METADATA: {
|
|
|
149
138
|
readonly themingModule: "igniteui-theming";
|
|
150
139
|
readonly 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.";
|
|
151
140
|
};
|
|
141
|
+
readonly generic: {
|
|
142
|
+
readonly id: "generic";
|
|
143
|
+
readonly name: "Ignite UI Theming (Standalone)";
|
|
144
|
+
readonly shortName: "Generic";
|
|
145
|
+
readonly packageName: "igniteui-theming";
|
|
146
|
+
readonly themingModule: "igniteui-theming";
|
|
147
|
+
readonly 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.";
|
|
148
|
+
};
|
|
152
149
|
};
|
|
@@ -12,8 +12,10 @@ const IGNITE_PACKAGE_PATTERNS = {
|
|
|
12
12
|
"@infragistics/igniteui-webcomponents"
|
|
13
13
|
],
|
|
14
14
|
react: ["igniteui-react", "@infragistics/igniteui-react"],
|
|
15
|
-
blazor: []
|
|
15
|
+
blazor: [],
|
|
16
16
|
// Blazor uses NuGet, not npm - detected via .csproj
|
|
17
|
+
generic: []
|
|
18
|
+
// Generic is platform-agnostic; not detectable from packages
|
|
17
19
|
};
|
|
18
20
|
const FRAMEWORK_PACKAGE_PATTERNS = {
|
|
19
21
|
"@angular/core": "angular",
|
|
@@ -118,12 +120,21 @@ function detectPlatformFromDependencies(dependencies = {}, devDependencies = {},
|
|
|
118
120
|
}
|
|
119
121
|
}
|
|
120
122
|
}
|
|
123
|
+
const hasIgniteProduct = signals.some((s) => s.type === "ignite_package") || signals.some((s) => s.type === "config_file" && s.confidence === 100);
|
|
121
124
|
if (platformScores.size === 0) {
|
|
122
125
|
return {
|
|
123
|
-
platform:
|
|
126
|
+
platform: "generic",
|
|
124
127
|
confidence: "none",
|
|
125
128
|
signals: [],
|
|
126
|
-
reason: "No Ignite UI packages, framework packages, or config files detected"
|
|
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."
|
|
127
138
|
};
|
|
128
139
|
}
|
|
129
140
|
const sorted = Array.from(platformScores.entries()).sort(
|
|
@@ -186,15 +197,6 @@ function detectPlatformFromDependencies(dependencies = {}, devDependencies = {},
|
|
|
186
197
|
reason: `Detected ${topPlatform} with ${confidenceLevel} confidence (score: ${topScore})`
|
|
187
198
|
};
|
|
188
199
|
}
|
|
189
|
-
const PLATFORM_VARIABLE_PREFIX = {
|
|
190
|
-
angular: "igx",
|
|
191
|
-
webcomponents: "ig",
|
|
192
|
-
react: "ig",
|
|
193
|
-
blazor: "ig"
|
|
194
|
-
};
|
|
195
|
-
function getVariablePrefix(platform) {
|
|
196
|
-
return PLATFORM_VARIABLE_PREFIX[platform];
|
|
197
|
-
}
|
|
198
200
|
function isLicensedPackage(detectedPackage) {
|
|
199
201
|
return detectedPackage?.startsWith("@infragistics/") ?? false;
|
|
200
202
|
}
|
|
@@ -232,13 +234,19 @@ const PLATFORM_METADATA = {
|
|
|
232
234
|
packageName: "IgniteUI.Blazor",
|
|
233
235
|
themingModule: "igniteui-theming",
|
|
234
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."
|
|
235
245
|
}
|
|
236
246
|
};
|
|
237
247
|
export {
|
|
238
248
|
PLATFORM_METADATA,
|
|
239
|
-
PLATFORM_VARIABLE_PREFIX,
|
|
240
249
|
detectConfigFiles,
|
|
241
250
|
detectPlatformFromDependencies,
|
|
242
|
-
getVariablePrefix,
|
|
243
251
|
isLicensedPackage
|
|
244
252
|
};
|
|
@@ -37,8 +37,8 @@ export declare const REACT_PLATFORM: {
|
|
|
37
37
|
*/
|
|
38
38
|
export declare const REACT_USAGE_EXAMPLES: {
|
|
39
39
|
readonly basic: "\n// Basic Material Light Theme for React (Vite)\n// In your styles.scss or theme.scss file:\n\n@use 'igniteui-theming/sass/color/presets/light/material' as *;\n@use 'igniteui-theming' as *;\n@use 'igniteui-theming/sass/typography/presets/material' as *;\n@use 'igniteui-theming/sass/elevations/presets' as *;\n\n:root {\n --ig-theme: material;\n --ig-theme-variant: light;\n --ig-size-small: 1;\n --ig-size-medium: 2;\n --ig-size-large: 3;\n --ig-scrollbar-size: #{rem(16px)};\n}\n\n@include palette($palette);\n@include elevations($material-elevations);\n@include typography(\n $font-family: $typeface,\n $type-scale: $type-scale\n);\n@include spacing();\n";
|
|
40
|
-
readonly viteConfig: "\n// vite.config.ts - Sass configuration for Ignite UI theming\nimport { defineConfig } from 'vite';\nimport react from '@vitejs/plugin-react';\n\nexport default defineConfig({\n plugins: [react()],\n css: {\n preprocessorOptions: {\n scss: {\n // Add node_modules to
|
|
41
|
-
readonly nextjsConfig: "\n// next.config.js - Sass configuration for Next.js\nconst path = require('path');\n\nmodule.exports = {\n sassOptions: {\n
|
|
40
|
+
readonly viteConfig: "\n// vite.config.ts - Sass configuration for Ignite UI theming\nimport { defineConfig } from 'vite';\nimport react from '@vitejs/plugin-react';\n\nexport default defineConfig({\n plugins: [react()],\n css: {\n preprocessorOptions: {\n scss: {\n // Add node_modules to load paths for @use statements\n loadPaths: ['node_modules'],\n },\n },\n },\n});\n";
|
|
41
|
+
readonly nextjsConfig: "\n// next.config.js - Sass configuration for Next.js\nconst path = require('path');\n\nmodule.exports = {\n sassOptions: {\n loadPaths: [path.join(__dirname, 'node_modules')],\n },\n};\n";
|
|
42
42
|
readonly customPalette: "\n// Custom Palette Theme for React\n@use 'igniteui-theming' as *;\n@use 'igniteui-theming/sass/typography/presets/material' as *;\n@use 'igniteui-theming/sass/elevations/presets' as *;\n\n$my-palette: palette(\n $primary: #2ab759,\n $secondary: #f96a88,\n $surface: #ffffff\n);\n\n:root {\n --ig-theme: material;\n --ig-theme-variant: light;\n --ig-size-small: 1;\n --ig-size-medium: 2;\n --ig-size-large: 3;\n}\n\n@include palette($my-palette);\n@include elevations($material-elevations);\n@include typography(\n $font-family: $typeface,\n $type-scale: $type-scale\n);\n@include spacing();\n";
|
|
43
43
|
readonly darkTheme: "\n// Dark Indigo Theme for React\n@use 'igniteui-theming' as *;\n@use 'igniteui-theming/sass/typography/presets/indigo' as *;\n@use 'igniteui-theming/sass/elevations/presets' as *;\n\n:root {\n --ig-theme: indigo;\n --ig-theme-variant: dark;\n --ig-size-small: 1;\n --ig-size-medium: 2;\n --ig-size-large: 3;\n}\n\n@include palette($palette);\n@include elevations($indigo-elevations);\n@include typography(\n $font-family: $typeface,\n $type-scale: $type-scale\n);\n@include spacing();\n";
|
|
44
44
|
};
|
|
@@ -61,8 +61,8 @@ export default defineConfig({
|
|
|
61
61
|
css: {
|
|
62
62
|
preprocessorOptions: {
|
|
63
63
|
scss: {
|
|
64
|
-
// Add node_modules to
|
|
65
|
-
|
|
64
|
+
// Add node_modules to load paths for @use statements
|
|
65
|
+
loadPaths: ['node_modules'],
|
|
66
66
|
},
|
|
67
67
|
},
|
|
68
68
|
},
|
|
@@ -74,7 +74,7 @@ const path = require('path');
|
|
|
74
74
|
|
|
75
75
|
module.exports = {
|
|
76
76
|
sassOptions: {
|
|
77
|
-
|
|
77
|
+
loadPaths: [path.join(__dirname, 'node_modules')],
|
|
78
78
|
},
|
|
79
79
|
};
|
|
80
80
|
`,
|
|
@@ -11,8 +11,8 @@ export declare const IMPORT_PATHS: {
|
|
|
11
11
|
readonly react: "igniteui-theming";
|
|
12
12
|
/** Direct igniteui-theming module for Blazor */
|
|
13
13
|
readonly blazor: "igniteui-theming";
|
|
14
|
-
/**
|
|
15
|
-
readonly
|
|
14
|
+
/** Generic / platform-agnostic code */
|
|
15
|
+
readonly generic: "igniteui-theming";
|
|
16
16
|
};
|
|
17
17
|
/**
|
|
18
18
|
* Get the appropriate import path for a platform.
|
|
@@ -15,11 +15,13 @@ export declare const RESOURCE_URIS: {
|
|
|
15
15
|
readonly PLATFORM_WEBCOMPONENTS: "theming://platforms/webcomponents";
|
|
16
16
|
readonly PLATFORM_REACT: "theming://platforms/react";
|
|
17
17
|
readonly PLATFORM_BLAZOR: "theming://platforms/blazor";
|
|
18
|
+
readonly PLATFORM_GENERIC: "theming://platforms/generic";
|
|
18
19
|
readonly PALETTES: "theming://presets/palettes";
|
|
19
20
|
readonly PALETTES_LIGHT: "theming://presets/palettes/light";
|
|
20
21
|
readonly PALETTES_DARK: "theming://presets/palettes/dark";
|
|
21
22
|
readonly TYPOGRAPHY: "theming://presets/typography";
|
|
22
23
|
readonly ELEVATIONS: "theming://presets/elevations";
|
|
24
|
+
readonly GUIDANCE_PLATFORM_SETUP: "theming://guidance/platform-setup";
|
|
23
25
|
readonly GUIDANCE_COLORS: "theming://guidance/colors";
|
|
24
26
|
readonly GUIDANCE_COLORS_RULES: "theming://guidance/colors/rules";
|
|
25
27
|
readonly GUIDANCE_COLORS_USAGE: "theming://guidance/colors/usage";
|
|
@@ -62,6 +64,11 @@ export declare const RESOURCE_DEFINITIONS: ({
|
|
|
62
64
|
name: string;
|
|
63
65
|
description: string;
|
|
64
66
|
mimeType: string;
|
|
67
|
+
} | {
|
|
68
|
+
uri: "theming://platforms/generic";
|
|
69
|
+
name: string;
|
|
70
|
+
description: string;
|
|
71
|
+
mimeType: string;
|
|
65
72
|
} | {
|
|
66
73
|
uri: "theming://presets/palettes";
|
|
67
74
|
name: string;
|
|
@@ -87,6 +94,11 @@ export declare const RESOURCE_DEFINITIONS: ({
|
|
|
87
94
|
name: string;
|
|
88
95
|
description: string;
|
|
89
96
|
mimeType: string;
|
|
97
|
+
} | {
|
|
98
|
+
uri: "theming://guidance/platform-setup";
|
|
99
|
+
name: string;
|
|
100
|
+
description: string;
|
|
101
|
+
mimeType: string;
|
|
90
102
|
} | {
|
|
91
103
|
uri: "theming://guidance/colors";
|
|
92
104
|
name: string;
|
|
@@ -9,6 +9,7 @@ import SIZING_MIXIN_DOC from "../knowledge/docs/layout/mixins/sizing.md.js";
|
|
|
9
9
|
import SPACING_MIXIN_DOC from "../knowledge/docs/layout/mixins/spacing.md.js";
|
|
10
10
|
import LAYOUT_OVERVIEW_DOC from "../knowledge/docs/layout/overview.md.js";
|
|
11
11
|
import { PALETTE_PRESETS, LIGHT_PALETTE_PRESETS, DARK_PALETTE_PRESETS } from "../knowledge/palettes.js";
|
|
12
|
+
import PLATFORM_SETUP_MARKDOWN from "../knowledge/docs/setup/platform.md.js";
|
|
12
13
|
import { ANGULAR_USAGE_EXAMPLES, ANGULAR_PLATFORM } from "../knowledge/platforms/angular.js";
|
|
13
14
|
import { BLAZOR_USAGE_EXAMPLES, BLAZOR_PLATFORM } from "../knowledge/platforms/blazor.js";
|
|
14
15
|
import { ELEVATIONS, TYPE_SCALES, TYPEFACES, SCHEMAS } from "../knowledge/platforms/common.js";
|
|
@@ -26,12 +27,15 @@ const RESOURCE_URIS = {
|
|
|
26
27
|
PLATFORM_WEBCOMPONENTS: `${RESOURCE_SCHEME}://platforms/webcomponents`,
|
|
27
28
|
PLATFORM_REACT: `${RESOURCE_SCHEME}://platforms/react`,
|
|
28
29
|
PLATFORM_BLAZOR: `${RESOURCE_SCHEME}://platforms/blazor`,
|
|
30
|
+
PLATFORM_GENERIC: `${RESOURCE_SCHEME}://platforms/generic`,
|
|
29
31
|
// Preset resources
|
|
30
32
|
PALETTES: `${RESOURCE_SCHEME}://presets/palettes`,
|
|
31
33
|
PALETTES_LIGHT: `${RESOURCE_SCHEME}://presets/palettes/light`,
|
|
32
34
|
PALETTES_DARK: `${RESOURCE_SCHEME}://presets/palettes/dark`,
|
|
33
35
|
TYPOGRAPHY: `${RESOURCE_SCHEME}://presets/typography`,
|
|
34
36
|
ELEVATIONS: `${RESOURCE_SCHEME}://presets/elevations`,
|
|
37
|
+
// Platform setup guidance
|
|
38
|
+
GUIDANCE_PLATFORM_SETUP: `${RESOURCE_SCHEME}://guidance/platform-setup`,
|
|
35
39
|
// Color guidance resources (organized under colors/ parent)
|
|
36
40
|
GUIDANCE_COLORS: `${RESOURCE_SCHEME}://guidance/colors`,
|
|
37
41
|
GUIDANCE_COLORS_RULES: `${RESOURCE_SCHEME}://guidance/colors/rules`,
|
|
@@ -80,6 +84,12 @@ const RESOURCE_DEFINITIONS = [
|
|
|
80
84
|
description: "Ignite UI for Blazor platform configuration, schemas, palettes, and usage examples",
|
|
81
85
|
mimeType: "application/json"
|
|
82
86
|
},
|
|
87
|
+
{
|
|
88
|
+
uri: RESOURCE_URIS.PLATFORM_GENERIC,
|
|
89
|
+
name: "Generic Platform Config",
|
|
90
|
+
description: "Platform-agnostic theming configuration using igniteui-theming standalone, with presets for schemas, palettes, typography, and elevations",
|
|
91
|
+
mimeType: "application/json"
|
|
92
|
+
},
|
|
83
93
|
// Preset resources
|
|
84
94
|
{
|
|
85
95
|
uri: RESOURCE_URIS.PALETTES,
|
|
@@ -111,6 +121,13 @@ const RESOURCE_DEFINITIONS = [
|
|
|
111
121
|
description: "Elevation/shadow presets (Material and Indigo)",
|
|
112
122
|
mimeType: "application/json"
|
|
113
123
|
},
|
|
124
|
+
// Platform setup guidance
|
|
125
|
+
{
|
|
126
|
+
uri: RESOURCE_URIS.GUIDANCE_PLATFORM_SETUP,
|
|
127
|
+
name: "Platform Setup Guide",
|
|
128
|
+
description: "Instruction guide for platform detection, Sass configuration, dependency handling, and the recommended theming workflow. Read this before generating theme code.",
|
|
129
|
+
mimeType: "text/markdown"
|
|
130
|
+
},
|
|
114
131
|
// Color guidance resources (organized under colors/ parent)
|
|
115
132
|
{
|
|
116
133
|
uri: RESOURCE_URIS.GUIDANCE_COLORS,
|
|
@@ -199,7 +216,7 @@ const RESOURCE_HANDLERS = /* @__PURE__ */ new Map([
|
|
|
199
216
|
() => ({
|
|
200
217
|
content: JSON.stringify(
|
|
201
218
|
{
|
|
202
|
-
platforms: ["angular", "webcomponents", "react", "blazor"],
|
|
219
|
+
platforms: ["angular", "webcomponents", "react", "blazor", "generic"],
|
|
203
220
|
metadata: PLATFORM_METADATA
|
|
204
221
|
},
|
|
205
222
|
null,
|
|
@@ -285,6 +302,24 @@ const RESOURCE_HANDLERS = /* @__PURE__ */ new Map([
|
|
|
285
302
|
mimeType: "application/json"
|
|
286
303
|
})
|
|
287
304
|
],
|
|
305
|
+
[
|
|
306
|
+
RESOURCE_URIS.PLATFORM_GENERIC,
|
|
307
|
+
() => ({
|
|
308
|
+
content: JSON.stringify(
|
|
309
|
+
{
|
|
310
|
+
platform: PLATFORM_METADATA.generic,
|
|
311
|
+
schemas: SCHEMAS,
|
|
312
|
+
palettes: PALETTE_PRESETS,
|
|
313
|
+
typefaces: TYPEFACES,
|
|
314
|
+
typography: TYPOGRAPHY_PRESETS,
|
|
315
|
+
elevations: ELEVATION_PRESETS
|
|
316
|
+
},
|
|
317
|
+
null,
|
|
318
|
+
2
|
|
319
|
+
),
|
|
320
|
+
mimeType: "application/json"
|
|
321
|
+
})
|
|
322
|
+
],
|
|
288
323
|
// Preset resources
|
|
289
324
|
[
|
|
290
325
|
RESOURCE_URIS.PALETTES,
|
|
@@ -321,6 +356,14 @@ const RESOURCE_HANDLERS = /* @__PURE__ */ new Map([
|
|
|
321
356
|
mimeType: "application/json"
|
|
322
357
|
})
|
|
323
358
|
],
|
|
359
|
+
// Platform setup guidance
|
|
360
|
+
[
|
|
361
|
+
RESOURCE_URIS.GUIDANCE_PLATFORM_SETUP,
|
|
362
|
+
() => ({
|
|
363
|
+
content: PLATFORM_SETUP_MARKDOWN,
|
|
364
|
+
mimeType: "text/markdown"
|
|
365
|
+
})
|
|
366
|
+
],
|
|
324
367
|
// Color guidance resources
|
|
325
368
|
[
|
|
326
369
|
RESOURCE_URIS.GUIDANCE_COLORS,
|