@muloka/figma-console-mcp 0.6.4 → 0.6.6
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 +18 -6
- package/dist/apps/design-system-dashboard/mcp-app.html +20 -20
- package/dist/apps/design-system-dashboard/scoring/accessibility.d.ts.map +1 -1
- package/dist/apps/design-system-dashboard/scoring/accessibility.js +2 -1
- package/dist/apps/design-system-dashboard/scoring/accessibility.js.map +1 -1
- package/dist/apps/design-system-dashboard/scoring/coverage.d.ts.map +1 -1
- package/dist/apps/design-system-dashboard/scoring/coverage.js +2 -1
- package/dist/apps/design-system-dashboard/scoring/coverage.js.map +1 -1
- package/dist/apps/design-system-dashboard/scoring/token-architecture.d.ts.map +1 -1
- package/dist/apps/design-system-dashboard/scoring/token-architecture.js +2 -1
- package/dist/apps/design-system-dashboard/scoring/token-architecture.js.map +1 -1
- package/dist/apps/design-system-dashboard/server.d.ts.map +1 -1
- package/dist/apps/design-system-dashboard/server.js +2 -1
- package/dist/apps/design-system-dashboard/server.js.map +1 -1
- package/dist/core/annotation-tools.d.ts.map +1 -1
- package/dist/core/annotation-tools.js +7 -6
- package/dist/core/annotation-tools.js.map +1 -1
- package/dist/core/cache-invalidation.d.ts +18 -2
- package/dist/core/cache-invalidation.d.ts.map +1 -1
- package/dist/core/cache-invalidation.js +51 -0
- package/dist/core/cache-invalidation.js.map +1 -1
- package/dist/core/call-context.d.ts +13 -0
- package/dist/core/call-context.d.ts.map +1 -0
- package/dist/core/call-context.js +20 -0
- package/dist/core/call-context.js.map +1 -0
- package/dist/core/comment-tools.d.ts.map +1 -1
- package/dist/core/comment-tools.js +4 -3
- package/dist/core/comment-tools.js.map +1 -1
- package/dist/core/deep-component-tools.d.ts.map +1 -1
- package/dist/core/deep-component-tools.js +5 -4
- package/dist/core/deep-component-tools.js.map +1 -1
- package/dist/core/design-code-tools.d.ts.map +1 -1
- package/dist/core/design-code-tools.js +4 -3
- package/dist/core/design-code-tools.js.map +1 -1
- package/dist/core/design-system-manifest.d.ts +7 -3
- package/dist/core/design-system-manifest.d.ts.map +1 -1
- package/dist/core/design-system-manifest.js +14 -5
- package/dist/core/design-system-manifest.js.map +1 -1
- package/dist/core/design-system-tools.d.ts.map +1 -1
- package/dist/core/design-system-tools.js +2 -1
- package/dist/core/design-system-tools.js.map +1 -1
- package/dist/core/diagnose-tool.d.ts +2 -0
- package/dist/core/diagnose-tool.d.ts.map +1 -1
- package/dist/core/diagnose-tool.js +6 -5
- package/dist/core/diagnose-tool.js.map +1 -1
- package/dist/core/figjam-tools.d.ts.map +1 -1
- package/dist/core/figjam-tools.js +5 -4
- package/dist/core/figjam-tools.js.map +1 -1
- package/dist/core/figma-api.d.ts +12 -0
- package/dist/core/figma-api.d.ts.map +1 -1
- package/dist/core/figma-api.js +17 -1
- package/dist/core/figma-api.js.map +1 -1
- package/dist/core/figma-tools.d.ts.map +1 -1
- package/dist/core/figma-tools.js +42 -53
- package/dist/core/figma-tools.js.map +1 -1
- package/dist/core/library-tools.d.ts.map +1 -1
- package/dist/core/library-tools.js +7 -6
- package/dist/core/library-tools.js.map +1 -1
- package/dist/core/logger.d.ts +11 -0
- package/dist/core/logger.d.ts.map +1 -1
- package/dist/core/logger.js +13 -1
- package/dist/core/logger.js.map +1 -1
- package/dist/core/plugin-import-dir.d.ts +9 -0
- package/dist/core/plugin-import-dir.d.ts.map +1 -0
- package/dist/core/plugin-import-dir.js +47 -0
- package/dist/core/plugin-import-dir.js.map +1 -0
- package/dist/core/plugin-name.d.ts +26 -0
- package/dist/core/plugin-name.d.ts.map +1 -0
- package/dist/core/plugin-name.js +35 -0
- package/dist/core/plugin-name.js.map +1 -0
- package/dist/core/port-discovery.d.ts +2 -2
- package/dist/core/port-discovery.d.ts.map +1 -1
- package/dist/core/port-discovery.js +8 -6
- package/dist/core/port-discovery.js.map +1 -1
- package/dist/core/slides-tools.d.ts.map +1 -1
- package/dist/core/slides-tools.js +2 -1
- package/dist/core/slides-tools.js.map +1 -1
- package/dist/core/slot-tools.d.ts.map +1 -1
- package/dist/core/slot-tools.js +3 -2
- package/dist/core/slot-tools.js.map +1 -1
- package/dist/core/tokens/schemas.d.ts +1 -1
- package/dist/core/tokens-tools.d.ts.map +1 -1
- package/dist/core/tokens-tools.js +2 -1
- package/dist/core/tokens-tools.js.map +1 -1
- package/dist/core/variable-resolver.d.ts.map +1 -1
- package/dist/core/variable-resolver.js +3 -2
- package/dist/core/variable-resolver.js.map +1 -1
- package/dist/core/version-tools.d.ts.map +1 -1
- package/dist/core/version-tools.js +9 -8
- package/dist/core/version-tools.js.map +1 -1
- package/dist/core/websocket-connector.d.ts.map +1 -1
- package/dist/core/websocket-connector.js +3 -2
- package/dist/core/websocket-connector.js.map +1 -1
- package/dist/core/websocket-server.d.ts.map +1 -1
- package/dist/core/websocket-server.js +8 -5
- package/dist/core/websocket-server.js.map +1 -1
- package/dist/core/write-tools.d.ts.map +1 -1
- package/dist/core/write-tools.js +283 -232
- package/dist/core/write-tools.js.map +1 -1
- package/dist/local.d.ts +1 -1
- package/dist/local.d.ts.map +1 -1
- package/dist/local.js +114 -190
- package/dist/local.js.map +1 -1
- package/figma-desktop-bridge/README.md +15 -63
- package/figma-desktop-bridge/code.js +31 -29
- package/figma-desktop-bridge/manifest.json +5 -9
- package/figma-desktop-bridge/ui.html +768 -924
- package/package.json +1 -1
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Toko Relay (the Desktop Bridge plugin)
|
|
2
2
|
|
|
3
|
-
A Figma plugin that bridges the Variables API and Component descriptions to MCP (Model Context Protocol) clients without requiring an Enterprise plan.
|
|
3
|
+
A Figma plugin that bridges the Variables API and Component descriptions to MCP (Model Context Protocol) clients without requiring an Enterprise plan.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
This plugin enables AI assistants to access your Figma variables AND component descriptions through the MCP protocol. It
|
|
7
|
+
This plugin enables AI assistants to access your Figma variables AND component descriptions through the MCP protocol. It connects to local MCP servers:
|
|
8
8
|
|
|
9
9
|
- **Local MCP bridge** — Connects to a local MCP server via WebSocket on localhost (Claude Code, Claude Desktop, Cursor)
|
|
10
|
-
- **Cloud relay bridge** — Connects to a cloud relay via WebSocket over TLS, enabling web-based AI clients (Claude.ai, v0, Replit, Lovable) to send write commands to Figma
|
|
11
10
|
|
|
12
|
-
|
|
11
|
+
The bridge bypasses Figma's plugin sandbox restrictions and the REST API's component description bug.
|
|
13
12
|
|
|
14
13
|
## Architecture
|
|
15
14
|
|
|
16
|
-
The plugin communicates with MCP servers via WebSocket
|
|
15
|
+
The plugin communicates with MCP servers via WebSocket:
|
|
17
16
|
|
|
18
17
|
```
|
|
19
|
-
|
|
20
|
-
CLOUD: Cloud MCP Server → Relay DO ←WebSocket (wss://)→ Plugin UI ←postMessage→ Plugin Worker → Figma API
|
|
18
|
+
MCP Server ←WebSocket (ports 9223–9232)→ Plugin UI ←postMessage→ Plugin Worker → Figma API
|
|
21
19
|
```
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
For cloud mode, the plugin connects to a Cloudflare Durable Object relay via a one-time pairing code. Web-based AI clients send write commands through the relay to the plugin.
|
|
21
|
+
The server supports multi-instance operation — if port 9223 is already in use, it automatically falls back through ports 9224–9232. The plugin scans all ports and connects to every active server.
|
|
26
22
|
|
|
27
23
|
**Key Features:**
|
|
28
24
|
- ✅ No Enterprise plan required for variables
|
|
@@ -36,8 +32,6 @@ For cloud mode, the plugin connects to a Cloudflare Durable Object relay via a o
|
|
|
36
32
|
- ✅ WebSocket transport — no debug flags needed
|
|
37
33
|
- ✅ Auto-reconnect on connection loss
|
|
38
34
|
- ✅ Multi-instance: connects to all active MCP servers simultaneously (v1.10.0)
|
|
39
|
-
- ✅ Cloud Mode: pair with web-based AI clients (Claude.ai, v0, Replit, Lovable)
|
|
40
|
-
- ✅ Full write access from any MCP-capable web platform
|
|
41
35
|
|
|
42
36
|
## Installation
|
|
43
37
|
|
|
@@ -45,10 +39,10 @@ For cloud mode, the plugin connects to a Cloudflare Durable Object relay via a o
|
|
|
45
39
|
|
|
46
40
|
1. **Open Figma Desktop**
|
|
47
41
|
2. **Go to Plugins → Development → Import plugin from manifest...**
|
|
48
|
-
3. **Navigate to:**
|
|
42
|
+
3. **Navigate to:** `~/.figma-console-mcp/toko-relay/manifest.json`, the folder the MCP server keeps up to date (`npx @muloka/figma-console-mcp --print-path` prints it). On macOS the folder is hidden: press **Cmd+Shift+G** in the file dialog and paste the path.
|
|
49
43
|
4. **Click "Open"**
|
|
50
44
|
|
|
51
|
-
The plugin will appear in your Development plugins list as "Figma Desktop Bridge".
|
|
45
|
+
The plugin will appear in your Development plugins list as "Toko Relay". If you still have the older "Figma Desktop Bridge" entry, see [Moving from Figma Desktop Bridge](../docs/setup.md#moving-from-figma-desktop-bridge).
|
|
52
46
|
|
|
53
47
|
### Manual Installation
|
|
54
48
|
|
|
@@ -69,8 +63,8 @@ cd figma-desktop-bridge
|
|
|
69
63
|
### Running the Plugin
|
|
70
64
|
|
|
71
65
|
1. **Open your Figma file** with variables and/or components
|
|
72
|
-
2. **Run the plugin:** Right-click → Plugins → Development →
|
|
73
|
-
3. **Wait for confirmation:** the
|
|
66
|
+
2. **Run the plugin:** Right-click → Plugins → Development → Toko Relay
|
|
67
|
+
3. **Wait for confirmation:** the window shows a green check, **Connected**, and **Ready**
|
|
74
68
|
|
|
75
69
|
The plugin will:
|
|
76
70
|
- Fetch all local variables and collections on startup
|
|
@@ -112,7 +106,6 @@ The plugin is a compact, collapsible status panel designed to stay out of the wa
|
|
|
112
106
|
- **Pause / Reconnect** — the action button:
|
|
113
107
|
- `Pause` (when connected) — disconnects and stops auto-reconnect until you resume.
|
|
114
108
|
- `Reconnect` (when not connected) — runs a fresh port scan and connects on the spot, with no need to close and reopen the plugin.
|
|
115
|
-
- **Cloud icon** — opens cloud pairing (see [Cloud Mode](#cloud-mode)).
|
|
116
109
|
- **`+` / `−`** — expand/collapse the options and panels.
|
|
117
110
|
|
|
118
111
|
### Options (under `+`)
|
|
@@ -142,29 +135,6 @@ The plugin follows Figma's light/dark theme automatically — there is no separa
|
|
|
142
135
|
- If no server is running yet (for example, you opened the plugin before starting your AI client), a background watchdog keeps probing while disconnected and connects automatically as soon as a server appears — **no plugin restart needed**. The `Reconnect` button forces an immediate retry.
|
|
143
136
|
- On the server side, stale/zombie MCP instances that would otherwise squat the port range are reaped automatically (SIGTERM, escalating to SIGKILL), so a freshly launched server can claim its preferred port instead of being pushed onto a fallback the plugin then has to chase.
|
|
144
137
|
|
|
145
|
-
## Cloud Mode
|
|
146
|
-
|
|
147
|
-
Cloud Mode lets web-based AI clients (Claude.ai, v0, Replit, Lovable) send write commands to your Figma file through a cloud relay. This enables the full suite of design creation and variable management tools from any MCP-capable web platform — no local Node.js required.
|
|
148
|
-
|
|
149
|
-
### How to Connect
|
|
150
|
-
|
|
151
|
-
1. **Start pairing from the AI client.** The AI client calls `figma_pair_plugin`, which generates a 6-character pairing code (valid for 5 minutes).
|
|
152
|
-
2. **Open the Desktop Bridge plugin** in Figma Desktop.
|
|
153
|
-
3. **Expand Cloud Mode.** Click the "Cloud Mode" toggle (chevron) below the status bar.
|
|
154
|
-
4. **Enter the pairing code** in the text input and click **Connect**.
|
|
155
|
-
5. The plugin establishes a WebSocket connection to the cloud relay. The status indicator changes to "Connected to cloud relay."
|
|
156
|
-
|
|
157
|
-
### Disconnecting
|
|
158
|
-
|
|
159
|
-
Click the **Disconnect** button in the Cloud Mode section, or close the plugin. The cloud relay session is terminated immediately.
|
|
160
|
-
|
|
161
|
-
### Notes
|
|
162
|
-
|
|
163
|
-
- **Both local and cloud connections can be active simultaneously.** Local MCP servers continue to work while Cloud Mode is connected.
|
|
164
|
-
- **Pairing codes are single-use.** Each code can only be used once. If connection fails, generate a new code from the AI client.
|
|
165
|
-
- **Codes expire in 5 minutes.** If the code has expired, ask the AI client to generate a fresh one.
|
|
166
|
-
- **One plugin per relay session.** Each pairing code creates a dedicated relay instance scoped to that session.
|
|
167
|
-
|
|
168
138
|
## How It Works
|
|
169
139
|
|
|
170
140
|
### Plugin Worker (code.js)
|
|
@@ -212,7 +182,7 @@ Click the **Disconnect** button in the Cloud Mode section, or close the plugin.
|
|
|
212
182
|
- Try **Plugins → Development → Refresh plugin list**
|
|
213
183
|
|
|
214
184
|
### "No plugin UI found with variables data" or "No plugin UI found with requestComponentData"
|
|
215
|
-
- Ensure plugin is running (
|
|
185
|
+
- Ensure the plugin is running (its window shows a green check and **Connected**)
|
|
216
186
|
- Try closing and reopening the plugin
|
|
217
187
|
- Check browser console for errors (Plugins → Development → Open Console)
|
|
218
188
|
|
|
@@ -228,7 +198,7 @@ Click the **Disconnect** button in the Cloud Mode section, or close the plugin.
|
|
|
228
198
|
- Check that the nodeId is correct (format: "123:456")
|
|
229
199
|
|
|
230
200
|
### Component request times out
|
|
231
|
-
- Ensure plugin is running and shows
|
|
201
|
+
- Ensure the plugin is running and shows **Connected**
|
|
232
202
|
- Check that the component exists in the current file
|
|
233
203
|
- Verify nodeId format is correct
|
|
234
204
|
- Timeout is set to 10 seconds - complex files may take longer
|
|
@@ -237,7 +207,7 @@ Click the **Disconnect** button in the Cloud Mode section, or close the plugin.
|
|
|
237
207
|
- Verify the MCP server is running (it starts the WebSocket server on port 9223)
|
|
238
208
|
- Check that the plugin is open in Figma — the WebSocket client is in the plugin UI
|
|
239
209
|
- Check the browser console (Plugins > Development > Open Console) for `[MCP Bridge] WebSocket connected to port 9223`
|
|
240
|
-
- **You usually don't need to restart the plugin.** If you opened it before starting the MCP server, the background watchdog reconnects automatically within ~12s once a server appears; the
|
|
210
|
+
- **You usually don't need to restart the plugin.** If you opened it before starting the MCP server, the background watchdog reconnects automatically within ~12s once a server appears; the **Try again** button forces it immediately. The window's first line shows the live connection state, with the number of connected AI apps after **Connected**.
|
|
241
211
|
- As of v1.10.0, multiple MCP servers can run simultaneously on different ports (9223–9232). If tools aren't working on a fallback port, re-import the plugin manifest to enable multi-port scanning.
|
|
242
212
|
- **Custom ports:** the plugin scans ports 9223–9232 automatically. The `FIGMA_WS_PORT` env var sets the preferred starting port. Multi-instance support works out of the box within this range.
|
|
243
213
|
|
|
@@ -247,16 +217,6 @@ Click the **Disconnect** button in the Cloud Mode section, or close the plugin.
|
|
|
247
217
|
- Cache TTL is 5 minutes for variables - use `refreshCache: true` for immediate updates
|
|
248
218
|
- Ensure you're in the correct file (plugin reads current file's data)
|
|
249
219
|
|
|
250
|
-
### Cloud Mode shows "Connection failed"
|
|
251
|
-
- The pairing code may have expired (codes are valid for 5 minutes). Generate a new one from the AI client.
|
|
252
|
-
- Verify the code was entered correctly (6 characters, case-sensitive).
|
|
253
|
-
|
|
254
|
-
### Cloud Mode disconnect button doesn't work
|
|
255
|
-
- Close and reopen the Cloud Mode section, then try again.
|
|
256
|
-
|
|
257
|
-
### Cloud connection drops between AI turns
|
|
258
|
-
- Re-pair by generating a new pairing code from the AI client. The relay uses hibernation-safe patterns, but extended idle periods may cause reconnection. If it persists, generate a fresh code.
|
|
259
|
-
|
|
260
220
|
## Multi-Instance Support (v1.10.0)
|
|
261
221
|
|
|
262
222
|
The Desktop Bridge plugin supports connecting to **multiple MCP server instances** simultaneously. This is useful when:
|
|
@@ -281,7 +241,7 @@ The server guards against this on two fronts:
|
|
|
281
241
|
- **On shutdown**, a hard backstop forces the process to exit even if graceful close hangs, so zombies aren't created in the first place.
|
|
282
242
|
- **On startup and periodically**, each server reaps orphaned instances that hold a port without a live advertisement file — escalating from `SIGTERM` to `SIGKILL` so a process that ignores `SIGTERM` is still cleared.
|
|
283
243
|
|
|
284
|
-
The
|
|
244
|
+
The AI-app count after **Connected** in the plugin window is a quick health check: if it's higher than the number of AI clients you actually have open, stale instances are present (and will be reaped on the next server launch).
|
|
285
245
|
|
|
286
246
|
### Important: One-Time Plugin Update
|
|
287
247
|
|
|
@@ -335,18 +295,10 @@ View logs: **Plugins → Development → Open Console** (Cmd+Option+I on Mac)
|
|
|
335
295
|
|
|
336
296
|
## Security
|
|
337
297
|
|
|
338
|
-
**Local Mode:**
|
|
339
298
|
- Plugin network access limited to `localhost` only (for WebSocket bridge)
|
|
340
299
|
- Data never leaves the local machine
|
|
341
300
|
- WebSocket bridge is local-only and unauthenticated — it relies on `localhost` binding for security. Multiple clients may be connected concurrently (one per Figma file). Do not expose the WebSocket port outside `localhost` (e.g., via port forwarding) on untrusted machines
|
|
342
301
|
|
|
343
|
-
**Cloud Mode:**
|
|
344
|
-
- Cloud relay connection uses TLS (`wss://`) for all traffic
|
|
345
|
-
- Pairing codes are single-use and expire in 5 minutes — no unauthenticated access is possible
|
|
346
|
-
- Each relay Durable Object is scoped per session (one plugin per relay instance)
|
|
347
|
-
- The relay passes commands through without storing design data persistently
|
|
348
|
-
|
|
349
|
-
**Both Modes:**
|
|
350
302
|
- Uses standard Figma Plugin API (no unofficial APIs)
|
|
351
303
|
- Component requests are scoped to current file only
|
|
352
304
|
|
|
@@ -16,12 +16,12 @@ var PLUGIN_VERSION = '1.35.0'; // Last release in which plugin files changed.
|
|
|
16
16
|
// so the server compares this too (only when the versions are equal) to spot
|
|
17
17
|
// a stale imported plugin. Bump it on every fork change to figma-desktop-bridge/;
|
|
18
18
|
// tests/plugin-revision-guard.test.ts fails until you do.
|
|
19
|
-
var FORK_PLUGIN_REVISION =
|
|
19
|
+
var FORK_PLUGIN_REVISION = 2;
|
|
20
20
|
|
|
21
21
|
console.log('🌉 [Desktop Bridge] Plugin loaded (v' + PLUGIN_VERSION + ')');
|
|
22
22
|
|
|
23
23
|
// Show minimal UI - compact status indicator
|
|
24
|
-
figma.showUI(__html__, { width: 240, height:
|
|
24
|
+
figma.showUI(__html__, { width: 240, height: 68, visible: true, themeColors: true });
|
|
25
25
|
|
|
26
26
|
// ============================================================================
|
|
27
27
|
// CONSOLE CAPTURE — Intercept console.* in the QuickJS sandbox and forward
|
|
@@ -158,23 +158,6 @@ var __stickyColors = {
|
|
|
158
158
|
}
|
|
159
159
|
})();
|
|
160
160
|
|
|
161
|
-
// Restore persisted cloud pairing config (stored via STORE_CLOUD_CONFIG) and
|
|
162
|
-
// push it to the UI so cloud users don't lose their pairing on plugin reopen.
|
|
163
|
-
// Fire-and-forget: never blocks the FILE_INFO/VARIABLES_DATA pushes above.
|
|
164
|
-
(function() {
|
|
165
|
-
figma.clientStorage.getAsync('cloudConfig')
|
|
166
|
-
.then(function(stored) {
|
|
167
|
-
// Skip if nothing stored or the shape is unusable (e.g., cleared config)
|
|
168
|
-
if (!stored || !stored.code) return;
|
|
169
|
-
figma.ui.postMessage({ type: 'CLOUD_CONFIG_RESTORED', config: stored });
|
|
170
|
-
console.log('🌉 [Desktop Bridge] Restored cloud config from clientStorage');
|
|
171
|
-
})
|
|
172
|
-
.catch(function(error) {
|
|
173
|
-
// clientStorage can throw — non-critical, just log
|
|
174
|
-
console.warn('🌉 [Desktop Bridge] Could not restore cloud config:', error && error.message ? error.message : String(error));
|
|
175
|
-
});
|
|
176
|
-
})();
|
|
177
|
-
|
|
178
161
|
// Helper function to serialize a variable for response
|
|
179
162
|
function serializeVariable(v) {
|
|
180
163
|
return {
|
|
@@ -636,8 +619,10 @@ figma.ui.onmessage = async (msg) => {
|
|
|
636
619
|
// Convert value based on variable type
|
|
637
620
|
var value = msg.value;
|
|
638
621
|
|
|
639
|
-
//
|
|
640
|
-
|
|
622
|
+
// A string starting with "VariableID:" is an alias, unless the caller set
|
|
623
|
+
// literalStrings and the variable is a STRING (then it is plain text).
|
|
624
|
+
if (typeof value === 'string' && value.startsWith('VariableID:') &&
|
|
625
|
+
!(msg.literalStrings === true && variable.resolvedType === 'STRING')) {
|
|
641
626
|
// Convert to VARIABLE_ALIAS format
|
|
642
627
|
value = {
|
|
643
628
|
type: 'VARIABLE_ALIAS',
|
|
@@ -3804,7 +3789,7 @@ figma.ui.onmessage = async (msg) => {
|
|
|
3804
3789
|
|
|
3805
3790
|
// ============================================================================
|
|
3806
3791
|
// CAPTURE_SCREENSHOT - Capture node screenshot using plugin exportAsync
|
|
3807
|
-
// This captures the CURRENT plugin runtime state (not
|
|
3792
|
+
// This captures the CURRENT plugin runtime state (not remote state like the REST API)
|
|
3808
3793
|
// ============================================================================
|
|
3809
3794
|
else if (msg.type === 'CAPTURE_SCREENSHOT') {
|
|
3810
3795
|
try {
|
|
@@ -4006,18 +3991,35 @@ figma.ui.onmessage = async (msg) => {
|
|
|
4006
3991
|
}
|
|
4007
3992
|
|
|
4008
3993
|
// ============================================================================
|
|
4009
|
-
// RESIZE_UI - Dynamically resize the plugin window (e.g.,
|
|
3994
|
+
// RESIZE_UI - Dynamically resize the plugin window (e.g., toggling the plugin's expanded panel)
|
|
4010
3995
|
// ============================================================================
|
|
4011
3996
|
else if (msg.type === 'RESIZE_UI') {
|
|
4012
|
-
figma.ui.resize(msg.width ||
|
|
3997
|
+
figma.ui.resize(msg.width || 240, msg.height || 68);
|
|
4013
3998
|
}
|
|
4014
3999
|
|
|
4015
4000
|
// ============================================================================
|
|
4016
|
-
//
|
|
4001
|
+
// GET_UI_PREFS / SET_UI_PREFS - Whether the window is minimized, kept in
|
|
4002
|
+
// figma.clientStorage (per user, across files and restarts). 'uiMinimized'
|
|
4003
|
+
// is the plugin's only stored key. A read error answers "not minimized";
|
|
4004
|
+
// a write error is only logged. Neither message is a bridge command.
|
|
4017
4005
|
// ============================================================================
|
|
4018
|
-
else if (msg.type === '
|
|
4019
|
-
|
|
4020
|
-
|
|
4006
|
+
else if (msg.type === 'GET_UI_PREFS') {
|
|
4007
|
+
var storedMinimized = false;
|
|
4008
|
+
try {
|
|
4009
|
+
storedMinimized = (await figma.clientStorage.getAsync('uiMinimized')) === true;
|
|
4010
|
+
} catch (error) {
|
|
4011
|
+
storedMinimized = false;
|
|
4012
|
+
console.warn('🌉 [Desktop Bridge] Could not read the window setting:', error && error.message ? error.message : String(error));
|
|
4013
|
+
}
|
|
4014
|
+
figma.ui.postMessage({ type: 'UI_PREFS', minimized: storedMinimized });
|
|
4015
|
+
}
|
|
4016
|
+
|
|
4017
|
+
else if (msg.type === 'SET_UI_PREFS') {
|
|
4018
|
+
try {
|
|
4019
|
+
await figma.clientStorage.setAsync('uiMinimized', msg.minimized === true);
|
|
4020
|
+
} catch (error) {
|
|
4021
|
+
console.warn('🌉 [Desktop Bridge] Could not save the window setting:', error && error.message ? error.message : String(error));
|
|
4022
|
+
}
|
|
4021
4023
|
}
|
|
4022
4024
|
|
|
4023
4025
|
// ============================================================================
|
|
@@ -4034,7 +4036,7 @@ figma.ui.onmessage = async (msg) => {
|
|
|
4034
4036
|
});
|
|
4035
4037
|
// Short delay to let the response message be sent before reload
|
|
4036
4038
|
setTimeout(function() {
|
|
4037
|
-
figma.showUI(__html__, { width: 240, height:
|
|
4039
|
+
figma.showUI(__html__, { width: 240, height: 68, visible: true, themeColors: true });
|
|
4038
4040
|
}, 100);
|
|
4039
4041
|
} catch (error) {
|
|
4040
4042
|
var errorMsg = error && error.message ? error.message : String(error);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"id": "
|
|
2
|
+
"name": "Toko Relay",
|
|
3
|
+
"id": "toko-relay",
|
|
4
4
|
"api": "1.0.0",
|
|
5
5
|
"main": "code.js",
|
|
6
6
|
"ui": "ui.html",
|
|
@@ -32,11 +32,9 @@
|
|
|
32
32
|
"ws://localhost:9229",
|
|
33
33
|
"ws://localhost:9230",
|
|
34
34
|
"ws://localhost:9231",
|
|
35
|
-
"ws://localhost:9232"
|
|
36
|
-
"wss://figma-console-mcp.southleft.com",
|
|
37
|
-
"https://figma-console-mcp.southleft.com"
|
|
35
|
+
"ws://localhost:9232"
|
|
38
36
|
],
|
|
39
|
-
"reasoning": "Connects to local MCP server via WebSocket (port range 9223-9232 for multi-instance)
|
|
37
|
+
"reasoning": "Connects to the local MCP server via WebSocket (port range 9223-9232 for multi-instance).",
|
|
40
38
|
"devAllowedDomains": [
|
|
41
39
|
"http://localhost",
|
|
42
40
|
"http://localhost:9223",
|
|
@@ -59,9 +57,7 @@
|
|
|
59
57
|
"ws://localhost:9229",
|
|
60
58
|
"ws://localhost:9230",
|
|
61
59
|
"ws://localhost:9231",
|
|
62
|
-
"ws://localhost:9232"
|
|
63
|
-
"wss://figma-console-mcp.southleft.com",
|
|
64
|
-
"https://figma-console-mcp.southleft.com"
|
|
60
|
+
"ws://localhost:9232"
|
|
65
61
|
]
|
|
66
62
|
}
|
|
67
63
|
}
|