Skip to content

AI-native design editor. Open-source Figma alternative.

Fix fill text MeasureFunc constraint, strengthen nested flex prompt

Anton A Sba4333d79831
diff --git a/packages/core/src/layout.ts b/packages/core/src/layout.ts
index 4f32cff03..b3dc9ae36 100644
--- a/packages/core/src/layout.ts
+++ b/packages/core/src/layout.ts
@@ -427,8 +427,9 @@ function configureTextLeaf(
yogaChild.setWidth(fixedWidth)
}
yogaChild.setMeasureFunc((width, widthMode, _height, _heightMode) => {
- const constraintW =
- widthMode === MeasureMode.Undefined ? fixedWidth : Math.min(width, fixedWidth || width)
+ const constraintW = fillsWidth
+ ? (widthMode === MeasureMode.Undefined ? fixedWidth : width)
+ : (widthMode === MeasureMode.Undefined ? fixedWidth : Math.min(width, fixedWidth || width))
const cacheKey = Math.round(constraintW)
const cached = cache.get(cacheKey)
if (cached) return cached
diff --git a/src/ai/system-prompt.md b/src/ai/system-prompt.md
index 146344082..9c5a2f76f 100644
--- a/src/ai/system-prompt.md
+++ b/src/ai/system-prompt.md
@@ -34,7 +34,7 @@ justify/items require flex — always declare flex="row" or flex="col" before us
A hug parent shrinks to fit its children. A fill child stretches to its parent. These can't be circular — if the parent hugs, at least one child must have a concrete size.
-Nested flex containers inside a column parent need w="fill" to stretch, otherwise they collapse to zero width.
+Nested flex containers inside a column parent need w="fill" to stretch, otherwise they collapse to zero width. ⚠ This applies to ALL intermediate containers, not just the first level. If you have `flex="col" > flex="col" > flex="row"`, EVERY level needs w="fill". A `grow={1}` child inside a HUG parent gets zero width — the parent must have a concrete size (fixed w or w="fill").
There is no margin property. Padding on a container pushes all children equally from the edges. To offset a single child, wrap it in a Frame with its own padding.