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,29 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import "../../knowledge/
|
|
3
|
-
import { hasVariants, getVariants, isComponentAvailable, getComponentPlatformAvailability, getComponentSelector } from "../../knowledge/component-metadata.js";
|
|
4
|
-
import { getComponentTheme, searchComponents, COMPONENT_NAMES, validateTokens } from "../../knowledge/component-themes.js";
|
|
5
|
-
import "../../knowledge/custom-palettes.js";
|
|
6
|
-
import "../../utils/types.js";
|
|
7
|
-
import "../../knowledge/palettes.js";
|
|
1
|
+
import { getComponentPlatformAvailability, getComponentSelector, getVariants, hasVariants, isComponentAvailable } from "../../knowledge/component-metadata.js";
|
|
2
|
+
import { COMPONENT_NAMES, getComponentTheme, searchComponents, validateTokens } from "../../knowledge/component-themes.js";
|
|
8
3
|
import { PLATFORM_METADATA } from "../../knowledge/platforms/index.js";
|
|
4
|
+
import "../../knowledge/index.js";
|
|
5
|
+
import { generateComponentTheme } from "../../generators/sass.js";
|
|
6
|
+
//#region src/tools/handlers/component-theme.ts
|
|
7
|
+
/**
|
|
8
|
+
* Handler for create_component_theme tool.
|
|
9
|
+
* Generates Sass code to customize a component's appearance.
|
|
10
|
+
*/
|
|
9
11
|
async function handleCreateComponentTheme(params) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
output = "sass",
|
|
17
|
-
designSystem = "material",
|
|
18
|
-
variant = "light"
|
|
19
|
-
} = params;
|
|
20
|
-
const normalizedComponent = component.toLowerCase().trim();
|
|
21
|
-
if (!platform) {
|
|
22
|
-
return {
|
|
23
|
-
content: [
|
|
24
|
-
{
|
|
25
|
-
type: "text",
|
|
26
|
-
text: `**Error:** The \`platform\` parameter is required.
|
|
12
|
+
const { platform, component, tokens, selector, name, output = "sass", designSystem = "material", variant = "light" } = params;
|
|
13
|
+
const normalizedComponent = component.toLowerCase().trim();
|
|
14
|
+
if (!platform) return {
|
|
15
|
+
content: [{
|
|
16
|
+
type: "text",
|
|
17
|
+
text: `**Error:** The \`platform\` parameter is required.
|
|
27
18
|
|
|
28
19
|
**Valid platforms:**
|
|
29
20
|
- \`angular\` - Ignite UI for Angular
|
|
@@ -32,17 +23,13 @@ async function handleCreateComponentTheme(params) {
|
|
|
32
23
|
- \`blazor\` - Ignite UI for Blazor
|
|
33
24
|
|
|
34
25
|
Please specify which platform you're using to generate the correct variable prefixes and selectors.`
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
content: [
|
|
43
|
-
{
|
|
44
|
-
type: "text",
|
|
45
|
-
text: `**Error:** \`create_component_theme\` requires a specific Ignite UI product platform.
|
|
26
|
+
}],
|
|
27
|
+
isError: true
|
|
28
|
+
};
|
|
29
|
+
if (platform === "generic") return {
|
|
30
|
+
content: [{
|
|
31
|
+
type: "text",
|
|
32
|
+
text: `**Error:** \`create_component_theme\` requires a specific Ignite UI product platform.
|
|
46
33
|
|
|
47
34
|
The \`"generic"\` platform is not supported for component theming because component selectors and variable prefixes are platform-specific and do not exist in generic mode.
|
|
48
35
|
|
|
@@ -51,37 +38,31 @@ The \`"generic"\` platform is not supported for component theming because compon
|
|
|
51
38
|
- \`webcomponents\` - Ignite UI for Web Components
|
|
52
39
|
- \`react\` - Ignite UI for React
|
|
53
40
|
- \`blazor\` - Ignite UI for Blazor`
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
content: [
|
|
65
|
-
{
|
|
66
|
-
type: "text",
|
|
67
|
-
text: `**Error:** Component "${component}" not found.
|
|
41
|
+
}],
|
|
42
|
+
isError: true
|
|
43
|
+
};
|
|
44
|
+
if (!getComponentTheme(normalizedComponent)) {
|
|
45
|
+
const suggestions = searchComponents(normalizedComponent);
|
|
46
|
+
const componentList = suggestions.length > 0 ? suggestions.slice(0, 10) : COMPONENT_NAMES.slice(0, 15);
|
|
47
|
+
return {
|
|
48
|
+
content: [{
|
|
49
|
+
type: "text",
|
|
50
|
+
text: `**Error:** Component "${component}" not found.
|
|
68
51
|
|
|
69
52
|
${suggestions.length > 0 ? "**Similar components:**" : "**Available components:**"}
|
|
70
53
|
${componentList.map((c) => `- ${c}`).join("\n")}
|
|
71
54
|
|
|
72
55
|
**Tip:** Use \`get_component_design_tokens\` first to discover valid component names and their tokens.`
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
type: "text",
|
|
84
|
-
text: `**Error:** The \`${component}\` component has multiple variants and requires a specific variant for theming.
|
|
56
|
+
}],
|
|
57
|
+
isError: true
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
if (hasVariants(normalizedComponent)) {
|
|
61
|
+
const variants = getVariants(normalizedComponent);
|
|
62
|
+
return {
|
|
63
|
+
content: [{
|
|
64
|
+
type: "text",
|
|
65
|
+
text: `**Error:** The \`${component}\` component has multiple variants and requires a specific variant for theming.
|
|
85
66
|
|
|
86
67
|
**Available variants:**
|
|
87
68
|
${variants.map((v) => `- \`${v}\``).join("\n")}
|
|
@@ -89,175 +70,132 @@ ${variants.map((v) => `- \`${v}\``).join("\n")}
|
|
|
89
70
|
Please use \`create_component_theme\` with one of the specific variant names above.
|
|
90
71
|
|
|
91
72
|
**Tip:** Use \`get_component_design_tokens\` with a specific variant (e.g., \`${variants[0]}\`) to see available tokens.`
|
|
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
|
-
type: "text",
|
|
118
|
-
text: `**Error:** No tokens provided. At least one token must be specified.
|
|
73
|
+
}],
|
|
74
|
+
isError: true
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
if (platform) {
|
|
78
|
+
if (!isComponentAvailable(normalizedComponent, platform)) {
|
|
79
|
+
const availability = getComponentPlatformAvailability(normalizedComponent);
|
|
80
|
+
const availablePlatforms = [];
|
|
81
|
+
if (availability?.angular) availablePlatforms.push("Angular");
|
|
82
|
+
if (availability?.webcomponents) availablePlatforms.push("Web Components");
|
|
83
|
+
return {
|
|
84
|
+
content: [{
|
|
85
|
+
type: "text",
|
|
86
|
+
text: `**Error:** The \`${component}\` component is not available on ${PLATFORM_METADATA[platform]?.name ?? platform}. ${availablePlatforms.length > 0 ? `It is available on: ${availablePlatforms.join(", ")}.` : ""}`
|
|
87
|
+
}],
|
|
88
|
+
isError: true
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const tokenNames = Object.keys(tokens);
|
|
93
|
+
if (tokenNames.length === 0) return {
|
|
94
|
+
content: [{
|
|
95
|
+
type: "text",
|
|
96
|
+
text: `**Error:** No tokens provided. At least one token must be specified.
|
|
119
97
|
|
|
120
98
|
Use \`get_component_design_tokens\` with component "${component}" to see available tokens.`
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
content: [
|
|
130
|
-
{
|
|
131
|
-
type: "text",
|
|
132
|
-
text: `**Error:** Invalid token(s) for component "${component}":
|
|
99
|
+
}],
|
|
100
|
+
isError: true
|
|
101
|
+
};
|
|
102
|
+
const validation = validateTokens(normalizedComponent, tokenNames);
|
|
103
|
+
if (!validation.isValid) return {
|
|
104
|
+
content: [{
|
|
105
|
+
type: "text",
|
|
106
|
+
text: `**Error:** Invalid token(s) for component "${component}":
|
|
133
107
|
${validation.invalidTokens.map((t) => `- \`${t}\``).join("\n")}
|
|
134
108
|
|
|
135
109
|
**Valid tokens for ${component}:**
|
|
136
|
-
${validation.validTokens.slice(0, 20).map((t) => `- \`${t}\``).join(
|
|
137
|
-
"\n"
|
|
138
|
-
)}${validation.validTokens.length > 20 ? `
|
|
139
|
-
... and ${validation.validTokens.length - 20} more` : ""}
|
|
110
|
+
${validation.validTokens.slice(0, 20).map((t) => `- \`${t}\``).join("\n")}${validation.validTokens.length > 20 ? `\n... and ${validation.validTokens.length - 20} more` : ""}
|
|
140
111
|
|
|
141
112
|
Use \`get_component_design_tokens\` to see all tokens with descriptions.`
|
|
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
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
-
responseParts.push(`Selector: \`${finalSelector}\``);
|
|
229
|
-
}
|
|
230
|
-
responseParts.push("");
|
|
231
|
-
responseParts.push(`Variables created: ${result.variables.join(", ")}`);
|
|
232
|
-
responseParts.push("");
|
|
233
|
-
responseParts.push("```scss");
|
|
234
|
-
responseParts.push(result.code.trimEnd());
|
|
235
|
-
responseParts.push("```");
|
|
236
|
-
responseParts.push("");
|
|
237
|
-
responseParts.push("---");
|
|
238
|
-
responseParts.push(
|
|
239
|
-
"**Usage:** Import this Sass file in your main styles file, or include the code in your theme file."
|
|
240
|
-
);
|
|
241
|
-
return {
|
|
242
|
-
content: [
|
|
243
|
-
{
|
|
244
|
-
type: "text",
|
|
245
|
-
text: responseParts.join("\n")
|
|
246
|
-
}
|
|
247
|
-
]
|
|
248
|
-
};
|
|
249
|
-
} catch (error) {
|
|
250
|
-
return {
|
|
251
|
-
content: [
|
|
252
|
-
{
|
|
253
|
-
type: "text",
|
|
254
|
-
text: `**Error generating theme:** ${error instanceof Error ? error.message : String(error)}`
|
|
255
|
-
}
|
|
256
|
-
],
|
|
257
|
-
isError: true
|
|
258
|
-
};
|
|
259
|
-
}
|
|
113
|
+
}],
|
|
114
|
+
isError: true
|
|
115
|
+
};
|
|
116
|
+
let finalSelector = selector;
|
|
117
|
+
if (!finalSelector && platform) {
|
|
118
|
+
const selectors = getComponentSelector(normalizedComponent, platform);
|
|
119
|
+
if (selectors.length > 0) finalSelector = selectors[0];
|
|
120
|
+
}
|
|
121
|
+
if (output === "css") try {
|
|
122
|
+
const { generateComponentThemeCss, formatCssOutput } = await import("../../generators/css.js");
|
|
123
|
+
const result = await generateComponentThemeCss({
|
|
124
|
+
platform,
|
|
125
|
+
component: normalizedComponent,
|
|
126
|
+
tokens,
|
|
127
|
+
selector: finalSelector,
|
|
128
|
+
name,
|
|
129
|
+
designSystem,
|
|
130
|
+
variant
|
|
131
|
+
});
|
|
132
|
+
const responseParts = [];
|
|
133
|
+
responseParts.push(result.description);
|
|
134
|
+
responseParts.push("");
|
|
135
|
+
const platformNote = platform ? `Platform: ${PLATFORM_METADATA[platform]?.name ?? platform}` : "Platform: Not specified (generic output). Specify `platform` for optimized imports.";
|
|
136
|
+
responseParts.push(platformNote);
|
|
137
|
+
responseParts.push(`Design System: ${designSystem.charAt(0).toUpperCase() + designSystem.slice(1)} (${variant})`);
|
|
138
|
+
if (finalSelector) responseParts.push(`Selector: \`${finalSelector}\``);
|
|
139
|
+
responseParts.push("");
|
|
140
|
+
responseParts.push("```css");
|
|
141
|
+
responseParts.push(formatCssOutput(result.css, result.description).trimEnd());
|
|
142
|
+
responseParts.push("```");
|
|
143
|
+
responseParts.push("");
|
|
144
|
+
responseParts.push("---");
|
|
145
|
+
responseParts.push("**Usage:** Include this CSS in your stylesheet or add it to your application's global styles.");
|
|
146
|
+
return { content: [{
|
|
147
|
+
type: "text",
|
|
148
|
+
text: responseParts.join("\n")
|
|
149
|
+
}] };
|
|
150
|
+
} catch (error) {
|
|
151
|
+
return {
|
|
152
|
+
content: [{
|
|
153
|
+
type: "text",
|
|
154
|
+
text: `**Error generating CSS:** ${error instanceof Error ? error.message : String(error)}`
|
|
155
|
+
}],
|
|
156
|
+
isError: true
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
try {
|
|
160
|
+
const result = generateComponentTheme({
|
|
161
|
+
platform,
|
|
162
|
+
licensed: params.licensed,
|
|
163
|
+
component: normalizedComponent,
|
|
164
|
+
tokens,
|
|
165
|
+
selector: finalSelector,
|
|
166
|
+
name,
|
|
167
|
+
designSystem,
|
|
168
|
+
variant
|
|
169
|
+
});
|
|
170
|
+
const responseParts = [];
|
|
171
|
+
responseParts.push(result.description);
|
|
172
|
+
responseParts.push("");
|
|
173
|
+
const platformNote = platform ? `Platform: ${PLATFORM_METADATA[platform]?.name ?? platform}` : "Platform: Not specified (generic output). Specify `platform` for optimized imports.";
|
|
174
|
+
responseParts.push(platformNote);
|
|
175
|
+
responseParts.push(`Design System: ${designSystem.charAt(0).toUpperCase() + designSystem.slice(1)} (${variant})`);
|
|
176
|
+
if (finalSelector) responseParts.push(`Selector: \`${finalSelector}\``);
|
|
177
|
+
responseParts.push("");
|
|
178
|
+
responseParts.push(`Variables created: ${result.variables.join(", ")}`);
|
|
179
|
+
responseParts.push("");
|
|
180
|
+
responseParts.push("```scss");
|
|
181
|
+
responseParts.push(result.code.trimEnd());
|
|
182
|
+
responseParts.push("```");
|
|
183
|
+
responseParts.push("");
|
|
184
|
+
responseParts.push("---");
|
|
185
|
+
responseParts.push("**Usage:** Import this Sass file in your main styles file, or include the code in your theme file.");
|
|
186
|
+
return { content: [{
|
|
187
|
+
type: "text",
|
|
188
|
+
text: responseParts.join("\n")
|
|
189
|
+
}] };
|
|
190
|
+
} catch (error) {
|
|
191
|
+
return {
|
|
192
|
+
content: [{
|
|
193
|
+
type: "text",
|
|
194
|
+
text: `**Error generating theme:** ${error instanceof Error ? error.message : String(error)}`
|
|
195
|
+
}],
|
|
196
|
+
isError: true
|
|
197
|
+
};
|
|
198
|
+
}
|
|
260
199
|
}
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
};
|
|
200
|
+
//#endregion
|
|
201
|
+
export { handleCreateComponentTheme };
|