Repository navigation
Refactor Plugin - #184
Refactor Plugin#184
Conversation
4e20a43 to
599a994
Compare
There was a problem hiding this comment.
PR Overview
This PR refactors the plugin to improve design, incorporate the Figma REST API, and add extensive debug logging while updating various conversion and rendering flows. Key changes include:
- Exporting additional helper functions and adjusting existing utility functions.
- Updating UI rendering and code generation logic in the plugin.
- Modifying conversion logic for Figma nodes, including changes in flattening and cloning behavior.
Reviewed Changes
| File | Description |
|---|---|
| packages/backend/src/common/lowercaseFirstLetter.ts | Now exports the helper function explicitly. |
| apps/plugin/ui-src/main.tsx | Updates ReactDOM usage with createRoot. |
| packages/backend/src/altNodes/altNodeUtils.ts | Refines children type-checking and error handling in SVG export. |
| packages/backend/src/common/color.ts | Adds new functions for converting colors and gradients. |
| packages/backend/src/common/nodeWidthHeight.ts | Revises logic to check explicit layout sizing properties. |
| packages/backend/src/common/nodeVisibility.ts | Updates filtering logic for visible nodes. |
| packages/backend/src/code.ts | Adds extensive debug logging and refactors settings management. |
| packages/backend/src/tailwind.config.js | Removes unused theme extensions and plugins. |
| packages/backend/src/common/exportAsyncProxy.ts | Adjusts export logic using figma.getNodeByIdAsync. |
| packages/backend/src/altNodes/altConversion.ts | Simplifies node conversion and adjusts cloning behavior. |
| packages/backend/src/common/retrieveUI/convertToCode.ts | Refines conversion to code for HTML mode. |
| packages/backend/src/common/commonFormatAttributes.ts | Modifies attribute formatting to use lowercase first letters. |
| packages/backend/src/common/commonPosition.ts | Adds a defensive check on layoutPositioning. |
| packages/backend/src/common/images.ts | Adjusts image export logic by using the node directly. |
Copilot reviewed 69 out of 69 changed files in this pull request and generated 2 comments.
| if (!result) { | ||
| // If any child is not of the specified types, return false | ||
| return false; | ||
| } | ||
| } | ||
| // all children are true | ||
| return true; | ||
| // All children are valid types | ||
| return node.children.length > 0; // Only return true if there are children |
There was a problem hiding this comment.
The revised logic in isTypeOrGroupOfTypes now returns false if any child node does not match. Please confirm that this behavior is intended, as it changes the previous iteration over all children.
|
The idea of a pull request and separate branch is to protect the main branch from unvalidated new code. But since the released version is the refactored version, and all new work is happening on this branch, there is no point in keeping it separate anymore. So it should be merged into main. |
|
Yeah, I agree. I was waiting for 2 consecutive days without big changes. |
I improved the design and started using Figma REST API so plugin is as faster as ever. The REST API might cause some bugs, so need to check if everything is as best as possible.