@biolab/talk-to-figma 0.5.0 → 0.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/README.md +0 -125
- package/dist/cli.cjs +104 -0
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.js +104 -0
- package/dist/cli.js.map +1 -1
- package/dist/talk_to_figma_mcp/server.cjs +104 -0
- package/dist/talk_to_figma_mcp/server.cjs.map +1 -1
- package/dist/talk_to_figma_mcp/server.js +104 -0
- package/dist/talk_to_figma_mcp/server.js.map +1 -1
- package/figma-plugin/code.js +118 -1
- package/figma-plugin/figma-plugin.zip +0 -0
- package/figma-plugin/ui.html +869 -832
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1038,6 +1038,110 @@ var init_server = __esm({
|
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
1040
|
);
|
|
1041
|
+
server.tool(
|
|
1042
|
+
"set_font_family",
|
|
1043
|
+
"Set the font family of an existing text node in Figma",
|
|
1044
|
+
{
|
|
1045
|
+
nodeId: z.string().describe("The ID of the text node to modify"),
|
|
1046
|
+
fontFamily: z.string().describe("Font family name (e.g. 'Inter', 'Roboto', 'Arial')"),
|
|
1047
|
+
fontStyle: z.string().optional().describe("Font style (e.g. 'Regular', 'Bold', 'Italic'). Defaults to 'Regular'")
|
|
1048
|
+
},
|
|
1049
|
+
async ({ nodeId, fontFamily, fontStyle }) => {
|
|
1050
|
+
try {
|
|
1051
|
+
const result = await sendCommandToFigma("set_font_family", {
|
|
1052
|
+
nodeId,
|
|
1053
|
+
fontFamily,
|
|
1054
|
+
fontStyle: fontStyle || "Regular"
|
|
1055
|
+
});
|
|
1056
|
+
const typedResult = result;
|
|
1057
|
+
return {
|
|
1058
|
+
content: [
|
|
1059
|
+
{
|
|
1060
|
+
type: "text",
|
|
1061
|
+
text: `Updated font family of node "${typedResult.name}" to "${typedResult.fontName.family} ${typedResult.fontName.style}"`
|
|
1062
|
+
}
|
|
1063
|
+
]
|
|
1064
|
+
};
|
|
1065
|
+
} catch (error) {
|
|
1066
|
+
return {
|
|
1067
|
+
content: [
|
|
1068
|
+
{
|
|
1069
|
+
type: "text",
|
|
1070
|
+
text: `Error setting font family: ${error instanceof Error ? error.message : String(error)}`
|
|
1071
|
+
}
|
|
1072
|
+
]
|
|
1073
|
+
};
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
);
|
|
1077
|
+
server.tool(
|
|
1078
|
+
"set_font_size",
|
|
1079
|
+
"Set the font size of an existing text node in Figma",
|
|
1080
|
+
{
|
|
1081
|
+
nodeId: z.string().describe("The ID of the text node to modify"),
|
|
1082
|
+
fontSize: z.number().min(1).describe("Font size in pixels")
|
|
1083
|
+
},
|
|
1084
|
+
async ({ nodeId, fontSize }) => {
|
|
1085
|
+
try {
|
|
1086
|
+
const result = await sendCommandToFigma("set_font_size", {
|
|
1087
|
+
nodeId,
|
|
1088
|
+
fontSize
|
|
1089
|
+
});
|
|
1090
|
+
const typedResult = result;
|
|
1091
|
+
return {
|
|
1092
|
+
content: [
|
|
1093
|
+
{
|
|
1094
|
+
type: "text",
|
|
1095
|
+
text: `Updated font size of node "${typedResult.name}" to ${typedResult.fontSize}px`
|
|
1096
|
+
}
|
|
1097
|
+
]
|
|
1098
|
+
};
|
|
1099
|
+
} catch (error) {
|
|
1100
|
+
return {
|
|
1101
|
+
content: [
|
|
1102
|
+
{
|
|
1103
|
+
type: "text",
|
|
1104
|
+
text: `Error setting font size: ${error instanceof Error ? error.message : String(error)}`
|
|
1105
|
+
}
|
|
1106
|
+
]
|
|
1107
|
+
};
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
);
|
|
1111
|
+
server.tool(
|
|
1112
|
+
"set_font_weight",
|
|
1113
|
+
"Set the font weight of an existing text node in Figma. Maps numeric weight to font style (100=Thin, 300=Light, 400=Regular, 500=Medium, 600=Semi Bold, 700=Bold, 800=Extra Bold, 900=Black)",
|
|
1114
|
+
{
|
|
1115
|
+
nodeId: z.string().describe("The ID of the text node to modify"),
|
|
1116
|
+
fontWeight: z.number().min(100).max(900).describe("Font weight (100-900)")
|
|
1117
|
+
},
|
|
1118
|
+
async ({ nodeId, fontWeight }) => {
|
|
1119
|
+
try {
|
|
1120
|
+
const result = await sendCommandToFigma("set_font_weight", {
|
|
1121
|
+
nodeId,
|
|
1122
|
+
fontWeight
|
|
1123
|
+
});
|
|
1124
|
+
const typedResult = result;
|
|
1125
|
+
return {
|
|
1126
|
+
content: [
|
|
1127
|
+
{
|
|
1128
|
+
type: "text",
|
|
1129
|
+
text: `Updated font weight of node "${typedResult.name}" to ${fontWeight} (${typedResult.fontName.style})`
|
|
1130
|
+
}
|
|
1131
|
+
]
|
|
1132
|
+
};
|
|
1133
|
+
} catch (error) {
|
|
1134
|
+
return {
|
|
1135
|
+
content: [
|
|
1136
|
+
{
|
|
1137
|
+
type: "text",
|
|
1138
|
+
text: `Error setting font weight: ${error instanceof Error ? error.message : String(error)}`
|
|
1139
|
+
}
|
|
1140
|
+
]
|
|
1141
|
+
};
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
);
|
|
1041
1145
|
server.tool(
|
|
1042
1146
|
"get_styles",
|
|
1043
1147
|
"Get all styles from the current Figma document",
|