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

💡 flex-shrink and flex-basis

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

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
c, typescript
Ambito
frontend, tooling

Direzione di ricerca

Inizia con il test che fallisce in test/flex-shrink.test.ts, poi leggi clay/clay.h intorno alle righe 2318 e 2358-2401 per comprendere la distribuzione delle dimensioni e dell’overflow. Traccia il percorso wire attraverso src/clayterm.c:365 e ops.ts:16 e 216. Il lavoro è completo quando lo shrink ponderato e il comportamento di basis funzionano end-to-end, il comportamento predefinito conserva no-shrink e la repro esegue il rendering di tutti e tre i glifi.

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

Descrizione

enhancement

Is your feature request related to a problem?

When children overflow their parent along the main axis, we can't absorb the overflow by shrinking sized children. The solver only redistributes free space across grow children and excludes fixed/percent from compression, so an overflowing row keeps every child at its declared size and pushes trailing children off-grid. A width-10 row with two fixed(6) children plus a trailing fit() lays A at width 6, B at 6, and C at x=12—off the 10-wide grid—so C never renders, giving "A B " instead of all three glyphs.

Describe the solution you'd like

A child should support a flex-basis as the solver's starting main size plus a shrink weight controlling how much overflow it absorbs. shrinkWeight (exact name TBD) should mirror the CSS flex-shrink property and default to 0, preserving today's no-shrink behavior; basis mirrors CSS flex-basis and seeds the main size before the solver runs. For the scene above, marking both width-6 children shrinkable by 1 distributes the 3-column overflow (6→5, 6→4), landing C at x=9 and rendering "A B C".

open("a", {
  layout: {
    width: {
      ...fixed(6),
      basis: 6,
      shrinkWeight: 1,
    },
    height: fixed(1),
  },
});

Describe alternatives you've considered

A JS-side workaround means measuring intrinsic sizes, computing the negative-free-space split, and re-emitting each child as a fixed() of the shrunk width before render. That duplicates the solver in the bindings, can't see wrapped-text or nested intrinsic sizes the way Clay does, and breaks the moment a parent resizes.

Additional context

Failing test case on nm/repro/flex-shrink (test · diff). Today A and B stay at width 6 and C lands at x=12. Likely spans the Clay solver and the wire format: clay/clay.h:2318 skips FIXED/PERCENT from resizableContainerBuffer, clay/clay.h:2358-2401 runs the sizeToDistribute < 0 loop with no per-child shrink weight, src/clayterm.c:365 decode_axis has no basis/shrink word, and ops.ts:16 packAxis plus the ops.ts:216 SizingAxis union would need a basis/shrink-aware shape.

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.