@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
|
@@ -1195,6 +1195,67 @@ server.tool(
|
|
|
1195
1195
|
}
|
|
1196
1196
|
}
|
|
1197
1197
|
);
|
|
1198
|
+
server.tool(
|
|
1199
|
+
"create_component",
|
|
1200
|
+
"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.",
|
|
1201
|
+
{
|
|
1202
|
+
nodeId: z.string().describe("ID of the node to convert into a component")
|
|
1203
|
+
},
|
|
1204
|
+
async ({ nodeId }) => {
|
|
1205
|
+
try {
|
|
1206
|
+
const result = await sendCommandToFigma("create_component", { nodeId });
|
|
1207
|
+
const typedResult = result;
|
|
1208
|
+
return {
|
|
1209
|
+
content: [
|
|
1210
|
+
{
|
|
1211
|
+
type: "text",
|
|
1212
|
+
text: `Created component "${typedResult.name}" with ID: ${typedResult.id}, key: ${typedResult.key}`
|
|
1213
|
+
}
|
|
1214
|
+
]
|
|
1215
|
+
};
|
|
1216
|
+
} catch (error) {
|
|
1217
|
+
return {
|
|
1218
|
+
content: [
|
|
1219
|
+
{
|
|
1220
|
+
type: "text",
|
|
1221
|
+
text: `Error creating component: ${error instanceof Error ? error.message : String(error)}`
|
|
1222
|
+
}
|
|
1223
|
+
]
|
|
1224
|
+
};
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
);
|
|
1228
|
+
server.tool(
|
|
1229
|
+
"create_component_set",
|
|
1230
|
+
"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.",
|
|
1231
|
+
{
|
|
1232
|
+
nodeIds: z.array(z.string()).min(1).describe("Array of Component node IDs to combine into a variant set"),
|
|
1233
|
+
parentId: z.string().optional().describe("Optional parent node ID. Defaults to the first component's parent.")
|
|
1234
|
+
},
|
|
1235
|
+
async ({ nodeIds, parentId }) => {
|
|
1236
|
+
try {
|
|
1237
|
+
const result = await sendCommandToFigma("create_component_set", { nodeIds, parentId });
|
|
1238
|
+
const typedResult = result;
|
|
1239
|
+
return {
|
|
1240
|
+
content: [
|
|
1241
|
+
{
|
|
1242
|
+
type: "text",
|
|
1243
|
+
text: `Created component set "${typedResult.name}" with ID: ${typedResult.id}, containing ${typedResult.childCount} variants`
|
|
1244
|
+
}
|
|
1245
|
+
]
|
|
1246
|
+
};
|
|
1247
|
+
} catch (error) {
|
|
1248
|
+
return {
|
|
1249
|
+
content: [
|
|
1250
|
+
{
|
|
1251
|
+
type: "text",
|
|
1252
|
+
text: `Error creating component set: ${error instanceof Error ? error.message : String(error)}`
|
|
1253
|
+
}
|
|
1254
|
+
]
|
|
1255
|
+
};
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
1258
|
+
);
|
|
1198
1259
|
server.tool(
|
|
1199
1260
|
"get_instance_overrides",
|
|
1200
1261
|
"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.",
|