AI-native design editor. Open-source Figma alternative.
Add text overflow and wrap layout rules to prompt and describe
Anton A S3904b987d8c8
diff --git a/packages/core/src/tools/describe.ts b/packages/core/src/tools/describe.tsindex d18cd94d4..6847c46e2 100644--- a/packages/core/src/tools/describe.ts+++ b/packages/core/src/tools/describe.ts@@ -313,6 +313,22 @@ function detectLayoutIssues(node: SceneNode, graph: SceneGraph, issues: Describe}}+ // Text wider than its fixed-width parent+ if (isAutoLayout) {+ const parentAvailableW = isRow+ ? node.width - node.paddingLeft - node.paddingRight+ : node.width - node.paddingLeft - node.paddingRight+ for (const child of children) {+ if (child.type !== 'TEXT' || !child.visible) continue+ if (child.textAutoResize === 'WIDTH_AND_HEIGHT' && child.width > parentAvailableW + 1) {+ issues.push({+ message: `Text "${(child.characters ?? child.text ?? '').slice(0, 25)}..." is ${Math.round(child.width)}px wide but parent "${node.name}" has ${Math.round(parentAvailableW)}px available`,+ suggestion: `Add w={${Math.round(parentAvailableW)}} to the Text or use w="fill"`+ })+ }+ }+ }+// Child with fixed size larger than parent (direct overflow)if (isAutoLayout && !node.clipsContent) {const crossPad = isRowdiff --git a/src/ai/system-prompt.md b/src/ai/system-prompt.mdindex 3ba774fd8..2f697bf7b 100644--- a/src/ai/system-prompt.md+++ b/src/ai/system-prompt.md@@ -46,6 +46,10 @@ For dynamic content (variable text length, generated lists), always use flex sizAbsolute-positioned children (layout="none" parent) are unconstrained — they render at x/y regardless of parent bounds. Use overflow="hidden" to clip them.+**Text inside fixed-width containers:** Text without an explicit `w` auto-sizes and can exceed its parent width. When a container has a fixed width, always set `w` on multiword Text children to match the available space, or use `w="fill"`. Calculate: available = parent w − parent horizontal padding. Example: parent `w={156} p={0}` → text `w={156}`.++**Wrap layouts:** In `flex="row" wrap`, each child's fixed width determines the column count. Calculate: columns = floor((parent_available + gap) / (child_w + gap)). Make sure text content fits within child width — if the longest text value is 20 characters at size 14, it needs ~170px. Don't guess widths — count characters × ~0.6 × fontSize.+## Corner radiusInner radius = outer radius − padding. A card with `rounded={20} p={12}` → children should use `rounded={8}`. If padding ≥ outer radius, inner radius = 0 (straight corners).