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,23 +1,35 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { fileURLToPath } from "node:url";
|
|
1
|
+
import { themingImporter } from "../utils/theming-resolve.js";
|
|
3
2
|
import * as sass from "sass-embedded";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
//#region src/generators/css.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generate CSS custom properties for a standard palette.
|
|
6
|
+
*
|
|
7
|
+
* This function compiles Sass code that uses the palette() function and
|
|
8
|
+
* @include palette() mixin, then returns the compiled CSS output.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const result = await generatePaletteCss({
|
|
12
|
+
* primary: '#1976d2',
|
|
13
|
+
* secondary: '#ff9800',
|
|
14
|
+
* surface: '#fafafa',
|
|
15
|
+
* variant: 'light'
|
|
16
|
+
* });
|
|
17
|
+
* // result.css contains :root { --ig-primary-50: ...; --ig-primary-100: ...; ... }
|
|
18
|
+
*/
|
|
7
19
|
async function generatePaletteCss(options) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
@use 'sass/color' as *;
|
|
20
|
+
const variant = options.variant ?? "light";
|
|
21
|
+
const paletteArgs = [
|
|
22
|
+
`$primary: ${options.primary}`,
|
|
23
|
+
`$secondary: ${options.secondary}`,
|
|
24
|
+
`$surface: ${options.surface}`
|
|
25
|
+
];
|
|
26
|
+
if (options.gray) paletteArgs.push(`$gray: ${options.gray}`);
|
|
27
|
+
if (options.info) paletteArgs.push(`$info: ${options.info}`);
|
|
28
|
+
if (options.success) paletteArgs.push(`$success: ${options.success}`);
|
|
29
|
+
if (options.warn) paletteArgs.push(`$warn: ${options.warn}`);
|
|
30
|
+
if (options.error) paletteArgs.push(`$error: ${options.error}`);
|
|
31
|
+
const sassCode = `
|
|
32
|
+
@use 'igniteui-theming/sass/color' as *;
|
|
21
33
|
|
|
22
34
|
$palette: palette(
|
|
23
35
|
${paletteArgs.join(",\n ")}
|
|
@@ -25,83 +37,101 @@ $palette: palette(
|
|
|
25
37
|
|
|
26
38
|
@include palette($palette);
|
|
27
39
|
`;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
}
|
|
40
|
+
try {
|
|
41
|
+
const importers = options._importers ?? [themingImporter];
|
|
42
|
+
return {
|
|
43
|
+
css: (await sass.compileStringAsync(sassCode, {
|
|
44
|
+
importers,
|
|
45
|
+
style: "expanded"
|
|
46
|
+
})).css,
|
|
47
|
+
description: `Generated CSS custom properties for a ${variant} palette with primary color ${options.primary}`
|
|
48
|
+
};
|
|
49
|
+
} catch (error) {
|
|
50
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
51
|
+
throw new Error(`Failed to compile palette CSS: ${message}`);
|
|
52
|
+
}
|
|
42
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Generate CSS custom properties for a custom palette.
|
|
56
|
+
*
|
|
57
|
+
* This function generates Sass code for the custom palette structure
|
|
58
|
+
* (using either shades() function or explicit values), compiles it,
|
|
59
|
+
* and returns the CSS output.
|
|
60
|
+
*/
|
|
43
61
|
async function generateCustomPaletteCss(options) {
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
variableName: "custom",
|
|
49
|
-
surfaceColor: options.surfaceColor,
|
|
50
|
-
colors: options.colors
|
|
51
|
-
});
|
|
52
|
-
const sassCode = `
|
|
53
|
-
@use 'sass/color' as *;
|
|
62
|
+
const variant = options.variant ?? "light";
|
|
63
|
+
const { generateCustomPaletteCode } = await import("../utils/sass.js");
|
|
64
|
+
const sassCode = `
|
|
65
|
+
@use 'igniteui-theming/sass/color' as *;
|
|
54
66
|
|
|
55
|
-
${
|
|
67
|
+
${generateCustomPaletteCode({
|
|
68
|
+
variant,
|
|
69
|
+
variableName: "custom",
|
|
70
|
+
surfaceColor: options.surfaceColor,
|
|
71
|
+
colors: options.colors
|
|
72
|
+
}).join("\n")}
|
|
56
73
|
|
|
57
74
|
@include palette($custom-palette);
|
|
58
75
|
`;
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
}
|
|
76
|
+
try {
|
|
77
|
+
const importers = options._importers ?? [themingImporter];
|
|
78
|
+
return {
|
|
79
|
+
css: (await sass.compileStringAsync(sassCode, {
|
|
80
|
+
importers,
|
|
81
|
+
style: "expanded"
|
|
82
|
+
})).css,
|
|
83
|
+
description: `Generated CSS custom properties for a custom ${variant} palette`
|
|
84
|
+
};
|
|
85
|
+
} catch (error) {
|
|
86
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
87
|
+
throw new Error(`Failed to compile custom palette CSS: ${message}`);
|
|
88
|
+
}
|
|
73
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Format CSS output for display.
|
|
92
|
+
* Adds a header comment and ensures consistent formatting.
|
|
93
|
+
*/
|
|
74
94
|
function formatCssOutput(css, description) {
|
|
75
|
-
|
|
95
|
+
return `/* Generated by Ignite UI Theming MCP Server */
|
|
76
96
|
/* ${description} */
|
|
77
|
-
|
|
78
|
-
return header + css;
|
|
97
|
+
` + css;
|
|
79
98
|
}
|
|
99
|
+
/**
|
|
100
|
+
* Generate CSS custom properties for a component theme.
|
|
101
|
+
*
|
|
102
|
+
* This function compiles Sass code that uses the component theme function
|
|
103
|
+
* and @include tokens() mixin, then returns the compiled CSS output.
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* const result = await generateComponentThemeCss({
|
|
107
|
+
* platform: 'webcomponents',
|
|
108
|
+
* designSystem: 'bootstrap',
|
|
109
|
+
* variant: 'light',
|
|
110
|
+
* component: 'button',
|
|
111
|
+
* tokens: { background: '#1976d2', 'text-color': 'white' },
|
|
112
|
+
* selector: 'igc-button'
|
|
113
|
+
* });
|
|
114
|
+
* // result.css contains: igc-button { --ig-button-background: var(--ig-button-background, #1976d2); ... }
|
|
115
|
+
*/
|
|
80
116
|
async function generateComponentThemeCss(options) {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
options.platform
|
|
100
|
-
);
|
|
101
|
-
const selector = options.selector || (defaultSelectors.length > 0 ? defaultSelectors[0] : options.component);
|
|
102
|
-
const sassCode = `
|
|
103
|
-
@use 'sass/themes' as *;
|
|
104
|
-
@use 'sass/themes/schemas' as *;
|
|
117
|
+
const { getComponentTheme, getComponentSelector, SCHEMA_PRESETS } = await import("../knowledge/index.js");
|
|
118
|
+
const { toVariableName } = await import("../utils/sass.js");
|
|
119
|
+
const theme = getComponentTheme(options.component);
|
|
120
|
+
if (!theme) throw new Error(`Unknown component: ${options.component}`);
|
|
121
|
+
const designSystem = options.designSystem ?? "material";
|
|
122
|
+
const variant = options.variant ?? "light";
|
|
123
|
+
const themeFn = theme.themeFunctionName;
|
|
124
|
+
const themeName = options.name ? `$${toVariableName(options.name)}` : `$custom-${options.component}-theme`;
|
|
125
|
+
const tokenArgs = [`$schema: ${SCHEMA_PRESETS[variant][designSystem]}`];
|
|
126
|
+
for (const [tokenName, value] of Object.entries(options.tokens)) {
|
|
127
|
+
const stringValue = typeof value === "number" ? String(value) : value;
|
|
128
|
+
tokenArgs.push(`$${tokenName}: ${stringValue}`);
|
|
129
|
+
}
|
|
130
|
+
const defaultSelectors = getComponentSelector(options.component, options.platform);
|
|
131
|
+
const selector = options.selector || (defaultSelectors.length > 0 ? defaultSelectors[0] : options.component);
|
|
132
|
+
const sassCode = `
|
|
133
|
+
@use 'igniteui-theming/sass/themes' as *;
|
|
134
|
+
@use 'igniteui-theming/sass/themes/schemas' as *;
|
|
105
135
|
|
|
106
136
|
// Custom ${options.component} theme
|
|
107
137
|
${themeName}: ${themeFn}(
|
|
@@ -113,24 +143,19 @@ ${selector} {
|
|
|
113
143
|
@include tokens(${themeName});
|
|
114
144
|
}
|
|
115
145
|
`;
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
}
|
|
146
|
+
try {
|
|
147
|
+
const importers = options._importers ?? [themingImporter];
|
|
148
|
+
return {
|
|
149
|
+
css: (await sass.compileStringAsync(sassCode, {
|
|
150
|
+
importers,
|
|
151
|
+
style: "expanded"
|
|
152
|
+
})).css,
|
|
153
|
+
description: `Generated CSS custom properties for ${options.component} component with ${Object.keys(options.tokens).length} token(s) using ${designSystem} design system (${variant} variant)`
|
|
154
|
+
};
|
|
155
|
+
} catch (error) {
|
|
156
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
157
|
+
throw new Error(`Failed to compile component theme CSS: ${message}`);
|
|
158
|
+
}
|
|
130
159
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
generateComponentThemeCss,
|
|
134
|
-
generateCustomPaletteCss,
|
|
135
|
-
generatePaletteCss
|
|
136
|
-
};
|
|
160
|
+
//#endregion
|
|
161
|
+
export { formatCssOutput, generateComponentThemeCss, generateCustomPaletteCss, generatePaletteCss };
|