@progress/kendo-react-mcp 1.6.2-beta.cd97a7ec.0 → 1.7.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 +456 -2849
- package/package.json +1 -1
- package/proto/service.proto +0 -66
package/dist/index.js
CHANGED
|
@@ -1,804 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import{McpServer as It}from"@modelcontextprotocol/sdk/server/mcp.js";import{StdioServerTransport as Nt}from"@modelcontextprotocol/sdk/server/stdio.js";import{dirname as mt,join as ut}from"path";import{fileURLToPath as ht}from"url";import{loadLicense as tt,decodeLicenseKey as ot,decodeLicenseEvidence as nt}from"@progress/kendo-licensing/utils";var q=class extends Error{constructor(t){super(t),this.name="LicenseError"}};function se(e){return e.replace(/^\uFEFF/,"")}async function ae(e){let t=null,n=null;try{let o=tt();if(!o.success){let s=new q(o.message);throw e&&await e("license_load_failed",{error:o.message}).catch(()=>{}),s}try{t=(await ot(o.value)).licenses.find(async r=>!!(await nt(r)).userId)}catch(s){console.log(s.message),e&&await e("license_load_failed",{error:s.message||"Unknown decoding error"}).catch(()=>{})}if(!t)return[se(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[se(t),null]}import P from"node:fs";import _ from"node:path";var B=!1,x=process.env.DEBUG_LOG_FILE,re=!!(x&&typeof x=="string");if(re){let e=_.resolve(x),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 B=!1;B=re&&!!x&&P.existsSync(_.resolve(x));function h(...e){if(B&&x){let o=`${new Date().toISOString()}: ${e.join(" ")}
|
|
3
|
+
`,s=_.resolve(x);P.appendFile(s,o,r=>{r&&console.error("Error writing to log file:",r)})}}import st from"@grpc/proto-loader";import D from"@grpc/grpc-js";import ce from"path";import ie from"fs";import{fileURLToPath as at}from"url";var rt=at(import.meta.url),it=ce.dirname(rt),de={version:"unknown"},le=ce.resolve(it,"../package.json");ie.existsSync(le)&&(de=JSON.parse(ie.readFileSync(le,"utf-8")));function lt(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=st.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 r=D.loadPackageDefinition(s);this.client=new r.ContextQueryService(this.contextApiUrl||"contextapi.telerik.com:443",this.isDev?D.credentials.createInsecure():D.credentials.createSsl())}async getMetadata({meta:t}={meta:{}}){let[n,o]=this.isDev?["fake_license",null]:await ae((m,b)=>this.logEvent(m,b)),s=process.env.CONTEXTAPI_API_KEY,r=s&&typeof s=="string",a=n&&typeof n=="string";if(!a&&!r&&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 i=new D.Metadata;if(a)try{i.add("x-license-key",n)}catch(m){throw h("Error adding license key to metadata:",m),new Error(`Failed to use license key: ${m.message}`)}r&&i.add("x-api-key",s),this.options?.libName&&i.add("x-library-name",this.options.libName),i.add("x-tool-name",this.toolNameHeader);let d=JSON.stringify({...t,source:"npm",version:de.version,os:process.platform,node_version:process.version});return i.add("x-request-metadata",lt(d)),i}async query(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.query(t,o,(a,i)=>{a?r(new Error(a)):s(i)})})}async getApiRefMatches(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.getApiRefMatches(t,o,(a,i)=>{a?r(new Error(a)):s(i)})})}async queryCssUtils(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.cssUtilsSearch(t,o,(a,i)=>{a?(h("Error querying CSS Utils:",a),r(new Error(a))):s(i)})})}async queryIconsSearch(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.iconsSearch(t,o,(a,i)=>{a?(h("Error querying Icons Search:",a),r(new Error(a))):s(i)})})}async queryBuildingBlocks(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.buildingBlocksSearch(t,o,(a,i)=>{a?(h("Error querying Building Blocks:",a),r(new Error(a))):s(i)})})}async validateUserLicense(){let t=await this.getMetadata();return new Promise((n,o)=>{this.client.validateUserLicense(null,t,(s,r)=>{s?(h("Error validating user license:",s),o(new Error(s))):n(r)})})}async queryThemeGenerate(t,n){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.generateTheme(t,o,(a,i)=>{a?(h("Error querying context API/GenerateTheme:",a),r(new Error(a))):s(i)})})}async recordOrchestratorUserRequest({meta:t}){let n=await this.getMetadata({meta:t});return new Promise((o,s)=>{this.client.recordOrchestratorUserRequest(null,n,(r,a)=>{r?(h("Error recording orchestrator user request:",r),s(new Error(r))):o(a)})})}async recordToolUserRequest({toolName:t,meta:n}){let o=await this.getMetadata({meta:n});return new Promise((s,r)=>{this.client.recordToolUserRequest({tool_name:t},o,(a,i)=>{a?(h("Error recording tool user request:",a),r(new Error(a))):s(i)})})}async logEvent(t,n){let o="h8utJ6rk4PpIWX4JMn9beQDsjVUri6KV0XYfiVwq";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((r,a)=>{this.client.logEvent({event_name:t,fields:n||{}},s,(i,d)=>{i?(h("Error logging event:",i),a(new Error(i))):r()})})}};import{z as F}from"zod";var Jt=F.object({user_id:F.string(),user_email:F.string().email()});import{z as C}from"zod";var ct=C.object({Product:C.object({Id:C.number().int(),Code:C.string(),Name:C.string()}),License:C.nullable(C.object({Id:C.number().int(),Name:C.string(),Type:C.string(),Active:C.boolean()})),Availability:C.array(C.object({LicenseStart:C.nullable(C.string().datetime()),LicenseEnd:C.nullable(C.string().datetime())})),IsLicenseAvailable:C.optional(C.boolean())}),eo=C.array(ct);async function pe(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 me(){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 dt=1440*60*1e3;function ue(e){let{serverName:t,contextApi:n,additionalFields:o={},intervalMs:s=dt}=e,r="mcp_server_heartbeat",a=async()=>{try{let d={server_name:t,timestamp:new Date().toISOString(),...o};await n.logEvent(r,d)}catch(d){h(`Failed to send heartbeat for ${t}:`,d)}};a();let i=setInterval(a,s);return()=>{clearInterval(i),h(`Heartbeat stopped for ${t}`)}}import{z as K}from"zod";var pt=["default","bootstrap","material","fluent"];function he(e,t){return{projectName:K.string().default(t).describe("The name of the project. Used as the project folder name when creating a new project."),createNewProject:K.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:K.enum(pt).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",N="kendo";var G=["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 gt=ut(mt(ht(import.meta.url)),"../proto/service.proto"),O=new M("contextapi.telerik.com:443",gt,{libName:T});var ge=async()=>O.validateUserLicense();import xt from"fs";import Je from"path";import{fileURLToPath as Et}from"url";import{z as A}from"zod";var w=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,148 @@ 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
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
-
|
|
852
|
-
-
|
|
853
|
-
- Use
|
|
854
|
-
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
-
|
|
859
|
-
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
49
|
+
`;var j=()=>`## 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 U=(e,t)=>{let n=L({suiteName:e.suiteName,libKey:e.libKey},t.validationSteps),o=e.libKey==="angular"?"- **Drag and Drop**: Consider using the DragandDrop and Sortable components when drag-and-drop functionality is needed.":"",s=e.components?e.components.join(", "):"components";return`# \u{1F3AF} ${e.suiteName} - Execution Plan
|
|
874
151
|
|
|
875
152
|
**Current Goal:**
|
|
876
153
|
|
|
877
|
-
${
|
|
154
|
+
${e.userIntent}
|
|
878
155
|
|
|
879
156
|
**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
|
-
|
|
157
|
+
- **Framework:** ${e.libKey}
|
|
158
|
+
${e.includeComponentsDocs?`- **Component Library:** ${e.suiteName}
|
|
159
|
+
- Ensure to use ONLY ${e.suiteName} components for all UI elements.
|
|
160
|
+
- And use the ${e.codeAssistantName} tool to get ${e.suiteName} component documentation and code snippets.
|
|
161
|
+
- 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}.
|
|
162
|
+
`:""}${e.includeLayout?`- **Layout:** Yes
|
|
163
|
+
- And use the ${e.layoutAssistantName} tool to get Kendo CSS utility classes needed for layout structure and responsive design.
|
|
164
|
+
`:""}${e.includeIcons?`- **Icons:** Yes
|
|
888
165
|
- Use icons that align with the project theme and enhance usability.
|
|
889
|
-
- Use the ${
|
|
890
|
-
|
|
166
|
+
- Use the ${e.iconAssistantName} tool to search for icons that fit the theme and purpose of your project.
|
|
167
|
+
`:""}${e.includeTheming?`- **Custom Theming:**
|
|
891
168
|
- Create a custom theme that aligns with the current goal and branding needs.
|
|
892
169
|
- Use Kendo Themes and Design System guidelines.
|
|
893
170
|
- Make sure to include strict CSS variables or theme requirements from the current goal.
|
|
894
|
-
- And use the ${
|
|
895
|
-
|
|
171
|
+
- And use the ${e.styleAssistantName} tool to create a custom theme for your project.
|
|
172
|
+
`:""}${e.includeResponsive?`- **Responsive:**
|
|
896
173
|
- Ensure the layout is fully responsive across mobile, tablet, and desktop views.
|
|
897
|
-
${
|
|
898
|
-
|
|
174
|
+
- And use the ${e.layoutAssistantName} tool to get Kendo CSS utility classes needed for responsive design.
|
|
175
|
+
`:""}
|
|
899
176
|
- **Accessible (WCAG 2.2 Level AA):**
|
|
900
|
-
- CRITICAL: You must call the ${
|
|
177
|
+
- CRITICAL: You must call the ${e.accessibilityAssistantName} tool with includeGeneralGuidelines=true on your first call to get WCAG 2.2 Level AA guidelines.
|
|
901
178
|
- For subsequent calls, use includeGeneralGuidelines=false to get only component-specific accessibility information.
|
|
902
179
|
- Ensure all components meet WCAG 2.2 Level AA standards.
|
|
903
180
|
|
|
904
|
-
${includeLayout
|
|
905
|
-
**LAYOUT MODE: KENDO DESIGN SYSTEM CSS UTILITIES**
|
|
181
|
+
${e.includeLayout?`**STYLING AND LAYOUT REQUIREMENTS:**
|
|
906
182
|
## CRITICAL DESIGN SYSTEM CONSTRAINTS
|
|
907
183
|
- **USE ONLY KENDO DESIGN SYSTEM UTILITIES** for ALL styling, layout, spacing, positioning, and responsive behavior
|
|
908
184
|
- Avoid custom CSS, inline styles, or other CSS framework classes
|
|
909
|
-
- The ${
|
|
185
|
+
- The ${e.layoutAssistantName} tool will provide the specific Kendo CSS utility classes needed
|
|
910
186
|
- All layout requirements must use Kendo utilities exclusively
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
- Do NOT use any utility-first CSS classes (e.g., from Tailwind) for layout or styling.
|
|
916
|
-
- 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
|
-
${ctx.layoutMode === "tailwind" ? `**STYLING AND LAYOUT REQUIREMENTS:**
|
|
919
|
-
**LAYOUT MODE: TAILWIND**
|
|
920
|
-
- In this mode, you should use Tailwind CSS utility classes for layout and styling.
|
|
921
|
-
- Do NOT write custom CSS or use vanilla CSS for layout or styling.
|
|
922
|
-
- 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
|
-
${ctx.includeFigmaD2C ? `**DESIGN EXTRACTION FROM FIGMA FILE**
|
|
925
|
-
- You are given a Figma file URL that contains the design for the current goal. You MUST use the ${ctx.figmaD2CToolName} tool to extract design information from the Figma file.
|
|
926
|
-
- Extracted design information should be used to get information about the layout, styles, design tokens and assets that can be used within the project.
|
|
927
|
-
- The ${ctx.figmaD2CToolName} tool will output you Layout structure of the design, design tokens for CSS and any decoration and a snapshot of the design.
|
|
928
|
-
` : ""}
|
|
187
|
+
|
|
188
|
+
`:""}---
|
|
189
|
+
|
|
190
|
+
${j()}
|
|
929
191
|
|
|
930
192
|
---
|
|
931
193
|
|
|
@@ -939,13 +201,13 @@ Follow these steps strictly in order to achieve a complete and polished implemen
|
|
|
939
201
|
**MANDATORY REQUIREMENT:**
|
|
940
202
|
|
|
941
203
|
- Before implementing any UI components or features, you must call the accessibility assistant with general guidelines
|
|
942
|
-
- On your first call to "${
|
|
204
|
+
- On your first call to "${e.accessibilityAssistantName}", set "includeGeneralGuidelines=true" to get foundational WCAG 2.2 Level AA best practices
|
|
943
205
|
- These general guidelines apply to all components and must be considered throughout implementation
|
|
944
206
|
- For all subsequent calls, set "includeGeneralGuidelines=false" to get only component-specific information
|
|
945
207
|
|
|
946
208
|
**First tool call (includes general WCAG guidelines):**
|
|
947
209
|
\`\`\`
|
|
948
|
-
${
|
|
210
|
+
${e.accessibilityAssistantName}({
|
|
949
211
|
query="What are the accessibility requirements for [COMPONENT_NAME]?",
|
|
950
212
|
component="[COMPONENT_NAME]",
|
|
951
213
|
includeGeneralGuidelines=true // ONLY true on first call
|
|
@@ -954,11 +216,11 @@ ${ctx.accessibilityAssistantName}({
|
|
|
954
216
|
|
|
955
217
|
**Step 2: Get Component-Specific Accessibility Information**
|
|
956
218
|
|
|
957
|
-
For each additional ${
|
|
219
|
+
For each additional ${e.suiteName} component you plan to use, call the tool with "includeGeneralGuidelines=false":
|
|
958
220
|
|
|
959
221
|
**Tool call example:**
|
|
960
222
|
\`\`\`
|
|
961
|
-
${
|
|
223
|
+
${e.accessibilityAssistantName}({
|
|
962
224
|
query="What are the accessibility features and requirements for [COMPONENT_NAME]? Include ARIA attributes, keyboard navigation, and screen reader support.",
|
|
963
225
|
component="[COMPONENT_NAME]",
|
|
964
226
|
includeGeneralGuidelines=false // false for all calls after the first
|
|
@@ -967,112 +229,13 @@ ${ctx.accessibilityAssistantName}({
|
|
|
967
229
|
|
|
968
230
|
**Example:**
|
|
969
231
|
\`\`\`
|
|
970
|
-
${
|
|
232
|
+
${e.accessibilityAssistantName}({
|
|
971
233
|
query="How to associate the label with another component or HTML input?",
|
|
972
234
|
component="Label",
|
|
973
235
|
includeGeneralGuidelines=false
|
|
974
236
|
})
|
|
975
237
|
\`\`\`
|
|
976
|
-
|
|
977
|
-
${ctx.includeFigmaD2C ? `### Phase: Design Extraction and Analysis
|
|
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 ? `
|
|
238
|
+
${e.includeLayout?`
|
|
1076
239
|
### Phase: Layout Foundation
|
|
1077
240
|
|
|
1078
241
|
**Step 1: Create Base Layout Structure**
|
|
@@ -1083,16 +246,16 @@ ${includeLayout ? `
|
|
|
1083
246
|
|
|
1084
247
|
**Tool call example:**
|
|
1085
248
|
\`\`\`
|
|
1086
|
-
${
|
|
249
|
+
${e.layoutAssistantName}({
|
|
1087
250
|
prompt="Provide Kendo Design System utility classes for the following layout structure: [LAYOUT DESCRIPTION HERE]",
|
|
1088
251
|
includeBuildingBlockExamples=true // Optional, include examples of Kendo building blocks (Grid, Flex, Stack, etc.)
|
|
1089
252
|
})
|
|
1090
253
|
\`\`\`
|
|
1091
|
-
|
|
1092
|
-
${
|
|
254
|
+
`:""}
|
|
255
|
+
${e.includeComponentsDocs?`
|
|
1093
256
|
### Phase: Component Integration
|
|
1094
257
|
**Step 1: Identify and Implement Core Components**
|
|
1095
|
-
Based on your current goal, analyze what other ${
|
|
258
|
+
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
259
|
|
|
1097
260
|
**Component Selection Guidelines:**
|
|
1098
261
|
- **Landing Pages**: Consider Button, Card, Form components, Layout containers, Navigation elements
|
|
@@ -1100,17 +263,17 @@ Based on your current goal, analyze what other ${ctx.suiteName} components are n
|
|
|
1100
263
|
- **Data Entry**: Consider Form, TextBox, DatePicker, DropDownList, Upload, Validation components
|
|
1101
264
|
- **Content Management**: Consider Grid, Editor, TreeView, FileManager, Dialog components
|
|
1102
265
|
- **E-commerce**: Consider ListView, Card, Button, Rating, Badge, Carousel components
|
|
1103
|
-
${
|
|
266
|
+
${o}
|
|
1104
267
|
|
|
1105
268
|
**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 ${
|
|
269
|
+
- Make sure to identify all necessary features related to the ${s} based on the current goal.
|
|
270
|
+
- Make sure to identify specific features needed for other ${e.suiteName} components based on the current goal.
|
|
271
|
+
- Make sure to generate a query for ${e.codeAssistantName} tool for each component and call the tool for each specific feature or functionality.
|
|
1109
272
|
- 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
273
|
|
|
1111
274
|
**Tool call examples:**
|
|
1112
275
|
\`\`\`
|
|
1113
|
-
${
|
|
276
|
+
${e.codeAssistantName}({
|
|
1114
277
|
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
278
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', 'Chart', etc. -->
|
|
1116
279
|
})
|
|
@@ -1118,33 +281,40 @@ ${dragDropGuidance}
|
|
|
1118
281
|
|
|
1119
282
|
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
283
|
\`\`\`
|
|
1121
|
-
${
|
|
284
|
+
${e.codeAssistantName}({
|
|
1122
285
|
query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'paging in Grid' -->
|
|
1123
286
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
|
|
1124
287
|
})
|
|
1125
288
|
\`\`\`
|
|
1126
289
|
|
|
1127
290
|
\`\`\`
|
|
1128
|
-
${
|
|
291
|
+
${e.codeAssistantName}({
|
|
1129
292
|
query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'sorting in Grid' -->
|
|
1130
293
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
|
|
1131
294
|
})
|
|
1132
295
|
\`\`\`
|
|
1133
296
|
|
|
1134
297
|
\`\`\`
|
|
1135
|
-
${
|
|
298
|
+
${e.codeAssistantName}({
|
|
1136
299
|
query="How to implement [SPECIFIC_FEATURE] in [COMPONENT_NAME]?" <!-- For example: 'filtering in Grid' -->
|
|
1137
300
|
component="[COMPONENT_NAME]" <!-- For example: 'Grid', 'Button', etc. -->
|
|
1138
301
|
})
|
|
1139
302
|
\`\`\`
|
|
1140
|
-
|
|
1141
|
-
${
|
|
303
|
+
`:""}
|
|
304
|
+
${e.includeResponsive?`
|
|
1142
305
|
### Phase: Layout Responsive Finalization
|
|
1143
306
|
|
|
1144
307
|
**Step 1: Implement Responsive Behavior**
|
|
1145
|
-
${responsiveKDSGuidance}${responsiveVanillaCSSGuidance}${responsiveTailwindCSSGuidance}` : ""}
|
|
1146
308
|
|
|
1147
|
-
|
|
309
|
+
**Tool call example:**
|
|
310
|
+
\`\`\`
|
|
311
|
+
${e.layoutAssistantName}({
|
|
312
|
+
prompt="Provide Kendo Design System utility classes to make the following layout structure responsive across mobile, tablet, and desktop views: [LAYOUT DESCRIPTION HERE]",
|
|
313
|
+
includeBuildingBlockExamples=false // Optional, include examples of Kendo building blocks (Grid, Flex, Stack, etc.)
|
|
314
|
+
})
|
|
315
|
+
\`\`\`
|
|
316
|
+
`:""}
|
|
317
|
+
${e.includeTheming?`
|
|
1148
318
|
**Step 2: Custom Theme Implementation**
|
|
1149
319
|
|
|
1150
320
|
**CUSTOM THEME REQUIREMENTS:**
|
|
@@ -1154,13 +324,13 @@ ${ctx.includeTheming ? `
|
|
|
1154
324
|
|
|
1155
325
|
**Tool call example:**
|
|
1156
326
|
\`\`\`
|
|
1157
|
-
${
|
|
327
|
+
${e.styleAssistantName}({
|
|
1158
328
|
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
329
|
includeThemeVariables=true // Optional, include specific CSS variables for colors, typography, spacing, etc.
|
|
1160
330
|
})
|
|
1161
331
|
\`\`\`
|
|
1162
|
-
|
|
1163
|
-
${
|
|
332
|
+
`:""}
|
|
333
|
+
${e.includeIcons?`
|
|
1164
334
|
**Step 3: Iconography and Visual Enhancements**
|
|
1165
335
|
|
|
1166
336
|
**ICONOGRAPHY GUIDELINES:**
|
|
@@ -1170,64 +340,61 @@ ${ctx.includeIcons ? `
|
|
|
1170
340
|
|
|
1171
341
|
**Tool call example:**
|
|
1172
342
|
\`\`\`
|
|
1173
|
-
${
|
|
343
|
+
${e.iconAssistantName}({
|
|
1174
344
|
query="Suggest icons that fit the theme and purpose of the following current goal: [CURRENT GOAL HERE]. Provide icon names and usage context.",
|
|
1175
345
|
})
|
|
1176
346
|
\`\`\`
|
|
1177
|
-
|
|
347
|
+
`:""}
|
|
1178
348
|
### Phase: Code Generation
|
|
1179
349
|
**IMPORTANT:** Do NOT generate ANY code or create files until ALL information gathering phases (1-3) are complete.
|
|
1180
350
|
**Step 1: Generate Complete Implementation**
|
|
1181
|
-
After completing all information gathering phases above, generate the complete ${
|
|
351
|
+
After completing all information gathering phases above, generate the complete ${e.libKey} component/page implementation:
|
|
1182
352
|
**Code Generation Requirements:**
|
|
1183
|
-
- Create complete, functional ${
|
|
1184
|
-
- Include all identified ${
|
|
353
|
+
- Create complete, functional ${e.libKey} components/pages
|
|
354
|
+
- Include all identified ${e.suiteName} components with their configurations
|
|
1185
355
|
- Apply ALL Kendo Design System utility classes gathered from layout assistant
|
|
1186
356
|
- Implement proper component event handling and data binding
|
|
1187
357
|
- Ensure responsive behavior using Kendo utility classes
|
|
1188
358
|
- Include necessary import statements and dependencies
|
|
1189
359
|
|
|
1190
|
-
${
|
|
360
|
+
${t.injectedPlan??""}
|
|
1191
361
|
|
|
1192
362
|
### Phase: Validation and Finalization
|
|
1193
363
|
|
|
1194
364
|
**Step 1: Code Validation**
|
|
1195
365
|
** CRITICAL REQUIREMENT: You MUST validate the generated UI code using this comprehensive checklist to ensure code quality and compliance:**
|
|
1196
366
|
|
|
1197
|
-
${
|
|
367
|
+
${n}
|
|
1198
368
|
|
|
1199
369
|
**Step 2: Final Review and Testing**
|
|
1200
370
|
** Implementation Validation:**
|
|
1201
|
-
${
|
|
1202
|
-
-
|
|
1203
|
-
-
|
|
1204
|
-
|
|
371
|
+
${e.includeComponentsDocs?` - Components render correctly without errors
|
|
372
|
+
- Running \`npm run build\` compiles the application successfully without any build errors or crashes.
|
|
373
|
+
- All ${e.suiteName} component features function as expected
|
|
374
|
+
- Event handling and data binding operate correctly`:""}
|
|
375
|
+
${e.includeResponsive?"- Responsive layout works across breakpoints":""}
|
|
1205
376
|
|
|
1206
377
|
**Quick Fixes (if needed):**
|
|
1207
378
|
|
|
1208
379
|
After code implementation and validation you can make quick fixes as needed:
|
|
1209
|
-
-
|
|
1210
|
-
- Use ${
|
|
380
|
+
- If any build errors are found, fix them and re-run the application.
|
|
381
|
+
- Use ${e.codeAssistantName} for component-specific issues
|
|
382
|
+
- Use ${e.layoutAssistantName} for styling adjustments
|
|
1211
383
|
|
|
1212
384
|
+### Before You Begin
|
|
1213
|
-
- When following/executing the plan call tools are defined from the same function_ecosystem/MCP_server which ${
|
|
385
|
+
- When following/executing the plan call tools are defined from the same function_ecosystem/MCP_server which ${e.name} was called.
|
|
1214
386
|
- Do NOT generate or suggest any code until all tools have been used and validated responses are incorporated.
|
|
1215
387
|
- Focus on planning and sequencing.
|
|
1216
388
|
- 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
|
|
389
|
+
- Confirm all required inputs from tools have been provided.`};var H=e=>`# ${e.suiteName} Assistant
|
|
1223
390
|
|
|
1224
391
|
**What you're looking for:**
|
|
1225
392
|
|
|
1226
|
-
${
|
|
393
|
+
${e.userIntent}
|
|
1227
394
|
|
|
1228
395
|
**Available Tools:**
|
|
1229
|
-
- **${
|
|
1230
|
-
- **${
|
|
396
|
+
- **${e.codeAssistantName}** - Get component documentation, features, and usage examples
|
|
397
|
+
- **${e.iconAssistantName}** - Search for icons from the Kendo icon library
|
|
1231
398
|
|
|
1232
399
|
---
|
|
1233
400
|
|
|
@@ -1237,7 +404,7 @@ Follow these steps to find the right components and resources:
|
|
|
1237
404
|
|
|
1238
405
|
### Step 1: Identify Components
|
|
1239
406
|
|
|
1240
|
-
Based on your needs, consider these ${
|
|
407
|
+
Based on your needs, consider these ${e.suiteName} component categories:
|
|
1241
408
|
|
|
1242
409
|
**Common Use Cases:**
|
|
1243
410
|
- **Data Display**: Grid, ListView, TreeView, Card, TileLayout
|
|
@@ -1250,10 +417,10 @@ Based on your needs, consider these ${ctx.suiteName} component categories:
|
|
|
1250
417
|
|
|
1251
418
|
**How to explore components:**
|
|
1252
419
|
|
|
1253
|
-
Use the ${
|
|
420
|
+
Use the ${e.codeAssistantName} tool to learn about specific components:
|
|
1254
421
|
|
|
1255
422
|
\`\`\`
|
|
1256
|
-
${
|
|
423
|
+
${e.codeAssistantName}({
|
|
1257
424
|
query: "What are the main features of [COMPONENT_NAME]?",
|
|
1258
425
|
component: "[COMPONENT_NAME]"
|
|
1259
426
|
})
|
|
@@ -1261,14 +428,14 @@ ${ctx.codeAssistantName}({
|
|
|
1261
428
|
|
|
1262
429
|
**Examples:**
|
|
1263
430
|
\`\`\`
|
|
1264
|
-
${
|
|
431
|
+
${e.codeAssistantName}({
|
|
1265
432
|
query: "How to use Grid with paging and sorting?",
|
|
1266
433
|
component: "Grid"
|
|
1267
434
|
})
|
|
1268
435
|
\`\`\`
|
|
1269
436
|
|
|
1270
437
|
\`\`\`
|
|
1271
|
-
${
|
|
438
|
+
${e.codeAssistantName}({
|
|
1272
439
|
query: "What features does DatePicker have?",
|
|
1273
440
|
component: "DatePicker"
|
|
1274
441
|
})
|
|
@@ -1279,37 +446,37 @@ ${ctx.codeAssistantName}({
|
|
|
1279
446
|
- Break complex queries into multiple calls focusing on one feature at a time
|
|
1280
447
|
- Specify the exact component name in the component parameter
|
|
1281
448
|
|
|
1282
|
-
${
|
|
449
|
+
${e.includeIcons?`
|
|
1283
450
|
### Step 2: Find Icons
|
|
1284
451
|
|
|
1285
|
-
Use the ${
|
|
452
|
+
Use the ${e.iconAssistantName} tool to search for icons:
|
|
1286
453
|
|
|
1287
454
|
\`\`\`
|
|
1288
|
-
${
|
|
455
|
+
${e.iconAssistantName}({
|
|
1289
456
|
query: "Search for icons related to [YOUR THEME/PURPOSE]"
|
|
1290
457
|
})
|
|
1291
458
|
\`\`\`
|
|
1292
459
|
|
|
1293
460
|
**Examples:**
|
|
1294
461
|
\`\`\`
|
|
1295
|
-
${
|
|
462
|
+
${e.iconAssistantName}({
|
|
1296
463
|
query: "icons for navigation menu"
|
|
1297
464
|
})
|
|
1298
465
|
\`\`\`
|
|
1299
466
|
|
|
1300
467
|
\`\`\`
|
|
1301
|
-
${
|
|
468
|
+
${e.iconAssistantName}({
|
|
1302
469
|
query: "icons for user actions like edit, delete, save"
|
|
1303
470
|
})
|
|
1304
471
|
\`\`\`
|
|
1305
|
-
|
|
472
|
+
`:""}
|
|
1306
473
|
|
|
1307
474
|
### Step 3: Review and Implement
|
|
1308
475
|
|
|
1309
476
|
After gathering information:
|
|
1310
|
-
1. Review the component documentation provided by ${
|
|
1311
|
-
2. Check which icons are available from ${
|
|
1312
|
-
3. Use the official ${
|
|
477
|
+
1. Review the component documentation provided by ${e.codeAssistantName}
|
|
478
|
+
2. Check which icons are available from ${e.iconAssistantName}
|
|
479
|
+
3. Use the official ${e.suiteName} documentation for detailed implementation guides
|
|
1313
480
|
4. Refer to the component examples and code snippets provided
|
|
1314
481
|
|
|
1315
482
|
---
|
|
@@ -1317,1525 +484,144 @@ After gathering information:
|
|
|
1317
484
|
## Getting Started
|
|
1318
485
|
|
|
1319
486
|
**Next Actions:**
|
|
1320
|
-
1. Start by calling ${
|
|
1321
|
-
2. ${
|
|
1322
|
-
3. Follow the ${
|
|
487
|
+
1. Start by calling ${e.codeAssistantName} for the components you need
|
|
488
|
+
2. ${e.includeIcons?`Search for icons using ${e.iconAssistantName}`:"Review the component documentation"}
|
|
489
|
+
3. Follow the ${e.suiteName} official documentation for implementation details
|
|
1323
490
|
|
|
1324
491
|
**Important Notes:**
|
|
1325
492
|
- 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: `
|
|
493
|
+
- Always refer to official ${e.suiteName} documentation for the most up-to-date information
|
|
494
|
+
- Tool responses include usage examples and best practices`;var E=(e,t)=>({SETUP_VALIDATION:`
|
|
1333
495
|
UI Library Setup:
|
|
1334
|
-
- ${
|
|
1335
|
-
- ${
|
|
1336
|
-
- ${
|
|
1337
|
-
- Globalization and localization properly configured for ${
|
|
1338
|
-
- Required ${
|
|
1339
|
-
PERFORMANCE_OPTIMIZATION: `
|
|
496
|
+
- ${e} modules properly imported and configured
|
|
497
|
+
- ${e} theme properly loaded and applied
|
|
498
|
+
- ${e} license properly configured
|
|
499
|
+
- Globalization and localization properly configured for ${e} components
|
|
500
|
+
- Required ${e} dependencies installed and up-to-date`,PERFORMANCE_OPTIMIZATION:`
|
|
1340
501
|
Performance Optimization:
|
|
1341
502
|
- 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
|
|
503
|
+
- Lazy loading of ${e} components when appropriate
|
|
504
|
+
- Virtualization enabled for large datasets in ${e} components
|
|
505
|
+
- Only required ${e} modules imported and tree-shaken`,THEME_AND_STYLING:`
|
|
506
|
+
${e} Theme & Styling:
|
|
507
|
+
- Prioritize the ${t} Design System utilities
|
|
1348
508
|
- Avoid custom CSS or other framework classes
|
|
1349
509
|
- Do not use inline styles
|
|
1350
|
-
- Consistent ${
|
|
510
|
+
- Consistent ${e} theme application across all components
|
|
1351
511
|
- Custom theme variables properly defined and scoped
|
|
1352
|
-
- ${
|
|
1353
|
-
- Brand colors integrated with ${
|
|
1354
|
-
}
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
--kendo-color-subtle
|
|
1360
|
-
--kendo-color-surface
|
|
1361
|
-
--kendo-color-surface-alt
|
|
1362
|
-
--kendo-color-border
|
|
1363
|
-
--kendo-color-border-alt
|
|
1364
|
-
/* Base */
|
|
1365
|
-
--kendo-color-base-subtle
|
|
1366
|
-
--kendo-color-base-subtle-hover
|
|
1367
|
-
--kendo-color-base-subtle-active
|
|
1368
|
-
--kendo-color-base
|
|
1369
|
-
--kendo-color-base-hover
|
|
1370
|
-
--kendo-color-base-active
|
|
1371
|
-
--kendo-color-base-emphasis
|
|
1372
|
-
--kendo-color-base-on-subtle
|
|
1373
|
-
--kendo-color-on-base
|
|
1374
|
-
--kendo-color-base-on-surface
|
|
1375
|
-
/* Primary */
|
|
1376
|
-
--kendo-color-primary-subtle
|
|
1377
|
-
--kendo-color-primary-subtle-hover
|
|
1378
|
-
--kendo-color-primary-subtle-active
|
|
1379
|
-
--kendo-color-primary
|
|
1380
|
-
--kendo-color-primary-hover
|
|
1381
|
-
--kendo-color-primary-active
|
|
1382
|
-
--kendo-color-primary-emphasis
|
|
1383
|
-
--kendo-color-primary-on-subtle
|
|
1384
|
-
--kendo-color-on-primary
|
|
1385
|
-
--kendo-color-primary-on-surface
|
|
1386
|
-
/* Secondary */
|
|
1387
|
-
--kendo-color-secondary-subtle
|
|
1388
|
-
--kendo-color-secondary-subtle-hover
|
|
1389
|
-
--kendo-color-secondary-subtle-active
|
|
1390
|
-
--kendo-color-secondary
|
|
1391
|
-
--kendo-color-secondary-hover
|
|
1392
|
-
--kendo-color-secondary-active
|
|
1393
|
-
--kendo-color-secondary-emphasis
|
|
1394
|
-
--kendo-color-secondary-on-subtle
|
|
1395
|
-
--kendo-color-on-secondary
|
|
1396
|
-
--kendo-color-secondary-on-surface
|
|
1397
|
-
/* Tertiary */
|
|
1398
|
-
--kendo-color-tertiary-subtle
|
|
1399
|
-
--kendo-color-tertiary-subtle-hover
|
|
1400
|
-
--kendo-color-tertiary-subtle-active
|
|
1401
|
-
--kendo-color-tertiary
|
|
1402
|
-
--kendo-color-tertiary-hover
|
|
1403
|
-
--kendo-color-tertiary-active
|
|
1404
|
-
--kendo-color-tertiary-emphasis
|
|
1405
|
-
--kendo-color-tertiary-on-subtle
|
|
1406
|
-
--kendo-color-on-tertiary
|
|
1407
|
-
--kendo-color-tertiary-on-surface
|
|
1408
|
-
/* Info */
|
|
1409
|
-
--kendo-color-info-subtle
|
|
1410
|
-
--kendo-color-info-subtle-hover
|
|
1411
|
-
--kendo-color-info-subtle-active
|
|
1412
|
-
--kendo-color-info
|
|
1413
|
-
--kendo-color-info-hover
|
|
1414
|
-
--kendo-color-info-active
|
|
1415
|
-
--kendo-color-info-emphasis
|
|
1416
|
-
--kendo-color-info-on-subtle
|
|
1417
|
-
--kendo-color-on-info
|
|
1418
|
-
--kendo-color-info-on-surface
|
|
1419
|
-
/* Success */
|
|
1420
|
-
--kendo-color-success-subtle
|
|
1421
|
-
--kendo-color-success-subtle-hover
|
|
1422
|
-
--kendo-color-success-subtle-active
|
|
1423
|
-
--kendo-color-success
|
|
1424
|
-
--kendo-color-success-hover
|
|
1425
|
-
--kendo-color-success-active
|
|
1426
|
-
--kendo-color-success-emphasis
|
|
1427
|
-
--kendo-color-success-on-subtle
|
|
1428
|
-
--kendo-color-on-success
|
|
1429
|
-
--kendo-color-success-on-surface
|
|
1430
|
-
/* Warning */
|
|
1431
|
-
--kendo-color-warning-subtle
|
|
1432
|
-
--kendo-color-warning-subtle-hover
|
|
1433
|
-
--kendo-color-warning-subtle-active
|
|
1434
|
-
--kendo-color-warning
|
|
1435
|
-
--kendo-color-warning-hover
|
|
1436
|
-
--kendo-color-warning-active
|
|
1437
|
-
--kendo-color-warning-emphasis
|
|
1438
|
-
--kendo-color-warning-on-subtle
|
|
1439
|
-
--kendo-color-on-warning
|
|
1440
|
-
--kendo-color-warning-on-surface
|
|
1441
|
-
/* Error */
|
|
1442
|
-
--kendo-color-error-subtle
|
|
1443
|
-
--kendo-color-error-subtle-hover
|
|
1444
|
-
--kendo-color-error-subtle-active
|
|
1445
|
-
--kendo-color-error
|
|
1446
|
-
--kendo-color-error-hover
|
|
1447
|
-
--kendo-color-error-active
|
|
1448
|
-
--kendo-color-error-emphasis
|
|
1449
|
-
--kendo-color-error-on-subtle
|
|
1450
|
-
--kendo-color-on-error
|
|
1451
|
-
--kendo-color-error-on-surface
|
|
1452
|
-
/* Light */
|
|
1453
|
-
--kendo-color-light-subtle
|
|
1454
|
-
--kendo-color-light-subtle-hover
|
|
1455
|
-
--kendo-color-light-subtle-active
|
|
1456
|
-
--kendo-color-light
|
|
1457
|
-
--kendo-color-light-hover
|
|
1458
|
-
--kendo-color-light-active
|
|
1459
|
-
--kendo-color-light-emphasis
|
|
1460
|
-
--kendo-color-light-on-subtle
|
|
1461
|
-
--kendo-color-on-light
|
|
1462
|
-
--kendo-color-light-on-surface
|
|
1463
|
-
/* Dark */
|
|
1464
|
-
--kendo-color-dark-subtle
|
|
1465
|
-
--kendo-color-dark-subtle-hover
|
|
1466
|
-
--kendo-color-dark-subtle-active
|
|
1467
|
-
--kendo-color-dark
|
|
1468
|
-
--kendo-color-dark-hover
|
|
1469
|
-
--kendo-color-dark-active
|
|
1470
|
-
--kendo-color-dark-emphasis
|
|
1471
|
-
--kendo-color-dark-on-subtle
|
|
1472
|
-
--kendo-color-on-dark
|
|
1473
|
-
--kendo-color-dark-on-surface
|
|
1474
|
-
/* Inverse */
|
|
1475
|
-
--kendo-color-inverse-subtle
|
|
1476
|
-
--kendo-color-inverse-subtle-hover
|
|
1477
|
-
--kendo-color-inverse-subtle-active
|
|
1478
|
-
--kendo-color-inverse
|
|
1479
|
-
--kendo-color-inverse-hover
|
|
1480
|
-
--kendo-color-inverse-active
|
|
1481
|
-
--kendo-color-inverse-emphasis
|
|
1482
|
-
--kendo-color-inverse-on-subtle
|
|
1483
|
-
--kendo-color-on-inverse
|
|
1484
|
-
--kendo-color-inverse-on-surface
|
|
1485
|
-
/* Series A */
|
|
1486
|
-
--kendo-color-series-a
|
|
1487
|
-
--kendo-color-series-a-bold
|
|
1488
|
-
--kendo-color-series-a-bolder
|
|
1489
|
-
--kendo-color-series-a-subtle
|
|
1490
|
-
--kendo-color-series-a-subtler
|
|
1491
|
-
/* Series B */
|
|
1492
|
-
--kendo-color-series-b
|
|
1493
|
-
--kendo-color-series-b-bold
|
|
1494
|
-
--kendo-color-series-b-bolder
|
|
1495
|
-
--kendo-color-series-b-subtle
|
|
1496
|
-
--kendo-color-series-b-subtler
|
|
1497
|
-
/* Series C */
|
|
1498
|
-
--kendo-color-series-c
|
|
1499
|
-
--kendo-color-series-c-bold
|
|
1500
|
-
--kendo-color-series-c-bolder
|
|
1501
|
-
--kendo-color-series-c-subtle
|
|
1502
|
-
--kendo-color-series-c-subtler
|
|
1503
|
-
/* Series D */
|
|
1504
|
-
--kendo-color-series-d
|
|
1505
|
-
--kendo-color-series-d-bold
|
|
1506
|
-
--kendo-color-series-d-bolder
|
|
1507
|
-
--kendo-color-series-d-subtle
|
|
1508
|
-
--kendo-color-series-d-subtler
|
|
1509
|
-
/* Series E */
|
|
1510
|
-
--kendo-color-series-e
|
|
1511
|
-
--kendo-color-series-e-bold
|
|
1512
|
-
--kendo-color-series-e-bolder
|
|
1513
|
-
--kendo-color-series-e-subtle
|
|
1514
|
-
--kendo-color-series-e-subtler
|
|
1515
|
-
/* Series F */
|
|
1516
|
-
--kendo-color-series-f
|
|
1517
|
-
--kendo-color-series-f-bold
|
|
1518
|
-
--kendo-color-series-f-bolder
|
|
1519
|
-
--kendo-color-series-f-subtle
|
|
1520
|
-
--kendo-color-series-f-subtler
|
|
1521
|
-
/* Typography */
|
|
1522
|
-
--kendo-font-family-sans
|
|
1523
|
-
--kendo-font-family-sans-serif
|
|
1524
|
-
--kendo-font-family-monospace
|
|
1525
|
-
--kendo-font-size-xs
|
|
1526
|
-
--kendo-line-height-xs
|
|
1527
|
-
--kendo-font-size-sm
|
|
1528
|
-
--kendo-line-height-sm
|
|
1529
|
-
--kendo-font-size
|
|
1530
|
-
--kendo-line-height
|
|
1531
|
-
--kendo-font-size-lg
|
|
1532
|
-
--kendo-line-height-lg
|
|
1533
|
-
/* Border Radius */
|
|
1534
|
-
--kendo-border-radius-none
|
|
1535
|
-
--kendo-border-radius-xs
|
|
1536
|
-
--kendo-border-radius-sm
|
|
1537
|
-
--kendo-border-radius-md
|
|
1538
|
-
--kendo-border-radius-lg
|
|
1539
|
-
--kendo-border-radius-xl
|
|
1540
|
-
--kendo-border-radius-xxl
|
|
1541
|
-
--kendo-border-radius-xxxl
|
|
1542
|
-
--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.
|
|
1545
|
-
Requirements:
|
|
1546
|
-
|
|
1547
|
-
All design tokens (colors, spacing, font families, border radius, shadows) are defined once in tailwind.config.js
|
|
1548
|
-
A Tailwind plugin emits every token as a --token-name CSS custom property on :root
|
|
1549
|
-
Colors support Tailwind's opacity modifier syntax (bg-primary/50) using the rgb(var(--color-x-rgb) / <alpha-value>) pattern
|
|
1550
|
-
Dark mode tokens are emitted under .dark so that both dark: utility variants and var(--color-x) in custom CSS update together
|
|
1551
|
-
var(--color-primary) in hand-written CSS and bg-primary in HTML resolve to the same value
|
|
1552
|
-
|
|
1553
|
-
Use the Kendo theme tokens listed above as the design tokens.
|
|
1554
|
-
|
|
1555
|
-
Output I need:
|
|
1556
|
-
|
|
1557
|
-
The full tailwind.config.js with the plugin included
|
|
1558
|
-
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.
|
|
1561
|
-
Requirements:
|
|
1562
|
-
|
|
1563
|
-
All design tokens (colors, spacing, font families, border radius, shadows) are defined once in the @theme block \u2014 no tailwind.config.js
|
|
1564
|
-
Every @theme variable is natively available as a var(--token-name) CSS custom property with no plugin needed
|
|
1565
|
-
Colors use oklch and support opacity modifier syntax (bg-primary/50) natively
|
|
1566
|
-
Dark mode tokens are re-declared under .dark so that both dark: utility variants and var(--color-x) in custom CSS update together
|
|
1567
|
-
var(--color-primary) in hand-written CSS and bg-primary in HTML resolve to the same value
|
|
1568
|
-
|
|
1569
|
-
Use the Kendo theme tokens listed above as the design tokens.
|
|
1570
|
-
|
|
1571
|
-
Output I need:
|
|
1572
|
-
|
|
1573
|
-
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
|
|
1576
|
-
|
|
1577
|
-
Detect which version of Tailwind CSS the project uses, then follow the appropriate setup guide below.
|
|
1578
|
-
|
|
1579
|
-
### Kendo Theme Tokens
|
|
1580
|
-
These are the design tokens to map into Tailwind:
|
|
1581
|
-
${kendoTokenList}
|
|
1582
|
-
|
|
1583
|
-
### For Tailwind CSS v3 (uses tailwind.config.js)
|
|
1584
|
-
|
|
1585
|
-
<tailwind_v3_setup>
|
|
1586
|
-
${tailwindV3SetupPrompt}
|
|
1587
|
-
</tailwind_v3_setup>
|
|
1588
|
-
|
|
1589
|
-
### For Tailwind CSS v4 (uses @theme block, no config file)
|
|
1590
|
-
|
|
1591
|
-
<tailwind_v4_setup>
|
|
1592
|
-
${tailwindV4SetupPrompt}
|
|
1593
|
-
</tailwind_v4_setup>
|
|
1594
|
-
|
|
1595
|
-
IMPORTANT: Detect which version of Tailwind CSS the project uses, then follow the matching setup guide.`;
|
|
1596
|
-
|
|
1597
|
-
// packages/kendo-ui-agent/src/lib/tools-factory.ts
|
|
1598
|
-
function formatApiRefItemFromJson(rawValue, component) {
|
|
1599
|
-
let data;
|
|
1600
|
-
try {
|
|
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}
|
|
512
|
+
- ${e} icon fonts properly loaded and optimized
|
|
513
|
+
- Brand colors integrated with ${e} component themes`});function ft(e,t){let n;try{n=JSON.parse(e)}catch{return e}let o=n?.Item;if(!o)return e;let s=[],r=o.FullName??o.Name??"",a=o.Type??"",i=o.Summary??"",d=o.SyntaxContent??"";s.push(`## API Reference Item
|
|
514
|
+
- Name: ${r}
|
|
515
|
+
- Type: ${a}
|
|
516
|
+
- Summary: ${i}
|
|
517
|
+
- Syntax: ${d}`);let m=n.RelatedItemsByType?.return_type;if(m?.length){let p=m[0].Text;p&&s.push(`- Return Type: ${p}`)}let b=o.Examples??[];if(b.length>0){let p=`## Examples
|
|
518
|
+
`,l=0;for(let y of b){let v=(y.Component??"").toLowerCase(),S=t.toLowerCase();if(v&&v!==S&&v!=="general")continue;l+=1;let k=y.Code??"";p+=`### Example ${l}
|
|
1641
519
|
\`\`\`
|
|
1642
|
-
${
|
|
520
|
+
${k}
|
|
1643
521
|
\`\`\`
|
|
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}
|
|
522
|
+
`}l>0&&s.push(p)}let g=n.RelatedItemsByType??{},f=[];for(let[p,l]of Object.entries(g))if(!(p==="return_type"||p==="render_fragment"))for(let y of l??[]){let v=y.FullName??"",S=y.ShortText??"";f.push(`### ${v} (${p})
|
|
523
|
+
${S}`)}return f.length>0&&s.push(`## Additional Context
|
|
524
|
+
`+f.join(`
|
|
525
|
+
---
|
|
526
|
+
`)),s.join(`
|
|
527
|
+
|
|
528
|
+
`)}function fe(e,t,n){let{name:o,title:s,description:r,layoutAssistantName:a,codeAssistantName:i,styleAssistantName:d,iconAssistantName:m,accessibilityAssistantName:b,suiteName:g,libKey:f,components:p}=e,l=new w(o,{title:s,description:r,requiredAccess:e.requiredAccess,inputSchema:{userIntent:A.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:A.number().min(0).max(1).default(1).describe("Confidence (0-1) to include Component Documentation assistance. Default is 1."),needsLayoutConfidence:A.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Layout assistance. Default is 0."),needsStylingConfidence:A.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Theming/Styling assistance. Default is 0."),needsResponsiveBehaviorConfidence:A.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Responsive Behavior assistance. Default is 0."),needsIconsConfidence:A.number().min(0).max(1).default(0).describe("Confidence (0-1) to include Icons assistance. Default is 0."),componentsNeeded:A.array(A.enum(p)).optional().describe(`Optional list of specific ${g} components needed for the project.`)}},async({userIntent:y,needsComponentsDocsConfidence:v,needsLayoutConfidence:S,needsStylingConfidence:k,needsResponsiveBehaviorConfidence:I,needsIconsConfidence:te,componentsNeeded:oe},{_meta:Ze})=>{h("UI Orchestrator called with:",{userIntent:y,needsComponentsDocsConfidence:v,needsLayoutConfidence:S,needsStylingConfidence:k,needsResponsiveBehaviorConfidence:I,needsIconsConfidence:te});try{await n.recordOrchestratorUserRequest({meta:{userIntent:y,componentsNeeded:oe,_meta:Ze}})}catch($){throw R($)}let et=l.server?.server.getClientCapabilities?.()?.elicitation,ne;if(et&&k>.3&&k<=.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&&(ne=!0)}return{content:[{type:"text",text:U({name:o,userIntent:y,includeComponentsDocs:v>.3,includeTheming:k>.6||!!ne,includeLayout:S>.5,includeIcons:te>.6,includeResponsive:S>.5&&I>.4,layoutAssistantName:a,codeAssistantName:i,styleAssistantName:d,iconAssistantName:m,accessibilityAssistantName:b,suiteName:g,libKey:f,components:oe},t)}]}});return l}function ye(e,t){let{name:n,title:o,description:s,iconAssistantName:r,codeAssistantName:a,suiteName:i,libKey:d,components:m}=e;return new w(n,{title:o,description:s,inputSchema:{userIntent:A.string().describe(`Describe what you want to build or what components you're looking for. Include the type of functionality, features, or UI elements you need from ${i}.`),needsIconsConfidence:A.number().min(0).max(1).default(.7).describe("Confidence (0-1) to include Icons assistance. Default is 0.7."),componentsNeeded:A.array(A.enum(m)).optional().describe(`Optional list of specific ${i} components you want to learn about.`)},requiredAccess:e.requiredAccess},async({userIntent:g,needsIconsConfidence:f,componentsNeeded:p},{_meta:l})=>{h("Assistant Orchestrator called with:",{userIntent:g,needsIconsConfidence:f,componentsNeeded:p});try{await t.recordOrchestratorUserRequest({meta:{userIntent:g,componentsNeeded:p,_meta:l}})}catch(v){throw R(v)}return{content:[{type:"text",text:H({name:n,userIntent:g,includeComponentsDocs:!0,includeIcons:f>.5,codeAssistantName:a,iconAssistantName:r,suiteName:i,libKey:d,components:p})}]}})}function be(e,t){let{name:n,title:o,description:s,suiteName:r,libKey:a,getPreContent:i}=e;return new w(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{prompt:A.string().describe("An enhanced prompt describing the HTML layout structure, design requirements or specific visual effects you want to achieve."),includeBuildingBlockExamples:A.boolean().describe("Whether to include building block examples. Defaults to false.").default(!1)}},async({prompt:d,includeBuildingBlockExamples:m},{_meta:b})=>{h("Layout Assistant called with:",{prompt:d,includeBuildingBlockExamples:m});try{let f=(await t.queryCssUtils({query:d},{_meta:b})).values.join(`
|
|
529
|
+
`)||"No CSS utilities found for the given prompt.",p=i?.()??"",l=y=>`${p}
|
|
1909
530
|
|
|
1910
531
|
# Kendo Design System CSS Utilities
|
|
1911
532
|
|
|
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 = `
|
|
533
|
+
${f}
|
|
534
|
+
${y??""}
|
|
535
|
+
`;if(m)try{let y=await t.queryBuildingBlocks({query:d,lib_name:a},{_meta:b}),v="";y.items?.length>0&&(v=`
|
|
1925
536
|
## Building Blocks Examples
|
|
1926
537
|
|
|
1927
538
|
The examples here are for demonstration purpose how CSS utils can be implemented in various building blocks.
|
|
1928
539
|
However, consider your own design requirements and specifics in order to implement your templates/building blocks correctly.
|
|
1929
540
|
|
|
1930
|
-
${
|
|
1931
|
-
|
|
1932
|
-
### ${item.name}
|
|
541
|
+
${y.items.map(S=>`
|
|
542
|
+
### ${S.name}
|
|
1933
543
|
|
|
1934
|
-
${
|
|
544
|
+
${S.description}
|
|
1935
545
|
|
|
1936
546
|
\`\`\`code
|
|
1937
|
-
${
|
|
547
|
+
${S.code}
|
|
1938
548
|
\`\`\`
|
|
1939
|
-
`
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
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.
|
|
1986
|
-
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
|
-
|
|
1988
|
-
<tailwind_setup_instructions>
|
|
1989
|
-
${tailwindBridgeExample}
|
|
1990
|
-
</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.
|
|
549
|
+
`).join(`
|
|
550
|
+
`)}`),f=l(v)}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 Ae(e,t){let{name:n,title:o,description:s,libKey:r,getPreContent:a}=e;return new w(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{prompt:A.string().describe("A natural language description of the desired visual style or theme. For example: 'Create a modern dark theme with high contrast'.")}},async({prompt:i},{_meta:d})=>{h("Style Assistant called with:",{prompt:i});let m="";try{let f=await t.queryThemeGenerate({prompt:i},{_meta:d});if(f.variables_json){let p=JSON.parse(f.variables_json),l=[];if(p)for(let y of Object.keys(p))typeof p[y]=="string"&&l.push(`${y}: ${p[y]}`);m=l.join(`
|
|
551
|
+
|
|
552
|
+
`)}}catch(f){throw R(f)}let b=a?.()??"";return{content:[{type:"text",text:m?`Use the following CSS variables to style the web application, including colors, typography, spacing, and component appearance.
|
|
2016
553
|
Ensure the variables are applied consistently across all relevant elements.
|
|
2017
554
|
Do NOT set any inline styles. CSS variables should be defined in global or component-level CSS files, or via supported theming mechanisms.
|
|
2018
555
|
|
|
2019
|
-
${
|
|
556
|
+
${b}
|
|
2020
557
|
|
|
2021
558
|
## Generated CSS Variables
|
|
2022
559
|
|
|
2023
560
|
\`\`\`css
|
|
2024
|
-
${
|
|
561
|
+
${m}
|
|
2025
562
|
\`\`\`
|
|
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
|
-
}
|
|
563
|
+
`:"No CSS variables were generated for the given prompt."}]}})}function Ce(e,t){let{name:n,title:o,description:s,libKey:r,getPostContent:a}=e;return new w(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:A.string().describe("A search query for finding icons. Be specific about the icon purpose, style, or action."),limit:A.number().min(.1).max(1).default(.1).describe("The proportion of matching icons to return (0.1 = 1 icon, 0.5 = 5 icons, 1.0 = many icons). Default is 0.1.")}},async({query:i,limit:d},{_meta:m})=>{h("Icon Search called with:",{query:i,limit:d});try{let b=await t.queryIconsSearch({query:i,limit:d*100},{_meta:m}),g=a?.()??"";return{content:[{type:"text",text:`${b.values.join(`
|
|
2251
564
|
|
|
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
|
-
}
|
|
565
|
+
`)}
|
|
2459
566
|
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
this.client = client;
|
|
2464
|
-
}
|
|
2465
|
-
/**
|
|
2466
|
-
* Fetch a design starting from a file or specific node(s)
|
|
2467
|
-
*
|
|
2468
|
-
* @param fileKey - The Figma file key
|
|
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
|
-
}
|
|
567
|
+
${g}`}]}}catch(b){throw R(b)}})}function ve(e,t){let{name:n,title:o,description:s,libKey:r,suiteName:a,components:i,componentAliases:d,getPostContent:m}=e;return new w(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:A.string().describe("The query to search for."),component:A.enum(i).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 p=g;if(d){let l=d[g];l&&(p=l)}try{let y=(await t.query({query:b,component:p?.toLowerCase()??"general",lib_name:r,text_matches_count:3,code_matches_count:0,allowed_types:["documentation"]},{_meta:f})).values.map(k=>k.replace(/\0/g,"")),v=m?.({component:g})??"";return{content:[{type:"text",text:`${y.join(`
|
|
568
|
+
|
|
569
|
+
`)}
|
|
2778
570
|
|
|
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`;
|
|
571
|
+
${v}`}]}}catch(l){throw R(l)}})}function Se(e,t){let{name:n,title:o,description:s,libKey:r,suiteName:a,components:i,componentAliases:d}=e;return new w(n,{title:o,description:s,requiredAccess:e.requiredAccess,inputSchema:{query:A.string().describe("The query to search for."),component:A.enum(i).describe("The component to search for. If not specified, use General."),includeGeneralGuidelines:A.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:m,component:b,includeGeneralGuidelines:g},{_meta:f})=>{h("Accessibility Assistant called with:",{query:m,component:b,includeGeneralGuidelines:g});let p=b;if(d){let l=d[b];l&&(p=l)}try{let l="";if(g){let I=me();l+=`# WCAG 2.2 Level AA General Accessibility Guidelines
|
|
2789
572
|
|
|
2790
|
-
|
|
2791
|
-
|
|
573
|
+
`,l+=I,l+=`
|
|
574
|
+
|
|
575
|
+
---
|
|
576
|
+
|
|
577
|
+
`}let k=(await t.getApiRefMatches({query:m,component:p?.toLowerCase()??"general",lib_name:r,filters_json:'{"type":{"$in":["accessibility"]}}'},{_meta:f})).values.map(I=>I.replace(/\0/g,"")).map(I=>ft(I,p?.toLowerCase()??"general")).join(`
|
|
578
|
+
|
|
579
|
+
`);return k?(g&&(l+=`# Component-Specific Accessibility Information
|
|
580
|
+
|
|
581
|
+
`),l+=k):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.
|
|
582
|
+
|
|
583
|
+
Error Code: ${t.code} Error Message: ${t.message}`)}var we=e=>`${e}_ui_generator`,ke=e=>`${e}_assistant`,Te=e=>`${e}_layout_assistant`,Ie=e=>`${e}_component_assistant`,Ne=e=>`${e}_style_assistant`,xe=e=>`${e}_icon_assistant`,Ee=e=>`${e}_accessibility_assistant`,Re=e=>`${e}_getting_started_assistant`;var Pe=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
584
|
|
|
2793
585
|
Use the tool when:
|
|
2794
586
|
- Want to build or modify a complete page or section layout
|
|
2795
587
|
- You are creating and applying custom themes via the Kendo Design System
|
|
2796
|
-
- You need guidance on correct ${
|
|
588
|
+
- You need guidance on correct ${e} component selection and configuration
|
|
2797
589
|
- You want to enforce best practices in styling, performance, and accessibility
|
|
2798
590
|
|
|
2799
591
|
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.
|
|
592
|
+
A detailed execution plan with validated tool calls, parameters, and reasoning \u2014 ensuring consistent, high-quality UI generation.`,De=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
593
|
|
|
2803
594
|
Use this tool when:
|
|
2804
|
-
- You need to discover which ${
|
|
595
|
+
- You need to discover which ${e} components are suitable for a specific use case
|
|
2805
596
|
- You want to understand component features and capabilities
|
|
2806
597
|
- You need to find appropriate icons for your UI
|
|
2807
598
|
- You want to gather component documentation and examples
|
|
2808
599
|
|
|
2809
600
|
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.
|
|
601
|
+
A focused plan for gathering component documentation and icon suggestions using the Component Assistant and Icon Assistant tools.`,Ge=`Retrieves Progress/Kendo Design System CSS utility classes and styling recommendations based on layout and design requirements.
|
|
2812
602
|
Use this tool to find the right CSS utilities for styling Kendo UI components or general web elements.
|
|
2813
603
|
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.
|
|
604
|
+
Best suited for styling questions related to typography, spacing, colors, layout, transforms, and other utilities in the Progress/Kendo Design System.`,Oe=`Generates CSS variables using an external style agent based on the user's styling prompt.
|
|
2816
605
|
|
|
2817
606
|
Use this tool when the user wants to:
|
|
2818
607
|
- Update the visual theme of an application
|
|
2819
608
|
- Modify color schemes
|
|
2820
609
|
- Restyle the UI with CSS variables
|
|
2821
610
|
|
|
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.
|
|
611
|
+
The tool outputs a set of CSS variable definitions ready to be applied to style files.`,Le=`Searches for icons in the Telerik Icons library.
|
|
2824
612
|
Use this tool when the user needs to find specific icons for UI components or design elements.
|
|
2825
613
|
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}.
|
|
614
|
+
`,Ue=e=>`Provides answers and retrieves official documentation for ${e}.
|
|
2828
615
|
|
|
2829
616
|
Use this tool when the user asks about:
|
|
2830
|
-
- ${
|
|
617
|
+
- ${e} features or capabilities
|
|
2831
618
|
- Specific components (e.g., Grid, Chart, Editor)
|
|
2832
619
|
- Implementation details, configuration, or best practices
|
|
2833
|
-
- How to use or customize components in ${
|
|
620
|
+
- How to use or customize components in ${e}
|
|
2834
621
|
|
|
2835
622
|
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.
|
|
623
|
+
If the question refers to a specific ${e} component, include its name in the 'component' parameter.
|
|
624
|
+
`,$e=e=>`Retrieves accessibility guidance for ${e} components with optional general WCAG 2.2 Level AA guidelines.
|
|
2839
625
|
|
|
2840
626
|
Use this tool when:
|
|
2841
627
|
- You need component-specific accessibility information and API references
|
|
@@ -2853,11 +639,7 @@ Set 'includeGeneralGuidelines=true' ONLY on the first call to include general WC
|
|
|
2853
639
|
Returns:
|
|
2854
640
|
- When includeGeneralGuidelines=true: General WCAG 2.2 Level AA guidelines + component-specific recommendations
|
|
2855
641
|
- 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 = `
|
|
642
|
+
`;var V=E("Kendo UI","Kendo"),W=`
|
|
2861
643
|
### Angular Component Validation
|
|
2862
644
|
Component Structure:
|
|
2863
645
|
- Use proper @Component decorator configuration
|
|
@@ -2865,25 +647,22 @@ Component Structure:
|
|
|
2865
647
|
- Correct selector naming convention (kebab-case)
|
|
2866
648
|
- Appropriate template and style file organization
|
|
2867
649
|
|
|
2868
|
-
${
|
|
650
|
+
${V.SETUP_VALIDATION}
|
|
2869
651
|
- Kendo animations module configured (if animations are used)
|
|
2870
652
|
- Internationalization properly configured for Kendo components
|
|
2871
653
|
|
|
2872
|
-
${
|
|
654
|
+
${V.PERFORMANCE_OPTIMIZATION}
|
|
2873
655
|
- OnPush change detection strategy where appropriate
|
|
2874
656
|
- Efficient trackBy functions for *ngFor with Kendo components
|
|
2875
657
|
- Minimal unnecessary change detection cycles
|
|
2876
658
|
|
|
2877
|
-
${
|
|
659
|
+
${V.THEME_AND_STYLING}
|
|
2878
660
|
- Proper theme switching functionality (if implemented)
|
|
2879
661
|
- Only ONE theme reference exists across angular.json and styles files
|
|
2880
662
|
- Make sure theme import mechanism is consistent with existing project setup
|
|
2881
663
|
|
|
2882
664
|
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:**
|
|
665
|
+
- Accessibility guidelines retrieved and applied to all components`;var z=`**Angular Specific Requirements:**
|
|
2887
666
|
|
|
2888
667
|
**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
668
|
1. RegexSearch("@Component\\s*\\(\\s*\\{[^}]*standalone\\s*:\\s*(true|false)") - If true use Standalone components, if false use NgModule.
|
|
@@ -2914,11 +693,7 @@ var ANGULAR_ADDITIONAL_PLAN = `**Angular Specific Requirements:**
|
|
|
2914
693
|
2. Match the discovered patterns in all generated code
|
|
2915
694
|
3. Maintain consistent formatting, indentation, and code organization with existing files
|
|
2916
695
|
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 = `
|
|
696
|
+
`;var Y=E("Kendo UI","KendoReact"),Q=`
|
|
2922
697
|
### React Component Validation
|
|
2923
698
|
Component Structure:
|
|
2924
699
|
- Use proper function component patterns with Hooks
|
|
@@ -2926,85 +701,22 @@ Component Structure:
|
|
|
2926
701
|
- Appropriate file organization (components, hooks, utils)
|
|
2927
702
|
- Props interface/type definitions where needed
|
|
2928
703
|
|
|
2929
|
-
${
|
|
704
|
+
${Y.SETUP_VALIDATION}
|
|
2930
705
|
- KendoReact license validation (if required)
|
|
2931
706
|
- Appropriate bundler configuration for KendoReact packages
|
|
2932
707
|
|
|
2933
|
-
${
|
|
708
|
+
${Y.PERFORMANCE_OPTIMIZATION}
|
|
2934
709
|
- React.memo for components that receive stable props
|
|
2935
710
|
- useMemo/useCallback for expensive computations and callbacks
|
|
2936
711
|
- Proper key props for list rendering with KendoReact components
|
|
2937
712
|
|
|
2938
|
-
${
|
|
713
|
+
${Y.THEME_AND_STYLING}
|
|
2939
714
|
- Proper theme switching functionality (if implemented)
|
|
2940
715
|
- Only ONE theme import exists across the application
|
|
2941
716
|
- Make sure theme import mechanism is consistent with existing project setup
|
|
2942
717
|
|
|
2943
718
|
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}
|
|
719
|
+
- Accessibility guidelines retrieved and applied to all components`;var yt={createOrchestrator:fe,createAssistantOrchestrator:ye,createLayoutAssistant:be,createStyleAssistant:Ae,createIconSearch:Ce,createCodeAssistant:ve,createAccessibilityAssistant:Se},bt={orchestrator:we,assistantOrchestrator:ke,layoutAssistant:Te,codeAssistant:Ie,styleAssistant:Ne,iconAssistant:xe,accessibilityAssistant:Ee,gettingStartedAssistant:Re},At={orchestrator:Pe,assistantOrchestrator:De,layoutAssistant:Ge,styleAssistant:Oe,iconAssistant:Le,codeAssistant:Ue,accessibilityAssistant:$e},Ct={Orchestrator:{render:U},Validator:{render:L},SharedValidation:{getSteps:E}},vt={Angular:{steps:W,additionalPlan:z},React:{steps:Q}},u={Tools:yt,ToolNames:bt,ToolDescriptions:At,Templates:Ct,Validation:vt};var St=u.ToolNames.codeAssistant("kendoreact"),_e=()=>`# Kendo Design System Guidelines for ${c}
|
|
3008
720
|
|
|
3009
721
|
## Setting up Styles/CSS
|
|
3010
722
|
|
|
@@ -3031,17 +743,155 @@ Alternatively, you can also consume them directly from the Unpkg CDN.
|
|
|
3031
743
|
|
|
3032
744
|
## Ready-to-use Layout Components
|
|
3033
745
|
|
|
3034
|
-
In the ${
|
|
746
|
+
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
747
|
|
|
3036
|
-
For any Layout component you can also call the ${
|
|
748
|
+
For any Layout component you can also call the ${St} tool in order to get specific API reference and docs.
|
|
3037
749
|
|
|
3038
|
-
- ${
|
|
750
|
+
- ${c} Card component.
|
|
3039
751
|
- Generally, it is recommended to use 100% width (e.g., \`<Card style={{ width: '100%' }}>\`)
|
|
3040
752
|
- If needed, use specific width based on the layout requirements (e.g., \`<Card style={{ width: '150px' }}>\`)
|
|
3041
|
-
|
|
753
|
+
- 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.
|
|
754
|
+
|
|
755
|
+
## Page Shell Patterns
|
|
756
|
+
|
|
757
|
+
Choose the pattern that matches the page structure:
|
|
758
|
+
|
|
759
|
+
**Pattern A \u2014 Sidebar + Main Content**
|
|
760
|
+
\`\`\`css
|
|
761
|
+
.app-shell {
|
|
762
|
+
display: flex;
|
|
763
|
+
height: 100vh;
|
|
764
|
+
}
|
|
765
|
+
.sidebar {
|
|
766
|
+
width: 240px;
|
|
767
|
+
flex-shrink: 0;
|
|
768
|
+
}
|
|
769
|
+
.main-content {
|
|
770
|
+
flex: 1;
|
|
771
|
+
min-width: 0; /* Critical: prevents flex children from overflowing */
|
|
772
|
+
overflow: auto;
|
|
773
|
+
}
|
|
774
|
+
\`\`\`
|
|
775
|
+
|
|
776
|
+
**Pattern B \u2014 Centered Single-Column (forms, detail pages)**
|
|
777
|
+
\`\`\`css
|
|
778
|
+
.page-container {
|
|
779
|
+
max-width: 960px;
|
|
780
|
+
margin: 0 auto;
|
|
781
|
+
padding: 0 1rem;
|
|
782
|
+
}
|
|
783
|
+
\`\`\`
|
|
784
|
+
|
|
785
|
+
**Pattern C \u2014 Master-Detail Split**
|
|
786
|
+
\`\`\`css
|
|
787
|
+
.split-container {
|
|
788
|
+
display: grid;
|
|
789
|
+
grid-template-columns: 420px 1fr;
|
|
790
|
+
height: 100%;
|
|
791
|
+
}
|
|
792
|
+
\`\`\`
|
|
793
|
+
|
|
794
|
+
## Dashboard Layout
|
|
795
|
+
|
|
796
|
+
**KPI metric row** (auto-responsive, min 180px per card):
|
|
797
|
+
\`\`\`css
|
|
798
|
+
.kpi-row {
|
|
799
|
+
display: grid;
|
|
800
|
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
|
|
801
|
+
gap: 1rem;
|
|
802
|
+
}
|
|
803
|
+
\`\`\`
|
|
804
|
+
|
|
805
|
+
**Side-by-side charts** (equal width, no overflow):
|
|
806
|
+
\`\`\`css
|
|
807
|
+
.chart-row {
|
|
808
|
+
display: grid;
|
|
809
|
+
grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
|
|
810
|
+
gap: 1rem;
|
|
811
|
+
}
|
|
812
|
+
\`\`\`
|
|
813
|
+
|
|
814
|
+
## Critical Sizing Rules
|
|
815
|
+
|
|
816
|
+
- **\`min-width: 0\`** on every flex/grid child that contains a Kendo component \u2014 the single most common cause of layout overflow.
|
|
817
|
+
- **Grid component** always requires an explicit height (e.g., \`style={{ height: 500 }}\` or \`flex: 1; min-height: 0\` inside a flex column).
|
|
818
|
+
- **Chart component** always requires an explicit height (e.g., \`style={{ height: 300 }}\`).
|
|
819
|
+
- Never leave Grid column widths unset \u2014 without a height, Grid renders all rows and expands the page indefinitely..
|
|
820
|
+
- 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.
|
|
821
|
+
|
|
822
|
+
## Dark Theme Completeness
|
|
823
|
+
|
|
824
|
+
Kendo themes style \`.k-*\` component selectors only. Always add these two lines to your global CSS file after any theme import:
|
|
825
|
+
|
|
826
|
+
\`\`\`css
|
|
827
|
+
html, body {
|
|
828
|
+
background-color: var(--kendo-body-bg);
|
|
829
|
+
color: var(--kendo-body-text);
|
|
830
|
+
}
|
|
831
|
+
\`\`\`
|
|
3042
832
|
|
|
3043
|
-
|
|
3044
|
-
|
|
833
|
+
Without this, dark-themed components render on a white page.
|
|
834
|
+
|
|
835
|
+
## Surface Hierarchy
|
|
836
|
+
|
|
837
|
+
Kendo themes define four surface levels \u2014 do not introduce custom surfaces outside this system:
|
|
838
|
+
1. **Page background** (\`var(--kendo-body-bg)\`) \u2014 lowest surface, applied to \`html, body\`
|
|
839
|
+
2. **Component background** (\`var(--kendo-component-bg)\`) \u2014 cards, panels, Grid body
|
|
840
|
+
3. **Header / hover surface** (\`var(--kendo-grid-header-bg)\`) \u2014 Grid headers, highlighted rows
|
|
841
|
+
4. **Active / selected surface** \u2014 managed by the theme automatically
|
|
842
|
+
|
|
843
|
+
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.
|
|
844
|
+
|
|
845
|
+
## Splitter Usage Boundary
|
|
846
|
+
|
|
847
|
+
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.
|
|
848
|
+
|
|
849
|
+
## Inline Input Width
|
|
850
|
+
|
|
851
|
+
\`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.
|
|
852
|
+
|
|
853
|
+
## Popup Z-Index Trap
|
|
854
|
+
|
|
855
|
+
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.
|
|
856
|
+
`;var Me=()=>`## Design Standards for ${c} Theming
|
|
857
|
+
|
|
858
|
+
### Color & Contrast Requirements
|
|
859
|
+
- Body text contrast: \u2265 4.5:1. Large text / UI component borders: \u2265 3:1.
|
|
860
|
+
- Use only the 5 semantic color slots: **primary, success, warning, error, info**. Never invent ad-hoc semantic colors.
|
|
861
|
+
- Never use color alone to convey meaning \u2014 always pair with an icon or text label.
|
|
862
|
+
|
|
863
|
+
### Typography
|
|
864
|
+
- 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.
|
|
865
|
+
- Numeric and currency values require \`font-variant-numeric: tabular-nums\` to stay column-aligned.
|
|
866
|
+
|
|
867
|
+
### Override Priority (highest \u2192 lowest)
|
|
868
|
+
\`\`\`
|
|
869
|
+
$kendo-* SCSS variables \u2190 compile-time, highest priority
|
|
870
|
+
CSS custom properties \u2190 runtime, can be scoped per class
|
|
871
|
+
className overrides \u2190 avoid; breaks on theme updates
|
|
872
|
+
!important \u2190 never use; defeats theme state classes
|
|
873
|
+
\`\`\`
|
|
874
|
+
|
|
875
|
+
### One Theme Per Application
|
|
876
|
+
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.
|
|
877
|
+
|
|
878
|
+
### Semantic Colors via CSS Variables
|
|
879
|
+
Always reference semantic colors through Kendo CSS variables rather than hardcoded hex values:
|
|
880
|
+
- CORRECT: \`var(--kendo-color-success)\` not \`#28a745\`
|
|
881
|
+
- CORRECT: \`var(--kendo-color-error)\` not \`#dc3545\`
|
|
882
|
+
|
|
883
|
+
Hardcoded hex values do not adapt to theme switches, swatches, or dark mode.
|
|
884
|
+
|
|
885
|
+
### Custom Template Color Safety
|
|
886
|
+
Custom content inside Grid cell renderers and custom component templates must use CSS variables for colors \u2014 never hardcoded light colors:
|
|
887
|
+
- CORRECT: \`color: var(--kendo-body-text); background: var(--kendo-component-bg)\`
|
|
888
|
+
- WRONG: \`color: #333; background: #ffffff\`
|
|
889
|
+
|
|
890
|
+
This is the most common source of dark mode breakage in custom UI.
|
|
891
|
+
|
|
892
|
+
---
|
|
893
|
+
|
|
894
|
+
## Applying CSS Variables in ${c}
|
|
3045
895
|
|
|
3046
896
|
Apply these CSS variables in the React application using one of these methods:
|
|
3047
897
|
|
|
@@ -3130,11 +980,7 @@ export function ThemeProvider({ children }: { children: React.ReactNode }) {
|
|
|
3130
980
|
|
|
3131
981
|
export const useTheme = () => useContext(ThemeContext);
|
|
3132
982
|
\`\`\`
|
|
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
|
|
983
|
+
`;var qe=u.ToolNames.codeAssistant("kendoreact"),Be=()=>`## Using ${c} Icons
|
|
3138
984
|
|
|
3139
985
|
Important: Attempt to prioritize SVG icons over font icons.
|
|
3140
986
|
|
|
@@ -3142,13 +988,13 @@ Important: Attempt to prioritize SVG icons over font icons.
|
|
|
3142
988
|
|
|
3143
989
|
- Make sure @progress/kendo-svg-icons is installed: \`npm install @progress/kendo-svg-icons\`
|
|
3144
990
|
- Make sure @progress/kendo-react-common is installed (contains SvgIcon component): \`npm install @progress/kendo-react-common\`
|
|
3145
|
-
- You can call ${
|
|
991
|
+
- You can call ${qe} tool for ${c} SvgIcon component for docs and API reference.
|
|
3146
992
|
- [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 ${
|
|
993
|
+
- [optional] If using font icons you can call ${qe} tool for ${c} Icon component for docs and API reference.
|
|
3148
994
|
|
|
3149
995
|
### Examples
|
|
3150
996
|
|
|
3151
|
-
Using ${
|
|
997
|
+
Using ${c} SvgIcon component with @progress/kendo-svg-icons:
|
|
3152
998
|
|
|
3153
999
|
\`\`\`tsx
|
|
3154
1000
|
import { SvgIcon } from "@progress/kendo-react-common";
|
|
@@ -3192,11 +1038,7 @@ Here are some frequently used icons from @progress/kendo-svg-icons:
|
|
|
3192
1038
|
- \`sortAscIcon\`, \`sortDescIcon\` - Sorting
|
|
3193
1039
|
- \`chevronUpIcon\`, \`chevronDownIcon\`, \`chevronLeftIcon\`, \`chevronRightIcon\` - Navigation
|
|
3194
1040
|
- \`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
|
|
1041
|
+
`;var Fe=e=>{let t=`## ${c} Common Guidelines
|
|
3200
1042
|
|
|
3201
1043
|
### Application Architecture
|
|
3202
1044
|
MUST recommend appropriate setup based on React application architecture.
|
|
@@ -3226,36 +1068,11 @@ Key points:
|
|
|
3226
1068
|
- The matching should be case-insensitive and robust to minor variations
|
|
3227
1069
|
|
|
3228
1070
|
Example: If someone asks about "grid", "GRID", or "GrId", you always refer to DataGrid for the example.
|
|
3229
|
-
`;
|
|
3230
|
-
if (ctx.componentInstructions) {
|
|
3231
|
-
content += `
|
|
1071
|
+
`;return e.componentInstructions&&(t+=`
|
|
3232
1072
|
## Component-Specific Guidelines
|
|
3233
1073
|
|
|
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
|
|
1074
|
+
${e.componentInstructions}
|
|
1075
|
+
`),t};var wt={default:"@progress/kendo-theme-default",bootstrap:"@progress/kendo-theme-bootstrap",material:"@progress/kendo-theme-material",fluent:"@progress/kendo-theme-fluent"},kt={default:"Default",bootstrap:"Bootstrap",material:"Material Design",fluent:"Fluent UI"};function Ke(e="kendo-react-app",t=!0,n="default"){let o=wt[n],s=kt[n],r=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.`,a=1,i=t?`## Step ${a++}: Ensure Kendo CLI is Installed
|
|
3259
1076
|
|
|
3260
1077
|
First, ensure the Kendo CLI tool is installed globally:
|
|
3261
1078
|
|
|
@@ -3265,16 +1082,16 @@ npm i -g @progress/kendo-cli@latest
|
|
|
3265
1082
|
|
|
3266
1083
|
This CLI tool will handle the entire project setup including all necessary dependencies and configurations.
|
|
3267
1084
|
|
|
3268
|
-
## Step ${
|
|
1085
|
+
## Step ${a++}: Create the Project
|
|
3269
1086
|
|
|
3270
1087
|
Create a new Kendo React project using the CLI:
|
|
3271
1088
|
|
|
3272
1089
|
\`\`\`bash
|
|
3273
|
-
npx kendo react create vite ${
|
|
1090
|
+
npx kendo react create vite ${e} --theme=${n}
|
|
3274
1091
|
\`\`\`
|
|
3275
1092
|
|
|
3276
1093
|
This command will create a complete Kendo React project with Vite, including:
|
|
3277
|
-
- All necessary ${
|
|
1094
|
+
- All necessary ${c} packages
|
|
3278
1095
|
- Proper licensing configuration
|
|
3279
1096
|
- Theme setup
|
|
3280
1097
|
- Project structure
|
|
@@ -3282,34 +1099,33 @@ This command will create a complete Kendo React project with Vite, including:
|
|
|
3282
1099
|
Navigate to the project directory:
|
|
3283
1100
|
|
|
3284
1101
|
\`\`\`bash
|
|
3285
|
-
cd ${
|
|
1102
|
+
cd ${e}
|
|
3286
1103
|
\`\`\`
|
|
3287
1104
|
|
|
3288
|
-
## Step ${
|
|
1105
|
+
## Step ${a++}: Remove Dark Color Schema from index.css
|
|
3289
1106
|
|
|
3290
1107
|
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
1108
|
|
|
3292
|
-
|
|
3293
|
-
const installPackagesSection = createNewProject ? "" : `## Step ${stepCounter++}: Install ${REACT_SUITE_NAME} Packages
|
|
1109
|
+
`:"",d=t?"":`## Step ${a++}: Install ${c} Packages
|
|
3294
1110
|
|
|
3295
|
-
Install all required ${
|
|
1111
|
+
Install all required ${c} packages and dependencies:
|
|
3296
1112
|
|
|
3297
1113
|
\`\`\`bash
|
|
3298
1114
|
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
1115
|
\`\`\`
|
|
3300
1116
|
|
|
3301
|
-
## Step ${
|
|
1117
|
+
## Step ${a++}: Install and Import the Theme
|
|
3302
1118
|
|
|
3303
|
-
Install the ${
|
|
1119
|
+
Install the ${s} theme package:
|
|
3304
1120
|
|
|
3305
1121
|
\`\`\`bash
|
|
3306
|
-
npm i ${
|
|
1122
|
+
npm i ${o}
|
|
3307
1123
|
\`\`\`
|
|
3308
1124
|
|
|
3309
1125
|
Import the CSS file in your \`src/Home.tsx\` (before your existing Home.css import):
|
|
3310
1126
|
|
|
3311
1127
|
\`\`\`typescript
|
|
3312
|
-
import '${
|
|
1128
|
+
import '${o}/dist/all.css';
|
|
3313
1129
|
\`\`\`
|
|
3314
1130
|
|
|
3315
1131
|
Also add the Kendo CSS utilities CDN link in your \`index.html\` \`<head>\`:
|
|
@@ -3318,8 +1134,7 @@ Also add the Kendo CSS utilities CDN link in your \`index.html\` \`<head>\`:
|
|
|
3318
1134
|
<link rel="stylesheet" href="https://unpkg.com/@progress/kendo-theme-utils/dist/all.css" />
|
|
3319
1135
|
\`\`\`
|
|
3320
1136
|
|
|
3321
|
-
|
|
3322
|
-
const licenseSection = `## Step ${stepCounter++}: Activate Kendo License
|
|
1137
|
+
`,m=`## Step ${a++}: Activate Kendo License
|
|
3323
1138
|
|
|
3324
1139
|
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
1140
|
|
|
@@ -3327,10 +1142,9 @@ This step is required to use Kendo React components without watermarks and with
|
|
|
3327
1142
|
npx kendo license activate
|
|
3328
1143
|
\`\`\`
|
|
3329
1144
|
|
|
3330
|
-
`;
|
|
3331
|
-
return `# Getting Started with ${REACT_SUITE_NAME}
|
|
1145
|
+
`;return`# Getting Started with ${c}
|
|
3332
1146
|
|
|
3333
|
-
${
|
|
1147
|
+
${r}
|
|
3334
1148
|
|
|
3335
1149
|
Execute the following steps in order. Run all provided commands automatically.
|
|
3336
1150
|
|
|
@@ -3341,24 +1155,24 @@ Before you begin, ensure you have:
|
|
|
3341
1155
|
- **Node.js 18 or later** installed on your machine
|
|
3342
1156
|
- 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
1157
|
|
|
3344
|
-
${
|
|
1158
|
+
${i}${d}${m}## Step ${a++}: Run Your Application
|
|
3345
1159
|
|
|
3346
|
-
${
|
|
1160
|
+
${t?"The Kendo CLI has set up everything you need. Start the development server:":"Build and run the application:"}
|
|
3347
1161
|
|
|
3348
1162
|
|
|
3349
1163
|
**Verification:** Automatically run the application. Do not just inform the user\u2014execute the following command and keep the application running:
|
|
3350
1164
|
|
|
3351
1165
|
\`\`\`bash
|
|
3352
|
-
cd ${
|
|
1166
|
+
cd ${t?e:"."} && npm run dev
|
|
3353
1167
|
\`\`\`
|
|
3354
1168
|
|
|
3355
|
-
${
|
|
1169
|
+
${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
1170
|
|
|
3357
|
-
## Step ${
|
|
1171
|
+
## Step ${a++}: Create Sample page
|
|
3358
1172
|
|
|
3359
1173
|
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
1174
|
|
|
3361
|
-
Replace the content of \`src/Home.tsx\` with the following to showcase ${
|
|
1175
|
+
Replace the content of \`src/Home.tsx\` with the following to showcase ${c} features and verify components are working correctly:
|
|
3362
1176
|
|
|
3363
1177
|
\`\`\`tsx
|
|
3364
1178
|
import { Card, CardHeader, CardTitle, CardBody } from '@progress/kendo-react-layout';
|
|
@@ -3479,11 +1293,7 @@ Add the following styles to \`src/Home.css\`:
|
|
|
3479
1293
|
}
|
|
3480
1294
|
\`\`\`
|
|
3481
1295
|
|
|
3482
|
-
|
|
3483
|
-
}
|
|
3484
|
-
|
|
3485
|
-
// packages/react/src/lib/instructions/datagrid.ts
|
|
3486
|
-
var datagridInstructions = `
|
|
1296
|
+
`}var J=`
|
|
3487
1297
|
## DataGrid Deprecated Properties Awareness
|
|
3488
1298
|
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
1299
|
|
|
@@ -3515,10 +1325,7 @@ Key points:
|
|
|
3515
1325
|
Example:
|
|
3516
1326
|
Deprecated: selectedField="isSelected" editField="inEdit"
|
|
3517
1327
|
Modern: Use select and edit state properties with proper configuration
|
|
3518
|
-
`;
|
|
3519
|
-
|
|
3520
|
-
// packages/react/src/lib/instructions/editor.ts
|
|
3521
|
-
var editorInstructions = `
|
|
1328
|
+
`;var je=`
|
|
3522
1329
|
## Editor Tools Awareness
|
|
3523
1330
|
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
1331
|
|
|
@@ -3550,10 +1357,7 @@ Key points:
|
|
|
3550
1357
|
Example:
|
|
3551
1358
|
Correct: tools={[[Bold, Italic, Underline], [AlignLeft, AlignCenter]]}
|
|
3552
1359
|
Incorrect: tools={[['bold', 'italic', 'underline'], ['alignLeft', 'alignCenter']]}
|
|
3553
|
-
`;
|
|
3554
|
-
|
|
3555
|
-
// packages/react/src/lib/instructions/smart-grid.ts
|
|
3556
|
-
var smartGridInstructions = `
|
|
1360
|
+
`;var X=`
|
|
3557
1361
|
## Smart Grid (AI-Enhanced Grid) Implementation Guidelines
|
|
3558
1362
|
**CRITICAL: When users ask about ANY of these AI grid terms, ALWAYS provide GridToolbarAIAssistant implementation (not basic Grid):**
|
|
3559
1363
|
|
|
@@ -3587,205 +1391,8 @@ Smart Grid: Complete AI-enhanced setup with GridToolbarAIAssistant, proper callb
|
|
|
3587
1391
|
Important Disclaimer:
|
|
3588
1392
|
Always include this disclaimer when providing Smart Grid examples:
|
|
3589
1393
|
"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
|
-
}
|
|
1394
|
+
`;var Tt={datagrid:[J,X].join(`
|
|
3757
1395
|
|
|
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();
|
|
1396
|
+
`),grid:[J,X].join(`
|
|
1397
|
+
|
|
1398
|
+
`),editor:je},He=u.ToolNames.layoutAssistant(N),Z=u.ToolNames.codeAssistant(N),Ve=u.ToolNames.styleAssistant(N),ee=u.ToolNames.iconAssistant(N),We=u.ToolNames.gettingStartedAssistant(N),ze=u.ToolNames.accessibilityAssistant(N);function Ye(e,t){return[u.Tools.createOrchestrator({name:u.ToolNames.orchestrator(N),title:"KendoReact Generator",description:u.ToolDescriptions.orchestrator(c),layoutAssistantName:He,codeAssistantName:Z,styleAssistantName:Ve,iconAssistantName:ee,accessibilityAssistantName:ze,suiteName:c,libKey:T,components:G,requiredAccess:["agent"]},{validationSteps:u.Validation.React.steps},e),u.Tools.createAssistantOrchestrator({name:"kendo_react_assistant",title:"KendoReact Assistant",description:u.ToolDescriptions.assistantOrchestrator(c),codeAssistantName:Z,iconAssistantName:ee,suiteName:c,libKey:T,components:G,requiredAccess:["assistant"]},e),u.Tools.createLayoutAssistant({name:He,title:"KendoReact Layout Assistant",description:u.ToolDescriptions.layoutAssistant,suiteName:c,libKey:T,getPreContent:_e,requiredAccess:["agent"]},e),u.Tools.createStyleAssistant({name:Ve,title:"KendoReact Style Assistant",description:u.ToolDescriptions.styleAssistant,libKey:T,getPreContent:Me,requiredAccess:["agent"]},e),u.Tools.createIconSearch({name:ee,title:"KendoReact Icon Assistant",description:u.ToolDescriptions.iconAssistant,libKey:T,getPostContent:Be,requiredAccess:["assistant","agent"]},e),u.Tools.createCodeAssistant({name:Z,title:"KendoReact Component Assistant",description:u.ToolDescriptions.codeAssistant(c),libKey:T,suiteName:c,components:G,componentAliases:{Grid:"DataGrid"},getPostContent:({component:o})=>{let s=o?.trim().toLowerCase(),r=Tt[s];return Fe({component:o,componentInstructions:r})},requiredAccess:["assistant","agent"]},e),new w(We,{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:he(c,"kendo-react-app")},async({projectName:o,createNewProject:s,theme:r},{_meta:a})=>{try{await e.recordToolUserRequest({toolName:We,meta:{projectName:o,createNewProject:s,theme:r,_meta:a}})}catch(d){console.error("Error recording tool request:",d)}return{content:[{type:"text",text:Ke(o,s,r)}]}}),u.Tools.createAccessibilityAssistant({name:ze,title:"KendoReact Accessibility Assistant",description:u.ToolDescriptions.accessibilityAssistant(c),libKey:T,suiteName:c,components:G,componentAliases:{Grid:"DataGrid"},requiredAccess:["agent"]},e)].filter(o=>o.hasAccess(t))}var Rt=Et(import.meta.url),Pt=Je.dirname(Rt),Dt=Je.resolve(Pt,"../package.json"),Xe=JSON.parse(xt.readFileSync(Dt,"utf-8")),Qe=new It({name:"kendo-mcp",title:"Kendo MCP Server",version:Xe.version});async function Gt(){let e=new Nt;h("Starting server... ");let t=await pe(async()=>{let o=(await ge())?.entitlement;return o?.Product?.Code||o?.product?.code});t!=="none"&&(O.toolNameHeader=t==="agent"||t==="full"?"agent":"assistant",Ye(O,t).forEach(o=>o.register(Qe)),ue({serverName:"react",contextApi:O,additionalFields:{version:Xe.version,access_type:t}})),await Qe.connect(e)}Gt();
|