Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

💡 Parent-relative min/max (percent) constraints for sizing

Aperta
#78 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Tranquilla
Stack tecnologico
c, typescript
Ambito
cli

Direzione di ricerca

Inizia dal test fallito in test/percent-sizing.test.ts e dal relativo diff nm/repro/percent-sizing, quindi leggi Clay_SizingMinMax in clay/clay.h:316-328. Traccia il percorso con cui i limiti di dimensionamento raggiungono il motore di layout e determina le modifiche necessarie all'API e al wire. Il lavoro è completo quando i limiti inferiore e superiore relativi al parent mantengono il comportamento delle celle assolute e il test passa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement

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 slotsfit(percent(0.5)) / fit(0, percent(0.5)). Smallest surface, but overloads the min/max args.
  • Dedicated clamp helpersclamp(min, max) or minmax(min, max) accepting cells or percent(...), composing with fit()/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.

Lingua principale
TypeScript
Stelle
42
Fork
2
Merge medio
2g 5h
PR unite (30g)
12

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bombshell-dev/tty

Tutte le issue di bombshell-dev/tty

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.