Capture · Roots: roots drop w_full; hosts give the width

145 component roots drop w_full, the early returns included. Three
field rows keep it, Input, InputGroup and TagInput: stretched without
a width, taffy 0.9 laid the field's flex_1 share at no width in the
template picker at 280px, and the placeholder drew nothing. Container
keeps it, since mx_auto needs a width to fill.

Hosts that relied on a root's width now give it: MessageList boxes
each row at the list's width, the splash gives its bar the column's,
and test stages that mount a component as the window's root sit in a
size_full box. Tests hold a narrow row across the list and the splash
bar across its column; each goes red without its fix.

The gallery gains --narrow <px>, which lays each page in a padded
card at that width and shoots it without its script. The page
header wraps: the title takes the room and the theme switcher drops
below, where a long summary used to push it past the edge. A file
panel step waits for the panel to become key instead of a fixed
pause, which lost a race in a capture.
This commit is contained in:
ZacharyZhang-NY committed 2026-09-28 13:07:22 -04:00
1 parent 3be809a660
commit 81e73b79c1
126 files changed
+275 -276

No files matched your search

+21 -6
View File
@@ -53,6 +53,8 @@ pub enum Step {
}
const FRAME: Duration = Duration::from_millis(120);
/// How long an out-of-process file panel may take to open.
const PANEL: Duration = Duration::from_secs(10);
const DRAG_STEPS: u32 = 10;
#[derive(Clone, Copy)]
@@ -218,7 +220,15 @@ pub async fn play(
let number = window.update(cx, |_, window, _| number(window))??;
post_key(number, true, text, code)?;
}
Step::CancelPanel => cancel_panel()?,
Step::CancelPanel => {
let mut waited = Duration::ZERO;
while !cancel_panel()? {
anyhow::ensure!(waited < PANEL, "no file panel became key in {PANEL:?}");
cx.background_executor().timer(FRAME).await;
waited += FRAME;
}
log::info!("script: file panel cancelled after {waited:?}");
}
Step::ExpectClosed(key) => {
let handle = opened(key, cx)?;
let open = cx.update(|cx| cx.windows().contains(&handle))?;
@@ -363,7 +373,8 @@ fn post_key(_: u32, _: bool, _: &str, _: u16) -> Result<()> {
}
#[cfg(target_os = "macos")]
fn cancel_panel() -> Result<()> {
/// Cancels a key file panel; false while none is key.
fn cancel_panel() -> Result<bool> {
use cocoa::{
appkit::NSApp,
base::{BOOL, NO, id, nil},
@@ -371,16 +382,20 @@ fn cancel_panel() -> Result<()> {
use objc::{class, msg_send, sel, sel_impl};
unsafe {
let key: id = msg_send![NSApp(), keyWindow];
anyhow::ensure!(key != nil, "no key window to cancel");
if key == nil {
return Ok(false);
}
let panel: BOOL = msg_send![key, isKindOfClass: class!(NSSavePanel)];
anyhow::ensure!(panel != NO, "the key window is not a file panel");
if panel == NO {
return Ok(false);
}
let _: () = msg_send![key, cancel: nil];
}
Ok(())
Ok(true)
}
#[cfg(not(target_os = "macos"))]
fn cancel_panel() -> Result<()> {
fn cancel_panel() -> Result<bool> {
anyhow::bail!("file panels need macOS")
}