You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
`plugins/figma-to-wordpress` moves a Figma file into WordPress. Internally it generates a static HTML/CSS website artifact, then hands that artifact to a WordPress Playground runner that imports it with Static Site Importer and Blocks Engine.
3
+
`plugins/figma-to-wordpress` moves a Figma file into WordPress. It hands the design to a WordPress runner service that creates a Playground session and imports the result with Static Site Importer and Blocks Engine.
4
4
5
5
## Architecture
6
6
7
7
```text
8
8
Figma plugin UI
9
-
-> GeneratedWebsiteArtifact
10
-
-> PlaygroundRunnerPayload
11
-
-> runner URL or generated runner page
12
-
-> WordPress Playground blueprint
9
+
-> Figma document scene data
10
+
-> runner request
11
+
-> WordPress runner service
12
+
-> WordPress Playground session URL
13
13
-> Static Site Importer / Blocks Engine inside WordPress
14
14
```
15
15
16
-
The TypeScript boundary stops at payload construction and Playground blueprint creation. WordPress, PHP, Static Site Importer, and Blocks Engine remain WordPress-side runtime concerns.
16
+
The TypeScript boundary stops at request construction and opening the returned Playground URL. WordPress, PHP, Static Site Importer, Blocks Engine, and Playground session orchestration remain WordPress-side runtime concerns.
17
17
18
18
## Figma Iframe Limits
19
19
@@ -27,27 +27,25 @@ Practical constraints for this browser-based flow:
27
27
- Clipboard access can require user activation.
28
28
- Local file URLs can behave differently between desktop Figma, browser Figma, and development builds.
29
29
30
-
Because of those constraints, the primary integration shape is a browser fallback: the plugin builds the same runner payload and opens or copies a runner URL. If in-plugin embedding works later, it can consume the same `PlaygroundRunnerPayload` interface.
30
+
Because of those constraints, the primary integration shape is a service handoff: the plugin posts a runner request and opens the returned URL in a browser tab. If in-plugin embedding works later, it can consume the same runner response interface.
31
31
32
32
## Playground And PHP Role
33
33
34
34
WordPress Playground is the correct place to run WordPress and PHP plugin logic. It provides a browser-hosted WordPress runtime backed by WebAssembly PHP and a virtual filesystem.
35
35
36
-
Static Site Importer and Blocks Engine should run in that WordPress runtime because they are WordPress/PHP import systems. The Figma plugin should not reimplement them in TypeScript. The plugin's job is to hand off a generated static artifact with enough metadata for the Playground runner to install/activate/import with those plugins.
36
+
Static Site Importer and Blocks Engine should run in that WordPress runtime because they are WordPress/PHP import systems. The Figma plugin should not reimplement them in TypeScript. The plugin's job is to hand off design data with enough metadata for the WordPress runner to transform, install, activate, and import with those plugins.
37
37
38
38
## Current Boundary
39
39
40
40
Implemented now:
41
41
42
42
-`GeneratedWebsiteArtifact` for static generated files from Figma.
43
-
-`PlaygroundRunnerPayload` for the Playground handoff plan.
44
-
- Runner URL construction with an encoded payload fragment.
45
-
- A standalone runner HTML page that decodes and displays the payload.
46
-
- A Playground URL builder that installs Static Site Importer from GitHub, writes the artifact JSON into `/tmp/figma-to-wordpress-artifact.json`, and runs the `static-site-importer/import-website-artifact` ability.
43
+
-`figma-to-wordpress/runner-request/v1` for the runner handoff plan.
44
+
- A Figma UI client that posts the runner request and opens the returned Playground URL.
47
45
48
46
Not implemented yet:
49
47
50
-
-Embedded Playground execution inside the Figma iframe.
48
+
-The hosted WordPress runner endpoint that creates the Playground session.
51
49
- Post-import block validation and visual parity checks.
52
50
53
51
## Local Testing
@@ -60,21 +58,14 @@ npm run build --prefix plugins/figma-to-wordpress
60
58
npm test --prefix plugins/figma-to-wordpress
61
59
```
62
60
63
-
Manual runner test:
64
-
65
-
1. Build or otherwise serve `plugins/figma-to-wordpress/runner/playground-runner.html`.
66
-
2. Use `buildRunnerPayload()` and `buildRunnerUrl()` from `src/payload.ts` to create a URL with `#payload=...`.
67
-
3. Open the URL in a browser.
68
-
4. Confirm the payload is decoded and the Playground link opens a session that installs Static Site Importer and runs the artifact import.
69
-
70
61
Figma development test:
71
62
72
63
1. Run `npm run build --prefix plugins/figma-to-wordpress`.
73
64
2. Load `plugins/figma-to-wordpress/manifest.json` as a Figma development plugin.
74
65
3. Run the plugin.
75
66
4. Use `Open in WordPress Playground`.
76
-
5.If the runner does not open from inside Figma, paste the copied URL into a normal browser tab.
67
+
5.Confirm the runner service returns a Playground URL that opens in a normal browser tab.
77
68
78
69
## Next Integration Step
79
70
80
-
The next meaningful step is a hosted runner page with richer progress/error reporting around the Playground import and post-import block/visual validation. That should remain in the WordPress/Playground runner layer, not by porting PHP importer behavior into the Figma plugin.
71
+
The next meaningful step is a hosted WordPress runner endpoint with progress/error reporting around the Playground import and post-import block/visual validation. That should remain in the WordPress/Playground runner layer, not by porting PHP importer behavior into the Figma plugin.
This plugin moves a Figma file into WordPress by generating static HTML/CSS internally and importing that artifact with Static Site Importer and Blocks Engine in WordPress Playground.
3
+
This plugin moves a Figma file into WordPress by handing the design to a WordPress runner service that imports it with Static Site Importer and Blocks Engine in WordPress Playground.
4
4
5
-
It does not port Static Site Importer, Blocks Engine, WordPress, PHP, or Playground internals to TypeScript. The TypeScript code extracts Figma scene data, builds a static artifact, and creates a Playground blueprint that runs the WordPress/PHP import path.
5
+
It does not port Static Site Importer, Blocks Engine, WordPress, PHP, or Playground internals to TypeScript. The TypeScript code extracts Figma scene data, prepares the runner request, and opens the Playground session URL returned by the WordPress-side runner.
6
6
7
7
## Flow
8
8
9
9
```text
10
10
Figma plugin controller + UI
11
-
-> selected Figma scene
12
-
-> static HTML/CSS website artifact
13
-
-> runner payload
14
-
-> Playground blueprint URL
15
-
-> WordPress Playground boots WordPress/PHP in WASM
16
-
-> Static Site Importer installs and imports through Blocks Engine
11
+
-> whole Figma document scene data
12
+
-> runner request
13
+
-> WordPress runner service
14
+
-> WordPress Playground session
15
+
-> Static Site Importer imports through Blocks Engine
17
16
```
18
17
19
18
## Boundaries
20
19
21
20
- Implemented: a Figma Desktop-loadable plugin shell with whole-file export.
22
-
- Implemented: a reusable scene-to-HTML/CSS artifact generator with diagnostics and tests.
23
-
- Implemented: a Playground blueprint URL that installs Static Site Importer from GitHub and calls `static-site-importer/import-website-artifact` with the generated artifact.
24
-
- Implemented: a standalone runner page that decodes the payload and opens the same Playground import URL.
21
+
- Implemented: a reusable scene-to-HTML/CSS artifact generator with diagnostics and tests for the current local handoff.
22
+
- Implemented: a product-neutral runner request that can be posted to a WordPress-side Playground session service.
25
23
- Not implemented: running Static Site Importer from TypeScript.
26
-
- Not implemented: in-plugin embedded Playground validation; the reliable path opens Playground in a browser tab.
24
+
- Not implemented: the hosted WordPress runner endpoint that creates the Playground session and returns its URL.
27
25
- Not implemented: automated visual parity/block validation after import.
28
26
29
27
## Files
@@ -32,17 +30,16 @@ Figma plugin controller + UI
32
30
-`src/code.ts` is the Figma plugin main thread entry.
33
31
-`src/ui.ts` is the Figma UI-side handoff logic.
34
32
-`src/index.ts` contains the reusable Figma-scene-to-website-artifact generator.
35
-
-`src/payload.ts` contains the reusable TypeScript interfaces and Playground blueprint URL builders.
33
+
-`src/payload.ts` contains the reusable TypeScript interfaces for the runner handoff.
34
+
-`src/wordpress-runner.ts` posts the runner request and expects an `open_url` response.
36
35
-`src/ui.html` is the Figma UI shell bundled into `dist/ui.html`.
37
-
-`runner/playground-runner.html` is the browser fallback runner page.
38
36
39
37
## Local Test
40
38
41
39
1. Run `npm run build --prefix plugins/figma-to-wordpress`.
42
40
2. In Figma Desktop, use Plugins -> Development -> Import plugin from manifest, then select `plugins/figma-to-wordpress/manifest.json`.
43
41
3. Open the plugin and choose `Open in WordPress Playground`.
44
-
4. If Figma blocks embedding or navigation, copy the generated runner URL and open it in a normal browser tab.
45
-
5. Confirm WordPress Playground boots, installs Static Site Importer, runs the import, and opens wp-admin.
42
+
4. Confirm the WordPress runner service returns a Playground URL and the plugin opens it in a browser tab.
46
43
47
44
For quick syntax verification without a full Figma build pipeline:
48
45
@@ -52,8 +49,8 @@ npm run build --prefix plugins/figma-to-wordpress
52
49
npm test --prefix plugins/figma-to-wordpress
53
50
```
54
51
55
-
## Figma Iframe Fallback
52
+
## Runner Boundary
56
53
57
-
Figma plugin UIs run in a constrained iframe-like environment. Cross-origin iframes, WASM boot, popup behavior, and navigation can be restricted depending on host context and plugin permissions. The supported fallback is to build the same payload, encode it into a runner URL fragment, and ask the user to open the runner page in a browser tab.
54
+
Figma plugin UIs run in a constrained iframe-like environment. Cross-origin iframes, WASM boot, popup behavior, and navigation can be restricted depending on host context and plugin permissions. The supported boundary is a WordPress-side runner service: the plugin posts a runner request, the service creates the Playground session, and the plugin opens the returned URL.
58
55
59
56
See [`../../docs/figma-playground-runner.md`](../../docs/figma-playground-runner.md) for the integration notes.
0 commit comments