canicode 0.8.7 → 0.8.9
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/cli/index.js +12 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +12 -3
- package/dist/mcp/server.js.map +1 -1
- package/package.json +1 -1
package/dist/mcp/server.js
CHANGED
|
@@ -30,7 +30,7 @@ __export(visual_compare_exports, {
|
|
|
30
30
|
});
|
|
31
31
|
async function fetchFigmaScreenshot(fileKey, nodeId, token, outputPath) {
|
|
32
32
|
const res = await fetch(
|
|
33
|
-
`https://api.figma.com/v1/images/${fileKey}?ids=${nodeId}&format=png&scale=
|
|
33
|
+
`https://api.figma.com/v1/images/${fileKey}?ids=${nodeId}&format=png&scale=1`,
|
|
34
34
|
{ headers: { "X-Figma-Token": token } }
|
|
35
35
|
);
|
|
36
36
|
if (!res.ok) throw new Error(`Figma Images API: ${res.status} ${res.statusText}`);
|
|
@@ -52,7 +52,12 @@ async function renderCodeScreenshot(codePath, outputPath, viewport) {
|
|
|
52
52
|
timeout: 3e4
|
|
53
53
|
});
|
|
54
54
|
await page.waitForTimeout(1e3);
|
|
55
|
-
|
|
55
|
+
const root = page.locator("body > *:first-child");
|
|
56
|
+
if (await root.count() > 0) {
|
|
57
|
+
await root.screenshot({ path: outputPath });
|
|
58
|
+
} else {
|
|
59
|
+
await page.screenshot({ path: outputPath });
|
|
60
|
+
}
|
|
56
61
|
await browser.close();
|
|
57
62
|
}
|
|
58
63
|
function resizePng(png, targetWidth, targetHeight) {
|
|
@@ -901,6 +906,9 @@ function transformNode(node) {
|
|
|
901
906
|
if ("effects" in node) {
|
|
902
907
|
base.effects = node.effects;
|
|
903
908
|
}
|
|
909
|
+
if ("cornerRadius" in node && typeof node.cornerRadius === "number") {
|
|
910
|
+
base.cornerRadius = node.cornerRadius;
|
|
911
|
+
}
|
|
904
912
|
if ("boundVariables" in node && node.boundVariables) {
|
|
905
913
|
base.boundVariables = node.boundVariables;
|
|
906
914
|
}
|
|
@@ -1506,7 +1514,7 @@ function parseDesignData(data, fileKey, fileName) {
|
|
|
1506
1514
|
}
|
|
1507
1515
|
|
|
1508
1516
|
// package.json
|
|
1509
|
-
var version = "0.8.
|
|
1517
|
+
var version = "0.8.9";
|
|
1510
1518
|
var AnalysisNodeTypeSchema = z.enum([
|
|
1511
1519
|
"DOCUMENT",
|
|
1512
1520
|
"CANVAS",
|
|
@@ -1572,6 +1580,7 @@ var BaseAnalysisNodeSchema = z.object({
|
|
|
1572
1580
|
fills: z.array(z.unknown()).optional(),
|
|
1573
1581
|
strokes: z.array(z.unknown()).optional(),
|
|
1574
1582
|
effects: z.array(z.unknown()).optional(),
|
|
1583
|
+
cornerRadius: z.number().optional(),
|
|
1575
1584
|
// Variable binding analysis (design tokens)
|
|
1576
1585
|
boundVariables: z.record(z.string(), z.unknown()).optional(),
|
|
1577
1586
|
// Text analysis
|