-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
continue: get the output for justification to work
- Loading branch information
1 parent
f69c61c
commit abe23fa
Showing
8 changed files
with
1,641 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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,50 @@ | ||
# Layout Processing Logic | ||
|
||
## Figma to CSS Flex Layout Mapping | ||
|
||
The layout processors convert Figma's Auto Layout properties to CSS Flexbox properties. Here's how the mapping works: | ||
|
||
### Display Property | ||
- When `layoutMode !== "NONE"` -> `display: flex` | ||
- When `layoutMode === "NONE"` -> no display property output | ||
|
||
### Flex Direction | ||
- `layoutMode === "HORIZONTAL"` -> `flex-direction: row` | ||
- `layoutMode === "VERTICAL"` -> `flex-direction: column` | ||
|
||
### Justify Content (Primary Axis Alignment) | ||
Controlled by `primaryAxisAlignItems`: | ||
- `"MIN"` -> `justify-content: flex-start` | ||
- `"CENTER"` -> `justify-content: center` | ||
- `"MAX"` -> `justify-content: flex-end` | ||
- `"SPACE_BETWEEN"` -> `justify-content: space-between` | ||
|
||
### Align Items (Counter Axis Alignment) | ||
Controlled by `counterAxisAlignItems`: | ||
- `"MIN"` -> `align-items: flex-start` | ||
- `"CENTER"` -> `align-items: center` | ||
- `"MAX"` -> `align-items: flex-end` | ||
- `"BASELINE"` -> `align-items: baseline` | ||
|
||
## Complete Mapping Table | ||
|
||
| Figma layoutMode | Figma primaryAxisAlignItems | Figma counterAxisAlignItems | CSS display | CSS flex-direction | CSS justify-content | CSS align-items | | ||
|-----------------|---------------------------|---------------------------|------------|------------------|-------------------|----------------| | ||
| "HORIZONTAL" | "MIN" | "MIN" | flex | row | flex-start | flex-start | | ||
| "HORIZONTAL" | "CENTER" | "MIN" | flex | row | center | flex-start | | ||
| "HORIZONTAL" | "MAX" | "MIN" | flex | row | flex-end | flex-start | | ||
| "HORIZONTAL" | "SPACE_BETWEEN" | "MIN" | flex | row | space-between | flex-start | | ||
| "VERTICAL" | "MIN" | "MIN" | flex | column | flex-start | flex-start | | ||
| "VERTICAL" | "CENTER" | "MIN" | flex | column | center | flex-start | | ||
| "VERTICAL" | "MAX" | "MIN" | flex | column | flex-end | flex-start | | ||
| "VERTICAL" | "SPACE_BETWEEN" | "MIN" | flex | column | space-between | flex-start | | ||
[...additional combinations omitted for brevity] | ||
|
||
## Implementation Notes | ||
|
||
1. Layout properties are only processed for nodes with Auto Layout enabled (`layoutMode !== "NONE"`) | ||
2. The primary axis alignment maps to justify-content | ||
3. The counter axis alignment maps to align-items | ||
4. Gap is handled separately using the itemSpacing property | ||
|
||
See `layout.processor.ts` for the implementation. |
This file contains 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 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 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 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
Oops, something went wrong.