@progress/kendo-react-mcp 1.6.2-beta.cd97a7ec.0 → 1.7.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 +467 -2594
- package/package.json +1 -1
- package/proto/service.proto +0 -62
package/dist/index.js
CHANGED
|
@@ -1,804 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import{McpServer as Lt}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as Ut}from"@modelcontextprotocol/sdk/server/stdio.js";import{dirname as yt,join as bt}from"path";import{fileURLToPath as vt}from"url";import{loadLicense as it,decodeLicenseKey as at,decodeLicenseEvidence as lt}from"@progress/kendo-licensing/utils";var q=class extends Error{constructor(t){super(t),this.name="LicenseError"}};function ae(e){return e.replace(/^\uFEFF/,"")}async function le(e){let t=null,n=null;try{let o=it();if(!o.success){let s=new q(o.message);throw e&&await e("license_load_failed",{error:o.message}).catch(()=>{}),s}try{t=(await at(o.value)).licenses.find(async i=>!!(await lt(i)).userId)}catch(s){console.log(s.message),e&&await e("license_load_failed",{error:s.message||"Unknown decoding error"}).catch(()=>{})}if(!t)return[ae(o.value),null]}catch(o){return n=o.message||"Unknown error loading license.",e&&await e("license_load_failed",{error:n}).catch(()=>{}),[null,n]}return[ae(t),null]}import P from"node:fs";import $ from"node:path";var F=!1,N=process.env.DEBUG_LOG_FILE,ce=!!(N&&typeof N=="string");if(ce){let e=$.resolve(N),t=$.dirname(e);if(t!=="."&&t!==process.cwd()&&!P.existsSync(t))try{P.mkdirSync(t,{recursive:!0})}catch(n){console.error("Error creating log directory:",n)}if(!P.existsSync(e))try{P.writeFileSync(e,"")}catch(n){console.error("Error creating log file:",n)}}else F=!1;F=ce&&!!N&&P.existsSync($.resolve(N));function h(...e){if(F&&N){let o=`${new Date().toISOString()}: ${e.join(" ")}
|
|
3
|
+
`,s=$.resolve(N);P.appendFile(s,o,i=>{i&&console.error("Error writing to log file:",i)})}}import ct from"@grpc/proto-loader";import D from"@grpc/grpc-js";import ue from"path";import de from"fs";import{fileURLToPath as dt}from"url";var pt=dt(import.meta.url),ut=ue.dirname(pt),me={version:"unknown"},pe=ue.resolve(ut,"../package.json");de.existsSync(pe)&&(me=JSON.parse(de.readFileSync(pe,"utf-8")));function mt(e){return e.replace(/\u2014/g,"--").replace(/\u2013/g,"-").replace(/[^\x20-\x7E]/g,"")}var M=class{constructor(t,n,o){this.contextApiUrl=t;this.protoPath=n;this.options=o;this.toolNameHeader="assistant";let s=ct.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"),h("Using ContextApi URl:",this.contextApiUrl);let i=D.loadPackageDefinition(s),r=100*1024*1024,a={"grpc.max_receive_message_length":r,"grpc.max_send_message_length":r};this.client=new i.ContextQueryService(this.contextApiUrl||"contextapi.telerik.com:443",this.isDev?D.credentials.createInsecure():D.credentials.createSsl(),a)}async getMetadata({meta:t}={meta:{}}){let[n,o]=this.isDev?["fake_license",null]:await le((p,b)=>this.logEvent(p,b)),s=process.env.CONTEXTAPI_API_KEY,i=s&&typeof s=="string",r=n&&typeof n=="string";if(!r&&!i&&o)throw new Error(`Failed to authenticate with API key or License key!
|
|
2
4
|
|
|
3
|
-
// packages/react/src/index.ts
|
|
4
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
-
|
|
7
|
-
// packages/react/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/react/src/lib/constants.ts
|
|
617
|
-
var REACT_SUITE_NAME = "Kendo UI for React";
|
|
618
|
-
var Suite = "react";
|
|
619
|
-
var PRODUCT_LINE = "kendo";
|
|
620
|
-
var ReactComponents = [
|
|
621
|
-
"ActionSheet",
|
|
622
|
-
"AIPrompt",
|
|
623
|
-
"Animation",
|
|
624
|
-
"AppBar",
|
|
625
|
-
"ArcGauge",
|
|
626
|
-
"AutoComplete",
|
|
627
|
-
"Avatar",
|
|
628
|
-
"Badge",
|
|
629
|
-
"Barcode",
|
|
630
|
-
"BottomNavigation",
|
|
631
|
-
"Breadcrumb",
|
|
632
|
-
"Button",
|
|
633
|
-
"ButtonGroup",
|
|
634
|
-
"BreadCrumb",
|
|
635
|
-
"Calendar",
|
|
636
|
-
"Card",
|
|
637
|
-
"Chart",
|
|
638
|
-
"ChartWizard",
|
|
639
|
-
"Chat",
|
|
640
|
-
"Checkbox",
|
|
641
|
-
"Chip",
|
|
642
|
-
"ChipList",
|
|
643
|
-
"ChunkProgressBar",
|
|
644
|
-
"CircularGauge",
|
|
645
|
-
"ColorGradient",
|
|
646
|
-
"ColorPalette",
|
|
647
|
-
"ColorPicker",
|
|
648
|
-
"ComboBox",
|
|
649
|
-
"ContextMenu",
|
|
650
|
-
"ConversationalUI",
|
|
651
|
-
"DataGrid",
|
|
652
|
-
"Grid",
|
|
653
|
-
// Alias for DataGrid only used in the mcp-server
|
|
654
|
-
"DataQuery",
|
|
655
|
-
"DateMath",
|
|
656
|
-
"DateInput",
|
|
657
|
-
"DatePicker",
|
|
658
|
-
"DateRangePicker",
|
|
659
|
-
"DateTimePicker",
|
|
660
|
-
"Dialog",
|
|
661
|
-
"Drag&Drop",
|
|
662
|
-
"Drawer",
|
|
663
|
-
"Drawing",
|
|
664
|
-
"DropDownButton",
|
|
665
|
-
"DropDownList",
|
|
666
|
-
"DropDownTree",
|
|
667
|
-
"Editor",
|
|
668
|
-
"Error",
|
|
669
|
-
"ExcelExport",
|
|
670
|
-
"ExpansionPanel",
|
|
671
|
-
"ExternalDropZone",
|
|
672
|
-
"FileSaver",
|
|
673
|
-
"FileManager",
|
|
674
|
-
"Filter",
|
|
675
|
-
"FlatColorPicker",
|
|
676
|
-
"FloatingActionButton",
|
|
677
|
-
"FloatingLabel",
|
|
678
|
-
"Form",
|
|
679
|
-
"Gantt",
|
|
680
|
-
"Gauge",
|
|
681
|
-
"General",
|
|
682
|
-
"GridLayout",
|
|
683
|
-
"Hint",
|
|
684
|
-
"Icon",
|
|
685
|
-
"InlineAIPrompt",
|
|
686
|
-
"Input",
|
|
687
|
-
"Label",
|
|
688
|
-
"LinearGauge",
|
|
689
|
-
"ListBox",
|
|
690
|
-
"ListView",
|
|
691
|
-
"Loader",
|
|
692
|
-
"Map",
|
|
693
|
-
"MaskedTextBox",
|
|
694
|
-
"Menu",
|
|
695
|
-
"MultiColumnComboBox",
|
|
696
|
-
"MultiSelect",
|
|
697
|
-
"MultiSelectTree",
|
|
698
|
-
"MultiViewCalendar",
|
|
699
|
-
"Notification",
|
|
700
|
-
"NumericTextBox",
|
|
701
|
-
"OrgChart",
|
|
702
|
-
"PageTemplates/BuildingBlocks",
|
|
703
|
-
"Pager",
|
|
704
|
-
"PanelBar",
|
|
705
|
-
"PDFProcessing",
|
|
706
|
-
"PDFViewer",
|
|
707
|
-
"PivotGrid",
|
|
708
|
-
"Popover",
|
|
709
|
-
"Popup",
|
|
710
|
-
"ProgressBar",
|
|
711
|
-
"PromptBox",
|
|
712
|
-
"QRCode",
|
|
713
|
-
"RadialGauge",
|
|
714
|
-
"RadioButton",
|
|
715
|
-
"RadioGroup",
|
|
716
|
-
"RangeSlider",
|
|
717
|
-
"Rating",
|
|
718
|
-
"Ripple",
|
|
719
|
-
"Sankey",
|
|
720
|
-
"Scheduler",
|
|
721
|
-
"ScrollView",
|
|
722
|
-
"Signature",
|
|
723
|
-
"Skeleton",
|
|
724
|
-
"Slider",
|
|
725
|
-
"Sortable",
|
|
726
|
-
"Sparkline",
|
|
727
|
-
"SpeechToTextButton",
|
|
728
|
-
"SmartPasteButton",
|
|
729
|
-
"SplitButton",
|
|
730
|
-
"Splitter",
|
|
731
|
-
"Spreadsheet",
|
|
732
|
-
"StackLayout",
|
|
733
|
-
"Stepper",
|
|
734
|
-
"StockChart",
|
|
735
|
-
"SVGIcon",
|
|
736
|
-
"Switch",
|
|
737
|
-
"TabStrip",
|
|
738
|
-
"TaskBoard",
|
|
739
|
-
"TextArea",
|
|
740
|
-
"TextBox",
|
|
741
|
-
"TileLayout",
|
|
742
|
-
"Timeline",
|
|
743
|
-
"TimePicker",
|
|
744
|
-
"Toolbar",
|
|
745
|
-
"Tooltip",
|
|
746
|
-
"TreeList",
|
|
747
|
-
"TreeView",
|
|
748
|
-
"Typography",
|
|
749
|
-
"Upload",
|
|
750
|
-
"VSCodeExtension",
|
|
751
|
-
"Window"
|
|
752
|
-
];
|
|
753
|
-
|
|
754
|
-
// packages/react/src/lib/grpc-client.ts
|
|
755
|
-
var protoPath = join(
|
|
756
|
-
dirname(fileURLToPath2(import.meta.url)),
|
|
757
|
-
"../proto/service.proto"
|
|
758
|
-
);
|
|
759
|
-
var contextApi = new ContextAPI("contextapi.telerik.com:443", protoPath, {
|
|
760
|
-
libName: Suite
|
|
761
|
-
});
|
|
762
|
-
var validateUserLicense = async () => {
|
|
763
|
-
return contextApi.validateUserLicense();
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
// packages/react/src/index.ts
|
|
767
|
-
import fs3 from "fs";
|
|
768
|
-
import path3 from "path";
|
|
769
|
-
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
770
|
-
|
|
771
|
-
// packages/kendo-ui-agent/src/lib/tools-factory.ts
|
|
772
|
-
import { z as z4 } from "zod";
|
|
773
|
-
|
|
774
|
-
// packages/kendo-ui-agent/src/lib/ui-agent-tool.ts
|
|
775
|
-
var UIAgentTool = class {
|
|
776
|
-
constructor(name, config, cb) {
|
|
777
|
-
this.name = name;
|
|
778
|
-
this.config = config;
|
|
779
|
-
this.cb = cb;
|
|
780
|
-
}
|
|
781
|
-
register(mcpServer) {
|
|
782
|
-
this.server = mcpServer;
|
|
783
|
-
this.server.registerTool(this.name, this.config, this.cb);
|
|
784
|
-
}
|
|
785
|
-
hasAccess(accessType) {
|
|
786
|
-
if (!this.config.requiredAccess || this.config.requiredAccess.length === 0) {
|
|
787
|
-
return true;
|
|
788
|
-
}
|
|
789
|
-
return accessType === "full" || this.config.requiredAccess.includes(accessType);
|
|
790
|
-
}
|
|
791
|
-
};
|
|
792
|
-
|
|
793
|
-
// packages/kendo-ui-agent/src/lib/templates/validator.ts
|
|
794
|
-
var renderValidatorResponse = (ctx, frameworkValidationSteps) => `# ${ctx.suiteName} - Code Validation & Quality Assurance
|
|
5
|
+
License Error: ${o}`);let a=new D.Metadata;if(r)try{a.add("x-license-key",n)}catch(p){throw h("Error adding license key to metadata:",p),new Error(`Failed to use license key: ${p.message}`)}i&&a.add("x-api-key",s),this.options?.libName&&a.add("x-library-name",this.options.libName),a.add("x-tool-name",this.toolNameHeader);let d=JSON.stringify({...t,source:"npm",version:me.version,os:process.platform,node_version:process.version});return a.add("x-request-metadata",mt(d)),a}async query(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,i)=>{this.client.query(t,o,(r,a)=>{r?i(new Error(r)):s(a)})})}async getApiRefMatches(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,i)=>{this.client.getApiRefMatches(t,o,(r,a)=>{r?i(new Error(r)):s(a)})})}async queryCssUtils(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,i)=>{this.client.cssUtilsSearch(t,o,(r,a)=>{r?(h("Error querying CSS Utils:",r),i(new Error(r))):s(a)})})}async queryIconsSearch(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,i)=>{this.client.iconsSearch(t,o,(r,a)=>{r?(h("Error querying Icons Search:",r),i(new Error(r))):s(a)})})}async queryBuildingBlocks(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,i)=>{this.client.buildingBlocksSearch(t,o,(r,a)=>{r?(h("Error querying Building Blocks:",r),i(new Error(r))):s(a)})})}async validateUserLicense(){let t=await this.getMetadata();return new Promise((n,o)=>{this.client.validateUserLicense(null,t,(s,i)=>{s?(h("Error validating user license:",s),o(new Error(s))):n(i)})})}async queryThemeGenerate(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,i)=>{this.client.generateTheme(t,o,(r,a)=>{r?(h("Error querying context API/GenerateTheme:",r),i(new Error(r))):s(a)})})}async recordOrchestratorUserRequest({meta:t}){let n=await this.getMetadata({meta:t});return new Promise((o,s)=>{this.client.recordOrchestratorUserRequest(null,n,(i,r)=>{i?(h("Error recording orchestrator user request:",i),s(new Error(i))):o(r)})})}async recordToolUserRequest({toolName:t,meta:n}){let o=await this.getMetadata({meta:n});return new Promise((s,i)=>{this.client.recordToolUserRequest({tool_name:t},o,(r,a)=>{r?(h("Error recording tool user request:",r),i(new Error(r))):s(a)})})}async logEvent(t,n){let o=process.env.LOGGING_API_KEY;if(!o||typeof o!="string"){h("LOGGING_API_KEY not configured, skipping log event");return}let s=new D.Metadata;return s.add("x-api-key",o),new Promise((i,r)=>{this.client.logEvent({event_name:t,fields:n||{}},s,(a,d)=>{a?(h("Error logging event:",a),r(new Error(a))):i()})})}};import{z as K}from"zod";var io=K.object({user_id:K.string(),user_email:K.string().email()});import{z as k}from"zod";var ht=k.object({Product:k.object({Id:k.number().int(),Code:k.string(),Name:k.string()}),License:k.nullable(k.object({Id:k.number().int(),Name:k.string(),Type:k.string(),Active:k.boolean()})),Availability:k.array(k.object({LicenseStart:k.nullable(k.string().datetime()),LicenseEnd:k.nullable(k.string().datetime())})),IsLicenseAvailable:k.optional(k.boolean())}),co=k.array(ht);async function he(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 n=await e();return n.toLocaleLowerCase()==="agentic_ui_generator"?"agent":n.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 gt=1440*60*1e3;function fe(e){let{serverName:t,contextApi:n,additionalFields:o={},intervalMs:s=gt}=e,i="mcp_server_heartbeat",r=async()=>{try{let d={server_name:t,timestamp:new Date().toISOString(),...o};await n.logEvent(i,d)}catch(d){h(`Failed to send heartbeat for ${t}:`,d)}};r();let a=setInterval(r,s);return()=>{clearInterval(a),h(`Heartbeat stopped for ${t}`)}}import{z as j}from"zod";var ft=["default","bootstrap","material","fluent"];function ye(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(ft).default("default").describe("The Kendo UI theme to use. Determines which theme package is installed and imported.")}}var c="Kendo UI for React",T="react",x="kendo";var O=["ActionSheet","AIPrompt","Animation","AppBar","ArcGauge","AutoComplete","Avatar","Badge","Barcode","BottomNavigation","Breadcrumb","Button","ButtonGroup","BreadCrumb","Calendar","Card","Chart","ChartWizard","Chat","Checkbox","Chip","ChipList","ChunkProgressBar","CircularGauge","ColorGradient","ColorPalette","ColorPicker","ComboBox","ContextMenu","ConversationalUI","DataGrid","Grid","DataQuery","DateMath","DateInput","DatePicker","DateRangePicker","DateTimePicker","Dialog","Drag&Drop","Drawer","Drawing","DropDownButton","DropDownList","DropDownTree","Editor","Error","ExcelExport","ExpansionPanel","ExternalDropZone","FileSaver","FileManager","Filter","FlatColorPicker","FloatingActionButton","FloatingLabel","Form","Gantt","Gauge","General","GridLayout","Hint","Icon","InlineAIPrompt","Input","Label","LinearGauge","ListBox","ListView","Loader","Map","MaskedTextBox","Menu","MultiColumnComboBox","MultiSelect","MultiSelectTree","MultiViewCalendar","Notification","NumericTextBox","OrgChart","PageTemplates/BuildingBlocks","Pager","PanelBar","PDFProcessing","PDFViewer","PivotGrid","Popover","Popup","ProgressBar","PromptBox","QRCode","RadialGauge","RadioButton","RadioGroup","RangeSlider","Rating","Ripple","Sankey","Scheduler","ScrollView","Signature","Skeleton","Slider","Sortable","Sparkline","SpeechToTextButton","SmartPasteButton","SplitButton","Splitter","Spreadsheet","StackLayout","Stepper","StockChart","SVGIcon","Switch","TabStrip","TaskBoard","TextArea","TextBox","TileLayout","Timeline","TimePicker","Toolbar","Tooltip","TreeList","TreeView","Typography","Upload","VSCodeExtension","Window"];var kt=bt(yt(vt(import.meta.url)),"../proto/service.proto"),G=new M("test.contextapi.telerik.com:443",kt,{libName:T});var be=async()=>G.validateUserLicense();import _t from"fs";import ot from"path";import{fileURLToPath as $t}from"url";import{z as v}from"zod";var S=class{constructor(t,n,o){this.name=t;this.config=n;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 L=(e,t)=>`# ${e.suiteName} - Code Validation & Quality Assurance
|
|
795
6
|
|
|
796
7
|
## Comprehensive Code Validation Checklist
|
|
797
8
|
Execute these validation steps systematically to ensure high-quality, maintainable code:
|
|
798
9
|
|
|
799
10
|
### Validation Phase: Framework-Specific Validation
|
|
800
11
|
|
|
801
|
-
${
|
|
12
|
+
${t}
|
|
802
13
|
|
|
803
14
|
### Validation Phase: General Code Quality & Best Practices
|
|
804
15
|
|
|
@@ -835,97 +46,179 @@ Responsive Design:
|
|
|
835
46
|
- Graceful error handling for all user interactions
|
|
836
47
|
- Meaningful error messages for users
|
|
837
48
|
- Network error handling for API calls
|
|
838
|
-
`;
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
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 At=e=>`**Tool call example:**
|
|
842
151
|
\`\`\`
|
|
843
|
-
${
|
|
152
|
+
${e.layoutAssistantName}({
|
|
844
153
|
prompt="Provide Kendo Design System utility classes to make the following layout structure responsive across mobile, tablet, and desktop views: [LAYOUT DESCRIPTION HERE]",
|
|
845
154
|
includeBuildingBlockExamples=false // Optional, include examples of Kendo building blocks (Grid, Flex, Stack, etc.)
|
|
846
155
|
})
|
|
847
156
|
\`\`\`
|
|
848
|
-
|
|
849
|
-
var vanillaCSSResponsiveGuidance = `**General Responsive Design Guidance:**
|
|
157
|
+
`,Ct=`**General Responsive Design Guidance:**
|
|
850
158
|
- Use CSS media queries to apply different styles at various breakpoints (e.g., mobile, tablet, desktop).
|
|
851
159
|
- Consider a mobile-first approach, starting with styles for smaller screens and adding complexity for larger screens.
|
|
852
160
|
- Ensure flexible grid layouts that can adapt to different screen sizes.
|
|
853
161
|
- Use relative units (%, em, rem) instead of fixed units (px) for widths and spacing to allow for better scalability.
|
|
854
|
-
- Test the design across multiple devices and screen sizes to ensure a consistent user experience
|
|
855
|
-
var tailwindResponsiveGuidance = `**Tailwind CSS Responsive Design Guidance:**
|
|
162
|
+
- Test the design across multiple devices and screen sizes to ensure a consistent user experience.`,St=`**Tailwind CSS Responsive Design Guidance:**
|
|
856
163
|
- Use Tailwind's responsive utility variants (e.g., sm:, md:, lg:, xl:) to apply styles at specific breakpoints.
|
|
857
164
|
- Start with mobile styles (no prefix) and layer on additional styles for larger screens using the appropriate prefixes.
|
|
858
165
|
- Leverage Tailwind's grid and flex utilities to create flexible layouts that adapt to different screen sizes.
|
|
859
166
|
- Use Tailwind's spacing utilities to maintain consistent spacing across breakpoints.
|
|
860
|
-
- Test the design across multiple devices and screen sizes to ensure a consistent user experience
|
|
861
|
-
var renderOrchestratorResponse = (ctx, options) => {
|
|
862
|
-
const validationInstructions = renderValidatorResponse(
|
|
863
|
-
{ suiteName: ctx.suiteName, libKey: ctx.libKey },
|
|
864
|
-
options.validationSteps
|
|
865
|
-
);
|
|
866
|
-
const includeLayout = ctx.includeLayout && ctx.layoutMode === "utils";
|
|
867
|
-
const dragDropGuidance = ctx.libKey === "angular" ? `- **Drag and Drop**: Consider using the DragandDrop and Sortable components when drag-and-drop functionality is needed.` : "";
|
|
868
|
-
const componentsList = ctx.components ? ctx.components.join(", ") : "components";
|
|
869
|
-
const responsiveLayoutHint = includeLayout ? `- And use the ${ctx.layoutAssistantName} tool to get Kendo CSS utility classes needed for responsive design.` : "";
|
|
870
|
-
const responsiveKDSGuidance = includeLayout ? responsiveKendoDesignSystemGuidance(ctx) : "";
|
|
871
|
-
const responsiveVanillaCSSGuidance = ctx.layoutMode === "vanilla" ? vanillaCSSResponsiveGuidance : "";
|
|
872
|
-
const responsiveTailwindCSSGuidance = ctx.layoutMode === "tailwind" ? tailwindResponsiveGuidance : "";
|
|
873
|
-
return `# \u{1F3AF} ${ctx.suiteName} - Execution Plan
|
|
167
|
+
- Test the design across multiple devices and screen sizes to ensure a consistent user experience.`,U=(e,t)=>{let n=L({suiteName:e.suiteName,libKey:e.libKey},t.validationSteps),o=e.includeLayout&&e.layoutMode==="utils",s=e.libKey==="angular"?"- **Drag and Drop**: Consider using the DragandDrop and Sortable components when drag-and-drop functionality is needed.":"",i=e.components?e.components.join(", "):"components",r=o?`- And use the ${e.layoutAssistantName} tool to get Kendo CSS utility classes needed for responsive design.`:"",a=o?At(e):"",d=e.layoutMode==="vanilla"?Ct:"",p=e.layoutMode==="tailwind"?St:"";return`# \u{1F3AF} ${e.suiteName} - Execution Plan
|
|
874
168
|
|
|
875
169
|
**Current Goal:**
|
|
876
170
|
|
|
877
|
-
${
|
|
171
|
+
${e.userIntent}
|
|
878
172
|
|
|
879
173
|
**Requirements Summary:**
|
|
880
|
-
- **Framework:** ${
|
|
881
|
-
${
|
|
882
|
-
- Ensure to use ONLY ${
|
|
883
|
-
- And use the ${
|
|
884
|
-
- Ensure that after you read the plan you use exactly the ${
|
|
885
|
-
|
|
886
|
-
- And use the ${
|
|
887
|
-
|
|
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
|
|
888
182
|
- Use icons that align with the project theme and enhance usability.
|
|
889
|
-
- Use the ${
|
|
890
|
-
|
|
183
|
+
- Use the ${e.iconAssistantName} tool to search for icons that fit the theme and purpose of your project.
|
|
184
|
+
`:""}${e.includeTheming?`- **Custom Theming:**
|
|
891
185
|
- Create a custom theme that aligns with the current goal and branding needs.
|
|
892
186
|
- Use Kendo Themes and Design System guidelines.
|
|
893
187
|
- Make sure to include strict CSS variables or theme requirements from the current goal.
|
|
894
|
-
- And use the ${
|
|
895
|
-
|
|
188
|
+
- And use the ${e.styleAssistantName} tool to create a custom theme for your project.
|
|
189
|
+
`:""}${e.includeResponsive?`- **Responsive:**
|
|
896
190
|
- Ensure the layout is fully responsive across mobile, tablet, and desktop views.
|
|
897
|
-
${
|
|
898
|
-
|
|
191
|
+
${r}
|
|
192
|
+
`:""}
|
|
899
193
|
- **Accessible (WCAG 2.2 Level AA):**
|
|
900
|
-
- 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.
|
|
901
195
|
- For subsequent calls, use includeGeneralGuidelines=false to get only component-specific accessibility information.
|
|
902
196
|
- Ensure all components meet WCAG 2.2 Level AA standards.
|
|
903
197
|
|
|
904
|
-
${
|
|
198
|
+
${o?`**STYLING AND LAYOUT REQUIREMENTS:**
|
|
905
199
|
**LAYOUT MODE: KENDO DESIGN SYSTEM CSS UTILITIES**
|
|
906
200
|
## CRITICAL DESIGN SYSTEM CONSTRAINTS
|
|
907
201
|
- **USE ONLY KENDO DESIGN SYSTEM UTILITIES** for ALL styling, layout, spacing, positioning, and responsive behavior
|
|
908
202
|
- Avoid custom CSS, inline styles, or other CSS framework classes
|
|
909
|
-
- The ${
|
|
203
|
+
- The ${e.layoutAssistantName} tool will provide the specific Kendo CSS utility classes needed
|
|
910
204
|
- All layout requirements must use Kendo utilities exclusively
|
|
911
|
-
|
|
912
|
-
${
|
|
205
|
+
`:""}
|
|
206
|
+
${e.layoutMode==="vanilla"?`**STYLING AND LAYOUT REQUIREMENTS:**
|
|
913
207
|
**LAYOUT MODE: VANILLA**
|
|
914
208
|
- In this mode, you should use Kendo UI components and vanilla CSS for layout and styling.
|
|
915
209
|
- Do NOT use any utility-first CSS classes (e.g., from Tailwind) for layout or styling.
|
|
916
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.
|
|
917
|
-
|
|
918
|
-
${
|
|
211
|
+
`:""}
|
|
212
|
+
${e.layoutMode==="tailwind"?`**STYLING AND LAYOUT REQUIREMENTS:**
|
|
919
213
|
**LAYOUT MODE: TAILWIND**
|
|
920
214
|
- In this mode, you should use Tailwind CSS utility classes for layout and styling.
|
|
921
215
|
- Do NOT write custom CSS or use vanilla CSS for layout or styling.
|
|
922
216
|
- Focus on leveraging Tailwind's utility-first approach to achieve the desired design and layout, while still using Kendo UI components for functionality.
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
` : ""}
|
|
217
|
+
`:""}
|
|
218
|
+
|
|
219
|
+
---
|
|
220
|
+
|
|
221
|
+
${V()}
|
|
929
222
|
|
|
930
223
|
---
|
|
931
224
|
|
|
@@ -939,13 +232,13 @@ Follow these steps strictly in order to achieve a complete and polished implemen
|
|
|
939
232
|
**MANDATORY REQUIREMENT:**
|
|
940
233
|
|
|
941
234
|
- Before implementing any UI components or features, you must call the accessibility assistant with general guidelines
|
|
942
|
-
- 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
|
|
943
236
|
- These general guidelines apply to all components and must be considered throughout implementation
|
|
944
237
|
- For all subsequent calls, set "includeGeneralGuidelines=false" to get only component-specific information
|
|
945
238
|
|
|
946
239
|
**First tool call (includes general WCAG guidelines):**
|
|
947
240
|
\`\`\`
|
|
948
|
-
${
|
|
241
|
+
${e.accessibilityAssistantName}({
|
|
949
242
|
query="What are the accessibility requirements for [COMPONENT_NAME]?",
|
|
950
243
|
component="[COMPONENT_NAME]",
|
|
951
244
|
includeGeneralGuidelines=true // ONLY true on first call
|
|
@@ -954,11 +247,11 @@ ${ctx.accessibilityAssistantName}({
|
|
|
954
247
|
|
|
955
248
|
**Step 2: Get Component-Specific Accessibility Information**
|
|
956
249
|
|
|
957
|
-
For each additional ${
|
|
250
|
+
For each additional ${e.suiteName} component you plan to use, call the tool with "includeGeneralGuidelines=false":
|
|
958
251
|
|
|
959
252
|
**Tool call example:**
|
|
960
253
|
\`\`\`
|
|
961
|
-
${
|
|
254
|
+
${e.accessibilityAssistantName}({
|
|
962
255
|
query="What are the accessibility features and requirements for [COMPONENT_NAME]? Include ARIA attributes, keyboard navigation, and screen reader support.",
|
|
963
256
|
component="[COMPONENT_NAME]",
|
|
964
257
|
includeGeneralGuidelines=false // false for all calls after the first
|
|
@@ -967,112 +260,14 @@ ${ctx.accessibilityAssistantName}({
|
|
|
967
260
|
|
|
968
261
|
**Example:**
|
|
969
262
|
\`\`\`
|
|
970
|
-
${
|
|
263
|
+
${e.accessibilityAssistantName}({
|
|
971
264
|
query="How to associate the label with another component or HTML input?",
|
|
972
265
|
component="Label",
|
|
973
266
|
includeGeneralGuidelines=false
|
|
974
267
|
})
|
|
975
268
|
\`\`\`
|
|
976
269
|
|
|
977
|
-
${
|
|
978
|
-
|
|
979
|
-
**IMPORTANT DESIGN EXTRACTION REQUIRMENTS**
|
|
980
|
-
- Use the ${ctx.figmaD2CToolName} tool to extract design information from the provided Figma file URL.
|
|
981
|
-
- Analyze the extracted design information to identify key layout structures, components, styles, and design tokens.
|
|
982
|
-
- Use the insights from the design analysis to inform your implementation in the next phases, ensuring alignment with the original design intent.
|
|
983
|
-
- Follow ALL three extraction steps sequentially \u2014 each step is MANDATORY.
|
|
984
|
-
- Complete the verification checklist after each step before proceeding to the next.
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
**Step 1: Extract Base Design Information from Figma**
|
|
988
|
-
- 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.
|
|
989
|
-
- 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.
|
|
990
|
-
- **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.
|
|
991
|
-
- **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.
|
|
992
|
-
|
|
993
|
-
**Tool call example:**
|
|
994
|
-
\`\`\`
|
|
995
|
-
${ctx.figmaD2CToolName}({
|
|
996
|
-
url: [Figma URL from prompt]
|
|
997
|
-
depth: 10 // Consider more depth only if the user prompt explicitly states to extract deeply.
|
|
998
|
-
})
|
|
999
|
-
\`\`\`
|
|
1000
|
-
|
|
1001
|
-
**Step 1 Completion Checklist (MUST satisfy before proceeding):**
|
|
1002
|
-
- [ ] Have I captured all top-level layout containers (headers, footers, main sections)?
|
|
1003
|
-
- [ ] Have I identified all major structural components?
|
|
1004
|
-
- [ ] Have I created and outputted a structured list of node IDs and their labels?
|
|
1005
|
-
- [ ] Have I visually analyzed the design snapshot to correlate nodes with design elements?
|
|
1006
|
-
|
|
1007
|
-
**Step 2: Extract Main Nodes Design**
|
|
1008
|
-
- 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.
|
|
1009
|
-
- 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.
|
|
1010
|
-
- **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.
|
|
1011
|
-
|
|
1012
|
-
**Tool call example:**
|
|
1013
|
-
\`\`\`
|
|
1014
|
-
${ctx.figmaD2CToolName}({
|
|
1015
|
-
fileKey: [The fileKey extracted from Step 1]
|
|
1016
|
-
nodeIds: [Array of main node IDs identified from Step 1]
|
|
1017
|
-
depth: 10 // Deeper extraction for main nodes to capture necessary details.
|
|
1018
|
-
})
|
|
1019
|
-
\`\`\`
|
|
1020
|
-
|
|
1021
|
-
**Step 2 Completion Checklist (MUST satisfy before proceeding):**
|
|
1022
|
-
- [ ] Have I captured all interactive components (buttons, inputs, navigation elements)?
|
|
1023
|
-
- [ ] Have I identified all typography styles and text elements?
|
|
1024
|
-
- [ ] Have I extracted all color tokens and design system values?
|
|
1025
|
-
- [ ] Have I documented child node IDs that need deeper extraction in Step 3?
|
|
1026
|
-
|
|
1027
|
-
**Step 3: Extract Child Node Details (MANDATORY)**
|
|
1028
|
-
**CRITICAL:** After Step 2, you MUST proceed to Step 3. Extract ALL child nodes identified in Step 2. Do not skip this step.
|
|
1029
|
-
|
|
1030
|
-
- 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.
|
|
1031
|
-
- Use the node IDs from the node-id attribute to fetch these specific child nodes with sufficient depth to capture all critical design details.
|
|
1032
|
-
- **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.
|
|
1033
|
-
|
|
1034
|
-
**Tool call example:**
|
|
1035
|
-
\`\`\`
|
|
1036
|
-
${ctx.figmaD2CToolName}({
|
|
1037
|
-
fileKey: [The fileKey extracted from Step 1]
|
|
1038
|
-
nodeIds: [Array of ALL child node IDs identified from Step 2]
|
|
1039
|
-
depth: 15 // Targeted deeper extraction for specific nodes. Increase if needed.
|
|
1040
|
-
})
|
|
1041
|
-
\`\`\`
|
|
1042
|
-
|
|
1043
|
-
**Step 3 Completion Checklist (MUST satisfy before proceeding):**
|
|
1044
|
-
- [ ] Have I captured ALL leaf-level components (buttons, icons, form inputs)?
|
|
1045
|
-
- [ ] Have I extracted all spacing, padding, and margin values?
|
|
1046
|
-
- [ ] Have I identified all border styles, shadows, and visual effects?
|
|
1047
|
-
- [ ] Are there any remaining truncated nodes? (If yes, apply depth escalation)
|
|
1048
|
-
|
|
1049
|
-
**Iterative Extraction and Stopping Condition**
|
|
1050
|
-
Continue iterating over the extraction process following these rules:
|
|
1051
|
-
- **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.
|
|
1052
|
-
- After each iteration, verify that no new child nodes require deeper extraction.
|
|
1053
|
-
- If depth escalation is needed after 3 passes, document the limitation and proceed with available data.
|
|
1054
|
-
|
|
1055
|
-
**MANDATORY: Design Extraction Verification (Complete BEFORE Code Generation Phase)**
|
|
1056
|
-
Before proceeding to any code generation or implementation phase, you MUST produce and output a verification summary containing:
|
|
1057
|
-
|
|
1058
|
-
1. **Component Inventory:** List all UI components discovered (buttons, inputs, cards, navigation elements, etc.)
|
|
1059
|
-
2. **Hierarchy Map:** Show the parent-child relationships of major layout sections
|
|
1060
|
-
3. **Design Tokens Identified:**
|
|
1061
|
-
- Colors (with hex/rgba values)
|
|
1062
|
-
- Typography (font families, sizes, weights)
|
|
1063
|
-
- Spacing values (margins, paddings, gaps)
|
|
1064
|
-
- Border styles and effects
|
|
1065
|
-
4. **Gaps and Limitations:** Explicitly state any design elements that could not be fully extracted
|
|
1066
|
-
|
|
1067
|
-
**This verification summary serves as the design specification for implementation. Do not proceed to Code Generation until this summary is complete.**
|
|
1068
|
-
|
|
1069
|
-
**Additional Extraction During Implementation:**
|
|
1070
|
-
- 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.
|
|
1071
|
-
- If additional extraction is needed, apply the same depth escalation logic and verification steps.
|
|
1072
|
-
` : ""}
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
${includeLayout ? `
|
|
270
|
+
${o?`
|
|
1076
271
|
### Phase: Layout Foundation
|
|
1077
272
|
|
|
1078
273
|
**Step 1: Create Base Layout Structure**
|
|
@@ -1083,16 +278,16 @@ ${includeLayout ? `
|
|
|
1083
278
|
|
|
1084
279
|
**Tool call example:**
|
|
1085
280
|
\`\`\`
|
|
1086
|
-
${
|
|
281
|
+
${e.layoutAssistantName}({
|
|
1087
282
|
prompt="Provide Kendo Design System utility classes for the following layout structure: [LAYOUT DESCRIPTION HERE]",
|
|
1088
283
|
includeBuildingBlockExamples=true // Optional, include examples of Kendo building blocks (Grid, Flex, Stack, etc.)
|
|
1089
284
|
})
|
|
1090
285
|
\`\`\`
|
|
1091
|
-
|
|
1092
|
-
${
|
|
286
|
+
`:""}
|
|
287
|
+
${e.includeComponentsDocs?`
|
|
1093
288
|
### Phase: Component Integration
|
|
1094
289
|
**Step 1: Identify and Implement Core Components**
|
|
1095
|
-
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:
|
|
1096
291
|
|
|
1097
292
|
**Component Selection Guidelines:**
|
|
1098
293
|
- **Landing Pages**: Consider Button, Card, Form components, Layout containers, Navigation elements
|
|
@@ -1100,17 +295,17 @@ Based on your current goal, analyze what other ${ctx.suiteName} components are n
|
|
|
1100
295
|
- **Data Entry**: Consider Form, TextBox, DatePicker, DropDownList, Upload, Validation components
|
|
1101
296
|
- **Content Management**: Consider Grid, Editor, TreeView, FileManager, Dialog components
|
|
1102
297
|
- **E-commerce**: Consider ListView, Card, Button, Rating, Badge, Carousel components
|
|
1103
|
-
${
|
|
298
|
+
${s}
|
|
1104
299
|
|
|
1105
300
|
**IMPORTANT COMPONENT USAGE REQUIREMENTS:**
|
|
1106
|
-
- Make sure to identify all necessary features related to the ${
|
|
1107
|
-
- Make sure to identify specific features needed for other ${
|
|
1108
|
-
- Make sure to generate a query for ${
|
|
301
|
+
- Make sure to identify all necessary features related to the ${i} 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.
|
|
1109
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.
|
|
1110
305
|
|
|
1111
306
|
**Tool call examples:**
|
|
1112
307
|
\`\`\`
|
|
1113
|
-
${
|
|
308
|
+
${e.codeAssistantName}({
|
|
1114
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' -->
|
|
1115
310
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', 'Chart', etc. -->
|
|
1116
311
|
})
|
|
@@ -1118,33 +313,33 @@ ${dragDropGuidance}
|
|
|
1118
313
|
|
|
1119
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:
|
|
1120
315
|
\`\`\`
|
|
1121
|
-
${
|
|
316
|
+
${e.codeAssistantName}({
|
|
1122
317
|
query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'paging in Grid' -->
|
|
1123
318
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
|
|
1124
319
|
})
|
|
1125
320
|
\`\`\`
|
|
1126
321
|
|
|
1127
322
|
\`\`\`
|
|
1128
|
-
${
|
|
323
|
+
${e.codeAssistantName}({
|
|
1129
324
|
query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'sorting in Grid' -->
|
|
1130
325
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
|
|
1131
326
|
})
|
|
1132
327
|
\`\`\`
|
|
1133
328
|
|
|
1134
329
|
\`\`\`
|
|
1135
|
-
${
|
|
330
|
+
${e.codeAssistantName}({
|
|
1136
331
|
query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'filtering in Grid' -->
|
|
1137
332
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
|
|
1138
333
|
})
|
|
1139
334
|
\`\`\`
|
|
1140
|
-
|
|
1141
|
-
${
|
|
335
|
+
`:""}
|
|
336
|
+
${e.includeResponsive?`
|
|
1142
337
|
### Phase: Layout Responsive Finalization
|
|
1143
338
|
|
|
1144
339
|
**Step 1: Implement Responsive Behavior**
|
|
1145
|
-
${
|
|
340
|
+
${a}${d}${p}`:""}
|
|
1146
341
|
|
|
1147
|
-
${
|
|
342
|
+
${e.includeTheming?`
|
|
1148
343
|
**Step 2: Custom Theme Implementation**
|
|
1149
344
|
|
|
1150
345
|
**CUSTOM THEME REQUIREMENTS:**
|
|
@@ -1154,13 +349,13 @@ ${ctx.includeTheming ? `
|
|
|
1154
349
|
|
|
1155
350
|
**Tool call example:**
|
|
1156
351
|
\`\`\`
|
|
1157
|
-
${
|
|
352
|
+
${e.styleAssistantName}({
|
|
1158
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.",
|
|
1159
354
|
includeThemeVariables=true // Optional, include specific CSS variables for colors, typography, spacing, etc.
|
|
1160
355
|
})
|
|
1161
356
|
\`\`\`
|
|
1162
|
-
|
|
1163
|
-
${
|
|
357
|
+
`:""}
|
|
358
|
+
${e.includeIcons?`
|
|
1164
359
|
**Step 3: Iconography and Visual Enhancements**
|
|
1165
360
|
|
|
1166
361
|
**ICONOGRAPHY GUIDELINES:**
|
|
@@ -1170,64 +365,61 @@ ${ctx.includeIcons ? `
|
|
|
1170
365
|
|
|
1171
366
|
**Tool call example:**
|
|
1172
367
|
\`\`\`
|
|
1173
|
-
${
|
|
368
|
+
${e.iconAssistantName}({
|
|
1174
369
|
query="Suggest icons that fit the theme and purpose of the following current goal: [CURRENT GOAL HERE]. Provide icon names and usage context.",
|
|
1175
370
|
})
|
|
1176
371
|
\`\`\`
|
|
1177
|
-
|
|
372
|
+
`:""}
|
|
1178
373
|
### Phase: Code Generation
|
|
1179
374
|
**IMPORTANT:** Do NOT generate ANY code or create files until ALL information gathering phases (1-3) are complete.
|
|
1180
375
|
**Step 1: Generate Complete Implementation**
|
|
1181
|
-
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:
|
|
1182
377
|
**Code Generation Requirements:**
|
|
1183
|
-
- Create complete, functional ${
|
|
1184
|
-
- Include all identified ${
|
|
378
|
+
- Create complete, functional ${e.libKey} components/pages
|
|
379
|
+
- Include all identified ${e.suiteName} components with their configurations
|
|
1185
380
|
- Apply ALL Kendo Design System utility classes gathered from layout assistant
|
|
1186
381
|
- Implement proper component event handling and data binding
|
|
1187
382
|
- Ensure responsive behavior using Kendo utility classes
|
|
1188
383
|
- Include necessary import statements and dependencies
|
|
1189
384
|
|
|
1190
|
-
${
|
|
385
|
+
${t.injectedPlan??""}
|
|
1191
386
|
|
|
1192
387
|
### Phase: Validation and Finalization
|
|
1193
388
|
|
|
1194
389
|
**Step 1: Code Validation**
|
|
1195
390
|
** CRITICAL REQUIREMENT: You MUST validate the generated UI code using this comprehensive checklist to ensure code quality and compliance:**
|
|
1196
391
|
|
|
1197
|
-
${
|
|
392
|
+
${n}
|
|
1198
393
|
|
|
1199
394
|
**Step 2: Final Review and Testing**
|
|
1200
395
|
** Implementation Validation:**
|
|
1201
|
-
${
|
|
1202
|
-
-
|
|
1203
|
-
-
|
|
1204
|
-
|
|
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":""}
|
|
1205
401
|
|
|
1206
402
|
**Quick Fixes (if needed):**
|
|
1207
403
|
|
|
1208
404
|
After code implementation and validation you can make quick fixes as needed:
|
|
1209
|
-
-
|
|
1210
|
-
- 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
|
|
1211
408
|
|
|
1212
409
|
+### Before You Begin
|
|
1213
|
-
- 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.
|
|
1214
411
|
- Do NOT generate or suggest any code until all tools have been used and validated responses are incorporated.
|
|
1215
412
|
- Focus on planning and sequencing.
|
|
1216
413
|
- Summarize the components, layouts, and utilities gathered.
|
|
1217
|
-
- Confirm all required inputs from tools have been provided
|
|
1218
|
-
};
|
|
1219
|
-
|
|
1220
|
-
// packages/kendo-ui-agent/src/lib/templates/assistant-orchestrator.ts
|
|
1221
|
-
var renderAssistantOrchestratorResponse = (ctx) => {
|
|
1222
|
-
return `# ${ctx.suiteName} Assistant
|
|
414
|
+
- Confirm all required inputs from tools have been provided.`};var H=e=>`# ${e.suiteName} Assistant
|
|
1223
415
|
|
|
1224
416
|
**What you're looking for:**
|
|
1225
417
|
|
|
1226
|
-
${
|
|
418
|
+
${e.userIntent}
|
|
1227
419
|
|
|
1228
420
|
**Available Tools:**
|
|
1229
|
-
- **${
|
|
1230
|
-
- **${
|
|
421
|
+
- **${e.codeAssistantName}** - Get component documentation, features, and usage examples
|
|
422
|
+
- **${e.iconAssistantName}** - Search for icons from the Kendo icon library
|
|
1231
423
|
|
|
1232
424
|
---
|
|
1233
425
|
|
|
@@ -1237,7 +429,7 @@ Follow these steps to find the right components and resources:
|
|
|
1237
429
|
|
|
1238
430
|
### Step 1: Identify Components
|
|
1239
431
|
|
|
1240
|
-
Based on your needs, consider these ${
|
|
432
|
+
Based on your needs, consider these ${e.suiteName} component categories:
|
|
1241
433
|
|
|
1242
434
|
**Common Use Cases:**
|
|
1243
435
|
- **Data Display**: Grid, ListView, TreeView, Card, TileLayout
|
|
@@ -1250,10 +442,10 @@ Based on your needs, consider these ${ctx.suiteName} component categories:
|
|
|
1250
442
|
|
|
1251
443
|
**How to explore components:**
|
|
1252
444
|
|
|
1253
|
-
Use the ${
|
|
445
|
+
Use the ${e.codeAssistantName} tool to learn about specific components:
|
|
1254
446
|
|
|
1255
447
|
\`\`\`
|
|
1256
|
-
${
|
|
448
|
+
${e.codeAssistantName}({
|
|
1257
449
|
query: "What are the main features of [COMPONENT_NAME]?",
|
|
1258
450
|
component: "[COMPONENT_NAME]"
|
|
1259
451
|
})
|
|
@@ -1261,14 +453,14 @@ ${ctx.codeAssistantName}({
|
|
|
1261
453
|
|
|
1262
454
|
**Examples:**
|
|
1263
455
|
\`\`\`
|
|
1264
|
-
${
|
|
456
|
+
${e.codeAssistantName}({
|
|
1265
457
|
query: "How to use Grid with paging and sorting?",
|
|
1266
458
|
component: "Grid"
|
|
1267
459
|
})
|
|
1268
460
|
\`\`\`
|
|
1269
461
|
|
|
1270
462
|
\`\`\`
|
|
1271
|
-
${
|
|
463
|
+
${e.codeAssistantName}({
|
|
1272
464
|
query: "What features does DatePicker have?",
|
|
1273
465
|
component: "DatePicker"
|
|
1274
466
|
})
|
|
@@ -1279,37 +471,37 @@ ${ctx.codeAssistantName}({
|
|
|
1279
471
|
- Break complex queries into multiple calls focusing on one feature at a time
|
|
1280
472
|
- Specify the exact component name in the component parameter
|
|
1281
473
|
|
|
1282
|
-
${
|
|
474
|
+
${e.includeIcons?`
|
|
1283
475
|
### Step 2: Find Icons
|
|
1284
476
|
|
|
1285
|
-
Use the ${
|
|
477
|
+
Use the ${e.iconAssistantName} tool to search for icons:
|
|
1286
478
|
|
|
1287
479
|
\`\`\`
|
|
1288
|
-
${
|
|
480
|
+
${e.iconAssistantName}({
|
|
1289
481
|
query: "Search for icons related to [YOUR THEME/PURPOSE]"
|
|
1290
482
|
})
|
|
1291
483
|
\`\`\`
|
|
1292
484
|
|
|
1293
485
|
**Examples:**
|
|
1294
486
|
\`\`\`
|
|
1295
|
-
${
|
|
487
|
+
${e.iconAssistantName}({
|
|
1296
488
|
query: "icons for navigation menu"
|
|
1297
489
|
})
|
|
1298
490
|
\`\`\`
|
|
1299
491
|
|
|
1300
492
|
\`\`\`
|
|
1301
|
-
${
|
|
493
|
+
${e.iconAssistantName}({
|
|
1302
494
|
query: "icons for user actions like edit, delete, save"
|
|
1303
495
|
})
|
|
1304
496
|
\`\`\`
|
|
1305
|
-
|
|
497
|
+
`:""}
|
|
1306
498
|
|
|
1307
499
|
### Step 3: Review and Implement
|
|
1308
500
|
|
|
1309
501
|
After gathering information:
|
|
1310
|
-
1. Review the component documentation provided by ${
|
|
1311
|
-
2. Check which icons are available from ${
|
|
1312
|
-
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
|
|
1313
505
|
4. Refer to the component examples and code snippets provided
|
|
1314
506
|
|
|
1315
507
|
---
|
|
@@ -1317,44 +509,33 @@ After gathering information:
|
|
|
1317
509
|
## Getting Started
|
|
1318
510
|
|
|
1319
511
|
**Next Actions:**
|
|
1320
|
-
1. Start by calling ${
|
|
1321
|
-
2. ${
|
|
1322
|
-
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
|
|
1323
515
|
|
|
1324
516
|
**Important Notes:**
|
|
1325
517
|
- These tools provide documentation and guidance, not code generation
|
|
1326
|
-
- Always refer to official ${
|
|
1327
|
-
- Tool responses include usage examples and best practices`;
|
|
1328
|
-
};
|
|
1329
|
-
|
|
1330
|
-
// packages/kendo-ui-agent/src/lib/templates/shared-validation.ts
|
|
1331
|
-
var getSharedValidationSteps = (uiLibrary, designSystem) => ({
|
|
1332
|
-
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:`
|
|
1333
520
|
UI Library Setup:
|
|
1334
|
-
- ${
|
|
1335
|
-
- ${
|
|
1336
|
-
- ${
|
|
1337
|
-
- Globalization and localization properly configured for ${
|
|
1338
|
-
- Required ${
|
|
1339
|
-
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:`
|
|
1340
526
|
Performance Optimization:
|
|
1341
527
|
- Efficient rendering patterns to prevent unnecessary re-renders
|
|
1342
|
-
- Lazy loading of ${
|
|
1343
|
-
- Virtualization enabled for large datasets in ${
|
|
1344
|
-
- Only required ${
|
|
1345
|
-
|
|
1346
|
-
${
|
|
1347
|
-
- 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
|
|
1348
533
|
- Avoid custom CSS or other framework classes
|
|
1349
534
|
- Do not use inline styles
|
|
1350
|
-
- Consistent ${
|
|
535
|
+
- Consistent ${e} theme application across all components
|
|
1351
536
|
- Custom theme variables properly defined and scoped
|
|
1352
|
-
- ${
|
|
1353
|
-
- Brand colors integrated with ${
|
|
1354
|
-
});
|
|
1355
|
-
|
|
1356
|
-
// packages/kendo-ui-agent/src/lib/templates/tailwind-bridge.ts
|
|
1357
|
-
var kendoTokenList = `--kendo-color-app-surface
|
|
537
|
+
- ${e} icon fonts properly loaded and optimized
|
|
538
|
+
- Brand colors integrated with ${e} component themes`});var wt=`--kendo-color-app-surface
|
|
1358
539
|
--kendo-color-on-app-surface
|
|
1359
540
|
--kendo-color-subtle
|
|
1360
541
|
--kendo-color-surface
|
|
@@ -1540,8 +721,7 @@ var kendoTokenList = `--kendo-color-app-surface
|
|
|
1540
721
|
--kendo-border-radius-xxl
|
|
1541
722
|
--kendo-border-radius-xxxl
|
|
1542
723
|
--radius-4xl: 1.5rem
|
|
1543
|
-
--kendo-border-radius-full
|
|
1544
|
-
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`,ve=`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.
|
|
1545
725
|
Requirements:
|
|
1546
726
|
|
|
1547
727
|
All design tokens (colors, spacing, font families, border radius, shadows) are defined once in tailwind.config.js
|
|
@@ -1556,8 +736,7 @@ Output I need:
|
|
|
1556
736
|
|
|
1557
737
|
The full tailwind.config.js with the plugin included
|
|
1558
738
|
The base CSS file importing Tailwind
|
|
1559
|
-
A short example showing a component using both bg-primary and var(--color-primary) side by side
|
|
1560
|
-
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`,ke=`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.
|
|
1561
740
|
Requirements:
|
|
1562
741
|
|
|
1563
742
|
All design tokens (colors, spacing, font families, border radius, shadows) are defined once in the @theme block \u2014 no tailwind.config.js
|
|
@@ -1571,1271 +750,144 @@ Use the Kendo theme tokens listed above as the design tokens.
|
|
|
1571
750
|
Output I need:
|
|
1572
751
|
|
|
1573
752
|
The single CSS file with @import "tailwindcss", the @theme block, and the .dark overrides
|
|
1574
|
-
A short example showing a component using both bg-primary and var(--color-primary) side by side
|
|
1575
|
-
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
|
|
1576
754
|
|
|
1577
755
|
Detect which version of Tailwind CSS the project uses, then follow the appropriate setup guide below.
|
|
1578
756
|
|
|
1579
757
|
### Kendo Theme Tokens
|
|
1580
758
|
These are the design tokens to map into Tailwind:
|
|
1581
|
-
${
|
|
759
|
+
${wt}
|
|
1582
760
|
|
|
1583
761
|
### For Tailwind CSS v3 (uses tailwind.config.js)
|
|
1584
762
|
|
|
1585
763
|
<tailwind_v3_setup>
|
|
1586
|
-
${
|
|
764
|
+
${ve}
|
|
1587
765
|
</tailwind_v3_setup>
|
|
1588
766
|
|
|
1589
767
|
### For Tailwind CSS v4 (uses @theme block, no config file)
|
|
1590
768
|
|
|
1591
769
|
<tailwind_v4_setup>
|
|
1592
|
-
${
|
|
770
|
+
${ke}
|
|
1593
771
|
</tailwind_v4_setup>
|
|
1594
772
|
|
|
1595
|
-
IMPORTANT: Detect which version of Tailwind CSS the project uses, then follow the matching setup guide.`;
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
data = JSON.parse(rawValue);
|
|
1602
|
-
} catch {
|
|
1603
|
-
return rawValue;
|
|
1604
|
-
}
|
|
1605
|
-
const item = data?.Item;
|
|
1606
|
-
if (!item) {
|
|
1607
|
-
return rawValue;
|
|
1608
|
-
}
|
|
1609
|
-
const sectionParts = [];
|
|
1610
|
-
const name = item.FullName ?? item.Name ?? "";
|
|
1611
|
-
const type = item.Type ?? "";
|
|
1612
|
-
const summary = item.Summary ?? "";
|
|
1613
|
-
const syntax = item.SyntaxContent ?? "";
|
|
1614
|
-
sectionParts.push(
|
|
1615
|
-
`## API Reference Item
|
|
1616
|
-
- Name: ${name}
|
|
1617
|
-
- Type: ${type}
|
|
1618
|
-
- Summary: ${summary}
|
|
1619
|
-
- Syntax: ${syntax}`
|
|
1620
|
-
);
|
|
1621
|
-
const returnTypeItems = data.RelatedItemsByType?.["return_type"];
|
|
1622
|
-
if (returnTypeItems?.length) {
|
|
1623
|
-
const returnType = returnTypeItems[0].Text;
|
|
1624
|
-
if (returnType) {
|
|
1625
|
-
sectionParts.push(`- Return Type: ${returnType}`);
|
|
1626
|
-
}
|
|
1627
|
-
}
|
|
1628
|
-
const examples = item.Examples ?? [];
|
|
1629
|
-
if (examples.length > 0) {
|
|
1630
|
-
let exampleSection = "## Examples\n";
|
|
1631
|
-
let exampleIndex = 0;
|
|
1632
|
-
for (const example of examples) {
|
|
1633
|
-
const exComponent = (example.Component ?? "").toLowerCase();
|
|
1634
|
-
const compLower = component.toLowerCase();
|
|
1635
|
-
if (exComponent && exComponent !== compLower && exComponent !== "general") {
|
|
1636
|
-
continue;
|
|
1637
|
-
}
|
|
1638
|
-
exampleIndex += 1;
|
|
1639
|
-
const code = example.Code ?? "";
|
|
1640
|
-
exampleSection += `### Example ${exampleIndex}
|
|
773
|
+
IMPORTANT: Detect which version of Tailwind CSS the project uses, then follow the matching setup guide.`;function Tt(e,t){let n;try{n=JSON.parse(e)}catch{return e}let o=n?.Item;if(!o)return e;let s=[],i=o.FullName??o.Name??"",r=o.Type??"",a=o.Summary??"",d=o.SyntaxContent??"";s.push(`## API Reference Item
|
|
774
|
+
- Name: ${i}
|
|
775
|
+
- Type: ${r}
|
|
776
|
+
- Summary: ${a}
|
|
777
|
+
- Syntax: ${d}`);let p=n.RelatedItemsByType?.return_type;if(p?.length){let u=p[0].Text;u&&s.push(`- Return Type: ${u}`)}let b=o.Examples??[];if(b.length>0){let u=`## Examples
|
|
778
|
+
`,l=0;for(let y of b){let A=(y.Component??"").toLowerCase(),C=t.toLowerCase();if(A&&A!==C&&A!=="general")continue;l+=1;let w=y.Code??"";u+=`### Example ${l}
|
|
1641
779
|
\`\`\`
|
|
1642
|
-
${
|
|
780
|
+
${w}
|
|
1643
781
|
\`\`\`
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
for (const [relationType, relatedItems] of Object.entries(related)) {
|
|
1653
|
-
if (relationType === "return_type" || relationType === "render_fragment") {
|
|
1654
|
-
continue;
|
|
1655
|
-
}
|
|
1656
|
-
for (const relatedItem of relatedItems ?? []) {
|
|
1657
|
-
const fullName = relatedItem.FullName ?? "";
|
|
1658
|
-
const shortText = relatedItem.ShortText ?? "";
|
|
1659
|
-
additionalContextItems.push(`### ${fullName} (${relationType})
|
|
1660
|
-
${shortText}`);
|
|
1661
|
-
}
|
|
1662
|
-
}
|
|
1663
|
-
if (additionalContextItems.length > 0) {
|
|
1664
|
-
sectionParts.push("## Additional Context\n" + additionalContextItems.join("\n---\n"));
|
|
1665
|
-
}
|
|
1666
|
-
return sectionParts.join("\n\n");
|
|
1667
|
-
}
|
|
1668
|
-
var LAYOUT_MODE = process.env.KENDO_UIA_LAYOUT_MODE || "utils";
|
|
1669
|
-
function createOrchestratorTool(config, templateOptions, contextApi2) {
|
|
1670
|
-
const {
|
|
1671
|
-
name,
|
|
1672
|
-
title,
|
|
1673
|
-
description,
|
|
1674
|
-
layoutAssistantName: layoutAssistantName2,
|
|
1675
|
-
codeAssistantName: codeAssistantName2,
|
|
1676
|
-
styleAssistantName: styleAssistantName2,
|
|
1677
|
-
iconAssistantName: iconAssistantName2,
|
|
1678
|
-
accessibilityAssistantName: accessibilityAssistantName2,
|
|
1679
|
-
figmaD2CToolName: figmaD2CToolName2,
|
|
1680
|
-
suiteName,
|
|
1681
|
-
libKey,
|
|
1682
|
-
components
|
|
1683
|
-
} = config;
|
|
1684
|
-
const tool = new UIAgentTool(
|
|
1685
|
-
name,
|
|
1686
|
-
{
|
|
1687
|
-
title,
|
|
1688
|
-
description,
|
|
1689
|
-
requiredAccess: config.requiredAccess,
|
|
1690
|
-
inputSchema: {
|
|
1691
|
-
userIntent: z4.string().describe(
|
|
1692
|
-
`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.`
|
|
1693
|
-
),
|
|
1694
|
-
needsComponentsDocsConfidence: z4.number().min(0).max(1).default(1).describe(
|
|
1695
|
-
"Confidence (0-1) to include Component Documentation assistance. Default is 1."
|
|
1696
|
-
),
|
|
1697
|
-
needsLayoutConfidence: z4.number().min(0).max(1).default(0).describe(
|
|
1698
|
-
"Confidence (0-1) to include Layout assistance. Default is 0."
|
|
1699
|
-
),
|
|
1700
|
-
needsStylingConfidence: z4.number().min(0).max(1).default(0).describe(
|
|
1701
|
-
"Confidence (0-1) to include Theming/Styling assistance. Default is 0."
|
|
1702
|
-
),
|
|
1703
|
-
needsResponsiveBehaviorConfidence: z4.number().min(0).max(1).default(0).describe(
|
|
1704
|
-
"Confidence (0-1) to include Responsive Behavior assistance. Default is 0."
|
|
1705
|
-
),
|
|
1706
|
-
needsIconsConfidence: z4.number().min(0).max(1).default(0).describe(
|
|
1707
|
-
"Confidence (0-1) to include Icons assistance. Default is 0."
|
|
1708
|
-
),
|
|
1709
|
-
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),
|
|
1710
|
-
componentsNeeded: z4.array(z4.enum(components)).optional().describe(
|
|
1711
|
-
`Optional list of specific ${suiteName} components needed for the project.`
|
|
1712
|
-
)
|
|
1713
|
-
}
|
|
1714
|
-
},
|
|
1715
|
-
async ({
|
|
1716
|
-
userIntent,
|
|
1717
|
-
needsComponentsDocsConfidence,
|
|
1718
|
-
needsLayoutConfidence,
|
|
1719
|
-
needsStylingConfidence,
|
|
1720
|
-
needsResponsiveBehaviorConfidence,
|
|
1721
|
-
needsIconsConfidence,
|
|
1722
|
-
needsFigmaD2CConfidence,
|
|
1723
|
-
componentsNeeded
|
|
1724
|
-
}, { _meta }) => {
|
|
1725
|
-
log("UI Orchestrator called with:", {
|
|
1726
|
-
userIntent,
|
|
1727
|
-
needsComponentsDocsConfidence,
|
|
1728
|
-
needsLayoutConfidence,
|
|
1729
|
-
needsStylingConfidence,
|
|
1730
|
-
needsResponsiveBehaviorConfidence,
|
|
1731
|
-
needsIconsConfidence
|
|
1732
|
-
});
|
|
1733
|
-
try {
|
|
1734
|
-
await contextApi2.recordOrchestratorUserRequest({
|
|
1735
|
-
meta: {
|
|
1736
|
-
userIntent,
|
|
1737
|
-
componentsNeeded,
|
|
1738
|
-
_meta
|
|
1739
|
-
}
|
|
1740
|
-
});
|
|
1741
|
-
} catch (error) {
|
|
1742
|
-
throw getGrpcError(error);
|
|
1743
|
-
}
|
|
1744
|
-
const clientCapabilities = tool.server?.server.getClientCapabilities?.();
|
|
1745
|
-
const supportsElicitation = clientCapabilities?.elicitation;
|
|
1746
|
-
let forceIncludeCustomTheming;
|
|
1747
|
-
if (supportsElicitation && needsStylingConfidence > 0.3 && needsStylingConfidence <= 0.6) {
|
|
1748
|
-
const result = await tool.server?.server.elicitInput({
|
|
1749
|
-
message: "I was unable to determine if you need custom Kendo Theme assistant. Can you please confirm?",
|
|
1750
|
-
requestedSchema: {
|
|
1751
|
-
type: "object",
|
|
1752
|
-
properties: {
|
|
1753
|
-
includeCustomTheming: {
|
|
1754
|
-
type: "boolean",
|
|
1755
|
-
description: "Whether to include Custom Theming assistance in the workflow."
|
|
1756
|
-
}
|
|
1757
|
-
},
|
|
1758
|
-
required: ["includeCustomTheming"]
|
|
1759
|
-
}
|
|
1760
|
-
});
|
|
1761
|
-
if (result?.action === "accept" && result.content?.includeCustomTheming) {
|
|
1762
|
-
forceIncludeCustomTheming = true;
|
|
1763
|
-
}
|
|
1764
|
-
}
|
|
1765
|
-
const response = renderOrchestratorResponse(
|
|
1766
|
-
{
|
|
1767
|
-
name,
|
|
1768
|
-
userIntent,
|
|
1769
|
-
includeComponentsDocs: needsComponentsDocsConfidence > 0.3,
|
|
1770
|
-
includeTheming: needsStylingConfidence > 0.6 || !!forceIncludeCustomTheming,
|
|
1771
|
-
includeLayout: needsLayoutConfidence > 0.5,
|
|
1772
|
-
includeIcons: needsIconsConfidence > 0.6,
|
|
1773
|
-
includeResponsive: needsLayoutConfidence > 0.5 && needsResponsiveBehaviorConfidence > 0.4,
|
|
1774
|
-
includeFigmaD2C: needsFigmaD2CConfidence,
|
|
1775
|
-
layoutAssistantName: layoutAssistantName2,
|
|
1776
|
-
codeAssistantName: codeAssistantName2,
|
|
1777
|
-
styleAssistantName: styleAssistantName2,
|
|
1778
|
-
iconAssistantName: iconAssistantName2,
|
|
1779
|
-
accessibilityAssistantName: accessibilityAssistantName2,
|
|
1780
|
-
figmaD2CToolName: figmaD2CToolName2,
|
|
1781
|
-
suiteName,
|
|
1782
|
-
libKey,
|
|
1783
|
-
layoutMode: LAYOUT_MODE,
|
|
1784
|
-
components: componentsNeeded
|
|
1785
|
-
},
|
|
1786
|
-
templateOptions
|
|
1787
|
-
);
|
|
1788
|
-
return {
|
|
1789
|
-
content: [
|
|
1790
|
-
{
|
|
1791
|
-
type: "text",
|
|
1792
|
-
text: response
|
|
1793
|
-
}
|
|
1794
|
-
]
|
|
1795
|
-
};
|
|
1796
|
-
}
|
|
1797
|
-
);
|
|
1798
|
-
return tool;
|
|
1799
|
-
}
|
|
1800
|
-
function createAssistantOrchestratorTool(config, contextApi2) {
|
|
1801
|
-
const {
|
|
1802
|
-
name,
|
|
1803
|
-
title,
|
|
1804
|
-
description,
|
|
1805
|
-
iconAssistantName: iconAssistantName2,
|
|
1806
|
-
codeAssistantName: codeAssistantName2,
|
|
1807
|
-
suiteName,
|
|
1808
|
-
libKey,
|
|
1809
|
-
components
|
|
1810
|
-
} = config;
|
|
1811
|
-
const tool = new UIAgentTool(
|
|
1812
|
-
name,
|
|
1813
|
-
{
|
|
1814
|
-
title,
|
|
1815
|
-
description,
|
|
1816
|
-
inputSchema: {
|
|
1817
|
-
userIntent: z4.string().describe(
|
|
1818
|
-
`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}.`
|
|
1819
|
-
),
|
|
1820
|
-
needsIconsConfidence: z4.number().min(0).max(1).default(0.7).describe(
|
|
1821
|
-
"Confidence (0-1) to include Icons assistance. Default is 0.7."
|
|
1822
|
-
),
|
|
1823
|
-
componentsNeeded: z4.array(z4.enum(components)).optional().describe(
|
|
1824
|
-
`Optional list of specific ${suiteName} components you want to learn about.`
|
|
1825
|
-
)
|
|
1826
|
-
},
|
|
1827
|
-
requiredAccess: config.requiredAccess
|
|
1828
|
-
},
|
|
1829
|
-
async ({
|
|
1830
|
-
userIntent,
|
|
1831
|
-
needsIconsConfidence,
|
|
1832
|
-
componentsNeeded
|
|
1833
|
-
}, { _meta }) => {
|
|
1834
|
-
log("Assistant Orchestrator called with:", {
|
|
1835
|
-
userIntent,
|
|
1836
|
-
needsIconsConfidence,
|
|
1837
|
-
componentsNeeded
|
|
1838
|
-
});
|
|
1839
|
-
try {
|
|
1840
|
-
await contextApi2.recordOrchestratorUserRequest({
|
|
1841
|
-
meta: {
|
|
1842
|
-
userIntent,
|
|
1843
|
-
componentsNeeded,
|
|
1844
|
-
_meta
|
|
1845
|
-
}
|
|
1846
|
-
});
|
|
1847
|
-
} catch (error) {
|
|
1848
|
-
throw getGrpcError(error);
|
|
1849
|
-
}
|
|
1850
|
-
const response = renderAssistantOrchestratorResponse({
|
|
1851
|
-
name,
|
|
1852
|
-
userIntent,
|
|
1853
|
-
includeComponentsDocs: true,
|
|
1854
|
-
// Always true for assistant mode
|
|
1855
|
-
includeIcons: needsIconsConfidence > 0.5,
|
|
1856
|
-
codeAssistantName: codeAssistantName2,
|
|
1857
|
-
iconAssistantName: iconAssistantName2,
|
|
1858
|
-
suiteName,
|
|
1859
|
-
libKey,
|
|
1860
|
-
components: componentsNeeded
|
|
1861
|
-
});
|
|
1862
|
-
return {
|
|
1863
|
-
content: [
|
|
1864
|
-
{
|
|
1865
|
-
type: "text",
|
|
1866
|
-
text: response
|
|
1867
|
-
}
|
|
1868
|
-
]
|
|
1869
|
-
};
|
|
1870
|
-
}
|
|
1871
|
-
);
|
|
1872
|
-
return tool;
|
|
1873
|
-
}
|
|
1874
|
-
function createLayoutAssistantTool(config, contextApi2) {
|
|
1875
|
-
const {
|
|
1876
|
-
name,
|
|
1877
|
-
title,
|
|
1878
|
-
description,
|
|
1879
|
-
suiteName: _suiteName,
|
|
1880
|
-
libKey,
|
|
1881
|
-
getPreContent
|
|
1882
|
-
} = config;
|
|
1883
|
-
return new UIAgentTool(
|
|
1884
|
-
name,
|
|
1885
|
-
{
|
|
1886
|
-
title,
|
|
1887
|
-
description,
|
|
1888
|
-
requiredAccess: LAYOUT_MODE === "utils" ? config.requiredAccess : ["none"],
|
|
1889
|
-
inputSchema: {
|
|
1890
|
-
prompt: z4.string().describe(
|
|
1891
|
-
`An enhanced prompt describing the HTML layout structure, design requirements or specific visual effects you want to achieve.`
|
|
1892
|
-
),
|
|
1893
|
-
includeBuildingBlockExamples: z4.boolean().describe(
|
|
1894
|
-
"Whether to include building block examples. Defaults to false."
|
|
1895
|
-
).default(false)
|
|
1896
|
-
}
|
|
1897
|
-
},
|
|
1898
|
-
async ({ prompt, includeBuildingBlockExamples }, { _meta }) => {
|
|
1899
|
-
log("Layout Assistant called with:", {
|
|
1900
|
-
prompt,
|
|
1901
|
-
includeBuildingBlockExamples
|
|
1902
|
-
});
|
|
1903
|
-
try {
|
|
1904
|
-
const cssResponse = await contextApi2.queryCssUtils({ query: prompt }, { _meta });
|
|
1905
|
-
let finalMarkdown = cssResponse.values.join("\n") || "No CSS utilities found for the given prompt.";
|
|
1906
|
-
const preContent = getPreContent?.() ?? "";
|
|
1907
|
-
const buildLayout = (buildingBlockMd) => {
|
|
1908
|
-
return `${preContent}
|
|
782
|
+
`}l>0&&s.push(u)}let g=n.RelatedItemsByType??{},f=[];for(let[u,l]of Object.entries(g))if(!(u==="return_type"||u==="render_fragment"))for(let y of l??[]){let A=y.FullName??"",C=y.ShortText??"";f.push(`### ${A} (${u})
|
|
783
|
+
${C}`)}return f.length>0&&s.push(`## Additional Context
|
|
784
|
+
`+f.join(`
|
|
785
|
+
---
|
|
786
|
+
`)),s.join(`
|
|
787
|
+
|
|
788
|
+
`)}var W=process.env.KENDO_UIA_LAYOUT_MODE||"utils";function Ae(e,t,n){let{name:o,title:s,description:i,layoutAssistantName:r,codeAssistantName:a,styleAssistantName:d,iconAssistantName:p,accessibilityAssistantName:b,suiteName:g,libKey:f,components:u}=e,l=new S(o,{title:s,description:i,requiredAccess:e.requiredAccess,inputSchema:{userIntent:v.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 ${g} components you want to use.`),needsComponentsDocsConfidence:v.number().min(0).max(1).default(1).describe("Confidence (0-1) to include Component Documentation assistance. Default is 1."),needsLayoutConfidence:v.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Layout assistance. Default is 0."),needsStylingConfidence:v.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Theming/Styling assistance. Default is 0."),needsResponsiveBehaviorConfidence:v.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Responsive Behavior assistance. Default is 0."),needsIconsConfidence:v.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Icons assistance. Default is 0."),componentsNeeded:v.array(v.enum(u)).optional().describe(`Optional list of specific ${g} components needed for the project.`)}},async({userIntent:y,needsComponentsDocsConfidence:A,needsLayoutConfidence:C,needsStylingConfidence:w,needsResponsiveBehaviorConfidence:I,needsIconsConfidence:se,componentsNeeded:re},{_meta:st})=>{h("UI Orchestrator called with:",{userIntent:y,needsComponentsDocsConfidence:A,needsLayoutConfidence:C,needsStylingConfidence:w,needsResponsiveBehaviorConfidence:I,needsIconsConfidence:se});try{await n.recordOrchestratorUserRequest({meta:{userIntent:y,componentsNeeded:re,_meta:st}})}catch(_){throw R(_)}let rt=l.server?.server.getClientCapabilities?.()?.elicitation,ie;if(rt&&w>.3&&w<=.6){let _=await l.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&&(ie=!0)}return{content:[{type:"text",text:U({name:o,userIntent:y,includeComponentsDocs:A>.3,includeTheming:w>.6||!!ie,includeLayout:C>.5,includeIcons:se>.6,includeResponsive:C>.5&&I>.4,layoutAssistantName:r,codeAssistantName:a,styleAssistantName:d,iconAssistantName:p,accessibilityAssistantName:b,suiteName:g,libKey:f,layoutMode:W,components:re},t)}]}});return l}function Ce(e,t){let{name:n,title:o,description:s,iconAssistantName:i,codeAssistantName:r,suiteName:a,libKey:d,components:p}=e;return new S(n,{title:o,description:s,inputSchema:{userIntent:v.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 ${a}.`),needsIconsConfidence:v.number().min(0).max(1).default(.7).describe("Confidence (0-1) to include Icons assistance. Default is 0.7."),componentsNeeded:v.array(v.enum(p)).optional().describe(`Optional list of specific ${a} components you want to learn about.`)},requiredAccess:e.requiredAccess},async({userIntent:g,needsIconsConfidence:f,componentsNeeded:u},{_meta:l})=>{h("Assistant Orchestrator called with:",{userIntent:g,needsIconsConfidence:f,componentsNeeded:u});try{await t.recordOrchestratorUserRequest({meta:{userIntent:g,componentsNeeded:u,_meta:l}})}catch(A){throw R(A)}return{content:[{type:"text",text:H({name:n,userIntent:g,includeComponentsDocs:!0,includeIcons:f>.5,codeAssistantName:r,iconAssistantName:i,suiteName:a,libKey:d,components:u})}]}})}function Se(e,t){let{name:n,title:o,description:s,suiteName:i,libKey:r,getPreContent:a}=e;return new S(n,{title:o,description:s,requiredAccess:W==="utils"?e.requiredAccess:["none"],inputSchema:{prompt:v.string().describe("An enhanced prompt describing the HTML layout structure, design requirements or specific visual effects you want to achieve."),includeBuildingBlockExamples:v.boolean().describe("Whether to include building block examples. Defaults to false.").default(!1)}},async({prompt:d,includeBuildingBlockExamples:p},{_meta:b})=>{h("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=a?.()??"",l=y=>`${u}
|
|
1909
790
|
|
|
1910
791
|
# Kendo Design System CSS Utilities
|
|
1911
792
|
|
|
1912
|
-
${
|
|
1913
|
-
${
|
|
1914
|
-
`;
|
|
1915
|
-
};
|
|
1916
|
-
if (includeBuildingBlockExamples) {
|
|
1917
|
-
try {
|
|
1918
|
-
const buildingBlocksResponse = await contextApi2.queryBuildingBlocks({
|
|
1919
|
-
query: prompt,
|
|
1920
|
-
lib_name: libKey
|
|
1921
|
-
}, { _meta });
|
|
1922
|
-
let buildingBlockMd = "";
|
|
1923
|
-
if (buildingBlocksResponse.items?.length > 0) {
|
|
1924
|
-
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=`
|
|
1925
796
|
## Building Blocks Examples
|
|
1926
797
|
|
|
1927
798
|
The examples here are for demonstration purpose how CSS utils can be implemented in various building blocks.
|
|
1928
799
|
However, consider your own design requirements and specifics in order to implement your templates/building blocks correctly.
|
|
1929
800
|
|
|
1930
|
-
${
|
|
1931
|
-
|
|
1932
|
-
### ${item.name}
|
|
801
|
+
${y.items.map(C=>`
|
|
802
|
+
### ${C.name}
|
|
1933
803
|
|
|
1934
|
-
${
|
|
804
|
+
${C.description}
|
|
1935
805
|
|
|
1936
806
|
\`\`\`code
|
|
1937
|
-
${
|
|
807
|
+
${C.code}
|
|
1938
808
|
\`\`\`
|
|
1939
|
-
`
|
|
1940
|
-
|
|
1941
|
-
}
|
|
1942
|
-
finalMarkdown = buildLayout(buildingBlockMd);
|
|
1943
|
-
} catch (buildingBlockError) {
|
|
1944
|
-
log("Error calling building-blocks service:", buildingBlockError);
|
|
1945
|
-
finalMarkdown = buildLayout();
|
|
1946
|
-
}
|
|
1947
|
-
} else {
|
|
1948
|
-
finalMarkdown = buildLayout();
|
|
1949
|
-
}
|
|
1950
|
-
return {
|
|
1951
|
-
content: [
|
|
1952
|
-
{
|
|
1953
|
-
type: "text",
|
|
1954
|
-
text: finalMarkdown
|
|
1955
|
-
}
|
|
1956
|
-
]
|
|
1957
|
-
};
|
|
1958
|
-
} catch (error) {
|
|
1959
|
-
throw getGrpcError(error);
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
);
|
|
1963
|
-
}
|
|
1964
|
-
function createStyleAssistantTool(config, contextApi2) {
|
|
1965
|
-
const { name, title, description, libKey: _libKey, getPreContent } = config;
|
|
1966
|
-
return new UIAgentTool(
|
|
1967
|
-
name,
|
|
1968
|
-
{
|
|
1969
|
-
title,
|
|
1970
|
-
description,
|
|
1971
|
-
requiredAccess: config.requiredAccess,
|
|
1972
|
-
inputSchema: {
|
|
1973
|
-
prompt: z4.string().describe(
|
|
1974
|
-
`A natural language description of the desired visual style or theme. For example: 'Create a modern dark theme with high contrast'.`
|
|
1975
|
-
)
|
|
1976
|
-
}
|
|
1977
|
-
},
|
|
1978
|
-
async ({ prompt }, { _meta }) => {
|
|
1979
|
-
log("Style Assistant called with:", { prompt });
|
|
1980
|
-
if (LAYOUT_MODE === "tailwind") {
|
|
1981
|
-
return {
|
|
1982
|
-
content: [
|
|
1983
|
-
{
|
|
1984
|
-
type: "text",
|
|
1985
|
-
text: `Note: For layout and spacing, use Tailwind CSS utility classes to structure your layout and apply spacing between elements.
|
|
809
|
+
`).join(`
|
|
810
|
+
`)}`),f=l(A)}catch(y){h("Error calling building-blocks service:",y),f=l()}else f=l();return{content:[{type:"text",text:f}]}}catch(g){throw R(g)}})}function we(e,t){let{name:n,title:o,description:s,libKey:i,getPreContent:r}=e;return new S(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{prompt:v.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:a},{_meta:d})=>{if(h("Style Assistant called with:",{prompt:a}),W==="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.
|
|
1986
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.
|
|
1987
812
|
|
|
1988
813
|
<tailwind_setup_instructions>
|
|
1989
|
-
${
|
|
814
|
+
${z}
|
|
1990
815
|
</tailwind_setup_instructions>
|
|
1991
|
-
`
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
};
|
|
1995
|
-
}
|
|
1996
|
-
let formattedCSS = "";
|
|
1997
|
-
try {
|
|
1998
|
-
const result = await contextApi2.queryThemeGenerate({ prompt }, { _meta });
|
|
1999
|
-
if (result.variables_json) {
|
|
2000
|
-
const theme = JSON.parse(result.variables_json);
|
|
2001
|
-
let cssBlocks = [];
|
|
2002
|
-
if (theme) {
|
|
2003
|
-
for (const key of Object.keys(theme)) {
|
|
2004
|
-
if (typeof theme[key] === "string") {
|
|
2005
|
-
cssBlocks.push(`${key}: ${theme[key]}`);
|
|
2006
|
-
}
|
|
2007
|
-
}
|
|
2008
|
-
}
|
|
2009
|
-
formattedCSS = cssBlocks.join("\n\n");
|
|
2010
|
-
}
|
|
2011
|
-
} catch (error) {
|
|
2012
|
-
throw getGrpcError(error);
|
|
2013
|
-
}
|
|
2014
|
-
const preContent = getPreContent?.() ?? "";
|
|
2015
|
-
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:a},{_meta:d});if(f.variables_json){let u=JSON.parse(f.variables_json),l=[];if(u)for(let y of Object.keys(u))typeof u[y]=="string"&&l.push(`${y}: ${u[y]}`);p=l.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.
|
|
2016
819
|
Ensure the variables are applied consistently across all relevant elements.
|
|
2017
820
|
Do NOT set any inline styles. CSS variables should be defined in global or component-level CSS files, or via supported theming mechanisms.
|
|
2018
821
|
|
|
2019
|
-
${
|
|
822
|
+
${b}
|
|
2020
823
|
|
|
2021
824
|
## Generated CSS Variables
|
|
2022
825
|
|
|
2023
826
|
\`\`\`css
|
|
2024
|
-
${
|
|
827
|
+
${p}
|
|
2025
828
|
\`\`\`
|
|
2026
|
-
|
|
2027
|
-
return {
|
|
2028
|
-
content: [
|
|
2029
|
-
{
|
|
2030
|
-
type: "text",
|
|
2031
|
-
text: response
|
|
2032
|
-
},
|
|
2033
|
-
{
|
|
2034
|
-
type: "text",
|
|
2035
|
-
text: "Note: For layout and spacing, use the Layout Assistant tool to get the appropriate Kendo CSS utility classes."
|
|
2036
|
-
}
|
|
2037
|
-
]
|
|
2038
|
-
};
|
|
2039
|
-
}
|
|
2040
|
-
);
|
|
2041
|
-
}
|
|
2042
|
-
function createIconSearchTool(config, contextApi2) {
|
|
2043
|
-
const { name, title, description, libKey: _libKey, getPostContent } = config;
|
|
2044
|
-
return new UIAgentTool(
|
|
2045
|
-
name,
|
|
2046
|
-
{
|
|
2047
|
-
title,
|
|
2048
|
-
description,
|
|
2049
|
-
requiredAccess: config.requiredAccess,
|
|
2050
|
-
inputSchema: {
|
|
2051
|
-
query: z4.string().describe(
|
|
2052
|
-
"A search query for finding icons. Be specific about the icon purpose, style, or action."
|
|
2053
|
-
),
|
|
2054
|
-
limit: z4.number().min(0.1).max(1).default(0.1).describe(
|
|
2055
|
-
`The proportion of matching icons to return (0.1 = 1 icon, 0.5 = 5 icons, 1.0 = many icons). Default is 0.1.`
|
|
2056
|
-
)
|
|
2057
|
-
}
|
|
2058
|
-
},
|
|
2059
|
-
async ({ query, limit }, { _meta }) => {
|
|
2060
|
-
log("Icon Search called with:", { query, limit });
|
|
2061
|
-
try {
|
|
2062
|
-
const result = await contextApi2.queryIconsSearch({
|
|
2063
|
-
query,
|
|
2064
|
-
limit: limit * 100
|
|
2065
|
-
}, { _meta });
|
|
2066
|
-
const postContent = getPostContent?.() ?? "";
|
|
2067
|
-
const response = `${result.values.join("\n\n")}
|
|
2068
|
-
|
|
2069
|
-
${postContent}`;
|
|
2070
|
-
return {
|
|
2071
|
-
content: [
|
|
2072
|
-
{
|
|
2073
|
-
type: "text",
|
|
2074
|
-
text: response
|
|
2075
|
-
}
|
|
2076
|
-
]
|
|
2077
|
-
};
|
|
2078
|
-
} catch (error) {
|
|
2079
|
-
throw getGrpcError(error);
|
|
2080
|
-
}
|
|
2081
|
-
}
|
|
2082
|
-
);
|
|
2083
|
-
}
|
|
2084
|
-
function createCodeAssistantTool(config, contextApi2) {
|
|
2085
|
-
const {
|
|
2086
|
-
name,
|
|
2087
|
-
title,
|
|
2088
|
-
description,
|
|
2089
|
-
libKey,
|
|
2090
|
-
suiteName: _suiteName,
|
|
2091
|
-
components,
|
|
2092
|
-
componentAliases,
|
|
2093
|
-
getPostContent
|
|
2094
|
-
} = config;
|
|
2095
|
-
return new UIAgentTool(
|
|
2096
|
-
name,
|
|
2097
|
-
{
|
|
2098
|
-
title,
|
|
2099
|
-
description,
|
|
2100
|
-
requiredAccess: config.requiredAccess,
|
|
2101
|
-
inputSchema: {
|
|
2102
|
-
query: z4.string().describe("The query to search for."),
|
|
2103
|
-
component: z4.enum(components).describe(
|
|
2104
|
-
"The component to search for. If not specified, use General."
|
|
2105
|
-
)
|
|
2106
|
-
}
|
|
2107
|
-
},
|
|
2108
|
-
async ({ query, component }, { _meta }) => {
|
|
2109
|
-
log("Code Assistant called with:", { query, component });
|
|
2110
|
-
let resolvedComponent = component;
|
|
2111
|
-
if (componentAliases) {
|
|
2112
|
-
const alias = componentAliases[component];
|
|
2113
|
-
if (alias) {
|
|
2114
|
-
resolvedComponent = alias;
|
|
2115
|
-
}
|
|
2116
|
-
}
|
|
2117
|
-
try {
|
|
2118
|
-
const response = await contextApi2.query({
|
|
2119
|
-
query,
|
|
2120
|
-
component: resolvedComponent?.toLowerCase() ?? "general",
|
|
2121
|
-
lib_name: libKey,
|
|
2122
|
-
text_matches_count: 3,
|
|
2123
|
-
code_matches_count: 0,
|
|
2124
|
-
allowed_types: ["documentation"]
|
|
2125
|
-
}, { _meta });
|
|
2126
|
-
const cleanedValues = response.values.map(
|
|
2127
|
-
(val) => val.replace(/\0/g, "")
|
|
2128
|
-
);
|
|
2129
|
-
const postContent = getPostContent?.({ component }) ?? "";
|
|
2130
|
-
const combinedResponse = `${cleanedValues.join("\n\n")}
|
|
2131
|
-
|
|
2132
|
-
${postContent}`;
|
|
2133
|
-
return {
|
|
2134
|
-
content: [
|
|
2135
|
-
{
|
|
2136
|
-
type: "text",
|
|
2137
|
-
text: combinedResponse
|
|
2138
|
-
}
|
|
2139
|
-
]
|
|
2140
|
-
};
|
|
2141
|
-
} catch (error) {
|
|
2142
|
-
throw getGrpcError(error);
|
|
2143
|
-
}
|
|
2144
|
-
}
|
|
2145
|
-
);
|
|
2146
|
-
}
|
|
2147
|
-
function createAccessibilityAssistantTool(config, contextApi2) {
|
|
2148
|
-
const {
|
|
2149
|
-
name,
|
|
2150
|
-
title,
|
|
2151
|
-
description,
|
|
2152
|
-
libKey,
|
|
2153
|
-
suiteName: _suiteName,
|
|
2154
|
-
components,
|
|
2155
|
-
componentAliases
|
|
2156
|
-
} = config;
|
|
2157
|
-
return new UIAgentTool(
|
|
2158
|
-
name,
|
|
2159
|
-
{
|
|
2160
|
-
title,
|
|
2161
|
-
description,
|
|
2162
|
-
requiredAccess: config.requiredAccess,
|
|
2163
|
-
inputSchema: {
|
|
2164
|
-
query: z4.string().describe("The query to search for."),
|
|
2165
|
-
component: z4.enum(components).describe(
|
|
2166
|
-
"The component to search for. If not specified, use General."
|
|
2167
|
-
),
|
|
2168
|
-
includeGeneralGuidelines: z4.boolean().default(false).describe(
|
|
2169
|
-
"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."
|
|
2170
|
-
)
|
|
2171
|
-
}
|
|
2172
|
-
},
|
|
2173
|
-
async ({ query, component, includeGeneralGuidelines }, { _meta }) => {
|
|
2174
|
-
log("Accessibility Assistant called with:", {
|
|
2175
|
-
query,
|
|
2176
|
-
component,
|
|
2177
|
-
includeGeneralGuidelines
|
|
2178
|
-
});
|
|
2179
|
-
let resolvedComponent = component;
|
|
2180
|
-
if (componentAliases) {
|
|
2181
|
-
const alias = componentAliases[component];
|
|
2182
|
-
if (alias) {
|
|
2183
|
-
resolvedComponent = alias;
|
|
2184
|
-
}
|
|
2185
|
-
}
|
|
2186
|
-
try {
|
|
2187
|
-
let finalResponse = "";
|
|
2188
|
-
if (includeGeneralGuidelines) {
|
|
2189
|
-
const generalGuidelines = getAccessibilityGuidelines();
|
|
2190
|
-
finalResponse += "# WCAG 2.2 Level AA General Accessibility Guidelines\n\n";
|
|
2191
|
-
finalResponse += generalGuidelines;
|
|
2192
|
-
finalResponse += "\n\n---\n\n";
|
|
2193
|
-
}
|
|
2194
|
-
const response = await contextApi2.getApiRefMatches({
|
|
2195
|
-
query,
|
|
2196
|
-
component: resolvedComponent?.toLowerCase() ?? "general",
|
|
2197
|
-
lib_name: libKey,
|
|
2198
|
-
filters_json: '{"type":{"$in":["accessibility"]}}'
|
|
2199
|
-
}, { _meta });
|
|
2200
|
-
const cleanedValues = response.values.map(
|
|
2201
|
-
(val) => val.replace(/\0/g, "")
|
|
2202
|
-
);
|
|
2203
|
-
const formattedValues = cleanedValues.map(
|
|
2204
|
-
(val) => formatApiRefItemFromJson(val, resolvedComponent?.toLowerCase() ?? "general")
|
|
2205
|
-
);
|
|
2206
|
-
const componentResult = formattedValues.join("\n\n");
|
|
2207
|
-
if (componentResult) {
|
|
2208
|
-
if (includeGeneralGuidelines) {
|
|
2209
|
-
finalResponse += "# Component-Specific Accessibility Information\n\n";
|
|
2210
|
-
}
|
|
2211
|
-
finalResponse += componentResult;
|
|
2212
|
-
} else if (!includeGeneralGuidelines) {
|
|
2213
|
-
finalResponse = "No component-specific accessibility guidelines found.";
|
|
2214
|
-
}
|
|
2215
|
-
return {
|
|
2216
|
-
content: [
|
|
2217
|
-
{
|
|
2218
|
-
type: "text",
|
|
2219
|
-
text: finalResponse
|
|
2220
|
-
}
|
|
2221
|
-
]
|
|
2222
|
-
};
|
|
2223
|
-
} catch (error) {
|
|
2224
|
-
throw getGrpcError(error);
|
|
2225
|
-
}
|
|
2226
|
-
}
|
|
2227
|
-
);
|
|
2228
|
-
}
|
|
2229
|
-
function getGrpcError(error) {
|
|
2230
|
-
const errorObj = error;
|
|
2231
|
-
if (errorObj.code === 16 /* UNAUTHENTICATED */) {
|
|
2232
|
-
return new Error(
|
|
2233
|
-
"Error: You are not authenticated. Please verify the Telerik License Key provided is valid."
|
|
2234
|
-
);
|
|
2235
|
-
} else if (errorObj.code === 8 /* RESOURCE_EXHAUSTED */) {
|
|
2236
|
-
return new Error(
|
|
2237
|
-
`Error: You have exceeded the extension quota. Upgrade to subscription licensing to unlock full access. Message: ${errorObj.message}.`
|
|
2238
|
-
);
|
|
2239
|
-
} else if (errorObj.code === 7 /* PERMISSION_DENIED */) {
|
|
2240
|
-
return new Error(
|
|
2241
|
-
"Error: You do not have permission to access this resource. Please verify that you have a valid license."
|
|
2242
|
-
);
|
|
2243
|
-
} else {
|
|
2244
|
-
return new Error(
|
|
2245
|
-
`Error: An error occurred while calling the service. Please try again later.
|
|
2246
|
-
|
|
2247
|
-
Error Code: ${errorObj.code} Error Message: ${errorObj.message}`
|
|
2248
|
-
);
|
|
2249
|
-
}
|
|
2250
|
-
}
|
|
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:n,title:o,description:s,libKey:i,getPostContent:r}=e;return new S(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:v.string().describe("A search query for finding icons. Be specific about the icon purpose, style, or action."),limit:v.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:a,limit:d},{_meta:p})=>{h("Icon Search called with:",{query:a,limit:d});try{let b=await t.queryIconsSearch({query:a,limit:d*100},{_meta:p}),g=r?.()??"";return{content:[{type:"text",text:`${b.values.join(`
|
|
2251
830
|
|
|
2252
|
-
|
|
2253
|
-
var FigmaAPIError = class extends Error {
|
|
2254
|
-
constructor(status, body) {
|
|
2255
|
-
super(`Figma API error ${status}: ${body}`);
|
|
2256
|
-
this.status = status;
|
|
2257
|
-
this.body = body;
|
|
2258
|
-
this.name = "FigmaAPIError";
|
|
2259
|
-
}
|
|
2260
|
-
};
|
|
2261
|
-
|
|
2262
|
-
// packages/kendo-ui-agent/src/lib/figma-d2c/figma-client.ts
|
|
2263
|
-
var FigmaClient = class {
|
|
2264
|
-
constructor(apiKey) {
|
|
2265
|
-
this.retryConfig = {
|
|
2266
|
-
maxRetries: 3,
|
|
2267
|
-
baseDelayMs: 1e3,
|
|
2268
|
-
maxDelayMs: 3e4
|
|
2269
|
-
};
|
|
2270
|
-
this.apiKey = apiKey;
|
|
2271
|
-
}
|
|
2272
|
-
/**
|
|
2273
|
-
* Fetch file metadata including node and component counts
|
|
2274
|
-
*/
|
|
2275
|
-
async getFileMeta(fileKey) {
|
|
2276
|
-
const fileResponse = await this.getFile(fileKey, { depth: 1 });
|
|
2277
|
-
const counts = this.countNodesAndComponents(fileResponse.document);
|
|
2278
|
-
return {
|
|
2279
|
-
nodeCount: counts.nodes,
|
|
2280
|
-
componentCount: counts.components
|
|
2281
|
-
};
|
|
2282
|
-
}
|
|
2283
|
-
/**
|
|
2284
|
-
* Fetch a specific file with optional depth parameter
|
|
2285
|
-
*/
|
|
2286
|
-
async getFile(fileKey, options) {
|
|
2287
|
-
const url = this.buildFileUrl(fileKey, options);
|
|
2288
|
-
return this.fetchWithRetry(url);
|
|
2289
|
-
}
|
|
2290
|
-
/**
|
|
2291
|
-
* Fetch specific nodes by ID
|
|
2292
|
-
*/
|
|
2293
|
-
async getNodes(fileKey, nodeIds, options) {
|
|
2294
|
-
const url = this.buildNodesUrl(fileKey, nodeIds, options);
|
|
2295
|
-
return this.fetchWithRetry(url);
|
|
2296
|
-
}
|
|
2297
|
-
/**
|
|
2298
|
-
* Get export URLs for node images
|
|
2299
|
-
*/
|
|
2300
|
-
async getImages(fileKey, nodeIds, options) {
|
|
2301
|
-
const url = this.buildImagesUrl(fileKey, nodeIds, options);
|
|
2302
|
-
return this.fetchWithRetry(url);
|
|
2303
|
-
}
|
|
2304
|
-
/**
|
|
2305
|
-
* Get download URLs for embedded image fills
|
|
2306
|
-
* Returns a map of imageRef hashes to temporary S3 download URLs
|
|
2307
|
-
*/
|
|
2308
|
-
async getImageFills(fileKey) {
|
|
2309
|
-
const url = `https://api.figma.com/v1/files/${fileKey}/images`;
|
|
2310
|
-
return this.fetchWithRetry(url);
|
|
2311
|
-
}
|
|
2312
|
-
/**
|
|
2313
|
-
* Core fetch method with retry logic
|
|
2314
|
-
*/
|
|
2315
|
-
async fetchWithRetry(url) {
|
|
2316
|
-
let lastError = null;
|
|
2317
|
-
for (let attempt = 0; attempt < this.retryConfig.maxRetries; attempt++) {
|
|
2318
|
-
try {
|
|
2319
|
-
const response = await fetch(url, {
|
|
2320
|
-
headers: {
|
|
2321
|
-
"X-Figma-Token": this.apiKey,
|
|
2322
|
-
"Content-Type": "application/json"
|
|
2323
|
-
}
|
|
2324
|
-
});
|
|
2325
|
-
if (response.status === 429) {
|
|
2326
|
-
const retryAfter = response.headers.get("Retry-After");
|
|
2327
|
-
const delayMs = retryAfter ? parseInt(retryAfter) * 1e3 : this.calculateBackoff(attempt);
|
|
2328
|
-
await this.sleep(delayMs);
|
|
2329
|
-
continue;
|
|
2330
|
-
}
|
|
2331
|
-
if (!response.ok) {
|
|
2332
|
-
const body = await response.text();
|
|
2333
|
-
throw new FigmaAPIError(response.status, body);
|
|
2334
|
-
}
|
|
2335
|
-
return await response.json();
|
|
2336
|
-
} catch (err) {
|
|
2337
|
-
lastError = err;
|
|
2338
|
-
if (err instanceof FigmaAPIError && err.status >= 400 && err.status < 500) {
|
|
2339
|
-
throw err;
|
|
2340
|
-
}
|
|
2341
|
-
if (attempt < this.retryConfig.maxRetries - 1) {
|
|
2342
|
-
await this.sleep(this.calculateBackoff(attempt));
|
|
2343
|
-
}
|
|
2344
|
-
}
|
|
2345
|
-
}
|
|
2346
|
-
throw lastError ?? new Error("Max retries exceeded");
|
|
2347
|
-
}
|
|
2348
|
-
/**
|
|
2349
|
-
* Calculate exponential backoff with jitter
|
|
2350
|
-
*/
|
|
2351
|
-
calculateBackoff(attempt) {
|
|
2352
|
-
const delay = this.retryConfig.baseDelayMs * Math.pow(2, attempt);
|
|
2353
|
-
const jitter = Math.random() * 0.3 * delay;
|
|
2354
|
-
return Math.min(delay + jitter, this.retryConfig.maxDelayMs);
|
|
2355
|
-
}
|
|
2356
|
-
sleep(ms) {
|
|
2357
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
2358
|
-
}
|
|
2359
|
-
buildFileUrl(fileKey, options) {
|
|
2360
|
-
const base = `https://api.figma.com/v1/files/${fileKey}`;
|
|
2361
|
-
const params = new URLSearchParams();
|
|
2362
|
-
if (options?.depth) {
|
|
2363
|
-
params.set("depth", options.depth.toString());
|
|
2364
|
-
}
|
|
2365
|
-
return params.toString() ? `${base}?${params}` : base;
|
|
2366
|
-
}
|
|
2367
|
-
buildNodesUrl(fileKey, nodeIds, options) {
|
|
2368
|
-
const base = `https://api.figma.com/v1/files/${fileKey}/nodes`;
|
|
2369
|
-
const params = new URLSearchParams();
|
|
2370
|
-
params.set("ids", nodeIds.join(","));
|
|
2371
|
-
if (options?.depth) {
|
|
2372
|
-
params.set("depth", options.depth.toString());
|
|
2373
|
-
}
|
|
2374
|
-
return `${base}?${params}`;
|
|
2375
|
-
}
|
|
2376
|
-
buildImagesUrl(fileKey, nodeIds, options) {
|
|
2377
|
-
const base = `https://api.figma.com/v1/images/${fileKey}`;
|
|
2378
|
-
const params = new URLSearchParams();
|
|
2379
|
-
params.set("ids", nodeIds.join(","));
|
|
2380
|
-
if (options?.format) params.set("format", options.format);
|
|
2381
|
-
if (options?.scale) params.set("scale", options.scale.toString());
|
|
2382
|
-
return `${base}?${params}`;
|
|
2383
|
-
}
|
|
2384
|
-
/**
|
|
2385
|
-
* Recursively count nodes and components in the document tree
|
|
2386
|
-
*/
|
|
2387
|
-
countNodesAndComponents(node) {
|
|
2388
|
-
let nodes = 1;
|
|
2389
|
-
let components = node.type === "COMPONENT" || node.type === "COMPONENT_SET" ? 1 : 0;
|
|
2390
|
-
if (node.children) {
|
|
2391
|
-
for (const child of node.children) {
|
|
2392
|
-
const childCounts = this.countNodesAndComponents(child);
|
|
2393
|
-
nodes += childCounts.nodes;
|
|
2394
|
-
components += childCounts.components;
|
|
2395
|
-
}
|
|
2396
|
-
}
|
|
2397
|
-
return { nodes, components };
|
|
2398
|
-
}
|
|
2399
|
-
};
|
|
2400
|
-
|
|
2401
|
-
// packages/kendo-ui-agent/src/lib/figma-d2c/utils.ts
|
|
2402
|
-
function parseFigmaUrl(url) {
|
|
2403
|
-
const invalidResult = {
|
|
2404
|
-
fileKey: "",
|
|
2405
|
-
type: "unknown",
|
|
2406
|
-
isDevMode: false,
|
|
2407
|
-
isValid: false
|
|
2408
|
-
};
|
|
2409
|
-
if (!url || typeof url !== "string") {
|
|
2410
|
-
return invalidResult;
|
|
2411
|
-
}
|
|
2412
|
-
let parsed;
|
|
2413
|
-
try {
|
|
2414
|
-
parsed = new URL(url.trim());
|
|
2415
|
-
} catch {
|
|
2416
|
-
return invalidResult;
|
|
2417
|
-
}
|
|
2418
|
-
const validDomains = ["figma.com", "www.figma.com"];
|
|
2419
|
-
if (!validDomains.includes(parsed.hostname)) {
|
|
2420
|
-
return invalidResult;
|
|
2421
|
-
}
|
|
2422
|
-
const pathParts = parsed.pathname.split("/").filter(Boolean);
|
|
2423
|
-
if (pathParts.length < 2) {
|
|
2424
|
-
return invalidResult;
|
|
2425
|
-
}
|
|
2426
|
-
const typeMap = {
|
|
2427
|
-
file: "file",
|
|
2428
|
-
design: "design",
|
|
2429
|
-
proto: "proto",
|
|
2430
|
-
board: "board"
|
|
2431
|
-
};
|
|
2432
|
-
const type = typeMap[pathParts[0]] || "unknown";
|
|
2433
|
-
const fileKey = pathParts[1];
|
|
2434
|
-
if (!/^[a-zA-Z0-9]+$/.test(fileKey)) {
|
|
2435
|
-
return invalidResult;
|
|
2436
|
-
}
|
|
2437
|
-
const fileName = pathParts[2] ? decodeURIComponent(pathParts[2]).replace(/-/g, " ") : void 0;
|
|
2438
|
-
const nodeIdParam = parsed.searchParams.get("node-id");
|
|
2439
|
-
let nodeId;
|
|
2440
|
-
let nodeIds;
|
|
2441
|
-
if (nodeIdParam) {
|
|
2442
|
-
const rawIds = nodeIdParam.split(",").map((id) => id.trim()).filter(Boolean);
|
|
2443
|
-
nodeIds = rawIds.map((id) => id.replace(/-/g, ":"));
|
|
2444
|
-
nodeId = nodeIds[0];
|
|
2445
|
-
}
|
|
2446
|
-
const branchKey = parsed.searchParams.get("t") ?? void 0;
|
|
2447
|
-
const isDevMode = parsed.searchParams.get("m") === "dev";
|
|
2448
|
-
return {
|
|
2449
|
-
fileKey,
|
|
2450
|
-
fileName,
|
|
2451
|
-
nodeId,
|
|
2452
|
-
nodeIds,
|
|
2453
|
-
type,
|
|
2454
|
-
branchKey,
|
|
2455
|
-
isDevMode,
|
|
2456
|
-
isValid: true
|
|
2457
|
-
};
|
|
2458
|
-
}
|
|
831
|
+
`)}
|
|
2459
832
|
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
* @param nodeIds - Optional node ID(s) - can be string or string[]
|
|
2470
|
-
* @param options - Fetch options including depth
|
|
2471
|
-
* @returns Fetch result with root node and stats
|
|
2472
|
-
*/
|
|
2473
|
-
async fetch(fileKey, nodeIds, options = {}) {
|
|
2474
|
-
const initialDepth = options.initialDepth ?? 10;
|
|
2475
|
-
const fetchImages = options.fetchImages ?? true;
|
|
2476
|
-
const imageFormat = options.imageFormat ?? "png";
|
|
2477
|
-
const imageScale = options.imageScale ?? 2;
|
|
2478
|
-
const stats = {
|
|
2479
|
-
totalNodesFetched: 0,
|
|
2480
|
-
apiCallsMade: 0,
|
|
2481
|
-
imagesFetched: 0
|
|
2482
|
-
};
|
|
2483
|
-
let nodeIdArray;
|
|
2484
|
-
if (!nodeIds) {
|
|
2485
|
-
nodeIdArray = [];
|
|
2486
|
-
} else if (typeof nodeIds === "string") {
|
|
2487
|
-
nodeIdArray = [nodeIds];
|
|
2488
|
-
} else {
|
|
2489
|
-
nodeIdArray = nodeIds;
|
|
2490
|
-
}
|
|
2491
|
-
let rootNode;
|
|
2492
|
-
let fetchedNodes = [];
|
|
2493
|
-
if (nodeIdArray.length > 0) {
|
|
2494
|
-
const response = await this.client.getNodes(fileKey, nodeIdArray, { depth: initialDepth });
|
|
2495
|
-
stats.apiCallsMade++;
|
|
2496
|
-
for (const nodeId of nodeIdArray) {
|
|
2497
|
-
const nodeData = response.nodes[nodeId]?.document;
|
|
2498
|
-
if (!nodeData) {
|
|
2499
|
-
throw new Error(`Node ${nodeId} not found`);
|
|
2500
|
-
}
|
|
2501
|
-
fetchedNodes.push(nodeData);
|
|
2502
|
-
}
|
|
2503
|
-
if (fetchedNodes.length === 1) {
|
|
2504
|
-
rootNode = fetchedNodes[0];
|
|
2505
|
-
} else {
|
|
2506
|
-
rootNode = this.createContainerNode(fetchedNodes);
|
|
2507
|
-
}
|
|
2508
|
-
} else {
|
|
2509
|
-
const response = await this.client.getFile(fileKey, { depth: initialDepth });
|
|
2510
|
-
stats.apiCallsMade++;
|
|
2511
|
-
rootNode = response.document;
|
|
2512
|
-
fetchedNodes = [rootNode];
|
|
2513
|
-
}
|
|
2514
|
-
stats.totalNodesFetched += this.countNodes(rootNode);
|
|
2515
|
-
const images = [];
|
|
2516
|
-
if (fetchImages && nodeIdArray.length > 0) {
|
|
2517
|
-
try {
|
|
2518
|
-
const imageResult = await this.fetchNodeImages(
|
|
2519
|
-
fileKey,
|
|
2520
|
-
nodeIdArray,
|
|
2521
|
-
fetchedNodes,
|
|
2522
|
-
{ format: imageFormat, scale: imageScale }
|
|
2523
|
-
);
|
|
2524
|
-
images.push(...imageResult.images);
|
|
2525
|
-
stats.apiCallsMade += imageResult.apiCalls;
|
|
2526
|
-
stats.imagesFetched = images.length;
|
|
2527
|
-
} catch (error) {
|
|
2528
|
-
console.warn("Failed to fetch images:", error);
|
|
2529
|
-
}
|
|
2530
|
-
}
|
|
2531
|
-
return {
|
|
2532
|
-
rootNode,
|
|
2533
|
-
fetchedNodes,
|
|
2534
|
-
images,
|
|
2535
|
-
stats
|
|
2536
|
-
};
|
|
2537
|
-
}
|
|
2538
|
-
/**
|
|
2539
|
-
* Fetch and download images for specified nodes
|
|
2540
|
-
*/
|
|
2541
|
-
async fetchNodeImages(fileKey, nodeIds, nodes, options) {
|
|
2542
|
-
const imageResponse = await this.client.getImages(fileKey, nodeIds, options);
|
|
2543
|
-
let apiCalls = 1;
|
|
2544
|
-
const images = [];
|
|
2545
|
-
for (let i = 0; i < nodeIds.length; i++) {
|
|
2546
|
-
const nodeId = nodeIds[i];
|
|
2547
|
-
const imageUrl = imageResponse.images[nodeId];
|
|
2548
|
-
if (imageUrl) {
|
|
2549
|
-
try {
|
|
2550
|
-
const imageData = await this.downloadImage(imageUrl, options.format);
|
|
2551
|
-
const node = nodes[i];
|
|
2552
|
-
images.push({
|
|
2553
|
-
nodeId,
|
|
2554
|
-
nodeName: node?.name || "Unknown",
|
|
2555
|
-
data: imageData,
|
|
2556
|
-
mimeType: this.getMimeType(options.format),
|
|
2557
|
-
url: imageUrl
|
|
2558
|
-
});
|
|
2559
|
-
} catch (error) {
|
|
2560
|
-
console.warn(`Failed to download image for node ${nodeId}:`, error);
|
|
2561
|
-
}
|
|
2562
|
-
}
|
|
2563
|
-
}
|
|
2564
|
-
return { images, apiCalls };
|
|
2565
|
-
}
|
|
2566
|
-
/**
|
|
2567
|
-
* Download an image from a URL and convert to base64
|
|
2568
|
-
*/
|
|
2569
|
-
async downloadImage(url, format) {
|
|
2570
|
-
const response = await fetch(url);
|
|
2571
|
-
if (!response.ok) {
|
|
2572
|
-
throw new Error(`Failed to download image: ${response.statusText}`);
|
|
2573
|
-
}
|
|
2574
|
-
if (format === "svg") {
|
|
2575
|
-
const svgText = await response.text();
|
|
2576
|
-
return Buffer.from(svgText, "utf-8").toString("base64");
|
|
2577
|
-
} else {
|
|
2578
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
2579
|
-
return Buffer.from(arrayBuffer).toString("base64");
|
|
2580
|
-
}
|
|
2581
|
-
}
|
|
2582
|
-
/**
|
|
2583
|
-
* Get MIME type for image format
|
|
2584
|
-
*/
|
|
2585
|
-
getMimeType(format) {
|
|
2586
|
-
switch (format) {
|
|
2587
|
-
case "png":
|
|
2588
|
-
return "image/png";
|
|
2589
|
-
case "jpg":
|
|
2590
|
-
return "image/jpeg";
|
|
2591
|
-
case "svg":
|
|
2592
|
-
return "image/svg+xml";
|
|
2593
|
-
default:
|
|
2594
|
-
return "image/png";
|
|
2595
|
-
}
|
|
2596
|
-
}
|
|
2597
|
-
/**
|
|
2598
|
-
* Create a synthetic container node that wraps multiple nodes
|
|
2599
|
-
*/
|
|
2600
|
-
createContainerNode(nodes) {
|
|
2601
|
-
return {
|
|
2602
|
-
id: "container-" + Date.now(),
|
|
2603
|
-
name: "Multi-Node Container",
|
|
2604
|
-
type: "GROUP",
|
|
2605
|
-
visible: true,
|
|
2606
|
-
children: nodes
|
|
2607
|
-
};
|
|
2608
|
-
}
|
|
2609
|
-
/**
|
|
2610
|
-
* Count total nodes in a tree
|
|
2611
|
-
*/
|
|
2612
|
-
countNodes(node) {
|
|
2613
|
-
let count = 1;
|
|
2614
|
-
if (node.children) {
|
|
2615
|
-
for (const child of node.children) {
|
|
2616
|
-
count += this.countNodes(child);
|
|
2617
|
-
}
|
|
2618
|
-
}
|
|
2619
|
-
return count;
|
|
2620
|
-
}
|
|
2621
|
-
};
|
|
2622
|
-
|
|
2623
|
-
// packages/kendo-ui-agent/src/lib/figma-d2c/figma-d2c-tool.ts
|
|
2624
|
-
import { z as z5 } from "zod";
|
|
2625
|
-
function createFigmaD2CTool({
|
|
2626
|
-
name,
|
|
2627
|
-
figmaApiKey,
|
|
2628
|
-
requiredAccess
|
|
2629
|
-
}, contextApi2) {
|
|
2630
|
-
return new UIAgentTool(
|
|
2631
|
-
name,
|
|
2632
|
-
{
|
|
2633
|
-
title: "Figma Design to Code",
|
|
2634
|
-
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.",
|
|
2635
|
-
inputSchema: {
|
|
2636
|
-
url: z5.string().describe(
|
|
2637
|
-
"Figma file or node URL (e.g., https://www.figma.com/file/...)"
|
|
2638
|
-
).optional(),
|
|
2639
|
-
fileKey: z5.string().describe("Figma file key (alternative to URL)").optional(),
|
|
2640
|
-
nodeIds: z5.array(z5.string()).describe("Array of specific node IDs to fetch (alternative to URL)").optional(),
|
|
2641
|
-
depth: z5.number().min(1).max(20).default(10).describe("Initial fetch depth (1-20, default: 10)")
|
|
2642
|
-
},
|
|
2643
|
-
requiredAccess
|
|
2644
|
-
},
|
|
2645
|
-
async ({ url, fileKey, nodeIds, depth }) => {
|
|
2646
|
-
const client = new FigmaClient(figmaApiKey);
|
|
2647
|
-
const fetcher = new NodeFetcher(client);
|
|
2648
|
-
let fileKeyToUse = fileKey;
|
|
2649
|
-
let nodeIdsToUse;
|
|
2650
|
-
if (fileKeyToUse) {
|
|
2651
|
-
if (nodeIds && nodeIds.length > 0) {
|
|
2652
|
-
nodeIdsToUse = nodeIds.length === 1 ? nodeIds[0] : nodeIds;
|
|
2653
|
-
}
|
|
2654
|
-
} else if (url) {
|
|
2655
|
-
const parsed = parseFigmaUrl(url);
|
|
2656
|
-
if (!parsed.isValid || !parsed.fileKey) {
|
|
2657
|
-
throw new Error(
|
|
2658
|
-
"Invalid Figma URL. Please provide a valid Figma file or frame URL."
|
|
2659
|
-
);
|
|
2660
|
-
}
|
|
2661
|
-
fileKeyToUse = parsed.fileKey;
|
|
2662
|
-
if (parsed.nodeId) {
|
|
2663
|
-
nodeIdsToUse = parsed.nodeId;
|
|
2664
|
-
}
|
|
2665
|
-
} else {
|
|
2666
|
-
throw new Error("Please provide either a Figma URL, fileKey, or both.");
|
|
2667
|
-
}
|
|
2668
|
-
const fetchResult = await fetcher.fetch(fileKeyToUse, nodeIdsToUse, {
|
|
2669
|
-
initialDepth: depth,
|
|
2670
|
-
fetchImages: true,
|
|
2671
|
-
imageFormat: "png",
|
|
2672
|
-
imageScale: 2
|
|
2673
|
-
});
|
|
2674
|
-
const resultJson = {
|
|
2675
|
-
name: fetchResult.rootNode.name,
|
|
2676
|
-
type: fetchResult.rootNode.type,
|
|
2677
|
-
rootNode: fetchResult.rootNode,
|
|
2678
|
-
fetchedNodes: fetchResult.fetchedNodes,
|
|
2679
|
-
meta: {
|
|
2680
|
-
fileKey,
|
|
2681
|
-
nodeIds
|
|
2682
|
-
}
|
|
2683
|
-
};
|
|
2684
|
-
let backendResponse;
|
|
2685
|
-
try {
|
|
2686
|
-
const nodeJsons = fetchResult.fetchedNodes.map(
|
|
2687
|
-
(node) => JSON.stringify(node)
|
|
2688
|
-
);
|
|
2689
|
-
backendResponse = await contextApi2.processFigmaDesign({
|
|
2690
|
-
node_jsons: nodeJsons
|
|
2691
|
-
});
|
|
2692
|
-
} catch (error) {
|
|
2693
|
-
console.error("Backend processing failed:", error);
|
|
2694
|
-
return {
|
|
2695
|
-
content: [
|
|
2696
|
-
{
|
|
2697
|
-
type: "text",
|
|
2698
|
-
text: JSON.stringify(
|
|
2699
|
-
{
|
|
2700
|
-
error: {
|
|
2701
|
-
message: `Backend processing failed: ${error.message}`,
|
|
2702
|
-
code: error.code || "UNKNOWN"
|
|
2703
|
-
},
|
|
2704
|
-
figma_data: resultJson
|
|
2705
|
-
},
|
|
2706
|
-
null,
|
|
2707
|
-
2
|
|
2708
|
-
)
|
|
2709
|
-
}
|
|
2710
|
-
]
|
|
2711
|
-
};
|
|
2712
|
-
}
|
|
2713
|
-
const content = [];
|
|
2714
|
-
content.push({
|
|
2715
|
-
type: "text",
|
|
2716
|
-
text: `# Figma Design Extraction Results
|
|
2717
|
-
Successfully fetched design data for file key ${fileKeyToUse} with for nodes [${nodeIds?.join(", ")}].
|
|
2718
|
-
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:`
|
|
2719
|
-
});
|
|
2720
|
-
backendResponse.layout_pseudo_codes.forEach((layoutCode, index) => {
|
|
2721
|
-
const [nodeName, nodeId] = ((index2) => {
|
|
2722
|
-
const node = fetchResult.fetchedNodes[index2];
|
|
2723
|
-
return node ? [node.name, node.id] : ["Unknown Node", "unknown_id"];
|
|
2724
|
-
})(index);
|
|
2725
|
-
content.push({
|
|
2726
|
-
type: "text",
|
|
2727
|
-
text: `## Psuedo-code Layout - Node: ${nodeName} (${nodeId})
|
|
2728
|
-
|
|
2729
|
-
` + layoutCode,
|
|
2730
|
-
_meta: {
|
|
2731
|
-
description: `Psuedo-code Layout - Node: ${nodeName} (${nodeId})`
|
|
2732
|
-
},
|
|
2733
|
-
annotations: {
|
|
2734
|
-
audience: ["assistant"]
|
|
2735
|
-
}
|
|
2736
|
-
});
|
|
2737
|
-
});
|
|
2738
|
-
content.push({
|
|
2739
|
-
type: "text",
|
|
2740
|
-
text: `## Design Tokens - File: ${fileKey} for Nodes: [${nodeIds?.join(", ")}]
|
|
2741
|
-
|
|
2742
|
-
` + backendResponse.design_tokens,
|
|
2743
|
-
_meta: {
|
|
2744
|
-
description: `Design Tokens - File: ${fileKey} for Nodes: [${nodeIds?.join(", ")}]`
|
|
2745
|
-
},
|
|
2746
|
-
annotations: {
|
|
2747
|
-
audience: ["assistant"]
|
|
2748
|
-
}
|
|
2749
|
-
});
|
|
2750
|
-
if (fetchResult.images && fetchResult.images.length > 0) {
|
|
2751
|
-
for (const image of fetchResult.images) {
|
|
2752
|
-
content.push({
|
|
2753
|
-
type: "image",
|
|
2754
|
-
data: image.data,
|
|
2755
|
-
mimeType: image.mimeType,
|
|
2756
|
-
_meta: {
|
|
2757
|
-
description: `Design snapshot of ${image.nodeName} (${image.nodeId})`
|
|
2758
|
-
},
|
|
2759
|
-
annotations: {
|
|
2760
|
-
audience: ["assistant"]
|
|
2761
|
-
}
|
|
2762
|
-
});
|
|
2763
|
-
}
|
|
2764
|
-
}
|
|
2765
|
-
content.push({
|
|
2766
|
-
type: "text",
|
|
2767
|
-
text: `# Analysis Instructions and Next Steps
|
|
2768
|
-
|
|
2769
|
-
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.
|
|
2770
|
-
If more design details are needed, consider asking for additional nodes or deeper fetches to gather more information about specific areas of the design.`
|
|
2771
|
-
});
|
|
2772
|
-
return {
|
|
2773
|
-
content
|
|
2774
|
-
};
|
|
2775
|
-
}
|
|
2776
|
-
);
|
|
2777
|
-
}
|
|
833
|
+
${g}`}]}}catch(b){throw R(b)}})}function Ie(e,t){let{name:n,title:o,description:s,libKey:i,suiteName:r,components:a,componentAliases:d,getPostContent:p}=e;return new S(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:v.string().describe("The query to search for."),component:v.enum(a).describe("The component to search for. If not specified, use General.")}},async({query:b,component:g},{_meta:f})=>{h("Code Assistant called with:",{query:b,component:g});let u=g;if(d){let l=d[g];l&&(u=l)}try{let y=(await t.query({query:b,component:u?.toLowerCase()??"general",lib_name:i,text_matches_count:3,code_matches_count:0,allowed_types:["documentation"]},{_meta:f})).values.map(w=>w.replace(/\0/g,"")),A=p?.({component:g})??"";return{content:[{type:"text",text:`${y.join(`
|
|
834
|
+
|
|
835
|
+
`)}
|
|
836
|
+
|
|
837
|
+
${A}`}]}}catch(l){throw R(l)}})}function xe(e,t){let{name:n,title:o,description:s,libKey:i,suiteName:r,components:a,componentAliases:d}=e;return new S(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:v.string().describe("The query to search for."),component:v.enum(a).describe("The component to search for. If not specified, use General."),includeGeneralGuidelines:v.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:g},{_meta:f})=>{h("Accessibility Assistant called with:",{query:p,component:b,includeGeneralGuidelines:g});let u=b;if(d){let l=d[b];l&&(u=l)}try{let l="";if(g){let I=ge();l+=`# WCAG 2.2 Level AA General Accessibility Guidelines
|
|
838
|
+
|
|
839
|
+
`,l+=I,l+=`
|
|
840
|
+
|
|
841
|
+
---
|
|
2778
842
|
|
|
2779
|
-
|
|
2780
|
-
var orchestratorToolName = (prefix) => `${prefix}_ui_generator`;
|
|
2781
|
-
var assistantOrchestratorToolName = (prefix) => `${prefix}_assistant`;
|
|
2782
|
-
var layoutAssistantName = (prefix) => `${prefix}_layout_assistant`;
|
|
2783
|
-
var codeAssistantName = (prefix) => `${prefix}_component_assistant`;
|
|
2784
|
-
var styleAssistantName = (prefix) => `${prefix}_style_assistant`;
|
|
2785
|
-
var iconAssistantName = (prefix) => `${prefix}_icon_assistant`;
|
|
2786
|
-
var accessibilityAssistantName = (prefix) => `${prefix}_accessibility_assistant`;
|
|
2787
|
-
var gettingStartedAssistantName = (prefix) => `${prefix}_getting_started_assistant`;
|
|
2788
|
-
var figmaD2CToolName = (prefix) => `${prefix}_figma_d2c`;
|
|
843
|
+
`}let w=(await t.getApiRefMatches({query:p,component:u?.toLowerCase()??"general",lib_name:i,filters_json:'{"type":{"$in":["accessibility"]}}'},{_meta:f})).values.map(I=>I.replace(/\0/g,"")).map(I=>Tt(I,u?.toLowerCase()??"general")).join(`
|
|
2789
844
|
|
|
2790
|
-
|
|
2791
|
-
|
|
845
|
+
`);return w?(g&&(l+=`# Component-Specific Accessibility Information
|
|
846
|
+
|
|
847
|
+
`),l+=w):g||(l="No component-specific accessibility guidelines found."),{content:[{type:"text",text:l}]}}catch(l){throw R(l)}})}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.
|
|
848
|
+
|
|
849
|
+
Error Code: ${t.code} Error Message: ${t.message}`)}var Ne=e=>`${e}_ui_generator`,Ee=e=>`${e}_assistant`,Re=e=>`${e}_layout_assistant`,Pe=e=>`${e}_component_assistant`,De=e=>`${e}_style_assistant`,Oe=e=>`${e}_icon_assistant`,Ge=e=>`${e}_accessibility_assistant`,Le=e=>`${e}_getting_started_assistant`;var Ue=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.
|
|
2792
850
|
|
|
2793
851
|
Use the tool when:
|
|
2794
852
|
- Want to build or modify a complete page or section layout
|
|
2795
853
|
- You are creating and applying custom themes via the Kendo Design System
|
|
2796
|
-
- You need guidance on correct ${
|
|
854
|
+
- You need guidance on correct ${e} component selection and configuration
|
|
2797
855
|
- You want to enforce best practices in styling, performance, and accessibility
|
|
2798
856
|
|
|
2799
857
|
Returns:
|
|
2800
|
-
A detailed execution plan with validated tool calls, parameters, and reasoning \u2014 ensuring consistent, high-quality UI generation
|
|
2801
|
-
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.
|
|
2802
859
|
|
|
2803
860
|
Use this tool when:
|
|
2804
|
-
- You need to discover which ${
|
|
861
|
+
- You need to discover which ${e} components are suitable for a specific use case
|
|
2805
862
|
- You want to understand component features and capabilities
|
|
2806
863
|
- You need to find appropriate icons for your UI
|
|
2807
864
|
- You want to gather component documentation and examples
|
|
2808
865
|
|
|
2809
866
|
Returns:
|
|
2810
|
-
A focused plan for gathering component documentation and icon suggestions using the Component Assistant and Icon Assistant tools
|
|
2811
|
-
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.
|
|
2812
868
|
Use this tool to find the right CSS utilities for styling Kendo UI components or general web elements.
|
|
2813
869
|
It analyzes the provided design context and returns relevant utility classes with explanations and examples.
|
|
2814
|
-
Best suited for styling questions related to typography, spacing, colors, layout, transforms, and other utilities in the Progress/Kendo Design System
|
|
2815
|
-
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.
|
|
2816
871
|
|
|
2817
872
|
Use this tool when the user wants to:
|
|
2818
873
|
- Update the visual theme of an application
|
|
2819
874
|
- Modify color schemes
|
|
2820
875
|
- Restyle the UI with CSS variables
|
|
2821
876
|
|
|
2822
|
-
The tool outputs a set of CSS variable definitions ready to be applied to style files
|
|
2823
|
-
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.
|
|
2824
878
|
Use this tool when the user needs to find specific icons for UI components or design elements.
|
|
2825
879
|
It supports searching by icon name, category, or keyword and returns matching icons from the Telerik Icons library.
|
|
2826
|
-
|
|
2827
|
-
var codeAssistantToolDescription = (suiteName) => `Provides answers and retrieves official documentation for ${suiteName}.
|
|
880
|
+
`,qe=e=>`Provides answers and retrieves official documentation for ${e}.
|
|
2828
881
|
|
|
2829
882
|
Use this tool when the user asks about:
|
|
2830
|
-
- ${
|
|
883
|
+
- ${e} features or capabilities
|
|
2831
884
|
- Specific components (e.g., Grid, Chart, Editor)
|
|
2832
885
|
- Implementation details, configuration, or best practices
|
|
2833
|
-
- How to use or customize components in ${
|
|
886
|
+
- How to use or customize components in ${e}
|
|
2834
887
|
|
|
2835
888
|
Set the user's full question as the 'query' parameter.
|
|
2836
|
-
If the question refers to a specific ${
|
|
2837
|
-
|
|
2838
|
-
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
|
+
`,Fe=e=>`Retrieves accessibility guidance for ${e} components with optional general WCAG 2.2 Level AA guidelines.
|
|
2839
891
|
|
|
2840
892
|
Use this tool when:
|
|
2841
893
|
- You need component-specific accessibility information and API references
|
|
@@ -2853,11 +905,7 @@ Set 'includeGeneralGuidelines=true' ONLY on the first call to include general WC
|
|
|
2853
905
|
Returns:
|
|
2854
906
|
- When includeGeneralGuidelines=true: General WCAG 2.2 Level AA guidelines + component-specific recommendations
|
|
2855
907
|
- When includeGeneralGuidelines=false: Only component-specific accessibility recommendations
|
|
2856
|
-
`;
|
|
2857
|
-
|
|
2858
|
-
// packages/kendo-ui-agent/src/lib/validation/angular-validation-steps.ts
|
|
2859
|
-
var sharedSteps = getSharedValidationSteps("Kendo UI", "Kendo");
|
|
2860
|
-
var ANGULAR_VALIDATION_STEPS = `
|
|
908
|
+
`;var Y=E("Kendo UI","Kendo"),Q=`
|
|
2861
909
|
### Angular Component Validation
|
|
2862
910
|
Component Structure:
|
|
2863
911
|
- Use proper @Component decorator configuration
|
|
@@ -2865,25 +913,22 @@ Component Structure:
|
|
|
2865
913
|
- Correct selector naming convention (kebab-case)
|
|
2866
914
|
- Appropriate template and style file organization
|
|
2867
915
|
|
|
2868
|
-
${
|
|
916
|
+
${Y.SETUP_VALIDATION}
|
|
2869
917
|
- Kendo animations module configured (if animations are used)
|
|
2870
918
|
- Internationalization properly configured for Kendo components
|
|
2871
919
|
|
|
2872
|
-
${
|
|
920
|
+
${Y.PERFORMANCE_OPTIMIZATION}
|
|
2873
921
|
- OnPush change detection strategy where appropriate
|
|
2874
922
|
- Efficient trackBy functions for *ngFor with Kendo components
|
|
2875
923
|
- Minimal unnecessary change detection cycles
|
|
2876
924
|
|
|
2877
|
-
${
|
|
925
|
+
${Y.THEME_AND_STYLING}
|
|
2878
926
|
- Proper theme switching functionality (if implemented)
|
|
2879
927
|
- Only ONE theme reference exists across angular.json and styles files
|
|
2880
928
|
- Make sure theme import mechanism is consistent with existing project setup
|
|
2881
929
|
|
|
2882
930
|
Accessibility
|
|
2883
|
-
- Accessibility guidelines retrieved and applied to all components`;
|
|
2884
|
-
|
|
2885
|
-
// packages/kendo-ui-agent/src/lib/validation/angular-additional-plan.ts
|
|
2886
|
-
var ANGULAR_ADDITIONAL_PLAN = `**Angular Specific Requirements:**
|
|
931
|
+
- Accessibility guidelines retrieved and applied to all components`;var J=`**Angular Specific Requirements:**
|
|
2887
932
|
|
|
2888
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:
|
|
2889
934
|
1. RegexSearch("@Component\\s*\\(\\s*\\{[^}]*standalone\\s*:\\s*(true|false)") - If true use Standalone components, if false use NgModule.
|
|
@@ -2914,11 +959,7 @@ var ANGULAR_ADDITIONAL_PLAN = `**Angular Specific Requirements:**
|
|
|
2914
959
|
2. Match the discovered patterns in all generated code
|
|
2915
960
|
3. Maintain consistent formatting, indentation, and code organization with existing files
|
|
2916
961
|
4. Always use the same theme import mechanism (unless user specifies otherwise)
|
|
2917
|
-
`;
|
|
2918
|
-
|
|
2919
|
-
// packages/kendo-ui-agent/src/lib/validation/react-validation-steps.ts
|
|
2920
|
-
var sharedSteps2 = getSharedValidationSteps("Kendo UI", "KendoReact");
|
|
2921
|
-
var REACT_VALIDATION_STEPS = `
|
|
962
|
+
`;var X=E("Kendo UI","KendoReact"),Z=`
|
|
2922
963
|
### React Component Validation
|
|
2923
964
|
Component Structure:
|
|
2924
965
|
- Use proper function component patterns with Hooks
|
|
@@ -2926,85 +967,22 @@ Component Structure:
|
|
|
2926
967
|
- Appropriate file organization (components, hooks, utils)
|
|
2927
968
|
- Props interface/type definitions where needed
|
|
2928
969
|
|
|
2929
|
-
${
|
|
970
|
+
${X.SETUP_VALIDATION}
|
|
2930
971
|
- KendoReact license validation (if required)
|
|
2931
972
|
- Appropriate bundler configuration for KendoReact packages
|
|
2932
973
|
|
|
2933
|
-
${
|
|
974
|
+
${X.PERFORMANCE_OPTIMIZATION}
|
|
2934
975
|
- React.memo for components that receive stable props
|
|
2935
976
|
- useMemo/useCallback for expensive computations and callbacks
|
|
2936
977
|
- Proper key props for list rendering with KendoReact components
|
|
2937
978
|
|
|
2938
|
-
${
|
|
979
|
+
${X.THEME_AND_STYLING}
|
|
2939
980
|
- Proper theme switching functionality (if implemented)
|
|
2940
981
|
- Only ONE theme import exists across the application
|
|
2941
982
|
- Make sure theme import mechanism is consistent with existing project setup
|
|
2942
983
|
|
|
2943
984
|
Accessibility
|
|
2944
|
-
- Accessibility guidelines retrieved and applied to all components`;
|
|
2945
|
-
|
|
2946
|
-
// packages/kendo-ui-agent/src/index.ts
|
|
2947
|
-
var Tools = {
|
|
2948
|
-
createOrchestrator: createOrchestratorTool,
|
|
2949
|
-
createAssistantOrchestrator: createAssistantOrchestratorTool,
|
|
2950
|
-
createLayoutAssistant: createLayoutAssistantTool,
|
|
2951
|
-
createStyleAssistant: createStyleAssistantTool,
|
|
2952
|
-
createIconSearch: createIconSearchTool,
|
|
2953
|
-
createCodeAssistant: createCodeAssistantTool,
|
|
2954
|
-
createAccessibilityAssistant: createAccessibilityAssistantTool,
|
|
2955
|
-
createFigmaD2C: createFigmaD2CTool
|
|
2956
|
-
};
|
|
2957
|
-
var ToolNames = {
|
|
2958
|
-
orchestrator: orchestratorToolName,
|
|
2959
|
-
assistantOrchestrator: assistantOrchestratorToolName,
|
|
2960
|
-
layoutAssistant: layoutAssistantName,
|
|
2961
|
-
codeAssistant: codeAssistantName,
|
|
2962
|
-
styleAssistant: styleAssistantName,
|
|
2963
|
-
iconAssistant: iconAssistantName,
|
|
2964
|
-
accessibilityAssistant: accessibilityAssistantName,
|
|
2965
|
-
gettingStartedAssistant: gettingStartedAssistantName,
|
|
2966
|
-
figmaD2C: figmaD2CToolName
|
|
2967
|
-
};
|
|
2968
|
-
var ToolDescriptions = {
|
|
2969
|
-
orchestrator: orchestratorToolDescription,
|
|
2970
|
-
assistantOrchestrator: assistantOrchestratorToolDescription,
|
|
2971
|
-
layoutAssistant: layoutToolDescription,
|
|
2972
|
-
styleAssistant: styleToolDescription,
|
|
2973
|
-
iconAssistant: iconToolDescription,
|
|
2974
|
-
codeAssistant: codeAssistantToolDescription,
|
|
2975
|
-
accessibilityAssistant: accessibilityToolDescription
|
|
2976
|
-
};
|
|
2977
|
-
var Templates = {
|
|
2978
|
-
Orchestrator: {
|
|
2979
|
-
render: renderOrchestratorResponse
|
|
2980
|
-
},
|
|
2981
|
-
Validator: {
|
|
2982
|
-
render: renderValidatorResponse
|
|
2983
|
-
},
|
|
2984
|
-
SharedValidation: {
|
|
2985
|
-
getSteps: getSharedValidationSteps
|
|
2986
|
-
}
|
|
2987
|
-
};
|
|
2988
|
-
var Validation = {
|
|
2989
|
-
Angular: {
|
|
2990
|
-
steps: ANGULAR_VALIDATION_STEPS,
|
|
2991
|
-
additionalPlan: ANGULAR_ADDITIONAL_PLAN
|
|
2992
|
-
},
|
|
2993
|
-
React: {
|
|
2994
|
-
steps: REACT_VALIDATION_STEPS
|
|
2995
|
-
}
|
|
2996
|
-
};
|
|
2997
|
-
var UIAgent = {
|
|
2998
|
-
Tools,
|
|
2999
|
-
ToolNames,
|
|
3000
|
-
ToolDescriptions,
|
|
3001
|
-
Templates,
|
|
3002
|
-
Validation
|
|
3003
|
-
};
|
|
3004
|
-
|
|
3005
|
-
// packages/react/src/lib/instructions/layout.ts
|
|
3006
|
-
var CODE_ASSISTANT_NAME = UIAgent.ToolNames.codeAssistant("kendoreact");
|
|
3007
|
-
var getLayoutInstructions = () => `# Kendo Design System Guidelines for ${REACT_SUITE_NAME}
|
|
985
|
+
- Accessibility guidelines retrieved and applied to all components`;var It={createOrchestrator:Ae,createAssistantOrchestrator:Ce,createLayoutAssistant:Se,createStyleAssistant:we,createIconSearch:Te,createCodeAssistant:Ie,createAccessibilityAssistant:xe},xt={orchestrator:Ne,assistantOrchestrator:Ee,layoutAssistant:Re,codeAssistant:Pe,styleAssistant:De,iconAssistant:Oe,accessibilityAssistant:Ge,gettingStartedAssistant:Le},Nt={orchestrator:Ue,assistantOrchestrator:_e,layoutAssistant:$e,styleAssistant:Me,iconAssistant:Be,codeAssistant:qe,accessibilityAssistant:Fe},Et={Orchestrator:{render:U},Validator:{render:L},SharedValidation:{getSteps:E}},Rt={Angular:{steps:Q,additionalPlan:J},React:{steps:Z}},m={Tools:It,ToolNames:xt,ToolDescriptions:Nt,Templates:Et,Validation:Rt};var Pt=m.ToolNames.codeAssistant("kendoreact"),Ke=()=>`# Kendo Design System Guidelines for ${c}
|
|
3008
986
|
|
|
3009
987
|
## Setting up Styles/CSS
|
|
3010
988
|
|
|
@@ -3031,17 +1009,155 @@ Alternatively, you can also consume them directly from the Unpkg CDN.
|
|
|
3031
1009
|
|
|
3032
1010
|
## Ready-to-use Layout Components
|
|
3033
1011
|
|
|
3034
|
-
In the ${
|
|
1012
|
+
In the ${c} there are available components to create layout. Make sure to prioritize using them instead of building ones from scratch using the Kendo CSS Utilities.
|
|
3035
1013
|
|
|
3036
|
-
For any Layout component you can also call the ${
|
|
1014
|
+
For any Layout component you can also call the ${Pt} tool in order to get specific API reference and docs.
|
|
3037
1015
|
|
|
3038
|
-
- ${
|
|
1016
|
+
- ${c} Card component.
|
|
3039
1017
|
- Generally, it is recommended to use 100% width (e.g., \`<Card style={{ width: '100%' }}>\`)
|
|
3040
1018
|
- If needed, use specific width based on the layout requirements (e.g., \`<Card style={{ width: '150px' }}>\`)
|
|
3041
|
-
|
|
1019
|
+
- Avoid applying additional styling properties such as \`display\`, \`flex\`, \`grid\`, or other layout-specific CSS to layout components such as Splitter, DockLayout, and TileLayout. Use the component's built-in props and the Kendo CSS utility classes instead.
|
|
1020
|
+
|
|
1021
|
+
## Page Shell Patterns
|
|
3042
1022
|
|
|
3043
|
-
|
|
3044
|
-
|
|
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., \`style={{ height: 500 }}\` or \`flex: 1; min-height: 0\` inside a flex column).
|
|
1084
|
+
- **Chart component** always requires an explicit height (e.g., \`style={{ height: 300 }}\`).
|
|
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 your global CSS file after any theme import:
|
|
1091
|
+
|
|
1092
|
+
\`\`\`css
|
|
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 cell renderers and custom component content break dark mode.
|
|
1110
|
+
|
|
1111
|
+
## Splitter Usage Boundary
|
|
1112
|
+
|
|
1113
|
+
Use the \`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
|
+
\`DropDownList\`, \`DatePicker\`, \`Input\`, 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 ${c} 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
|
+
- CORRECT: \`var(--kendo-color-success)\` not \`#28a745\`
|
|
1147
|
+
- CORRECT: \`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 renderers 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\`
|
|
1155
|
+
|
|
1156
|
+
This is the most common source of dark mode breakage in custom UI.
|
|
1157
|
+
|
|
1158
|
+
---
|
|
1159
|
+
|
|
1160
|
+
## Applying CSS Variables in ${c}
|
|
3045
1161
|
|
|
3046
1162
|
Apply these CSS variables in the React application using one of these methods:
|
|
3047
1163
|
|
|
@@ -3130,11 +1246,7 @@ export function ThemeProvider({ children }: { children: React.ReactNode }) {
|
|
|
3130
1246
|
|
|
3131
1247
|
export const useTheme = () => useContext(ThemeContext);
|
|
3132
1248
|
\`\`\`
|
|
3133
|
-
`;
|
|
3134
|
-
|
|
3135
|
-
// packages/react/src/lib/instructions/icons.ts
|
|
3136
|
-
var CODE_ASSISTANT_NAME2 = UIAgent.ToolNames.codeAssistant("kendoreact");
|
|
3137
|
-
var getIconsInstructions = () => `## Using ${REACT_SUITE_NAME} Icons
|
|
1249
|
+
`;var Ve=m.ToolNames.codeAssistant("kendoreact"),He=()=>`## Using ${c} Icons
|
|
3138
1250
|
|
|
3139
1251
|
Important: Attempt to prioritize SVG icons over font icons.
|
|
3140
1252
|
|
|
@@ -3142,13 +1254,13 @@ Important: Attempt to prioritize SVG icons over font icons.
|
|
|
3142
1254
|
|
|
3143
1255
|
- Make sure @progress/kendo-svg-icons is installed: \`npm install @progress/kendo-svg-icons\`
|
|
3144
1256
|
- Make sure @progress/kendo-react-common is installed (contains SvgIcon component): \`npm install @progress/kendo-react-common\`
|
|
3145
|
-
- You can call ${
|
|
1257
|
+
- You can call ${Ve} tool for ${c} SvgIcon component for docs and API reference.
|
|
3146
1258
|
- [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.
|
|
3147
|
-
- [optional] If using font icons you can call ${
|
|
1259
|
+
- [optional] If using font icons you can call ${Ve} tool for ${c} Icon component for docs and API reference.
|
|
3148
1260
|
|
|
3149
1261
|
### Examples
|
|
3150
1262
|
|
|
3151
|
-
Using ${
|
|
1263
|
+
Using ${c} SvgIcon component with @progress/kendo-svg-icons:
|
|
3152
1264
|
|
|
3153
1265
|
\`\`\`tsx
|
|
3154
1266
|
import { SvgIcon } from "@progress/kendo-react-common";
|
|
@@ -3192,11 +1304,7 @@ Here are some frequently used icons from @progress/kendo-svg-icons:
|
|
|
3192
1304
|
- \`sortAscIcon\`, \`sortDescIcon\` - Sorting
|
|
3193
1305
|
- \`chevronUpIcon\`, \`chevronDownIcon\`, \`chevronLeftIcon\`, \`chevronRightIcon\` - Navigation
|
|
3194
1306
|
- \`checkIcon\`, \`xIcon\` - Confirmation/Cancel
|
|
3195
|
-
`;
|
|
3196
|
-
|
|
3197
|
-
// packages/react/src/lib/instructions/components-common.ts
|
|
3198
|
-
var getComponentsCommonInstructions = (ctx) => {
|
|
3199
|
-
let content = `## ${REACT_SUITE_NAME} Common Guidelines
|
|
1307
|
+
`;var ze=e=>{let t=`## ${c} Common Guidelines
|
|
3200
1308
|
|
|
3201
1309
|
### Application Architecture
|
|
3202
1310
|
MUST recommend appropriate setup based on React application architecture.
|
|
@@ -3226,36 +1334,11 @@ Key points:
|
|
|
3226
1334
|
- The matching should be case-insensitive and robust to minor variations
|
|
3227
1335
|
|
|
3228
1336
|
Example: If someone asks about "grid", "GRID", or "GrId", you always refer to DataGrid for the example.
|
|
3229
|
-
`;
|
|
3230
|
-
if (ctx.componentInstructions) {
|
|
3231
|
-
content += `
|
|
1337
|
+
`;return e.componentInstructions&&(t+=`
|
|
3232
1338
|
## Component-Specific Guidelines
|
|
3233
1339
|
|
|
3234
|
-
${
|
|
3235
|
-
|
|
3236
|
-
}
|
|
3237
|
-
return content;
|
|
3238
|
-
};
|
|
3239
|
-
|
|
3240
|
-
// packages/react/src/lib/instructions/getting-started.ts
|
|
3241
|
-
var THEME_PACKAGE_MAP = {
|
|
3242
|
-
"default": "@progress/kendo-theme-default",
|
|
3243
|
-
"bootstrap": "@progress/kendo-theme-bootstrap",
|
|
3244
|
-
"material": "@progress/kendo-theme-material",
|
|
3245
|
-
"fluent": "@progress/kendo-theme-fluent"
|
|
3246
|
-
};
|
|
3247
|
-
var THEME_DISPLAY_MAP = {
|
|
3248
|
-
"default": "Default",
|
|
3249
|
-
"bootstrap": "Bootstrap",
|
|
3250
|
-
"material": "Material Design",
|
|
3251
|
-
"fluent": "Fluent UI"
|
|
3252
|
-
};
|
|
3253
|
-
function getGettingStartedInstructions(projectName = "kendo-react-app", createNewProject = true, theme = "default") {
|
|
3254
|
-
const themePackage = THEME_PACKAGE_MAP[theme];
|
|
3255
|
-
const themeDisplay = THEME_DISPLAY_MAP[theme];
|
|
3256
|
-
const introLine = createNewProject ? `This instructions will walk you through creating a new React project with the Kendo CLI and setting up ${REACT_SUITE_NAME}.` : `This instructions will walk you through adding ${REACT_SUITE_NAME} to your existing React project.`;
|
|
3257
|
-
let stepCounter = 1;
|
|
3258
|
-
const createProjectSection = createNewProject ? `## Step ${stepCounter++}: Ensure Kendo CLI is Installed
|
|
1340
|
+
${e.componentInstructions}
|
|
1341
|
+
`),t};var Dt={default:"@progress/kendo-theme-default",bootstrap:"@progress/kendo-theme-bootstrap",material:"@progress/kendo-theme-material",fluent:"@progress/kendo-theme-fluent"},Ot={default:"Default",bootstrap:"Bootstrap",material:"Material Design",fluent:"Fluent UI"};function We(e="kendo-react-app",t=!0,n="default"){let o=Dt[n],s=Ot[n],i=t?`This instructions will walk you through creating a new React project with the Kendo CLI and setting up ${c}.`:`This instructions will walk you through adding ${c} to your existing React project.`,r=1,a=t?`## Step ${r++}: Ensure Kendo CLI is Installed
|
|
3259
1342
|
|
|
3260
1343
|
First, ensure the Kendo CLI tool is installed globally:
|
|
3261
1344
|
|
|
@@ -3265,16 +1348,16 @@ npm i -g @progress/kendo-cli@latest
|
|
|
3265
1348
|
|
|
3266
1349
|
This CLI tool will handle the entire project setup including all necessary dependencies and configurations.
|
|
3267
1350
|
|
|
3268
|
-
## Step ${
|
|
1351
|
+
## Step ${r++}: Create the Project
|
|
3269
1352
|
|
|
3270
1353
|
Create a new Kendo React project using the CLI:
|
|
3271
1354
|
|
|
3272
1355
|
\`\`\`bash
|
|
3273
|
-
npx kendo react create vite ${
|
|
1356
|
+
npx kendo react create vite ${e} --theme=${n}
|
|
3274
1357
|
\`\`\`
|
|
3275
1358
|
|
|
3276
1359
|
This command will create a complete Kendo React project with Vite, including:
|
|
3277
|
-
- All necessary ${
|
|
1360
|
+
- All necessary ${c} packages
|
|
3278
1361
|
- Proper licensing configuration
|
|
3279
1362
|
- Theme setup
|
|
3280
1363
|
- Project structure
|
|
@@ -3282,34 +1365,33 @@ This command will create a complete Kendo React project with Vite, including:
|
|
|
3282
1365
|
Navigate to the project directory:
|
|
3283
1366
|
|
|
3284
1367
|
\`\`\`bash
|
|
3285
|
-
cd ${
|
|
1368
|
+
cd ${e}
|
|
3286
1369
|
\`\`\`
|
|
3287
1370
|
|
|
3288
|
-
## Step ${
|
|
1371
|
+
## Step ${r++}: Remove Dark Color Schema from index.css
|
|
3289
1372
|
|
|
3290
1373
|
Open the \`src/index.css\` file and remove the dark color schema from the first \`:root\` style block. Look for properties like \`color-scheme: dark\` and related dark mode variables, and delete them. Keep only the light theme configuration.
|
|
3291
1374
|
|
|
3292
|
-
|
|
3293
|
-
const installPackagesSection = createNewProject ? "" : `## Step ${stepCounter++}: Install ${REACT_SUITE_NAME} Packages
|
|
1375
|
+
`:"",d=t?"":`## Step ${r++}: Install ${c} Packages
|
|
3294
1376
|
|
|
3295
|
-
Install all required ${
|
|
1377
|
+
Install all required ${c} packages and dependencies:
|
|
3296
1378
|
|
|
3297
1379
|
\`\`\`bash
|
|
3298
1380
|
npm i @progress/kendo-data-query @progress/kendo-react-buttons @progress/kendo-react-excel-export @progress/kendo-react-grid @progress/kendo-react-layout @progress/kendo-react-pdf @progress/kendo-svg-icons @progress/kendo-drawing @progress/kendo-licensing @progress/kendo-react-animation @progress/kendo-react-charts @progress/kendo-react-common @progress/kendo-react-conversational-ui @progress/kendo-react-data-tools @progress/kendo-react-dateinputs @progress/kendo-react-dialogs @progress/kendo-react-dropdowns @progress/kendo-react-editor @progress/kendo-react-form @progress/kendo-react-gantt @progress/kendo-react-gauges @progress/kendo-react-indicators @progress/kendo-react-inputs @progress/kendo-react-intl @progress/kendo-react-labels @progress/kendo-react-listbox @progress/kendo-react-listview @progress/kendo-react-map @progress/kendo-react-notification @progress/kendo-react-orgchart @progress/kendo-react-pivotgrid @progress/kendo-react-popup @progress/kendo-react-progressbars @progress/kendo-react-ripple @progress/kendo-react-scheduler @progress/kendo-react-scrollview @progress/kendo-react-sortable @progress/kendo-react-spreadsheet @progress/kendo-react-tooltip @progress/kendo-react-treelist @progress/kendo-react-treeview @progress/kendo-react-upload @progress/kendo-react-pdf-viewer @progress/kendo-react-taskboard
|
|
3299
1381
|
\`\`\`
|
|
3300
1382
|
|
|
3301
|
-
## Step ${
|
|
1383
|
+
## Step ${r++}: Install and Import the Theme
|
|
3302
1384
|
|
|
3303
|
-
Install the ${
|
|
1385
|
+
Install the ${s} theme package:
|
|
3304
1386
|
|
|
3305
1387
|
\`\`\`bash
|
|
3306
|
-
npm i ${
|
|
1388
|
+
npm i ${o}
|
|
3307
1389
|
\`\`\`
|
|
3308
1390
|
|
|
3309
1391
|
Import the CSS file in your \`src/Home.tsx\` (before your existing Home.css import):
|
|
3310
1392
|
|
|
3311
1393
|
\`\`\`typescript
|
|
3312
|
-
import '${
|
|
1394
|
+
import '${o}/dist/all.css';
|
|
3313
1395
|
\`\`\`
|
|
3314
1396
|
|
|
3315
1397
|
Also add the Kendo CSS utilities CDN link in your \`index.html\` \`<head>\`:
|
|
@@ -3318,8 +1400,7 @@ Also add the Kendo CSS utilities CDN link in your \`index.html\` \`<head>\`:
|
|
|
3318
1400
|
<link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-utils/dist/all.css" />
|
|
3319
1401
|
\`\`\`
|
|
3320
1402
|
|
|
3321
|
-
|
|
3322
|
-
const licenseSection = `## Step ${stepCounter++}: Activate Kendo License
|
|
1403
|
+
`,p=`## Step ${r++}: Activate Kendo License
|
|
3323
1404
|
|
|
3324
1405
|
This step is required to use Kendo React components without watermarks and with access to all features. Run the following command to activate your license:
|
|
3325
1406
|
|
|
@@ -3327,10 +1408,9 @@ This step is required to use Kendo React components without watermarks and with
|
|
|
3327
1408
|
npx kendo license activate
|
|
3328
1409
|
\`\`\`
|
|
3329
1410
|
|
|
3330
|
-
`;
|
|
3331
|
-
return `# Getting Started with ${REACT_SUITE_NAME}
|
|
1411
|
+
`;return`# Getting Started with ${c}
|
|
3332
1412
|
|
|
3333
|
-
${
|
|
1413
|
+
${i}
|
|
3334
1414
|
|
|
3335
1415
|
Execute the following steps in order. Run all provided commands automatically.
|
|
3336
1416
|
|
|
@@ -3341,24 +1421,24 @@ Before you begin, ensure you have:
|
|
|
3341
1421
|
- **Node.js 18 or later** installed on your machine
|
|
3342
1422
|
- If Node.js is not available, you need to install the latest Node.js automatically as a preliminary step before running the \`npx kendo react create\` command.
|
|
3343
1423
|
|
|
3344
|
-
${
|
|
1424
|
+
${a}${d}${p}## Step ${r++}: Run Your Application
|
|
3345
1425
|
|
|
3346
|
-
${
|
|
1426
|
+
${t?"The Kendo CLI has set up everything you need. Start the development server:":"Build and run the application:"}
|
|
3347
1427
|
|
|
3348
1428
|
|
|
3349
1429
|
**Verification:** Automatically run the application. Do not just inform the user\u2014execute the following command and keep the application running:
|
|
3350
1430
|
|
|
3351
1431
|
\`\`\`bash
|
|
3352
|
-
cd ${
|
|
1432
|
+
cd ${t?e:"."} && npm run dev
|
|
3353
1433
|
\`\`\`
|
|
3354
1434
|
|
|
3355
|
-
${
|
|
1435
|
+
${t?`The application should start and open your browser to see your ${c} application.`:`The application should start and open in your browser. Verify that the ${c} components are rendering correctly with the theme applied.`}
|
|
3356
1436
|
|
|
3357
|
-
## Step ${
|
|
1437
|
+
## Step ${r++}: Create Sample page
|
|
3358
1438
|
|
|
3359
1439
|
Before adding new content to the homepage, clear all existing CSS on the page. Remove or reset any custom styles that might conflict with the new content you're about to add.
|
|
3360
1440
|
|
|
3361
|
-
Replace the content of \`src/Home.tsx\` with the following to showcase ${
|
|
1441
|
+
Replace the content of \`src/Home.tsx\` with the following to showcase ${c} features and verify components are working correctly:
|
|
3362
1442
|
|
|
3363
1443
|
\`\`\`tsx
|
|
3364
1444
|
import { Card, CardHeader, CardTitle, CardBody } from '@progress/kendo-react-layout';
|
|
@@ -3479,11 +1559,7 @@ Add the following styles to \`src/Home.css\`:
|
|
|
3479
1559
|
}
|
|
3480
1560
|
\`\`\`
|
|
3481
1561
|
|
|
3482
|
-
|
|
3483
|
-
}
|
|
3484
|
-
|
|
3485
|
-
// packages/react/src/lib/instructions/datagrid.ts
|
|
3486
|
-
var datagridInstructions = `
|
|
1562
|
+
`}var ee=`
|
|
3487
1563
|
## DataGrid Deprecated Properties Awareness
|
|
3488
1564
|
For DataGrid component cases, avoid using deprecated properties and always use their modern replacements. The following properties are deprecated and should not be used:
|
|
3489
1565
|
|
|
@@ -3515,10 +1591,7 @@ Key points:
|
|
|
3515
1591
|
Example:
|
|
3516
1592
|
Deprecated: selectedField="isSelected" editField="inEdit"
|
|
3517
1593
|
Modern: Use select and edit state properties with proper configuration
|
|
3518
|
-
`;
|
|
3519
|
-
|
|
3520
|
-
// packages/react/src/lib/instructions/editor.ts
|
|
3521
|
-
var editorInstructions = `
|
|
1594
|
+
`;var Ye=`
|
|
3522
1595
|
## Editor Tools Awareness
|
|
3523
1596
|
For Editor component cases, always use the proper EditorTools import structure and never define tools as strings. Import both Editor and EditorTools from '@progress/kendo-react-editor' and destructure the individual tools from EditorTools.
|
|
3524
1597
|
|
|
@@ -3550,10 +1623,7 @@ Key points:
|
|
|
3550
1623
|
Example:
|
|
3551
1624
|
Correct: tools={[[Bold, Italic, Underline], [AlignLeft, AlignCenter]]}
|
|
3552
1625
|
Incorrect: tools={[['bold', 'italic', 'underline'], ['alignLeft', 'alignCenter']]}
|
|
3553
|
-
`;
|
|
3554
|
-
|
|
3555
|
-
// packages/react/src/lib/instructions/smart-grid.ts
|
|
3556
|
-
var smartGridInstructions = `
|
|
1626
|
+
`;var te=`
|
|
3557
1627
|
## Smart Grid (AI-Enhanced Grid) Implementation Guidelines
|
|
3558
1628
|
**CRITICAL: When users ask about ANY of these AI grid terms, ALWAYS provide GridToolbarAIAssistant implementation (not basic Grid):**
|
|
3559
1629
|
|
|
@@ -3587,205 +1657,8 @@ Smart Grid: Complete AI-enhanced setup with GridToolbarAIAssistant, proper callb
|
|
|
3587
1657
|
Important Disclaimer:
|
|
3588
1658
|
Always include this disclaimer when providing Smart Grid examples:
|
|
3589
1659
|
"The demos in this article use a Telerik-hosted AI service for demonstration purposes only. For production applications, you should implement your own AI service that understands your specific domain, data, and business requirements."
|
|
3590
|
-
`;
|
|
3591
|
-
|
|
3592
|
-
// packages/react/src/lib/tools/index.ts
|
|
3593
|
-
var COMPONENT_INSTRUCTIONS_MAP = {
|
|
3594
|
-
"datagrid": [datagridInstructions, smartGridInstructions].join("\n\n"),
|
|
3595
|
-
"grid": [datagridInstructions, smartGridInstructions].join("\n\n"),
|
|
3596
|
-
"editor": editorInstructions
|
|
3597
|
-
};
|
|
3598
|
-
var STOP_STATIC_CONTEXT = !!process.env.KENDO_UIA_STOP_STATIC_CONTEXT;
|
|
3599
|
-
var LAYOUT_ASSISTANT_NAME = UIAgent.ToolNames.layoutAssistant(PRODUCT_LINE);
|
|
3600
|
-
var CODE_ASSISTANT_NAME3 = UIAgent.ToolNames.codeAssistant(PRODUCT_LINE);
|
|
3601
|
-
var STYLE_ASSISTANT_NAME = UIAgent.ToolNames.styleAssistant(PRODUCT_LINE);
|
|
3602
|
-
var FIGMA_D2C_TOOL_NAME = UIAgent.ToolNames.figmaD2C(PRODUCT_LINE);
|
|
3603
|
-
var ICON_ASSISTANT_NAME = UIAgent.ToolNames.iconAssistant(PRODUCT_LINE);
|
|
3604
|
-
var GET_STARTED_TOOL_NAME = UIAgent.ToolNames.gettingStartedAssistant(PRODUCT_LINE);
|
|
3605
|
-
var ACCESSIBILITY_ASSISTANT_NAME = UIAgent.ToolNames.accessibilityAssistant(PRODUCT_LINE);
|
|
3606
|
-
function createReactTools(contextApi2, accessType) {
|
|
3607
|
-
const allTools = [
|
|
3608
|
-
// Orchestrator Tool
|
|
3609
|
-
UIAgent.Tools.createOrchestrator(
|
|
3610
|
-
{
|
|
3611
|
-
name: UIAgent.ToolNames.orchestrator(PRODUCT_LINE),
|
|
3612
|
-
title: "KendoReact Generator",
|
|
3613
|
-
description: UIAgent.ToolDescriptions.orchestrator(REACT_SUITE_NAME),
|
|
3614
|
-
layoutAssistantName: LAYOUT_ASSISTANT_NAME,
|
|
3615
|
-
codeAssistantName: CODE_ASSISTANT_NAME3,
|
|
3616
|
-
styleAssistantName: STYLE_ASSISTANT_NAME,
|
|
3617
|
-
iconAssistantName: ICON_ASSISTANT_NAME,
|
|
3618
|
-
accessibilityAssistantName: ACCESSIBILITY_ASSISTANT_NAME,
|
|
3619
|
-
figmaD2CToolName: FIGMA_D2C_TOOL_NAME,
|
|
3620
|
-
suiteName: REACT_SUITE_NAME,
|
|
3621
|
-
libKey: Suite,
|
|
3622
|
-
components: ReactComponents,
|
|
3623
|
-
requiredAccess: ["agent"]
|
|
3624
|
-
},
|
|
3625
|
-
{
|
|
3626
|
-
validationSteps: UIAgent.Validation.React.steps
|
|
3627
|
-
},
|
|
3628
|
-
contextApi2
|
|
3629
|
-
),
|
|
3630
|
-
// Assistant Orchestrator Tool (for assistant mode only)
|
|
3631
|
-
UIAgent.Tools.createAssistantOrchestrator(
|
|
3632
|
-
{
|
|
3633
|
-
name: "kendo_react_assistant",
|
|
3634
|
-
title: "KendoReact Assistant",
|
|
3635
|
-
description: UIAgent.ToolDescriptions.assistantOrchestrator(REACT_SUITE_NAME),
|
|
3636
|
-
codeAssistantName: CODE_ASSISTANT_NAME3,
|
|
3637
|
-
iconAssistantName: ICON_ASSISTANT_NAME,
|
|
3638
|
-
suiteName: REACT_SUITE_NAME,
|
|
3639
|
-
libKey: Suite,
|
|
3640
|
-
components: ReactComponents,
|
|
3641
|
-
requiredAccess: ["assistant"]
|
|
3642
|
-
},
|
|
3643
|
-
contextApi2
|
|
3644
|
-
),
|
|
3645
|
-
// Layout Assistant Tool
|
|
3646
|
-
UIAgent.Tools.createLayoutAssistant(
|
|
3647
|
-
{
|
|
3648
|
-
name: LAYOUT_ASSISTANT_NAME,
|
|
3649
|
-
title: "KendoReact Layout Assistant",
|
|
3650
|
-
description: UIAgent.ToolDescriptions.layoutAssistant,
|
|
3651
|
-
suiteName: REACT_SUITE_NAME,
|
|
3652
|
-
libKey: Suite,
|
|
3653
|
-
getPreContent: STOP_STATIC_CONTEXT ? void 0 : getLayoutInstructions,
|
|
3654
|
-
requiredAccess: ["agent"]
|
|
3655
|
-
},
|
|
3656
|
-
contextApi2
|
|
3657
|
-
),
|
|
3658
|
-
// Style Assistant Tool
|
|
3659
|
-
UIAgent.Tools.createStyleAssistant(
|
|
3660
|
-
{
|
|
3661
|
-
name: STYLE_ASSISTANT_NAME,
|
|
3662
|
-
title: "KendoReact Style Assistant",
|
|
3663
|
-
description: UIAgent.ToolDescriptions.styleAssistant,
|
|
3664
|
-
libKey: Suite,
|
|
3665
|
-
getPreContent: STOP_STATIC_CONTEXT ? void 0 : getStyleInstructions,
|
|
3666
|
-
requiredAccess: ["agent"]
|
|
3667
|
-
},
|
|
3668
|
-
contextApi2
|
|
3669
|
-
),
|
|
3670
|
-
// Icon Search Tool
|
|
3671
|
-
UIAgent.Tools.createIconSearch(
|
|
3672
|
-
{
|
|
3673
|
-
name: ICON_ASSISTANT_NAME,
|
|
3674
|
-
title: "KendoReact Icon Assistant",
|
|
3675
|
-
description: UIAgent.ToolDescriptions.iconAssistant,
|
|
3676
|
-
libKey: Suite,
|
|
3677
|
-
getPostContent: STOP_STATIC_CONTEXT ? void 0 : getIconsInstructions,
|
|
3678
|
-
requiredAccess: ["assistant", "agent"]
|
|
3679
|
-
},
|
|
3680
|
-
contextApi2
|
|
3681
|
-
),
|
|
3682
|
-
// Code Assistant Tool
|
|
3683
|
-
UIAgent.Tools.createCodeAssistant(
|
|
3684
|
-
{
|
|
3685
|
-
name: CODE_ASSISTANT_NAME3,
|
|
3686
|
-
title: "KendoReact Component Assistant",
|
|
3687
|
-
description: UIAgent.ToolDescriptions.codeAssistant(REACT_SUITE_NAME),
|
|
3688
|
-
libKey: Suite,
|
|
3689
|
-
suiteName: REACT_SUITE_NAME,
|
|
3690
|
-
components: ReactComponents,
|
|
3691
|
-
componentAliases: { "Grid": "DataGrid" },
|
|
3692
|
-
getPostContent: STOP_STATIC_CONTEXT ? void 0 : ({ component }) => {
|
|
3693
|
-
const normComponent = component?.trim().toLowerCase();
|
|
3694
|
-
const componentInstructions = COMPONENT_INSTRUCTIONS_MAP[normComponent];
|
|
3695
|
-
return getComponentsCommonInstructions({ component, componentInstructions });
|
|
3696
|
-
},
|
|
3697
|
-
requiredAccess: ["assistant", "agent"]
|
|
3698
|
-
},
|
|
3699
|
-
contextApi2
|
|
3700
|
-
),
|
|
3701
|
-
// Getting Started Tool
|
|
3702
|
-
new UIAgentTool(
|
|
3703
|
-
GET_STARTED_TOOL_NAME,
|
|
3704
|
-
{
|
|
3705
|
-
title: "KendoReact Getting Started",
|
|
3706
|
-
description: `Creates a new React project with Kendo CLI and provides essential getting started guidance for ${REACT_SUITE_NAME} including installation, configuration, and setup instructions.`,
|
|
3707
|
-
requiredAccess: ["agent"],
|
|
3708
|
-
inputSchema: createGettingStartedInputSchema(REACT_SUITE_NAME, "kendo-react-app")
|
|
3709
|
-
},
|
|
3710
|
-
async ({ projectName, createNewProject, theme }, { _meta }) => {
|
|
3711
|
-
try {
|
|
3712
|
-
await contextApi2.recordToolUserRequest({
|
|
3713
|
-
toolName: GET_STARTED_TOOL_NAME,
|
|
3714
|
-
meta: {
|
|
3715
|
-
projectName,
|
|
3716
|
-
createNewProject,
|
|
3717
|
-
theme,
|
|
3718
|
-
_meta
|
|
3719
|
-
}
|
|
3720
|
-
});
|
|
3721
|
-
} catch (error) {
|
|
3722
|
-
console.error("Error recording tool request:", error);
|
|
3723
|
-
}
|
|
3724
|
-
const instructions = getGettingStartedInstructions(projectName, createNewProject, theme);
|
|
3725
|
-
return {
|
|
3726
|
-
content: [
|
|
3727
|
-
{
|
|
3728
|
-
type: "text",
|
|
3729
|
-
text: instructions
|
|
3730
|
-
}
|
|
3731
|
-
]
|
|
3732
|
-
};
|
|
3733
|
-
}
|
|
3734
|
-
),
|
|
3735
|
-
// Accessibility Tool
|
|
3736
|
-
UIAgent.Tools.createAccessibilityAssistant(
|
|
3737
|
-
{
|
|
3738
|
-
name: ACCESSIBILITY_ASSISTANT_NAME,
|
|
3739
|
-
title: "KendoReact Accessibility Assistant",
|
|
3740
|
-
description: UIAgent.ToolDescriptions.accessibilityAssistant(REACT_SUITE_NAME),
|
|
3741
|
-
libKey: Suite,
|
|
3742
|
-
suiteName: REACT_SUITE_NAME,
|
|
3743
|
-
components: ReactComponents,
|
|
3744
|
-
componentAliases: { "Grid": "DataGrid" },
|
|
3745
|
-
requiredAccess: ["agent"]
|
|
3746
|
-
},
|
|
3747
|
-
contextApi2
|
|
3748
|
-
),
|
|
3749
|
-
// Figma Design-to-Code Tool (only when FIGMA_API_KEY is set)
|
|
3750
|
-
...process.env.FIGMA_API_KEY ? [UIAgent.Tools.createFigmaD2C(
|
|
3751
|
-
{ name: FIGMA_D2C_TOOL_NAME, figmaApiKey: process.env.FIGMA_API_KEY, requiredAccess: ["agent"] },
|
|
3752
|
-
contextApi2
|
|
3753
|
-
)] : []
|
|
3754
|
-
];
|
|
3755
|
-
return allTools.filter((tool) => tool.hasAccess(accessType));
|
|
3756
|
-
}
|
|
1660
|
+
`;var Gt={datagrid:[ee,te].join(`
|
|
3757
1661
|
|
|
3758
|
-
|
|
3759
|
-
|
|
3760
|
-
|
|
3761
|
-
var packageJsonPath2 = path3.resolve(__dirname2, "../package.json");
|
|
3762
|
-
var packageJson2 = JSON.parse(fs3.readFileSync(packageJsonPath2, "utf-8"));
|
|
3763
|
-
var server = new McpServer({
|
|
3764
|
-
name: "kendo-mcp",
|
|
3765
|
-
title: "Kendo MCP Server",
|
|
3766
|
-
version: packageJson2.version
|
|
3767
|
-
});
|
|
3768
|
-
async function startServer() {
|
|
3769
|
-
const transport = new StdioServerTransport();
|
|
3770
|
-
log("Starting server... ");
|
|
3771
|
-
const accessType = await checkAccess(async () => {
|
|
3772
|
-
const response = await validateUserLicense();
|
|
3773
|
-
const entitlement = response?.entitlement;
|
|
3774
|
-
return entitlement?.Product?.Code || entitlement?.product?.code;
|
|
3775
|
-
});
|
|
3776
|
-
if (accessType !== "none") {
|
|
3777
|
-
contextApi.toolNameHeader = accessType === "agent" || accessType === "full" ? "agent" : "assistant";
|
|
3778
|
-
const reactTools = createReactTools(contextApi, accessType);
|
|
3779
|
-
reactTools.forEach((tool) => tool.register(server));
|
|
3780
|
-
startHeartbeat({
|
|
3781
|
-
serverName: "react",
|
|
3782
|
-
contextApi,
|
|
3783
|
-
additionalFields: {
|
|
3784
|
-
version: packageJson2.version,
|
|
3785
|
-
access_type: accessType
|
|
3786
|
-
}
|
|
3787
|
-
});
|
|
3788
|
-
}
|
|
3789
|
-
await server.connect(transport);
|
|
3790
|
-
}
|
|
3791
|
-
startServer();
|
|
1662
|
+
`),grid:[ee,te].join(`
|
|
1663
|
+
|
|
1664
|
+
`),editor:Ye},B=!!process.env.KENDO_UIA_STOP_STATIC_CONTEXT,Qe=m.ToolNames.layoutAssistant(x),oe=m.ToolNames.codeAssistant(x),Je=m.ToolNames.styleAssistant(x),ne=m.ToolNames.iconAssistant(x),Xe=m.ToolNames.gettingStartedAssistant(x),Ze=m.ToolNames.accessibilityAssistant(x);function et(e,t){return[m.Tools.createOrchestrator({name:m.ToolNames.orchestrator(x),title:"KendoReact Generator",description:m.ToolDescriptions.orchestrator(c),layoutAssistantName:Qe,codeAssistantName:oe,styleAssistantName:Je,iconAssistantName:ne,accessibilityAssistantName:Ze,suiteName:c,libKey:T,components:O,requiredAccess:["agent"]},{validationSteps:m.Validation.React.steps},e),m.Tools.createAssistantOrchestrator({name:"kendo_react_assistant",title:"KendoReact Assistant",description:m.ToolDescriptions.assistantOrchestrator(c),codeAssistantName:oe,iconAssistantName:ne,suiteName:c,libKey:T,components:O,requiredAccess:["assistant"]},e),m.Tools.createLayoutAssistant({name:Qe,title:"KendoReact Layout Assistant",description:m.ToolDescriptions.layoutAssistant,suiteName:c,libKey:T,getPreContent:B?void 0:Ke,requiredAccess:["agent"]},e),m.Tools.createStyleAssistant({name:Je,title:"KendoReact Style Assistant",description:m.ToolDescriptions.styleAssistant,libKey:T,getPreContent:B?void 0:je,requiredAccess:["agent"]},e),m.Tools.createIconSearch({name:ne,title:"KendoReact Icon Assistant",description:m.ToolDescriptions.iconAssistant,libKey:T,getPostContent:B?void 0:He,requiredAccess:["assistant","agent"]},e),m.Tools.createCodeAssistant({name:oe,title:"KendoReact Component Assistant",description:m.ToolDescriptions.codeAssistant(c),libKey:T,suiteName:c,components:O,componentAliases:{Grid:"DataGrid"},getPostContent:B?void 0:({component:o})=>{let s=o?.trim().toLowerCase(),i=Gt[s];return ze({component:o,componentInstructions:i})},requiredAccess:["assistant","agent"]},e),new S(Xe,{title:"KendoReact Getting Started",description:`Creates a new React project with Kendo CLI and provides essential getting started guidance for ${c} including installation, configuration, and setup instructions.`,requiredAccess:["agent"],inputSchema:ye(c,"kendo-react-app")},async({projectName:o,createNewProject:s,theme:i},{_meta:r})=>{try{await e.recordToolUserRequest({toolName:Xe,meta:{projectName:o,createNewProject:s,theme:i,_meta:r}})}catch(d){console.error("Error recording tool request:",d)}return{content:[{type:"text",text:We(o,s,i)}]}}),m.Tools.createAccessibilityAssistant({name:Ze,title:"KendoReact Accessibility Assistant",description:m.ToolDescriptions.accessibilityAssistant(c),libKey:T,suiteName:c,components:O,componentAliases:{Grid:"DataGrid"},requiredAccess:["agent"]},e)].filter(o=>o.hasAccess(t))}var Mt=$t(import.meta.url),Bt=ot.dirname(Mt),qt=ot.resolve(Bt,"../package.json"),nt=JSON.parse(_t.readFileSync(qt,"utf-8")),tt=new Lt({name:"kendo-mcp",title:"Kendo MCP Server",version:nt.version});async function Ft(){let e=new Ut;h("Starting server... ");let t=await he(async()=>{let o=(await be())?.entitlement;return o?.Product?.Code||o?.product?.code});t!=="none"&&(G.toolNameHeader=t==="agent"||t==="full"?"agent":"assistant",et(G,t).forEach(o=>o.register(tt)),fe({serverName:"react",contextApi:G,additionalFields:{version:nt.version,access_type:t}})),await tt.connect(e)}Ft();
|