@biolab/talk-to-figma 0.4.0 → 0.5.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/README.md +10 -8
- package/dist/cli.cjs +61 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +61 -0
- package/dist/cli.js.map +1 -1
- package/dist/talk_to_figma_mcp/server.cjs +61 -0
- package/dist/talk_to_figma_mcp/server.cjs.map +1 -1
- package/dist/talk_to_figma_mcp/server.js +61 -0
- package/dist/talk_to_figma_mcp/server.js.map +1 -1
- package/figma-plugin/code.js +106 -0
- package/figma-plugin/figma-plugin.zip +0 -0
- package/figma-plugin/manifest.json +2 -2
- package/figma-plugin/ui.html +15 -15
- package/package.json +1 -1
|
@@ -1217,6 +1217,67 @@ server.tool(
|
|
|
1217
1217
|
}
|
|
1218
1218
|
}
|
|
1219
1219
|
);
|
|
1220
|
+
server.tool(
|
|
1221
|
+
"create_component",
|
|
1222
|
+
"Convert an existing node (typically a frame) into a reusable Figma Component. The node must not be nested inside another component, component set, or instance.",
|
|
1223
|
+
{
|
|
1224
|
+
nodeId: import_zod.z.string().describe("ID of the node to convert into a component")
|
|
1225
|
+
},
|
|
1226
|
+
async ({ nodeId }) => {
|
|
1227
|
+
try {
|
|
1228
|
+
const result = await sendCommandToFigma("create_component", { nodeId });
|
|
1229
|
+
const typedResult = result;
|
|
1230
|
+
return {
|
|
1231
|
+
content: [
|
|
1232
|
+
{
|
|
1233
|
+
type: "text",
|
|
1234
|
+
text: `Created component "${typedResult.name}" with ID: ${typedResult.id}, key: ${typedResult.key}`
|
|
1235
|
+
}
|
|
1236
|
+
]
|
|
1237
|
+
};
|
|
1238
|
+
} catch (error) {
|
|
1239
|
+
return {
|
|
1240
|
+
content: [
|
|
1241
|
+
{
|
|
1242
|
+
type: "text",
|
|
1243
|
+
text: `Error creating component: ${error instanceof Error ? error.message : String(error)}`
|
|
1244
|
+
}
|
|
1245
|
+
]
|
|
1246
|
+
};
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
);
|
|
1250
|
+
server.tool(
|
|
1251
|
+
"create_component_set",
|
|
1252
|
+
"Combine multiple Component nodes into a single ComponentSet (variant component). All provided nodes must already be Components (use create_component first). Components should use naming like 'property=value, property=value' for Figma to auto-detect variant properties.",
|
|
1253
|
+
{
|
|
1254
|
+
nodeIds: import_zod.z.array(import_zod.z.string()).min(1).describe("Array of Component node IDs to combine into a variant set"),
|
|
1255
|
+
parentId: import_zod.z.string().optional().describe("Optional parent node ID. Defaults to the first component's parent.")
|
|
1256
|
+
},
|
|
1257
|
+
async ({ nodeIds, parentId }) => {
|
|
1258
|
+
try {
|
|
1259
|
+
const result = await sendCommandToFigma("create_component_set", { nodeIds, parentId });
|
|
1260
|
+
const typedResult = result;
|
|
1261
|
+
return {
|
|
1262
|
+
content: [
|
|
1263
|
+
{
|
|
1264
|
+
type: "text",
|
|
1265
|
+
text: `Created component set "${typedResult.name}" with ID: ${typedResult.id}, containing ${typedResult.childCount} variants`
|
|
1266
|
+
}
|
|
1267
|
+
]
|
|
1268
|
+
};
|
|
1269
|
+
} catch (error) {
|
|
1270
|
+
return {
|
|
1271
|
+
content: [
|
|
1272
|
+
{
|
|
1273
|
+
type: "text",
|
|
1274
|
+
text: `Error creating component set: ${error instanceof Error ? error.message : String(error)}`
|
|
1275
|
+
}
|
|
1276
|
+
]
|
|
1277
|
+
};
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
);
|
|
1220
1281
|
server.tool(
|
|
1221
1282
|
"get_instance_overrides",
|
|
1222
1283
|
"Get all override properties from a selected component instance. These overrides can be applied to other instances, which will swap them to match the source component.",
|