@clovis500c/figma-bridge 1.8.0 → 1.13.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 +49 -13
- package/dist/server.js +2256 -351
- package/package.json +7 -3
- package/plugin/code.js +577 -20
- package/plugin/manifest.json +2 -1
- package/plugin/ui.html +24 -3
package/plugin/manifest.json
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
"api": "1.0.0",
|
|
5
5
|
"main": "code.js",
|
|
6
6
|
"ui": "ui.html",
|
|
7
|
-
"editorType": ["figma"],
|
|
7
|
+
"editorType": ["figma", "figjam", "slides"],
|
|
8
8
|
"documentAccess": "dynamic-page",
|
|
9
|
+
"enablePrivatePluginApi": true,
|
|
9
10
|
"networkAccess": {
|
|
10
11
|
"allowedDomains": ["none"],
|
|
11
12
|
"devAllowedDomains": ["http://localhost:3055", "ws://localhost:3055"],
|
package/plugin/ui.html
CHANGED
|
@@ -357,7 +357,8 @@
|
|
|
357
357
|
|
|
358
358
|
<section class="banner warn" id="verBar">
|
|
359
359
|
<span class="bico"><svg width="14" height="14"><use href="#i-alert"/></svg></span>
|
|
360
|
-
<div class="main"><b>Version mismatch</b><span id="verMsg">Reopen the plugin or update.</span></div>
|
|
360
|
+
<div class="main"><b id="verTitle">Version mismatch</b><span id="verMsg">Reopen the plugin or update.</span></div>
|
|
361
|
+
<button class="mini" id="btnReopen">Reopen</button>
|
|
361
362
|
</section>
|
|
362
363
|
|
|
363
364
|
<section class="banner" id="waitBar">
|
|
@@ -487,6 +488,9 @@ const METHODS = {
|
|
|
487
488
|
prototype: { label: "Prototype", color: "#8b5cf6", icon: "i-play" },
|
|
488
489
|
annotate: { label: "Annotate", color: "#f59e0b", icon: "i-note" },
|
|
489
490
|
export_tree: { label: "Export code", color: "#64748b", icon: "i-braces" },
|
|
491
|
+
node_info: { label: "Layer names", color: "#64748b", icon: "i-tree" },
|
|
492
|
+
roblox_tree: { label: "Roblox export", color: "#e11d48", icon: "i-braces" },
|
|
493
|
+
roblox_images: { label: "Roblox images", color: "#e11d48", icon: "i-image" },
|
|
490
494
|
ping: { label: "Ping", color: "#64748b", icon: "i-pulse" },
|
|
491
495
|
};
|
|
492
496
|
const methodOf = (m) => METHODS[m] || { label: m, color: "#64748b", icon: "i-pulse" };
|
|
@@ -774,6 +778,9 @@ function summarize(msg) {
|
|
|
774
778
|
return action.charAt(0).toUpperCase() + action.slice(1) + (p.nodeId ? " · " + p.nodeId : "");
|
|
775
779
|
}
|
|
776
780
|
case "export_tree": return p.nodeId ? "Node " + p.nodeId : "Selection";
|
|
781
|
+
case "roblox_tree": return p.nodeId ? "Node " + p.nodeId : "Selection";
|
|
782
|
+
case "roblox_images": return (p.items || []).length + " picture" + ((p.items || []).length === 1 ? "" : "s") + " at " + ((p.items && p.items[0] && p.items[0].scale) || 2) + "×";
|
|
783
|
+
case "node_info": return (p.ids || []).length + " layer" + ((p.ids || []).length === 1 ? "" : "s");
|
|
777
784
|
case "wait_for_selection": return p.message || "Select layers";
|
|
778
785
|
case "build": {
|
|
779
786
|
let count = 0;
|
|
@@ -926,10 +933,23 @@ function onProgress(msg) {
|
|
|
926
933
|
renderBar();
|
|
927
934
|
}
|
|
928
935
|
|
|
936
|
+
function newerThan(a, b) {
|
|
937
|
+
const pa = a.split(".").map(Number), pb = b.split(".").map(Number);
|
|
938
|
+
for (let i = 0; i < 3; i++) if ((pa[i] || 0) !== (pb[i] || 0)) return (pa[i] || 0) > (pb[i] || 0);
|
|
939
|
+
return false;
|
|
940
|
+
}
|
|
941
|
+
|
|
929
942
|
function renderVersion() {
|
|
930
943
|
const mismatch = !!(serverVersion && version && serverVersion !== version);
|
|
931
944
|
document.body.classList.toggle("mismatch", mismatch);
|
|
932
|
-
if (mismatch)
|
|
945
|
+
if (!mismatch) return;
|
|
946
|
+
// The server installs the matching plugin when it starts: a newer server means the update is already on disk.
|
|
947
|
+
const updateReady = newerThan(serverVersion, version);
|
|
948
|
+
$("verTitle").textContent = updateReady ? "Update installed: v" + serverVersion : "Older server: v" + serverVersion;
|
|
949
|
+
$("verMsg").textContent = updateReady
|
|
950
|
+
? "Reopen the plugin to use it."
|
|
951
|
+
: "This plugin is v" + version + ". Restart your AI client to update its server.";
|
|
952
|
+
$("btnReopen").style.display = updateReady ? "" : "none";
|
|
933
953
|
}
|
|
934
954
|
|
|
935
955
|
// ─── Rendering ──────────────────────────────────────────────────────────────
|
|
@@ -1112,6 +1132,7 @@ $("btnWaitCancel").onclick = () => {
|
|
|
1112
1132
|
const w = [...waits.values()].pop();
|
|
1113
1133
|
if (w) toPlugin({ t: "cancelWait", id: w.id });
|
|
1114
1134
|
};
|
|
1135
|
+
$("btnReopen").onclick = () => toPlugin({ t: "reopen" });
|
|
1115
1136
|
$("btnClear").onclick = () => { entries.length = 0; openId = null; render(); };
|
|
1116
1137
|
$("btnRetry").onclick = () => { retryDelay = 400; connect(); };
|
|
1117
1138
|
$("btnCopyCmd").onclick = () => copy("Get-NetTCPConnection -LocalPort 3055");
|
|
@@ -1184,7 +1205,7 @@ window.onmessage = (ev) => {
|
|
|
1184
1205
|
} else if (msg.t === "info") {
|
|
1185
1206
|
session = msg.session;
|
|
1186
1207
|
renderSession();
|
|
1187
|
-
send({ t: "info", fileName: session.fileName, page: session.page });
|
|
1208
|
+
send({ t: "info", fileName: session.fileName, page: session.page, pageId: session.pageId });
|
|
1188
1209
|
} else if (msg.t === "res") {
|
|
1189
1210
|
onResult(msg);
|
|
1190
1211
|
} else if (msg.t === "progress") {
|