figma-prototype-mcp 0.31.0 → 0.32.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/dist/figma-plugin/code.js +10 -8
- package/dist/server/index.js +3 -3
- package/package.json +1 -1
|
@@ -510,6 +510,10 @@
|
|
|
510
510
|
resetScrollPosition: action.resetScrollPosition
|
|
511
511
|
};
|
|
512
512
|
}
|
|
513
|
+
async function encodeReactionActions(reaction, resolvers) {
|
|
514
|
+
const raw = Array.isArray(reaction == null ? void 0 : reaction.actions) && reaction.actions.length > 0 ? reaction.actions : (reaction == null ? void 0 : reaction.action) ? [reaction.action] : [];
|
|
515
|
+
return Promise.all(raw.map((a) => encodeActionForListEcho(a, resolvers)));
|
|
516
|
+
}
|
|
513
517
|
async function decodeConditionForEcho(condition, resolvers) {
|
|
514
518
|
const decoded = decodeConditionExpression(condition);
|
|
515
519
|
if ("raw" in decoded) return { raw: decoded.raw };
|
|
@@ -875,7 +879,7 @@
|
|
|
875
879
|
return { page: { id: page.id, name: page.name }, frames, selection };
|
|
876
880
|
}
|
|
877
881
|
async function handleGetPrototypeFlow(params) {
|
|
878
|
-
var _a, _b, _c
|
|
882
|
+
var _a, _b, _c;
|
|
879
883
|
const page = await loadPage(params.pageId);
|
|
880
884
|
const limit = (_a = params.limit) != null ? _a : 500;
|
|
881
885
|
const frames = page.findAll((n) => n.type === "FRAME").map((f) => {
|
|
@@ -897,13 +901,12 @@
|
|
|
897
901
|
const frameId = node.type === "FRAME" ? node.id : findEnclosingFrameId(node);
|
|
898
902
|
const reactions = (_b = node.reactions) != null ? _b : [];
|
|
899
903
|
for (const r of reactions) {
|
|
900
|
-
const firstAction = (_e = (_d = (_c = r.actions) == null ? void 0 : _c[0]) != null ? _d : r.action) != null ? _e : {};
|
|
901
904
|
interactions.push({
|
|
902
905
|
frameId,
|
|
903
906
|
sourceNodeId: node.id,
|
|
904
907
|
sourceNodeName: node.name,
|
|
905
|
-
trigger: (
|
|
906
|
-
|
|
908
|
+
trigger: (_c = r.trigger) != null ? _c : { type: "UNKNOWN" },
|
|
909
|
+
actions: await encodeReactionActions(r, echoResolvers)
|
|
907
910
|
});
|
|
908
911
|
}
|
|
909
912
|
}
|
|
@@ -1131,12 +1134,11 @@
|
|
|
1131
1134
|
nodeId: node.id,
|
|
1132
1135
|
nodeName: node.name,
|
|
1133
1136
|
reactions: await Promise.all(reactions.map(async (r, i) => {
|
|
1134
|
-
var _a2
|
|
1135
|
-
const firstAction = (_c = (_b = (_a2 = r.actions) == null ? void 0 : _a2[0]) != null ? _b : r.action) != null ? _c : {};
|
|
1137
|
+
var _a2;
|
|
1136
1138
|
return {
|
|
1137
1139
|
index: i,
|
|
1138
|
-
trigger: (
|
|
1139
|
-
|
|
1140
|
+
trigger: (_a2 = r.trigger) != null ? _a2 : { type: "UNKNOWN" },
|
|
1141
|
+
actions: await encodeReactionActions(r, echoResolvers)
|
|
1140
1142
|
};
|
|
1141
1143
|
}))
|
|
1142
1144
|
};
|
package/dist/server/index.js
CHANGED
|
@@ -966,8 +966,8 @@ function buildInteractionSpec(flow, screens) {
|
|
|
966
966
|
}
|
|
967
967
|
const interactions = (byFrame.get(id) ?? []).map((it) => {
|
|
968
968
|
const source = { id: it.sourceNodeId, name: it.sourceNodeName ?? null };
|
|
969
|
-
const
|
|
970
|
-
return { source, trigger: it.trigger, actions
|
|
969
|
+
const actions = (Array.isArray(it.actions) ? it.actions : []).map((a) => mapAction(a, source, unsupported)).filter((x) => x !== null);
|
|
970
|
+
return { source, trigger: it.trigger, actions };
|
|
971
971
|
});
|
|
972
972
|
screensOut.push({ id, name: frame.name ?? null, interactions });
|
|
973
973
|
}
|
|
@@ -998,7 +998,7 @@ function makeTools(historyStore) {
|
|
|
998
998
|
},
|
|
999
999
|
{
|
|
1000
1000
|
name: "get_prototype_flow",
|
|
1001
|
-
description: "Return the whole prototype interaction graph of a page in ONE call: its frames (each with `isStartFrame`) and every wired interaction \u2014 `{ frameId, frameName, sourceNodeId, sourceNodeName, trigger,
|
|
1001
|
+
description: "Return the whole prototype interaction graph of a page in ONE call: its frames (each with `isStartFrame`) and every wired interaction \u2014 `{ frameId, frameName, sourceNodeId, sourceNodeName, trigger, actions }`. Each entry in `actions` is decoded exactly as `list_reactions` returns it (navigate / scroll / overlay / swap / close / back / url / change_to / set_variable / toggle_variable / conditional incl. all/any compound). Use this to see what is ALREADY wired before adding more (avoid duplicates, check what a screen connects to); for a single node use list_reactions. Page-scoped \u2014 optional `pageId` (defaults to current page); `limit` caps interactions (default 500) and sets `truncated`.",
|
|
1002
1002
|
schema: GetPrototypeFlowInput,
|
|
1003
1003
|
command: "GET_PROTOTYPE_FLOW"
|
|
1004
1004
|
},
|