diff --git a/Cargo.lock b/Cargo.lock index a7d6adb2c..00b0fbfa8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6678,6 +6678,7 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" name = "story-render" version = "0.1.0" dependencies = [ + "craft-behavior", "craft-ui", "craft-ui-gallery", "egui", diff --git a/crates/story-render/Cargo.toml b/crates/story-render/Cargo.toml index ec7f82c13..776df6da2 100644 --- a/crates/story-render/Cargo.toml +++ b/crates/story-render/Cargo.toml @@ -42,6 +42,7 @@ update = ["craft-ui-gallery/update"] [dependencies] # The same framework features as the gallery, so the framework builds once for the gallery, the tests and this bin. +craft-behavior = { workspace = true } craft-ui = { workspace = true, features = ["app", "testing", "snapshot"] } craft-ui-gallery = { path = "../ui-gallery", default-features = false } egui = { workspace = true } diff --git a/crates/story-render/src/main.rs b/crates/story-render/src/main.rs index 12bb002ad..98a2f8955 100644 --- a/crates/story-render/src/main.rs +++ b/crates/story-render/src/main.rs @@ -3,7 +3,7 @@ //! `cargo run -p story-render --features -- --only --out ` writes, into ``: //! `new---.png` for every story of the component, `new-.png` for the story its Overview card //! shows (its first), `stories.tsv` and `components.tsv`. Each story runs in a card's story body (`StoryBody`) in a -//! fresh context, in ArtCraft Dark at 2 pixels per point with the interface fonts, and its image is cropped to the +//! fresh context, in ArtCraft Dark at 2 pixels per point (`--scale`) with the interface fonts, and its image is cropped to the //! story's surface and the layers it opened. A story runs in an embedded shell, over which its dialogs open, and a story //! whose dialog the card holds behind its button is shown with the dialog open. //! @@ -11,20 +11,29 @@ //! components; `--features apps` for every crate, as the gallery links them), so a change in one crate rebuilds that //! crate and this bin, not the gallery. //! +//! `--card` renders whole Overview cards instead, as the gallery builds them (`overview_card`): one card per story +//! group, selected, `--width` wide, its dialogs open, cropped to the card and the layers it opened (to the opened +//! dialogs alone when it has any). The files are `new---.png` and `new-.png` for the first group +//! (the Overview's default card); the tables list the group's name as the story and title. +//! //! Options: `--only Name,Name` renders those components only (all registered components without it); `--story name` -//! renders the story of that name only; `--threads N` (default: the cores, at most 8); `--width W` and `--room H` -//! set the card's story width and the height a filling story gets, in points. +//! renders the story (with `--card`, the group) of that name only; `--threads N` (default: the cores, at most 8); +//! `--width W` and `--room H` set the card's story width (with `--card`, the card's width) and the height a filling +//! story gets, in points; `--scale S` the images' pixels per point (1 matches the old gallery's shots, so a canvas +//! document shows at the same size on both sides). `stories.tsv` lists the scale of every image. -use craft_ui::contract::{Pad, Surface}; +use craft_behavior::ColumnWidth; +use craft_ui::contract::{Pad, Scroll, ShowContainer as _, Surface}; use craft_ui::fonts::{I18nScripts, UiFonts}; +use craft_ui::layout_components::{Grid, Stack}; use craft_ui::runtime::env::{RootEnv, WindowKey}; use craft_ui::shell::AppShell; use craft_ui::testing::snapshot::{Renderer, RgbaImage, layer_rects}; use craft_ui::testing::{Frames, StoryRegistration}; use craft_ui_gallery::WINDOW; -use craft_ui_gallery::chrome::{BodyShown, StoryBody}; -use craft_ui_gallery::viewer::{CardState, Catalog, GallerySettings, entry_of}; -use egui::{Pos2, Rect, Vec2}; +use craft_ui_gallery::chrome::{Spec, StoryBody, overview_card}; +use craft_ui_gallery::viewer::{CardState, Catalog, Cells, GallerySettings, entry_of}; +use egui::{Pos2, Rect, Ui, Vec2}; use std::cell::RefCell; use std::fmt::Write as _; use std::io::Write as _; @@ -33,12 +42,15 @@ use std::process::ExitCode; use std::sync::Mutex; use std::sync::atomic::{AtomicUsize, Ordering}; -/// The pixels per point of the images. +/// The pixels per point of the images unless `--scale` gives another. const PIXELS_PER_POINT: f32 = 2.0; /// The width of an Overview card's story body at the gallery's default window (the room a story on another surface than /// the card's panel gets), measured in the running gallery: the Overview's grid takes it from the dock's centre panel at -/// run time, and no function gives it for a window size. +/// run time, and no function gives it for a window size. The old gallery's cards were this wide outside, so `--card` +/// uses it as the card's width, and both sides of the comparison match. const WIDTH: f32 = 342.0; +/// The Overview's one column of cards. +const ONE: &[ColumnWidth] = &[ColumnWidth::fill(1.0)]; /// The height a filling story gets in that Overview: the visible height of its card view, measured the same way. const ROOM: f32 = 692.0; @@ -49,12 +61,17 @@ struct Options { threads: usize, width: f32, room: f32, + /// The pixels per point of the images. + scale: f32, + /// Whole Overview cards, one per story group, instead of story bodies. + card: bool, } fn options() -> Result { let mut args = std::env::args().skip(1); let threads = std::thread::available_parallelism().map_or(1, |n| n.get()).min(8); - let mut options = Options { out: PathBuf::new(), only: None, story: None, threads, width: WIDTH, room: ROOM }; + let mut options = + Options { out: PathBuf::new(), only: None, story: None, threads, width: WIDTH, room: ROOM, scale: PIXELS_PER_POINT, card: false }; while let Some(arg) = args.next() { let mut value = || args.next().ok_or_else(|| format!("{arg} needs a value")); match arg.as_str() { @@ -64,6 +81,8 @@ fn options() -> Result { "--threads" => options.threads = value()?.parse().map_err(|_| "--threads takes a number".to_owned())?, "--width" => options.width = value()?.parse().map_err(|_| "--width takes points".to_owned())?, "--room" => options.room = value()?.parse().map_err(|_| "--room takes points".to_owned())?, + "--scale" => options.scale = value()?.parse().map_err(|_| "--scale takes pixels per point".to_owned())?, + "--card" => options.card = true, _ => return Err(format!("unknown argument {arg}")), } } @@ -73,15 +92,27 @@ fn options() -> Result { Ok(options) } -/// One story to render. +/// What a job renders. +enum Shown { + /// One story in a card's story body. + Story(&'static StoryRegistration), + /// The Overview card of one story group. + Card(Spec), +} + +/// One story or card to render. struct Job { /// The component's display name. name: String, level: &'static str, crate_name: &'static str, - story: &'static StoryRegistration, + shown: Shown, surface: Surface, - /// The story the component's Overview card shows. + /// The story's name, or the card's group name. + story: String, + /// The story's caption, or the card's group name. + title: String, + /// The story or group the component's Overview card shows by default. first: bool, } @@ -99,6 +130,27 @@ fn jobs(options: &Options) -> Vec { continue; } let Some(entry) = entry_of(component.type_name) else { continue }; + if options.card { + for (at, group) in component.groups.iter().enumerate() { + if options.story.as_ref().is_some_and(|name| *name != group.name) { + continue; + } + let Some(mut spec) = overview_card(&catalog, component, at) else { continue }; + let Some(crate_name) = spec.stories.first().map(|story| story.story.crate_name) else { continue }; + spec.selected = true; + jobs.push(Job { + name: component.name.clone(), + level: entry.level.title(), + crate_name, + shown: Shown::Card(spec), + surface: entry.surface, + story: group.name.clone(), + title: group.name.clone(), + first: at == 0, + }); + } + continue; + } let stories = catalog.stories_of(component.type_name).iter().map(|&at| &catalog.entries[at]); for (at, story) in stories.enumerate() { if options.story.as_ref().is_some_and(|name| *name != story.registration.story.name) { @@ -108,8 +160,10 @@ fn jobs(options: &Options) -> Vec { name: component.name.clone(), level: entry.level.title(), crate_name: story.registration.crate_name, - story: story.registration, + shown: Shown::Story(story.registration), surface: entry.surface, + story: story.registration.story.name.to_owned(), + title: story.registration.story.caption(&component.name), first: at == 0, }); } @@ -126,44 +180,80 @@ fn root_env() -> RootEnv { env } -/// The story shown in a card's body at the screen's top left until it settles: the frames, then a second past every -/// fade, then the frames again. -fn settle(frames: &mut Frames, body: &StoryBody, width: f32, state: &mut CardState, shown: &mut BodyShown) { +/// `show` at the screen's top left, `width` wide, until it settles: the frames, then a second past every fade, then the +/// frames again. +fn settle(frames: &mut Frames, width: f32, show: &mut dyn FnMut(&mut Ui)) { let region = Rect::from_min_size(Pos2::ZERO, Vec2::new(width, Vec2::from(WINDOW).y)); - let mut frame = |frames: &mut Frames| { + for at in 0..8 { + if at == 4 { + frames.advance(1.0); + } frames.frame(Vec::new(), |ui| { - // The story's dialogs open over the shell around it, as over a gallery view. + // What shows runs in a shell, over which its dialogs open, as over a gallery view. craft_ui::testing::layout::in_region(ui, region, |ui| { - AppShell::embedded(WindowKey::new("story-render")).body(|ui, _, _: &mut ()| *shown = body.show(ui, state)).show(ui, &mut ()) + AppShell::embedded(WindowKey::new("story-render")).body(|ui, _, _: &mut ()| show(ui)).show(ui, &mut ()) }); }); - }; - for _ in 0..4 { - frame(frames); - } - frames.advance(1.0); - for _ in 0..4 { - frame(frames); } } -/// The story rendered: its image cropped to the story's surface and the layers it opened, in pixels. +/// The story in a card's body, with its dialog open when the card holds one behind its button: the rect it showed in. +fn story(frames: &mut Frames, story: &'static StoryRegistration, job: &Job, options: &Options) -> Option { + let body = StoryBody::new("sheet", story, job.surface, options.room, Pad::Regular); + let mut state = CardState::default(); + let mut flow = None; + settle(frames, options.width, &mut |ui| flow = body.show(ui, &mut state).flow); + if state.dialog.hidden { + state.show_dialog(); + settle(frames, options.width, &mut |ui| flow = body.show(ui, &mut state).flow); + } + flow +} + +/// The Overview card of `spec`, with every dialog its stories hold behind a button open: the card's rect, and whether +/// a dialog was opened. +fn card(frames: &mut Frames, spec: &Spec, options: &Options) -> (Option, bool) { + let stories = spec.card_stories(); + let card = spec.card(&stories, "sheet".to_owned(), options.room); + let mut cells = Cells::default(); + let mut rect = None; + // In a one-column grid row in a vertical scroll, as the Overview holds its cards: a filling card is as tall as its + // row's content. + let show = |ui: &mut Ui, cells: &mut Cells| { + Stack::new() + .fill() + .scroll(Scroll::vertical()) + .show(ui, |ui, _| Grid::new(ONE).fill_width().show(ui, |ui, _| card.show(ui, cells).rect).inner.flatten()) + .inner + .flatten() + }; + settle(frames, options.width, &mut |ui| rect = show(ui, &mut cells)); + let mut opened = false; + for state in cells.values_mut().filter(|state| state.dialog.hidden) { + state.show_dialog(); + opened = true; + } + if opened { + settle(frames, options.width, &mut |ui| rect = show(ui, &mut cells)); + } + (rect, opened) +} + +/// The story or card rendered: its image cropped to what it showed and the layers it opened, in pixels. fn render(job: &Job, renderer: &mut Renderer, env: &RootEnv, options: &Options) -> Result { let mut frames = Frames::new(); UiFonts::new(&I18nScripts).install(&frames.ctx); frames.root(env.clone()); frames.screen(Vec2::from(WINDOW)); - frames.pixels_per_point(PIXELS_PER_POINT); + frames.pixels_per_point(options.scale); frames.record_paint(); - let body = StoryBody::new("sheet", job.story, job.surface, options.room, Pad::Regular); - let mut state = CardState::default(); - let mut shown = BodyShown::default(); - settle(&mut frames, &body, options.width, &mut state, &mut shown); - if state.dialog.hidden { - state.show_dialog(); - settle(&mut frames, &body, options.width, &mut state, &mut shown); - } - let crop = layer_rects(&frames.ctx).into_iter().chain(shown.flow).fold(Rect::NOTHING, Rect::union); + let (shown, dialog) = match &job.shown { + Shown::Story(registration) => (story(&mut frames, registration, job, options), false), + Shown::Card(spec) => card(&mut frames, spec, options), + }; + let layers = layer_rects(&frames.ctx).into_iter().fold(Rect::NOTHING, Rect::union); + // An opened card dialog is cropped alone, as the old gallery's dialog shots are. + let crop = if dialog && layers.is_positive() { layers } else { shown.map_or(layers, |shown| layers.union(shown)) }; let paint = frames.take_paint().ok_or("no paint recorded")?; let image = renderer.render(&frames.ctx, paint); renderer.finish(); @@ -172,7 +262,7 @@ fn render(job: &Job, renderer: &mut Renderer, env: &RootEnv, options: &Options) return Err("blank: the story showed nothing".to_owned()); } let (w, h) = (image.width(), image.height()); - let px = |v: f32, max: u32| ((v * PIXELS_PER_POINT).max(0.0) as u32).min(max); + let px = |v: f32, max: u32| ((v * options.scale).max(0.0) as u32).min(max); let (x0, y0) = (px(crop.min.x.floor(), w), px(crop.min.y.floor(), h)); let (x1, y1) = (px(crop.max.x.ceil(), w), px(crop.max.y.ceil(), h)); if x1 <= x0 || y1 <= y0 { @@ -189,7 +279,7 @@ thread_local! { } fn file_name(job: &Job) -> String { - let story: String = job.story.story.name.chars().map(|c| if c.is_ascii_alphanumeric() || c == '_' { c } else { '-' }).collect(); + let story: String = job.story.chars().map(|c| if c.is_ascii_alphanumeric() || c == '_' { c } else { '-' }).collect(); format!("new-{}--{story}.png", job.name) } @@ -214,15 +304,16 @@ fn clean(text: &str) -> String { text.replace(['\t', '\n'], " ") } -fn write_tables(out: &Path, jobs: &[Job], done: &[Option]) -> std::io::Result<()> { - let mut stories = String::from("name\tlevel\tcrate\tstory\ttitle\tfile\tstatus\twidth\theight\n"); +fn write_tables(out: &Path, jobs: &[Job], done: &[Option], scale: f32) -> std::io::Result<()> { + let mut stories = String::from("name\tlevel\tcrate\tstory\ttitle\tfile\tstatus\twidth\theight\tscale\n"); let mut components = String::from("name\tlevel\tcrate\tstory used\tstatus\n"); for (job, done) in jobs.iter().zip(done) { let (status, size) = done.as_ref().map_or(("not run".to_owned(), None), |done| (clean(&done.status), done.size)); let (w, h) = size.map_or((String::new(), String::new()), |(w, h)| (w.to_string(), h.to_string())); - let story = job.story.story.name; - let title = clean(&job.story.story.caption(&job.name)); - let _ = writeln!(stories, "{}\t{}\t{}\t{story}\t{title}\t{}\t{status}\t{w}\t{h}", job.name, job.level, job.crate_name, file_name(job)); + let story = &job.story; + let title = clean(&job.title); + let _ = + writeln!(stories, "{}\t{}\t{}\t{story}\t{title}\t{}\t{status}\t{w}\t{h}\t{scale}", job.name, job.level, job.crate_name, file_name(job)); if job.first { let _ = writeln!(components, "{}\t{}\t{}\t{story}\t{status}", job.name, job.level, job.crate_name); } @@ -278,12 +369,13 @@ fn main() -> ExitCode { } }); let done: Vec> = done.into_iter().map(|slot| slot.into_inner().ok().flatten()).collect(); - if let Err(error) = write_tables(&options.out, &jobs, &done) { + if let Err(error) = write_tables(&options.out, &jobs, &done, options.scale) { let _ = writeln!(std::io::stderr(), "story-render: cannot write the tables: {error}"); return ExitCode::FAILURE; } let ok = done.iter().flatten().filter(|done| done.status == "ok").count(); let components = jobs.iter().filter(|job| job.first).count(); - let _ = writeln!(std::io::stdout(), "story-render: {ok} of {} stories of {components} components rendered", jobs.len()); + let what = if options.card { "cards" } else { "stories" }; + let _ = writeln!(std::io::stdout(), "story-render: {ok} of {} {what} of {components} components rendered", jobs.len()); ExitCode::SUCCESS } diff --git a/crates/ui-gallery/src/chrome/mod.rs b/crates/ui-gallery/src/chrome/mod.rs index 3f5a0496d..6e3e581be 100644 --- a/crates/ui-gallery/src/chrome/mod.rs +++ b/crates/ui-gallery/src/chrome/mod.rs @@ -10,8 +10,9 @@ mod persist; mod shell; mod variants; -pub use card::{BodyShown, Look, StoryBody}; +pub use card::{BodyShown, Card, CardEvents, CardStory, Look, StoryBody}; pub use options::options_bar; +pub use overview::{Spec, SpecStory, overview_card}; pub use panels::Panels; pub use persist::Persisted; pub use shell::Gallery; diff --git a/crates/ui-gallery/src/chrome/overview.rs b/crates/ui-gallery/src/chrome/overview.rs index 59207d829..e5106d0f9 100644 --- a/crates/ui-gallery/src/chrome/overview.rs +++ b/crates/ui-gallery/src/chrome/overview.rs @@ -4,7 +4,7 @@ use super::card::{Card, CardEvents, CardStory, Look}; use super::panels::Panels; use super::variants; -use crate::viewer::{ComponentInfo, PanelId, TreeKey, by_level, entry_of}; +use crate::viewer::{Catalog, ComponentInfo, PanelId, TreeKey, by_level, entry_of}; use craft_behavior::{ColumnWidth, Selection}; use craft_theme::variant::Tone; use craft_ui::contract::{Bind, BodyCx, Entry, Gap, Lazy, Pad, Props as _, Scroll, Show as _, ShowContainer as _, StoryLayout}; @@ -32,9 +32,10 @@ const ONE: &[ColumnWidth] = &[ColumnWidth::fill(1.0)]; const TWO: &[ColumnWidth] = &[ColumnWidth::fill(1.0); 2]; /// One story of a card to show. -pub(super) struct SpecStory { +pub struct SpecStory { /// The index of the story in the catalog. pub index: usize, + /// The story's registration. pub story: &'static StoryRegistration, /// The story's caption. pub caption: String, @@ -42,14 +43,14 @@ pub(super) struct SpecStory { impl SpecStory { /// The story at catalog index `index` of the component whose display name is `name`. - pub fn of(p: &Panels<'_>, index: usize, name: &str) -> Self { - let story = p.catalog.entries[index].registration; + pub fn of(catalog: &Catalog, index: usize, name: &str) -> Self { + let story = catalog.entries[index].registration; SpecStory { index, story, caption: story.story.caption(name) } } } /// The card of one component to show, before it is laid out. -pub(super) struct Spec { +pub struct Spec { /// The id scope of the card. pub key: String, /// The registered name of the component. @@ -62,10 +63,15 @@ pub(super) struct Spec { pub stories: Vec, /// How the stories are laid out together. pub layout: StoryLayout, + /// The surface the stories sit on. pub surface: craft_ui::contract::Surface, + /// Whether the header has Open. pub open: bool, + /// Whether the header has Use. pub usable: bool, + /// Whether the card has the selection ring. pub selected: bool, + /// The values the card sets for its stories. pub look: Look, /// Whether the card gates its story's wheel takers (`Card::gated`). pub gated: bool, @@ -80,6 +86,30 @@ impl Spec { }; HEADER_GUESS + self.stories.len().div_ceil(per_row) as f32 * STORY_ROW_GUESS } + + /// The stories as the card takes them. + pub fn card_stories(&self) -> Vec> { + self.stories.iter().map(|story| CardStory::new(story.index, story.story, &story.caption)).collect() + } + + /// The card of this spec, with `stories` from [`Spec::card_stories`], `key` as its id scope and `room` as the + /// height a filling story gets. + pub fn card<'a>(&'a self, stories: &'a [CardStory<'a>], key: String, room: f32) -> Card<'a> { + Card { + key, + title: &self.title, + note: self.note.as_deref(), + stories, + layout: self.layout, + surface: self.surface, + room, + open: self.open, + usable: self.usable, + selected: self.selected, + look: self.look, + gated: self.gated, + } + } } /// What the cards of a pass reported, by card. @@ -135,24 +165,9 @@ pub(super) fn grid( // Keyed by the card alone: a change of the column count regroups the rows, and the cards out of // view keep their extents. Lazy::new((generation, spec.key.as_str()), spec.estimate()).keep(target).show(ui, |ui| { - let stories: Vec> = - spec.stories.iter().map(|story| CardStory::new(story.index, story.story, &story.caption)).collect(); + let stories = spec.card_stories(); // Each card is its own id scope: a story's `id_salt` and auto ids must not meet another card's. - let card = Card { - key: format!("{}-{generation}", spec.key), - title: &spec.title, - note: spec.note.as_deref(), - stories: &stories, - layout: spec.layout, - surface: spec.surface, - room, - open: spec.open, - usable: spec.usable, - selected: spec.selected, - look: spec.look, - gated: spec.gated, - }; - let events = card.show(ui, p.cells); + let events = spec.card(&stories, format!("{}-{generation}", spec.key), room).show(ui, p.cells); reported.push(Reported { spec: row * columns + at, events }); }); } @@ -250,8 +265,8 @@ pub(super) fn overview(ui: &mut Ui, p: &mut Panels<'_>) { } /// The stories of group `group` of the component registered as `type_name`, under their captions. -fn group_stories(p: &Panels<'_>, type_name: &'static str, group: usize, name: &str) -> Vec { - p.catalog.group_stories(type_name, group).into_iter().map(|at| SpecStory::of(p, at, name)).collect() +fn group_stories(catalog: &Catalog, type_name: &'static str, group: usize, name: &str) -> Vec { + catalog.group_stories(type_name, group).into_iter().map(|at| SpecStory::of(catalog, at, name)).collect() } /// The group the component registered as `type_name` shows: the group of its picked story, else its first. @@ -259,13 +274,20 @@ fn target_group(p: &Panels<'_>, type_name: &'static str) -> usize { target_story(p, type_name).and_then(|at| p.catalog.group_at(type_name, at)).unwrap_or(0) } -/// The Overview's card of `component`: the cases of the group of its picked story, in catalog order, with the group's -/// name as a note when it is not the first group. +/// The Overview's card of `component`: the cases of the group of its picked story; selected when it is the selected +/// component. fn component_card(p: &Panels<'_>, component: &ComponentInfo, selected: Option<&'static str>) -> Option { + let mut spec = overview_card(p.catalog, component, target_group(p, component.type_name))?; + spec.selected = selected == Some(component.type_name); + Some(spec) +} + +/// The Overview's card of `component` showing its story group `group`: the group's cases in catalog order, with the +/// group's name as a note when it is not the first group. Not selected. +pub fn overview_card(catalog: &Catalog, component: &ComponentInfo, group: usize) -> Option { let entry = entry_of(component.type_name)?; - let group = target_group(p, component.type_name); let name = &component.groups.get(group)?.name; - let stories = group_stories(p, component.type_name, group, &entry.name); + let stories = group_stories(catalog, component.type_name, group, &entry.name); if stories.is_empty() { return None; } @@ -279,7 +301,7 @@ fn component_card(p: &Panels<'_>, component: &ComponentInfo, selected: Option<&' surface: entry.surface, open: true, usable: false, - selected: selected == Some(component.type_name), + selected: false, look: Look::default(), gated: true, }) @@ -307,7 +329,7 @@ pub(super) fn component_tab(ui: &mut Ui, p: &mut Panels<'_>, type_name: &'static type_name, title: group.name.clone(), note: None, - stories: group_stories(p, type_name, at, &entry.name), + stories: group_stories(p.catalog, type_name, at, &entry.name), layout: entry.story_layout(&group.name), surface: entry.surface, open: false, diff --git a/crates/ui-gallery/src/chrome/variants.rs b/crates/ui-gallery/src/chrome/variants.rs index 154551e8c..bc8d1059a 100644 --- a/crates/ui-gallery/src/chrome/variants.rs +++ b/crates/ui-gallery/src/chrome/variants.rs @@ -135,7 +135,7 @@ pub(super) fn show(ui: &mut Ui, p: &mut Panels<'_>, tab: PanelId) -> bool { type_name, title: value.label.to_owned(), note: shown(&value.look).then(|| "shown now".to_owned()), - stories: vec![SpecStory::of(p, index, &entry.name)], + stories: vec![SpecStory::of(p.catalog, index, &entry.name)], layout: StoryLayout::Stacked, surface: entry.surface, open: false, diff --git a/tools/cl b/tools/cl index 2228a337b..2bb2806c9 100755 --- a/tools/cl +++ b/tools/cl @@ -5,8 +5,8 @@ cl test [cargo args] [-- test args] cargo test -p --tests, canonical features cl build gallery [cargo args] the debug gallery binary (target/debug/craft-ui-gallery) cl build [cargo args] cargo build -p , canonical features - cl render [--story ] [--out ] [--threads N] - the component's stories as PNGs through the story-render bin + cl render [--card] [--story ] [--out ] [--threads N] + the component's stories (--card: its Overview cards) as PNGs through the story-render bin cl features print the canonical --features value for cl doctor check the manifests for drift from the one feature set cl cargo cargo through the job pool, no features added @@ -252,7 +252,7 @@ def main(): run(top, with_features(["build", "-p", pkg], features) + args) if command == "render": if len(rest) < 2: - fail("cl render [--story ] [--out ] [--threads N]") + fail("cl render [--card] [--story ] [--out ] [--threads N]") crate, component, options = rest[0], rest[1], rest[2:] short = crate.removeprefix("craft-") features = []