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/cli/index.js
CHANGED
|
@@ -28,7 +28,7 @@ __export(visual_compare_exports, {
|
|
|
28
28
|
});
|
|
29
29
|
async function fetchFigmaScreenshot(fileKey, nodeId, token, outputPath) {
|
|
30
30
|
const res = await fetch(
|
|
31
|
-
`https://api.figma.com/v1/images/${fileKey}?ids=${nodeId}&format=png&scale=
|
|
31
|
+
`https://api.figma.com/v1/images/${fileKey}?ids=${nodeId}&format=png&scale=1`,
|
|
32
32
|
{ headers: { "X-Figma-Token": token } }
|
|
33
33
|
);
|
|
34
34
|
if (!res.ok) throw new Error(`Figma Images API: ${res.status} ${res.statusText}`);
|
|
@@ -50,7 +50,12 @@ async function renderCodeScreenshot(codePath, outputPath, viewport) {
|
|
|
50
50
|
timeout: 3e4
|
|
51
51
|
});
|
|
52
52
|
await page.waitForTimeout(1e3);
|
|
53
|
-
|
|
53
|
+
const root = page.locator("body > *:first-child");
|
|
54
|
+
if (await root.count() > 0) {
|
|
55
|
+
await root.screenshot({ path: outputPath });
|
|
56
|
+
} else {
|
|
57
|
+
await page.screenshot({ path: outputPath });
|
|
58
|
+
}
|
|
54
59
|
await browser.close();
|
|
55
60
|
}
|
|
56
61
|
function resizePng(png, targetWidth, targetHeight) {
|
|
@@ -940,6 +945,9 @@ function transformNode(node) {
|
|
|
940
945
|
if ("effects" in node) {
|
|
941
946
|
base.effects = node.effects;
|
|
942
947
|
}
|
|
948
|
+
if ("cornerRadius" in node && typeof node.cornerRadius === "number") {
|
|
949
|
+
base.cornerRadius = node.cornerRadius;
|
|
950
|
+
}
|
|
943
951
|
if ("boundVariables" in node && node.boundVariables) {
|
|
944
952
|
base.boundVariables = node.boundVariables;
|
|
945
953
|
}
|
|
@@ -1119,7 +1127,7 @@ async function loadFromApi(fileKey, nodeId, token) {
|
|
|
1119
1127
|
}
|
|
1120
1128
|
|
|
1121
1129
|
// package.json
|
|
1122
|
-
var version = "0.8.
|
|
1130
|
+
var version = "0.8.9";
|
|
1123
1131
|
var AnalysisNodeTypeSchema = z.enum([
|
|
1124
1132
|
"DOCUMENT",
|
|
1125
1133
|
"CANVAS",
|
|
@@ -1185,6 +1193,7 @@ var BaseAnalysisNodeSchema = z.object({
|
|
|
1185
1193
|
fills: z.array(z.unknown()).optional(),
|
|
1186
1194
|
strokes: z.array(z.unknown()).optional(),
|
|
1187
1195
|
effects: z.array(z.unknown()).optional(),
|
|
1196
|
+
cornerRadius: z.number().optional(),
|
|
1188
1197
|
// Variable binding analysis (design tokens)
|
|
1189
1198
|
boundVariables: z.record(z.string(), z.unknown()).optional(),
|
|
1190
1199
|
// Text analysis
|