💡 Parent-relative min/max (percent) constraints for sizing
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- 説明が足りない
- 活発さ
- 静か
- 技術スタック
- c, typescript
- 領域
- cli
調査の方向性
test/percent-sizing.test.ts の失敗しているテストと、その nm/repro/percent-sizing diff から始め、次に clay/clay.h:316-328 の Clay_SizingMinMax を読みます。サイズの境界がどのようにレイアウトエンジンへ到達するかを追跡し、必要な API と wire の変更を特定します。親相対の下限と上限が絶対セルの動作を維持し、テストが通れば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- TypeScript
- スター
- 42
- フォーク
- 2
- 平均マージ
- 2日 5時間
- マージ済み PR(30日)
- 12
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
bombshell-dev/tty のほかの issue
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
bombshell-dev/tty#61 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
bombshell-dev/tty#129 ·
メンテナーはふだん 1 日以内に返信
-
question
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
bombshell-dev/tty#112 ·
メンテナーはふだん 1 日以内に返信
-
enhancement high priority
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
bombshell-dev/tty#83 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
bombshell-dev/tty#82 ·
メンテナーはふだん 1 日以内に返信
bombshell-dev/tty の issue をすべて見る
似ている issue
-
docs
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
remix-run/react-router#15558 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
solana-foundation/pay-kit#341 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
supabase/agent-skills#607 ·
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信