💡 Parent-relative min/max (percent) constraints for sizing
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Needs clarification
- Activity status
- Quiet
- Tech stack
- c, typescript
- Domain
- cli
Research direction
Start with the failing test in test/percent-sizing.test.ts and its nm/repro/percent-sizing diff, then read Clay_SizingMinMax in clay/clay.h:316-328. Trace how sizing bounds reach the layout engine and determine the API and wire changes needed. Done means parent-relative floors and caps preserve absolute-cell behavior and the test passes.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem?
There's no way to size an element relative to its parent as a constraint rather than a fixed size. We can say "exactly 50% of the parent" with percent(0.5), but not "at least 50%" or "at most 50%" while still letting content drive the actual size. A sidebar that should be ≥50% tall but grow with its content, or a panel capped at half the viewport, can't be expressed: percent(0.5) pins to exactly 6 rows in a 12-row parent regardless of content, and fit()/grow() only take absolute cell counts in their min/max slots. (Passing a percent into a min/max slot today corrupts layout—it's coerced into a garbage float.)
Describe the solution you'd like
A way to express parent-relative floors and caps, not just fixed sizes, so an element can be bounded by a fraction of its parent while content still determines the size within those bounds. The exact API is open; a few directions worth weighing:
- Percent in the existing min/max slots —
fit(percent(0.5))/fit(0, percent(0.5)). Smallest surface, but overloads the min/max args. - Dedicated clamp helpers —
clamp(min, max)orminmax(min, max)accepting cells orpercent(...), composing withfit()/grow(). More explicit about intent. min()/max()constraint helpers — CSS-like, e.g.max(fit(), percent(0.5)). Most general, largest surface.
Whatever the shape: numeric bounds must keep exact absolute-cell semantics (additive only), and a percent bound should clamp content-aware—a floor still lets content grow past it, a cap still lets content shrink below it.
Describe alternatives you've considered
Measure the parent first (info.get(parent).bounds), compute the cell count, and feed an absolute number back on a second pass—but that needs two renders, goes stale on resize, and can't express floor-plus-content-grows in one pass. The whole-axis percent() is the existing primitive that falls short here.
Additional context
Failing test case on nm/repro/percent-sizing (test · diff). Whichever shape wins, the clamp lives deepest in the layout engine: Clay_SizingMinMax (clay/clay.h:316-328) is absolute float cells with no parent-relative bound, so it needs a percent-aware min/max on the wire and in the engine.
- Dominant language
- TypeScript
- Stars
- 42
- Forks
- 2
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 12
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bombshell-dev/tty
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
bombshell-dev/tty#61 · 1 reaction ·
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
bombshell-dev/tty#129 ·
-
question
Difficulty 5/5 Over a week Newbie friendliness 38/100
bombshell-dev/tty#112 ·
-
enhancement high priority
Difficulty 3/5 1-2 days Newbie friendliness 68/100
bombshell-dev/tty#83 · 2 comments ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 48/100
bombshell-dev/tty#82 ·
All issues in bombshell-dev/tty
Similar issues
-
clawsweeper:linked-pr-open clawsweeper:no-new-fix-pr clawsweeper:source-repro impact:message-loss issue-rating: 🦞 diamond lobster maturity:stable P2
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#616 ·
-
ZCode 3.14.3 に対応する Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
supermomonga/zcode-acp#24 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
growthbook/growthbook#7100 ·
-
triage
Difficulty 1/5 1-3 hours Newbie friendliness 88/100