igniteui-theming 27.3.0 → 27.4.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.
@@ -1,11 +1,44 @@
1
1
  import { PLATFORM_METADATA } from "../../knowledge/platforms/index.js";
2
2
  import { SASS_USE_ASSEMBLY_NOTE } from "../../utils/sass.js";
3
3
  import { generateTypography } from "../../generators/sass.js";
4
+ import { formatCssOutput, generateTypographyCss } from "../../generators/css.js";
4
5
  //#region src/tools/handlers/typography.ts
5
6
  /**
6
7
  * Handler for create_typography tool.
7
8
  */
8
- function handleCreateTypography(params) {
9
+ async function handleCreateTypography(params) {
10
+ if ((params.output ?? (params.platform === "angular" ? "sass" : "css")) === "css") return handleCssOutput(params);
11
+ return handleSassOutput(params);
12
+ }
13
+ async function handleCssOutput(params) {
14
+ try {
15
+ const result = await generateTypographyCss({
16
+ fontFamily: params.fontFamily,
17
+ designSystem: params.designSystem
18
+ });
19
+ const formattedCss = formatCssOutput(result.css, result.description);
20
+ const responseParts = [result.description];
21
+ responseParts.push("");
22
+ responseParts.push("Output format: CSS custom properties");
23
+ responseParts.push("");
24
+ responseParts.push("```css");
25
+ responseParts.push(formattedCss.trimEnd());
26
+ responseParts.push("```");
27
+ return { content: [{
28
+ type: "text",
29
+ text: responseParts.join("\n")
30
+ }] };
31
+ } catch (error) {
32
+ return {
33
+ content: [{
34
+ type: "text",
35
+ text: `**Error generating CSS typography**\n\n${error instanceof Error ? error.message : String(error)}`
36
+ }],
37
+ isError: true
38
+ };
39
+ }
40
+ }
41
+ function handleSassOutput(params) {
9
42
  const result = generateTypography({
10
43
  platform: params.platform,
11
44
  licensed: params.licensed,
@@ -156,12 +156,14 @@ export declare const createTypographySchema: z.ZodObject<{
156
156
  marginBottom?: string | undefined;
157
157
  }>>>;
158
158
  name: z.ZodOptional<z.ZodString>;
159
+ output: z.ZodOptional<z.ZodEnum<["sass", "css"]>>;
159
160
  }, "strip", z.ZodTypeAny, {
160
161
  fontFamily: string;
161
162
  designSystem?: "material" | "bootstrap" | "fluent" | "indigo" | undefined;
162
163
  platform?: "angular" | "webcomponents" | "react" | "blazor" | "generic" | undefined;
163
164
  name?: string | undefined;
164
165
  licensed?: boolean | undefined;
166
+ output?: "sass" | "css" | undefined;
165
167
  customScale?: Record<string, {
166
168
  fontSize?: string | undefined;
167
169
  fontWeight?: string | number | undefined;
@@ -178,6 +180,7 @@ export declare const createTypographySchema: z.ZodObject<{
178
180
  platform?: "angular" | "webcomponents" | "react" | "blazor" | "generic" | undefined;
179
181
  name?: string | undefined;
180
182
  licensed?: boolean | undefined;
183
+ output?: "sass" | "css" | undefined;
181
184
  customScale?: Record<string, {
182
185
  fontSize?: string | undefined;
183
186
  fontWeight?: string | number | undefined;
@@ -197,16 +200,19 @@ export declare const createElevationsSchema: z.ZodObject<{
197
200
  licensed: z.ZodOptional<z.ZodBoolean>;
198
201
  designSystem: z.ZodOptional<z.ZodEnum<["material", "indigo"]>>;
199
202
  name: z.ZodOptional<z.ZodString>;
203
+ output: z.ZodOptional<z.ZodEnum<["sass", "css"]>>;
200
204
  }, "strip", z.ZodTypeAny, {
201
205
  designSystem?: "material" | "indigo" | undefined;
202
206
  platform?: "angular" | "webcomponents" | "react" | "blazor" | "generic" | undefined;
203
207
  name?: string | undefined;
204
208
  licensed?: boolean | undefined;
209
+ output?: "sass" | "css" | undefined;
205
210
  }, {
206
211
  designSystem?: "material" | "indigo" | undefined;
207
212
  platform?: "angular" | "webcomponents" | "react" | "blazor" | "generic" | undefined;
208
213
  name?: string | undefined;
209
214
  licensed?: boolean | undefined;
215
+ output?: "sass" | "css" | undefined;
210
216
  }>;
211
217
  /**
212
218
  * Schema for create_theme tool.
@@ -224,6 +230,7 @@ export declare const createThemeSchema: z.ZodObject<{
224
230
  includeTypography: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
225
231
  includeElevations: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
226
232
  includeSpacing: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
233
+ output: z.ZodOptional<z.ZodEnum<["sass", "css"]>>;
227
234
  }, "strip", z.ZodTypeAny, {
228
235
  includeTypography: boolean;
229
236
  includeElevations: boolean;
@@ -237,6 +244,7 @@ export declare const createThemeSchema: z.ZodObject<{
237
244
  platform?: "angular" | "webcomponents" | "react" | "blazor" | "generic" | undefined;
238
245
  name?: string | undefined;
239
246
  licensed?: boolean | undefined;
247
+ output?: "sass" | "css" | undefined;
240
248
  }, {
241
249
  primaryColor: string;
242
250
  secondaryColor: string;
@@ -250,6 +258,7 @@ export declare const createThemeSchema: z.ZodObject<{
250
258
  platform?: "angular" | "webcomponents" | "react" | "blazor" | "generic" | undefined;
251
259
  name?: string | undefined;
252
260
  licensed?: boolean | undefined;
261
+ output?: "sass" | "css" | undefined;
253
262
  }>;
254
263
  /**
255
264
  * Type exports inferred from schemas.
@@ -83,7 +83,8 @@ var createTypographySchema = z.object({
83
83
  fontFamily: z.string().describe(PARAM_DESCRIPTIONS.fontFamily),
84
84
  designSystem: designSystemSchema.describe(PARAM_DESCRIPTIONS.designSystem),
85
85
  customScale: z.record(typeStyleSchema).optional().describe(PARAM_DESCRIPTIONS.customScale),
86
- name: z.string().optional().describe(PARAM_DESCRIPTIONS.name)
86
+ name: z.string().optional().describe(PARAM_DESCRIPTIONS.name),
87
+ output: outputFormatSchema.describe(PARAM_DESCRIPTIONS.output)
87
88
  });
88
89
  /**
89
90
  * Schema for create_elevations tool.
@@ -92,7 +93,8 @@ var createElevationsSchema = z.object({
92
93
  platform: platformSchema,
93
94
  licensed: licensedSchema,
94
95
  designSystem: elevationPresetSchema.describe(PARAM_DESCRIPTIONS.elevationPreset),
95
- name: z.string().optional().describe(PARAM_DESCRIPTIONS.name)
96
+ name: z.string().optional().describe(PARAM_DESCRIPTIONS.name),
97
+ output: outputFormatSchema.describe(PARAM_DESCRIPTIONS.output)
96
98
  });
97
99
  /**
98
100
  * Schema for create_theme tool.
@@ -109,7 +111,8 @@ var createThemeSchema = z.object({
109
111
  fontFamily: z.string().optional().describe(PARAM_DESCRIPTIONS.fontFamily),
110
112
  includeTypography: z.boolean().optional().default(true).describe(PARAM_DESCRIPTIONS.includeTypography),
111
113
  includeElevations: z.boolean().optional().default(true).describe(PARAM_DESCRIPTIONS.includeElevations),
112
- includeSpacing: z.boolean().optional().default(true).describe(PARAM_DESCRIPTIONS.includeSpacing)
114
+ includeSpacing: z.boolean().optional().default(true).describe(PARAM_DESCRIPTIONS.includeSpacing),
115
+ output: outputFormatSchema.describe(PARAM_DESCRIPTIONS.output)
113
116
  });
114
117
  /**
115
118
  * All chromatic shade levels combined for schema validation.