Let the Join box have the width the row is not using
A Flexible button beside an Expanded entry are two flex children of one flex each, so the button was allotted half the row, drew its label at the right of it and left the other half of its half empty. The row then had slack, `:align :end` pushed everything into the right, and the box you type a channel into started halfway across the card. A button next to something that fills takes the width of its label and no share at all. It stays loosely flexible where nothing else in the row fills — that is the people panel's nick lozenges, which is what asked for Flexible in the first place. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
9d0b095 parent: 35f0e9b modified
flutter/src/frq/hiccup.cljd +27 -5 | @@ -424,16 +424,38 @@ | ||
| 424 | 424 | |
| 425 | 425 | ;; ------------------------------------------------------------------ text |
| 426 | 426 | |
| 427 | +(defn- any-fills-row? | |
| 428 | + "Whether anything in a row's children asks for what the row has left. | |
| 429 | + | |
| 430 | + Through nested seqs, because a `for` over rows arrives as one child." | |
| 431 | + [nodes] | |
| 432 | + (boolean (some (fn [n0] | |
| 433 | + (let [n (expand n0)] | |
| 434 | + (if (seq? n) (any-fills-row? n) (fills-row? n)))) | |
| 435 | + nodes))) | |
| 436 | + | |
| 427 | 437 | (defn- flexed |
| 428 | 438 | "Children of a Flex, with the ones that fill wrapped in Expanded. |
| 429 | 439 | |
| 430 | - `fills?` says which, so a Row asks about width and a Column about height." | |
| 431 | - [fills? nodes] | |
| 440 | + `fills?` says which, so a Row asks about width and a Column about height. | |
| 441 | + | |
| 442 | + `sibling-fills?` is whether anything in the row already asks for what is | |
| 443 | + left, and it is the Join row that needs the question asked: an Expanded entry | |
| 444 | + beside a Flexible button are two flex children of one flex each, so the | |
| 445 | + button is allotted half the row, draws its label in a corner of it, and | |
| 446 | + leaves the rest of its half empty — the row then has slack, `:align :end` | |
| 447 | + pushes what is in it to the right, and the box the reader types into starts | |
| 448 | + halfway across the card. A button beside something that fills takes the width | |
| 449 | + of its label and no share at all; the thing that fills is what gives." | |
| 450 | + ([fills? nodes] | |
| 451 | + (flexed fills? nodes | |
| 452 | + (and (identical? fills? fills-row?) (any-fills-row? nodes)))) | |
| 453 | + ([fills? nodes sibling-fills?] | |
| 432 | 454 | (persistent! |
| 433 | 455 | (reduce (fn [acc n0] |
| 434 | 456 | (let [n (expand n0)] |
| 435 | 457 | (cond (nil? n) acc |
| 436 | - (seq? n) (reduce conj! acc (flexed fills? n)) | |
| 458 | + (seq? n) (reduce conj! acc (flexed fills? n sibling-fills?)) | |
| 437 | 459 | (fills? n) (conj! acc (m/Expanded .child (render n))) |
| 438 | 460 | ;; A pane that fills the column takes the row's width too: |
| 439 | 461 | ;; the message list sits in a row beside the people panel, |
| @@ -458,11 +480,11 @@ | ||
| 458 | 480 | ;; stripes. Loose rather than Expanded — a button asks for |
| 459 | 481 | ;; the width of its label and gets it whenever the row has |
| 460 | 482 | ;; it, and only gives way when the row has not. |
| 461 | - (and (identical? fills? fills-row?) | |
| 483 | + (and (identical? fills? fills-row?) (not sibling-fills?) | |
| 462 | 484 | (vector? n) (= :button (first n))) |
| 463 | 485 | (conj! acc (m/Flexible .child (render n))) |
| 464 | 486 | :else (conj! acc (render n))))) |
| 465 | - (transient []) nodes))) | |
| 487 | + (transient []) nodes)))) | |
| 466 | 488 | |
| 467 | 489 | (defn- txt |
| 468 | 490 | [ctx s size color & {:keys [weight]}] |
| @@ -424,16 +424,38 @@ | |||
| 424 | 424 | ||
| 425 | ;; ------------------------------------------------------------------ text | 425 | ;; ------------------------------------------------------------------ text |
| 426 | 426 | ||
| 427 | +(defn- any-fills-row? | ||
| 428 | + "Whether anything in a row's children asks for what the row has left. | ||
| 429 | + | ||
| 430 | + Through nested seqs, because a `for` over rows arrives as one child." | ||
| 431 | + [nodes] | ||
| 432 | + (boolean (some (fn [n0] | ||
| 433 | + (let [n (expand n0)] | ||
| 434 | + (if (seq? n) (any-fills-row? n) (fills-row? n)))) | ||
| 435 | + nodes))) | ||
| 436 | + | ||
| 427 | (defn- flexed | 437 | (defn- flexed |
| 428 | "Children of a Flex, with the ones that fill wrapped in Expanded. | 438 | "Children of a Flex, with the ones that fill wrapped in Expanded. |
| 429 | 439 | ||
| 430 | - `fills?` says which, so a Row asks about width and a Column about height." | 440 | + `fills?` says which, so a Row asks about width and a Column about height. |
| 431 | - [fills? nodes] | 441 | + |
| 442 | + `sibling-fills?` is whether anything in the row already asks for what is | ||
| 443 | + left, and it is the Join row that needs the question asked: an Expanded entry | ||
| 444 | + beside a Flexible button are two flex children of one flex each, so the | ||
| 445 | + button is allotted half the row, draws its label in a corner of it, and | ||
| 446 | + leaves the rest of its half empty — the row then has slack, `:align :end` | ||
| 447 | + pushes what is in it to the right, and the box the reader types into starts | ||
| 448 | + halfway across the card. A button beside something that fills takes the width | ||
| 449 | + of its label and no share at all; the thing that fills is what gives." | ||
| 450 | + ([fills? nodes] | ||
| 451 | + (flexed fills? nodes | ||
| 452 | + (and (identical? fills? fills-row?) (any-fills-row? nodes)))) | ||
| 453 | + ([fills? nodes sibling-fills?] | ||
| 432 | (persistent! | 454 | (persistent! |
| 433 | (reduce (fn [acc n0] | 455 | (reduce (fn [acc n0] |
| 434 | (let [n (expand n0)] | 456 | (let [n (expand n0)] |
| 435 | (cond (nil? n) acc | 457 | (cond (nil? n) acc |
| 436 | - (seq? n) (reduce conj! acc (flexed fills? n)) | 458 | + (seq? n) (reduce conj! acc (flexed fills? n sibling-fills?)) |
| 437 | (fills? n) (conj! acc (m/Expanded .child (render n))) | 459 | (fills? n) (conj! acc (m/Expanded .child (render n))) |
| 438 | ;; A pane that fills the column takes the row's width too: | 460 | ;; A pane that fills the column takes the row's width too: |
| 439 | ;; the message list sits in a row beside the people panel, | 461 | ;; the message list sits in a row beside the people panel, |
| @@ -458,11 +480,11 @@ | |||
| 458 | ;; stripes. Loose rather than Expanded — a button asks for | 480 | ;; stripes. Loose rather than Expanded — a button asks for |
| 459 | ;; the width of its label and gets it whenever the row has | 481 | ;; the width of its label and gets it whenever the row has |
| 460 | ;; it, and only gives way when the row has not. | 482 | ;; it, and only gives way when the row has not. |
| 461 | - (and (identical? fills? fills-row?) | 483 | + (and (identical? fills? fills-row?) (not sibling-fills?) |
| 462 | (vector? n) (= :button (first n))) | 484 | (vector? n) (= :button (first n))) |
| 463 | (conj! acc (m/Flexible .child (render n))) | 485 | (conj! acc (m/Flexible .child (render n))) |
| 464 | :else (conj! acc (render n))))) | 486 | :else (conj! acc (render n))))) |
| 465 | - (transient []) nodes))) | 487 | + (transient []) nodes)))) |
| 466 | 488 | ||
| 467 | (defn- txt | 489 | (defn- txt |
| 468 | [ctx s size color & {:keys [weight]}] | 490 | [ctx s size color & {:keys [weight]}] |