@progress/kendo-angular-mcp 1.5.3-beta.cd97a7ec.0 → 1.6.1-beta.d2eee4d2.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.js +605 -2772
- package/package.json +1 -1
- package/proto/service.proto +0 -62
package/dist/index.js
CHANGED
|
@@ -1,914 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import{McpServer as Vt}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as Wt}from"@modelcontextprotocol/sdk/server/stdio.js";import{dirname as Ct,join as Tt}from"path";import{fileURLToPath as xt}from"url";import{loadLicense as mt,decodeLicenseKey as gt,decodeLicenseEvidence as ht}from"@progress/kendo-licensing/utils";var F=class extends Error{constructor(t){super(t),this.name="LicenseError"}};function ae(e){return e.replace(/^\uFEFF/,"")}async function ie(e){let t=null,s=null;try{let o=mt();if(!o.success){let n=new F(o.message);throw e&&await e("license_load_failed",{error:o.message}).catch(()=>{}),n}try{t=(await gt(o.value)).licenses.find(async a=>!!(await ht(a)).userId)}catch(n){console.log(n.message),e&&await e("license_load_failed",{error:n.message||"Unknown decoding error"}).catch(()=>{})}if(!t)return[ae(o.value),null]}catch(o){return s=o.message||"Unknown error loading license.",e&&await e("license_load_failed",{error:s}).catch(()=>{}),[null,s]}return[ae(t),null]}import D from"node:fs";import $ from"node:path";var q=!1,N=process.env.DEBUG_LOG_FILE,le=!!(N&&typeof N=="string");if(le){let e=$.resolve(N),t=$.dirname(e);if(t!=="."&&t!==process.cwd()&&!D.existsSync(t))try{D.mkdirSync(t,{recursive:!0})}catch(s){console.error("Error creating log directory:",s)}if(!D.existsSync(e))try{D.writeFileSync(e,"")}catch(s){console.error("Error creating log file:",s)}}else q=!1;q=le&&!!N&&D.existsSync($.resolve(N));function g(...e){if(q&&N){let o=`${new Date().toISOString()}: ${e.join(" ")}
|
|
3
|
+
`,n=$.resolve(N);D.appendFile(n,o,a=>{a&&console.error("Error writing to log file:",a)})}}import ft from"@grpc/proto-loader";import P from"@grpc/grpc-js";import pe from"path";import ce from"fs";import{fileURLToPath as yt}from"url";var bt=yt(import.meta.url),kt=pe.dirname(bt),ue={version:"unknown"},de=pe.resolve(kt,"../package.json");ce.existsSync(de)&&(ue=JSON.parse(ce.readFileSync(de,"utf-8")));function vt(e){return e.replace(/\u2014/g,"--").replace(/\u2013/g,"-").replace(/[^\x20-\x7E]/g,"")}var M=class{constructor(t,s,o){this.contextApiUrl=t;this.protoPath=s;this.options=o;this.toolNameHeader="assistant";let n=ft.loadSync(this.protoPath,{keepCase:!0,longs:String,enums:String,defaults:!0,oneofs:!0});this.isDev=this.contextApiUrl?.includes("localhost")||this.contextApiUrl?.includes("127.0.0.1"),g("Using ContextApi URl:",this.contextApiUrl);let a=P.loadPackageDefinition(n),r=100*1024*1024,i={"grpc.max_receive_message_length":r,"grpc.max_send_message_length":r};this.client=new a.ContextQueryService(this.contextApiUrl||"contextapi.telerik.com:443",this.isDev?P.credentials.createInsecure():P.credentials.createSsl(),i)}async getMetadata({meta:t}={meta:{}}){let[s,o]=this.isDev?["fake_license",null]:await ie((p,b)=>this.logEvent(p,b)),n=process.env.CONTEXTAPI_API_KEY,a=n&&typeof n=="string",r=s&&typeof s=="string";if(!r&&!a&&o)throw new Error(`Failed to authenticate with API key or License key!
|
|
2
4
|
|
|
3
|
-
// packages/angular/src/index.ts
|
|
4
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
-
|
|
7
|
-
// packages/angular/src/lib/grpc-client.ts
|
|
8
|
-
import { dirname, join } from "path";
|
|
9
|
-
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
10
|
-
|
|
11
|
-
// packages/mcp-common/src/lib/read-license.ts
|
|
12
|
-
import {
|
|
13
|
-
loadLicense,
|
|
14
|
-
decodeLicenseKey,
|
|
15
|
-
decodeLicenseEvidence
|
|
16
|
-
} from "@progress/kendo-licensing/utils";
|
|
17
|
-
var LicenseError = class extends Error {
|
|
18
|
-
constructor(message) {
|
|
19
|
-
super(message);
|
|
20
|
-
this.name = "LicenseError";
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
function fixBom(licenseKey) {
|
|
24
|
-
return licenseKey.replace(/^\uFEFF/, "");
|
|
25
|
-
}
|
|
26
|
-
async function readLicense(logCallback) {
|
|
27
|
-
let licenseEvidence = null;
|
|
28
|
-
let error = null;
|
|
29
|
-
try {
|
|
30
|
-
const license = loadLicense();
|
|
31
|
-
if (!license.success) {
|
|
32
|
-
const licenseError = new LicenseError(license.message);
|
|
33
|
-
if (logCallback) {
|
|
34
|
-
await logCallback("license_load_failed", {
|
|
35
|
-
error: license.message
|
|
36
|
-
}).catch(() => {
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
throw licenseError;
|
|
40
|
-
}
|
|
41
|
-
try {
|
|
42
|
-
const decodedLicense = await decodeLicenseKey(license.value);
|
|
43
|
-
licenseEvidence = decodedLicense.licenses.find(async (lic) => {
|
|
44
|
-
const evidence = await decodeLicenseEvidence(lic);
|
|
45
|
-
if (evidence.userId) {
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
48
|
-
return false;
|
|
49
|
-
});
|
|
50
|
-
} catch (err) {
|
|
51
|
-
console.log(err.message);
|
|
52
|
-
if (logCallback) {
|
|
53
|
-
await logCallback("license_load_failed", {
|
|
54
|
-
error: err.message || "Unknown decoding error"
|
|
55
|
-
}).catch(() => {
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (!licenseEvidence) {
|
|
60
|
-
return [fixBom(license.value), null];
|
|
61
|
-
}
|
|
62
|
-
} catch (err) {
|
|
63
|
-
error = err.message || "Unknown error loading license.";
|
|
64
|
-
if (logCallback) {
|
|
65
|
-
await logCallback("license_load_failed", {
|
|
66
|
-
error
|
|
67
|
-
}).catch(() => {
|
|
68
|
-
});
|
|
69
|
-
}
|
|
70
|
-
return [null, error];
|
|
71
|
-
}
|
|
72
|
-
return [fixBom(licenseEvidence), null];
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// packages/mcp-common/src/lib/logger.ts
|
|
76
|
-
import fs from "node:fs";
|
|
77
|
-
import path from "node:path";
|
|
78
|
-
var LOG_ENABLED = false;
|
|
79
|
-
var LOG_FILE = process.env.DEBUG_LOG_FILE;
|
|
80
|
-
var LOG_FILE_DEFINED = !!(LOG_FILE && typeof LOG_FILE === "string");
|
|
81
|
-
if (LOG_FILE_DEFINED) {
|
|
82
|
-
const resolvedLogFile = path.resolve(LOG_FILE);
|
|
83
|
-
const logDir = path.dirname(resolvedLogFile);
|
|
84
|
-
if (logDir !== "." && logDir !== process.cwd() && !fs.existsSync(logDir)) {
|
|
85
|
-
try {
|
|
86
|
-
fs.mkdirSync(logDir, { recursive: true });
|
|
87
|
-
} catch (err) {
|
|
88
|
-
console.error("Error creating log directory:", err);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
if (!fs.existsSync(resolvedLogFile)) {
|
|
92
|
-
try {
|
|
93
|
-
fs.writeFileSync(resolvedLogFile, "");
|
|
94
|
-
} catch (err) {
|
|
95
|
-
console.error("Error creating log file:", err);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
} else {
|
|
99
|
-
LOG_ENABLED = false;
|
|
100
|
-
}
|
|
101
|
-
LOG_ENABLED = LOG_FILE_DEFINED && !!LOG_FILE && fs.existsSync(path.resolve(LOG_FILE));
|
|
102
|
-
function log(...args) {
|
|
103
|
-
if (LOG_ENABLED && LOG_FILE) {
|
|
104
|
-
const date = /* @__PURE__ */ new Date();
|
|
105
|
-
const dateString = date.toISOString();
|
|
106
|
-
const logString = `${dateString}: ${args.join(" ")}
|
|
107
|
-
`;
|
|
108
|
-
const resolvedLogFile = path.resolve(LOG_FILE);
|
|
109
|
-
fs.appendFile(resolvedLogFile, logString, (err) => {
|
|
110
|
-
if (err) {
|
|
111
|
-
console.error("Error writing to log file:", err);
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
// packages/mcp-common/src/lib/context-api.ts
|
|
118
|
-
import protoLoader from "@grpc/proto-loader";
|
|
119
|
-
import grpc from "@grpc/grpc-js";
|
|
120
|
-
import path2 from "path";
|
|
121
|
-
import fs2 from "fs";
|
|
122
|
-
import { fileURLToPath } from "url";
|
|
123
|
-
var __filename = fileURLToPath(import.meta.url);
|
|
124
|
-
var __dirname = path2.dirname(__filename);
|
|
125
|
-
var packageJson = { version: "unknown" };
|
|
126
|
-
var packageJsonPath = path2.resolve(__dirname, "../package.json");
|
|
127
|
-
if (fs2.existsSync(packageJsonPath)) {
|
|
128
|
-
packageJson = JSON.parse(fs2.readFileSync(packageJsonPath, "utf-8"));
|
|
129
|
-
}
|
|
130
|
-
function sanitizeMetadata(value) {
|
|
131
|
-
return value.replace(/\u2014/g, "--").replace(/\u2013/g, "-").replace(/[^\x20-\x7E]/g, "");
|
|
132
|
-
}
|
|
133
|
-
var D2CError = class extends Error {
|
|
134
|
-
constructor(code, message, details) {
|
|
135
|
-
super(message);
|
|
136
|
-
this.code = code;
|
|
137
|
-
this.details = details;
|
|
138
|
-
this.name = "D2CError";
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
var ContextAPI = class {
|
|
142
|
-
constructor(contextApiUrl, protoPath2, options) {
|
|
143
|
-
this.contextApiUrl = contextApiUrl;
|
|
144
|
-
this.protoPath = protoPath2;
|
|
145
|
-
this.options = options;
|
|
146
|
-
this.toolNameHeader = "assistant";
|
|
147
|
-
const proto = protoLoader.loadSync(this.protoPath, {
|
|
148
|
-
keepCase: true,
|
|
149
|
-
longs: String,
|
|
150
|
-
enums: String,
|
|
151
|
-
defaults: true,
|
|
152
|
-
oneofs: true
|
|
153
|
-
});
|
|
154
|
-
this.isDev = this.contextApiUrl?.includes("localhost") || this.contextApiUrl?.includes("127.0.0.1");
|
|
155
|
-
log("Using ContextApi URl:", this.contextApiUrl);
|
|
156
|
-
const protoDescriptor = grpc.loadPackageDefinition(proto);
|
|
157
|
-
const maxMsgSize = 100 * 1024 * 1024;
|
|
158
|
-
const channelOptions = {
|
|
159
|
-
"grpc.max_receive_message_length": maxMsgSize,
|
|
160
|
-
"grpc.max_send_message_length": maxMsgSize
|
|
161
|
-
};
|
|
162
|
-
this.client = new protoDescriptor.ContextQueryService(
|
|
163
|
-
this.contextApiUrl || "contextapi.telerik.com:443",
|
|
164
|
-
this.isDev ? grpc.credentials.createInsecure() : grpc.credentials.createSsl(),
|
|
165
|
-
channelOptions
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
async getMetadata({ meta } = { meta: {} }) {
|
|
169
|
-
const [license, error] = this.isDev ? ["fake_license", null] : await readLicense((eventName, fields) => this.logEvent(eventName, fields));
|
|
170
|
-
const apiKey = process.env.CONTEXTAPI_API_KEY;
|
|
171
|
-
const hasApiKey = apiKey && typeof apiKey === "string";
|
|
172
|
-
const hasLicense = license && typeof license === "string";
|
|
173
|
-
if (!hasLicense && !hasApiKey && error) {
|
|
174
|
-
throw new Error(
|
|
175
|
-
`Failed to authenticate with API key or License key!
|
|
176
|
-
|
|
177
|
-
License Error: ${error}`
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
const metadata = new grpc.Metadata();
|
|
181
|
-
if (hasLicense) {
|
|
182
|
-
try {
|
|
183
|
-
metadata.add("x-license-key", license);
|
|
184
|
-
} catch (error2) {
|
|
185
|
-
log("Error adding license key to metadata:", error2);
|
|
186
|
-
throw new Error(`Failed to use license key: ${error2.message}`);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
if (hasApiKey) {
|
|
190
|
-
metadata.add("x-api-key", apiKey);
|
|
191
|
-
}
|
|
192
|
-
if (this.options?.libName) {
|
|
193
|
-
metadata.add("x-library-name", this.options.libName);
|
|
194
|
-
}
|
|
195
|
-
metadata.add("x-tool-name", this.toolNameHeader);
|
|
196
|
-
const requestMetadata = JSON.stringify({
|
|
197
|
-
...meta,
|
|
198
|
-
source: "npm",
|
|
199
|
-
version: packageJson.version,
|
|
200
|
-
os: process.platform,
|
|
201
|
-
node_version: process.version
|
|
202
|
-
});
|
|
203
|
-
metadata.add("x-request-metadata", sanitizeMetadata(requestMetadata));
|
|
204
|
-
return metadata;
|
|
205
|
-
}
|
|
206
|
-
async query(params, meta) {
|
|
207
|
-
const metadata = await this.getMetadata({ meta });
|
|
208
|
-
return new Promise((resolve, reject) => {
|
|
209
|
-
this.client.query(
|
|
210
|
-
params,
|
|
211
|
-
metadata,
|
|
212
|
-
(err, response) => {
|
|
213
|
-
if (err) {
|
|
214
|
-
reject(new Error(err));
|
|
215
|
-
} else {
|
|
216
|
-
resolve(response);
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
);
|
|
220
|
-
});
|
|
221
|
-
}
|
|
222
|
-
async getApiRefMatches(params, meta) {
|
|
223
|
-
const metadata = await this.getMetadata({ meta });
|
|
224
|
-
return new Promise((resolve, reject) => {
|
|
225
|
-
this.client.getApiRefMatches(
|
|
226
|
-
params,
|
|
227
|
-
metadata,
|
|
228
|
-
(err, response) => {
|
|
229
|
-
if (err) {
|
|
230
|
-
reject(new Error(err));
|
|
231
|
-
} else {
|
|
232
|
-
resolve(response);
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
);
|
|
236
|
-
});
|
|
237
|
-
}
|
|
238
|
-
async queryCssUtils(params, meta) {
|
|
239
|
-
const metadata = await this.getMetadata({ meta });
|
|
240
|
-
return new Promise((resolve, reject) => {
|
|
241
|
-
this.client.cssUtilsSearch(
|
|
242
|
-
params,
|
|
243
|
-
metadata,
|
|
244
|
-
(err, response) => {
|
|
245
|
-
if (err) {
|
|
246
|
-
log("Error querying CSS Utils:", err);
|
|
247
|
-
reject(new Error(err));
|
|
248
|
-
} else {
|
|
249
|
-
resolve(response);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
);
|
|
253
|
-
});
|
|
254
|
-
}
|
|
255
|
-
async queryIconsSearch(params, meta) {
|
|
256
|
-
const metadata = await this.getMetadata({ meta });
|
|
257
|
-
return new Promise((resolve, reject) => {
|
|
258
|
-
this.client.iconsSearch(params, metadata, (err, response) => {
|
|
259
|
-
if (err) {
|
|
260
|
-
log("Error querying Icons Search:", err);
|
|
261
|
-
reject(new Error(err));
|
|
262
|
-
} else {
|
|
263
|
-
resolve(response);
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
});
|
|
267
|
-
}
|
|
268
|
-
async queryBuildingBlocks(params, meta) {
|
|
269
|
-
const metadata = await this.getMetadata({ meta });
|
|
270
|
-
return new Promise((resolve, reject) => {
|
|
271
|
-
this.client.buildingBlocksSearch(
|
|
272
|
-
params,
|
|
273
|
-
metadata,
|
|
274
|
-
(err, response) => {
|
|
275
|
-
if (err) {
|
|
276
|
-
log("Error querying Building Blocks:", err);
|
|
277
|
-
reject(new Error(err));
|
|
278
|
-
} else {
|
|
279
|
-
resolve(response);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
);
|
|
283
|
-
});
|
|
284
|
-
}
|
|
285
|
-
async validateUserLicense() {
|
|
286
|
-
const metadata = await this.getMetadata();
|
|
287
|
-
return new Promise((resolve, reject) => {
|
|
288
|
-
this.client.validateUserLicense(
|
|
289
|
-
null,
|
|
290
|
-
metadata,
|
|
291
|
-
(err, response) => {
|
|
292
|
-
if (err) {
|
|
293
|
-
log("Error validating user license:", err);
|
|
294
|
-
reject(new Error(err));
|
|
295
|
-
} else {
|
|
296
|
-
resolve(response);
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
);
|
|
300
|
-
});
|
|
301
|
-
}
|
|
302
|
-
async queryThemeGenerate(params, meta) {
|
|
303
|
-
const metadata = await this.getMetadata({ meta });
|
|
304
|
-
return new Promise((resolve, reject) => {
|
|
305
|
-
this.client.generateTheme(params, metadata, (err, response) => {
|
|
306
|
-
if (err) {
|
|
307
|
-
log("Error querying context API/GenerateTheme:", err);
|
|
308
|
-
reject(new Error(err));
|
|
309
|
-
} else {
|
|
310
|
-
resolve(response);
|
|
311
|
-
}
|
|
312
|
-
});
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
async recordOrchestratorUserRequest({ meta }) {
|
|
316
|
-
const metadata = await this.getMetadata({ meta });
|
|
317
|
-
return new Promise((resolve, reject) => {
|
|
318
|
-
this.client.recordOrchestratorUserRequest(
|
|
319
|
-
null,
|
|
320
|
-
metadata,
|
|
321
|
-
(err, response) => {
|
|
322
|
-
if (err) {
|
|
323
|
-
log("Error recording orchestrator user request:", err);
|
|
324
|
-
reject(new Error(err));
|
|
325
|
-
} else {
|
|
326
|
-
resolve(response);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
);
|
|
330
|
-
});
|
|
331
|
-
}
|
|
332
|
-
async recordToolUserRequest({ toolName, meta }) {
|
|
333
|
-
const metadata = await this.getMetadata({ meta });
|
|
334
|
-
return new Promise((resolve, reject) => {
|
|
335
|
-
this.client.recordToolUserRequest(
|
|
336
|
-
{ tool_name: toolName },
|
|
337
|
-
metadata,
|
|
338
|
-
(err, response) => {
|
|
339
|
-
if (err) {
|
|
340
|
-
log("Error recording tool user request:", err);
|
|
341
|
-
reject(new Error(err));
|
|
342
|
-
} else {
|
|
343
|
-
resolve(response);
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
);
|
|
347
|
-
});
|
|
348
|
-
}
|
|
349
|
-
async logEvent(eventName, fields) {
|
|
350
|
-
const apiKey = "h8utJ6rk4PpIWX4JMn9beQDsjVUri6KV0XYfiVwq";
|
|
351
|
-
if (!apiKey || typeof apiKey !== "string") {
|
|
352
|
-
log("LOGGING_API_KEY not configured, skipping log event");
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
const metadata = new grpc.Metadata();
|
|
356
|
-
metadata.add("x-api-key", apiKey);
|
|
357
|
-
return new Promise((resolve, reject) => {
|
|
358
|
-
this.client.logEvent(
|
|
359
|
-
{ event_name: eventName, fields: fields || {} },
|
|
360
|
-
metadata,
|
|
361
|
-
(err, response) => {
|
|
362
|
-
if (err) {
|
|
363
|
-
log("Error logging event:", err);
|
|
364
|
-
reject(new Error(err));
|
|
365
|
-
} else {
|
|
366
|
-
resolve();
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
);
|
|
370
|
-
});
|
|
371
|
-
}
|
|
372
|
-
/**
|
|
373
|
-
* Process a Figma design through the D2C pipeline
|
|
374
|
-
*
|
|
375
|
-
* @param params - Figma design data and processing options
|
|
376
|
-
* @returns Processed design with layout, styles, and component matches
|
|
377
|
-
* @throws D2CError if processing fails
|
|
378
|
-
*/
|
|
379
|
-
async processFigmaDesign(params) {
|
|
380
|
-
const metadata = await this.getMetadata();
|
|
381
|
-
const request = {};
|
|
382
|
-
if (params.node_jsons && params.node_jsons.length > 0) {
|
|
383
|
-
request.node_jsons = params.node_jsons;
|
|
384
|
-
} else if (params.root_node_json) {
|
|
385
|
-
request.node_jsons = [params.root_node_json];
|
|
386
|
-
} else {
|
|
387
|
-
throw new Error("Either node_jsons or root_node_json must be provided");
|
|
388
|
-
}
|
|
389
|
-
return new Promise((resolve, reject) => {
|
|
390
|
-
this.client.processFigmaDesign(
|
|
391
|
-
request,
|
|
392
|
-
metadata,
|
|
393
|
-
(err, response) => {
|
|
394
|
-
if (err) {
|
|
395
|
-
log("Error processing Figma design:", err);
|
|
396
|
-
reject(new Error(`gRPC error: ${err.message}`));
|
|
397
|
-
return;
|
|
398
|
-
}
|
|
399
|
-
if (response.error) {
|
|
400
|
-
const error = new D2CError(
|
|
401
|
-
response.error.code,
|
|
402
|
-
response.error.message,
|
|
403
|
-
response.error.details
|
|
404
|
-
);
|
|
405
|
-
log("D2C processing error:", error);
|
|
406
|
-
reject(error);
|
|
407
|
-
return;
|
|
408
|
-
}
|
|
409
|
-
if (response.success) {
|
|
410
|
-
const layoutPseudoCodes = response.success.layout_pseudo_codes || [];
|
|
411
|
-
const result = {
|
|
412
|
-
// Backward compatibility: first layout or empty string
|
|
413
|
-
layout_pseudo_code: layoutPseudoCodes[0] || response.success.layout_pseudo_code || "",
|
|
414
|
-
layout_pseudo_codes: layoutPseudoCodes.length > 0 ? layoutPseudoCodes : [response.success.layout_pseudo_code || ""],
|
|
415
|
-
design_tokens: response.success.design_tokens || "",
|
|
416
|
-
stats: {
|
|
417
|
-
total_nodes: response.success.stats?.total_nodes || 0,
|
|
418
|
-
processing_time_ms: response.success.stats?.processing_time_ms || 0
|
|
419
|
-
}
|
|
420
|
-
};
|
|
421
|
-
resolve(result);
|
|
422
|
-
return;
|
|
423
|
-
}
|
|
424
|
-
reject(new Error("Invalid response format from server"));
|
|
425
|
-
}
|
|
426
|
-
);
|
|
427
|
-
});
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
|
|
431
|
-
// packages/mcp-common/src/models/user.ts
|
|
432
|
-
import { z } from "zod";
|
|
433
|
-
var userInfoSchema = z.object({
|
|
434
|
-
user_id: z.string(),
|
|
435
|
-
user_email: z.string().email()
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
// packages/mcp-common/src/models/entitlements.ts
|
|
439
|
-
import { z as z2 } from "zod";
|
|
440
|
-
var itemSchema = z2.object({
|
|
441
|
-
Product: z2.object({
|
|
442
|
-
Id: z2.number().int(),
|
|
443
|
-
Code: z2.string(),
|
|
444
|
-
Name: z2.string()
|
|
445
|
-
}),
|
|
446
|
-
License: z2.nullable(
|
|
447
|
-
z2.object({
|
|
448
|
-
Id: z2.number().int(),
|
|
449
|
-
Name: z2.string(),
|
|
450
|
-
Type: z2.string(),
|
|
451
|
-
Active: z2.boolean()
|
|
452
|
-
})
|
|
453
|
-
),
|
|
454
|
-
Availability: z2.array(
|
|
455
|
-
z2.object({
|
|
456
|
-
LicenseStart: z2.nullable(z2.string().datetime()),
|
|
457
|
-
LicenseEnd: z2.nullable(z2.string().datetime())
|
|
458
|
-
})
|
|
459
|
-
),
|
|
460
|
-
IsLicenseAvailable: z2.optional(z2.boolean())
|
|
461
|
-
});
|
|
462
|
-
var entitlementsSchema = z2.array(itemSchema);
|
|
463
|
-
|
|
464
|
-
// packages/mcp-common/src/lib/utils.ts
|
|
465
|
-
async function checkAccess(cb) {
|
|
466
|
-
const access = process.env.KENDO_MCP_ACCESS;
|
|
467
|
-
if (access === "true" || access === "1" || access === "full") {
|
|
468
|
-
return "full";
|
|
469
|
-
} else if (typeof access === "string" && (access.toLowerCase() === "agent" || access.toLowerCase() === "assistant")) {
|
|
470
|
-
return access.toLowerCase();
|
|
471
|
-
}
|
|
472
|
-
const productCode = await cb();
|
|
473
|
-
if (productCode.toLocaleLowerCase() === "agentic_ui_generator") {
|
|
474
|
-
return "agent";
|
|
475
|
-
}
|
|
476
|
-
if (productCode.toLocaleLowerCase() === "ai_coding_assistants") {
|
|
477
|
-
return "assistant";
|
|
478
|
-
}
|
|
479
|
-
return "none";
|
|
480
|
-
}
|
|
481
|
-
|
|
482
|
-
// packages/mcp-common/src/lib/instructions/accessibility.ts
|
|
483
|
-
function getAccessibilityGuidelines() {
|
|
484
|
-
return `**Accessibility Guidelines: WCAG 2.2 Level AA Compliance**
|
|
485
|
-
|
|
486
|
-
**Core Principles:**
|
|
487
|
-
1. Use semantic HTML and ARIA correctly
|
|
488
|
-
2. Ensure WCAG 2.2 AA compliance
|
|
489
|
-
3. Follow W3C ARIA Authoring Practices
|
|
490
|
-
4. Provide standards-based accessibility fixes
|
|
491
|
-
|
|
492
|
-
**1. Form Control Labels** (WCAG 1.3.1, 3.3.2, 4.1.2)
|
|
493
|
-
Every input must have an associated label.
|
|
494
|
-
CORRECT: \`<input type="search" aria-label="Search products" placeholder="Search...">\`
|
|
495
|
-
CORRECT: \`<label for="qty">Quantity</label><input type="number" id="qty">\`
|
|
496
|
-
WRONG: \`<span>Email</span><input type="email">\` (no association)
|
|
497
|
-
WRONG: \`<input type="email" placeholder="Email">\` (placeholder as label)
|
|
498
|
-
|
|
499
|
-
**2. Button Accessibility** (WCAG 4.1.2, 2.4.6, 2.5.3)
|
|
500
|
-
All buttons need accessible names describing their purpose.
|
|
501
|
-
CORRECT: \`<button type="button">Save Changes</button>\`
|
|
502
|
-
CORRECT: \`<button aria-label="Close dialog"><svg aria-hidden="true" focusable="false">...</svg></button>\`
|
|
503
|
-
WRONG: \`<button><svg>...</svg></button>\` (no accessible name)
|
|
504
|
-
WRONG: \`<button>Click here</button>\` (generic text)
|
|
505
|
-
|
|
506
|
-
**3. Popup/Menu Triggers** (WCAG 4.1.2, 1.3.1)
|
|
507
|
-
Indicate popup purpose and state using aria-haspopup, aria-expanded, aria-controls.
|
|
508
|
-
CORRECT: \`<button aria-expanded="false" aria-haspopup="menu" aria-controls="menu-id">Settings</button>\`
|
|
509
|
-
|
|
510
|
-
**4. Image Accessibility** (WCAG 1.1.1)
|
|
511
|
-
Informative: \`<img src="chart.png" alt="Sales increased 25% in Q4 2024">\`
|
|
512
|
-
Functional: \`<a href="/home"><img src="logo.png" alt="Company Name Home"></a>\`
|
|
513
|
-
Decorative: \`<img src="border.png" alt="" role="presentation">\`
|
|
514
|
-
Complex: \`<img src="chart.png" alt="Sales data" aria-describedby="desc-id">\`
|
|
515
|
-
WRONG: Missing alt, filename as alt, generic alt for decorative images
|
|
516
|
-
|
|
517
|
-
**5. Link Accessibility** (WCAG 2.4.4, 2.4.6)
|
|
518
|
-
Links must be descriptive and understandable out of context.
|
|
519
|
-
CORRECT: \`<a href="/products">View All Products</a>\`
|
|
520
|
-
CORRECT: \`<a href="/article" aria-label="Read more about New Product Launch">Read more</a>\`
|
|
521
|
-
WRONG: "Click here", "Read more", "Learn more" without context
|
|
522
|
-
|
|
523
|
-
**6. Form Validation** (WCAG 3.3.1, 3.3.2, 3.3.3)
|
|
524
|
-
Errors must be identified, associated with inputs, and provide suggestions. Use aria-describedby, aria-invalid="true", and role="alert".
|
|
525
|
-
|
|
526
|
-
**7. Heading Structure** (WCAG 1.3.1, 2.4.6)
|
|
527
|
-
Each page must have an \`<h1>\` that describes its content. Use hierarchical, descriptive headings with no skipped levels (h1\u2192h2\u2192h3).
|
|
528
|
-
CORRECT: \`<h1>Dashboard</h1> <h2>Sales</h2> <h3>By Region</h3>\`
|
|
529
|
-
WRONG: No \`<h1>\` on the page, or skipping levels (h1\u2192h3)
|
|
530
|
-
If a heading should look smaller than its semantic level, use CSS: \`<h2 class="text-sm">Subtitle</h2>\`
|
|
531
|
-
|
|
532
|
-
**8. Page Component Landmark Rules** (WCAG 1.3.1, 4.1.2)
|
|
533
|
-
Page components (route components) may be rendered inside a layout that already provides \`<main>\`, \`<header>\`, or \`<footer>\`. Since the layout configuration is unknown, avoid using these landmarks in page components to prevent potential duplication and nesting violations. Use \`<div>\`, \`<section>\`, or \`<article>\` as the top-level wrapper instead.
|
|
534
|
-
- Avoid adding \`<main>\`, \`role="main"\`, \`<header>\`, or \`<footer>\` in page components \u2014 the layout typically provides them. Duplicating them can cause \`landmark-no-duplicate-main\` and \`landmark-main-is-top-level\` violations.
|
|
535
|
-
- Avoid adding \`role="banner"\` or using a semantic \`<header>\` element in page components \u2014 the layout's \`<header>\` already claims the banner landmark. Adding another causes \`landmark-banner-is-top-level\` violations.
|
|
536
|
-
- Avoid adding \`role="contentinfo"\` to elements inside page components \u2014 the contentinfo landmark should be a top-level landmark, not nested inside \`<main>\` or other landmarks. Nesting it can cause \`landmark-contentinfo-is-top-level\` violations.
|
|
537
|
-
- When multiple \`<section>\` or \`<nav>\` elements exist on a page, give each a unique \`aria-label\` to avoid \`landmark-unique\` violations.
|
|
538
|
-
|
|
539
|
-
**9. ARIA Role and Attribute Restrictions** (WCAG 4.1.2)
|
|
540
|
-
Only use ARIA roles that are valid for the given HTML element. Avoid adding \`aria-label\` or \`aria-labelledby\` to elements that do not permit naming.
|
|
541
|
-
- \`<article>\` has an implicit \`article\` role. Do NOT override it with \`role="listitem"\`, \`role="button"\`, \`role="link"\`, or any other role \u2014 none are allowed on \`<article>\`. Use \`<li>\` for list items, \`<button>\` for interactive cards, or \`<a>\` for clickable cards instead.
|
|
542
|
-
- \`<button>\` already has an implicit \`button\` role. Do NOT add \`role="listitem"\` or other incompatible roles.
|
|
543
|
-
- \`<span>\` and \`<div>\` without roles are generic elements. Do NOT add \`aria-label\` to them \u2014 it is a prohibited attribute on elements with no accessible role and can cause \`aria-prohibited-attr\` violations. Instead, use \`role="img"\` + \`aria-label\` for visual indicators, or use visually hidden text.
|
|
544
|
-
- Do NOT add \`aria-label\` to non-interactive \`<div>\` wrappers \u2014 it has no effect and triggers violations.
|
|
545
|
-
- \`aria-pressed\` is only valid on elements with \`role="button"\`, \`role="checkbox"\`, \`role="menuitemcheckbox"\`, \`role="option"\`, \`role="radio"\`, or \`role="switch"\`. Do NOT use \`aria-pressed\` on elements with \`role="listitem"\` or other roles.
|
|
546
|
-
CORRECT: \`<ul role="list"><li class="product-card">...</li></ul>\` (listitem inside list)
|
|
547
|
-
CORRECT: \`<span role="img" aria-label="Status: pending" class="status-dot"></span>\` (role added before aria-label)
|
|
548
|
-
CORRECT: \`<span class="status-dot" aria-hidden="true"></span><span class="visually-hidden">Pending</span>\` (hidden text alternative)
|
|
549
|
-
WRONG: \`<article role="listitem">\` (listitem not allowed on article)
|
|
550
|
-
WRONG: \`<article role="button">\` (button not allowed on article \u2014 use \`<button>\` or \`<div role="button">\`)
|
|
551
|
-
WRONG: \`<span aria-label="pending" class="status-dot"></span>\` (aria-label prohibited on generic span)
|
|
552
|
-
WRONG: \`<div aria-label="Product badges" class="badges"></div>\` (aria-label prohibited on generic div)
|
|
553
|
-
|
|
554
|
-
**Quick Checklist:**
|
|
555
|
-
- **Forms:** Associated labels, aria-required on required fields, autocomplete attributes, aria-describedby for errors, aria-invalid for invalid fields, fieldsets with legends
|
|
556
|
-
- **Buttons/Links:** Accessible names, aria-label for icon buttons, aria-hidden on decorative icons, descriptive link text
|
|
557
|
-
- **Popups/Dialogs:** aria-haspopup, aria-expanded, aria-controls, role="dialog", aria-modal="true", aria-labelledby, focus trap, Escape to close
|
|
558
|
-
- **Images:** alt on all images, descriptive alt for informative, empty alt for decorative, aria-describedby for complex
|
|
559
|
-
- **Structure:** One h1, logical heading hierarchy, avoid \`<main>\`, \`<header>\`, \`<footer>\`, \`role="main"\`, \`role="contentinfo"\`, \`role="banner"\` in page/route components (the layout may already provide them), use \`<section>\` or \`<div>\` as page-level wrappers, unique aria-labels on duplicate landmark types
|
|
560
|
-
- **ARIA Rules:** Avoid adding \`aria-label\` to generic \`<span>\`/\`<div>\` without a role, avoid using \`role="listitem"\` or \`role="button"\` on \`<article>\` \u2014 use \`<li>\` for list items, add \`role="img"\` before \`aria-label\` on visual indicators, \`aria-pressed\` only on button-like roles
|
|
561
|
-
- **Scrollable Regions:** Any scrollable container must have \`tabindex="0"\` or contain keyboard-interactive children
|
|
562
|
-
- **Nested Interactive:** Do not add interactive role/tabindex to a container that already has focusable children
|
|
563
|
-
- **List Roles:** \`role="list"\` containers must have \`role="listitem"\` children \u2014 prefer \`<ul>/<li>\` natively
|
|
564
|
-
- **Dynamic Content:** role="status"/aria-live="polite" for updates, role="alert"/aria-live="assertive" for critical alerts
|
|
565
|
-
- **Keyboard/Focus:** All interactive elements keyboard accessible, logical focus order, visible focus indicators, no keyboard traps (except modals)
|
|
566
|
-
- **Color/Contrast:** 4.5:1 text contrast (3:1 large text), 3:1 UI component contrast, no color-only information, 3:1 focus indicator contrast`;
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
// packages/mcp-common/src/lib/heartbeat.ts
|
|
570
|
-
var ONE_DAY_MS = 24 * 60 * 60 * 1e3;
|
|
571
|
-
function startHeartbeat(options) {
|
|
572
|
-
const {
|
|
573
|
-
serverName,
|
|
574
|
-
contextApi: contextApi2,
|
|
575
|
-
additionalFields = {},
|
|
576
|
-
intervalMs = ONE_DAY_MS
|
|
577
|
-
} = options;
|
|
578
|
-
const eventName = `mcp_server_heartbeat`;
|
|
579
|
-
const sendHeartbeat = async () => {
|
|
580
|
-
try {
|
|
581
|
-
const fields = {
|
|
582
|
-
server_name: serverName,
|
|
583
|
-
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
584
|
-
...additionalFields
|
|
585
|
-
};
|
|
586
|
-
await contextApi2.logEvent(eventName, fields);
|
|
587
|
-
} catch (error) {
|
|
588
|
-
log(`Failed to send heartbeat for ${serverName}:`, error);
|
|
589
|
-
}
|
|
590
|
-
};
|
|
591
|
-
sendHeartbeat();
|
|
592
|
-
const intervalId = setInterval(sendHeartbeat, intervalMs);
|
|
593
|
-
return () => {
|
|
594
|
-
clearInterval(intervalId);
|
|
595
|
-
log(`Heartbeat stopped for ${serverName}`);
|
|
596
|
-
};
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
// packages/mcp-common/src/lib/getting-started-params.ts
|
|
600
|
-
import { z as z3 } from "zod";
|
|
601
|
-
var KendoThemes = ["default", "bootstrap", "material", "fluent"];
|
|
602
|
-
function createGettingStartedInputSchema(suiteName, defaultProjectName) {
|
|
603
|
-
return {
|
|
604
|
-
projectName: z3.string().default(defaultProjectName).describe(
|
|
605
|
-
"The name of the project. Used as the project folder name when creating a new project."
|
|
606
|
-
),
|
|
607
|
-
createNewProject: z3.boolean().default(true).describe(
|
|
608
|
-
`Whether to create a new project before configuring ${suiteName}. Set to true to scaffold a brand-new project, or false if the project already exists and you only want to add ${suiteName} to it.`
|
|
609
|
-
),
|
|
610
|
-
theme: z3.enum(KendoThemes).default("default").describe(
|
|
611
|
-
"The Kendo UI theme to use. Determines which theme package is installed and imported."
|
|
612
|
-
)
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
// packages/angular/src/lib/constants.ts
|
|
617
|
-
var ANGULAR_SUITE_NAME = "Kendo UI for Angular";
|
|
618
|
-
var Suite = "angular";
|
|
619
|
-
var PRODUCT_LINE = "kendo";
|
|
620
|
-
var AngularComponents = [
|
|
621
|
-
"AIPrompt",
|
|
622
|
-
"ActionSheet",
|
|
623
|
-
"AppBar",
|
|
624
|
-
"ArcGauge",
|
|
625
|
-
"AutoComplete",
|
|
626
|
-
"Avatar",
|
|
627
|
-
"Badge",
|
|
628
|
-
"Barcode",
|
|
629
|
-
"BottomNavigation",
|
|
630
|
-
"BreadCrumb",
|
|
631
|
-
"Button",
|
|
632
|
-
"ButtonGroup",
|
|
633
|
-
"Calendar",
|
|
634
|
-
"Card",
|
|
635
|
-
"ChartWizard",
|
|
636
|
-
"Charts",
|
|
637
|
-
"CheckBox",
|
|
638
|
-
"Chip",
|
|
639
|
-
"ChipList",
|
|
640
|
-
"ChunkProgressBar",
|
|
641
|
-
"CircularGauge",
|
|
642
|
-
"CircularProgressBar",
|
|
643
|
-
"ColorGradient",
|
|
644
|
-
"ColorPalette",
|
|
645
|
-
"ColorPicker",
|
|
646
|
-
"ComboBox",
|
|
647
|
-
"ContextMenu",
|
|
648
|
-
"ConversationalUI",
|
|
649
|
-
"DataQuery",
|
|
650
|
-
"DateInput",
|
|
651
|
-
"DateMath",
|
|
652
|
-
"DatePicker",
|
|
653
|
-
"DateRange",
|
|
654
|
-
"DateTimePicker",
|
|
655
|
-
"Diagram",
|
|
656
|
-
"Dialog",
|
|
657
|
-
"DragandDrop",
|
|
658
|
-
"Drawer",
|
|
659
|
-
"Drawing",
|
|
660
|
-
"DropDownButton",
|
|
661
|
-
"DropDownList",
|
|
662
|
-
"DropDownTree",
|
|
663
|
-
"Editor",
|
|
664
|
-
"ExcelExport",
|
|
665
|
-
"ExpansionPanel",
|
|
666
|
-
"FileSaver",
|
|
667
|
-
"FileSelect",
|
|
668
|
-
"Filter",
|
|
669
|
-
"FlatColorPicker",
|
|
670
|
-
"FloatingActionButton",
|
|
671
|
-
"FloatingLabel",
|
|
672
|
-
"Forms",
|
|
673
|
-
"FormField",
|
|
674
|
-
"Gantt",
|
|
675
|
-
"Gauges",
|
|
676
|
-
"General",
|
|
677
|
-
"Grid",
|
|
678
|
-
"GridLayout",
|
|
679
|
-
"Icon",
|
|
680
|
-
"InlineAIPrompt",
|
|
681
|
-
"Label",
|
|
682
|
-
"LinearGauge",
|
|
683
|
-
"ListBox",
|
|
684
|
-
"ListView",
|
|
685
|
-
"Loader",
|
|
686
|
-
"Map",
|
|
687
|
-
"MaskedTextBox",
|
|
688
|
-
"Menu",
|
|
689
|
-
"MultiColumnComboBox",
|
|
690
|
-
"MultiSelect",
|
|
691
|
-
"MultiSelectTree",
|
|
692
|
-
"MultiViewCalendar",
|
|
693
|
-
"Notification",
|
|
694
|
-
"NumericTextBox",
|
|
695
|
-
"OTPInput",
|
|
696
|
-
"Pager",
|
|
697
|
-
"PanelBar",
|
|
698
|
-
"PDFExport",
|
|
699
|
-
"PDFViewer",
|
|
700
|
-
"PivotGrid",
|
|
701
|
-
"Popover",
|
|
702
|
-
"Popup",
|
|
703
|
-
"ProgressBar",
|
|
704
|
-
"PromptBox",
|
|
705
|
-
"QRCode",
|
|
706
|
-
"RadialGauge",
|
|
707
|
-
"RadioButton",
|
|
708
|
-
"RangeSlider",
|
|
709
|
-
"Rating",
|
|
710
|
-
"Ripple",
|
|
711
|
-
"Sankey",
|
|
712
|
-
"Scheduler",
|
|
713
|
-
"ScrollView",
|
|
714
|
-
"Signature",
|
|
715
|
-
"Skeleton",
|
|
716
|
-
"Slider",
|
|
717
|
-
"SmartPasteButton",
|
|
718
|
-
"Sortable",
|
|
719
|
-
"StockChart",
|
|
720
|
-
"Sparkline",
|
|
721
|
-
"SpeechToTextButton",
|
|
722
|
-
"SplitButton",
|
|
723
|
-
"Splitter",
|
|
724
|
-
"Spreadsheet",
|
|
725
|
-
"StackLayout",
|
|
726
|
-
"Stepper",
|
|
727
|
-
"SVGIcon",
|
|
728
|
-
"Switch",
|
|
729
|
-
"TabStrip",
|
|
730
|
-
"TextArea",
|
|
731
|
-
"TextBox",
|
|
732
|
-
"TileLayout",
|
|
733
|
-
"Timeline",
|
|
734
|
-
"TimePicker",
|
|
735
|
-
"ToolBar",
|
|
736
|
-
"Tooltip",
|
|
737
|
-
"TreeList",
|
|
738
|
-
"TreeView",
|
|
739
|
-
"Typography",
|
|
740
|
-
"Upload",
|
|
741
|
-
"Window"
|
|
742
|
-
];
|
|
743
|
-
var COMPONENT_PACKAGE_MAP = /* @__PURE__ */ new Map([
|
|
744
|
-
["actionsheet", "@progress/kendo-angular-navigation"],
|
|
745
|
-
["aiprompt", "@progress/kendo-angular-conversational-ui"],
|
|
746
|
-
["appbar", "@progress/kendo-angular-navigation"],
|
|
747
|
-
["arcgauge", "@progress/kendo-angular-gauges"],
|
|
748
|
-
["autocomplete", "@progress/kendo-angular-dropdowns"],
|
|
749
|
-
["avatar", "@progress/kendo-angular-layout"],
|
|
750
|
-
["badge", "@progress/kendo-angular-indicators"],
|
|
751
|
-
["barcode", "@progress/kendo-angular-barcodes"],
|
|
752
|
-
["bottomnavigation", "@progress/kendo-angular-navigation"],
|
|
753
|
-
["breadcrumb", "@progress/kendo-angular-navigation"],
|
|
754
|
-
["button", "@progress/kendo-angular-buttons"],
|
|
755
|
-
["buttongroup", "@progress/kendo-angular-buttons"],
|
|
756
|
-
["calendar", "@progress/kendo-angular-dateinputs"],
|
|
757
|
-
["card", "@progress/kendo-angular-layout"],
|
|
758
|
-
["chartwizard", "@progress/kendo-angular-chart-wizard"],
|
|
759
|
-
["checkbox", "@progress/kendo-angular-inputs"],
|
|
760
|
-
["chip", "@progress/kendo-angular-buttons"],
|
|
761
|
-
["chiplist", "@progress/kendo-angular-buttons"],
|
|
762
|
-
["chunkprogressbar", "@progress/kendo-angular-progressbar"],
|
|
763
|
-
["circulargauge", "@progress/kendo-angular-gauges"],
|
|
764
|
-
["circularprogressbar", "@progress/kendo-angular-progressbar"],
|
|
765
|
-
["colorgradient", "@progress/kendo-angular-inputs"],
|
|
766
|
-
["colorpalette", "@progress/kendo-angular-inputs"],
|
|
767
|
-
["colorpicker", "@progress/kendo-angular-inputs"],
|
|
768
|
-
["combobox", "@progress/kendo-angular-dropdowns"],
|
|
769
|
-
["contextmenu", "@progress/kendo-angular-menu"],
|
|
770
|
-
["dataquery", "@progress/kendo-data-query"],
|
|
771
|
-
["dateinput", "@progress/kendo-angular-dateinputs"],
|
|
772
|
-
["datemath", "@progress/kendo-date-math"],
|
|
773
|
-
["datepicker", "@progress/kendo-angular-dateinputs"],
|
|
774
|
-
["daterangepicker", "@progress/kendo-angular-dateinputs"],
|
|
775
|
-
["datetimepicker", "@progress/kendo-angular-dateinputs"],
|
|
776
|
-
["diagram", "@progress/kendo-angular-diagrams"],
|
|
777
|
-
["dialog", "@progress/kendo-angular-dialog"],
|
|
778
|
-
["drawer", "@progress/kendo-angular-layout"],
|
|
779
|
-
["drawing", "@progress/kendo-drawing"],
|
|
780
|
-
["dropdownbutton", "@progress/kendo-angular-buttons"],
|
|
781
|
-
["dropdownlist", "@progress/kendo-angular-dropdowns"],
|
|
782
|
-
["dropdowntree", "@progress/kendo-angular-dropdowns"],
|
|
783
|
-
["editor", "@progress/kendo-angular-editor"],
|
|
784
|
-
["excelexport", "@progress/kendo-angular-excel-export"],
|
|
785
|
-
["expansionpanel", "@progress/kendo-angular-layout"],
|
|
786
|
-
["filesaver", "@progress/kendo-file-saver"],
|
|
787
|
-
["fileselect", "@progress/kendo-angular-upload"],
|
|
788
|
-
["filter", "@progress/kendo-angular-filter"],
|
|
789
|
-
["flatcolorpicker", "@progress/kendo-angular-inputs"],
|
|
790
|
-
["floatingactionbutton", "@progress/kendo-angular-buttons"],
|
|
791
|
-
["floatinglabel", "@progress/kendo-angular-label"],
|
|
792
|
-
["formfield", "@progress/kendo-angular-inputs"],
|
|
793
|
-
["forms", "@progress/kendo-angular-inputs"],
|
|
794
|
-
["gantt", "@progress/kendo-angular-gantt"],
|
|
795
|
-
["grid", "@progress/kendo-angular-grid"],
|
|
796
|
-
["gridlayout", "@progress/kendo-angular-layout"],
|
|
797
|
-
["icon", "@progress/kendo-angular-icons"],
|
|
798
|
-
["inlineaiprompt", "@progress/kendo-angular-conversational-ui"],
|
|
799
|
-
["label", "@progress/kendo-angular-label"],
|
|
800
|
-
["lineargauge", "@progress/kendo-angular-gauges"],
|
|
801
|
-
["listbox", "@progress/kendo-angular-listbox"],
|
|
802
|
-
["listview", "@progress/kendo-angular-listview"],
|
|
803
|
-
["loader", "@progress/kendo-angular-indicators"],
|
|
804
|
-
["map", "@progress/kendo-angular-map"],
|
|
805
|
-
["maskedtextbox", "@progress/kendo-angular-inputs"],
|
|
806
|
-
["menu", "@progress/kendo-angular-menu"],
|
|
807
|
-
["multicolumncombobox", "@progress/kendo-angular-dropdowns"],
|
|
808
|
-
["multiselect", "@progress/kendo-angular-dropdowns"],
|
|
809
|
-
["multiselecttree", "@progress/kendo-angular-dropdowns"],
|
|
810
|
-
["multiviewcalendar", "@progress/kendo-angular-dateinputs"],
|
|
811
|
-
["notification", "@progress/kendo-angular-notification"],
|
|
812
|
-
["numerictextbox", "@progress/kendo-angular-inputs"],
|
|
813
|
-
["otpinput", "@progress/kendo-angular-inputs"],
|
|
814
|
-
["pager", "@progress/kendo-angular-pager"],
|
|
815
|
-
["panelbar", "@progress/kendo-angular-layout"],
|
|
816
|
-
["pdfexport", "@progress/kendo-angular-pdf-export"],
|
|
817
|
-
["pdfviewer", "@progress/kendo-angular-pdfviewer"],
|
|
818
|
-
["pivotgrid", "@progress/kendo-angular-pivotgrid"],
|
|
819
|
-
["popover", "@progress/kendo-angular-tooltip"],
|
|
820
|
-
["popup", "@progress/kendo-angular-popup"],
|
|
821
|
-
["progressbar", "@progress/kendo-angular-progressbar"],
|
|
822
|
-
["promptbox", "@progress/kendo-angular-conversational-ui"],
|
|
823
|
-
["qrcode", "@progress/kendo-angular-barcodes"],
|
|
824
|
-
["radialgauge", "@progress/kendo-angular-gauges"],
|
|
825
|
-
["radiobutton", "@progress/kendo-angular-inputs"],
|
|
826
|
-
["rangeslider", "@progress/kendo-angular-inputs"],
|
|
827
|
-
["rating", "@progress/kendo-angular-inputs"],
|
|
828
|
-
["ripple", "@progress/kendo-angular-ripple"],
|
|
829
|
-
["sankey", "@progress/kendo-angular-charts"],
|
|
830
|
-
["scheduler", "@progress/kendo-angular-scheduler"],
|
|
831
|
-
["scrollview", "@progress/kendo-angular-scrollview"],
|
|
832
|
-
["signature", "@progress/kendo-angular-inputs"],
|
|
833
|
-
["skeleton", "@progress/kendo-angular-indicators"],
|
|
834
|
-
["slider", "@progress/kendo-angular-inputs"],
|
|
835
|
-
["smartpastebutton", "@progress/kendo-angular-buttons"],
|
|
836
|
-
["sortable", "@progress/kendo-angular-sortable"],
|
|
837
|
-
["sparkline", "@progress/kendo-angular-charts"],
|
|
838
|
-
["speechtotextbutton", "@progress/kendo-angular-buttons"],
|
|
839
|
-
["splitbutton", "@progress/kendo-angular-buttons"],
|
|
840
|
-
["splitter", "@progress/kendo-angular-layout"],
|
|
841
|
-
["spreadsheet", "@progress/kendo-angular-spreadsheet"],
|
|
842
|
-
["stacklayout", "@progress/kendo-angular-layout"],
|
|
843
|
-
["stepper", "@progress/kendo-angular-layout"],
|
|
844
|
-
["stockchart", "@progress/kendo-angular-charts"],
|
|
845
|
-
["svgicon", "@progress/kendo-angular-icons"],
|
|
846
|
-
["switch", "@progress/kendo-angular-inputs"],
|
|
847
|
-
["tabstrip", "@progress/kendo-angular-layout"],
|
|
848
|
-
["textarea", "@progress/kendo-angular-inputs"],
|
|
849
|
-
["textbox", "@progress/kendo-angular-inputs"],
|
|
850
|
-
["tilelayout", "@progress/kendo-angular-layout"],
|
|
851
|
-
["timeline", "@progress/kendo-angular-layout"],
|
|
852
|
-
["timepicker", "@progress/kendo-angular-dateinputs"],
|
|
853
|
-
["toolbar", "@progress/kendo-angular-toolbar"],
|
|
854
|
-
["treelist", "@progress/kendo-angular-treelist"],
|
|
855
|
-
["treeview", "@progress/kendo-angular-treeview"],
|
|
856
|
-
["typography", "@progress/kendo-angular-typography"],
|
|
857
|
-
["upload", "@progress/kendo-angular-upload"],
|
|
858
|
-
["window", "@progress/kendo-angular-dialog"],
|
|
859
|
-
["charts", "@progress/kendo-angular-charts"],
|
|
860
|
-
["conversationalui", "@progress/kendo-angular-conversational-ui"],
|
|
861
|
-
["tooltip", "@progress/kendo-angular-tooltip"]
|
|
862
|
-
]);
|
|
863
|
-
|
|
864
|
-
// packages/angular/src/lib/grpc-client.ts
|
|
865
|
-
var protoPath = join(
|
|
866
|
-
dirname(fileURLToPath2(import.meta.url)),
|
|
867
|
-
"../proto/service.proto"
|
|
868
|
-
);
|
|
869
|
-
var contextApi = new ContextAPI("contextapi.telerik.com:443", protoPath, {
|
|
870
|
-
libName: Suite
|
|
871
|
-
});
|
|
872
|
-
var validateUserLicense = async () => {
|
|
873
|
-
return contextApi.validateUserLicense();
|
|
874
|
-
};
|
|
875
|
-
|
|
876
|
-
// packages/angular/src/index.ts
|
|
877
|
-
import fs3 from "fs";
|
|
878
|
-
import path3 from "path";
|
|
879
|
-
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
880
|
-
|
|
881
|
-
// packages/kendo-ui-agent/src/lib/tools-factory.ts
|
|
882
|
-
import { z as z4 } from "zod";
|
|
883
|
-
|
|
884
|
-
// packages/kendo-ui-agent/src/lib/ui-agent-tool.ts
|
|
885
|
-
var UIAgentTool = class {
|
|
886
|
-
constructor(name, config, cb) {
|
|
887
|
-
this.name = name;
|
|
888
|
-
this.config = config;
|
|
889
|
-
this.cb = cb;
|
|
890
|
-
}
|
|
891
|
-
register(mcpServer) {
|
|
892
|
-
this.server = mcpServer;
|
|
893
|
-
this.server.registerTool(this.name, this.config, this.cb);
|
|
894
|
-
}
|
|
895
|
-
hasAccess(accessType) {
|
|
896
|
-
if (!this.config.requiredAccess || this.config.requiredAccess.length === 0) {
|
|
897
|
-
return true;
|
|
898
|
-
}
|
|
899
|
-
return accessType === "full" || this.config.requiredAccess.includes(accessType);
|
|
900
|
-
}
|
|
901
|
-
};
|
|
902
|
-
|
|
903
|
-
// packages/kendo-ui-agent/src/lib/templates/validator.ts
|
|
904
|
-
var renderValidatorResponse = (ctx, frameworkValidationSteps) => `# ${ctx.suiteName} - Code Validation & Quality Assurance
|
|
5
|
+
License Error: ${o}`);let i=new P.Metadata;if(r)try{i.add("x-license-key",s)}catch(p){throw g("Error adding license key to metadata:",p),new Error(`Failed to use license key: ${p.message}`)}a&&i.add("x-api-key",n),this.options?.libName&&i.add("x-library-name",this.options.libName),i.add("x-tool-name",this.toolNameHeader);let d=JSON.stringify({...t,source:"npm",version:ue.version,os:process.platform,node_version:process.version});return i.add("x-request-metadata",vt(d)),i}async query(t,s){let o=await this.getMetadata({meta:s});return new Promise((n,a)=>{this.client.query(t,o,(r,i)=>{r?a(new Error(r)):n(i)})})}async getApiRefMatches(t,s){let o=await this.getMetadata({meta:s});return new Promise((n,a)=>{this.client.getApiRefMatches(t,o,(r,i)=>{r?a(new Error(r)):n(i)})})}async queryCssUtils(t,s){let o=await this.getMetadata({meta:s});return new Promise((n,a)=>{this.client.cssUtilsSearch(t,o,(r,i)=>{r?(g("Error querying CSS Utils:",r),a(new Error(r))):n(i)})})}async queryIconsSearch(t,s){let o=await this.getMetadata({meta:s});return new Promise((n,a)=>{this.client.iconsSearch(t,o,(r,i)=>{r?(g("Error querying Icons Search:",r),a(new Error(r))):n(i)})})}async queryBuildingBlocks(t,s){let o=await this.getMetadata({meta:s});return new Promise((n,a)=>{this.client.buildingBlocksSearch(t,o,(r,i)=>{r?(g("Error querying Building Blocks:",r),a(new Error(r))):n(i)})})}async validateUserLicense(){let t=await this.getMetadata();return new Promise((s,o)=>{this.client.validateUserLicense(null,t,(n,a)=>{n?(g("Error validating user license:",n),o(new Error(n))):s(a)})})}async queryThemeGenerate(t,s){let o=await this.getMetadata({meta:s});return new Promise((n,a)=>{this.client.generateTheme(t,o,(r,i)=>{r?(g("Error querying context API/GenerateTheme:",r),a(new Error(r))):n(i)})})}async recordOrchestratorUserRequest({meta:t}){let s=await this.getMetadata({meta:t});return new Promise((o,n)=>{this.client.recordOrchestratorUserRequest(null,s,(a,r)=>{a?(g("Error recording orchestrator user request:",a),n(new Error(a))):o(r)})})}async recordToolUserRequest({toolName:t,meta:s}){let o=await this.getMetadata({meta:s});return new Promise((n,a)=>{this.client.recordToolUserRequest({tool_name:t},o,(r,i)=>{r?(g("Error recording tool user request:",r),a(new Error(r))):n(i)})})}async logEvent(t,s){let o=process.env.LOGGING_API_KEY;if(!o||typeof o!="string"){g("LOGGING_API_KEY not configured, skipping log event");return}let n=new P.Metadata;return n.add("x-api-key",o),new Promise((a,r)=>{this.client.logEvent({event_name:t,fields:s||{}},n,(i,d)=>{i?(g("Error logging event:",i),r(new Error(i))):a()})})}};import{z as K}from"zod";var yo=K.object({user_id:K.string(),user_email:K.string().email()});import{z as v}from"zod";var At=v.object({Product:v.object({Id:v.number().int(),Code:v.string(),Name:v.string()}),License:v.nullable(v.object({Id:v.number().int(),Name:v.string(),Type:v.string(),Active:v.boolean()})),Availability:v.array(v.object({LicenseStart:v.nullable(v.string().datetime()),LicenseEnd:v.nullable(v.string().datetime())})),IsLicenseAvailable:v.optional(v.boolean())}),vo=v.array(At);async function me(e){let t=process.env.KENDO_MCP_ACCESS;if(t==="true"||t==="1"||t==="full")return"full";if(typeof t=="string"&&(t.toLowerCase()==="agent"||t.toLowerCase()==="assistant"))return t.toLowerCase();let s=await e();return s.toLocaleLowerCase()==="agentic_ui_generator"?"agent":s.toLocaleLowerCase()==="ai_coding_assistants"?"assistant":"none"}function ge(){return'**Accessibility Guidelines: WCAG 2.2 Level AA Compliance**\n\n**Core Principles:**\n1. Use semantic HTML and ARIA correctly\n2. Ensure WCAG 2.2 AA compliance\n3. Follow W3C ARIA Authoring Practices\n4. Provide standards-based accessibility fixes\n\n**1. Form Control Labels** (WCAG 1.3.1, 3.3.2, 4.1.2)\nEvery input must have an associated label.\nCORRECT: `<input type="search" aria-label="Search products" placeholder="Search...">`\nCORRECT: `<label for="qty">Quantity</label><input type="number" id="qty">`\nWRONG: `<span>Email</span><input type="email">` (no association)\nWRONG: `<input type="email" placeholder="Email">` (placeholder as label)\n\n**2. Button Accessibility** (WCAG 4.1.2, 2.4.6, 2.5.3)\nAll buttons need accessible names describing their purpose.\nCORRECT: `<button type="button">Save Changes</button>`\nCORRECT: `<button aria-label="Close dialog"><svg aria-hidden="true" focusable="false">...</svg></button>`\nWRONG: `<button><svg>...</svg></button>` (no accessible name)\nWRONG: `<button>Click here</button>` (generic text)\n\n**3. Popup/Menu Triggers** (WCAG 4.1.2, 1.3.1)\nIndicate popup purpose and state using aria-haspopup, aria-expanded, aria-controls.\nCORRECT: `<button aria-expanded="false" aria-haspopup="menu" aria-controls="menu-id">Settings</button>`\n\n**4. Image Accessibility** (WCAG 1.1.1)\nInformative: `<img src="chart.png" alt="Sales increased 25% in Q4 2024">`\nFunctional: `<a href="/home"><img src="logo.png" alt="Company Name Home"></a>`\nDecorative: `<img src="border.png" alt="" role="presentation">`\nComplex: `<img src="chart.png" alt="Sales data" aria-describedby="desc-id">`\nWRONG: Missing alt, filename as alt, generic alt for decorative images\n\n**5. Link Accessibility** (WCAG 2.4.4, 2.4.6)\nLinks must be descriptive and understandable out of context.\nCORRECT: `<a href="/products">View All Products</a>`\nCORRECT: `<a href="/article" aria-label="Read more about New Product Launch">Read more</a>`\nWRONG: "Click here", "Read more", "Learn more" without context\n\n**6. Form Validation** (WCAG 3.3.1, 3.3.2, 3.3.3)\nErrors must be identified, associated with inputs, and provide suggestions. Use aria-describedby, aria-invalid="true", and role="alert".\n\n**7. Heading Structure** (WCAG 1.3.1, 2.4.6)\nEach page must have an `<h1>` that describes its content. Use hierarchical, descriptive headings with no skipped levels (h1\u2192h2\u2192h3).\nCORRECT: `<h1>Dashboard</h1> <h2>Sales</h2> <h3>By Region</h3>`\nWRONG: No `<h1>` on the page, or skipping levels (h1\u2192h3)\nIf a heading should look smaller than its semantic level, use CSS: `<h2 class="text-sm">Subtitle</h2>`\n\n**8. Page Component Landmark Rules** (WCAG 1.3.1, 4.1.2)\nPage components (route components) may be rendered inside a layout that already provides `<main>`, `<header>`, or `<footer>`. Since the layout configuration is unknown, avoid using these landmarks in page components to prevent potential duplication and nesting violations. Use `<div>`, `<section>`, or `<article>` as the top-level wrapper instead.\n- Avoid adding `<main>`, `role="main"`, `<header>`, or `<footer>` in page components \u2014 the layout typically provides them. Duplicating them can cause `landmark-no-duplicate-main` and `landmark-main-is-top-level` violations.\n- Avoid adding `role="banner"` or using a semantic `<header>` element in page components \u2014 the layout\'s `<header>` already claims the banner landmark. Adding another causes `landmark-banner-is-top-level` violations.\n- Avoid adding `role="contentinfo"` to elements inside page components \u2014 the contentinfo landmark should be a top-level landmark, not nested inside `<main>` or other landmarks. Nesting it can cause `landmark-contentinfo-is-top-level` violations.\n- When multiple `<section>` or `<nav>` elements exist on a page, give each a unique `aria-label` to avoid `landmark-unique` violations.\n\n**9. ARIA Role and Attribute Restrictions** (WCAG 4.1.2)\nOnly use ARIA roles that are valid for the given HTML element. Avoid adding `aria-label` or `aria-labelledby` to elements that do not permit naming.\n- `<article>` has an implicit `article` role. Do NOT override it with `role="listitem"`, `role="button"`, `role="link"`, or any other role \u2014 none are allowed on `<article>`. Use `<li>` for list items, `<button>` for interactive cards, or `<a>` for clickable cards instead.\n- `<button>` already has an implicit `button` role. Do NOT add `role="listitem"` or other incompatible roles.\n- `<span>` and `<div>` without roles are generic elements. Do NOT add `aria-label` to them \u2014 it is a prohibited attribute on elements with no accessible role and can cause `aria-prohibited-attr` violations. Instead, use `role="img"` + `aria-label` for visual indicators, or use visually hidden text.\n- Do NOT add `aria-label` to non-interactive `<div>` wrappers \u2014 it has no effect and triggers violations.\n- `aria-pressed` is only valid on elements with `role="button"`, `role="checkbox"`, `role="menuitemcheckbox"`, `role="option"`, `role="radio"`, or `role="switch"`. Do NOT use `aria-pressed` on elements with `role="listitem"` or other roles.\nCORRECT: `<ul role="list"><li class="product-card">...</li></ul>` (listitem inside list)\nCORRECT: `<span role="img" aria-label="Status: pending" class="status-dot"></span>` (role added before aria-label)\nCORRECT: `<span class="status-dot" aria-hidden="true"></span><span class="visually-hidden">Pending</span>` (hidden text alternative)\nWRONG: `<article role="listitem">` (listitem not allowed on article)\nWRONG: `<article role="button">` (button not allowed on article \u2014 use `<button>` or `<div role="button">`)\nWRONG: `<span aria-label="pending" class="status-dot"></span>` (aria-label prohibited on generic span)\nWRONG: `<div aria-label="Product badges" class="badges"></div>` (aria-label prohibited on generic div)\n\n**Quick Checklist:**\n- **Forms:** Associated labels, aria-required on required fields, autocomplete attributes, aria-describedby for errors, aria-invalid for invalid fields, fieldsets with legends\n- **Buttons/Links:** Accessible names, aria-label for icon buttons, aria-hidden on decorative icons, descriptive link text\n- **Popups/Dialogs:** aria-haspopup, aria-expanded, aria-controls, role="dialog", aria-modal="true", aria-labelledby, focus trap, Escape to close\n- **Images:** alt on all images, descriptive alt for informative, empty alt for decorative, aria-describedby for complex\n- **Structure:** One h1, logical heading hierarchy, avoid `<main>`, `<header>`, `<footer>`, `role="main"`, `role="contentinfo"`, `role="banner"` in page/route components (the layout may already provide them), use `<section>` or `<div>` as page-level wrappers, unique aria-labels on duplicate landmark types\n- **ARIA Rules:** Avoid adding `aria-label` to generic `<span>`/`<div>` without a role, avoid using `role="listitem"` or `role="button"` on `<article>` \u2014 use `<li>` for list items, add `role="img"` before `aria-label` on visual indicators, `aria-pressed` only on button-like roles\n- **Scrollable Regions:** Any scrollable container must have `tabindex="0"` or contain keyboard-interactive children\n- **Nested Interactive:** Do not add interactive role/tabindex to a container that already has focusable children\n- **List Roles:** `role="list"` containers must have `role="listitem"` children \u2014 prefer `<ul>/<li>` natively\n- **Dynamic Content:** role="status"/aria-live="polite" for updates, role="alert"/aria-live="assertive" for critical alerts\n- **Keyboard/Focus:** All interactive elements keyboard accessible, logical focus order, visible focus indicators, no keyboard traps (except modals)\n- **Color/Contrast:** 4.5:1 text contrast (3:1 large text), 3:1 UI component contrast, no color-only information, 3:1 focus indicator contrast'}var wt=1440*60*1e3;function he(e){let{serverName:t,contextApi:s,additionalFields:o={},intervalMs:n=wt}=e,a="mcp_server_heartbeat",r=async()=>{try{let d={server_name:t,timestamp:new Date().toISOString(),...o};await s.logEvent(a,d)}catch(d){g(`Failed to send heartbeat for ${t}:`,d)}};r();let i=setInterval(r,n);return()=>{clearInterval(i),g(`Heartbeat stopped for ${t}`)}}import{z as j}from"zod";var St=["default","bootstrap","material","fluent"];function fe(e,t){return{projectName:j.string().default(t).describe("The name of the project. Used as the project folder name when creating a new project."),createNewProject:j.boolean().default(!0).describe(`Whether to create a new project before configuring ${e}. Set to true to scaffold a brand-new project, or false if the project already exists and you only want to add ${e} to it.`),theme:j.enum(St).default("default").describe("The Kendo UI theme to use. Determines which theme package is installed and imported.")}}var l="Kendo UI for Angular",T="angular",I="kendo",O=["AIPrompt","ActionSheet","AppBar","ArcGauge","AutoComplete","Avatar","Badge","Barcode","BottomNavigation","BreadCrumb","Button","ButtonGroup","Calendar","Card","ChartWizard","Charts","CheckBox","Chip","ChipList","ChunkProgressBar","CircularGauge","CircularProgressBar","ColorGradient","ColorPalette","ColorPicker","ComboBox","ContextMenu","ConversationalUI","DataQuery","DateInput","DateMath","DatePicker","DateRange","DateTimePicker","Diagram","Dialog","DragandDrop","Drawer","Drawing","DropDownButton","DropDownList","DropDownTree","Editor","ExcelExport","ExpansionPanel","FileSaver","FileSelect","Filter","FlatColorPicker","FloatingActionButton","FloatingLabel","Forms","FormField","Gantt","Gauges","General","Grid","GridLayout","Icon","InlineAIPrompt","Label","LinearGauge","ListBox","ListView","Loader","Map","MaskedTextBox","Menu","MultiColumnComboBox","MultiSelect","MultiSelectTree","MultiViewCalendar","Notification","NumericTextBox","OTPInput","Pager","PanelBar","PDFExport","PDFViewer","PivotGrid","Popover","Popup","ProgressBar","PromptBox","QRCode","RadialGauge","RadioButton","RangeSlider","Rating","Ripple","Sankey","Scheduler","ScrollView","Signature","Skeleton","Slider","SmartPasteButton","Sortable","StockChart","Sparkline","SpeechToTextButton","SplitButton","Splitter","Spreadsheet","StackLayout","Stepper","SVGIcon","Switch","TabStrip","TextArea","TextBox","TileLayout","Timeline","TimePicker","ToolBar","Tooltip","TreeList","TreeView","Typography","Upload","Window"],ye=new Map([["actionsheet","@progress/kendo-angular-navigation"],["aiprompt","@progress/kendo-angular-conversational-ui"],["appbar","@progress/kendo-angular-navigation"],["arcgauge","@progress/kendo-angular-gauges"],["autocomplete","@progress/kendo-angular-dropdowns"],["avatar","@progress/kendo-angular-layout"],["badge","@progress/kendo-angular-indicators"],["barcode","@progress/kendo-angular-barcodes"],["bottomnavigation","@progress/kendo-angular-navigation"],["breadcrumb","@progress/kendo-angular-navigation"],["button","@progress/kendo-angular-buttons"],["buttongroup","@progress/kendo-angular-buttons"],["calendar","@progress/kendo-angular-dateinputs"],["card","@progress/kendo-angular-layout"],["chartwizard","@progress/kendo-angular-chart-wizard"],["checkbox","@progress/kendo-angular-inputs"],["chip","@progress/kendo-angular-buttons"],["chiplist","@progress/kendo-angular-buttons"],["chunkprogressbar","@progress/kendo-angular-progressbar"],["circulargauge","@progress/kendo-angular-gauges"],["circularprogressbar","@progress/kendo-angular-progressbar"],["colorgradient","@progress/kendo-angular-inputs"],["colorpalette","@progress/kendo-angular-inputs"],["colorpicker","@progress/kendo-angular-inputs"],["combobox","@progress/kendo-angular-dropdowns"],["contextmenu","@progress/kendo-angular-menu"],["dataquery","@progress/kendo-data-query"],["dateinput","@progress/kendo-angular-dateinputs"],["datemath","@progress/kendo-date-math"],["datepicker","@progress/kendo-angular-dateinputs"],["daterangepicker","@progress/kendo-angular-dateinputs"],["datetimepicker","@progress/kendo-angular-dateinputs"],["diagram","@progress/kendo-angular-diagrams"],["dialog","@progress/kendo-angular-dialog"],["drawer","@progress/kendo-angular-layout"],["drawing","@progress/kendo-drawing"],["dropdownbutton","@progress/kendo-angular-buttons"],["dropdownlist","@progress/kendo-angular-dropdowns"],["dropdowntree","@progress/kendo-angular-dropdowns"],["editor","@progress/kendo-angular-editor"],["excelexport","@progress/kendo-angular-excel-export"],["expansionpanel","@progress/kendo-angular-layout"],["filesaver","@progress/kendo-file-saver"],["fileselect","@progress/kendo-angular-upload"],["filter","@progress/kendo-angular-filter"],["flatcolorpicker","@progress/kendo-angular-inputs"],["floatingactionbutton","@progress/kendo-angular-buttons"],["floatinglabel","@progress/kendo-angular-label"],["formfield","@progress/kendo-angular-inputs"],["forms","@progress/kendo-angular-inputs"],["gantt","@progress/kendo-angular-gantt"],["grid","@progress/kendo-angular-grid"],["gridlayout","@progress/kendo-angular-layout"],["icon","@progress/kendo-angular-icons"],["inlineaiprompt","@progress/kendo-angular-conversational-ui"],["label","@progress/kendo-angular-label"],["lineargauge","@progress/kendo-angular-gauges"],["listbox","@progress/kendo-angular-listbox"],["listview","@progress/kendo-angular-listview"],["loader","@progress/kendo-angular-indicators"],["map","@progress/kendo-angular-map"],["maskedtextbox","@progress/kendo-angular-inputs"],["menu","@progress/kendo-angular-menu"],["multicolumncombobox","@progress/kendo-angular-dropdowns"],["multiselect","@progress/kendo-angular-dropdowns"],["multiselecttree","@progress/kendo-angular-dropdowns"],["multiviewcalendar","@progress/kendo-angular-dateinputs"],["notification","@progress/kendo-angular-notification"],["numerictextbox","@progress/kendo-angular-inputs"],["otpinput","@progress/kendo-angular-inputs"],["pager","@progress/kendo-angular-pager"],["panelbar","@progress/kendo-angular-layout"],["pdfexport","@progress/kendo-angular-pdf-export"],["pdfviewer","@progress/kendo-angular-pdfviewer"],["pivotgrid","@progress/kendo-angular-pivotgrid"],["popover","@progress/kendo-angular-tooltip"],["popup","@progress/kendo-angular-popup"],["progressbar","@progress/kendo-angular-progressbar"],["promptbox","@progress/kendo-angular-conversational-ui"],["qrcode","@progress/kendo-angular-barcodes"],["radialgauge","@progress/kendo-angular-gauges"],["radiobutton","@progress/kendo-angular-inputs"],["rangeslider","@progress/kendo-angular-inputs"],["rating","@progress/kendo-angular-inputs"],["ripple","@progress/kendo-angular-ripple"],["sankey","@progress/kendo-angular-charts"],["scheduler","@progress/kendo-angular-scheduler"],["scrollview","@progress/kendo-angular-scrollview"],["signature","@progress/kendo-angular-inputs"],["skeleton","@progress/kendo-angular-indicators"],["slider","@progress/kendo-angular-inputs"],["smartpastebutton","@progress/kendo-angular-buttons"],["sortable","@progress/kendo-angular-sortable"],["sparkline","@progress/kendo-angular-charts"],["speechtotextbutton","@progress/kendo-angular-buttons"],["splitbutton","@progress/kendo-angular-buttons"],["splitter","@progress/kendo-angular-layout"],["spreadsheet","@progress/kendo-angular-spreadsheet"],["stacklayout","@progress/kendo-angular-layout"],["stepper","@progress/kendo-angular-layout"],["stockchart","@progress/kendo-angular-charts"],["svgicon","@progress/kendo-angular-icons"],["switch","@progress/kendo-angular-inputs"],["tabstrip","@progress/kendo-angular-layout"],["textarea","@progress/kendo-angular-inputs"],["textbox","@progress/kendo-angular-inputs"],["tilelayout","@progress/kendo-angular-layout"],["timeline","@progress/kendo-angular-layout"],["timepicker","@progress/kendo-angular-dateinputs"],["toolbar","@progress/kendo-angular-toolbar"],["treelist","@progress/kendo-angular-treelist"],["treeview","@progress/kendo-angular-treeview"],["typography","@progress/kendo-angular-typography"],["upload","@progress/kendo-angular-upload"],["window","@progress/kendo-angular-dialog"],["charts","@progress/kendo-angular-charts"],["conversationalui","@progress/kendo-angular-conversational-ui"],["tooltip","@progress/kendo-angular-tooltip"]]);var It=Tt(Ct(xt(import.meta.url)),"../proto/service.proto"),L=new M("test.contextapi.telerik.com:443",It,{libName:T});var be=async()=>L.validateUserLicense();import zt from"fs";import ct from"path";import{fileURLToPath as Yt}from"url";import{z as k}from"zod";var S=class{constructor(t,s,o){this.name=t;this.config=s;this.cb=o}register(t){this.server=t,this.server.registerTool(this.name,this.config,this.cb)}hasAccess(t){return!this.config.requiredAccess||this.config.requiredAccess.length===0?!0:t==="full"||this.config.requiredAccess.includes(t)}};var U=(e,t)=>`# ${e.suiteName} - Code Validation & Quality Assurance
|
|
905
6
|
|
|
906
7
|
## Comprehensive Code Validation Checklist
|
|
907
8
|
Execute these validation steps systematically to ensure high-quality, maintainable code:
|
|
908
9
|
|
|
909
10
|
### Validation Phase: Framework-Specific Validation
|
|
910
11
|
|
|
911
|
-
${
|
|
12
|
+
${t}
|
|
912
13
|
|
|
913
14
|
### Validation Phase: General Code Quality & Best Practices
|
|
914
15
|
|
|
@@ -945,97 +46,179 @@ Responsive Design:
|
|
|
945
46
|
- Graceful error handling for all user interactions
|
|
946
47
|
- Meaningful error messages for users
|
|
947
48
|
- Network error handling for API calls
|
|
948
|
-
`;
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
49
|
+
`;var V=()=>`## UX/UI Design Best Practices
|
|
50
|
+
|
|
51
|
+
> **These are default guidelines \u2014 follow them when the user has not stated otherwise.** If the user explicitly requests different behavior (e.g., a specific component size, a custom row limit, alternate breakpoints, a different layout pattern), defer to the user's stated preference and disregard the conflicting default below. Only accessibility and WCAG requirements (contrast ratios, focus indicators, semantic HTML, ARIA) apply regardless of user preference.
|
|
52
|
+
|
|
53
|
+
Follow these principles when building or reviewing any UI. They apply regardless of the visual style requested.
|
|
54
|
+
|
|
55
|
+
### Visual Hierarchy & Typography
|
|
56
|
+
- Use a strict 3-level heading hierarchy: page title (h1) \u2192 section heading (h2) \u2192 component label (h3). Never skip levels.
|
|
57
|
+
- Body text line length: 60\u201380 characters maximum. Wider lines reduce readability.
|
|
58
|
+
- Numeric and currency columns must use \`font-variant-numeric: tabular-nums\` to keep digits column-aligned.
|
|
59
|
+
- Never use more than 2 typefaces in a single interface.
|
|
60
|
+
|
|
61
|
+
### Color & Contrast
|
|
62
|
+
- Body text contrast ratio: \u2265 4.5:1 against its background.
|
|
63
|
+
- Large text (\u2265 18pt / 14pt bold) and UI component boundaries: \u2265 3:1.
|
|
64
|
+
- Use only the 5 semantic color slots \u2014 primary, success, warning, error, info \u2014 for meaning. Do not invent new semantic colors.
|
|
65
|
+
- Never use color alone to convey status or meaning (8% of men have color vision deficiency). Always pair color with an icon or text label.
|
|
66
|
+
- Never use red and green as the sole distinguishing colors.
|
|
67
|
+
|
|
68
|
+
### Component Sizing & Density
|
|
69
|
+
- Never mix size variants within the same form or toolbar. Pick one: \`"small"\`, \`"medium"\`, or \`"large"\` and apply it consistently.
|
|
70
|
+
- \`"small"\` (24px) = data-dense tools. \`"medium"\` (32px) = default. \`"large"\` (40px) = comfortable/consumer-facing.
|
|
71
|
+
|
|
72
|
+
### Motion & Animation
|
|
73
|
+
- Always support \`prefers-reduced-motion: reduce\` \u2014 set transition durations to \u2264 0.01ms in that media query.
|
|
74
|
+
- Micro-interactions (button press, tooltip): 150\u2013250ms. Panel transitions (drawer, sidebar): 300\u2013400ms.
|
|
75
|
+
- Never animate layout properties that cause reflow (width, height, margin, padding). Animate transform and opacity instead.
|
|
76
|
+
|
|
77
|
+
### Interaction Patterns
|
|
78
|
+
- Never set \`outline: none\` globally. Keyboard focus indicators are required (WCAG 2.4.7).
|
|
79
|
+
- Loading states: prefer Skeleton loader for content areas, overlay + ProgressBar for blocking operations, disabled button + inline spinner for async submission.
|
|
80
|
+
- Error recovery: inline validation near the field for form errors; notification/toast for API/system errors.
|
|
81
|
+
- Every icon-only button must have a visible tooltip and an \`aria-label\`.
|
|
82
|
+
- Never show tooltips on disabled elements \u2014 disabled elements cannot receive focus.
|
|
83
|
+
|
|
84
|
+
### Responsive Design
|
|
85
|
+
- Breakpoints (defaults \u2014 use the project's breakpoint system if one is already established): Mobile < 640px | Tablet 640\u20131024px | Desktop 1024\u20131440px | Wide > 1440px.
|
|
86
|
+
- Constrain max content width to 1440px with \`margin: 0 auto\` on wide viewports, unless a different maximum is already defined by the project.
|
|
87
|
+
- On mobile (< 480px), data grids must switch to stacked/card layout \u2014 tabular layout is unusable at that width.
|
|
88
|
+
- Schedulers/complex data views are not viable on mobile; provide a simplified alternative or a clear message.
|
|
89
|
+
|
|
90
|
+
### UX Writing
|
|
91
|
+
- Input labels describe *what* the field is. Placeholder text hints at *format or example* \u2014 never use placeholder as a substitute for a label.
|
|
92
|
+
- Button labels must be specific action verbs: "Save Changes", "Delete Record", "Export CSV" \u2014 not "Submit", "OK", or "Yes".
|
|
93
|
+
- Error messages must be specific and actionable: "Email address is already registered" not "Error 409".
|
|
94
|
+
- Table/grid column headers: Title Case. Never ALL CAPS.
|
|
95
|
+
- Empty states must explain why it's empty and offer a next action (e.g., "No records found. Add your first item.").
|
|
96
|
+
|
|
97
|
+
### Data Presentation
|
|
98
|
+
- Numeric and currency values must be right-aligned in table/grid columns.
|
|
99
|
+
- Never display raw ISO 8601 date strings (e.g., \`2024-01-15T09:30:00Z\`) \u2014 always format for the locale (e.g., "15 Jan 2024").
|
|
100
|
+
- Never render more than 200 rows in a fully-loaded table. Use pagination or virtual scrolling for larger datasets.
|
|
101
|
+
- Never leave grid columns without explicit widths \u2014 causes layout jank on load and sort operations.
|
|
102
|
+
|
|
103
|
+
### Chart Type Selection
|
|
104
|
+
- **Line / Area**: continuous quantitative data over time (trends, rates).
|
|
105
|
+
- **Bar (vertical)**: discrete time periods or ordered categories.
|
|
106
|
+
- **Horizontal Bar**: comparing named categories (rankings, survey results).
|
|
107
|
+
- **Donut (not Pie)**: part-to-whole proportions with \u2264 6 segments. Avoid Pie charts \u2014 the center hole of a Donut makes area estimation easier.
|
|
108
|
+
- **Avoid**: 3D charts, dual-axis charts (misleading), charts with > 7 series in the same view.
|
|
109
|
+
- Chart legend placement: below the chart.
|
|
110
|
+
|
|
111
|
+
### Dialog vs Window Decisions
|
|
112
|
+
- **Dialog (modal)**: use when the user must respond before continuing. Title should be action-oriented: "Delete this record?" not "Confirmation".
|
|
113
|
+
- **Window (non-modal)**: use when content can exist alongside the background (resizable/draggable panels, editors).
|
|
114
|
+
- Destructive dialog actions (delete, overwrite) must use the error theme color.
|
|
115
|
+
- Every dialog must be closable via Escape key and have a clearly labeled close control.
|
|
116
|
+
|
|
117
|
+
### Form Validation Display Rules
|
|
118
|
+
- Show field-level validation errors **after the first blur** (not on initial render, not on every keystroke).
|
|
119
|
+
- Display error text inline, directly below the field \u2014 never in a toast or far from the field.
|
|
120
|
+
- On form-level submit failure, focus the first invalid field automatically.
|
|
121
|
+
- Required fields: mark with an asterisk (*) and include a legend. Do not mark optional fields \u2014 label them "(optional)" only if most fields are required.
|
|
122
|
+
|
|
123
|
+
### Grid Data Volume & Scrolling Strategy
|
|
124
|
+
- Never render more than 200 rows without pagination or virtual scrolling.
|
|
125
|
+
- Use **pagination** when users need to navigate by page number, see total row count, or perform export/select-all operations.
|
|
126
|
+
- Use **virtual scrolling** when the dataset is very large (thousands of rows) and users scroll continuously rather than jumping to pages.
|
|
127
|
+
- Default page size: 25 rows. Offer page size options (10, 25, 50) as defaults unless the project specifies otherwise.
|
|
128
|
+
|
|
129
|
+
### Grid Feature Selection
|
|
130
|
+
Enable only the Grid features genuinely required for the workflow. Each enabled feature adds UI chrome, event listeners, and DOM nodes. Start with the minimum set and add only when user stories require it:
|
|
131
|
+
- \`sortable\` \u2014 when users need to find specific rows in non-obvious order
|
|
132
|
+
- \`filterable\` \u2014 for datasets > 50 rows with varied values; skip for small fixed lists
|
|
133
|
+
- \`groupable\` \u2014 only when hierarchical analysis is a core workflow
|
|
134
|
+
- \`reorderable\` / \`resizable\` \u2014 when user customization of the view is a stated requirement
|
|
135
|
+
- \`selectable\` \u2014 only when batch actions exist
|
|
136
|
+
- \`editable\` \u2014 only when inline data entry is the primary workflow, not for read-only display
|
|
137
|
+
|
|
138
|
+
### Form Layout Defaults
|
|
139
|
+
These are defaults \u2014 respect the project's existing form conventions if established:
|
|
140
|
+
- Prefer single-column form layout \u2014 easier to read and complete than multi-column.
|
|
141
|
+
- Use two-column layout only for tightly related field pairs (First Name / Last Name, Start Date / End Date).
|
|
142
|
+
- Align labels above their fields for complex forms; inline labels work only for very short forms (2\u20133 fields).
|
|
143
|
+
- Place the primary action (Save / Submit) at the bottom left; Cancel or secondary actions to its right.
|
|
144
|
+
|
|
145
|
+
### Whitespace Defaults
|
|
146
|
+
When no design token system is defined by the project, apply these minimum spacing values:
|
|
147
|
+
- Section separators: \u2265 24px vertical gap between distinct content areas.
|
|
148
|
+
- Card internal padding: 16\u201324px.
|
|
149
|
+
- Form field vertical gap: \u2265 16px between fields (24px for multi-column groups).
|
|
150
|
+
- Page left/right margin: 24\u201332px minimum, even at desktop widths.`;var Nt=e=>`**Tool call example:**
|
|
952
151
|
\`\`\`
|
|
953
|
-
${
|
|
152
|
+
${e.layoutAssistantName}({
|
|
954
153
|
prompt="Provide Kendo Design System utility classes to make the following layout structure responsive across mobile, tablet, and desktop views: [LAYOUT DESCRIPTION HERE]",
|
|
955
154
|
includeBuildingBlockExamples=false // Optional, include examples of Kendo building blocks (Grid, Flex, Stack, etc.)
|
|
956
155
|
})
|
|
957
156
|
\`\`\`
|
|
958
|
-
|
|
959
|
-
var vanillaCSSResponsiveGuidance = `**General Responsive Design Guidance:**
|
|
157
|
+
`,Et=`**General Responsive Design Guidance:**
|
|
960
158
|
- Use CSS media queries to apply different styles at various breakpoints (e.g., mobile, tablet, desktop).
|
|
961
159
|
- Consider a mobile-first approach, starting with styles for smaller screens and adding complexity for larger screens.
|
|
962
160
|
- Ensure flexible grid layouts that can adapt to different screen sizes.
|
|
963
161
|
- Use relative units (%, em, rem) instead of fixed units (px) for widths and spacing to allow for better scalability.
|
|
964
|
-
- Test the design across multiple devices and screen sizes to ensure a consistent user experience
|
|
965
|
-
var tailwindResponsiveGuidance = `**Tailwind CSS Responsive Design Guidance:**
|
|
162
|
+
- Test the design across multiple devices and screen sizes to ensure a consistent user experience.`,Rt=`**Tailwind CSS Responsive Design Guidance:**
|
|
966
163
|
- Use Tailwind's responsive utility variants (e.g., sm:, md:, lg:, xl:) to apply styles at specific breakpoints.
|
|
967
164
|
- Start with mobile styles (no prefix) and layer on additional styles for larger screens using the appropriate prefixes.
|
|
968
165
|
- Leverage Tailwind's grid and flex utilities to create flexible layouts that adapt to different screen sizes.
|
|
969
166
|
- Use Tailwind's spacing utilities to maintain consistent spacing across breakpoints.
|
|
970
|
-
- Test the design across multiple devices and screen sizes to ensure a consistent user experience
|
|
971
|
-
var renderOrchestratorResponse = (ctx, options) => {
|
|
972
|
-
const validationInstructions = renderValidatorResponse(
|
|
973
|
-
{ suiteName: ctx.suiteName, libKey: ctx.libKey },
|
|
974
|
-
options.validationSteps
|
|
975
|
-
);
|
|
976
|
-
const includeLayout = ctx.includeLayout && ctx.layoutMode === "utils";
|
|
977
|
-
const dragDropGuidance = ctx.libKey === "angular" ? `- **Drag and Drop**: Consider using the DragandDrop and Sortable components when drag-and-drop functionality is needed.` : "";
|
|
978
|
-
const componentsList = ctx.components ? ctx.components.join(", ") : "components";
|
|
979
|
-
const responsiveLayoutHint = includeLayout ? `- And use the ${ctx.layoutAssistantName} tool to get Kendo CSS utility classes needed for responsive design.` : "";
|
|
980
|
-
const responsiveKDSGuidance = includeLayout ? responsiveKendoDesignSystemGuidance(ctx) : "";
|
|
981
|
-
const responsiveVanillaCSSGuidance = ctx.layoutMode === "vanilla" ? vanillaCSSResponsiveGuidance : "";
|
|
982
|
-
const responsiveTailwindCSSGuidance = ctx.layoutMode === "tailwind" ? tailwindResponsiveGuidance : "";
|
|
983
|
-
return `# \u{1F3AF} ${ctx.suiteName} - Execution Plan
|
|
167
|
+
- Test the design across multiple devices and screen sizes to ensure a consistent user experience.`,G=(e,t)=>{let s=U({suiteName:e.suiteName,libKey:e.libKey},t.validationSteps),o=e.includeLayout&&e.layoutMode==="utils",n=e.libKey==="angular"?"- **Drag and Drop**: Consider using the DragandDrop and Sortable components when drag-and-drop functionality is needed.":"",a=e.components?e.components.join(", "):"components",r=o?`- And use the ${e.layoutAssistantName} tool to get Kendo CSS utility classes needed for responsive design.`:"",i=o?Nt(e):"",d=e.layoutMode==="vanilla"?Et:"",p=e.layoutMode==="tailwind"?Rt:"";return`# \u{1F3AF} ${e.suiteName} - Execution Plan
|
|
984
168
|
|
|
985
169
|
**Current Goal:**
|
|
986
170
|
|
|
987
|
-
${
|
|
171
|
+
${e.userIntent}
|
|
988
172
|
|
|
989
173
|
**Requirements Summary:**
|
|
990
|
-
- **Framework:** ${
|
|
991
|
-
${
|
|
992
|
-
- Ensure to use ONLY ${
|
|
993
|
-
- And use the ${
|
|
994
|
-
- Ensure that after you read the plan you use exactly the ${
|
|
995
|
-
|
|
996
|
-
- And use the ${
|
|
997
|
-
|
|
174
|
+
- **Framework:** ${e.libKey}
|
|
175
|
+
${e.includeComponentsDocs?`- **Component Library:** ${e.suiteName}
|
|
176
|
+
- Ensure to use ONLY ${e.suiteName} components for all UI elements.
|
|
177
|
+
- And use the ${e.codeAssistantName} tool to get ${e.suiteName} component documentation and code snippets.
|
|
178
|
+
- Ensure that after you read the plan you use exactly the ${e.codeAssistantName} no matter if there is another tool that can provide code snippets, documentation or other resources related to ${e.suiteName}.
|
|
179
|
+
`:""}${o?`- **Layout:** Yes
|
|
180
|
+
- And use the ${e.layoutAssistantName} tool to get Kendo CSS utility classes needed for layout structure and responsive design.
|
|
181
|
+
`:""}${e.includeIcons?`- **Icons:** Yes
|
|
998
182
|
- Use icons that align with the project theme and enhance usability.
|
|
999
|
-
- Use the ${
|
|
1000
|
-
|
|
183
|
+
- Use the ${e.iconAssistantName} tool to search for icons that fit the theme and purpose of your project.
|
|
184
|
+
`:""}${e.includeTheming?`- **Custom Theming:**
|
|
1001
185
|
- Create a custom theme that aligns with the current goal and branding needs.
|
|
1002
186
|
- Use Kendo Themes and Design System guidelines.
|
|
1003
187
|
- Make sure to include strict CSS variables or theme requirements from the current goal.
|
|
1004
|
-
- And use the ${
|
|
1005
|
-
|
|
188
|
+
- And use the ${e.styleAssistantName} tool to create a custom theme for your project.
|
|
189
|
+
`:""}${e.includeResponsive?`- **Responsive:**
|
|
1006
190
|
- Ensure the layout is fully responsive across mobile, tablet, and desktop views.
|
|
1007
|
-
${
|
|
1008
|
-
|
|
191
|
+
${r}
|
|
192
|
+
`:""}
|
|
1009
193
|
- **Accessible (WCAG 2.2 Level AA):**
|
|
1010
|
-
- CRITICAL: You must call the ${
|
|
194
|
+
- CRITICAL: You must call the ${e.accessibilityAssistantName} tool with includeGeneralGuidelines=true on your first call to get WCAG 2.2 Level AA guidelines.
|
|
1011
195
|
- For subsequent calls, use includeGeneralGuidelines=false to get only component-specific accessibility information.
|
|
1012
196
|
- Ensure all components meet WCAG 2.2 Level AA standards.
|
|
1013
197
|
|
|
1014
|
-
${
|
|
198
|
+
${o?`**STYLING AND LAYOUT REQUIREMENTS:**
|
|
1015
199
|
**LAYOUT MODE: KENDO DESIGN SYSTEM CSS UTILITIES**
|
|
1016
200
|
## CRITICAL DESIGN SYSTEM CONSTRAINTS
|
|
1017
201
|
- **USE ONLY KENDO DESIGN SYSTEM UTILITIES** for ALL styling, layout, spacing, positioning, and responsive behavior
|
|
1018
202
|
- Avoid custom CSS, inline styles, or other CSS framework classes
|
|
1019
|
-
- The ${
|
|
203
|
+
- The ${e.layoutAssistantName} tool will provide the specific Kendo CSS utility classes needed
|
|
1020
204
|
- All layout requirements must use Kendo utilities exclusively
|
|
1021
|
-
|
|
1022
|
-
${
|
|
205
|
+
`:""}
|
|
206
|
+
${e.layoutMode==="vanilla"?`**STYLING AND LAYOUT REQUIREMENTS:**
|
|
1023
207
|
**LAYOUT MODE: VANILLA**
|
|
1024
208
|
- In this mode, you should use Kendo UI components and vanilla CSS for layout and styling.
|
|
1025
209
|
- Do NOT use any utility-first CSS classes (e.g., from Tailwind) for layout or styling.
|
|
1026
210
|
- Focus on leveraging the built-in capabilities of Kendo UI components and writing custom CSS as needed to achieve the desired design and layout.
|
|
1027
|
-
|
|
1028
|
-
${
|
|
211
|
+
`:""}
|
|
212
|
+
${e.layoutMode==="tailwind"?`**STYLING AND LAYOUT REQUIREMENTS:**
|
|
1029
213
|
**LAYOUT MODE: TAILWIND**
|
|
1030
214
|
- In this mode, you should use Tailwind CSS utility classes for layout and styling.
|
|
1031
215
|
- Do NOT write custom CSS or use vanilla CSS for layout or styling.
|
|
1032
216
|
- Focus on leveraging Tailwind's utility-first approach to achieve the desired design and layout, while still using Kendo UI components for functionality.
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
` : ""}
|
|
217
|
+
`:""}
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
${V()}
|
|
1039
222
|
|
|
1040
223
|
---
|
|
1041
224
|
|
|
@@ -1049,13 +232,13 @@ Follow these steps strictly in order to achieve a complete and polished implemen
|
|
|
1049
232
|
**MANDATORY REQUIREMENT:**
|
|
1050
233
|
|
|
1051
234
|
- Before implementing any UI components or features, you must call the accessibility assistant with general guidelines
|
|
1052
|
-
- On your first call to "${
|
|
235
|
+
- On your first call to "${e.accessibilityAssistantName}", set "includeGeneralGuidelines=true" to get foundational WCAG 2.2 Level AA best practices
|
|
1053
236
|
- These general guidelines apply to all components and must be considered throughout implementation
|
|
1054
237
|
- For all subsequent calls, set "includeGeneralGuidelines=false" to get only component-specific information
|
|
1055
238
|
|
|
1056
239
|
**First tool call (includes general WCAG guidelines):**
|
|
1057
240
|
\`\`\`
|
|
1058
|
-
${
|
|
241
|
+
${e.accessibilityAssistantName}({
|
|
1059
242
|
query="What are the accessibility requirements for [COMPONENT_NAME]?",
|
|
1060
243
|
component="[COMPONENT_NAME]",
|
|
1061
244
|
includeGeneralGuidelines=true // ONLY true on first call
|
|
@@ -1064,11 +247,11 @@ ${ctx.accessibilityAssistantName}({
|
|
|
1064
247
|
|
|
1065
248
|
**Step 2: Get Component-Specific Accessibility Information**
|
|
1066
249
|
|
|
1067
|
-
For each additional ${
|
|
250
|
+
For each additional ${e.suiteName} component you plan to use, call the tool with "includeGeneralGuidelines=false":
|
|
1068
251
|
|
|
1069
252
|
**Tool call example:**
|
|
1070
253
|
\`\`\`
|
|
1071
|
-
${
|
|
254
|
+
${e.accessibilityAssistantName}({
|
|
1072
255
|
query="What are the accessibility features and requirements for [COMPONENT_NAME]? Include ARIA attributes, keyboard navigation, and screen reader support.",
|
|
1073
256
|
component="[COMPONENT_NAME]",
|
|
1074
257
|
includeGeneralGuidelines=false // false for all calls after the first
|
|
@@ -1077,112 +260,14 @@ ${ctx.accessibilityAssistantName}({
|
|
|
1077
260
|
|
|
1078
261
|
**Example:**
|
|
1079
262
|
\`\`\`
|
|
1080
|
-
${
|
|
263
|
+
${e.accessibilityAssistantName}({
|
|
1081
264
|
query="How to associate the label with another component or HTML input?",
|
|
1082
265
|
component="Label",
|
|
1083
266
|
includeGeneralGuidelines=false
|
|
1084
267
|
})
|
|
1085
268
|
\`\`\`
|
|
1086
269
|
|
|
1087
|
-
${
|
|
1088
|
-
|
|
1089
|
-
**IMPORTANT DESIGN EXTRACTION REQUIRMENTS**
|
|
1090
|
-
- Use the ${ctx.figmaD2CToolName} tool to extract design information from the provided Figma file URL.
|
|
1091
|
-
- Analyze the extracted design information to identify key layout structures, components, styles, and design tokens.
|
|
1092
|
-
- Use the insights from the design analysis to inform your implementation in the next phases, ensuring alignment with the original design intent.
|
|
1093
|
-
- Follow ALL three extraction steps sequentially \u2014 each step is MANDATORY.
|
|
1094
|
-
- Complete the verification checklist after each step before proceeding to the next.
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
**Step 1: Extract Base Design Information from Figma**
|
|
1098
|
-
- Extract only base the first layer of the design to get the overall structure and layout without going too deep into details. This will help you to understand the design hierarchy and identify key components and layout patterns.
|
|
1099
|
-
- Use the downloaded design snapshot to visually analyze the design and correlate it with the extracted structure. This will help you to identify which nodes correspond to which design elements and to plan your implementation accordingly.
|
|
1100
|
-
- **REQUIRED OUTPUT:** After extraction, you MUST output a structured list of ALL discovered node IDs with their labels/names before proceeding to Step 2. Format this as a clear inventory that will be referenced in subsequent steps. For each node, extract the node ID from the node-id attribute of the node XML tag.
|
|
1101
|
-
- **Depth escalation:** If a node at this depth shows it contains more children than can be captured (e.g., children are truncated), re-fetch that specific node with depth + 5 to ensure complete extraction.
|
|
1102
|
-
|
|
1103
|
-
**Tool call example:**
|
|
1104
|
-
\`\`\`
|
|
1105
|
-
${ctx.figmaD2CToolName}({
|
|
1106
|
-
url: [Figma URL from prompt]
|
|
1107
|
-
depth: 10 // Consider more depth only if the user prompt explicitly states to extract deeply.
|
|
1108
|
-
})
|
|
1109
|
-
\`\`\`
|
|
1110
|
-
|
|
1111
|
-
**Step 1 Completion Checklist (MUST satisfy before proceeding):**
|
|
1112
|
-
- [ ] Have I captured all top-level layout containers (headers, footers, main sections)?
|
|
1113
|
-
- [ ] Have I identified all major structural components?
|
|
1114
|
-
- [ ] Have I created and outputted a structured list of node IDs and their labels?
|
|
1115
|
-
- [ ] Have I visually analyzed the design snapshot to correlate nodes with design elements?
|
|
1116
|
-
|
|
1117
|
-
**Step 2: Extract Main Nodes Design**
|
|
1118
|
-
- Based on the initial extraction and analysis, identify the main nodes that are critical for the design implementation. These could be reusable headers, body, navigation, sidebar or footer elements that illustrate the main structure.
|
|
1119
|
-
- Use the node IDs from the node-id attribute of the node XML tag to fetch these specific nodes with more depth to capture necessary details for implementation. This targeted extraction will help you to get the relevant design information without overwhelming the process with too much data.
|
|
1120
|
-
- **Depth escalation:** If any main node shows truncated children or contains more elements than expected at the given depth, immediately re-fetch with depth + 5.
|
|
1121
|
-
|
|
1122
|
-
**Tool call example:**
|
|
1123
|
-
\`\`\`
|
|
1124
|
-
${ctx.figmaD2CToolName}({
|
|
1125
|
-
fileKey: [The fileKey extracted from Step 1]
|
|
1126
|
-
nodeIds: [Array of main node IDs identified from Step 1]
|
|
1127
|
-
depth: 10 // Deeper extraction for main nodes to capture necessary details.
|
|
1128
|
-
})
|
|
1129
|
-
\`\`\`
|
|
1130
|
-
|
|
1131
|
-
**Step 2 Completion Checklist (MUST satisfy before proceeding):**
|
|
1132
|
-
- [ ] Have I captured all interactive components (buttons, inputs, navigation elements)?
|
|
1133
|
-
- [ ] Have I identified all typography styles and text elements?
|
|
1134
|
-
- [ ] Have I extracted all color tokens and design system values?
|
|
1135
|
-
- [ ] Have I documented child node IDs that need deeper extraction in Step 3?
|
|
1136
|
-
|
|
1137
|
-
**Step 3: Extract Child Node Details (MANDATORY)**
|
|
1138
|
-
**CRITICAL:** After Step 2, you MUST proceed to Step 3. Extract ALL child nodes identified in Step 2. Do not skip this step.
|
|
1139
|
-
|
|
1140
|
-
- Extract all child nodes that were identified in Step 2 as requiring deeper analysis. These include specific components, styles, or interactions that are essential for accurate implementation.
|
|
1141
|
-
- Use the node IDs from the node-id attribute to fetch these specific child nodes with sufficient depth to capture all critical design details.
|
|
1142
|
-
- **Depth escalation:** If child nodes still show incomplete extraction (truncated elements, nested components not fully visible), re-fetch with depth + 5 until all leaf-level components are captured.
|
|
1143
|
-
|
|
1144
|
-
**Tool call example:**
|
|
1145
|
-
\`\`\`
|
|
1146
|
-
${ctx.figmaD2CToolName}({
|
|
1147
|
-
fileKey: [The fileKey extracted from Step 1]
|
|
1148
|
-
nodeIds: [Array of ALL child node IDs identified from Step 2]
|
|
1149
|
-
depth: 15 // Targeted deeper extraction for specific nodes. Increase if needed.
|
|
1150
|
-
})
|
|
1151
|
-
\`\`\`
|
|
1152
|
-
|
|
1153
|
-
**Step 3 Completion Checklist (MUST satisfy before proceeding):**
|
|
1154
|
-
- [ ] Have I captured ALL leaf-level components (buttons, icons, form inputs)?
|
|
1155
|
-
- [ ] Have I extracted all spacing, padding, and margin values?
|
|
1156
|
-
- [ ] Have I identified all border styles, shadows, and visual effects?
|
|
1157
|
-
- [ ] Are there any remaining truncated nodes? (If yes, apply depth escalation)
|
|
1158
|
-
|
|
1159
|
-
**Iterative Extraction and Stopping Condition**
|
|
1160
|
-
Continue iterating over the extraction process following these rules:
|
|
1161
|
-
- **Continue until:** (a) All leaf-level components have been captured with complete details, OR (b) You have completed 3 extraction passes \u2014 whichever comes first.
|
|
1162
|
-
- After each iteration, verify that no new child nodes require deeper extraction.
|
|
1163
|
-
- If depth escalation is needed after 3 passes, document the limitation and proceed with available data.
|
|
1164
|
-
|
|
1165
|
-
**MANDATORY: Design Extraction Verification (Complete BEFORE Code Generation Phase)**
|
|
1166
|
-
Before proceeding to any code generation or implementation phase, you MUST produce and output a verification summary containing:
|
|
1167
|
-
|
|
1168
|
-
1. **Component Inventory:** List all UI components discovered (buttons, inputs, cards, navigation elements, etc.)
|
|
1169
|
-
2. **Hierarchy Map:** Show the parent-child relationships of major layout sections
|
|
1170
|
-
3. **Design Tokens Identified:**
|
|
1171
|
-
- Colors (with hex/rgba values)
|
|
1172
|
-
- Typography (font families, sizes, weights)
|
|
1173
|
-
- Spacing values (margins, paddings, gaps)
|
|
1174
|
-
- Border styles and effects
|
|
1175
|
-
4. **Gaps and Limitations:** Explicitly state any design elements that could not be fully extracted
|
|
1176
|
-
|
|
1177
|
-
**This verification summary serves as the design specification for implementation. Do not proceed to Code Generation until this summary is complete.**
|
|
1178
|
-
|
|
1179
|
-
**Additional Extraction During Implementation:**
|
|
1180
|
-
- During the implementation phase (Code Generation), you can and should use the ${ctx.figmaD2CToolName} tool with the relevant node IDs from the node-id attributes again if you discover you need more specific design details for certain components or sections that were not captured in earlier phases.
|
|
1181
|
-
- If additional extraction is needed, apply the same depth escalation logic and verification steps.
|
|
1182
|
-
` : ""}
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
${includeLayout ? `
|
|
270
|
+
${o?`
|
|
1186
271
|
### Phase: Layout Foundation
|
|
1187
272
|
|
|
1188
273
|
**Step 1: Create Base Layout Structure**
|
|
@@ -1193,16 +278,16 @@ ${includeLayout ? `
|
|
|
1193
278
|
|
|
1194
279
|
**Tool call example:**
|
|
1195
280
|
\`\`\`
|
|
1196
|
-
${
|
|
281
|
+
${e.layoutAssistantName}({
|
|
1197
282
|
prompt="Provide Kendo Design System utility classes for the following layout structure: [LAYOUT DESCRIPTION HERE]",
|
|
1198
283
|
includeBuildingBlockExamples=true // Optional, include examples of Kendo building blocks (Grid, Flex, Stack, etc.)
|
|
1199
284
|
})
|
|
1200
285
|
\`\`\`
|
|
1201
|
-
|
|
1202
|
-
${
|
|
286
|
+
`:""}
|
|
287
|
+
${e.includeComponentsDocs?`
|
|
1203
288
|
### Phase: Component Integration
|
|
1204
289
|
**Step 1: Identify and Implement Core Components**
|
|
1205
|
-
Based on your current goal, analyze what other ${
|
|
290
|
+
Based on your current goal, analyze what other ${e.suiteName} components are needed and implement them one by one. Here you are some appropriate components based on the different project type:
|
|
1206
291
|
|
|
1207
292
|
**Component Selection Guidelines:**
|
|
1208
293
|
- **Landing Pages**: Consider Button, Card, Form components, Layout containers, Navigation elements
|
|
@@ -1210,17 +295,17 @@ Based on your current goal, analyze what other ${ctx.suiteName} components are n
|
|
|
1210
295
|
- **Data Entry**: Consider Form, TextBox, DatePicker, DropDownList, Upload, Validation components
|
|
1211
296
|
- **Content Management**: Consider Grid, Editor, TreeView, FileManager, Dialog components
|
|
1212
297
|
- **E-commerce**: Consider ListView, Card, Button, Rating, Badge, Carousel components
|
|
1213
|
-
${
|
|
298
|
+
${n}
|
|
1214
299
|
|
|
1215
300
|
**IMPORTANT COMPONENT USAGE REQUIREMENTS:**
|
|
1216
|
-
- Make sure to identify all necessary features related to the ${
|
|
1217
|
-
- Make sure to identify specific features needed for other ${
|
|
1218
|
-
- Make sure to generate a query for ${
|
|
301
|
+
- Make sure to identify all necessary features related to the ${a} based on the current goal.
|
|
302
|
+
- Make sure to identify specific features needed for other ${e.suiteName} components based on the current goal.
|
|
303
|
+
- Make sure to generate a query for ${e.codeAssistantName} tool for each component and call the tool for each specific feature or functionality.
|
|
1219
304
|
- Always specify the exact features you want for each component. Describe only the needed functionality, and behavior you need. Be concise and don't include any information about the use case.
|
|
1220
305
|
|
|
1221
306
|
**Tool call examples:**
|
|
1222
307
|
\`\`\`
|
|
1223
|
-
${
|
|
308
|
+
${e.codeAssistantName}({
|
|
1224
309
|
query="Give me information about [COMPONENT_NAME] with [SPECIFIC_FEATURES]." <!-- For example: 'Grid with paging' or 'Button with click events' or 'Chart with multiple series' -->
|
|
1225
310
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', 'Chart', etc. -->
|
|
1226
311
|
})
|
|
@@ -1228,33 +313,33 @@ ${dragDropGuidance}
|
|
|
1228
313
|
|
|
1229
314
|
For broad queries, break them down into specific features (e.g., paging, sorting, filtering for Grid) and call the tool separately for each feature:
|
|
1230
315
|
\`\`\`
|
|
1231
|
-
${
|
|
316
|
+
${e.codeAssistantName}({
|
|
1232
317
|
query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'paging in Grid' -->
|
|
1233
318
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
|
|
1234
319
|
})
|
|
1235
320
|
\`\`\`
|
|
1236
321
|
|
|
1237
322
|
\`\`\`
|
|
1238
|
-
${
|
|
323
|
+
${e.codeAssistantName}({
|
|
1239
324
|
query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'sorting in Grid' -->
|
|
1240
325
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
|
|
1241
326
|
})
|
|
1242
327
|
\`\`\`
|
|
1243
328
|
|
|
1244
329
|
\`\`\`
|
|
1245
|
-
${
|
|
330
|
+
${e.codeAssistantName}({
|
|
1246
331
|
query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'filtering in Grid' -->
|
|
1247
332
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
|
|
1248
333
|
})
|
|
1249
334
|
\`\`\`
|
|
1250
|
-
|
|
1251
|
-
${
|
|
335
|
+
`:""}
|
|
336
|
+
${e.includeResponsive?`
|
|
1252
337
|
### Phase: Layout Responsive Finalization
|
|
1253
338
|
|
|
1254
339
|
**Step 1: Implement Responsive Behavior**
|
|
1255
|
-
${
|
|
340
|
+
${i}${d}${p}`:""}
|
|
1256
341
|
|
|
1257
|
-
${
|
|
342
|
+
${e.includeTheming?`
|
|
1258
343
|
**Step 2: Custom Theme Implementation**
|
|
1259
344
|
|
|
1260
345
|
**CUSTOM THEME REQUIREMENTS:**
|
|
@@ -1264,13 +349,13 @@ ${ctx.includeTheming ? `
|
|
|
1264
349
|
|
|
1265
350
|
**Tool call example:**
|
|
1266
351
|
\`\`\`
|
|
1267
|
-
${
|
|
352
|
+
${e.styleAssistantName}({
|
|
1268
353
|
query="Create a custom Kendo UI theme that aligns with the following current goal and branding needs: [CURRENT GOAL HERE]. Include strict CSS variables or theme requirements as needed.",
|
|
1269
354
|
includeThemeVariables=true // Optional, include specific CSS variables for colors, typography, spacing, etc.
|
|
1270
355
|
})
|
|
1271
356
|
\`\`\`
|
|
1272
|
-
|
|
1273
|
-
${
|
|
357
|
+
`:""}
|
|
358
|
+
${e.includeIcons?`
|
|
1274
359
|
**Step 3: Iconography and Visual Enhancements**
|
|
1275
360
|
|
|
1276
361
|
**ICONOGRAPHY GUIDELINES:**
|
|
@@ -1280,64 +365,61 @@ ${ctx.includeIcons ? `
|
|
|
1280
365
|
|
|
1281
366
|
**Tool call example:**
|
|
1282
367
|
\`\`\`
|
|
1283
|
-
${
|
|
368
|
+
${e.iconAssistantName}({
|
|
1284
369
|
query="Suggest icons that fit the theme and purpose of the following current goal: [CURRENT GOAL HERE]. Provide icon names and usage context.",
|
|
1285
370
|
})
|
|
1286
371
|
\`\`\`
|
|
1287
|
-
|
|
372
|
+
`:""}
|
|
1288
373
|
### Phase: Code Generation
|
|
1289
374
|
**IMPORTANT:** Do NOT generate ANY code or create files until ALL information gathering phases (1-3) are complete.
|
|
1290
375
|
**Step 1: Generate Complete Implementation**
|
|
1291
|
-
After completing all information gathering phases above, generate the complete ${
|
|
376
|
+
After completing all information gathering phases above, generate the complete ${e.libKey} component/page implementation:
|
|
1292
377
|
**Code Generation Requirements:**
|
|
1293
|
-
- Create complete, functional ${
|
|
1294
|
-
- Include all identified ${
|
|
378
|
+
- Create complete, functional ${e.libKey} components/pages
|
|
379
|
+
- Include all identified ${e.suiteName} components with their configurations
|
|
1295
380
|
- Apply ALL Kendo Design System utility classes gathered from layout assistant
|
|
1296
381
|
- Implement proper component event handling and data binding
|
|
1297
382
|
- Ensure responsive behavior using Kendo utility classes
|
|
1298
383
|
- Include necessary import statements and dependencies
|
|
1299
384
|
|
|
1300
|
-
${
|
|
385
|
+
${t.injectedPlan??""}
|
|
1301
386
|
|
|
1302
387
|
### Phase: Validation and Finalization
|
|
1303
388
|
|
|
1304
389
|
**Step 1: Code Validation**
|
|
1305
390
|
** CRITICAL REQUIREMENT: You MUST validate the generated UI code using this comprehensive checklist to ensure code quality and compliance:**
|
|
1306
391
|
|
|
1307
|
-
${
|
|
392
|
+
${s}
|
|
1308
393
|
|
|
1309
394
|
**Step 2: Final Review and Testing**
|
|
1310
395
|
** Implementation Validation:**
|
|
1311
|
-
${
|
|
1312
|
-
-
|
|
1313
|
-
-
|
|
1314
|
-
|
|
396
|
+
${e.includeComponentsDocs?` - Components render correctly without errors
|
|
397
|
+
- Running \`npm run build\` compiles the application successfully without any build errors or crashes.
|
|
398
|
+
- All ${e.suiteName} component features function as expected
|
|
399
|
+
- Event handling and data binding operate correctly`:""}
|
|
400
|
+
${e.includeResponsive?"- Responsive layout works across breakpoints":""}
|
|
1315
401
|
|
|
1316
402
|
**Quick Fixes (if needed):**
|
|
1317
403
|
|
|
1318
404
|
After code implementation and validation you can make quick fixes as needed:
|
|
1319
|
-
-
|
|
1320
|
-
- Use ${
|
|
405
|
+
- If any build errors are found, fix them and re-run the application.
|
|
406
|
+
- Use ${e.codeAssistantName} for component-specific issues
|
|
407
|
+
- Use ${e.layoutAssistantName} for styling adjustments
|
|
1321
408
|
|
|
1322
409
|
+### Before You Begin
|
|
1323
|
-
- When following/executing the plan call tools are defined from the same function_ecosystem/MCP_server which ${
|
|
410
|
+
- When following/executing the plan call tools are defined from the same function_ecosystem/MCP_server which ${e.name} was called.
|
|
1324
411
|
- Do NOT generate or suggest any code until all tools have been used and validated responses are incorporated.
|
|
1325
412
|
- Focus on planning and sequencing.
|
|
1326
413
|
- Summarize the components, layouts, and utilities gathered.
|
|
1327
|
-
- Confirm all required inputs from tools have been provided
|
|
1328
|
-
};
|
|
1329
|
-
|
|
1330
|
-
// packages/kendo-ui-agent/src/lib/templates/assistant-orchestrator.ts
|
|
1331
|
-
var renderAssistantOrchestratorResponse = (ctx) => {
|
|
1332
|
-
return `# ${ctx.suiteName} Assistant
|
|
414
|
+
- Confirm all required inputs from tools have been provided.`};var W=e=>`# ${e.suiteName} Assistant
|
|
1333
415
|
|
|
1334
416
|
**What you're looking for:**
|
|
1335
417
|
|
|
1336
|
-
${
|
|
418
|
+
${e.userIntent}
|
|
1337
419
|
|
|
1338
420
|
**Available Tools:**
|
|
1339
|
-
- **${
|
|
1340
|
-
- **${
|
|
421
|
+
- **${e.codeAssistantName}** - Get component documentation, features, and usage examples
|
|
422
|
+
- **${e.iconAssistantName}** - Search for icons from the Kendo icon library
|
|
1341
423
|
|
|
1342
424
|
---
|
|
1343
425
|
|
|
@@ -1347,7 +429,7 @@ Follow these steps to find the right components and resources:
|
|
|
1347
429
|
|
|
1348
430
|
### Step 1: Identify Components
|
|
1349
431
|
|
|
1350
|
-
Based on your needs, consider these ${
|
|
432
|
+
Based on your needs, consider these ${e.suiteName} component categories:
|
|
1351
433
|
|
|
1352
434
|
**Common Use Cases:**
|
|
1353
435
|
- **Data Display**: Grid, ListView, TreeView, Card, TileLayout
|
|
@@ -1360,10 +442,10 @@ Based on your needs, consider these ${ctx.suiteName} component categories:
|
|
|
1360
442
|
|
|
1361
443
|
**How to explore components:**
|
|
1362
444
|
|
|
1363
|
-
Use the ${
|
|
445
|
+
Use the ${e.codeAssistantName} tool to learn about specific components:
|
|
1364
446
|
|
|
1365
447
|
\`\`\`
|
|
1366
|
-
${
|
|
448
|
+
${e.codeAssistantName}({
|
|
1367
449
|
query: "What are the main features of [COMPONENT_NAME]?",
|
|
1368
450
|
component: "[COMPONENT_NAME]"
|
|
1369
451
|
})
|
|
@@ -1371,14 +453,14 @@ ${ctx.codeAssistantName}({
|
|
|
1371
453
|
|
|
1372
454
|
**Examples:**
|
|
1373
455
|
\`\`\`
|
|
1374
|
-
${
|
|
456
|
+
${e.codeAssistantName}({
|
|
1375
457
|
query: "How to use Grid with paging and sorting?",
|
|
1376
458
|
component: "Grid"
|
|
1377
459
|
})
|
|
1378
460
|
\`\`\`
|
|
1379
461
|
|
|
1380
462
|
\`\`\`
|
|
1381
|
-
${
|
|
463
|
+
${e.codeAssistantName}({
|
|
1382
464
|
query: "What features does DatePicker have?",
|
|
1383
465
|
component: "DatePicker"
|
|
1384
466
|
})
|
|
@@ -1389,37 +471,37 @@ ${ctx.codeAssistantName}({
|
|
|
1389
471
|
- Break complex queries into multiple calls focusing on one feature at a time
|
|
1390
472
|
- Specify the exact component name in the component parameter
|
|
1391
473
|
|
|
1392
|
-
${
|
|
474
|
+
${e.includeIcons?`
|
|
1393
475
|
### Step 2: Find Icons
|
|
1394
476
|
|
|
1395
|
-
Use the ${
|
|
477
|
+
Use the ${e.iconAssistantName} tool to search for icons:
|
|
1396
478
|
|
|
1397
479
|
\`\`\`
|
|
1398
|
-
${
|
|
480
|
+
${e.iconAssistantName}({
|
|
1399
481
|
query: "Search for icons related to [YOUR THEME/PURPOSE]"
|
|
1400
482
|
})
|
|
1401
483
|
\`\`\`
|
|
1402
484
|
|
|
1403
485
|
**Examples:**
|
|
1404
486
|
\`\`\`
|
|
1405
|
-
${
|
|
487
|
+
${e.iconAssistantName}({
|
|
1406
488
|
query: "icons for navigation menu"
|
|
1407
489
|
})
|
|
1408
490
|
\`\`\`
|
|
1409
491
|
|
|
1410
492
|
\`\`\`
|
|
1411
|
-
${
|
|
493
|
+
${e.iconAssistantName}({
|
|
1412
494
|
query: "icons for user actions like edit, delete, save"
|
|
1413
495
|
})
|
|
1414
496
|
\`\`\`
|
|
1415
|
-
|
|
497
|
+
`:""}
|
|
1416
498
|
|
|
1417
499
|
### Step 3: Review and Implement
|
|
1418
500
|
|
|
1419
501
|
After gathering information:
|
|
1420
|
-
1. Review the component documentation provided by ${
|
|
1421
|
-
2. Check which icons are available from ${
|
|
1422
|
-
3. Use the official ${
|
|
502
|
+
1. Review the component documentation provided by ${e.codeAssistantName}
|
|
503
|
+
2. Check which icons are available from ${e.iconAssistantName}
|
|
504
|
+
3. Use the official ${e.suiteName} documentation for detailed implementation guides
|
|
1423
505
|
4. Refer to the component examples and code snippets provided
|
|
1424
506
|
|
|
1425
507
|
---
|
|
@@ -1427,44 +509,33 @@ After gathering information:
|
|
|
1427
509
|
## Getting Started
|
|
1428
510
|
|
|
1429
511
|
**Next Actions:**
|
|
1430
|
-
1. Start by calling ${
|
|
1431
|
-
2. ${
|
|
1432
|
-
3. Follow the ${
|
|
512
|
+
1. Start by calling ${e.codeAssistantName} for the components you need
|
|
513
|
+
2. ${e.includeIcons?`Search for icons using ${e.iconAssistantName}`:"Review the component documentation"}
|
|
514
|
+
3. Follow the ${e.suiteName} official documentation for implementation details
|
|
1433
515
|
|
|
1434
516
|
**Important Notes:**
|
|
1435
517
|
- These tools provide documentation and guidance, not code generation
|
|
1436
|
-
- Always refer to official ${
|
|
1437
|
-
- Tool responses include usage examples and best practices`;
|
|
1438
|
-
};
|
|
1439
|
-
|
|
1440
|
-
// packages/kendo-ui-agent/src/lib/templates/shared-validation.ts
|
|
1441
|
-
var getSharedValidationSteps = (uiLibrary, designSystem) => ({
|
|
1442
|
-
SETUP_VALIDATION: `
|
|
518
|
+
- Always refer to official ${e.suiteName} documentation for the most up-to-date information
|
|
519
|
+
- Tool responses include usage examples and best practices`;var E=(e,t)=>({SETUP_VALIDATION:`
|
|
1443
520
|
UI Library Setup:
|
|
1444
|
-
- ${
|
|
1445
|
-
- ${
|
|
1446
|
-
- ${
|
|
1447
|
-
- Globalization and localization properly configured for ${
|
|
1448
|
-
- Required ${
|
|
1449
|
-
PERFORMANCE_OPTIMIZATION: `
|
|
521
|
+
- ${e} modules properly imported and configured
|
|
522
|
+
- ${e} theme properly loaded and applied
|
|
523
|
+
- ${e} license properly configured
|
|
524
|
+
- Globalization and localization properly configured for ${e} components
|
|
525
|
+
- Required ${e} dependencies installed and up-to-date`,PERFORMANCE_OPTIMIZATION:`
|
|
1450
526
|
Performance Optimization:
|
|
1451
527
|
- Efficient rendering patterns to prevent unnecessary re-renders
|
|
1452
|
-
- Lazy loading of ${
|
|
1453
|
-
- Virtualization enabled for large datasets in ${
|
|
1454
|
-
- Only required ${
|
|
1455
|
-
|
|
1456
|
-
${
|
|
1457
|
-
- Prioritize the ${designSystem} Design System utilities
|
|
528
|
+
- Lazy loading of ${e} components when appropriate
|
|
529
|
+
- Virtualization enabled for large datasets in ${e} components
|
|
530
|
+
- Only required ${e} modules imported and tree-shaken`,THEME_AND_STYLING:`
|
|
531
|
+
${e} Theme & Styling:
|
|
532
|
+
- Prioritize the ${t} Design System utilities
|
|
1458
533
|
- Avoid custom CSS or other framework classes
|
|
1459
534
|
- Do not use inline styles
|
|
1460
|
-
- Consistent ${
|
|
535
|
+
- Consistent ${e} theme application across all components
|
|
1461
536
|
- Custom theme variables properly defined and scoped
|
|
1462
|
-
- ${
|
|
1463
|
-
- Brand colors integrated with ${
|
|
1464
|
-
});
|
|
1465
|
-
|
|
1466
|
-
// packages/kendo-ui-agent/src/lib/templates/tailwind-bridge.ts
|
|
1467
|
-
var kendoTokenList = `--kendo-color-app-surface
|
|
537
|
+
- ${e} icon fonts properly loaded and optimized
|
|
538
|
+
- Brand colors integrated with ${e} component themes`});var Dt=`--kendo-color-app-surface
|
|
1468
539
|
--kendo-color-on-app-surface
|
|
1469
540
|
--kendo-color-subtle
|
|
1470
541
|
--kendo-color-surface
|
|
@@ -1650,8 +721,7 @@ var kendoTokenList = `--kendo-color-app-surface
|
|
|
1650
721
|
--kendo-border-radius-xxl
|
|
1651
722
|
--kendo-border-radius-xxxl
|
|
1652
723
|
--radius-4xl: 1.5rem
|
|
1653
|
-
--kendo-border-radius-full
|
|
1654
|
-
var tailwindV3SetupPrompt = `I need you to set up a system where Tailwind CSS is the single source of truth for all design tokens, and those tokens are automatically reflected as CSS custom properties so I can use them in regular CSS too.
|
|
724
|
+
--kendo-border-radius-full`,ke=`I need you to set up a system where Tailwind CSS is the single source of truth for all design tokens, and those tokens are automatically reflected as CSS custom properties so I can use them in regular CSS too.
|
|
1655
725
|
Requirements:
|
|
1656
726
|
|
|
1657
727
|
All design tokens (colors, spacing, font families, border radius, shadows) are defined once in tailwind.config.js
|
|
@@ -1666,8 +736,7 @@ Output I need:
|
|
|
1666
736
|
|
|
1667
737
|
The full tailwind.config.js with the plugin included
|
|
1668
738
|
The base CSS file importing Tailwind
|
|
1669
|
-
A short example showing a component using both bg-primary and var(--color-primary) side by side
|
|
1670
|
-
var tailwindV4SetupPrompt = `I need you to set up a system where Tailwind CSS v4 is the single source of truth for all design tokens, and those tokens are automatically available as CSS custom properties so I can use them in regular CSS too.
|
|
739
|
+
A short example showing a component using both bg-primary and var(--color-primary) side by side`,ve=`I need you to set up a system where Tailwind CSS v4 is the single source of truth for all design tokens, and those tokens are automatically available as CSS custom properties so I can use them in regular CSS too.
|
|
1671
740
|
Requirements:
|
|
1672
741
|
|
|
1673
742
|
All design tokens (colors, spacing, font families, border radius, shadows) are defined once in the @theme block \u2014 no tailwind.config.js
|
|
@@ -1681,1271 +750,144 @@ Use the Kendo theme tokens listed above as the design tokens.
|
|
|
1681
750
|
Output I need:
|
|
1682
751
|
|
|
1683
752
|
The single CSS file with @import "tailwindcss", the @theme block, and the .dark overrides
|
|
1684
|
-
A short example showing a component using both bg-primary and var(--color-primary) side by side
|
|
1685
|
-
var tailwindBridgeExample = `## Tailwind CSS Setup Instructions
|
|
753
|
+
A short example showing a component using both bg-primary and var(--color-primary) side by side`,z=`## Tailwind CSS Setup Instructions
|
|
1686
754
|
|
|
1687
755
|
Detect which version of Tailwind CSS the project uses, then follow the appropriate setup guide below.
|
|
1688
756
|
|
|
1689
757
|
### Kendo Theme Tokens
|
|
1690
758
|
These are the design tokens to map into Tailwind:
|
|
1691
|
-
${
|
|
759
|
+
${Dt}
|
|
1692
760
|
|
|
1693
761
|
### For Tailwind CSS v3 (uses tailwind.config.js)
|
|
1694
762
|
|
|
1695
763
|
<tailwind_v3_setup>
|
|
1696
|
-
${
|
|
764
|
+
${ke}
|
|
1697
765
|
</tailwind_v3_setup>
|
|
1698
766
|
|
|
1699
767
|
### For Tailwind CSS v4 (uses @theme block, no config file)
|
|
1700
768
|
|
|
1701
769
|
<tailwind_v4_setup>
|
|
1702
|
-
${
|
|
770
|
+
${ve}
|
|
1703
771
|
</tailwind_v4_setup>
|
|
1704
772
|
|
|
1705
|
-
IMPORTANT: Detect which version of Tailwind CSS the project uses, then follow the matching setup guide.`;
|
|
773
|
+
IMPORTANT: Detect which version of Tailwind CSS the project uses, then follow the matching setup guide.`;function Pt(e,t){let s;try{s=JSON.parse(e)}catch{return e}let o=s?.Item;if(!o)return e;let n=[],a=o.FullName??o.Name??"",r=o.Type??"",i=o.Summary??"",d=o.SyntaxContent??"";n.push(`## API Reference Item
|
|
774
|
+
- Name: ${a}
|
|
775
|
+
- Type: ${r}
|
|
776
|
+
- Summary: ${i}
|
|
777
|
+
- Syntax: ${d}`);let p=s.RelatedItemsByType?.return_type;if(p?.length){let u=p[0].Text;u&&n.push(`- Return Type: ${u}`)}let b=o.Examples??[];if(b.length>0){let u=`## Examples
|
|
778
|
+
`,c=0;for(let y of b){let A=(y.Component??"").toLowerCase(),w=t.toLowerCase();if(A&&A!==w&&A!=="general")continue;c+=1;let C=y.Code??"";u+=`### Example ${c}
|
|
779
|
+
\`\`\`
|
|
780
|
+
${C}
|
|
781
|
+
\`\`\`
|
|
782
|
+
`}c>0&&n.push(u)}let h=s.RelatedItemsByType??{},f=[];for(let[u,c]of Object.entries(h))if(!(u==="return_type"||u==="render_fragment"))for(let y of c??[]){let A=y.FullName??"",w=y.ShortText??"";f.push(`### ${A} (${u})
|
|
783
|
+
${w}`)}return f.length>0&&n.push(`## Additional Context
|
|
784
|
+
`+f.join(`
|
|
785
|
+
---
|
|
786
|
+
`)),n.join(`
|
|
1706
787
|
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
let data;
|
|
1710
|
-
try {
|
|
1711
|
-
data = JSON.parse(rawValue);
|
|
1712
|
-
} catch {
|
|
1713
|
-
return rawValue;
|
|
1714
|
-
}
|
|
1715
|
-
const item = data?.Item;
|
|
1716
|
-
if (!item) {
|
|
1717
|
-
return rawValue;
|
|
1718
|
-
}
|
|
1719
|
-
const sectionParts = [];
|
|
1720
|
-
const name = item.FullName ?? item.Name ?? "";
|
|
1721
|
-
const type = item.Type ?? "";
|
|
1722
|
-
const summary = item.Summary ?? "";
|
|
1723
|
-
const syntax = item.SyntaxContent ?? "";
|
|
1724
|
-
sectionParts.push(
|
|
1725
|
-
`## API Reference Item
|
|
1726
|
-
- Name: ${name}
|
|
1727
|
-
- Type: ${type}
|
|
1728
|
-
- Summary: ${summary}
|
|
1729
|
-
- Syntax: ${syntax}`
|
|
1730
|
-
);
|
|
1731
|
-
const returnTypeItems = data.RelatedItemsByType?.["return_type"];
|
|
1732
|
-
if (returnTypeItems?.length) {
|
|
1733
|
-
const returnType = returnTypeItems[0].Text;
|
|
1734
|
-
if (returnType) {
|
|
1735
|
-
sectionParts.push(`- Return Type: ${returnType}`);
|
|
1736
|
-
}
|
|
1737
|
-
}
|
|
1738
|
-
const examples = item.Examples ?? [];
|
|
1739
|
-
if (examples.length > 0) {
|
|
1740
|
-
let exampleSection = "## Examples\n";
|
|
1741
|
-
let exampleIndex = 0;
|
|
1742
|
-
for (const example of examples) {
|
|
1743
|
-
const exComponent = (example.Component ?? "").toLowerCase();
|
|
1744
|
-
const compLower = component.toLowerCase();
|
|
1745
|
-
if (exComponent && exComponent !== compLower && exComponent !== "general") {
|
|
1746
|
-
continue;
|
|
1747
|
-
}
|
|
1748
|
-
exampleIndex += 1;
|
|
1749
|
-
const code = example.Code ?? "";
|
|
1750
|
-
exampleSection += `### Example ${exampleIndex}
|
|
1751
|
-
\`\`\`
|
|
1752
|
-
${code}
|
|
1753
|
-
\`\`\`
|
|
1754
|
-
`;
|
|
1755
|
-
}
|
|
1756
|
-
if (exampleIndex > 0) {
|
|
1757
|
-
sectionParts.push(exampleSection);
|
|
1758
|
-
}
|
|
1759
|
-
}
|
|
1760
|
-
const related = data.RelatedItemsByType ?? {};
|
|
1761
|
-
const additionalContextItems = [];
|
|
1762
|
-
for (const [relationType, relatedItems] of Object.entries(related)) {
|
|
1763
|
-
if (relationType === "return_type" || relationType === "render_fragment") {
|
|
1764
|
-
continue;
|
|
1765
|
-
}
|
|
1766
|
-
for (const relatedItem of relatedItems ?? []) {
|
|
1767
|
-
const fullName = relatedItem.FullName ?? "";
|
|
1768
|
-
const shortText = relatedItem.ShortText ?? "";
|
|
1769
|
-
additionalContextItems.push(`### ${fullName} (${relationType})
|
|
1770
|
-
${shortText}`);
|
|
1771
|
-
}
|
|
1772
|
-
}
|
|
1773
|
-
if (additionalContextItems.length > 0) {
|
|
1774
|
-
sectionParts.push("## Additional Context\n" + additionalContextItems.join("\n---\n"));
|
|
1775
|
-
}
|
|
1776
|
-
return sectionParts.join("\n\n");
|
|
1777
|
-
}
|
|
1778
|
-
var LAYOUT_MODE = process.env.KENDO_UIA_LAYOUT_MODE || "utils";
|
|
1779
|
-
function createOrchestratorTool(config, templateOptions, contextApi2) {
|
|
1780
|
-
const {
|
|
1781
|
-
name,
|
|
1782
|
-
title,
|
|
1783
|
-
description,
|
|
1784
|
-
layoutAssistantName: layoutAssistantName2,
|
|
1785
|
-
codeAssistantName: codeAssistantName2,
|
|
1786
|
-
styleAssistantName: styleAssistantName2,
|
|
1787
|
-
iconAssistantName: iconAssistantName2,
|
|
1788
|
-
accessibilityAssistantName: accessibilityAssistantName2,
|
|
1789
|
-
figmaD2CToolName: figmaD2CToolName2,
|
|
1790
|
-
suiteName,
|
|
1791
|
-
libKey,
|
|
1792
|
-
components
|
|
1793
|
-
} = config;
|
|
1794
|
-
const tool = new UIAgentTool(
|
|
1795
|
-
name,
|
|
1796
|
-
{
|
|
1797
|
-
title,
|
|
1798
|
-
description,
|
|
1799
|
-
requiredAccess: config.requiredAccess,
|
|
1800
|
-
inputSchema: {
|
|
1801
|
-
userIntent: z4.string().describe(
|
|
1802
|
-
`Detailed description and intent of what the user wants to build. Include the type of page/component, main functionality, visual requirements, and any specific ${suiteName} components you want to use.`
|
|
1803
|
-
),
|
|
1804
|
-
needsComponentsDocsConfidence: z4.number().min(0).max(1).default(1).describe(
|
|
1805
|
-
"Confidence (0-1) to include Component Documentation assistance. Default is 1."
|
|
1806
|
-
),
|
|
1807
|
-
needsLayoutConfidence: z4.number().min(0).max(1).default(0).describe(
|
|
1808
|
-
"Confidence (0-1) to include Layout assistance. Default is 0."
|
|
1809
|
-
),
|
|
1810
|
-
needsStylingConfidence: z4.number().min(0).max(1).default(0).describe(
|
|
1811
|
-
"Confidence (0-1) to include Theming/Styling assistance. Default is 0."
|
|
1812
|
-
),
|
|
1813
|
-
needsResponsiveBehaviorConfidence: z4.number().min(0).max(1).default(0).describe(
|
|
1814
|
-
"Confidence (0-1) to include Responsive Behavior assistance. Default is 0."
|
|
1815
|
-
),
|
|
1816
|
-
needsIconsConfidence: z4.number().min(0).max(1).default(0).describe(
|
|
1817
|
-
"Confidence (0-1) to include Icons assistance. Default is 0."
|
|
1818
|
-
),
|
|
1819
|
-
needsFigmaD2CConfidence: z4.boolean().describe("Whether to include Figma D2C assistance. If the prompt includes a Figma URL always make sure to set to true.").default(false),
|
|
1820
|
-
componentsNeeded: z4.array(z4.enum(components)).optional().describe(
|
|
1821
|
-
`Optional list of specific ${suiteName} components needed for the project.`
|
|
1822
|
-
)
|
|
1823
|
-
}
|
|
1824
|
-
},
|
|
1825
|
-
async ({
|
|
1826
|
-
userIntent,
|
|
1827
|
-
needsComponentsDocsConfidence,
|
|
1828
|
-
needsLayoutConfidence,
|
|
1829
|
-
needsStylingConfidence,
|
|
1830
|
-
needsResponsiveBehaviorConfidence,
|
|
1831
|
-
needsIconsConfidence,
|
|
1832
|
-
needsFigmaD2CConfidence,
|
|
1833
|
-
componentsNeeded
|
|
1834
|
-
}, { _meta }) => {
|
|
1835
|
-
log("UI Orchestrator called with:", {
|
|
1836
|
-
userIntent,
|
|
1837
|
-
needsComponentsDocsConfidence,
|
|
1838
|
-
needsLayoutConfidence,
|
|
1839
|
-
needsStylingConfidence,
|
|
1840
|
-
needsResponsiveBehaviorConfidence,
|
|
1841
|
-
needsIconsConfidence
|
|
1842
|
-
});
|
|
1843
|
-
try {
|
|
1844
|
-
await contextApi2.recordOrchestratorUserRequest({
|
|
1845
|
-
meta: {
|
|
1846
|
-
userIntent,
|
|
1847
|
-
componentsNeeded,
|
|
1848
|
-
_meta
|
|
1849
|
-
}
|
|
1850
|
-
});
|
|
1851
|
-
} catch (error) {
|
|
1852
|
-
throw getGrpcError(error);
|
|
1853
|
-
}
|
|
1854
|
-
const clientCapabilities = tool.server?.server.getClientCapabilities?.();
|
|
1855
|
-
const supportsElicitation = clientCapabilities?.elicitation;
|
|
1856
|
-
let forceIncludeCustomTheming;
|
|
1857
|
-
if (supportsElicitation && needsStylingConfidence > 0.3 && needsStylingConfidence <= 0.6) {
|
|
1858
|
-
const result = await tool.server?.server.elicitInput({
|
|
1859
|
-
message: "I was unable to determine if you need custom Kendo Theme assistant. Can you please confirm?",
|
|
1860
|
-
requestedSchema: {
|
|
1861
|
-
type: "object",
|
|
1862
|
-
properties: {
|
|
1863
|
-
includeCustomTheming: {
|
|
1864
|
-
type: "boolean",
|
|
1865
|
-
description: "Whether to include Custom Theming assistance in the workflow."
|
|
1866
|
-
}
|
|
1867
|
-
},
|
|
1868
|
-
required: ["includeCustomTheming"]
|
|
1869
|
-
}
|
|
1870
|
-
});
|
|
1871
|
-
if (result?.action === "accept" && result.content?.includeCustomTheming) {
|
|
1872
|
-
forceIncludeCustomTheming = true;
|
|
1873
|
-
}
|
|
1874
|
-
}
|
|
1875
|
-
const response = renderOrchestratorResponse(
|
|
1876
|
-
{
|
|
1877
|
-
name,
|
|
1878
|
-
userIntent,
|
|
1879
|
-
includeComponentsDocs: needsComponentsDocsConfidence > 0.3,
|
|
1880
|
-
includeTheming: needsStylingConfidence > 0.6 || !!forceIncludeCustomTheming,
|
|
1881
|
-
includeLayout: needsLayoutConfidence > 0.5,
|
|
1882
|
-
includeIcons: needsIconsConfidence > 0.6,
|
|
1883
|
-
includeResponsive: needsLayoutConfidence > 0.5 && needsResponsiveBehaviorConfidence > 0.4,
|
|
1884
|
-
includeFigmaD2C: needsFigmaD2CConfidence,
|
|
1885
|
-
layoutAssistantName: layoutAssistantName2,
|
|
1886
|
-
codeAssistantName: codeAssistantName2,
|
|
1887
|
-
styleAssistantName: styleAssistantName2,
|
|
1888
|
-
iconAssistantName: iconAssistantName2,
|
|
1889
|
-
accessibilityAssistantName: accessibilityAssistantName2,
|
|
1890
|
-
figmaD2CToolName: figmaD2CToolName2,
|
|
1891
|
-
suiteName,
|
|
1892
|
-
libKey,
|
|
1893
|
-
layoutMode: LAYOUT_MODE,
|
|
1894
|
-
components: componentsNeeded
|
|
1895
|
-
},
|
|
1896
|
-
templateOptions
|
|
1897
|
-
);
|
|
1898
|
-
return {
|
|
1899
|
-
content: [
|
|
1900
|
-
{
|
|
1901
|
-
type: "text",
|
|
1902
|
-
text: response
|
|
1903
|
-
}
|
|
1904
|
-
]
|
|
1905
|
-
};
|
|
1906
|
-
}
|
|
1907
|
-
);
|
|
1908
|
-
return tool;
|
|
1909
|
-
}
|
|
1910
|
-
function createAssistantOrchestratorTool(config, contextApi2) {
|
|
1911
|
-
const {
|
|
1912
|
-
name,
|
|
1913
|
-
title,
|
|
1914
|
-
description,
|
|
1915
|
-
iconAssistantName: iconAssistantName2,
|
|
1916
|
-
codeAssistantName: codeAssistantName2,
|
|
1917
|
-
suiteName,
|
|
1918
|
-
libKey,
|
|
1919
|
-
components
|
|
1920
|
-
} = config;
|
|
1921
|
-
const tool = new UIAgentTool(
|
|
1922
|
-
name,
|
|
1923
|
-
{
|
|
1924
|
-
title,
|
|
1925
|
-
description,
|
|
1926
|
-
inputSchema: {
|
|
1927
|
-
userIntent: z4.string().describe(
|
|
1928
|
-
`Describe what you want to build or what components you're looking for. Include the type of functionality, features, or UI elements you need from ${suiteName}.`
|
|
1929
|
-
),
|
|
1930
|
-
needsIconsConfidence: z4.number().min(0).max(1).default(0.7).describe(
|
|
1931
|
-
"Confidence (0-1) to include Icons assistance. Default is 0.7."
|
|
1932
|
-
),
|
|
1933
|
-
componentsNeeded: z4.array(z4.enum(components)).optional().describe(
|
|
1934
|
-
`Optional list of specific ${suiteName} components you want to learn about.`
|
|
1935
|
-
)
|
|
1936
|
-
},
|
|
1937
|
-
requiredAccess: config.requiredAccess
|
|
1938
|
-
},
|
|
1939
|
-
async ({
|
|
1940
|
-
userIntent,
|
|
1941
|
-
needsIconsConfidence,
|
|
1942
|
-
componentsNeeded
|
|
1943
|
-
}, { _meta }) => {
|
|
1944
|
-
log("Assistant Orchestrator called with:", {
|
|
1945
|
-
userIntent,
|
|
1946
|
-
needsIconsConfidence,
|
|
1947
|
-
componentsNeeded
|
|
1948
|
-
});
|
|
1949
|
-
try {
|
|
1950
|
-
await contextApi2.recordOrchestratorUserRequest({
|
|
1951
|
-
meta: {
|
|
1952
|
-
userIntent,
|
|
1953
|
-
componentsNeeded,
|
|
1954
|
-
_meta
|
|
1955
|
-
}
|
|
1956
|
-
});
|
|
1957
|
-
} catch (error) {
|
|
1958
|
-
throw getGrpcError(error);
|
|
1959
|
-
}
|
|
1960
|
-
const response = renderAssistantOrchestratorResponse({
|
|
1961
|
-
name,
|
|
1962
|
-
userIntent,
|
|
1963
|
-
includeComponentsDocs: true,
|
|
1964
|
-
// Always true for assistant mode
|
|
1965
|
-
includeIcons: needsIconsConfidence > 0.5,
|
|
1966
|
-
codeAssistantName: codeAssistantName2,
|
|
1967
|
-
iconAssistantName: iconAssistantName2,
|
|
1968
|
-
suiteName,
|
|
1969
|
-
libKey,
|
|
1970
|
-
components: componentsNeeded
|
|
1971
|
-
});
|
|
1972
|
-
return {
|
|
1973
|
-
content: [
|
|
1974
|
-
{
|
|
1975
|
-
type: "text",
|
|
1976
|
-
text: response
|
|
1977
|
-
}
|
|
1978
|
-
]
|
|
1979
|
-
};
|
|
1980
|
-
}
|
|
1981
|
-
);
|
|
1982
|
-
return tool;
|
|
1983
|
-
}
|
|
1984
|
-
function createLayoutAssistantTool(config, contextApi2) {
|
|
1985
|
-
const {
|
|
1986
|
-
name,
|
|
1987
|
-
title,
|
|
1988
|
-
description,
|
|
1989
|
-
suiteName: _suiteName,
|
|
1990
|
-
libKey,
|
|
1991
|
-
getPreContent
|
|
1992
|
-
} = config;
|
|
1993
|
-
return new UIAgentTool(
|
|
1994
|
-
name,
|
|
1995
|
-
{
|
|
1996
|
-
title,
|
|
1997
|
-
description,
|
|
1998
|
-
requiredAccess: LAYOUT_MODE === "utils" ? config.requiredAccess : ["none"],
|
|
1999
|
-
inputSchema: {
|
|
2000
|
-
prompt: z4.string().describe(
|
|
2001
|
-
`An enhanced prompt describing the HTML layout structure, design requirements or specific visual effects you want to achieve.`
|
|
2002
|
-
),
|
|
2003
|
-
includeBuildingBlockExamples: z4.boolean().describe(
|
|
2004
|
-
"Whether to include building block examples. Defaults to false."
|
|
2005
|
-
).default(false)
|
|
2006
|
-
}
|
|
2007
|
-
},
|
|
2008
|
-
async ({ prompt, includeBuildingBlockExamples }, { _meta }) => {
|
|
2009
|
-
log("Layout Assistant called with:", {
|
|
2010
|
-
prompt,
|
|
2011
|
-
includeBuildingBlockExamples
|
|
2012
|
-
});
|
|
2013
|
-
try {
|
|
2014
|
-
const cssResponse = await contextApi2.queryCssUtils({ query: prompt }, { _meta });
|
|
2015
|
-
let finalMarkdown = cssResponse.values.join("\n") || "No CSS utilities found for the given prompt.";
|
|
2016
|
-
const preContent = getPreContent?.() ?? "";
|
|
2017
|
-
const buildLayout = (buildingBlockMd) => {
|
|
2018
|
-
return `${preContent}
|
|
788
|
+
`)}var Y=process.env.KENDO_UIA_LAYOUT_MODE||"utils";function Ae(e,t,s){let{name:o,title:n,description:a,layoutAssistantName:r,codeAssistantName:i,styleAssistantName:d,iconAssistantName:p,accessibilityAssistantName:b,suiteName:h,libKey:f,components:u}=e,c=new S(o,{title:n,description:a,requiredAccess:e.requiredAccess,inputSchema:{userIntent:k.string().describe(`Detailed description and intent of what the user wants to build. Include the type of page/component, main functionality, visual requirements, and any specific ${h} components you want to use.`),needsComponentsDocsConfidence:k.number().min(0).max(1).default(1).describe("Confidence (0-1) to include Component Documentation assistance. Default is 1."),needsLayoutConfidence:k.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Layout assistance. Default is 0."),needsStylingConfidence:k.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Theming/Styling assistance. Default is 0."),needsResponsiveBehaviorConfidence:k.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Responsive Behavior assistance. Default is 0."),needsIconsConfidence:k.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Icons assistance. Default is 0."),componentsNeeded:k.array(k.enum(u)).optional().describe(`Optional list of specific ${h} components needed for the project.`)}},async({userIntent:y,needsComponentsDocsConfidence:A,needsLayoutConfidence:w,needsStylingConfidence:C,needsResponsiveBehaviorConfidence:x,needsIconsConfidence:ne,componentsNeeded:se},{_meta:pt})=>{g("UI Orchestrator called with:",{userIntent:y,needsComponentsDocsConfidence:A,needsLayoutConfidence:w,needsStylingConfidence:C,needsResponsiveBehaviorConfidence:x,needsIconsConfidence:ne});try{await s.recordOrchestratorUserRequest({meta:{userIntent:y,componentsNeeded:se,_meta:pt}})}catch(_){throw R(_)}let ut=c.server?.server.getClientCapabilities?.()?.elicitation,re;if(ut&&C>.3&&C<=.6){let _=await c.server?.server.elicitInput({message:"I was unable to determine if you need custom Kendo Theme assistant. Can you please confirm?",requestedSchema:{type:"object",properties:{includeCustomTheming:{type:"boolean",description:"Whether to include Custom Theming assistance in the workflow."}},required:["includeCustomTheming"]}});_?.action==="accept"&&_.content?.includeCustomTheming&&(re=!0)}return{content:[{type:"text",text:G({name:o,userIntent:y,includeComponentsDocs:A>.3,includeTheming:C>.6||!!re,includeLayout:w>.5,includeIcons:ne>.6,includeResponsive:w>.5&&x>.4,layoutAssistantName:r,codeAssistantName:i,styleAssistantName:d,iconAssistantName:p,accessibilityAssistantName:b,suiteName:h,libKey:f,layoutMode:Y,components:se},t)}]}});return c}function we(e,t){let{name:s,title:o,description:n,iconAssistantName:a,codeAssistantName:r,suiteName:i,libKey:d,components:p}=e;return new S(s,{title:o,description:n,inputSchema:{userIntent:k.string().describe(`Describe what you want to build or what components you're looking for. Include the type of functionality, features, or UI elements you need from ${i}.`),needsIconsConfidence:k.number().min(0).max(1).default(.7).describe("Confidence (0-1) to include Icons assistance. Default is 0.7."),componentsNeeded:k.array(k.enum(p)).optional().describe(`Optional list of specific ${i} components you want to learn about.`)},requiredAccess:e.requiredAccess},async({userIntent:h,needsIconsConfidence:f,componentsNeeded:u},{_meta:c})=>{g("Assistant Orchestrator called with:",{userIntent:h,needsIconsConfidence:f,componentsNeeded:u});try{await t.recordOrchestratorUserRequest({meta:{userIntent:h,componentsNeeded:u,_meta:c}})}catch(A){throw R(A)}return{content:[{type:"text",text:W({name:s,userIntent:h,includeComponentsDocs:!0,includeIcons:f>.5,codeAssistantName:r,iconAssistantName:a,suiteName:i,libKey:d,components:u})}]}})}function Se(e,t){let{name:s,title:o,description:n,suiteName:a,libKey:r,getPreContent:i}=e;return new S(s,{title:o,description:n,requiredAccess:Y==="utils"?e.requiredAccess:["none"],inputSchema:{prompt:k.string().describe("An enhanced prompt describing the HTML layout structure, design requirements or specific visual effects you want to achieve."),includeBuildingBlockExamples:k.boolean().describe("Whether to include building block examples. Defaults to false.").default(!1)}},async({prompt:d,includeBuildingBlockExamples:p},{_meta:b})=>{g("Layout Assistant called with:",{prompt:d,includeBuildingBlockExamples:p});try{let f=(await t.queryCssUtils({query:d},{_meta:b})).values.join(`
|
|
789
|
+
`)||"No CSS utilities found for the given prompt.",u=i?.()??"",c=y=>`${u}
|
|
2019
790
|
|
|
2020
791
|
# Kendo Design System CSS Utilities
|
|
2021
792
|
|
|
2022
|
-
${
|
|
2023
|
-
${
|
|
2024
|
-
`;
|
|
2025
|
-
};
|
|
2026
|
-
if (includeBuildingBlockExamples) {
|
|
2027
|
-
try {
|
|
2028
|
-
const buildingBlocksResponse = await contextApi2.queryBuildingBlocks({
|
|
2029
|
-
query: prompt,
|
|
2030
|
-
lib_name: libKey
|
|
2031
|
-
}, { _meta });
|
|
2032
|
-
let buildingBlockMd = "";
|
|
2033
|
-
if (buildingBlocksResponse.items?.length > 0) {
|
|
2034
|
-
buildingBlockMd = `
|
|
793
|
+
${f}
|
|
794
|
+
${y??""}
|
|
795
|
+
`;if(p)try{let y=await t.queryBuildingBlocks({query:d,lib_name:r},{_meta:b}),A="";y.items?.length>0&&(A=`
|
|
2035
796
|
## Building Blocks Examples
|
|
2036
797
|
|
|
2037
798
|
The examples here are for demonstration purpose how CSS utils can be implemented in various building blocks.
|
|
2038
799
|
However, consider your own design requirements and specifics in order to implement your templates/building blocks correctly.
|
|
2039
800
|
|
|
2040
|
-
${
|
|
2041
|
-
|
|
2042
|
-
### ${item.name}
|
|
801
|
+
${y.items.map(w=>`
|
|
802
|
+
### ${w.name}
|
|
2043
803
|
|
|
2044
|
-
${
|
|
804
|
+
${w.description}
|
|
2045
805
|
|
|
2046
806
|
\`\`\`code
|
|
2047
|
-
${
|
|
2048
|
-
\`\`\`
|
|
2049
|
-
`
|
|
2050
|
-
|
|
2051
|
-
}
|
|
2052
|
-
finalMarkdown = buildLayout(buildingBlockMd);
|
|
2053
|
-
} catch (buildingBlockError) {
|
|
2054
|
-
log("Error calling building-blocks service:", buildingBlockError);
|
|
2055
|
-
finalMarkdown = buildLayout();
|
|
2056
|
-
}
|
|
2057
|
-
} else {
|
|
2058
|
-
finalMarkdown = buildLayout();
|
|
2059
|
-
}
|
|
2060
|
-
return {
|
|
2061
|
-
content: [
|
|
2062
|
-
{
|
|
2063
|
-
type: "text",
|
|
2064
|
-
text: finalMarkdown
|
|
2065
|
-
}
|
|
2066
|
-
]
|
|
2067
|
-
};
|
|
2068
|
-
} catch (error) {
|
|
2069
|
-
throw getGrpcError(error);
|
|
2070
|
-
}
|
|
2071
|
-
}
|
|
2072
|
-
);
|
|
2073
|
-
}
|
|
2074
|
-
function createStyleAssistantTool(config, contextApi2) {
|
|
2075
|
-
const { name, title, description, libKey: _libKey, getPreContent } = config;
|
|
2076
|
-
return new UIAgentTool(
|
|
2077
|
-
name,
|
|
2078
|
-
{
|
|
2079
|
-
title,
|
|
2080
|
-
description,
|
|
2081
|
-
requiredAccess: config.requiredAccess,
|
|
2082
|
-
inputSchema: {
|
|
2083
|
-
prompt: z4.string().describe(
|
|
2084
|
-
`A natural language description of the desired visual style or theme. For example: 'Create a modern dark theme with high contrast'.`
|
|
2085
|
-
)
|
|
2086
|
-
}
|
|
2087
|
-
},
|
|
2088
|
-
async ({ prompt }, { _meta }) => {
|
|
2089
|
-
log("Style Assistant called with:", { prompt });
|
|
2090
|
-
if (LAYOUT_MODE === "tailwind") {
|
|
2091
|
-
return {
|
|
2092
|
-
content: [
|
|
2093
|
-
{
|
|
2094
|
-
type: "text",
|
|
2095
|
-
text: `Note: For layout and spacing, use Tailwind CSS utility classes to structure your layout and apply spacing between elements.
|
|
807
|
+
${w.code}
|
|
808
|
+
\`\`\`
|
|
809
|
+
`).join(`
|
|
810
|
+
`)}`),f=c(A)}catch(y){g("Error calling building-blocks service:",y),f=c()}else f=c();return{content:[{type:"text",text:f}]}}catch(h){throw R(h)}})}function Ce(e,t){let{name:s,title:o,description:n,libKey:a,getPreContent:r}=e;return new S(s,{title:o,description:n,requiredAccess:e.requiredAccess,inputSchema:{prompt:k.string().describe("A natural language description of the desired visual style or theme. For example: 'Create a modern dark theme with high contrast'.")}},async({prompt:i},{_meta:d})=>{if(g("Style Assistant called with:",{prompt:i}),Y==="tailwind")return{content:[{type:"text",text:`Note: For layout and spacing, use Tailwind CSS utility classes to structure your layout and apply spacing between elements.
|
|
2096
811
|
IMPORTANT: You need to set up Tailwind CSS so it becomes the single source of truth for all design tokens. Detect which Tailwind version the project uses and follow the appropriate setup instructions below.
|
|
2097
812
|
|
|
2098
813
|
<tailwind_setup_instructions>
|
|
2099
|
-
${
|
|
814
|
+
${z}
|
|
2100
815
|
</tailwind_setup_instructions>
|
|
2101
|
-
`
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
};
|
|
2105
|
-
}
|
|
2106
|
-
let formattedCSS = "";
|
|
2107
|
-
try {
|
|
2108
|
-
const result = await contextApi2.queryThemeGenerate({ prompt }, { _meta });
|
|
2109
|
-
if (result.variables_json) {
|
|
2110
|
-
const theme = JSON.parse(result.variables_json);
|
|
2111
|
-
let cssBlocks = [];
|
|
2112
|
-
if (theme) {
|
|
2113
|
-
for (const key of Object.keys(theme)) {
|
|
2114
|
-
if (typeof theme[key] === "string") {
|
|
2115
|
-
cssBlocks.push(`${key}: ${theme[key]}`);
|
|
2116
|
-
}
|
|
2117
|
-
}
|
|
2118
|
-
}
|
|
2119
|
-
formattedCSS = cssBlocks.join("\n\n");
|
|
2120
|
-
}
|
|
2121
|
-
} catch (error) {
|
|
2122
|
-
throw getGrpcError(error);
|
|
2123
|
-
}
|
|
2124
|
-
const preContent = getPreContent?.() ?? "";
|
|
2125
|
-
const response = formattedCSS ? `Use the following CSS variables to style the web application, including colors, typography, spacing, and component appearance.
|
|
816
|
+
`}]};let p="";try{let f=await t.queryThemeGenerate({prompt:i},{_meta:d});if(f.variables_json){let u=JSON.parse(f.variables_json),c=[];if(u)for(let y of Object.keys(u))typeof u[y]=="string"&&c.push(`${y}: ${u[y]}`);p=c.join(`
|
|
817
|
+
|
|
818
|
+
`)}}catch(f){throw R(f)}let b=r?.()??"";return{content:[{type:"text",text:p?`Use the following CSS variables to style the web application, including colors, typography, spacing, and component appearance.
|
|
2126
819
|
Ensure the variables are applied consistently across all relevant elements.
|
|
2127
820
|
Do NOT set any inline styles. CSS variables should be defined in global or component-level CSS files, or via supported theming mechanisms.
|
|
2128
821
|
|
|
2129
|
-
${
|
|
822
|
+
${b}
|
|
2130
823
|
|
|
2131
824
|
## Generated CSS Variables
|
|
2132
825
|
|
|
2133
826
|
\`\`\`css
|
|
2134
|
-
${
|
|
2135
|
-
\`\`\`
|
|
2136
|
-
|
|
2137
|
-
return {
|
|
2138
|
-
content: [
|
|
2139
|
-
{
|
|
2140
|
-
type: "text",
|
|
2141
|
-
text: response
|
|
2142
|
-
},
|
|
2143
|
-
{
|
|
2144
|
-
type: "text",
|
|
2145
|
-
text: "Note: For layout and spacing, use the Layout Assistant tool to get the appropriate Kendo CSS utility classes."
|
|
2146
|
-
}
|
|
2147
|
-
]
|
|
2148
|
-
};
|
|
2149
|
-
}
|
|
2150
|
-
);
|
|
2151
|
-
}
|
|
2152
|
-
function createIconSearchTool(config, contextApi2) {
|
|
2153
|
-
const { name, title, description, libKey: _libKey, getPostContent } = config;
|
|
2154
|
-
return new UIAgentTool(
|
|
2155
|
-
name,
|
|
2156
|
-
{
|
|
2157
|
-
title,
|
|
2158
|
-
description,
|
|
2159
|
-
requiredAccess: config.requiredAccess,
|
|
2160
|
-
inputSchema: {
|
|
2161
|
-
query: z4.string().describe(
|
|
2162
|
-
"A search query for finding icons. Be specific about the icon purpose, style, or action."
|
|
2163
|
-
),
|
|
2164
|
-
limit: z4.number().min(0.1).max(1).default(0.1).describe(
|
|
2165
|
-
`The proportion of matching icons to return (0.1 = 1 icon, 0.5 = 5 icons, 1.0 = many icons). Default is 0.1.`
|
|
2166
|
-
)
|
|
2167
|
-
}
|
|
2168
|
-
},
|
|
2169
|
-
async ({ query, limit }, { _meta }) => {
|
|
2170
|
-
log("Icon Search called with:", { query, limit });
|
|
2171
|
-
try {
|
|
2172
|
-
const result = await contextApi2.queryIconsSearch({
|
|
2173
|
-
query,
|
|
2174
|
-
limit: limit * 100
|
|
2175
|
-
}, { _meta });
|
|
2176
|
-
const postContent = getPostContent?.() ?? "";
|
|
2177
|
-
const response = `${result.values.join("\n\n")}
|
|
2178
|
-
|
|
2179
|
-
${postContent}`;
|
|
2180
|
-
return {
|
|
2181
|
-
content: [
|
|
2182
|
-
{
|
|
2183
|
-
type: "text",
|
|
2184
|
-
text: response
|
|
2185
|
-
}
|
|
2186
|
-
]
|
|
2187
|
-
};
|
|
2188
|
-
} catch (error) {
|
|
2189
|
-
throw getGrpcError(error);
|
|
2190
|
-
}
|
|
2191
|
-
}
|
|
2192
|
-
);
|
|
2193
|
-
}
|
|
2194
|
-
function createCodeAssistantTool(config, contextApi2) {
|
|
2195
|
-
const {
|
|
2196
|
-
name,
|
|
2197
|
-
title,
|
|
2198
|
-
description,
|
|
2199
|
-
libKey,
|
|
2200
|
-
suiteName: _suiteName,
|
|
2201
|
-
components,
|
|
2202
|
-
componentAliases,
|
|
2203
|
-
getPostContent
|
|
2204
|
-
} = config;
|
|
2205
|
-
return new UIAgentTool(
|
|
2206
|
-
name,
|
|
2207
|
-
{
|
|
2208
|
-
title,
|
|
2209
|
-
description,
|
|
2210
|
-
requiredAccess: config.requiredAccess,
|
|
2211
|
-
inputSchema: {
|
|
2212
|
-
query: z4.string().describe("The query to search for."),
|
|
2213
|
-
component: z4.enum(components).describe(
|
|
2214
|
-
"The component to search for. If not specified, use General."
|
|
2215
|
-
)
|
|
2216
|
-
}
|
|
2217
|
-
},
|
|
2218
|
-
async ({ query, component }, { _meta }) => {
|
|
2219
|
-
log("Code Assistant called with:", { query, component });
|
|
2220
|
-
let resolvedComponent = component;
|
|
2221
|
-
if (componentAliases) {
|
|
2222
|
-
const alias = componentAliases[component];
|
|
2223
|
-
if (alias) {
|
|
2224
|
-
resolvedComponent = alias;
|
|
2225
|
-
}
|
|
2226
|
-
}
|
|
2227
|
-
try {
|
|
2228
|
-
const response = await contextApi2.query({
|
|
2229
|
-
query,
|
|
2230
|
-
component: resolvedComponent?.toLowerCase() ?? "general",
|
|
2231
|
-
lib_name: libKey,
|
|
2232
|
-
text_matches_count: 3,
|
|
2233
|
-
code_matches_count: 0,
|
|
2234
|
-
allowed_types: ["documentation"]
|
|
2235
|
-
}, { _meta });
|
|
2236
|
-
const cleanedValues = response.values.map(
|
|
2237
|
-
(val) => val.replace(/\0/g, "")
|
|
2238
|
-
);
|
|
2239
|
-
const postContent = getPostContent?.({ component }) ?? "";
|
|
2240
|
-
const combinedResponse = `${cleanedValues.join("\n\n")}
|
|
2241
|
-
|
|
2242
|
-
${postContent}`;
|
|
2243
|
-
return {
|
|
2244
|
-
content: [
|
|
2245
|
-
{
|
|
2246
|
-
type: "text",
|
|
2247
|
-
text: combinedResponse
|
|
2248
|
-
}
|
|
2249
|
-
]
|
|
2250
|
-
};
|
|
2251
|
-
} catch (error) {
|
|
2252
|
-
throw getGrpcError(error);
|
|
2253
|
-
}
|
|
2254
|
-
}
|
|
2255
|
-
);
|
|
2256
|
-
}
|
|
2257
|
-
function createAccessibilityAssistantTool(config, contextApi2) {
|
|
2258
|
-
const {
|
|
2259
|
-
name,
|
|
2260
|
-
title,
|
|
2261
|
-
description,
|
|
2262
|
-
libKey,
|
|
2263
|
-
suiteName: _suiteName,
|
|
2264
|
-
components,
|
|
2265
|
-
componentAliases
|
|
2266
|
-
} = config;
|
|
2267
|
-
return new UIAgentTool(
|
|
2268
|
-
name,
|
|
2269
|
-
{
|
|
2270
|
-
title,
|
|
2271
|
-
description,
|
|
2272
|
-
requiredAccess: config.requiredAccess,
|
|
2273
|
-
inputSchema: {
|
|
2274
|
-
query: z4.string().describe("The query to search for."),
|
|
2275
|
-
component: z4.enum(components).describe(
|
|
2276
|
-
"The component to search for. If not specified, use General."
|
|
2277
|
-
),
|
|
2278
|
-
includeGeneralGuidelines: z4.boolean().default(false).describe(
|
|
2279
|
-
"Set to true only on the first call to include comprehensive WCAG 2.2 Level AA general guidelines. After the first call, set to false to get only component-specific accessibility information. Default is false."
|
|
2280
|
-
)
|
|
2281
|
-
}
|
|
2282
|
-
},
|
|
2283
|
-
async ({ query, component, includeGeneralGuidelines }, { _meta }) => {
|
|
2284
|
-
log("Accessibility Assistant called with:", {
|
|
2285
|
-
query,
|
|
2286
|
-
component,
|
|
2287
|
-
includeGeneralGuidelines
|
|
2288
|
-
});
|
|
2289
|
-
let resolvedComponent = component;
|
|
2290
|
-
if (componentAliases) {
|
|
2291
|
-
const alias = componentAliases[component];
|
|
2292
|
-
if (alias) {
|
|
2293
|
-
resolvedComponent = alias;
|
|
2294
|
-
}
|
|
2295
|
-
}
|
|
2296
|
-
try {
|
|
2297
|
-
let finalResponse = "";
|
|
2298
|
-
if (includeGeneralGuidelines) {
|
|
2299
|
-
const generalGuidelines = getAccessibilityGuidelines();
|
|
2300
|
-
finalResponse += "# WCAG 2.2 Level AA General Accessibility Guidelines\n\n";
|
|
2301
|
-
finalResponse += generalGuidelines;
|
|
2302
|
-
finalResponse += "\n\n---\n\n";
|
|
2303
|
-
}
|
|
2304
|
-
const response = await contextApi2.getApiRefMatches({
|
|
2305
|
-
query,
|
|
2306
|
-
component: resolvedComponent?.toLowerCase() ?? "general",
|
|
2307
|
-
lib_name: libKey,
|
|
2308
|
-
filters_json: '{"type":{"$in":["accessibility"]}}'
|
|
2309
|
-
}, { _meta });
|
|
2310
|
-
const cleanedValues = response.values.map(
|
|
2311
|
-
(val) => val.replace(/\0/g, "")
|
|
2312
|
-
);
|
|
2313
|
-
const formattedValues = cleanedValues.map(
|
|
2314
|
-
(val) => formatApiRefItemFromJson(val, resolvedComponent?.toLowerCase() ?? "general")
|
|
2315
|
-
);
|
|
2316
|
-
const componentResult = formattedValues.join("\n\n");
|
|
2317
|
-
if (componentResult) {
|
|
2318
|
-
if (includeGeneralGuidelines) {
|
|
2319
|
-
finalResponse += "# Component-Specific Accessibility Information\n\n";
|
|
2320
|
-
}
|
|
2321
|
-
finalResponse += componentResult;
|
|
2322
|
-
} else if (!includeGeneralGuidelines) {
|
|
2323
|
-
finalResponse = "No component-specific accessibility guidelines found.";
|
|
2324
|
-
}
|
|
2325
|
-
return {
|
|
2326
|
-
content: [
|
|
2327
|
-
{
|
|
2328
|
-
type: "text",
|
|
2329
|
-
text: finalResponse
|
|
2330
|
-
}
|
|
2331
|
-
]
|
|
2332
|
-
};
|
|
2333
|
-
} catch (error) {
|
|
2334
|
-
throw getGrpcError(error);
|
|
2335
|
-
}
|
|
2336
|
-
}
|
|
2337
|
-
);
|
|
2338
|
-
}
|
|
2339
|
-
function getGrpcError(error) {
|
|
2340
|
-
const errorObj = error;
|
|
2341
|
-
if (errorObj.code === 16 /* UNAUTHENTICATED */) {
|
|
2342
|
-
return new Error(
|
|
2343
|
-
"Error: You are not authenticated. Please verify the Telerik License Key provided is valid."
|
|
2344
|
-
);
|
|
2345
|
-
} else if (errorObj.code === 8 /* RESOURCE_EXHAUSTED */) {
|
|
2346
|
-
return new Error(
|
|
2347
|
-
`Error: You have exceeded the extension quota. Upgrade to subscription licensing to unlock full access. Message: ${errorObj.message}.`
|
|
2348
|
-
);
|
|
2349
|
-
} else if (errorObj.code === 7 /* PERMISSION_DENIED */) {
|
|
2350
|
-
return new Error(
|
|
2351
|
-
"Error: You do not have permission to access this resource. Please verify that you have a valid license."
|
|
2352
|
-
);
|
|
2353
|
-
} else {
|
|
2354
|
-
return new Error(
|
|
2355
|
-
`Error: An error occurred while calling the service. Please try again later.
|
|
2356
|
-
|
|
2357
|
-
Error Code: ${errorObj.code} Error Message: ${errorObj.message}`
|
|
2358
|
-
);
|
|
2359
|
-
}
|
|
2360
|
-
}
|
|
827
|
+
${p}
|
|
828
|
+
\`\`\`
|
|
829
|
+
`:"No CSS variables were generated for the given prompt."},{type:"text",text:"Note: For layout and spacing, use the Layout Assistant tool to get the appropriate Kendo CSS utility classes."}]}})}function Te(e,t){let{name:s,title:o,description:n,libKey:a,getPostContent:r}=e;return new S(s,{title:o,description:n,requiredAccess:e.requiredAccess,inputSchema:{query:k.string().describe("A search query for finding icons. Be specific about the icon purpose, style, or action."),limit:k.number().min(.1).max(1).default(.1).describe("The proportion of matching icons to return (0.1 = 1 icon, 0.5 = 5 icons, 1.0 = many icons). Default is 0.1.")}},async({query:i,limit:d},{_meta:p})=>{g("Icon Search called with:",{query:i,limit:d});try{let b=await t.queryIconsSearch({query:i,limit:d*100},{_meta:p}),h=r?.()??"";return{content:[{type:"text",text:`${b.values.join(`
|
|
2361
830
|
|
|
2362
|
-
|
|
2363
|
-
var FigmaAPIError = class extends Error {
|
|
2364
|
-
constructor(status, body) {
|
|
2365
|
-
super(`Figma API error ${status}: ${body}`);
|
|
2366
|
-
this.status = status;
|
|
2367
|
-
this.body = body;
|
|
2368
|
-
this.name = "FigmaAPIError";
|
|
2369
|
-
}
|
|
2370
|
-
};
|
|
831
|
+
`)}
|
|
2371
832
|
|
|
2372
|
-
|
|
2373
|
-
var FigmaClient = class {
|
|
2374
|
-
constructor(apiKey) {
|
|
2375
|
-
this.retryConfig = {
|
|
2376
|
-
maxRetries: 3,
|
|
2377
|
-
baseDelayMs: 1e3,
|
|
2378
|
-
maxDelayMs: 3e4
|
|
2379
|
-
};
|
|
2380
|
-
this.apiKey = apiKey;
|
|
2381
|
-
}
|
|
2382
|
-
/**
|
|
2383
|
-
* Fetch file metadata including node and component counts
|
|
2384
|
-
*/
|
|
2385
|
-
async getFileMeta(fileKey) {
|
|
2386
|
-
const fileResponse = await this.getFile(fileKey, { depth: 1 });
|
|
2387
|
-
const counts = this.countNodesAndComponents(fileResponse.document);
|
|
2388
|
-
return {
|
|
2389
|
-
nodeCount: counts.nodes,
|
|
2390
|
-
componentCount: counts.components
|
|
2391
|
-
};
|
|
2392
|
-
}
|
|
2393
|
-
/**
|
|
2394
|
-
* Fetch a specific file with optional depth parameter
|
|
2395
|
-
*/
|
|
2396
|
-
async getFile(fileKey, options) {
|
|
2397
|
-
const url = this.buildFileUrl(fileKey, options);
|
|
2398
|
-
return this.fetchWithRetry(url);
|
|
2399
|
-
}
|
|
2400
|
-
/**
|
|
2401
|
-
* Fetch specific nodes by ID
|
|
2402
|
-
*/
|
|
2403
|
-
async getNodes(fileKey, nodeIds, options) {
|
|
2404
|
-
const url = this.buildNodesUrl(fileKey, nodeIds, options);
|
|
2405
|
-
return this.fetchWithRetry(url);
|
|
2406
|
-
}
|
|
2407
|
-
/**
|
|
2408
|
-
* Get export URLs for node images
|
|
2409
|
-
*/
|
|
2410
|
-
async getImages(fileKey, nodeIds, options) {
|
|
2411
|
-
const url = this.buildImagesUrl(fileKey, nodeIds, options);
|
|
2412
|
-
return this.fetchWithRetry(url);
|
|
2413
|
-
}
|
|
2414
|
-
/**
|
|
2415
|
-
* Get download URLs for embedded image fills
|
|
2416
|
-
* Returns a map of imageRef hashes to temporary S3 download URLs
|
|
2417
|
-
*/
|
|
2418
|
-
async getImageFills(fileKey) {
|
|
2419
|
-
const url = `https://api.figma.com/v1/files/${fileKey}/images`;
|
|
2420
|
-
return this.fetchWithRetry(url);
|
|
2421
|
-
}
|
|
2422
|
-
/**
|
|
2423
|
-
* Core fetch method with retry logic
|
|
2424
|
-
*/
|
|
2425
|
-
async fetchWithRetry(url) {
|
|
2426
|
-
let lastError = null;
|
|
2427
|
-
for (let attempt = 0; attempt < this.retryConfig.maxRetries; attempt++) {
|
|
2428
|
-
try {
|
|
2429
|
-
const response = await fetch(url, {
|
|
2430
|
-
headers: {
|
|
2431
|
-
"X-Figma-Token": this.apiKey,
|
|
2432
|
-
"Content-Type": "application/json"
|
|
2433
|
-
}
|
|
2434
|
-
});
|
|
2435
|
-
if (response.status === 429) {
|
|
2436
|
-
const retryAfter = response.headers.get("Retry-After");
|
|
2437
|
-
const delayMs = retryAfter ? parseInt(retryAfter) * 1e3 : this.calculateBackoff(attempt);
|
|
2438
|
-
await this.sleep(delayMs);
|
|
2439
|
-
continue;
|
|
2440
|
-
}
|
|
2441
|
-
if (!response.ok) {
|
|
2442
|
-
const body = await response.text();
|
|
2443
|
-
throw new FigmaAPIError(response.status, body);
|
|
2444
|
-
}
|
|
2445
|
-
return await response.json();
|
|
2446
|
-
} catch (err) {
|
|
2447
|
-
lastError = err;
|
|
2448
|
-
if (err instanceof FigmaAPIError && err.status >= 400 && err.status < 500) {
|
|
2449
|
-
throw err;
|
|
2450
|
-
}
|
|
2451
|
-
if (attempt < this.retryConfig.maxRetries - 1) {
|
|
2452
|
-
await this.sleep(this.calculateBackoff(attempt));
|
|
2453
|
-
}
|
|
2454
|
-
}
|
|
2455
|
-
}
|
|
2456
|
-
throw lastError ?? new Error("Max retries exceeded");
|
|
2457
|
-
}
|
|
2458
|
-
/**
|
|
2459
|
-
* Calculate exponential backoff with jitter
|
|
2460
|
-
*/
|
|
2461
|
-
calculateBackoff(attempt) {
|
|
2462
|
-
const delay = this.retryConfig.baseDelayMs * Math.pow(2, attempt);
|
|
2463
|
-
const jitter = Math.random() * 0.3 * delay;
|
|
2464
|
-
return Math.min(delay + jitter, this.retryConfig.maxDelayMs);
|
|
2465
|
-
}
|
|
2466
|
-
sleep(ms) {
|
|
2467
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2468
|
-
}
|
|
2469
|
-
buildFileUrl(fileKey, options) {
|
|
2470
|
-
const base = `https://api.figma.com/v1/files/${fileKey}`;
|
|
2471
|
-
const params = new URLSearchParams();
|
|
2472
|
-
if (options?.depth) {
|
|
2473
|
-
params.set("depth", options.depth.toString());
|
|
2474
|
-
}
|
|
2475
|
-
return params.toString() ? `${base}?${params}` : base;
|
|
2476
|
-
}
|
|
2477
|
-
buildNodesUrl(fileKey, nodeIds, options) {
|
|
2478
|
-
const base = `https://api.figma.com/v1/files/${fileKey}/nodes`;
|
|
2479
|
-
const params = new URLSearchParams();
|
|
2480
|
-
params.set("ids", nodeIds.join(","));
|
|
2481
|
-
if (options?.depth) {
|
|
2482
|
-
params.set("depth", options.depth.toString());
|
|
2483
|
-
}
|
|
2484
|
-
return `${base}?${params}`;
|
|
2485
|
-
}
|
|
2486
|
-
buildImagesUrl(fileKey, nodeIds, options) {
|
|
2487
|
-
const base = `https://api.figma.com/v1/images/${fileKey}`;
|
|
2488
|
-
const params = new URLSearchParams();
|
|
2489
|
-
params.set("ids", nodeIds.join(","));
|
|
2490
|
-
if (options?.format) params.set("format", options.format);
|
|
2491
|
-
if (options?.scale) params.set("scale", options.scale.toString());
|
|
2492
|
-
return `${base}?${params}`;
|
|
2493
|
-
}
|
|
2494
|
-
/**
|
|
2495
|
-
* Recursively count nodes and components in the document tree
|
|
2496
|
-
*/
|
|
2497
|
-
countNodesAndComponents(node) {
|
|
2498
|
-
let nodes = 1;
|
|
2499
|
-
let components = node.type === "COMPONENT" || node.type === "COMPONENT_SET" ? 1 : 0;
|
|
2500
|
-
if (node.children) {
|
|
2501
|
-
for (const child of node.children) {
|
|
2502
|
-
const childCounts = this.countNodesAndComponents(child);
|
|
2503
|
-
nodes += childCounts.nodes;
|
|
2504
|
-
components += childCounts.components;
|
|
2505
|
-
}
|
|
2506
|
-
}
|
|
2507
|
-
return { nodes, components };
|
|
2508
|
-
}
|
|
2509
|
-
};
|
|
833
|
+
${h}`}]}}catch(b){throw R(b)}})}function xe(e,t){let{name:s,title:o,description:n,libKey:a,suiteName:r,components:i,componentAliases:d,getPostContent:p}=e;return new S(s,{title:o,description:n,requiredAccess:e.requiredAccess,inputSchema:{query:k.string().describe("The query to search for."),component:k.enum(i).describe("The component to search for. If not specified, use General.")}},async({query:b,component:h},{_meta:f})=>{g("Code Assistant called with:",{query:b,component:h});let u=h;if(d){let c=d[h];c&&(u=c)}try{let y=(await t.query({query:b,component:u?.toLowerCase()??"general",lib_name:a,text_matches_count:3,code_matches_count:0,allowed_types:["documentation"]},{_meta:f})).values.map(C=>C.replace(/\0/g,"")),A=p?.({component:h})??"";return{content:[{type:"text",text:`${y.join(`
|
|
2510
834
|
|
|
2511
|
-
|
|
2512
|
-
function parseFigmaUrl(url) {
|
|
2513
|
-
const invalidResult = {
|
|
2514
|
-
fileKey: "",
|
|
2515
|
-
type: "unknown",
|
|
2516
|
-
isDevMode: false,
|
|
2517
|
-
isValid: false
|
|
2518
|
-
};
|
|
2519
|
-
if (!url || typeof url !== "string") {
|
|
2520
|
-
return invalidResult;
|
|
2521
|
-
}
|
|
2522
|
-
let parsed;
|
|
2523
|
-
try {
|
|
2524
|
-
parsed = new URL(url.trim());
|
|
2525
|
-
} catch {
|
|
2526
|
-
return invalidResult;
|
|
2527
|
-
}
|
|
2528
|
-
const validDomains = ["figma.com", "www.figma.com"];
|
|
2529
|
-
if (!validDomains.includes(parsed.hostname)) {
|
|
2530
|
-
return invalidResult;
|
|
2531
|
-
}
|
|
2532
|
-
const pathParts = parsed.pathname.split("/").filter(Boolean);
|
|
2533
|
-
if (pathParts.length < 2) {
|
|
2534
|
-
return invalidResult;
|
|
2535
|
-
}
|
|
2536
|
-
const typeMap = {
|
|
2537
|
-
file: "file",
|
|
2538
|
-
design: "design",
|
|
2539
|
-
proto: "proto",
|
|
2540
|
-
board: "board"
|
|
2541
|
-
};
|
|
2542
|
-
const type = typeMap[pathParts[0]] || "unknown";
|
|
2543
|
-
const fileKey = pathParts[1];
|
|
2544
|
-
if (!/^[a-zA-Z0-9]+$/.test(fileKey)) {
|
|
2545
|
-
return invalidResult;
|
|
2546
|
-
}
|
|
2547
|
-
const fileName = pathParts[2] ? decodeURIComponent(pathParts[2]).replace(/-/g, " ") : void 0;
|
|
2548
|
-
const nodeIdParam = parsed.searchParams.get("node-id");
|
|
2549
|
-
let nodeId;
|
|
2550
|
-
let nodeIds;
|
|
2551
|
-
if (nodeIdParam) {
|
|
2552
|
-
const rawIds = nodeIdParam.split(",").map((id) => id.trim()).filter(Boolean);
|
|
2553
|
-
nodeIds = rawIds.map((id) => id.replace(/-/g, ":"));
|
|
2554
|
-
nodeId = nodeIds[0];
|
|
2555
|
-
}
|
|
2556
|
-
const branchKey = parsed.searchParams.get("t") ?? void 0;
|
|
2557
|
-
const isDevMode = parsed.searchParams.get("m") === "dev";
|
|
2558
|
-
return {
|
|
2559
|
-
fileKey,
|
|
2560
|
-
fileName,
|
|
2561
|
-
nodeId,
|
|
2562
|
-
nodeIds,
|
|
2563
|
-
type,
|
|
2564
|
-
branchKey,
|
|
2565
|
-
isDevMode,
|
|
2566
|
-
isValid: true
|
|
2567
|
-
};
|
|
2568
|
-
}
|
|
835
|
+
`)}
|
|
2569
836
|
|
|
2570
|
-
|
|
2571
|
-
var NodeFetcher = class {
|
|
2572
|
-
constructor(client) {
|
|
2573
|
-
this.client = client;
|
|
2574
|
-
}
|
|
2575
|
-
/**
|
|
2576
|
-
* Fetch a design starting from a file or specific node(s)
|
|
2577
|
-
*
|
|
2578
|
-
* @param fileKey - The Figma file key
|
|
2579
|
-
* @param nodeIds - Optional node ID(s) - can be string or string[]
|
|
2580
|
-
* @param options - Fetch options including depth
|
|
2581
|
-
* @returns Fetch result with root node and stats
|
|
2582
|
-
*/
|
|
2583
|
-
async fetch(fileKey, nodeIds, options = {}) {
|
|
2584
|
-
const initialDepth = options.initialDepth ?? 10;
|
|
2585
|
-
const fetchImages = options.fetchImages ?? true;
|
|
2586
|
-
const imageFormat = options.imageFormat ?? "png";
|
|
2587
|
-
const imageScale = options.imageScale ?? 2;
|
|
2588
|
-
const stats = {
|
|
2589
|
-
totalNodesFetched: 0,
|
|
2590
|
-
apiCallsMade: 0,
|
|
2591
|
-
imagesFetched: 0
|
|
2592
|
-
};
|
|
2593
|
-
let nodeIdArray;
|
|
2594
|
-
if (!nodeIds) {
|
|
2595
|
-
nodeIdArray = [];
|
|
2596
|
-
} else if (typeof nodeIds === "string") {
|
|
2597
|
-
nodeIdArray = [nodeIds];
|
|
2598
|
-
} else {
|
|
2599
|
-
nodeIdArray = nodeIds;
|
|
2600
|
-
}
|
|
2601
|
-
let rootNode;
|
|
2602
|
-
let fetchedNodes = [];
|
|
2603
|
-
if (nodeIdArray.length > 0) {
|
|
2604
|
-
const response = await this.client.getNodes(fileKey, nodeIdArray, { depth: initialDepth });
|
|
2605
|
-
stats.apiCallsMade++;
|
|
2606
|
-
for (const nodeId of nodeIdArray) {
|
|
2607
|
-
const nodeData = response.nodes[nodeId]?.document;
|
|
2608
|
-
if (!nodeData) {
|
|
2609
|
-
throw new Error(`Node ${nodeId} not found`);
|
|
2610
|
-
}
|
|
2611
|
-
fetchedNodes.push(nodeData);
|
|
2612
|
-
}
|
|
2613
|
-
if (fetchedNodes.length === 1) {
|
|
2614
|
-
rootNode = fetchedNodes[0];
|
|
2615
|
-
} else {
|
|
2616
|
-
rootNode = this.createContainerNode(fetchedNodes);
|
|
2617
|
-
}
|
|
2618
|
-
} else {
|
|
2619
|
-
const response = await this.client.getFile(fileKey, { depth: initialDepth });
|
|
2620
|
-
stats.apiCallsMade++;
|
|
2621
|
-
rootNode = response.document;
|
|
2622
|
-
fetchedNodes = [rootNode];
|
|
2623
|
-
}
|
|
2624
|
-
stats.totalNodesFetched += this.countNodes(rootNode);
|
|
2625
|
-
const images = [];
|
|
2626
|
-
if (fetchImages && nodeIdArray.length > 0) {
|
|
2627
|
-
try {
|
|
2628
|
-
const imageResult = await this.fetchNodeImages(
|
|
2629
|
-
fileKey,
|
|
2630
|
-
nodeIdArray,
|
|
2631
|
-
fetchedNodes,
|
|
2632
|
-
{ format: imageFormat, scale: imageScale }
|
|
2633
|
-
);
|
|
2634
|
-
images.push(...imageResult.images);
|
|
2635
|
-
stats.apiCallsMade += imageResult.apiCalls;
|
|
2636
|
-
stats.imagesFetched = images.length;
|
|
2637
|
-
} catch (error) {
|
|
2638
|
-
console.warn("Failed to fetch images:", error);
|
|
2639
|
-
}
|
|
2640
|
-
}
|
|
2641
|
-
return {
|
|
2642
|
-
rootNode,
|
|
2643
|
-
fetchedNodes,
|
|
2644
|
-
images,
|
|
2645
|
-
stats
|
|
2646
|
-
};
|
|
2647
|
-
}
|
|
2648
|
-
/**
|
|
2649
|
-
* Fetch and download images for specified nodes
|
|
2650
|
-
*/
|
|
2651
|
-
async fetchNodeImages(fileKey, nodeIds, nodes, options) {
|
|
2652
|
-
const imageResponse = await this.client.getImages(fileKey, nodeIds, options);
|
|
2653
|
-
let apiCalls = 1;
|
|
2654
|
-
const images = [];
|
|
2655
|
-
for (let i = 0; i < nodeIds.length; i++) {
|
|
2656
|
-
const nodeId = nodeIds[i];
|
|
2657
|
-
const imageUrl = imageResponse.images[nodeId];
|
|
2658
|
-
if (imageUrl) {
|
|
2659
|
-
try {
|
|
2660
|
-
const imageData = await this.downloadImage(imageUrl, options.format);
|
|
2661
|
-
const node = nodes[i];
|
|
2662
|
-
images.push({
|
|
2663
|
-
nodeId,
|
|
2664
|
-
nodeName: node?.name || "Unknown",
|
|
2665
|
-
data: imageData,
|
|
2666
|
-
mimeType: this.getMimeType(options.format),
|
|
2667
|
-
url: imageUrl
|
|
2668
|
-
});
|
|
2669
|
-
} catch (error) {
|
|
2670
|
-
console.warn(`Failed to download image for node ${nodeId}:`, error);
|
|
2671
|
-
}
|
|
2672
|
-
}
|
|
2673
|
-
}
|
|
2674
|
-
return { images, apiCalls };
|
|
2675
|
-
}
|
|
2676
|
-
/**
|
|
2677
|
-
* Download an image from a URL and convert to base64
|
|
2678
|
-
*/
|
|
2679
|
-
async downloadImage(url, format) {
|
|
2680
|
-
const response = await fetch(url);
|
|
2681
|
-
if (!response.ok) {
|
|
2682
|
-
throw new Error(`Failed to download image: ${response.statusText}`);
|
|
2683
|
-
}
|
|
2684
|
-
if (format === "svg") {
|
|
2685
|
-
const svgText = await response.text();
|
|
2686
|
-
return Buffer.from(svgText, "utf-8").toString("base64");
|
|
2687
|
-
} else {
|
|
2688
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
2689
|
-
return Buffer.from(arrayBuffer).toString("base64");
|
|
2690
|
-
}
|
|
2691
|
-
}
|
|
2692
|
-
/**
|
|
2693
|
-
* Get MIME type for image format
|
|
2694
|
-
*/
|
|
2695
|
-
getMimeType(format) {
|
|
2696
|
-
switch (format) {
|
|
2697
|
-
case "png":
|
|
2698
|
-
return "image/png";
|
|
2699
|
-
case "jpg":
|
|
2700
|
-
return "image/jpeg";
|
|
2701
|
-
case "svg":
|
|
2702
|
-
return "image/svg+xml";
|
|
2703
|
-
default:
|
|
2704
|
-
return "image/png";
|
|
2705
|
-
}
|
|
2706
|
-
}
|
|
2707
|
-
/**
|
|
2708
|
-
* Create a synthetic container node that wraps multiple nodes
|
|
2709
|
-
*/
|
|
2710
|
-
createContainerNode(nodes) {
|
|
2711
|
-
return {
|
|
2712
|
-
id: "container-" + Date.now(),
|
|
2713
|
-
name: "Multi-Node Container",
|
|
2714
|
-
type: "GROUP",
|
|
2715
|
-
visible: true,
|
|
2716
|
-
children: nodes
|
|
2717
|
-
};
|
|
2718
|
-
}
|
|
2719
|
-
/**
|
|
2720
|
-
* Count total nodes in a tree
|
|
2721
|
-
*/
|
|
2722
|
-
countNodes(node) {
|
|
2723
|
-
let count = 1;
|
|
2724
|
-
if (node.children) {
|
|
2725
|
-
for (const child of node.children) {
|
|
2726
|
-
count += this.countNodes(child);
|
|
2727
|
-
}
|
|
2728
|
-
}
|
|
2729
|
-
return count;
|
|
2730
|
-
}
|
|
2731
|
-
};
|
|
837
|
+
${A}`}]}}catch(c){throw R(c)}})}function Ie(e,t){let{name:s,title:o,description:n,libKey:a,suiteName:r,components:i,componentAliases:d}=e;return new S(s,{title:o,description:n,requiredAccess:e.requiredAccess,inputSchema:{query:k.string().describe("The query to search for."),component:k.enum(i).describe("The component to search for. If not specified, use General."),includeGeneralGuidelines:k.boolean().default(!1).describe("Set to true only on the first call to include comprehensive WCAG 2.2 Level AA general guidelines. After the first call, set to false to get only component-specific accessibility information. Default is false.")}},async({query:p,component:b,includeGeneralGuidelines:h},{_meta:f})=>{g("Accessibility Assistant called with:",{query:p,component:b,includeGeneralGuidelines:h});let u=b;if(d){let c=d[b];c&&(u=c)}try{let c="";if(h){let x=ge();c+=`# WCAG 2.2 Level AA General Accessibility Guidelines
|
|
2732
838
|
|
|
2733
|
-
|
|
2734
|
-
|
|
2735
|
-
|
|
2736
|
-
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
return new UIAgentTool(
|
|
2741
|
-
name,
|
|
2742
|
-
{
|
|
2743
|
-
title: "Figma Design to Code",
|
|
2744
|
-
description: "Converts Figma designs to code by analyzing the design structure and matching Kendo UI components. Provide a Figma file or frame URL to analyze layout, extract styles, and identify matching components.",
|
|
2745
|
-
inputSchema: {
|
|
2746
|
-
url: z5.string().describe(
|
|
2747
|
-
"Figma file or node URL (e.g., https://www.figma.com/file/...)"
|
|
2748
|
-
).optional(),
|
|
2749
|
-
fileKey: z5.string().describe("Figma file key (alternative to URL)").optional(),
|
|
2750
|
-
nodeIds: z5.array(z5.string()).describe("Array of specific node IDs to fetch (alternative to URL)").optional(),
|
|
2751
|
-
depth: z5.number().min(1).max(20).default(10).describe("Initial fetch depth (1-20, default: 10)")
|
|
2752
|
-
},
|
|
2753
|
-
requiredAccess
|
|
2754
|
-
},
|
|
2755
|
-
async ({ url, fileKey, nodeIds, depth }) => {
|
|
2756
|
-
const client = new FigmaClient(figmaApiKey);
|
|
2757
|
-
const fetcher = new NodeFetcher(client);
|
|
2758
|
-
let fileKeyToUse = fileKey;
|
|
2759
|
-
let nodeIdsToUse;
|
|
2760
|
-
if (fileKeyToUse) {
|
|
2761
|
-
if (nodeIds && nodeIds.length > 0) {
|
|
2762
|
-
nodeIdsToUse = nodeIds.length === 1 ? nodeIds[0] : nodeIds;
|
|
2763
|
-
}
|
|
2764
|
-
} else if (url) {
|
|
2765
|
-
const parsed = parseFigmaUrl(url);
|
|
2766
|
-
if (!parsed.isValid || !parsed.fileKey) {
|
|
2767
|
-
throw new Error(
|
|
2768
|
-
"Invalid Figma URL. Please provide a valid Figma file or frame URL."
|
|
2769
|
-
);
|
|
2770
|
-
}
|
|
2771
|
-
fileKeyToUse = parsed.fileKey;
|
|
2772
|
-
if (parsed.nodeId) {
|
|
2773
|
-
nodeIdsToUse = parsed.nodeId;
|
|
2774
|
-
}
|
|
2775
|
-
} else {
|
|
2776
|
-
throw new Error("Please provide either a Figma URL, fileKey, or both.");
|
|
2777
|
-
}
|
|
2778
|
-
const fetchResult = await fetcher.fetch(fileKeyToUse, nodeIdsToUse, {
|
|
2779
|
-
initialDepth: depth,
|
|
2780
|
-
fetchImages: true,
|
|
2781
|
-
imageFormat: "png",
|
|
2782
|
-
imageScale: 2
|
|
2783
|
-
});
|
|
2784
|
-
const resultJson = {
|
|
2785
|
-
name: fetchResult.rootNode.name,
|
|
2786
|
-
type: fetchResult.rootNode.type,
|
|
2787
|
-
rootNode: fetchResult.rootNode,
|
|
2788
|
-
fetchedNodes: fetchResult.fetchedNodes,
|
|
2789
|
-
meta: {
|
|
2790
|
-
fileKey,
|
|
2791
|
-
nodeIds
|
|
2792
|
-
}
|
|
2793
|
-
};
|
|
2794
|
-
let backendResponse;
|
|
2795
|
-
try {
|
|
2796
|
-
const nodeJsons = fetchResult.fetchedNodes.map(
|
|
2797
|
-
(node) => JSON.stringify(node)
|
|
2798
|
-
);
|
|
2799
|
-
backendResponse = await contextApi2.processFigmaDesign({
|
|
2800
|
-
node_jsons: nodeJsons
|
|
2801
|
-
});
|
|
2802
|
-
} catch (error) {
|
|
2803
|
-
console.error("Backend processing failed:", error);
|
|
2804
|
-
return {
|
|
2805
|
-
content: [
|
|
2806
|
-
{
|
|
2807
|
-
type: "text",
|
|
2808
|
-
text: JSON.stringify(
|
|
2809
|
-
{
|
|
2810
|
-
error: {
|
|
2811
|
-
message: `Backend processing failed: ${error.message}`,
|
|
2812
|
-
code: error.code || "UNKNOWN"
|
|
2813
|
-
},
|
|
2814
|
-
figma_data: resultJson
|
|
2815
|
-
},
|
|
2816
|
-
null,
|
|
2817
|
-
2
|
|
2818
|
-
)
|
|
2819
|
-
}
|
|
2820
|
-
]
|
|
2821
|
-
};
|
|
2822
|
-
}
|
|
2823
|
-
const content = [];
|
|
2824
|
-
content.push({
|
|
2825
|
-
type: "text",
|
|
2826
|
-
text: `# Figma Design Extraction Results
|
|
2827
|
-
Successfully fetched design data for file key ${fileKeyToUse} with for nodes [${nodeIds?.join(", ")}].
|
|
2828
|
-
The following is the processed design data including layout pseudo-code and design tokens extracted from the Figma design, plus images for visual references of the desired nodes:`
|
|
2829
|
-
});
|
|
2830
|
-
backendResponse.layout_pseudo_codes.forEach((layoutCode, index) => {
|
|
2831
|
-
const [nodeName, nodeId] = ((index2) => {
|
|
2832
|
-
const node = fetchResult.fetchedNodes[index2];
|
|
2833
|
-
return node ? [node.name, node.id] : ["Unknown Node", "unknown_id"];
|
|
2834
|
-
})(index);
|
|
2835
|
-
content.push({
|
|
2836
|
-
type: "text",
|
|
2837
|
-
text: `## Psuedo-code Layout - Node: ${nodeName} (${nodeId})
|
|
2838
|
-
|
|
2839
|
-
` + layoutCode,
|
|
2840
|
-
_meta: {
|
|
2841
|
-
description: `Psuedo-code Layout - Node: ${nodeName} (${nodeId})`
|
|
2842
|
-
},
|
|
2843
|
-
annotations: {
|
|
2844
|
-
audience: ["assistant"]
|
|
2845
|
-
}
|
|
2846
|
-
});
|
|
2847
|
-
});
|
|
2848
|
-
content.push({
|
|
2849
|
-
type: "text",
|
|
2850
|
-
text: `## Design Tokens - File: ${fileKey} for Nodes: [${nodeIds?.join(", ")}]
|
|
2851
|
-
|
|
2852
|
-
` + backendResponse.design_tokens,
|
|
2853
|
-
_meta: {
|
|
2854
|
-
description: `Design Tokens - File: ${fileKey} for Nodes: [${nodeIds?.join(", ")}]`
|
|
2855
|
-
},
|
|
2856
|
-
annotations: {
|
|
2857
|
-
audience: ["assistant"]
|
|
2858
|
-
}
|
|
2859
|
-
});
|
|
2860
|
-
if (fetchResult.images && fetchResult.images.length > 0) {
|
|
2861
|
-
for (const image of fetchResult.images) {
|
|
2862
|
-
content.push({
|
|
2863
|
-
type: "image",
|
|
2864
|
-
data: image.data,
|
|
2865
|
-
mimeType: image.mimeType,
|
|
2866
|
-
_meta: {
|
|
2867
|
-
description: `Design snapshot of ${image.nodeName} (${image.nodeId})`
|
|
2868
|
-
},
|
|
2869
|
-
annotations: {
|
|
2870
|
-
audience: ["assistant"]
|
|
2871
|
-
}
|
|
2872
|
-
});
|
|
2873
|
-
}
|
|
2874
|
-
}
|
|
2875
|
-
content.push({
|
|
2876
|
-
type: "text",
|
|
2877
|
-
text: `# Analysis Instructions and Next Steps
|
|
2878
|
-
|
|
2879
|
-
Use the above design data, layout pseudo-code, and design tokens to analyze the Figma design and identify components. Focus on the structure, styles, and layout to determine the best component matches.
|
|
2880
|
-
If more design details are needed, consider asking for additional nodes or deeper fetches to gather more information about specific areas of the design.`
|
|
2881
|
-
});
|
|
2882
|
-
return {
|
|
2883
|
-
content
|
|
2884
|
-
};
|
|
2885
|
-
}
|
|
2886
|
-
);
|
|
2887
|
-
}
|
|
839
|
+
`,c+=x,c+=`
|
|
840
|
+
|
|
841
|
+
---
|
|
842
|
+
|
|
843
|
+
`}let C=(await t.getApiRefMatches({query:p,component:u?.toLowerCase()??"general",lib_name:a,filters_json:'{"type":{"$in":["accessibility"]}}'},{_meta:f})).values.map(x=>x.replace(/\0/g,"")).map(x=>Pt(x,u?.toLowerCase()??"general")).join(`
|
|
844
|
+
|
|
845
|
+
`);return C?(h&&(c+=`# Component-Specific Accessibility Information
|
|
2888
846
|
|
|
2889
|
-
|
|
2890
|
-
var orchestratorToolName = (prefix) => `${prefix}_ui_generator`;
|
|
2891
|
-
var assistantOrchestratorToolName = (prefix) => `${prefix}_assistant`;
|
|
2892
|
-
var layoutAssistantName = (prefix) => `${prefix}_layout_assistant`;
|
|
2893
|
-
var codeAssistantName = (prefix) => `${prefix}_component_assistant`;
|
|
2894
|
-
var styleAssistantName = (prefix) => `${prefix}_style_assistant`;
|
|
2895
|
-
var iconAssistantName = (prefix) => `${prefix}_icon_assistant`;
|
|
2896
|
-
var accessibilityAssistantName = (prefix) => `${prefix}_accessibility_assistant`;
|
|
2897
|
-
var gettingStartedAssistantName = (prefix) => `${prefix}_getting_started_assistant`;
|
|
2898
|
-
var figmaD2CToolName = (prefix) => `${prefix}_figma_d2c`;
|
|
847
|
+
`),c+=C):h||(c="No component-specific accessibility guidelines found."),{content:[{type:"text",text:c}]}}catch(c){throw R(c)}})}function R(e){let t=e;return t.code===16?new Error("Error: You are not authenticated. Please verify the Telerik License Key provided is valid."):t.code===8?new Error(`Error: You have exceeded the extension quota. Upgrade to subscription licensing to unlock full access. Message: ${t.message}.`):t.code===7?new Error("Error: You do not have permission to access this resource. Please verify that you have a valid license."):new Error(`Error: An error occurred while calling the service. Please try again later.
|
|
2899
848
|
|
|
2900
|
-
|
|
2901
|
-
var orchestratorToolDescription = (suiteName) => `This is the single entry point for all UI-related tasks. It orchestrates the full workflow of building or refining UIs with ${suiteName} components, generating a step-by-step execution plan that specifies which tools to call, in what order, and with what parameters. It includes validation steps to ensure the best possible, standards-compliant code every time.
|
|
849
|
+
Error Code: ${t.code} Error Message: ${t.message}`)}var Ne=e=>`${e}_ui_generator`,Ee=e=>`${e}_assistant`,Re=e=>`${e}_layout_assistant`,De=e=>`${e}_component_assistant`,Pe=e=>`${e}_style_assistant`,Oe=e=>`${e}_icon_assistant`,Le=e=>`${e}_accessibility_assistant`,Ue=e=>`${e}_getting_started_assistant`;var Ge=e=>`This is the single entry point for all UI-related tasks. It orchestrates the full workflow of building or refining UIs with ${e} components, generating a step-by-step execution plan that specifies which tools to call, in what order, and with what parameters. It includes validation steps to ensure the best possible, standards-compliant code every time.
|
|
2902
850
|
|
|
2903
851
|
Use the tool when:
|
|
2904
852
|
- Want to build or modify a complete page or section layout
|
|
2905
853
|
- You are creating and applying custom themes via the Kendo Design System
|
|
2906
|
-
- You need guidance on correct ${
|
|
854
|
+
- You need guidance on correct ${e} component selection and configuration
|
|
2907
855
|
- You want to enforce best practices in styling, performance, and accessibility
|
|
2908
856
|
|
|
2909
857
|
Returns:
|
|
2910
|
-
A detailed execution plan with validated tool calls, parameters, and reasoning \u2014 ensuring consistent, high-quality UI generation
|
|
2911
|
-
var assistantOrchestratorToolDescription = (suiteName) => `Provides guidance for discovering and using ${suiteName} components and icons. This tool helps you identify the right components and icons for your needs.
|
|
858
|
+
A detailed execution plan with validated tool calls, parameters, and reasoning \u2014 ensuring consistent, high-quality UI generation.`,_e=e=>`Provides guidance for discovering and using ${e} components and icons. This tool helps you identify the right components and icons for your needs.
|
|
2912
859
|
|
|
2913
860
|
Use this tool when:
|
|
2914
|
-
- You need to discover which ${
|
|
861
|
+
- You need to discover which ${e} components are suitable for a specific use case
|
|
2915
862
|
- You want to understand component features and capabilities
|
|
2916
863
|
- You need to find appropriate icons for your UI
|
|
2917
864
|
- You want to gather component documentation and examples
|
|
2918
865
|
|
|
2919
866
|
Returns:
|
|
2920
|
-
A focused plan for gathering component documentation and icon suggestions using the Component Assistant and Icon Assistant tools
|
|
2921
|
-
var layoutToolDescription = `Retrieves Progress/Kendo Design System CSS utility classes and styling recommendations based on layout and design requirements.
|
|
867
|
+
A focused plan for gathering component documentation and icon suggestions using the Component Assistant and Icon Assistant tools.`,$e=`Retrieves Progress/Kendo Design System CSS utility classes and styling recommendations based on layout and design requirements.
|
|
2922
868
|
Use this tool to find the right CSS utilities for styling Kendo UI components or general web elements.
|
|
2923
869
|
It analyzes the provided design context and returns relevant utility classes with explanations and examples.
|
|
2924
|
-
Best suited for styling questions related to typography, spacing, colors, layout, transforms, and other utilities in the Progress/Kendo Design System
|
|
2925
|
-
var styleToolDescription = `Generates CSS variables using an external style agent based on the user's styling prompt.
|
|
870
|
+
Best suited for styling questions related to typography, spacing, colors, layout, transforms, and other utilities in the Progress/Kendo Design System.`,Me=`Generates CSS variables using an external style agent based on the user's styling prompt.
|
|
2926
871
|
|
|
2927
872
|
Use this tool when the user wants to:
|
|
2928
873
|
- Update the visual theme of an application
|
|
2929
874
|
- Modify color schemes
|
|
2930
875
|
- Restyle the UI with CSS variables
|
|
2931
876
|
|
|
2932
|
-
The tool outputs a set of CSS variable definitions ready to be applied to style files
|
|
2933
|
-
var iconToolDescription = `Searches for icons in the Telerik Icons library.
|
|
877
|
+
The tool outputs a set of CSS variable definitions ready to be applied to style files.`,Be=`Searches for icons in the Telerik Icons library.
|
|
2934
878
|
Use this tool when the user needs to find specific icons for UI components or design elements.
|
|
2935
879
|
It supports searching by icon name, category, or keyword and returns matching icons from the Telerik Icons library.
|
|
2936
|
-
|
|
2937
|
-
var codeAssistantToolDescription = (suiteName) => `Provides answers and retrieves official documentation for ${suiteName}.
|
|
880
|
+
`,Fe=e=>`Provides answers and retrieves official documentation for ${e}.
|
|
2938
881
|
|
|
2939
882
|
Use this tool when the user asks about:
|
|
2940
|
-
- ${
|
|
883
|
+
- ${e} features or capabilities
|
|
2941
884
|
- Specific components (e.g., Grid, Chart, Editor)
|
|
2942
885
|
- Implementation details, configuration, or best practices
|
|
2943
|
-
- How to use or customize components in ${
|
|
886
|
+
- How to use or customize components in ${e}
|
|
2944
887
|
|
|
2945
888
|
Set the user's full question as the 'query' parameter.
|
|
2946
|
-
If the question refers to a specific ${
|
|
2947
|
-
|
|
2948
|
-
var accessibilityToolDescription = (suiteName) => `Retrieves accessibility guidance for ${suiteName} components with optional general WCAG 2.2 Level AA guidelines.
|
|
889
|
+
If the question refers to a specific ${e} component, include its name in the 'component' parameter.
|
|
890
|
+
`,qe=e=>`Retrieves accessibility guidance for ${e} components with optional general WCAG 2.2 Level AA guidelines.
|
|
2949
891
|
|
|
2950
892
|
Use this tool when:
|
|
2951
893
|
- You need component-specific accessibility information and API references
|
|
@@ -2963,11 +905,7 @@ Set 'includeGeneralGuidelines=true' ONLY on the first call to include general WC
|
|
|
2963
905
|
Returns:
|
|
2964
906
|
- When includeGeneralGuidelines=true: General WCAG 2.2 Level AA guidelines + component-specific recommendations
|
|
2965
907
|
- When includeGeneralGuidelines=false: Only component-specific accessibility recommendations
|
|
2966
|
-
`;
|
|
2967
|
-
|
|
2968
|
-
// packages/kendo-ui-agent/src/lib/validation/angular-validation-steps.ts
|
|
2969
|
-
var sharedSteps = getSharedValidationSteps("Kendo UI", "Kendo");
|
|
2970
|
-
var ANGULAR_VALIDATION_STEPS = `
|
|
908
|
+
`;var H=E("Kendo UI","Kendo"),Q=`
|
|
2971
909
|
### Angular Component Validation
|
|
2972
910
|
Component Structure:
|
|
2973
911
|
- Use proper @Component decorator configuration
|
|
@@ -2975,25 +913,22 @@ Component Structure:
|
|
|
2975
913
|
- Correct selector naming convention (kebab-case)
|
|
2976
914
|
- Appropriate template and style file organization
|
|
2977
915
|
|
|
2978
|
-
${
|
|
916
|
+
${H.SETUP_VALIDATION}
|
|
2979
917
|
- Kendo animations module configured (if animations are used)
|
|
2980
918
|
- Internationalization properly configured for Kendo components
|
|
2981
919
|
|
|
2982
|
-
${
|
|
920
|
+
${H.PERFORMANCE_OPTIMIZATION}
|
|
2983
921
|
- OnPush change detection strategy where appropriate
|
|
2984
922
|
- Efficient trackBy functions for *ngFor with Kendo components
|
|
2985
923
|
- Minimal unnecessary change detection cycles
|
|
2986
924
|
|
|
2987
|
-
${
|
|
925
|
+
${H.THEME_AND_STYLING}
|
|
2988
926
|
- Proper theme switching functionality (if implemented)
|
|
2989
927
|
- Only ONE theme reference exists across angular.json and styles files
|
|
2990
928
|
- Make sure theme import mechanism is consistent with existing project setup
|
|
2991
929
|
|
|
2992
930
|
Accessibility
|
|
2993
|
-
- Accessibility guidelines retrieved and applied to all components`;
|
|
2994
|
-
|
|
2995
|
-
// packages/kendo-ui-agent/src/lib/validation/angular-additional-plan.ts
|
|
2996
|
-
var ANGULAR_ADDITIONAL_PLAN = `**Angular Specific Requirements:**
|
|
931
|
+
- Accessibility guidelines retrieved and applied to all components`;var J=`**Angular Specific Requirements:**
|
|
2997
932
|
|
|
2998
933
|
**NgModule vs Standalone setup**: Search and detect the current project setup to determine whether to use NgModule or Standalone components based on the following rules:
|
|
2999
934
|
1. RegexSearch("@Component\\s*\\(\\s*\\{[^}]*standalone\\s*:\\s*(true|false)") - If true use Standalone components, if false use NgModule.
|
|
@@ -3024,11 +959,7 @@ var ANGULAR_ADDITIONAL_PLAN = `**Angular Specific Requirements:**
|
|
|
3024
959
|
2. Match the discovered patterns in all generated code
|
|
3025
960
|
3. Maintain consistent formatting, indentation, and code organization with existing files
|
|
3026
961
|
4. Always use the same theme import mechanism (unless user specifies otherwise)
|
|
3027
|
-
`;
|
|
3028
|
-
|
|
3029
|
-
// packages/kendo-ui-agent/src/lib/validation/react-validation-steps.ts
|
|
3030
|
-
var sharedSteps2 = getSharedValidationSteps("Kendo UI", "KendoReact");
|
|
3031
|
-
var REACT_VALIDATION_STEPS = `
|
|
962
|
+
`;var X=E("Kendo UI","KendoReact"),Z=`
|
|
3032
963
|
### React Component Validation
|
|
3033
964
|
Component Structure:
|
|
3034
965
|
- Use proper function component patterns with Hooks
|
|
@@ -3036,85 +967,22 @@ Component Structure:
|
|
|
3036
967
|
- Appropriate file organization (components, hooks, utils)
|
|
3037
968
|
- Props interface/type definitions where needed
|
|
3038
969
|
|
|
3039
|
-
${
|
|
970
|
+
${X.SETUP_VALIDATION}
|
|
3040
971
|
- KendoReact license validation (if required)
|
|
3041
972
|
- Appropriate bundler configuration for KendoReact packages
|
|
3042
973
|
|
|
3043
|
-
${
|
|
974
|
+
${X.PERFORMANCE_OPTIMIZATION}
|
|
3044
975
|
- React.memo for components that receive stable props
|
|
3045
976
|
- useMemo/useCallback for expensive computations and callbacks
|
|
3046
977
|
- Proper key props for list rendering with KendoReact components
|
|
3047
978
|
|
|
3048
|
-
${
|
|
979
|
+
${X.THEME_AND_STYLING}
|
|
3049
980
|
- Proper theme switching functionality (if implemented)
|
|
3050
981
|
- Only ONE theme import exists across the application
|
|
3051
982
|
- Make sure theme import mechanism is consistent with existing project setup
|
|
3052
983
|
|
|
3053
984
|
Accessibility
|
|
3054
|
-
- Accessibility guidelines retrieved and applied to all components`;
|
|
3055
|
-
|
|
3056
|
-
// packages/kendo-ui-agent/src/index.ts
|
|
3057
|
-
var Tools = {
|
|
3058
|
-
createOrchestrator: createOrchestratorTool,
|
|
3059
|
-
createAssistantOrchestrator: createAssistantOrchestratorTool,
|
|
3060
|
-
createLayoutAssistant: createLayoutAssistantTool,
|
|
3061
|
-
createStyleAssistant: createStyleAssistantTool,
|
|
3062
|
-
createIconSearch: createIconSearchTool,
|
|
3063
|
-
createCodeAssistant: createCodeAssistantTool,
|
|
3064
|
-
createAccessibilityAssistant: createAccessibilityAssistantTool,
|
|
3065
|
-
createFigmaD2C: createFigmaD2CTool
|
|
3066
|
-
};
|
|
3067
|
-
var ToolNames = {
|
|
3068
|
-
orchestrator: orchestratorToolName,
|
|
3069
|
-
assistantOrchestrator: assistantOrchestratorToolName,
|
|
3070
|
-
layoutAssistant: layoutAssistantName,
|
|
3071
|
-
codeAssistant: codeAssistantName,
|
|
3072
|
-
styleAssistant: styleAssistantName,
|
|
3073
|
-
iconAssistant: iconAssistantName,
|
|
3074
|
-
accessibilityAssistant: accessibilityAssistantName,
|
|
3075
|
-
gettingStartedAssistant: gettingStartedAssistantName,
|
|
3076
|
-
figmaD2C: figmaD2CToolName
|
|
3077
|
-
};
|
|
3078
|
-
var ToolDescriptions = {
|
|
3079
|
-
orchestrator: orchestratorToolDescription,
|
|
3080
|
-
assistantOrchestrator: assistantOrchestratorToolDescription,
|
|
3081
|
-
layoutAssistant: layoutToolDescription,
|
|
3082
|
-
styleAssistant: styleToolDescription,
|
|
3083
|
-
iconAssistant: iconToolDescription,
|
|
3084
|
-
codeAssistant: codeAssistantToolDescription,
|
|
3085
|
-
accessibilityAssistant: accessibilityToolDescription
|
|
3086
|
-
};
|
|
3087
|
-
var Templates = {
|
|
3088
|
-
Orchestrator: {
|
|
3089
|
-
render: renderOrchestratorResponse
|
|
3090
|
-
},
|
|
3091
|
-
Validator: {
|
|
3092
|
-
render: renderValidatorResponse
|
|
3093
|
-
},
|
|
3094
|
-
SharedValidation: {
|
|
3095
|
-
getSteps: getSharedValidationSteps
|
|
3096
|
-
}
|
|
3097
|
-
};
|
|
3098
|
-
var Validation = {
|
|
3099
|
-
Angular: {
|
|
3100
|
-
steps: ANGULAR_VALIDATION_STEPS,
|
|
3101
|
-
additionalPlan: ANGULAR_ADDITIONAL_PLAN
|
|
3102
|
-
},
|
|
3103
|
-
React: {
|
|
3104
|
-
steps: REACT_VALIDATION_STEPS
|
|
3105
|
-
}
|
|
3106
|
-
};
|
|
3107
|
-
var UIAgent = {
|
|
3108
|
-
Tools,
|
|
3109
|
-
ToolNames,
|
|
3110
|
-
ToolDescriptions,
|
|
3111
|
-
Templates,
|
|
3112
|
-
Validation
|
|
3113
|
-
};
|
|
3114
|
-
|
|
3115
|
-
// packages/angular/src/lib/instructions/layout.ts
|
|
3116
|
-
var CODE_ASSISTANT_NAME = UIAgent.ToolNames.codeAssistant("kendo");
|
|
3117
|
-
var getLayoutInstructions = () => `# Kendo Design System Guidelines for ${ANGULAR_SUITE_NAME}
|
|
985
|
+
- Accessibility guidelines retrieved and applied to all components`;var Ot={createOrchestrator:Ae,createAssistantOrchestrator:we,createLayoutAssistant:Se,createStyleAssistant:Ce,createIconSearch:Te,createCodeAssistant:xe,createAccessibilityAssistant:Ie},Lt={orchestrator:Ne,assistantOrchestrator:Ee,layoutAssistant:Re,codeAssistant:De,styleAssistant:Pe,iconAssistant:Oe,accessibilityAssistant:Le,gettingStartedAssistant:Ue},Ut={orchestrator:Ge,assistantOrchestrator:_e,layoutAssistant:$e,styleAssistant:Me,iconAssistant:Be,codeAssistant:Fe,accessibilityAssistant:qe},Gt={Orchestrator:{render:G},Validator:{render:U},SharedValidation:{getSteps:E}},_t={Angular:{steps:Q,additionalPlan:J},React:{steps:Z}},m={Tools:Ot,ToolNames:Lt,ToolDescriptions:Ut,Templates:Gt,Validation:_t};var $t=m.ToolNames.codeAssistant("kendo"),Ke=()=>`# Kendo Design System Guidelines for ${l}
|
|
3118
986
|
|
|
3119
987
|
## Setting up Styles/CSS
|
|
3120
988
|
|
|
@@ -3141,17 +1009,155 @@ Alternatively, you can also consume them directly from the Unpkg CDN.
|
|
|
3141
1009
|
|
|
3142
1010
|
## Ready-to-use Layout Components
|
|
3143
1011
|
|
|
3144
|
-
In the ${
|
|
1012
|
+
In the ${l} there are available components to create layout. Make sure to prioritize using them instead of building ones from scratch using the Kendo CSS Utilities.
|
|
3145
1013
|
|
|
3146
|
-
For any Layout component you can also call the ${
|
|
1014
|
+
For any Layout component you can also call the ${$t} tool in order to get specific API reference and docs.
|
|
3147
1015
|
|
|
3148
|
-
- ${
|
|
1016
|
+
- ${l} Card component.
|
|
3149
1017
|
- Generally, it is recommended to use 100% width (e.g., \`<kendo-card width="100%">\`)
|
|
3150
1018
|
- If needed, use specific width based on the layout requirements (e.g., \`<kendo-card width="150px">\`)
|
|
3151
|
-
|
|
1019
|
+
- Avoid applying additional styling properties such as \`display\`, \`flex\`, \`grid\`, or other layout-specific CSS to layout components such as GridLayout, Splitter, StackLayout and TileLayout. Use the component's built-in parameters and the Kendo CSS utility classes instead.
|
|
1020
|
+
|
|
1021
|
+
## Page Shell Patterns
|
|
1022
|
+
|
|
1023
|
+
Choose the pattern that matches the page structure:
|
|
1024
|
+
|
|
1025
|
+
**Pattern A \u2014 Sidebar + Main Content**
|
|
1026
|
+
\`\`\`css
|
|
1027
|
+
.app-shell {
|
|
1028
|
+
display: flex;
|
|
1029
|
+
height: 100vh;
|
|
1030
|
+
}
|
|
1031
|
+
.sidebar {
|
|
1032
|
+
width: 240px;
|
|
1033
|
+
flex-shrink: 0;
|
|
1034
|
+
}
|
|
1035
|
+
.main-content {
|
|
1036
|
+
flex: 1;
|
|
1037
|
+
min-width: 0; /* Critical: prevents flex children from overflowing */
|
|
1038
|
+
overflow: auto;
|
|
1039
|
+
}
|
|
1040
|
+
\`\`\`
|
|
1041
|
+
|
|
1042
|
+
**Pattern B \u2014 Centered Single-Column (forms, detail pages)**
|
|
1043
|
+
\`\`\`css
|
|
1044
|
+
.page-container {
|
|
1045
|
+
max-width: 960px;
|
|
1046
|
+
margin: 0 auto;
|
|
1047
|
+
padding: 0 1rem;
|
|
1048
|
+
}
|
|
1049
|
+
\`\`\`
|
|
1050
|
+
|
|
1051
|
+
**Pattern C \u2014 Master-Detail Split**
|
|
1052
|
+
\`\`\`css
|
|
1053
|
+
.split-container {
|
|
1054
|
+
display: grid;
|
|
1055
|
+
grid-template-columns: 420px 1fr;
|
|
1056
|
+
height: 100%;
|
|
1057
|
+
}
|
|
1058
|
+
\`\`\`
|
|
1059
|
+
|
|
1060
|
+
## Dashboard Layout
|
|
1061
|
+
|
|
1062
|
+
**KPI metric row** (auto-responsive, min 180px per card):
|
|
1063
|
+
\`\`\`css
|
|
1064
|
+
.kpi-row {
|
|
1065
|
+
display: grid;
|
|
1066
|
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
1067
|
+
gap: 1rem;
|
|
1068
|
+
}
|
|
1069
|
+
\`\`\`
|
|
1070
|
+
|
|
1071
|
+
**Side-by-side charts** (equal width, no overflow):
|
|
1072
|
+
\`\`\`css
|
|
1073
|
+
.chart-row {
|
|
1074
|
+
display: grid;
|
|
1075
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
1076
|
+
gap: 1rem;
|
|
1077
|
+
}
|
|
1078
|
+
\`\`\`
|
|
1079
|
+
|
|
1080
|
+
## Critical Sizing Rules
|
|
1081
|
+
|
|
1082
|
+
- **\`min-width: 0\`** on every flex/grid child that contains a Kendo component \u2014 the single most common cause of layout overflow.
|
|
1083
|
+
- **Grid component** always requires an explicit height (e.g., \`[height]="'500px'"\` or \`flex: 1; min-height: 0\` inside a flex column).
|
|
1084
|
+
- **Chart component** always requires an explicit height (e.g., \`style="height: 300px"\`).
|
|
1085
|
+
- Never leave Grid column widths unset \u2014 without a height, Grid renders all rows and expands the page indefinitely..
|
|
1086
|
+
- Constrain page content to \`max-width: 1440px\` with \`margin: 0 auto\` to prevent unbounded wide-screen stretching, unless the project defines a different maximum content width.
|
|
1087
|
+
|
|
1088
|
+
## Dark Theme Completeness
|
|
1089
|
+
|
|
1090
|
+
Kendo themes style \`.k-*\` component selectors only. Always add these two lines to \`styles.scss\` or the global CSS file after any theme import:
|
|
1091
|
+
|
|
1092
|
+
\`\`\`scss
|
|
1093
|
+
html, body {
|
|
1094
|
+
background-color: var(--kendo-body-bg);
|
|
1095
|
+
color: var(--kendo-body-text);
|
|
1096
|
+
}
|
|
1097
|
+
\`\`\`
|
|
1098
|
+
|
|
1099
|
+
Without this, dark-themed components render on a white page.
|
|
1100
|
+
|
|
1101
|
+
## Surface Hierarchy
|
|
1102
|
+
|
|
1103
|
+
Kendo themes define four surface levels \u2014 do not introduce custom surfaces outside this system:
|
|
1104
|
+
1. **Page background** (\`var(--kendo-body-bg)\`) \u2014 lowest surface, applied to \`html, body\`
|
|
1105
|
+
2. **Component background** (\`var(--kendo-component-bg)\`) \u2014 cards, panels, Grid body
|
|
1106
|
+
3. **Header / hover surface** (\`var(--kendo-grid-header-bg)\`) \u2014 Grid headers, highlighted rows
|
|
1107
|
+
4. **Active / selected surface** \u2014 managed by the theme automatically
|
|
1108
|
+
|
|
1109
|
+
Custom cards and containers must use \`var(--kendo-component-bg)\` for their background \u2014 never \`#fff\` or other hardcoded values. Hardcoded light colors in custom templates (Grid cell templates, custom component content) break dark mode.
|
|
1110
|
+
|
|
1111
|
+
## Splitter Usage Boundary
|
|
1112
|
+
|
|
1113
|
+
Use the \`kendo-splitter\` component only for **user-resizable** content areas (e.g., master-detail panels, side-by-side editors). Do **not** use it for static page layout \u2014 CSS Grid and Flexbox handle that with zero JavaScript overhead.
|
|
1114
|
+
|
|
1115
|
+
## Inline Input Width
|
|
1116
|
+
|
|
1117
|
+
\`kendo-dropdownlist\`, \`kendo-datepicker\`, \`kendo-textbox\`, and similar inline inputs are \`display: inline-block\` by default and will **not** fill their container automatically. Apply \`style="width: 100%"\` or wrap in a layout container to ensure consistent sizing in forms.
|
|
1118
|
+
|
|
1119
|
+
## Popup Z-Index Trap
|
|
1120
|
+
|
|
1121
|
+
CSS \`transform\` (including \`translate3d(0,0,0)\` GPU-compositing tricks) on any ancestor element creates a new stacking context. This clips Kendo popups (which use \`z-index ~10000\`), causing DropDownList, DatePicker, and ComboBox popups to appear behind other elements. Avoid \`transform\` on layout ancestors that contain Kendo overlay components.
|
|
1122
|
+
`;var je=()=>`## Design Standards for ${l} Theming
|
|
1123
|
+
|
|
1124
|
+
### Color & Contrast Requirements
|
|
1125
|
+
- Body text contrast: \u2265 4.5:1. Large text / UI component borders: \u2265 3:1.
|
|
1126
|
+
- Use only the 5 semantic color slots: **primary, success, warning, error, info**. Never invent ad-hoc semantic colors.
|
|
1127
|
+
- Never use color alone to convey meaning \u2014 always pair with an icon or text label.
|
|
1128
|
+
|
|
1129
|
+
### Typography
|
|
1130
|
+
- Prefer a single font family per application; defer to the project's established font stack if one already exists. When introducing or changing a font, test it against Grid headers, DatePicker, DropDownList, and Chart axes.
|
|
1131
|
+
- Numeric and currency values require \`font-variant-numeric: tabular-nums\` to stay column-aligned.
|
|
1132
|
+
|
|
1133
|
+
### Override Priority (highest \u2192 lowest)
|
|
1134
|
+
\`\`\`
|
|
1135
|
+
$kendo-* SCSS variables \u2190 compile-time, highest priority
|
|
1136
|
+
CSS custom properties \u2190 runtime, can be scoped per class
|
|
1137
|
+
className overrides \u2190 avoid; breaks on theme updates
|
|
1138
|
+
!important \u2190 never use; defeats theme state classes
|
|
1139
|
+
\`\`\`
|
|
1140
|
+
|
|
1141
|
+
### One Theme Per Application
|
|
1142
|
+
Never import more than one Kendo theme package in the same application. Mixing themes (e.g., Default + Bootstrap) causes cascade conflicts that are extremely difficult to debug and doubles the CSS bundle weight.
|
|
1143
|
+
|
|
1144
|
+
### Semantic Colors via CSS Variables
|
|
1145
|
+
Always reference semantic colors through Kendo CSS variables rather than hardcoded hex values:
|
|
1146
|
+
- \`var(--kendo-color-success)\` not \`#28a745\`
|
|
1147
|
+
- \`var(--kendo-color-error)\` not \`#dc3545\`
|
|
1148
|
+
|
|
1149
|
+
Hardcoded hex values do not adapt to theme switches, swatches, or dark mode.
|
|
1150
|
+
|
|
1151
|
+
### Custom Template Color Safety
|
|
1152
|
+
Custom content inside Grid cell templates and custom component templates must use CSS variables for colors \u2014 never hardcoded light colors:
|
|
1153
|
+
- CORRECT: \`color: var(--kendo-body-text); background: var(--kendo-component-bg)\`
|
|
1154
|
+
- WRONG: \`color: #333; background: #ffffff\`
|
|
3152
1155
|
|
|
3153
|
-
|
|
3154
|
-
|
|
1156
|
+
This is the most common source of dark mode breakage in custom UI.
|
|
1157
|
+
|
|
1158
|
+
---
|
|
1159
|
+
|
|
1160
|
+
## Applying CSS Variables in ${l}
|
|
3155
1161
|
|
|
3156
1162
|
Apply these CSS variables in the Angular application using one of these methods:
|
|
3157
1163
|
|
|
@@ -3213,11 +1219,7 @@ export class ThemeService {
|
|
|
3213
1219
|
}
|
|
3214
1220
|
}
|
|
3215
1221
|
\`\`\`
|
|
3216
|
-
`;
|
|
3217
|
-
|
|
3218
|
-
// packages/angular/src/lib/instructions/icons.ts
|
|
3219
|
-
var CODE_ASSISTANT_NAME2 = UIAgent.ToolNames.codeAssistant("kendo");
|
|
3220
|
-
var getIconsInstructions = () => `## Using ${ANGULAR_SUITE_NAME} Icons
|
|
1222
|
+
`;var Ve=m.ToolNames.codeAssistant("kendo"),We=()=>`## Using ${l} Icons
|
|
3221
1223
|
|
|
3222
1224
|
Important: Attempt to prioritize SVG icons over font icons.
|
|
3223
1225
|
|
|
@@ -3225,13 +1227,13 @@ Important: Attempt to prioritize SVG icons over font icons.
|
|
|
3225
1227
|
|
|
3226
1228
|
- Make sure @progress/kendo-svg-icons is installed.
|
|
3227
1229
|
- Make sure @progress/kendo-angular-icons is installed.
|
|
3228
|
-
- You can call ${
|
|
1230
|
+
- You can call ${Ve} tool for ${l} SVGIcon component for docs and API reference.
|
|
3229
1231
|
- [optional] If SVG is not an option fallback to fonticon - make sure \`<link rel="stylesheet" href="https://unpkg.com/@progress/kendo-font-icons/dist/index.css" />\` is added as a reference.
|
|
3230
|
-
- [optional] If using font icons you can call ${
|
|
1232
|
+
- [optional] If using font icons you can call ${Ve} tool for ${l} Icon component for docs and API reference.
|
|
3231
1233
|
|
|
3232
1234
|
### Examples
|
|
3233
1235
|
|
|
3234
|
-
Using ${
|
|
1236
|
+
Using ${l} SVGIcon component:
|
|
3235
1237
|
|
|
3236
1238
|
\`\`\`ts
|
|
3237
1239
|
import { Component } from "@angular/core";
|
|
@@ -3252,7 +1254,7 @@ export class AppComponent {
|
|
|
3252
1254
|
|
|
3253
1255
|
\`\`\`
|
|
3254
1256
|
|
|
3255
|
-
Using ${
|
|
1257
|
+
Using ${l} Icon component:
|
|
3256
1258
|
|
|
3257
1259
|
\`\`\`ts
|
|
3258
1260
|
import { Component } from "@angular/core";
|
|
@@ -3268,43 +1270,29 @@ import { KENDO_ICONS } from "@progress/kendo-angular-icons";
|
|
|
3268
1270
|
})
|
|
3269
1271
|
export class AppComponent {}
|
|
3270
1272
|
\`\`\`
|
|
3271
|
-
`;
|
|
3272
|
-
|
|
3273
|
-
// packages/angular/src/lib/instructions/components-common.ts
|
|
3274
|
-
var getComponentsCommonInstructions = (ctx) => {
|
|
3275
|
-
const normComponent = ctx.component?.trim().toLowerCase();
|
|
3276
|
-
const installPackage = COMPONENT_PACKAGE_MAP.get(normComponent);
|
|
3277
|
-
let content = `## ${ANGULAR_SUITE_NAME} Common Guidelines
|
|
1273
|
+
`;var ze=e=>{let t=e.component?.trim().toLowerCase(),s=ye.get(t),o=`## ${l} Common Guidelines
|
|
3278
1274
|
|
|
3279
|
-
`;
|
|
3280
|
-
if (installPackage) {
|
|
3281
|
-
content += `### Package Installation
|
|
1275
|
+
`;return s&&(o+=`### Package Installation
|
|
3282
1276
|
Always use minimal, targeted package installation.
|
|
3283
1277
|
Ensure all necessary Angular packages are installed, including @angular/localize.
|
|
3284
1278
|
|
|
3285
1279
|
Process:
|
|
3286
1280
|
1. Identify the required components
|
|
3287
1281
|
2. Determine the specific Kendo Angular packages needed
|
|
3288
|
-
3. Use the "ng add ${
|
|
1282
|
+
3. Use the "ng add ${s}" command
|
|
3289
1283
|
|
|
3290
|
-
For ${
|
|
3291
|
-
|
|
3292
|
-
}
|
|
3293
|
-
if (ctx.componentInstructions) {
|
|
3294
|
-
content += `
|
|
1284
|
+
For ${e.component} component: \`ng add ${s}\`
|
|
1285
|
+
`),e.componentInstructions&&(o+=`
|
|
3295
1286
|
## Component-Specific Guidelines
|
|
3296
1287
|
|
|
3297
|
-
${
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
return content;
|
|
3301
|
-
};
|
|
1288
|
+
${e.componentInstructions}
|
|
1289
|
+
`),o+=`
|
|
1290
|
+
## Types and Interfaces
|
|
3302
1291
|
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
const createProjectSection = createNewProject ? `## Step ${stepCounter++}: Install Angular CLI
|
|
1292
|
+
Always use the correct ${l} types for component inputs, outputs, and event handler parameters.
|
|
1293
|
+
Do not substitute plain strings, plain objects, or \`any\` for a typed union, enum, or interface provided by the library.
|
|
1294
|
+
Import all required types from the appropriate ${l} package.
|
|
1295
|
+
`,o};function Ye(e="kendo-angular-app",t=!0,s="default"){let o=t?`These instructions will walk you through creating a new Angular project and setting up ${l}.`:`These instructions will walk you through adding ${l} to your existing Angular project.`,n=1,a=t?`## Step ${n++}: Install Angular CLI
|
|
3308
1296
|
|
|
3309
1297
|
First, ensure the Angular CLI is installed globally:
|
|
3310
1298
|
|
|
@@ -3312,24 +1300,23 @@ First, ensure the Angular CLI is installed globally:
|
|
|
3312
1300
|
npm install -g @angular/cli@latest
|
|
3313
1301
|
\`\`\`
|
|
3314
1302
|
|
|
3315
|
-
## Step ${
|
|
1303
|
+
## Step ${n++}: Create the Project
|
|
3316
1304
|
|
|
3317
1305
|
Create a new Angular project using the Angular CLI:
|
|
3318
1306
|
|
|
3319
1307
|
\`\`\`bash
|
|
3320
|
-
ng new ${
|
|
1308
|
+
ng new ${e} --style=css --ai-config=none --no-ssr --routing --zoneless=false --minimal=true
|
|
3321
1309
|
\`\`\`
|
|
3322
1310
|
|
|
3323
1311
|
Navigate to the project directory:
|
|
3324
1312
|
|
|
3325
1313
|
\`\`\`bash
|
|
3326
|
-
cd ${
|
|
1314
|
+
cd ${e}
|
|
3327
1315
|
\`\`\`
|
|
3328
1316
|
|
|
3329
|
-
|
|
3330
|
-
return `# Getting Started with ${ANGULAR_SUITE_NAME}
|
|
1317
|
+
`:"";return`# Getting Started with ${l}
|
|
3331
1318
|
|
|
3332
|
-
${
|
|
1319
|
+
${o}
|
|
3333
1320
|
|
|
3334
1321
|
Execute the following steps in order.
|
|
3335
1322
|
|
|
@@ -3342,9 +1329,9 @@ Before you begin, ensure you have:
|
|
|
3342
1329
|
- **Node.js 18 or later** installed on your machine
|
|
3343
1330
|
- If Node.js is not available, you need to install the latest Node.js automatically as a preliminary step before installing the Angular CLI tool.
|
|
3344
1331
|
|
|
3345
|
-
${
|
|
1332
|
+
${a}## Step ${n++}: Configure animations
|
|
3346
1333
|
|
|
3347
|
-
This ensures animations that ${
|
|
1334
|
+
This ensures animations that ${l} components rely on are configurated correctly.
|
|
3348
1335
|
|
|
3349
1336
|
1. Open the \`src/app/app.config.ts\` file and add animations like this.
|
|
3350
1337
|
\`\`\`typescript
|
|
@@ -3360,21 +1347,21 @@ export const appConfig: ApplicationConfig = {
|
|
|
3360
1347
|
};
|
|
3361
1348
|
\`\`\`
|
|
3362
1349
|
|
|
3363
|
-
## Step ${
|
|
1350
|
+
## Step ${n++}: Install ${l} Packages
|
|
3364
1351
|
|
|
3365
1352
|
Use angular CLI to install grid package. While installing, confirm that you also want to install the underlying npm package with the suggested version from the ng tool.
|
|
3366
1353
|
|
|
3367
1354
|
\`\`\`bash
|
|
3368
|
-
ng add @progress/kendo-angular-grid@latest --skip-confirmation --theme=${
|
|
1355
|
+
ng add @progress/kendo-angular-grid@latest --skip-confirmation --theme=${s}
|
|
3369
1356
|
\`\`\`
|
|
3370
1357
|
|
|
3371
|
-
Use npm to install additional required ${
|
|
1358
|
+
Use npm to install additional required ${l} packages:
|
|
3372
1359
|
|
|
3373
1360
|
\`\`\`bash
|
|
3374
1361
|
npm install @progress/kendo-angular-barcodes @progress/kendo-angular-chart-wizard @progress/kendo-angular-charts @progress/kendo-angular-dateinputs @progress/kendo-angular-diagrams @progress/kendo-angular-editor @progress/kendo-angular-filter @progress/kendo-angular-gantt @progress/kendo-angular-gauges @progress/kendo-angular-icons @progress/kendo-angular-listbox @progress/kendo-angular-listview @progress/kendo-angular-map @progress/kendo-angular-pdfviewer @progress/kendo-angular-pivotgrid @progress/kendo-angular-ripple @progress/kendo-angular-scheduler @progress/kendo-angular-scrollview @progress/kendo-angular-sortable @progress/kendo-angular-spreadsheet @progress/kendo-angular-tooltip @progress/kendo-angular-treelist @progress/kendo-angular-typography @progress/kendo-file-saver
|
|
3375
1362
|
\`\`\`
|
|
3376
1363
|
|
|
3377
|
-
## Step ${
|
|
1364
|
+
## Step ${n++}: Activate Kendo license
|
|
3378
1365
|
|
|
3379
1366
|
This step is required to use Kendo UI for Angular components without watermarks and with access to all features. At this point, the customer have the correct license file, and the command should be run to activate the component in this specific project. Run the following command to activate your license:
|
|
3380
1367
|
|
|
@@ -3389,7 +1376,7 @@ ng cache clean
|
|
|
3389
1376
|
\`\`\`
|
|
3390
1377
|
|
|
3391
1378
|
|
|
3392
|
-
## Step ${
|
|
1379
|
+
## Step ${n++}: Install the Kendo utils package
|
|
3393
1380
|
|
|
3394
1381
|
Add the following script to index.html to include the Kendo theme utils, which are required for the themes to work correctly:
|
|
3395
1382
|
|
|
@@ -3397,9 +1384,9 @@ Add the following script to index.html to include the Kendo theme utils, which a
|
|
|
3397
1384
|
<link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-utils/dist/all.css" />
|
|
3398
1385
|
\`\`\`
|
|
3399
1386
|
|
|
3400
|
-
${
|
|
1387
|
+
${t?`The application should start and open your browser to see your ${l} application.`:`The application should start and open in your browser. Verify that the ${l} components are rendering correctly with the theme applied.`}
|
|
3401
1388
|
|
|
3402
|
-
## Step ${
|
|
1389
|
+
## Step ${n++}: Create Sample Page
|
|
3403
1390
|
|
|
3404
1391
|
Add the sample page below to your application to verify that everything is working correctly.
|
|
3405
1392
|
|
|
@@ -3426,7 +1413,7 @@ export class App {}
|
|
|
3426
1413
|
\`\`\`html
|
|
3427
1414
|
<div class="k-d-flex k-flex-col k-gap-5 k-p-6">
|
|
3428
1415
|
<div class="k-d-flex k-flex-col k-align-items-center k-gap-3 k-py-4">
|
|
3429
|
-
<h1 class="k-h2 k-text-center">${
|
|
1416
|
+
<h1 class="k-h2 k-text-center">${l}</h1>
|
|
3430
1417
|
<p class="k-h5 k-text-center k-color-subtle k-font-weight-normal k-max-w-3xl">
|
|
3431
1418
|
Create sophisticated Angular UIs with AI-powered agents using natural language prompts
|
|
3432
1419
|
</p>
|
|
@@ -3533,19 +1520,15 @@ export class App {}
|
|
|
3533
1520
|
}
|
|
3534
1521
|
\`\`\`
|
|
3535
1522
|
|
|
3536
|
-
## Step ${
|
|
1523
|
+
## Step ${n++}: Run Your Application
|
|
3537
1524
|
|
|
3538
1525
|
**Verification:** Automatically run the application. Do not just inform the user\u2014execute the following command and keep the application running:
|
|
3539
1526
|
|
|
3540
1527
|
\`\`\`bash
|
|
3541
|
-
cd ${
|
|
1528
|
+
cd ${e} && ng serve
|
|
3542
1529
|
\`\`\`
|
|
3543
1530
|
|
|
3544
|
-
|
|
3545
|
-
}
|
|
3546
|
-
|
|
3547
|
-
// packages/angular/src/lib/instructions/grid.ts
|
|
3548
|
-
var gridInstructions = `
|
|
1531
|
+
`}var He=`
|
|
3549
1532
|
## Grid Data Binding
|
|
3550
1533
|
|
|
3551
1534
|
MUST use kendoGridBinding directive for basic Grid operations
|
|
@@ -3559,10 +1542,96 @@ Always use kendoGridBinding for:
|
|
|
3559
1542
|
Implementation: <kendo-grid [kendoGridBinding]="data">
|
|
3560
1543
|
|
|
3561
1544
|
Use manual binding for complex custom scenarios.
|
|
3562
|
-
`;
|
|
3563
1545
|
|
|
3564
|
-
|
|
3565
|
-
|
|
1546
|
+
## Manual Data Binding
|
|
1547
|
+
|
|
1548
|
+
When using manual binding (without kendoGridBinding), every enabled Grid data operation requires a corresponding event handler that applies the operation to the data manually.
|
|
1549
|
+
The \`@progress/kendo-data-query\` package provides matching helpers (e.g. \`filterBy()\`, \`orderBy()\`, \`process()\`) that can be used directly inside these handlers.
|
|
1550
|
+
When multiple data operations are enabled at once, the preferred approach is a single \`dataStateChange\` handler using the \`process()\` helper.
|
|
1551
|
+
|
|
1552
|
+
Filtering example:
|
|
1553
|
+
\`\`\`typescript
|
|
1554
|
+
import { filterBy, CompositeFilterDescriptor } from '@progress/kendo-data-query';
|
|
1555
|
+
|
|
1556
|
+
onFilterChange(filter: CompositeFilterDescriptor): void {
|
|
1557
|
+
this.gridData = filterBy(this.sourceData, filter);
|
|
1558
|
+
}
|
|
1559
|
+
\`\`\`
|
|
1560
|
+
\`\`\`html
|
|
1561
|
+
<kendo-grid [data]="gridData" [filterable]="true" (filterChange)="onFilterChange($event)">
|
|
1562
|
+
\`\`\`
|
|
1563
|
+
|
|
1564
|
+
## kendoButton Must Not Be Combined with Command Directives
|
|
1565
|
+
|
|
1566
|
+
Never apply kendoButton to the same element as any of these Grid command directives - they render their own button internally.
|
|
1567
|
+
Instead, apply only the command directive to the button element.
|
|
1568
|
+
Placing kendoButton on the same host element introduces a second component on the same node, which Angular does not allow and causes a runtime error.
|
|
1569
|
+
|
|
1570
|
+
Affected directives:
|
|
1571
|
+
- kendoGridExcelCommand
|
|
1572
|
+
- kendoGridCSVCommand
|
|
1573
|
+
- kendoGridPDFCommand
|
|
1574
|
+
- kendoGridAddCommand
|
|
1575
|
+
- kendoGridEditCommand
|
|
1576
|
+
- kendoGridSaveCommand
|
|
1577
|
+
- kendoGridCancelCommand
|
|
1578
|
+
- kendoGridRemoveCommand
|
|
1579
|
+
|
|
1580
|
+
WRONG: <button kendoGridExcelCommand kendoButton>Export to Excel</button>
|
|
1581
|
+
CORRECT: <button kendoGridExcelCommand>Export to Excel</button>
|
|
1582
|
+
`;var Qe=`
|
|
1583
|
+
## kendoButton Must Not Be Combined with Command Directives
|
|
1584
|
+
|
|
1585
|
+
Never apply kendoButton to the same element as any of these TreeList command directives - they render their own button internally.
|
|
1586
|
+
Placing kendoButton on the same host element introduces a second component on the same node, which Angular does not allow and causes a runtime error.
|
|
1587
|
+
|
|
1588
|
+
Affected directives:
|
|
1589
|
+
- kendoTreeListExcelCommand
|
|
1590
|
+
- kendoTreeListPDFCommand
|
|
1591
|
+
|
|
1592
|
+
WRONG: <button kendoTreeListExcelCommand kendoButton>Export to Excel</button>
|
|
1593
|
+
CORRECT: <button kendoTreeListExcelCommand>Export to Excel</button>
|
|
1594
|
+
`;var Je=`
|
|
1595
|
+
## kendoButton Must Not Be Combined with Command Directives
|
|
1596
|
+
|
|
1597
|
+
Never apply kendoButton to the same element as any of these ListView command directives - they render their own button internally.
|
|
1598
|
+
Placing kendoButton on the same host element introduces a second component on the same node, which Angular does not allow and causes a runtime error.
|
|
1599
|
+
|
|
1600
|
+
Affected directives:
|
|
1601
|
+
- kendoListViewAddCommand
|
|
1602
|
+
- kendoListViewEditCommand
|
|
1603
|
+
- kendoListViewSaveCommand
|
|
1604
|
+
- kendoListViewCancelCommand
|
|
1605
|
+
- kendoListViewRemoveCommand
|
|
1606
|
+
|
|
1607
|
+
WRONG: <button kendoListViewAddCommand kendoButton>Add</button>
|
|
1608
|
+
CORRECT: <button kendoListViewAddCommand>Add</button>
|
|
1609
|
+
`;var Xe=`
|
|
1610
|
+
## kendoButton Must Not Be Combined with Command Directives
|
|
1611
|
+
|
|
1612
|
+
Never apply kendoButton to the same element as the Scheduler PDF command directive - it renders its own button internally.
|
|
1613
|
+
Placing kendoButton on the same host element introduces a second component on the same node, which Angular does not allow and causes a runtime error.
|
|
1614
|
+
|
|
1615
|
+
Affected directives:
|
|
1616
|
+
- kendoSchedulerPDFCommand
|
|
1617
|
+
|
|
1618
|
+
WRONG: <button kendoSchedulerPDFCommand kendoButton>Export to PDF</button>
|
|
1619
|
+
CORRECT: <button kendoSchedulerPDFCommand>Export to PDF</button>
|
|
1620
|
+
`;var Ze=`
|
|
1621
|
+
## kendoButton Must Not Be Combined with Action Directives
|
|
1622
|
+
|
|
1623
|
+
Never apply kendoButton to the same element as any of these Window action directives - they render their own button internally.
|
|
1624
|
+
Placing kendoButton on the same host element introduces a second component on the same node, which Angular does not allow and causes a runtime error.
|
|
1625
|
+
|
|
1626
|
+
Affected directives:
|
|
1627
|
+
- kendoWindowCloseAction
|
|
1628
|
+
- kendoWindowMaximizeAction
|
|
1629
|
+
- kendoWindowMinimizeAction
|
|
1630
|
+
- kendoWindowRestoreAction
|
|
1631
|
+
|
|
1632
|
+
WRONG: <button kendoWindowCloseAction kendoButton></button>
|
|
1633
|
+
CORRECT: <button kendoWindowCloseAction></button>
|
|
1634
|
+
`;var et=`
|
|
3566
1635
|
## Charts Data Binding
|
|
3567
1636
|
|
|
3568
1637
|
Never bind the Chart's data to a getter property. Using a getter causes the chart to rerender on every Angular change detection cycle.
|
|
@@ -3570,96 +1639,65 @@ Never bind the Chart's data to a getter property. Using a getter causes the char
|
|
|
3570
1639
|
BAD: get chartData() { return [ /* data items */ ] }
|
|
3571
1640
|
GOOD: public chartData = [ /* data items */ ];
|
|
3572
1641
|
GOOD: public chartData = this.data.map(...)
|
|
3573
|
-
`;
|
|
3574
|
-
|
|
3575
|
-
|
|
3576
|
-
var dropdownComponents = [
|
|
3577
|
-
"combobox",
|
|
3578
|
-
"dropdownlist",
|
|
3579
|
-
"dropdowntree",
|
|
3580
|
-
"multicolumncombobox",
|
|
3581
|
-
"multiselect",
|
|
3582
|
-
"multiselecttree",
|
|
3583
|
-
"autocomplete"
|
|
3584
|
-
];
|
|
3585
|
-
var dropdownsInstructions = (component) => {
|
|
3586
|
-
if (component === "autocomplete") {
|
|
3587
|
-
return autoCompleteInstructions;
|
|
3588
|
-
}
|
|
3589
|
-
if (component === "dropdowntree") {
|
|
3590
|
-
return dropDownTreeInstructions;
|
|
3591
|
-
}
|
|
3592
|
-
if (component === "multiselecttree") {
|
|
3593
|
-
return multiSelectTreeInstructions;
|
|
3594
|
-
}
|
|
3595
|
-
if (component === "multicolumncombobox") {
|
|
3596
|
-
return multiColumnComboBoxInstructions;
|
|
3597
|
-
}
|
|
3598
|
-
return dropdownCommonInstructions(component);
|
|
3599
|
-
};
|
|
3600
|
-
var dropdownCommonInstructions = (component) => `
|
|
3601
|
-
## ${component}
|
|
3602
|
-
When implementing or updating the ${component} component, always follow these rules for \`textField\` and \`valueField\`:
|
|
1642
|
+
`;var tt=["combobox","dropdownlist","dropdowntree","multicolumncombobox","multiselect","multiselecttree","autocomplete"],ot=e=>e==="autocomplete"?Bt:e==="dropdowntree"?Ft:e==="multiselecttree"?qt:e==="multicolumncombobox"?Kt:Mt(e),Mt=e=>`
|
|
1643
|
+
## ${e}
|
|
1644
|
+
When implementing or updating the ${e} component, always follow these rules for \`textField\` and \`valueField\`:
|
|
3603
1645
|
|
|
3604
1646
|
### Primitive Data
|
|
3605
|
-
If the data is an array of primitives (e.g., data=[
|
|
1647
|
+
If the data is an array of primitives (e.g., [data]="['A', 'B']"), never set \`textField\` or \`valueField\`:
|
|
1648
|
+
\`\`\`html
|
|
1649
|
+
<kendo-dropdownlist [data]="['A', 'B']"></kendo-dropdownlist>
|
|
1650
|
+
\`\`\`
|
|
3606
1651
|
|
|
3607
1652
|
### Complex Data
|
|
3608
|
-
If the data is an array of objects (e.g., data=[{ id, name }]), always set both \`textField\` and \`valueField\`:
|
|
1653
|
+
If the data is an array of objects (e.g., [data]="[{ id, name }]"), always set both \`textField\` and \`valueField\`:
|
|
3609
1654
|
- \`textField\` is the property to display (e.g., "name")
|
|
3610
1655
|
- \`valueField\` is the property for value binding (e.g., "id")
|
|
3611
1656
|
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
|
|
1657
|
+
\`\`\`html
|
|
1658
|
+
<kendo-dropdownlist
|
|
1659
|
+
[data]="[{ id: 1, name: 'A' }, { id: 2, name: 'B' }]"
|
|
1660
|
+
textField="name"
|
|
1661
|
+
valueField="id">
|
|
1662
|
+
</kendo-dropdownlist>
|
|
1663
|
+
\`\`\`
|
|
1664
|
+
|
|
1665
|
+
If \`valuePrimitive\` is true, the value must be a primitive and \`valueField\` is required:
|
|
1666
|
+
\`\`\`html
|
|
1667
|
+
<kendo-dropdownlist
|
|
1668
|
+
[data]="[{ id: 1, name: 'A' }, { id: 2, name: 'B' }]"
|
|
1669
|
+
textField="name"
|
|
1670
|
+
valueField="id"
|
|
1671
|
+
[valuePrimitive]="true"
|
|
1672
|
+
[(ngModel)]="selectedValue">
|
|
1673
|
+
</kendo-dropdownlist>
|
|
1674
|
+
\`\`\`
|
|
1675
|
+
\`\`\`typescript
|
|
1676
|
+
public selectedValue = 2;
|
|
1677
|
+
\`\`\`
|
|
1678
|
+
|
|
1679
|
+
If \`valuePrimitive\` is false, which is the default, the value must be an object and \`valueField\` is required:
|
|
1680
|
+
\`\`\`html
|
|
1681
|
+
<kendo-dropdownlist
|
|
1682
|
+
[data]="[{ id: 1, name: 'A' }, { id: 2, name: 'B' }]"
|
|
1683
|
+
textField="name"
|
|
1684
|
+
valueField="id"
|
|
1685
|
+
[valuePrimitive]="false"
|
|
1686
|
+
[(ngModel)]="selectedValue">
|
|
1687
|
+
</kendo-dropdownlist>
|
|
1688
|
+
\`\`\`
|
|
1689
|
+
\`\`\`typescript
|
|
1690
|
+
public selectedValue = { id: 2, name: 'B' };
|
|
1691
|
+
\`\`\`
|
|
1692
|
+
`,Bt=`
|
|
3615
1693
|
## AutoComplete
|
|
3616
1694
|
|
|
3617
1695
|
### Primitive Data
|
|
3618
|
-
If the data is an array of primitives (e.g., data=[
|
|
1696
|
+
If the data is an array of primitives (e.g., [data]="['A', 'B']"), never set \`valueField\`.
|
|
3619
1697
|
|
|
3620
1698
|
### Complex Data
|
|
3621
|
-
If the data is an array of objects (e.g., data=[{ id, name }]), always set \`valueField\` to a string property for value binding (e.g., "id").
|
|
3622
|
-
|
|
3623
|
-
var dropDownTreeInstructions = `
|
|
3624
|
-
## DropDownTree
|
|
3625
|
-
When implementing or updating the DropDownTree component, always follow these rules:
|
|
3626
|
-
|
|
3627
|
-
Always set both \`textField\` and \`valueField\`:
|
|
3628
|
-
- \`textField\` is the property to display (e.g., "name")
|
|
3629
|
-
- \`valueField\` is the property for value binding (e.g., "id")
|
|
3630
|
-
When \`valueField\` and \`textField\` are string[], always specify \`valueDepth\`.
|
|
3631
|
-
|
|
3632
|
-
### Primitive \`value\`
|
|
3633
|
-
If the \`value\` is of a primitive type, \`valuePrimitive\` must be true and \`dataItem\` is required.
|
|
3634
|
-
The \`value\` property of the \`dataItem\` will be associated with the \`valueField\`.
|
|
3635
|
-
`;
|
|
3636
|
-
var multiSelectTreeInstructions = `
|
|
3637
|
-
## MultiSelectTree
|
|
3638
|
-
When implementing or updating the MultiSelectTree component, always follow these rules:
|
|
3639
|
-
|
|
3640
|
-
Always set both \`textField\` and \`valueField\`:
|
|
3641
|
-
- \`textField\` is the property to display (e.g., "name")
|
|
3642
|
-
- \`valueField\` is the property for value binding (e.g., "id")
|
|
3643
|
-
When \`valueField\` and \`textField\` are string[], always specify \`valueDepth\`.
|
|
3644
|
-
|
|
3645
|
-
### Primitive \`value\`
|
|
3646
|
-
If the \`value\` is of a primitive type, \`valuePrimitive\` must be true and \`dataItems\` is required.
|
|
3647
|
-
The \`value\` property of the \`dataItems\` will be associated with the \`valueField\`.
|
|
3648
|
-
`;
|
|
3649
|
-
var multiColumnComboBoxInstructions = `
|
|
3650
|
-
## MultiColumnComboBox
|
|
3651
|
-
When implementing or updating the MultiColumnComboBox component, always follow these rules:
|
|
3652
|
-
|
|
3653
|
-
Always set both \`textField\` and \`valueField\`:
|
|
3654
|
-
- \`textField\` is the property to display (e.g., "name")
|
|
3655
|
-
- \`valueField\` is the property for value binding (e.g., "id")
|
|
3656
|
-
|
|
3657
|
-
### Primitive \`value\`
|
|
3658
|
-
If the \`value\` is of a primitive type, \`valuePrimitive\` must be true.
|
|
3659
|
-
`;
|
|
3660
|
-
|
|
3661
|
-
// packages/angular/src/lib/instructions/smart-grid.ts
|
|
3662
|
-
var smartGridInstructions = `
|
|
1699
|
+
If the data is an array of objects (e.g., [data]="[{ id, name }]"), always set \`valueField\` to a string property for value binding (e.g., "id").
|
|
1700
|
+
`,Ft='\n## DropDownTree\nWhen implementing or updating the DropDownTree component, always follow these rules:\n\nAlways set both `textField` and `valueField`:\n- `textField` is the property to display (e.g., "name")\n- `valueField` is the property for value binding (e.g., "id")\nWhen `valueField` and `textField` are string[], always specify `valueDepth`.\n\n### Primitive `value`\nIf the `value` is of a primitive type, `valuePrimitive` must be true and `dataItem` is required.\nThe `value` property of the `dataItem` will be associated with the `valueField`.\n',qt='\n## MultiSelectTree\nWhen implementing or updating the MultiSelectTree component, always follow these rules:\n\nAlways set both `textField` and `valueField`:\n- `textField` is the property to display (e.g., "name")\n- `valueField` is the property for value binding (e.g., "id")\nWhen `valueField` and `textField` are string[], always specify `valueDepth`.\n\n### Primitive `value`\nIf the `value` is of a primitive type, `valuePrimitive` must be true and `dataItems` is required.\nThe `value` property of the `dataItems` will be associated with the `valueField`.\n',Kt='\n## MultiColumnComboBox\nWhen implementing or updating the MultiColumnComboBox component, always follow these rules:\n\nAlways set both `textField` and `valueField`:\n- `textField` is the property to display (e.g., "name")\n- `valueField` is the property for value binding (e.g., "id")\n\n### Primitive `value`\nIf the `value` is of a primitive type, `valuePrimitive` must be true.\n';var nt=`
|
|
3663
1701
|
|
|
3664
1702
|
## Smart Grid (AI-Enhanced) Instructions
|
|
3665
1703
|
|
|
@@ -3678,211 +1716,6 @@ Suggestion Examples by Domain:
|
|
|
3678
1716
|
|
|
3679
1717
|
Required Disclaimer:
|
|
3680
1718
|
"The examples use a Telerik-hosted AI service for demonstration purposes only. For production applications, use an AI service that understands your specific domain, data, and business requirements."
|
|
3681
|
-
`;
|
|
1719
|
+
`;function jt(e){let t=e?.trim().toLowerCase();if(t==="grid")return[He,nt].join(`
|
|
3682
1720
|
|
|
3683
|
-
|
|
3684
|
-
function getAngularComponentInstructions(component) {
|
|
3685
|
-
const normComponent = component?.trim().toLowerCase();
|
|
3686
|
-
if (normComponent === "grid") {
|
|
3687
|
-
return [gridInstructions, smartGridInstructions].join("\n\n");
|
|
3688
|
-
}
|
|
3689
|
-
if (normComponent === "charts") {
|
|
3690
|
-
return chartsInstructions;
|
|
3691
|
-
}
|
|
3692
|
-
if (dropdownComponents.includes(normComponent)) {
|
|
3693
|
-
return dropdownsInstructions(normComponent);
|
|
3694
|
-
}
|
|
3695
|
-
return void 0;
|
|
3696
|
-
}
|
|
3697
|
-
var STOP_STATIC_CONTEXT = !!process.env.KENDO_UIA_STOP_STATIC_CONTEXT;
|
|
3698
|
-
var LAYOUT_ASSISTANT_NAME = UIAgent.ToolNames.layoutAssistant(PRODUCT_LINE);
|
|
3699
|
-
var CODE_ASSISTANT_NAME3 = UIAgent.ToolNames.codeAssistant(PRODUCT_LINE);
|
|
3700
|
-
var STYLE_ASSISTANT_NAME = UIAgent.ToolNames.styleAssistant(PRODUCT_LINE);
|
|
3701
|
-
var FIGMA_D2C_TOOL_NAME = UIAgent.ToolNames.figmaD2C(PRODUCT_LINE);
|
|
3702
|
-
var ICON_ASSISTANT_NAME = UIAgent.ToolNames.iconAssistant(PRODUCT_LINE);
|
|
3703
|
-
var GET_STARTED_TOOL_NAME = UIAgent.ToolNames.gettingStartedAssistant(PRODUCT_LINE);
|
|
3704
|
-
var ACCESSIBILITY_ASSISTANT_NAME = UIAgent.ToolNames.accessibilityAssistant(PRODUCT_LINE);
|
|
3705
|
-
function createAngularTools(contextApi2, accessType, mcpServer) {
|
|
3706
|
-
const allTools = [
|
|
3707
|
-
// Orchestrator Tool
|
|
3708
|
-
UIAgent.Tools.createOrchestrator(
|
|
3709
|
-
{
|
|
3710
|
-
name: UIAgent.ToolNames.orchestrator(PRODUCT_LINE),
|
|
3711
|
-
title: "Kendo UI Generator",
|
|
3712
|
-
description: UIAgent.ToolDescriptions.orchestrator(ANGULAR_SUITE_NAME),
|
|
3713
|
-
layoutAssistantName: LAYOUT_ASSISTANT_NAME,
|
|
3714
|
-
codeAssistantName: CODE_ASSISTANT_NAME3,
|
|
3715
|
-
styleAssistantName: STYLE_ASSISTANT_NAME,
|
|
3716
|
-
iconAssistantName: ICON_ASSISTANT_NAME,
|
|
3717
|
-
accessibilityAssistantName: ACCESSIBILITY_ASSISTANT_NAME,
|
|
3718
|
-
figmaD2CToolName: FIGMA_D2C_TOOL_NAME,
|
|
3719
|
-
suiteName: ANGULAR_SUITE_NAME,
|
|
3720
|
-
libKey: Suite,
|
|
3721
|
-
components: AngularComponents,
|
|
3722
|
-
requiredAccess: ["agent"]
|
|
3723
|
-
},
|
|
3724
|
-
{
|
|
3725
|
-
validationSteps: UIAgent.Validation.Angular.steps,
|
|
3726
|
-
injectedPlan: UIAgent.Validation.Angular.additionalPlan
|
|
3727
|
-
},
|
|
3728
|
-
contextApi2
|
|
3729
|
-
),
|
|
3730
|
-
// Assistant Orchestrator Tool (for assistant mode only)
|
|
3731
|
-
UIAgent.Tools.createAssistantOrchestrator(
|
|
3732
|
-
{
|
|
3733
|
-
name: "kendo_angular_assistant",
|
|
3734
|
-
title: "Kendo UI Assistant",
|
|
3735
|
-
description: UIAgent.ToolDescriptions.assistantOrchestrator(ANGULAR_SUITE_NAME),
|
|
3736
|
-
codeAssistantName: CODE_ASSISTANT_NAME3,
|
|
3737
|
-
iconAssistantName: ICON_ASSISTANT_NAME,
|
|
3738
|
-
suiteName: ANGULAR_SUITE_NAME,
|
|
3739
|
-
libKey: Suite,
|
|
3740
|
-
components: AngularComponents,
|
|
3741
|
-
requiredAccess: ["assistant"]
|
|
3742
|
-
},
|
|
3743
|
-
contextApi2
|
|
3744
|
-
),
|
|
3745
|
-
// Layout Assistant Tool
|
|
3746
|
-
UIAgent.Tools.createLayoutAssistant(
|
|
3747
|
-
{
|
|
3748
|
-
name: LAYOUT_ASSISTANT_NAME,
|
|
3749
|
-
title: "Kendo UI Layout Assistant",
|
|
3750
|
-
description: UIAgent.ToolDescriptions.layoutAssistant,
|
|
3751
|
-
suiteName: ANGULAR_SUITE_NAME,
|
|
3752
|
-
libKey: Suite,
|
|
3753
|
-
getPreContent: STOP_STATIC_CONTEXT ? void 0 : getLayoutInstructions,
|
|
3754
|
-
requiredAccess: ["agent"]
|
|
3755
|
-
},
|
|
3756
|
-
contextApi2
|
|
3757
|
-
),
|
|
3758
|
-
// Style Assistant Tool
|
|
3759
|
-
UIAgent.Tools.createStyleAssistant(
|
|
3760
|
-
{
|
|
3761
|
-
name: STYLE_ASSISTANT_NAME,
|
|
3762
|
-
title: "Kendo UI Style Assistant",
|
|
3763
|
-
description: UIAgent.ToolDescriptions.styleAssistant,
|
|
3764
|
-
libKey: Suite,
|
|
3765
|
-
getPreContent: STOP_STATIC_CONTEXT ? void 0 : getStyleInstructions,
|
|
3766
|
-
requiredAccess: ["agent"]
|
|
3767
|
-
},
|
|
3768
|
-
contextApi2
|
|
3769
|
-
),
|
|
3770
|
-
// Icon Search Tool
|
|
3771
|
-
UIAgent.Tools.createIconSearch(
|
|
3772
|
-
{
|
|
3773
|
-
name: ICON_ASSISTANT_NAME,
|
|
3774
|
-
title: "Kendo UI Icon Assistant",
|
|
3775
|
-
description: UIAgent.ToolDescriptions.iconAssistant,
|
|
3776
|
-
libKey: Suite,
|
|
3777
|
-
getPostContent: STOP_STATIC_CONTEXT ? void 0 : getIconsInstructions,
|
|
3778
|
-
requiredAccess: ["assistant", "agent"]
|
|
3779
|
-
},
|
|
3780
|
-
contextApi2
|
|
3781
|
-
),
|
|
3782
|
-
// Code Assistant Tool
|
|
3783
|
-
UIAgent.Tools.createCodeAssistant(
|
|
3784
|
-
{
|
|
3785
|
-
name: CODE_ASSISTANT_NAME3,
|
|
3786
|
-
title: "Kendo UI Component Assistant",
|
|
3787
|
-
description: UIAgent.ToolDescriptions.codeAssistant(ANGULAR_SUITE_NAME),
|
|
3788
|
-
libKey: Suite,
|
|
3789
|
-
suiteName: ANGULAR_SUITE_NAME,
|
|
3790
|
-
components: AngularComponents,
|
|
3791
|
-
getPostContent: STOP_STATIC_CONTEXT ? void 0 : ({ component }) => {
|
|
3792
|
-
const componentInstructions = getAngularComponentInstructions(component);
|
|
3793
|
-
return getComponentsCommonInstructions({ component, componentInstructions });
|
|
3794
|
-
},
|
|
3795
|
-
requiredAccess: ["assistant", "agent"]
|
|
3796
|
-
},
|
|
3797
|
-
contextApi2
|
|
3798
|
-
),
|
|
3799
|
-
// Getting Started Tool
|
|
3800
|
-
new UIAgentTool(
|
|
3801
|
-
GET_STARTED_TOOL_NAME,
|
|
3802
|
-
{
|
|
3803
|
-
title: "Kendo UI Getting Started",
|
|
3804
|
-
description: `Creates a new Angular project with Angular CLI and provides essential getting started guidance for ${ANGULAR_SUITE_NAME} including installation, configuration, and setup instructions.`,
|
|
3805
|
-
requiredAccess: ["agent"],
|
|
3806
|
-
inputSchema: createGettingStartedInputSchema(ANGULAR_SUITE_NAME, "kendo-angular-app")
|
|
3807
|
-
},
|
|
3808
|
-
async ({ projectName, createNewProject, theme }, { _meta }) => {
|
|
3809
|
-
try {
|
|
3810
|
-
await contextApi2.recordToolUserRequest({
|
|
3811
|
-
toolName: GET_STARTED_TOOL_NAME,
|
|
3812
|
-
meta: {
|
|
3813
|
-
projectName,
|
|
3814
|
-
createNewProject,
|
|
3815
|
-
theme,
|
|
3816
|
-
_meta
|
|
3817
|
-
}
|
|
3818
|
-
});
|
|
3819
|
-
} catch (error) {
|
|
3820
|
-
console.error("Error recording tool request:", error);
|
|
3821
|
-
}
|
|
3822
|
-
const instructions = getGettingStartedInstructions(projectName, createNewProject, theme);
|
|
3823
|
-
return {
|
|
3824
|
-
content: [
|
|
3825
|
-
{
|
|
3826
|
-
type: "text",
|
|
3827
|
-
text: instructions
|
|
3828
|
-
}
|
|
3829
|
-
]
|
|
3830
|
-
};
|
|
3831
|
-
}
|
|
3832
|
-
),
|
|
3833
|
-
// Accessibility Tool
|
|
3834
|
-
UIAgent.Tools.createAccessibilityAssistant(
|
|
3835
|
-
{
|
|
3836
|
-
name: ACCESSIBILITY_ASSISTANT_NAME,
|
|
3837
|
-
title: "Kendo UI Accessibility Assistant",
|
|
3838
|
-
description: UIAgent.ToolDescriptions.accessibilityAssistant(ANGULAR_SUITE_NAME),
|
|
3839
|
-
libKey: Suite,
|
|
3840
|
-
suiteName: ANGULAR_SUITE_NAME,
|
|
3841
|
-
components: AngularComponents,
|
|
3842
|
-
requiredAccess: ["agent"]
|
|
3843
|
-
},
|
|
3844
|
-
contextApi2
|
|
3845
|
-
),
|
|
3846
|
-
// Figma Design-to-Code Tool (only when FIGMA_API_KEY is set)
|
|
3847
|
-
...process.env.FIGMA_API_KEY ? [UIAgent.Tools.createFigmaD2C(
|
|
3848
|
-
{ name: FIGMA_D2C_TOOL_NAME, figmaApiKey: process.env.FIGMA_API_KEY, requiredAccess: ["agent"] },
|
|
3849
|
-
contextApi2
|
|
3850
|
-
)] : []
|
|
3851
|
-
];
|
|
3852
|
-
return allTools.filter((tool) => tool.hasAccess(accessType));
|
|
3853
|
-
}
|
|
3854
|
-
|
|
3855
|
-
// packages/angular/src/index.ts
|
|
3856
|
-
var __filename2 = fileURLToPath3(import.meta.url);
|
|
3857
|
-
var __dirname2 = path3.dirname(__filename2);
|
|
3858
|
-
var packageJsonPath2 = path3.resolve(__dirname2, "../package.json");
|
|
3859
|
-
var packageJson2 = JSON.parse(fs3.readFileSync(packageJsonPath2, "utf-8"));
|
|
3860
|
-
var server = new McpServer({
|
|
3861
|
-
name: "kendo-mcp",
|
|
3862
|
-
title: "Kendo MCP Server",
|
|
3863
|
-
version: packageJson2.version
|
|
3864
|
-
});
|
|
3865
|
-
async function startServer() {
|
|
3866
|
-
const transport = new StdioServerTransport();
|
|
3867
|
-
log("Starting server...");
|
|
3868
|
-
const accessType = await checkAccess(async () => {
|
|
3869
|
-
const response = await validateUserLicense();
|
|
3870
|
-
const entitlement = response?.entitlement;
|
|
3871
|
-
return entitlement?.Product?.Code || entitlement?.product?.code;
|
|
3872
|
-
});
|
|
3873
|
-
if (accessType !== "none") {
|
|
3874
|
-
contextApi.toolNameHeader = accessType === "agent" || accessType === "full" ? "agent" : "assistant";
|
|
3875
|
-
const angularTools = createAngularTools(contextApi, accessType, server);
|
|
3876
|
-
angularTools.forEach((tool) => tool.register(server));
|
|
3877
|
-
startHeartbeat({
|
|
3878
|
-
serverName: "angular",
|
|
3879
|
-
contextApi,
|
|
3880
|
-
additionalFields: {
|
|
3881
|
-
version: packageJson2.version,
|
|
3882
|
-
access_type: accessType
|
|
3883
|
-
}
|
|
3884
|
-
});
|
|
3885
|
-
}
|
|
3886
|
-
await server.connect(transport);
|
|
3887
|
-
}
|
|
3888
|
-
startServer();
|
|
1721
|
+
`);if(t==="treelist")return Qe;if(t==="listview")return Je;if(t==="scheduler")return Xe;if(t==="window")return Ze;if(t==="charts")return et;if(tt.includes(t))return ot(t)}var B=!!process.env.KENDO_UIA_STOP_STATIC_CONTEXT,st=m.ToolNames.layoutAssistant(I),ee=m.ToolNames.codeAssistant(I),rt=m.ToolNames.styleAssistant(I),te=m.ToolNames.iconAssistant(I),at=m.ToolNames.gettingStartedAssistant(I),it=m.ToolNames.accessibilityAssistant(I);function lt(e,t,s){return[m.Tools.createOrchestrator({name:m.ToolNames.orchestrator(I),title:"Kendo UI Generator",description:m.ToolDescriptions.orchestrator(l),layoutAssistantName:st,codeAssistantName:ee,styleAssistantName:rt,iconAssistantName:te,accessibilityAssistantName:it,suiteName:l,libKey:T,components:O,requiredAccess:["agent"]},{validationSteps:m.Validation.Angular.steps,injectedPlan:m.Validation.Angular.additionalPlan},e),m.Tools.createAssistantOrchestrator({name:"kendo_angular_assistant",title:"Kendo UI Assistant",description:m.ToolDescriptions.assistantOrchestrator(l),codeAssistantName:ee,iconAssistantName:te,suiteName:l,libKey:T,components:O,requiredAccess:["assistant"]},e),m.Tools.createLayoutAssistant({name:st,title:"Kendo UI Layout Assistant",description:m.ToolDescriptions.layoutAssistant,suiteName:l,libKey:T,getPreContent:B?void 0:Ke,requiredAccess:["agent"]},e),m.Tools.createStyleAssistant({name:rt,title:"Kendo UI Style Assistant",description:m.ToolDescriptions.styleAssistant,libKey:T,getPreContent:B?void 0:je,requiredAccess:["agent"]},e),m.Tools.createIconSearch({name:te,title:"Kendo UI Icon Assistant",description:m.ToolDescriptions.iconAssistant,libKey:T,getPostContent:B?void 0:We,requiredAccess:["assistant","agent"]},e),m.Tools.createCodeAssistant({name:ee,title:"Kendo UI Component Assistant",description:m.ToolDescriptions.codeAssistant(l),libKey:T,suiteName:l,components:O,getPostContent:B?void 0:({component:n})=>{let a=jt(n);return ze({component:n,componentInstructions:a})},requiredAccess:["assistant","agent"]},e),new S(at,{title:"Kendo UI Getting Started",description:`Creates a new Angular project with Angular CLI and provides essential getting started guidance for ${l} including installation, configuration, and setup instructions.`,requiredAccess:["agent"],inputSchema:fe(l,"kendo-angular-app")},async({projectName:n,createNewProject:a,theme:r},{_meta:i})=>{try{await e.recordToolUserRequest({toolName:at,meta:{projectName:n,createNewProject:a,theme:r,_meta:i}})}catch(p){console.error("Error recording tool request:",p)}return{content:[{type:"text",text:Ye(n,a,r)}]}}),m.Tools.createAccessibilityAssistant({name:it,title:"Kendo UI Accessibility Assistant",description:m.ToolDescriptions.accessibilityAssistant(l),libKey:T,suiteName:l,components:O,requiredAccess:["agent"]},e)].filter(n=>n.hasAccess(t))}var Ht=Yt(import.meta.url),Qt=ct.dirname(Ht),Jt=ct.resolve(Qt,"../package.json"),dt=JSON.parse(zt.readFileSync(Jt,"utf-8")),oe=new Vt({name:"kendo-mcp",title:"Kendo MCP Server",version:dt.version});async function Xt(){let e=new Wt;g("Starting server...");let t=await me(async()=>{let o=(await be())?.entitlement;return o?.Product?.Code||o?.product?.code});t!=="none"&&(L.toolNameHeader=t==="agent"||t==="full"?"agent":"assistant",lt(L,t,oe).forEach(o=>o.register(oe)),he({serverName:"angular",contextApi:L,additionalFields:{version:dt.version,access_type:t}})),await oe.connect(e)}Xt();
|