-
Notifications
You must be signed in to change notification settings - Fork 24
[Figma Plugin] Initial Figma Plugin #926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
t-regbs
wants to merge
7
commits into
main
Choose a base branch
from
feature/figma-plugin
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
231cca1
feat(figma-plugin): add initial plugin workflow and themed UI
t-regbs b0a9739
refactor(converter): stabilize figma converter result contracts
t-regbs 2600b4c
refactor(figma-plugin): streamline run lifecycle and remove cancel flow
t-regbs 064dec7
refactor(figma-plugin): organize src boundaries and finalize cleanup
t-regbs a46f770
fix(figma-plugin): harden request lifecycle, converter parsing, and a…
t-regbs 0dd7338
fix(figma-plugin): adress issue where disellection does not cancel in…
t-regbs 48c8342
chore: cleanup settings retrieval
t-regbs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -41,3 +41,5 @@ bin/ | |
| .kotlin | ||
| local.properties | ||
| kotlin-js-store/ | ||
| tools/figma-plugin/node_modules/ | ||
| tools/figma-plugin/dist/ | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| # Valkyrie Figma Plugin | ||
|
|
||
| This package contains a Figma plugin shell for exporting selected icons into Kotlin `ImageVector` source. | ||
|
|
||
| ## Status | ||
|
|
||
| - UI + selection export flow implemented. | ||
| - Auto export is enabled by default and can be toggled off. | ||
| - Output format supports both backing property and lazy property generation. | ||
| - Plugin UI follows Figma light/dark theme tokens. | ||
| - Converter runtime is injected into `dist/ui.html` during build. | ||
| - Copy and download actions are both supported. | ||
|
|
||
| ## Scripts | ||
|
|
||
| - `pnpm build:converter` - compile Kotlin/Wasm converter executable assets | ||
| - `pnpm build` - build plugin assets into `dist/` | ||
| - `pnpm build:all` - build converter + plugin assets | ||
| - `pnpm watch` - watch mode for development | ||
| - `pnpm typecheck` - TypeScript checks | ||
|
|
||
| ## Rerun in Figma | ||
|
|
||
| 1. Run `pnpm build:all` | ||
| 2. In Figma desktop, open `Plugins -> Development -> Reload plugins` | ||
| 3. Reopen `Valkyrie ImageVector Export` | ||
|
|
||
| ## Files | ||
|
|
||
| - `manifest.json` - Figma plugin manifest | ||
| - `src/main/code.ts` - plugin main thread (selection and SVG export) | ||
| - `src/ui/ui.ts` - plugin UI entry and orchestration | ||
| - `src/ui/core/` - UI runtime primitives (dom, status, state, api, utils) | ||
| - `src/ui/controllers/` - UI request/selection lifecycle controllers | ||
| - `src/ui/features/` - conversion, rendering, settings, and bulk actions | ||
| - `src/ui/features/converterAdapter.ts` - runtime bridge to Wasm converter | ||
| - `src/shared/messages.ts` - typed message contracts between main and UI | ||
|
|
||
| ## Runtime hookup | ||
|
|
||
| `pnpm build` reads these converter outputs: | ||
|
|
||
| - `valkyrie-sdk-figma-converter.mjs` | ||
| - `valkyrie-sdk-figma-converter.uninstantiated.mjs` | ||
| - `valkyrie-sdk-figma-converter.wasm` | ||
|
coderabbitai[bot] marked this conversation as resolved.
Outdated
|
||
|
|
||
| Then build-time injection inlines a Wasm bridge and exposes: | ||
|
|
||
| - `window.ValkyrieFigmaWasmConverter.convertSvg(...)` | ||
| - `window.ValkyrieFigmaWasmConverter.normalizeIconName(...)` | ||
|
|
||
| This avoids external script loading issues in `figma.showUI(__html__)`. | ||
|
|
||
| If converter artifacts are missing, build prints warnings and the UI reports that the runtime is not loaded. | ||
|
|
||
| ## UX notes | ||
|
|
||
| - Conversion uses request ids so stale responses do not overwrite newer runs. | ||
| - Bulk actions are disabled until at least one successful conversion exists. | ||
| - For a single converted icon, the code panel expands and increases code font size for readability. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| { | ||
| "name": "Valkyrie ImageVector Export", | ||
| "id": "valkyrie-imagevector-export", | ||
| "api": "1.0.0", | ||
| "main": "dist/code.js", | ||
| "ui": "dist/ui.html", | ||
| "editorType": ["figma"] | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| { | ||
| "name": "@composegears/valkyrie-figma-plugin", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "build:converter": "../../gradlew -p ../../ :sdk:figma:converter:compileProductionExecutableKotlinWasmJs", | ||
| "build": "node ./scripts/build.mjs", | ||
| "build:all": "pnpm build:converter && pnpm build", | ||
| "watch": "node ./scripts/build.mjs --watch", | ||
| "typecheck": "tsc --noEmit" | ||
| }, | ||
| "devDependencies": { | ||
| "@figma/plugin-typings": "^1.122.0", | ||
| "esbuild": "^0.25.10", | ||
| "typescript": "^5.9.2" | ||
| }, | ||
| "dependencies": { | ||
| "fflate": "^0.8.2" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.