# Contract API Generated by `cl cargo run -p craft-ui-gallery --bin contract-api`; do not edit. Every public item of `craft_behavior` and of the shared modules of `craft_ui` (`contract`, `layout`, `layout_components`, `primitives`, `runtime`, `style`, `testing` and the crate root), by public path, with its signature line and the first line of its doc comment. Inherent methods and trait methods are indented under their type. Setters written by `#[derive(Props)]` are not listed: each `#[prop]` field of a type is a setter of the same name. craft-ui-contract defines every module listed here except `layout_components`, which craft-ui-widgets defines; the craft-ui facade re-exports each under the same name. `craft_ui::testing` also re-exports the story helpers of craft-ui-widgets, `testing::internals` of craft-ui-panels and the tool and canvas fixtures of craft-ui-canvas, which are not listed. ## `craft_behavior` Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item layouts, edit events, - `craft_behavior::AccessAction`: re-export of `accesskit::Action` (outside these crates). - `craft_behavior::AccessData`: re-export of `accesskit::ActionData` (outside these crates). - `craft_behavior::AccessRequest`: re-export of `craft_behavior::intent::AccessRequest`. - `craft_behavior::Anchor9`: re-export of `craft_behavior::anchor::Anchor9`. - `craft_behavior::Applied`: re-export of `craft_behavior::value::Applied`. - `craft_behavior::Arrangement`: re-export of `craft_behavior::arrangement::Arrangement`. - `craft_behavior::Arrows`: `pub enum Arrows { All, Horizontal, Vertical, None }`. Which arrow keys a roving group moves its lead with. - `craft_behavior::Axis`: re-export of `craft_behavior::flow::Axis`. - `craft_behavior::Buttons`: re-export of `craft_behavior::press::Buttons`. - `craft_behavior::CancelReason`: re-export of `craft_behavior::value::CancelReason`. - `craft_behavior::CancelRule`: re-export of `craft_behavior::focus::CancelRule`. - `craft_behavior::CanvasTransform`: re-export of `craft_behavior::canvas::CanvasTransform`. - `craft_behavior::CanvasView`: `pub struct CanvasView { pub rect: ScreenRect, pub center: Point, pub zoom: f64, pub rotation: f64, pub flip_x: bool, pub aspect: f64 }`. How a canvas shows its document: where, how large, turned and mirrored how. Apps convert their - `pub fn new(rect: ScreenRect, center: Point, zoom: f64) -> Self`. An upright, unmirrored, square-pixel view of `rect` showing `center` at `zoom`. - `pub const fn rotation(mut self, degrees: f64) -> Self`. The same view turned `degrees` clockwise. - `pub const fn flip_x(mut self, flip: bool) -> Self`. The same view mirrored left-right (or not). - `pub const fn aspect(mut self, aspect: f64) -> Self`. The same view with a document unit `aspect` times as wide as it is tall. - `pub fn points_per_unit(device_zoom: f64, pixels_per_point: f32) -> f64`. `zoom` for a view that shows `device_zoom` device pixels per document unit at - `pub fn affine(&self) -> Affine`. Document to screen points. - `pub fn to_screen(&self, p: Point) -> Pos2`. Where the view draws document point `p`. - `pub fn to_doc(&self, p: Pos2) -> Point`. The document point under screen position `p`. - `pub fn map_vec(&self, v: Vec2) -> ScreenVec`. A document vector as the view draws it: stretched, turned, zoomed and mirrored. - `pub fn unmap_vec(&self, v: ScreenVec) -> Vec2`. The document vector a screen vector shows: the inverse of [`map_vec`](Self::map_vec). - `pub fn zoom_x(&self) -> f64`. Screen points per document unit along the document's x axis: `zoom × aspect`. - `pub fn quad(&self, r: Rect) -> [Pos2; 4]`. The screen corners of document rect `r`, in order round it: (x0, y0), (x1, y0), (x1, y1), - `pub fn visible(&self) -> Rect`. The document bounds of the screen rect: every document point the view can show. - `pub fn doc_len(&self, points: f32) -> f64`. A screen distance in document units along the document's y axis (divide by - `pub fn layer_transform(&self) -> Option`. The transform a canvas body is shown through when this view only scales and moves the document: unturned, - `pub fn axis_aligned(&self) -> bool`. Whether the rotation is a multiple of 90°, so document axes are screen axes. - `pub fn level(&self, zero: Point) -> CanvasView`. The view without its rotation, moved so it draws `zero` where this view does: the same - `craft_behavior::Caret`: re-export of `craft_behavior::codec::Caret`. - `craft_behavior::CellAdvance`: `pub enum CellAdvance { Enter, Tab }`. Which key moves the active cell after an entry: Enter goes down the rows, Tab along a row. - `craft_behavior::CellAt`: re-export of `craft_behavior::selection::CellAt`. - `craft_behavior::CellDirection`: `pub enum CellDirection { Up, Down, Left, Right }`. A move of one cell. Logical: in a right-to-left sheet the widget maps the Left arrow to - `craft_behavior::CellRange`: re-export of `craft_behavior::selection::CellRange`. - `craft_behavior::CellSelection`: re-export of `craft_behavior::selection::CellSelection`. - `craft_behavior::Codec`: re-export of `craft_behavior::codec::Codec`. - `craft_behavior::ColumnKey`: re-export of `craft_behavior::columns::ColumnKey`. - `craft_behavior::ColumnWidth`: re-export of `craft_behavior::columns::ColumnWidth`. - `craft_behavior::CommandFlags`: re-export of `craft_behavior::command::CommandFlags`. - `craft_behavior::ControlMetrics`: re-export of `craft_behavior::sizing::ControlMetrics`. - `craft_behavior::Cursor`: re-export of `craft_behavior::cursor::Cursor`. - `craft_behavior::CursorBadge`: re-export of `craft_behavior::cursor::CursorBadge`. - `craft_behavior::CursorIcon`: re-export of `craft_behavior::cursor::CursorIcon`. - `craft_behavior::CursorPriority`: re-export of `craft_behavior::cursor::CursorPriority`. - `craft_behavior::DigitEntry`: re-export of `craft_behavior::digit_keys::DigitEntry`. - `craft_behavior::DigitKeys`: re-export of `craft_behavior::digit_keys::DigitKeys`. - `craft_behavior::DisplayOrder`: re-export of `craft_behavior::item_source::DisplayOrder`. - `craft_behavior::DocKey`: re-export of `craft_behavior::doc_key::DocKey`. - `craft_behavior::DockSide`: re-export of `craft_behavior::dock::DockSide`. - `craft_behavior::DragWarp`: re-export of `craft_behavior::value_drag::DragWarp`. - `craft_behavior::DropOperation`: re-export of `craft_behavior::keys::DropOperation`. - `craft_behavior::EditCommand`: re-export of `craft_behavior::intent::EditCommand`. - `craft_behavior::EditEvent`: re-export of `craft_behavior::value::EditEvent`. - `craft_behavior::EditEvents`: re-export of `craft_behavior::value::EditEvents`. - `craft_behavior::EditHistory`: re-export of `craft_behavior::edit_history::EditHistory`. - `craft_behavior::EditPolicy`: re-export of `craft_behavior::value::EditPolicy`. - `craft_behavior::EditRun`: re-export of `craft_behavior::typing::EditRun`. - `craft_behavior::EditorInput`: re-export of `craft_behavior::editor::EditorInput`. - `craft_behavior::Ended`: re-export of `craft_behavior::typing::Ended`. - `craft_behavior::EscapeRule`: re-export of `craft_behavior::typing::EscapeRule`. - `craft_behavior::Escaped`: re-export of `craft_behavior::typing::Escaped`. - `craft_behavior::Flow`: re-export of `craft_behavior::flow::Flow`. - `craft_behavior::FreeLayout`: re-export of `craft_behavior::item_layout::FreeLayout`. - `craft_behavior::Gesture`: re-export of `craft_behavior::value::Gesture`. - `craft_behavior::GestureId`: re-export of `craft_behavior::value::GestureId`. - `craft_behavior::GesturePhase`: re-export of `craft_behavior::value::GesturePhase`. - `craft_behavior::Granularity`: re-export of `craft_behavior::intent::Granularity`. - `craft_behavior::GridCursor`: re-export of `craft_behavior::grid::GridCursor`. - `craft_behavior::GridFacts`: re-export of `craft_behavior::role_rule::GridFacts`. - `craft_behavior::GridMeasure`: re-export of `craft_behavior::grid::GridMeasure`. - `craft_behavior::GridSection`: re-export of `craft_behavior::columns::GridSection`. - `craft_behavior::GridView`: re-export of `craft_behavior::columns::GridView`. - `craft_behavior::HitLevel`: re-export of `craft_behavior::hit::HitLevel`. - `craft_behavior::HitPriority`: re-export of `craft_behavior::hit::HitPriority`. - `craft_behavior::HitShape`: re-export of `craft_behavior::hit::HitShape`. - `craft_behavior::IconId`: re-export of `craft_behavior::cursor::IconId`. - `craft_behavior::Input`: re-export of `craft_behavior::input::Input`. - `craft_behavior::Insets`: re-export of `craft_behavior::flow::Insets`. - `craft_behavior::Intent`: re-export of `craft_behavior::intent::Intent`. - `craft_behavior::ItemLayout`: re-export of `craft_behavior::item_layout::ItemLayout`. - `craft_behavior::ItemSource`: re-export of `craft_behavior::item_source::ItemSource`. - `craft_behavior::KeyOwner`: re-export of `craft_behavior::focus::KeyOwner`. - `craft_behavior::KeyRole`: re-export of `craft_behavior::keys::KeyRole`. - `craft_behavior::Keyed`: re-export of `craft_behavior::item_source::Keyed`. - `craft_behavior::LabelColumn`: re-export of `craft_behavior::label_column::LabelColumn`. - `craft_behavior::LabelPlacement`: re-export of `craft_behavior::label_column::LabelPlacement`. - `craft_behavior::Letters`: `pub enum Letters { None, TypeAhead }`. Whether a roving group matches typed letters to entries. - `craft_behavior::LineIndex`: re-export of `craft_behavior::item_layout::LineIndex`. - `craft_behavior::MarqueeMode`: re-export of `craft_behavior::item_marquee::MarqueeMode`. - `craft_behavior::MarqueeSelect`: re-export of `craft_behavior::item_marquee::MarqueeSelect`. - `craft_behavior::Metrics`: re-export of `craft_behavior::sizing::Metrics`. - `craft_behavior::Mixed`: re-export of `craft_behavior::value::Mixed`. - `craft_behavior::Monitor`: re-export of `craft_behavior::monitor::Monitor`. - `craft_behavior::MonitorKey`: re-export of `craft_behavior::monitor::MonitorKey`. - `craft_behavior::MotionKind`: re-export of `craft_behavior::motion::MotionKind`. - `craft_behavior::MotionMode`: re-export of `craft_behavior::motion::MotionMode`. - `craft_behavior::MoveMods`: re-export of `craft_behavior::intent::MoveMods`. - `craft_behavior::MultiTouch`: re-export of `craft_behavior::press::MultiTouch`. - `craft_behavior::NavMove`: re-export of `craft_behavior::intent::NavMove`. - `craft_behavior::NavOutline`: `pub trait NavOutline`. Positions, not keys: the key-free part of `DisplayOrder`. - `fn len(&self) -> usize`. The number of positions. - `fn depth(&self, at: usize) -> usize`. The nesting depth of the position, 0 for a root. - `fn has_children(&self, at: usize) -> bool`. Whether the position has children. - `fn open(&self, at: usize) -> bool`. Whether the position's children show. - `fn is_section(&self, at: usize) -> bool`. Whether the position is a section header, which a move skips. - `fn enabled(&self, at: usize) -> bool`. Whether the position can take the lead. - `fn row_len(&self, _row: usize) -> Option`. `RaggedGrid`: the number of positions in `row`; rows hold consecutive positions. `None` past the last row. - `fn columns(&self) -> usize`. `Cell`: the cells of every position (a row of a sheet). - `fn first_column(&self) -> Option`. `WrappedGrid`: the column of position 0 when the grid has blank cells before it (the leading days of a - `fn rect(&self, _at: usize) -> Option`. `Spatial`: where the position sits, in any one coordinate space. - `fn is_empty(&self) -> bool`. Whether there are no positions. - `craft_behavior::NavShape`: `pub enum NavShape { Flat, Tree, WrappedGrid { columns: usize }, BoundedGrid { columns: usize }, RaggedGrid, Cell, Spatial }`. The geometry a collection's keyboard navigation follows. - `pub const fn wrapped_grid(columns: usize) -> Self`. Equal-width cells that wrap at `columns`. - `pub const fn bounded_grid(columns: usize) -> Self`. Equal-width cells in `columns` columns whose Left and Right stop at the row ends. - `craft_behavior::NavState`: `pub struct NavState { pub lead: Option, pub anchor: Option, pub page: usize, pub wrap: bool, pub column: usize }`. Where a navigation stands between moves. - `pub const fn new() -> Self`. A state with no lead, a page of ten and no wrap. - `pub const fn at(lead: usize) -> Self`. A state at `lead`. - `pub const fn page(mut self, rows: usize) -> Self`. Sets the page size. - `pub const fn wrap(mut self, on: bool) -> Self`. Sets whether moves wrap. - `pub const fn column(mut self, column: usize) -> Self`. Sets the lead cell's column. - `craft_behavior::NavStep`: `pub enum NavStep { Stay, Moved(usize), Expand(usize), Collapse(usize), Column(usize), Unhandled }`. What one move did. - `craft_behavior::NotAValue`: re-export of `craft_behavior::codec::NotAValue`. - `craft_behavior::NumberCodec`: re-export of `craft_behavior::codec::NumberCodec`. - `craft_behavior::Outline`: re-export of `craft_behavior::item_source::Outline`. - `craft_behavior::OwnerClass`: re-export of `craft_behavior::focus::OwnerClass`. - `craft_behavior::PaintedCursor`: re-export of `craft_behavior::cursor::PaintedCursor`. - `craft_behavior::PartKey`: re-export of `craft_behavior::part::PartKey`. - `craft_behavior::PartRef`: re-export of `craft_behavior::part::PartRef`. - `craft_behavior::PassInput`: re-export of `craft_behavior::press::PassInput`. - `craft_behavior::PixelSize`: re-export of `craft_behavior::pixel_size::PixelSize`. - `craft_behavior::PlacedSelection`: `pub struct PlacedSelection`. The selected cells by position in one display order: the rows and columns of each range, and the cells taken out - `pub fn of_rows(spans: impl IntoIterator>) -> Self`. The selected rows `spans`, every column of each. - `pub fn of_cells(ranges: Vec<(Range, Range)>, mut removed: Vec<(usize, u32)>) -> Self`. The ranges `ranges` (row positions, column positions) without the cells `removed`. - `pub fn holds_row(&self, at: usize) -> bool`. Whether the row at position `at` has a selected cell. - `pub fn holds_cell(&self, at: usize, column: u32) -> bool`. Whether the cell at row position `at` and column position `column` is selected. - `pub fn rows(&self) -> Vec`. The positions of the rows that have a selected cell, ascending. - `craft_behavior::PlainText`: re-export of `craft_behavior::codec::PlainText`. - `craft_behavior::Playback`: re-export of `craft_behavior::motion::Playback`. - `craft_behavior::PointerButton`: re-export of `craft_behavior::press::PointerButton`. - `craft_behavior::PointerEvent`: re-export of `craft_behavior::press::PointerEvent`. - `craft_behavior::PointerKind`: re-export of `craft_behavior::press::PointerKind`. - `craft_behavior::PointerSample`: re-export of `craft_behavior::press::PointerSample`. - `craft_behavior::Positions`: `pub struct Positions`. The display order of a grid whose row keys are their positions (a sheet, a document table): `key(at) == at`, and - `pub const fn new(rows: u32) -> Self`. The order of `rows` rows. - `craft_behavior::PressCancel`: re-export of `craft_behavior::press::PressCancel`. - `craft_behavior::PressFocus`: re-export of `craft_behavior::focus::PressFocus`. - `craft_behavior::PressMachine`: re-export of `craft_behavior::press::PressMachine`. - `craft_behavior::PressPhase`: re-export of `craft_behavior::press::PressPhase`. - `craft_behavior::PressStart`: re-export of `craft_behavior::press::PressStart`. - `craft_behavior::PressState`: re-export of `craft_behavior::press::PressState`. - `craft_behavior::PressStep`: re-export of `craft_behavior::press::PressStep`. - `craft_behavior::Proposal`: re-export of `craft_behavior::sizing::Proposal`. - `craft_behavior::Reader`: re-export of `craft_behavior::quantity::Reader`. - `craft_behavior::ResolveFor`: re-export of `craft_behavior::hit::ResolveFor`. - `craft_behavior::RoleRule`: re-export of `craft_behavior::role_rule::RoleRule`. - `craft_behavior::Roving`: `pub struct Roving { pub shape: NavShape, pub wrap: bool, pub home_end: bool, pub page: Option, pub letters: Letters, pub arrows: Arrows, pub first_column: Option, pub hands_back: bool, pub no_lead: bool, pub keeps_lead_moves: bool }`. A roving group's rules: one Tab stop whose members take moves. - `pub const fn new(shape: NavShape) -> Roving`. A group of `shape` with Home and End, no wrap, no paging and no letters. - `pub const fn wrap(mut self, on: bool) -> Self`. Whether moves wrap. - `pub const fn home_end(mut self, on: bool) -> Self`. Whether Home and End move to the ends. - `pub const fn page(mut self, rows: Option) -> Self`. Rows a Page key covers. - `pub const fn letters(mut self, letters: Letters) -> Self`. Whether letters pick entries. - `pub const fn arrows(mut self, arrows: Arrows) -> Self`. The arrows the group takes. - `pub const fn first_column(mut self, column: usize) -> Self`. The column of the first member of a wrapped grid with `column` blank cells before it: Up and Down keep the - `pub const fn hands_back(mut self) -> Self`. A move the group cannot make reaches the owning component, which may page or change what the group shows. - `pub const fn keeps_lead_moves(mut self) -> Self`. Left and Right with the lead modifier reach the focused member. - `pub const fn no_lead(mut self, on: bool) -> Self`. Whether the focused member is no lead: the next move starts at an end, as from a group with no lead. - `pub const fn state(&self, lead: Option) -> NavState`. The state a step over this group starts from, at `lead`, or from no lead when the group has none. - `pub const fn takes(&self, mv: NavMove, mods: MoveMods) -> bool`. Whether the group handles `mv` with `mods`: Page moves only with a page size and without `lead` (on a document - `craft_behavior::RowAt`: re-export of `craft_behavior::selection::RowAt`. - `craft_behavior::RulerUnits`: `pub struct RulerUnits { pub per_doc: f64, pub ticks: Ticks }`. The ruler unit of one document axis: its size and its ticks. Rulers label their ticks with it; guides use it for - `pub const fn new(per_doc: f64, ticks: Ticks) -> Self`. Ruler units of `per_doc` per document unit, spaced by `ticks`. - `pub const fn pixels() -> Self`. Whole document pixels. - `pub fn step(&self, zoom: f64, step_min: f32) -> (f64, u32)`. The labelled step in ruler units and its subdivisions when one document unit is `zoom` screen points along - `pub fn snap_to_tick(&self, position: f64, zero: f64, zoom: f64, step_min: f32) -> f64`. `position` (document units) moved to the nearest minor tick of the ruler counting from `zero`, at `zoom` - `pub fn distance(&self, position: f64, zero: f64) -> f64`. The distance of `position` (document units) from `zero`, in ruler units. - `pub fn label_decimals(&self, step: f64) -> usize`. The decimals a ruler writes a tick of labelled step `step` with. Whole ticks are whole numbers; a step of at - `pub fn label_value(&self, value: f64, step: f64) -> f64`. The number a ruler prints at the tick `value` (ruler units from the zero point) for a labelled step `step`: - `craft_behavior::SHEET_ZOOM`: re-export of `craft_behavior::item_layout::SHEET_ZOOM`. - `craft_behavior::ScopeKind`: re-export of `craft_behavior::focus::ScopeKind`. - `craft_behavior::ScrollPos`: re-export of `craft_behavior::scroll::ScrollPos`. - `craft_behavior::ScrollSpan`: re-export of `craft_behavior::scroll::ScrollSpan`. - `craft_behavior::Selection`: re-export of `craft_behavior::selection::Selection`. - `craft_behavior::SelectionChange`: re-export of `craft_behavior::selection::SelectionChange`. - `craft_behavior::SelectionModel`: re-export of `craft_behavior::selection::SelectionModel`. - `craft_behavior::Sense`: re-export of `craft_behavior::sense::Sense`. - `craft_behavior::Shape`: re-export of `craft_behavior::hit::Shape`. - `craft_behavior::SheetLayout`: re-export of `craft_behavior::item_layout::SheetLayout`. - `craft_behavior::SizeHint`: re-export of `craft_behavior::item_source::SizeHint`. - `craft_behavior::SizeTween`: re-export of `craft_behavior::layout_memory::SizeTween`. - `craft_behavior::SpanLayout`: re-export of `craft_behavior::item_layout::SpanLayout`. - `craft_behavior::TextPos`: re-export of `craft_behavior::intent::TextPos`. - `craft_behavior::Ticks`: `pub enum Ticks { Decimal { whole: bool }, Custom(fn(f64) -> (f64, u32)) }`. How a ruler divides its unit at a zoom. - `pub const fn decimal(whole: bool) -> Self`. PhotoCraft's decimal steps; `whole` keeps the step a whole number of units without 2.5. - `craft_behavior::TileLayout`: re-export of `craft_behavior::item_layout::TileLayout`. - `craft_behavior::TypeAhead`: `pub struct TypeAhead`. Typed letters of the last second as one prefix. - `pub const fn new() -> Self`. An empty buffer. - `pub fn push(&mut self, letter: char, now: f64) -> &str`. Adds `letter` typed at `now` seconds and returns the prefix. - `pub fn pick<'a>(prefix: &str, from: Option, len: usize, label: impl Fn(usize) -> std::borrow::Cow<'a, str>) -> Option`. The entry a prefix picks: the first match from the position after `from` (from `from` itself when the - `craft_behavior::Typed`: re-export of `craft_behavior::typing::Typed`. - `craft_behavior::TypingRun`: re-export of `craft_behavior::typing::TypingRun`. - `craft_behavior::Validity`: re-export of `craft_behavior::value::Validity`. - `craft_behavior::Value`: re-export of `craft_behavior::value::Value`. - `craft_behavior::ValueDrag`: re-export of `craft_behavior::value_drag::ValueDrag`. - `craft_behavior::ViewHistory`: `pub struct ViewHistory`. The places a window jumped between, oldest first, with the one it shows now. The app records - `pub const LIMIT: usize`. Entries kept; the oldest go first. - `pub fn leave(&mut self, place: ViewPlace)`. The view is about to jump away from `place`: its entry keeps the centre and zoom the - `pub fn visit(&mut self, place: ViewPlace)`. The view jumped to `place`. Visiting after Go Back drops the Go Forward entries; visiting - `pub fn go(&mut self, step: isize, exists: impl Fn(&K) -> bool) -> Option>`. Go Back or Go Forward: the place to show, skipping places that no longer exist. Going - `craft_behavior::ViewPlace`: `pub struct ViewPlace { pub key: K, pub center: Point, pub zoom: f64 }`. Where a view stood: what it showed (`key`: a page, an artboard, a document) and the view's - `pub const fn new(key: K, center: Point, zoom: f64) -> Self`. The view of `key` centred on `center` at `zoom`. - `craft_behavior::Wheel`: re-export of `craft_behavior::wheel::Wheel`. - `craft_behavior::WheelNotch`: re-export of `craft_behavior::wheel::WheelNotch`. - `craft_behavior::WheelPhase`: re-export of `craft_behavior::wheel::WheelPhase`. - `craft_behavior::WheelRoom`: re-export of `craft_behavior::wheel::WheelRoom`. - `craft_behavior::WheelTaker`: re-export of `craft_behavior::wheel::WheelTaker`. - `craft_behavior::WheelUnit`: re-export of `craft_behavior::wheel::WheelUnit`. - `craft_behavior::Winner`: re-export of `craft_behavior::hit::Winner`. - `craft_behavior::ZoomLadder`: re-export of `craft_behavior::canvas::zoom::ZoomLadder`. - `craft_behavior::count_clicks`: re-export of `craft_behavior::press::count_clicks`. - `craft_behavior::decimals_for_step`: re-export of `craft_behavior::codec::decimals_for_step`. - `craft_behavior::is_checkable`: re-export of `craft_behavior::role_rule::is_checkable`. - `craft_behavior::is_selectable`: re-export of `craft_behavior::role_rule::is_selectable`. - `craft_behavior::keyed`: re-export of `craft_behavior::item_source::keyed`. - `craft_behavior::kurbo`: re-export of `craft_behavior::kurbo` (defined outside these crates). - `craft_behavior::lead_step`: `pub const fn lead_step(mv: NavMove, mods: MoveMods) -> Option`. The step Left or Right with the lead modifier makes, physical as the arrows are: Ctrl+Left and Ctrl+Right (Back - `craft_behavior::pick_instance`: re-export of `craft_behavior::command::pick_instance`. - `craft_behavior::resize_cursor`: `pub fn resize_cursor(view: &CanvasView, doc_dir: Vec2) -> CursorIcon`. The resize arrow for moving along document direction `doc_dir`, as `view` shows it (its - `craft_behavior::resolve`: re-export of `craft_behavior::hit::resolve`. - `craft_behavior::resolve_columns`: re-export of `craft_behavior::grid::resolve_columns`. - `craft_behavior::resolve_flags`: re-export of `craft_behavior::command::resolve_flags`. - `craft_behavior::resolve_mapped`: re-export of `craft_behavior::hit::resolve_mapped`. - `craft_behavior::role_violations`: re-export of `craft_behavior::role_rule::role_violations`. - `craft_behavior::wheel_step`: `pub fn wheel_step(steps: &ValueSteps, axes: ValueAxes, wheel: &Wheel, rtl: bool) -> StepResult`. Maps a wheel event to the new value of a single-value control: one `notch` per event, up for positive scroll. - `craft_behavior::wrap_value`: re-export of `craft_behavior::value_drag::wrap_value`. ## `craft_behavior::anchor` The nine points of a box, shared by the transform box rules and the reference point picker. - `craft_behavior::anchor::Anchor9`: `pub enum Anchor9 { TopLeft, Top, TopRight, Left, Centre, Right, BottomLeft, Bottom, BottomRight }`. The nine points of a box: its corners, edge midpoints and centre, row by row from the top left. - `pub const ALL: [Anchor9; 9]`. Every point, row by row from the top left. - `pub fn uv(self) -> (f64, f64)`. Where the point sits in the box: 0 to 1 across from the left edge and down from the top. - `pub fn cell(self) -> (usize, usize)`. The point's column and row in the 3 by 3 grid, counted from the top left. ## `craft_behavior::arrangement` `Arrangement`: a custom placement for a body, in logical coordinates. - `craft_behavior::arrangement::Arrangement`: `pub trait Arrangement`. A placement of keyed children measured by the caller. Logical: x runs from the start edge of `room`, so - `fn place(&self, room: Rect, sizes: &[Vec2], out: &mut Vec) -> Vec2`. Fills `out` with one rect per entry of `sizes`, in order, inside `room`; returns the size the placement - `fn mirrors(&self) -> bool`. False for a placement that must not mirror (a free-position board). ## `craft_behavior::canvas` The transform a canvas body is shown through, and the canvas view with its zoom rules, history and ruler units. - `craft_behavior::canvas::CanvasTransform`: `pub struct CanvasTransform { pub scale: f32, pub offset: Vec2 }`. A canvas body's mapping from canvas coordinates to its layer: `screen = canvas * scale + offset`. - `pub const fn new(scale: f32, offset: Vec2) -> Self`. The transform with `scale` layer points per canvas unit and the canvas origin at `offset`. - `pub fn to_layer(&self, canvas: Pos2) -> Pos2`. The position in the layer of a canvas point. - `craft_behavior::canvas::CanvasView`: `pub struct CanvasView { pub rect: ScreenRect, pub center: Point, pub zoom: f64, pub rotation: f64, pub flip_x: bool, pub aspect: f64 }`. How a canvas shows its document: where, how large, turned and mirrored how. Apps convert their - `pub fn new(rect: ScreenRect, center: Point, zoom: f64) -> Self`. An upright, unmirrored, square-pixel view of `rect` showing `center` at `zoom`. - `pub const fn rotation(mut self, degrees: f64) -> Self`. The same view turned `degrees` clockwise. - `pub const fn flip_x(mut self, flip: bool) -> Self`. The same view mirrored left-right (or not). - `pub const fn aspect(mut self, aspect: f64) -> Self`. The same view with a document unit `aspect` times as wide as it is tall. - `pub fn points_per_unit(device_zoom: f64, pixels_per_point: f32) -> f64`. `zoom` for a view that shows `device_zoom` device pixels per document unit at - `pub fn affine(&self) -> Affine`. Document to screen points. - `pub fn to_screen(&self, p: Point) -> Pos2`. Where the view draws document point `p`. - `pub fn to_doc(&self, p: Pos2) -> Point`. The document point under screen position `p`. - `pub fn map_vec(&self, v: Vec2) -> ScreenVec`. A document vector as the view draws it: stretched, turned, zoomed and mirrored. - `pub fn unmap_vec(&self, v: ScreenVec) -> Vec2`. The document vector a screen vector shows: the inverse of [`map_vec`](Self::map_vec). - `pub fn zoom_x(&self) -> f64`. Screen points per document unit along the document's x axis: `zoom × aspect`. - `pub fn quad(&self, r: Rect) -> [Pos2; 4]`. The screen corners of document rect `r`, in order round it: (x0, y0), (x1, y0), (x1, y1), - `pub fn visible(&self) -> Rect`. The document bounds of the screen rect: every document point the view can show. - `pub fn doc_len(&self, points: f32) -> f64`. A screen distance in document units along the document's y axis (divide by - `pub fn layer_transform(&self) -> Option`. The transform a canvas body is shown through when this view only scales and moves the document: unturned, - `pub fn axis_aligned(&self) -> bool`. Whether the rotation is a multiple of 90°, so document axes are screen axes. - `pub fn level(&self, zero: Point) -> CanvasView`. The view without its rotation, moved so it draws `zero` where this view does: the same - `craft_behavior::canvas::RulerUnits`: `pub struct RulerUnits { pub per_doc: f64, pub ticks: Ticks }`. The ruler unit of one document axis: its size and its ticks. Rulers label their ticks with it; guides use it for - `pub const fn new(per_doc: f64, ticks: Ticks) -> Self`. Ruler units of `per_doc` per document unit, spaced by `ticks`. - `pub const fn pixels() -> Self`. Whole document pixels. - `pub fn step(&self, zoom: f64, step_min: f32) -> (f64, u32)`. The labelled step in ruler units and its subdivisions when one document unit is `zoom` screen points along - `pub fn snap_to_tick(&self, position: f64, zero: f64, zoom: f64, step_min: f32) -> f64`. `position` (document units) moved to the nearest minor tick of the ruler counting from `zero`, at `zoom` - `pub fn distance(&self, position: f64, zero: f64) -> f64`. The distance of `position` (document units) from `zero`, in ruler units. - `pub fn label_decimals(&self, step: f64) -> usize`. The decimals a ruler writes a tick of labelled step `step` with. Whole ticks are whole numbers; a step of at - `pub fn label_value(&self, value: f64, step: f64) -> f64`. The number a ruler prints at the tick `value` (ruler units from the zero point) for a labelled step `step`: - `craft_behavior::canvas::Ticks`: `pub enum Ticks { Decimal { whole: bool }, Custom(fn(f64) -> (f64, u32)) }`. How a ruler divides its unit at a zoom. - `pub const fn decimal(whole: bool) -> Self`. PhotoCraft's decimal steps; `whole` keeps the step a whole number of units without 2.5. - `craft_behavior::canvas::ViewHistory`: `pub struct ViewHistory`. The places a window jumped between, oldest first, with the one it shows now. The app records - `pub const LIMIT: usize`. Entries kept; the oldest go first. - `pub fn leave(&mut self, place: ViewPlace)`. The view is about to jump away from `place`: its entry keeps the centre and zoom the - `pub fn visit(&mut self, place: ViewPlace)`. The view jumped to `place`. Visiting after Go Back drops the Go Forward entries; visiting - `pub fn go(&mut self, step: isize, exists: impl Fn(&K) -> bool) -> Option>`. Go Back or Go Forward: the place to show, skipping places that no longer exist. Going - `craft_behavior::canvas::ViewPlace`: `pub struct ViewPlace { pub key: K, pub center: Point, pub zoom: f64 }`. Where a view stood: what it showed (`key`: a page, an artboard, a document) and the view's - `pub const fn new(key: K, center: Point, zoom: f64) -> Self`. The view of `key` centred on `center` at `zoom`. - `craft_behavior::canvas::ZoomLadder`: re-export of `craft_behavior::canvas::zoom::ZoomLadder`. - `craft_behavior::canvas::resize_cursor`: `pub fn resize_cursor(view: &CanvasView, doc_dir: Vec2) -> CursorIcon`. The resize arrow for moving along document direction `doc_dir`, as `view` shows it (its ## `craft_behavior::canvas::zoom` Zoom rules as pure functions on a [`CanvasView`]: Photoshop's zoom range and Zoom In / Zoom Out ladder, Fit on - `craft_behavior::canvas::zoom::ZoomLadder`: `pub struct ZoomLadder`. Photoshop's zoom range and the Zoom In / Zoom Out ladder, measured on Photoshop 25.4: up to - `pub const MAX: f64`. 12800 %. - `pub const STEPS: [f64; 33]`. Zoom In / Zoom Out rungs (1 = 100 %). - `pub fn min(size: Size) -> f64`. The lowest zoom for a document of `size` units: its shorter side 2 device pixels. An empty - `pub fn clamp(zoom: f64, size: Size) -> f64`. `zoom` within the range for a document of `size`; a zoom that is not a finite number - `pub fn step(zoom: f64, dir: i32, size: Size) -> f64`. Zoom In (`dir` > 0) or Zoom Out (`dir` < 0) from `zoom`: the next rung past it (a zoom - `pub fn step_in_range(zoom: f64, dir: i32, range: RangeInclusive) -> f64`. [`step`](Self::step) within an explicit range (a navigator or a zoom field with bounds of - `pub fn percent_range(zoom: f64, size: Size) -> RangeInclusive`. A zoom field's range in percent: the document's range widened to include `zoom` itself. - `craft_behavior::canvas::zoom::about`: `pub fn about(view: &mut CanvasView, screen: Pos2, device_zoom: f64, center_on_point: bool, pixels_per_point: f32)`. Set the zoom to `device_zoom` (clamped by the caller) keeping the document point under - `craft_behavior::canvas::zoom::anchor`: `pub fn anchor(view: &mut CanvasView, screen: Pos2, doc: Point, device_zoom: f64, pixels_per_point: f32)`. Set the zoom to `device_zoom` with the document point `doc` shown at `screen`. - `craft_behavior::canvas::zoom::device`: `pub fn device(view: &CanvasView, pixels_per_point: f32) -> f64`. `view.zoom` as device zoom (1 = 100 %) at `pixels_per_point`. - `craft_behavior::canvas::zoom::fill`: `pub fn fill(view: &mut CanvasView, size: Size, pixels_per_point: f32)`. Fill Screen: centre the document and zoom until it covers `view.rect`; one axis may extend - `craft_behavior::canvas::zoom::fit`: `pub fn fit(view: &mut CanvasView, size: Size, pixels_per_point: f32, margin: f64)`. Fit on Screen: centre the document and zoom so all of it shows inside `view.rect` less `margin` points on - `craft_behavior::canvas::zoom::fit_up_to`: `pub fn fit_up_to(view: &mut CanvasView, size: Size, pixels_per_point: f32, max_device: f64, margin: f64)`. [`fit`] with the device zoom allowed up to `max_device` (1 = 100 %) instead of 100 %: a small document is - `craft_behavior::canvas::zoom::step`: `pub fn step(view: &mut CanvasView, dir: i32, size: Size, pixels_per_point: f32) -> bool`. View › Zoom In (`dir` > 0) or Zoom Out (`dir` < 0): the next ladder rung - `craft_behavior::canvas::zoom::wheel_anchor`: `pub fn wheel_anchor(view: &CanvasView, screen: Pos2, size: Size) -> Pos2`. Where a wheel or pinch zoom anchors for a pointer at `screen`: the pointer over the document, - `craft_behavior::canvas::zoom::with_device`: `pub fn with_device(view: &CanvasView, device: f64, size: Size, pixels_per_point: f32) -> CanvasView`. `view` at `device` zoom (1 = 100 %), clamped to the zoom range of a document of `size`, with its centre kept. ## `craft_behavior::codec` `Codec`: how a text part turns a value into text and text into a value (18.2), with the library codecs of this - `craft_behavior::codec::Caret`: `pub enum Caret { All, End }`. Where the caret goes when the part takes focus. - `craft_behavior::codec::Codec`: `pub trait Codec`. A value's text form. - `type Value`. The value the text stands for. - `const DRAFTS_ARE_VALUES: bool`. Every draft is a value (plain text): a draft applies as typed and never rejects. - `fn format(&self, v: &Self::Value) -> String`. The text of `v`. - `fn parse(&self, text: &str, start: &Self::Value) -> Result`. The value of `text`; `start` is the value when editing began, for relative input. - `fn parse_tagged(&self, text: &str, start: &Self::Value) -> Result<(Self::Value, Option), NotAValue>`. The value of `text` and the tag of the unit it named (`Reader::read_tagged`); the default names none. - `fn applies_as_typed(&self, _text: &str) -> bool`. Whether `text` applies as soon as it is typed rather than on commit. - `fn filter(&self, _c: char) -> bool`. Whether the codec takes `c` as typed. - `fn normalise(&self, _text: &str, v: &Self::Value) -> String`. The text the field shows after committing `v`, which was parsed from `text`. - `fn caret_on_focus(&self, _text: &str) -> Caret`. Where the caret goes when the part takes focus with this text. - `fn sample(&self, current: &Self::Value) -> Cow<'_, str>`. The widest typical text, for the field's ideal width. Codecs with bounded text only; `PlainText` returns - `craft_behavior::codec::NotAValue`: `pub struct NotAValue`. The text is not a value of the codec's type. - `craft_behavior::codec::NumberCodec`: `pub struct NumberCodec`. An optional number: empty text is `None`; anything else reads through a [`Reader`]. - `pub fn new(reader: Reader, decimals: usize) -> Self`. A codec reading with `reader` and writing at most `decimals` decimal places. - `pub fn fixed(mut self) -> Self`. The same codec writing every decimal place, trailing zeros included ("1.00"), as a field of a quantity shown - `pub fn or_parse(mut self, parse: impl Fn(&str) -> Option + Send + Sync + 'static) -> Self`. The same codec with `parse` as a second reader: it runs when the reader rejects the text, so words of the - `pub fn widest(&self, range: &RangeInclusive) -> String`. The widest text the codec writes for a number in `range`: the longest of each end and the number one place of - `pub fn decimals(&self) -> usize`. The most decimal places the codec writes. - `pub fn reader(&self) -> &Reader`. The reader the codec parses with. - `craft_behavior::codec::PlainText`: `pub struct PlainText`. Plain text: every draft is a value. - `craft_behavior::codec::decimals_for_step`: `pub fn decimals_for_step(step: f64) -> usize`. The decimal places a step needs to be written exactly: 2 for 0.25, 3 for 0.001, 0 for a whole step. A step with ## `craft_behavior::columns` Column keys, widths and the sections a grid layout reports. - `craft_behavior::columns::ColumnKey`: `pub struct ColumnKey`. The key of a column; stable across reordering and resizing. It serializes as its name, or as its position for a - `pub const fn new(key: &'static str) -> Self`. A key named `key`. - `pub const fn index(column: u32) -> Self`. The key of the column at `column` in a sheet whose columns are numbered rather than named - `pub fn as_str(&self) -> Option<&str>`. The name of a key made by [`ColumnKey::new`]; `None` for a numbered key. - `pub fn position(&self) -> Option`. The position a key made by [`ColumnKey::index`] holds; `None` for a named key. - `craft_behavior::columns::ColumnWidth`: `pub enum ColumnWidth { Content, Fixed(f32), Controls(f32), Fill { weight: f32 } }`. How wide a column is. - `pub fn in_unit(self, unit: f32) -> Self`. The width with `Controls(n)` turned into `Fixed(n * unit)`. - `pub const fn fill(weight: f32) -> Self`. A share of the remaining width with `weight` among the `Fill` columns. - `craft_behavior::columns::GridSection`: `pub struct GridSection { pub rect: Rect, pub columns: Range, pub edges: Vec }`. One horizontal section of a grid layout: its rect, the columns it shows and their edges. - `pub fn new(rect: Rect, columns: Range, edges: Vec) -> Self`. A section at `rect` showing `columns` with their edges. - `craft_behavior::columns::GridView`: `pub struct GridView { pub sections: SmallVec<[GridSection; 4]> }`. The sections of a sheet layout, one per frozen area. - `pub fn new(sections: impl IntoIterator) -> Self`. A view of `sections`, in reading order. ## `craft_behavior::command` The pure rules of command routing (spec 11.3): which state a command resolves to, and which live instance - `craft_behavior::command::CommandFlags`: `pub struct CommandFlags { pub enabled: bool, pub checked: Option }`. A command's enabled and checked state. - `pub const fn new(enabled: bool, checked: Option) -> Self`. Flags with the given enabled and checked state. - `pub const DEFAULT: CommandFlags`. A command nobody published a state for: enabled, with no checked state. - `craft_behavior::command::pick_instance`: `pub fn pick_instance(live: &[I], focused: &[I], last_focused: &[I]) -> Option`. The instance a non-component source delivers to, out of the live instances of the command's scope in - `craft_behavior::command::resolve_flags`: `pub const fn resolve_flags(this_frame: Option, last_frame: Option) -> CommandFlags`. This frame's state, else last frame's, else the default. ## `craft_behavior::cursor` Cursor requests as plain data and the rule that picks the winner (8.5). - `craft_behavior::cursor::Cursor`: `pub enum Cursor { System(CursorIcon), Painted(PaintedCursor) }`. What a cursor request names. - `craft_behavior::cursor::CursorBadge`: `pub enum CursorBadge { Add, Subtract, Intersect, Copy, NotAllowed, Scissors, Close }`. A mark beside a painted cursor. - `craft_behavior::cursor::CursorIcon`: `pub enum CursorIcon { Default, None, ContextMenu, Help, PointingHand, Progress, Wait, Cell, Crosshair, Text, VerticalText, Alias, Copy, Move, NoDrop, NotAllowed, Grab, Grabbing, AllScroll, ResizeHorizontal, ResizeNeSw, ResizeNwSe, ResizeVertical, ResizeColumn, ResizeEast, ResizeSouthEast, ResizeSouth, ResizeSouthWest, ResizeWest, ResizeNorthWest, ResizeNorth, ResizeNorthEast, ZoomIn, ZoomOut }`. A system cursor: craft-behavior's copy of egui's set, converted by `runtime::egui::output`. - `craft_behavior::cursor::CursorPriority`: `pub enum CursorPriority { Default, Tool, Hover, Part, DropTarget, Drag }`. Who asks, in ascending order of precedence. - `craft_behavior::cursor::IconId`: `pub struct IconId`. An icon's egui-free key (5.2), so plain data such as [`PaintedCursor::Tool`] names icons without egui. - `pub const fn new(name: &'static str) -> Self`. The icon named `name`. - `pub fn name(&self) -> &str`. The name. - `craft_behavior::cursor::PaintedCursor`: `pub enum PaintedCursor { Crosshair, Circle { radius: f32, centre: bool, badge: Option }, Outline { rings: Vec>, centre: bool, badge: Option }, Hand, Zoom { out: bool }, Tool { icon: IconId, hotspot: Vec2, badge: Option }, Badged { base: CursorIcon, badge: CursorBadge }, Turn { toward: Vec2 }, Distort { dir: Vec2 }, Skew { dir: Vec2 }, Hidden }`. A cursor the overlay host paints. Geometry is in screen points around the pointer (a tool scales its brush - `pub const CENTRE_ARM: f32`. The arm of the centre mark of a circle or an outline, in points. - `pub const fn circle(radius: f32) -> Self`. A circle of `radius` points, with no centre mark and no badge. - `pub fn outline(rings: Vec>) -> Self`. App shapes as closed rings, with no centre mark and no badge. - `pub fn marked(self, centre: bool, badge: Option) -> Self`. A circle or an outline with the centre mark when `centre` and `badge` centred on the pointer; any other cursor - `pub const fn zoom(out: bool) -> Self`. A magnifier, zooming out when `out`. - `pub const fn tool(icon: IconId, hotspot: Vec2, badge: Option) -> Self`. A tool's icon with its hotspot and an optional badge. - `pub const fn turn(toward: Vec2) -> Self`. The rotate pointer bent toward screen direction `toward`. - `pub const fn distort(dir: Vec2) -> Self`. The free-distort pointer along screen direction `dir`. - `pub const fn skew(dir: Vec2) -> Self`. The skew pointer along screen direction `dir`. - `pub const fn badged(base: CursorIcon, badge: CursorBadge) -> Self`. A system cursor with a mark. - `craft_behavior::cursor::pick`: `pub fn pick(requests: &[(Cursor, CursorPriority)]) -> Option<&Cursor>`. The winning request: the highest priority, the later request on a tie. ## `craft_behavior::digit_keys` [`DigitKeys`]: Photoshop's number keys for a tool's opacity. 1 sets 10 % … 9 sets 90 %, 0 sets 100 %; two digits - `craft_behavior::digit_keys::DigitEntry`: `pub struct DigitEntry { pub percent: f64, pub second: bool }`. What a number key sets: the percentage and which value. - `craft_behavior::digit_keys::DigitKeys`: `pub struct DigitKeys`. The number keys' state between presses: the first digit of a pair. The app keeps one. - `pub const TWO_DIGITS: f64`. Seconds within which a second digit makes an exact value. - `pub fn press(&mut self, digit: u8, second: bool, now: f64) -> Option`. One press of `digit` (0..=9) for the second value or not, at `now` seconds: 10 × the digit (0: 100) on its own, ## `craft_behavior::divider` The resize of a row of segments separated by dividers. - `craft_behavior::divider::Give`: `pub enum Give { Neighbours, Pair }`. Which segments give way when a divider moves. - `craft_behavior::divider::Segment`: `pub struct Segment { pub extent: f32, pub min: f32, pub max: f32 }`. One segment of a row: its extent along the row and its limits. - `pub const fn new(extent: f32, min: f32, max: f32) -> Self`. A segment of `extent` that stays within `min` and `max`. - `pub const fn unbounded(extent: f32, min: f32) -> Self`. A segment of `extent` with no upper limit. - `craft_behavior::divider::resize`: `pub fn resize(row: &[Segment], index: usize, target: f32, give: Give) -> Vec`. The extents of `row` after the divider after `row[index]` moves to `target`, a distance from the row's start, clamped - `craft_behavior::divider::travel`: `pub fn travel(row: &[Segment], index: usize, give: Give) -> (f32, f32)`. How far the divider after `row[index]` can move: `(lo, hi)`, with `lo <= 0 <= hi`. Toward the start the segments ## `craft_behavior::doc_key` A stable, crate-prefixed semantic key for presence, automation, undo names and programmatic focus. - `craft_behavior::doc_key::DocKey`: `pub struct DocKey`. A document key such as `"craft-ui.find-field"`. - `pub const fn new(name: &'static str) -> DocKey`. A key `crate-prefix.name`; evaluated in a const context it rejects a malformed name at compile time. The - `pub const fn name(self) -> &'static str`. The name the key was declared with. ## `craft_behavior::dock` The dock model: the tree of splits over panel frames, the side of a group a drop lands on (20.6), and the rules - `craft_behavior::dock::DockSide`: `pub enum DockSide { Start, End, Top, Bottom, Center }`. The side of a group a dropped panel docks on, in reading order: `Start` is the left half in a left-to-right - `pub const fn axis(self) -> Option`. The axis the side splits along; `None` for `Center`. - `pub fn area(self, group: Rect) -> Rect`. The part of `group` a panel docked on this side takes: the half on that side, or the whole group. - `craft_behavior::dock::Action`: `pub enum Action

{ Move { panel: P, anchor: P, placement: DockPlacement

}, Float { panel: P, rect: Rect }, Close { panel: P }, Activate { panel: P }, Open { panel: P, anchor: Option

}, OpenAt { panel: P, anchor: P, placement: DockPlacement

}, MoveFloating { panel: P, rect: Rect }, ResizeSplit { path: Vec, size: SplitSize }, ResizeWindowSplit { panel: P, path: Vec, size: SplitSize }, SetStackOpen { panel: P, open: bool }, ResizeStack { panel: P, height: Option }, MoveGroup { panel: P, to: Target

}, StepGroup { panel: P, up: bool }, MoveColumn { panel: P, to: Target

}, MoveWindow { panel: P, to: Target

}, CloseGroup { panel: P }, CloseWindow { panel: P }, CloseOthers { panel: P }, SetMinimized { panel: P, minimized: bool }, SetIconic { panel: P, iconic: bool }, ResizeColumn { panel: P, width: f32 }, ResizeGroup { panel: P, height: Option }, ResizeFlyoutWidth { panel: P, width: Option }, ResizeIconic { panel: P, width: Option }, SetNative { panel: P, placement: Option }, MovePanel { panel: P, to: Target

} }`. Groups, columns and floating windows are named by a panel they contain. - `pub fn move_beside(panel: P, anchor: P, placement: DockPlacement

) -> Self`. Builds [`Action::Move`]. - `pub fn float(panel: P, rect: Rect) -> Self`. Builds [`Action::Float`]. - `pub fn close(panel: P) -> Self`. Builds [`Action::Close`]. - `pub fn activate(panel: P) -> Self`. Builds [`Action::Activate`]. - `pub fn open(panel: P, anchor: Option

) -> Self`. Builds [`Action::Open`]. - `pub fn open_at(panel: P, anchor: P, placement: DockPlacement

) -> Self`. Builds [`Action::OpenAt`]. - `pub fn move_floating(panel: P, rect: Rect) -> Self`. Builds [`Action::MoveFloating`]. - `pub fn resize_split(path: Vec, size: SplitSize) -> Self`. Builds [`Action::ResizeSplit`]. - `pub fn resize_window_split(panel: P, path: Vec, size: SplitSize) -> Self`. Builds [`Action::ResizeWindowSplit`]. - `pub fn set_stack_open(panel: P, open: bool) -> Self`. Builds [`Action::SetStackOpen`]. - `pub fn resize_stack(panel: P, height: Option) -> Self`. Builds [`Action::ResizeStack`]. - `pub fn move_group(panel: P, to: Target

) -> Self`. Builds [`Action::MoveGroup`]. - `pub fn step_group(panel: P, up: bool) -> Self`. Builds [`Action::StepGroup`]. - `pub fn move_column(panel: P, to: Target

) -> Self`. Builds [`Action::MoveColumn`]. - `pub fn move_window(panel: P, to: Target

) -> Self`. Builds [`Action::MoveWindow`]. - `pub fn close_group(panel: P) -> Self`. Builds [`Action::CloseGroup`]. - `pub fn close_window(panel: P) -> Self`. Builds [`Action::CloseWindow`]. - `pub fn close_others(panel: P) -> Self`. Builds [`Action::CloseOthers`]. - `pub fn set_minimized(panel: P, minimized: bool) -> Self`. Builds [`Action::SetMinimized`]. - `pub fn set_iconic(panel: P, iconic: bool) -> Self`. Builds [`Action::SetIconic`]. - `pub fn resize_column(panel: P, width: f32) -> Self`. Builds [`Action::ResizeColumn`]. - `pub fn resize_group(panel: P, height: Option) -> Self`. Builds [`Action::ResizeGroup`]. - `pub fn resize_flyout_width(panel: P, width: Option) -> Self`. Builds [`Action::ResizeFlyoutWidth`]. - `pub fn resize_iconic(panel: P, width: Option) -> Self`. Builds [`Action::ResizeIconic`]. - `pub fn set_native(panel: P, placement: Option) -> Self`. Builds [`Action::SetNative`]. - `pub fn move_panel(panel: P, to: Target

) -> Self`. Builds [`Action::MovePanel`]. - `craft_behavior::dock::Arrangement`: `pub enum Arrangement { TileAllVertically, TileAllHorizontally, TwoUpVertical, TwoUpHorizontal, ThreeUpVertical, ThreeUpHorizontal, ThreeUpStacked, FourUp, SixUp, ConsolidateAllToTabs, Cascade, Tile, FloatInWindow, FloatAllInWindows, NewWindowForDocument, MatchZoom, MatchLocation, MatchRotation, MatchAll }`. One Window › Arrange entry. The n-up entries split the document area into that many - `pub fn group_count(self, documents: usize) -> Option`. How many document groups an n-up or tile arrangement wants, `None` for the window and - `pub fn enabled(self, documents: usize, groups: usize, floating: usize) -> bool`. Whether the entry is enabled with `documents` open and `floating` floating windows: - `craft_behavior::dock::Column`: `pub struct Column

{ pub groups: Vec>, pub width: Option, pub iconic: bool, pub iconic_width: Option }`. One column of a dock: groups from top to bottom. - `pub fn new(groups: Vec>) -> Self`. A column of `groups`, expanded at the theme's column width until the user resizes it. - `pub fn with_width(mut self, width: f32) -> Self`. The column resized to `width` points. - `craft_behavior::dock::ColumnLocation`: `pub struct ColumnLocation { pub side: DockEdge, pub width: Option, pub iconic: bool, pub iconic_width: Option }`. The column a closed panel's group was in. - `pub const fn new(side: DockEdge, width: Option, iconic: bool, iconic_width: Option) -> Self`. A column location on `side`, `width` points wide when expanded (the theme's column width for `None`). - `craft_behavior::dock::DockEdge`: `pub enum DockEdge { Start, End }`. The window edge a [`Node::Dock`] sits on, in reading order so right-to-left interfaces - `craft_behavior::dock::DockError`: `pub enum DockError { LimitExceeded, DuplicatePanel, MissingPanel, MissingTarget, InvalidSelection, InvalidGeometry, InvalidPlacement, NotAllowed, UnsupportedVersion }`. Why a layout edit or load was refused. The layout is unchanged when an edit fails. - `craft_behavior::dock::DockPlacement`: `pub enum DockPlacement

{ Tab { before: Option

}, Split(DockSide), SplitSized { zone: DockSide, size: SplitSize, outer: SplitSize }, Group { below: bool, height: Option }, Column { after: bool }, Edge(DockSide) }`. Where a moved panel goes relative to an anchor panel. - `pub fn tab(before: Option

) -> Self`. Builds [`DockPlacement::Tab`]. - `pub fn group(below: bool, height: Option) -> Self`. Builds [`DockPlacement::Group`]. - `pub fn column(after: bool) -> Self`. Builds [`DockPlacement::Column`]. - `pub fn allowed_by(&self, anchor: Permissions, floating: bool) -> bool`. Whether the anchor's permissions take this placement: tabs need `accepts_tabs`, side - `craft_behavior::dock::DocumentGroup`: `pub struct DocumentGroup { pub id: u64, pub documents: Vec, pub shown: Option }`. A document group: the documents in one tab strip, one of them shown. - `pub fn new(id: u64, documents: Vec) -> Self`. A group with id `id` holding `documents`, none shown. - `craft_behavior::dock::DocumentWindows`: `pub struct DocumentWindows { pub docked: Vec>, pub floating: Vec<(DocumentGroup, Rect)> }`. The document windows of the app: the tabbed groups in the canvas area and the floating ones. - `pub fn float(&mut self, document: &D, rect: Rect) -> Option`. Float `document` from its group into a new window at `rect`. A document alone in a - `pub fn float_all(&mut self, area: Rect, size: Vec2, step: f32)`. Every document into its own floating window, cascaded from `area`'s top left. A floating - `pub fn consolidate(&mut self, active: Option<&D>)`. Every document back into one docked group, the active one shown. A document in several - `pub fn split_into(&mut self, n: usize)`. Split the docked documents into `n` groups for an n-up arrangement, in order. The first - `pub fn new_window_for(&mut self, document: &D, rect: Rect) -> u64`. A second view of `document`: the same document id in a new window; the app keeps one - `pub fn to_actions(&self, layout: &Layout

, panel_of: impl Fn(u64) -> P) -> Vec>`. The dock actions that put `self` into `layout`, for the dock to draw the windows. The - `craft_behavior::dock::Floating`: `pub struct Floating

{ pub id: u64, pub root: Node

, pub rect: Rect, pub native: Option, pub minimized: bool }`. A floating window: a tree of groups like the docked layout's, without docks. - `pub fn new(root: Node

, rect: Rect) -> Self`. A window holding `root`. Each call makes a new window, with a fresh [`Self::id`]: build - `pub fn single(panels: Vec

, active: usize, rect: Rect) -> Self`. A window with one group. Each call makes a new window, as [`Self::new`] does. - `pub fn with_id(mut self, id: u64) -> Self`. The window with `id`, for a layout the app builds in code, such as a default layout: - `pub fn panels(&self) -> impl Iterator`. Every panel in the window, in tree order. - `pub fn stack(groups: Vec>, rect: Rect) -> Option`. Groups stacked top to bottom, as a v1 layout stored them: each group over a vertical - `pub fn groups(&self) -> Vec> where P: Clone,`. The window's groups, first to last. - `pub fn contains(&self, panel: &Q) -> bool where P: std::borrow::Borrow,`. True when a group of this window holds `panel`. Takes any borrowed form of `P`, such - `craft_behavior::dock::Group`: `pub struct Group

{ pub panels: Vec

, pub active: usize, pub minimized: bool, pub height: Option, pub flyout_width: Option }`. Tabs that move, minimize and size together in a dock column. - `pub fn new(panels: Vec

, active: usize) -> Self`. A group of `panels` with tab `active` selected, expanded and with no preferred height or flyout width. - `pub fn active_panel(&self) -> Option<&P>`. The selected panel, or `None` when `active` is out of range. - `craft_behavior::dock::GroupLocation`: `pub struct GroupLocation { pub minimized: bool, pub height: Option, pub flyout_width: Option, pub column: Option }`. The group a closed panel was in, when that group was in a dock. - `pub const fn new(minimized: bool, height: Option, column: Option) -> Self`. A group location with the given state and column. - `pub const fn with_flyout_width(mut self, width: Option) -> Self`. The location with the group's flyout `width` points wide. - `craft_behavior::dock::Layout`: `pub struct Layout

{ pub root: Option>, pub floating: Vec> }`. The panels of a workspace: a docked tree plus floating windows. Every panel occurs once. - `pub fn new(root: Option>, floating: Vec>) -> Self`. A layout with the docked tree `root` and the floating windows `floating`. - `pub fn validate(&self) -> Result<(), DockError>`. Check depth, allocation bounds, geometry, selection, globally unique panel ownership and - `pub fn panels(&self) -> Vec<&P>`. Iterate identities without recursion. On excessive input returns no more than the limit. - `pub fn contains(&self, panel: &P) -> bool`. Whether the layout holds `panel`, docked or floating. - `pub fn can_step_group(&self, panel: &P, up: bool, permissions: impl Fn(&P) -> Permissions) -> bool`. Whether [`Action::StepGroup`] would move `panel`'s group, for enabling a menu item. - `pub fn location(&self, panel: &P) -> Result, DockError>`. Capture a panel's nearest surviving group/split neighbor before hiding it. - `pub fn panel_state(&self, panel: &P) -> PanelState`. Hidden, open behind another tab or in a collapsed container, or showing. - `pub fn restore(&mut self, panel: P, location: &Location

) -> Result<(), DockError>`. Restore an absent panel at a captured location. Missing anchors are reported without - `pub fn open_at_edge(&mut self, panel: P) -> Result<(), DockError>`. Open an absent panel as a frame at the outer edge of the docked area, taking most of it: - `craft_behavior::dock::Location`: `pub struct Location

{ pub floating: Option, pub anchor: Option

, pub placement: DockPlacement

, pub size: Option, pub stack: Option<(bool, Option)>, pub sibling: Vec

, pub group: Option }`. A closed panel's former placement. Applications may retain this beside visibility flags. - `pub fn new(anchor: Option

, placement: DockPlacement

) -> Self`. A location relative to `anchor` by `placement`, with no recorded sizes or siblings. - `craft_behavior::dock::MAX_DEPTH`: `pub const MAX_DEPTH: usize`. Limits are checked before cloning or recursively modifying an application layout. - `craft_behavior::dock::MAX_PANELS`: `pub const MAX_PANELS: usize`. Most panels a layout may hold. Larger layouts fail with [`DockError::LimitExceeded`](super::DockError::LimitExceeded). - `craft_behavior::dock::NamedWorkspace`: `pub struct NamedWorkspace

{ pub id: String, pub name: String, pub layout: Workspace

, pub chrome: WorkspaceChrome, pub keeps_shortcuts: bool, pub keeps_menus: bool }`. One named workspace. - `pub fn new(id: impl Into, name: impl Into, layout: Workspace

) -> Self`. A workspace named `name` with the stable id `id`, showing every bar and keeping no shortcuts or menus. - `craft_behavior::dock::Node`: `pub enum Node

{ Split { axis: Axis, size: SplitSize, first: Box>, second: Box> }, Tabs { panels: Vec

, active: usize }, Stack { entries: Vec> }, Dock { side: DockEdge, columns: Vec> } }`. A node of a layout tree. - `pub fn tabs(panels: Vec

, active: usize) -> Self`. A group of tabs with tab `active` selected. - `pub fn split(axis: Axis, size: SplitSize, first: Node

, second: Node

) -> Self`. Two children along `axis`, sharing the room by `size`. - `pub fn stack(entries: Vec>) -> Self`. Builds [`Node::Stack`]. - `pub fn dock(side: DockEdge, columns: Vec>) -> Self`. Builds [`Node::Dock`]. - `craft_behavior::dock::PanelPlace`: `pub enum PanelPlace { Node(Vec), Dock { path: Vec, column: usize, group: usize }, Floating { window: usize, path: Vec } }`. Where a panel is. Paths lead from the root: false is a split's first child, true its second. - `pub fn tree_path(&self) -> Option<(Option, &[bool])>`. The tree (`None` for the docked layout, else a floating window) and the path of a - `craft_behavior::dock::PanelState`: `pub enum PanelState { Hidden, Open, Front }`. What the Window menu shows for a panel. The model does not track the z-order of floating - `craft_behavior::dock::Permissions`: `pub struct Permissions { pub movable: bool, pub floatable: bool, pub closable: bool, pub accepts_tabs: bool, pub accepts_splits: bool }`. What may happen to a panel. [`Layout::apply_with_permissions`] enforces these for every - `pub const ALL: Self`. Every right: the panel moves, floats, closes and takes tabs and splits. - `pub const PROTECTED: Self`. A document canvas: it stays docked and open, and takes neither tabs nor side splits. - `pub const fn movable(mut self, movable: bool) -> Self`. These permissions with [`Self::movable`] set to `movable`. - `pub const fn floatable(mut self, floatable: bool) -> Self`. These permissions with [`Self::floatable`] set to `floatable`. - `pub const fn closable(mut self, closable: bool) -> Self`. These permissions with [`Self::closable`] set to `closable`. - `pub const fn accepts_tabs(mut self, accepts_tabs: bool) -> Self`. These permissions with [`Self::accepts_tabs`] set to `accepts_tabs`. - `pub const fn accepts_splits(mut self, accepts_splits: bool) -> Self`. These permissions with [`Self::accepts_splits`] set to `accepts_splits`. - `pub fn is_protected(self) -> bool`. A canvas: it can neither move, close nor take tabs. `accepts_splits` and `floatable` - `pub fn locked(self) -> Self`. Lock Workspace: nothing moves, floats or closes; tab and split drops keep their policy. - `craft_behavior::dock::SIDE_ZONE_DEPTH_SHARE`: `pub const SIDE_ZONE_DEPTH_SHARE: f32`. The most of a body's smaller side that a [`ZoneSize::Depth`] zone reaches, so a body always keeps a middle. - `craft_behavior::dock::SIDE_ZONE_FRACTION`: `pub const SIDE_ZONE_FRACTION: f32`. Share of a body, from each edge, that means "beside" under [`ZoneSize::Fraction`]: of its width from the start - `craft_behavior::dock::SplitSize`: `pub enum SplitSize { Ratio(f32), FixedFirst(f32), FixedSecond(f32) }`. A transient sizing request. Applications may adapt their own persisted sizing enum. - `craft_behavior::dock::StackEntry`: `pub struct StackEntry

{ pub panel: P, pub open: bool, pub height: Option }`. One panel of a [`Node::Stack`] accordion. - `pub fn new(panel: P) -> Self`. An open accordion section for `panel` with no preferred height. - `craft_behavior::dock::Target`: `pub enum Target

{ At { anchor: P, placement: DockPlacement

}, NewDock { side: DockEdge }, Float { rect: Rect } }`. Where a group, column or floating window goes. - `pub fn at(anchor: P, placement: DockPlacement

) -> Self`. Builds [`Target::At`]. - `pub fn new_dock(side: DockEdge) -> Self`. Builds [`Target::NewDock`]. - `pub fn float(rect: Rect) -> Self`. Builds [`Target::Float`]. - `craft_behavior::dock::Workspace`: `pub struct Workspace

{ pub version: u32, pub layout: Layout

, pub hidden: Vec<(P, Location

)> }`. A saved arrangement of panels: the [`Layout`] and the closed panels' former places. - `pub const VERSION: u32`. The format version written to files. - `pub fn revision(&self) -> u64`. The revision of this live workspace: it changes with every [`replace`](Self::replace) and nothing else. - `pub fn replace(&mut self, with: Workspace

)`. Replaces the arrangement with `with` and moves to the next revision. - `pub fn apply(&mut self, action: Action

, locked: bool, permissions: impl Fn(&P) -> Permissions) -> Result, DockError>`. Apply one action. Closed panels record where they go back, so each one can be reopened - `pub fn apply_all(&mut self, actions: impl IntoIterator>, locked: bool, permissions: impl Fn(&P) -> Permissions,) -> Result, DockError>`. Apply every action in order, or none, as [`Self::apply`] does. Returns the panels the - `craft_behavior::dock::WorkspaceChrome`: `pub struct WorkspaceChrome { pub menu_bar: bool, pub tool_rail: bool, pub options_bar: bool, pub status_bar: bool }`. Chrome a workspace remembers beside the dock layout: which bars show. The default shows every bar. - `craft_behavior::dock::WorkspaceError`: `pub enum WorkspaceError { UnknownId, NameTaken, EmptyName, CurrentCannotBeDeleted }`. Why a [`WorkspaceSet`] edit was refused. - `craft_behavior::dock::WorkspaceSet`: `pub struct WorkspaceSet

{ pub builtin: Vec>, pub saved: Vec>, pub current: String, pub locked: bool, pub edited: BTreeMap> }`. The app's workspaces: built-ins first, saved ones after, one current. It is a settings - `pub fn new(builtin: Vec>) -> Self`. A set of `builtin` workspaces with the first one current. - `pub fn current(&self) -> Option<&NamedWorkspace

>`. The current workspace, or `None` when `current` names none. - `pub fn find(&self, id: &str) -> Option<&NamedWorkspace

>`. The workspace with this id. - `pub fn layout(&self) -> Option<&Workspace

>`. The layout the current workspace shows: what it was left with, else its stored one. - `pub fn select(&mut self, id: &str, live: &mut Workspace

) -> Result<(), WorkspaceError>`. Switch to `id` and replace `live` with the layout it shows; the current workspace's live - `pub fn save(&mut self, name: &str, live: Workspace

, chrome: WorkspaceChrome) -> Result`. Save `live` under `name` and make it current; a name a built-in has is refused. A saved - `pub fn delete(&mut self, id: &str) -> Result<(), WorkspaceError>`. Delete a saved workspace; the current one can't be deleted (Photoshop greys it). - `pub fn reset(&mut self, live: &mut Workspace

) -> Result<(), WorkspaceError>`. Reset the current workspace: drop what it was left with and replace `live` with its stored - `craft_behavior::dock::ZoneSize`: `pub enum ZoneSize { Depth(f32), Fraction }`. How deep the side zones of a body are. - `craft_behavior::dock::arrange_rects`: `pub fn arrange_rects(arrangement: Arrangement, area: Rect, n: usize) -> Option>`. The cells of an n-up or Tile All arrangement inside `area`, in reading order. `Tile All - `craft_behavior::dock::first_active`: `pub fn first_active

(root: &Node

) -> Option<&P>`. The shown panel of a tree's first group. - `craft_behavior::dock::node_at`: `pub fn node_at<'a, P>(mut node: &'a Node

, path: &[bool]) -> Option<&'a Node

>`. The node at `path` from `root`: false is a split's first child, true its second. - `craft_behavior::dock::tree_panels`: `pub fn tree_panels

(root: &Node

) -> Vec<&P>`. The panels of a tree in order, without recursion; at most [`MAX_PANELS`]. - `craft_behavior::dock::zones`: `pub fn zones(body: Rect, size: ZoneSize, rtl: bool) -> [(DockSide, Rect); 5]`. The zones of `body`, the part of a group below its tab strip: the start and end zones along its full height, ## `craft_behavior::edit_history` `EditHistory`: the undo and redo of a dialog, a tool session or the keymap editor, fed by edit events. - `craft_behavior::edit_history::EditHistory`: `pub struct EditHistory`. Undo and redo stacks of a value `T`, at most 100 steps. A gesture is one step: `Begin` opens it, `Commit` closes it, - `pub fn new(now: &T) -> Self`. A history that starts at `now`. - `pub fn record(&mut self, event: &EditEvent)`. Takes in one event. Events of a gesture other than the open one are ignored. - `pub fn is_open(&self) -> bool`. A gesture is open: a caller that restores a draft waits for it to end. - `pub fn step(&mut self, now: &mut T, step: Step) -> bool`. Steps `now` back or forward. False when there is nowhere to go. An open gesture is abandoned. - `pub fn take_back(&mut self) -> Option`. Takes back the newest undo step without a redo entry, for an edit that was refused: `settled` returns to the - `pub fn can_undo(&self) -> bool`. An undo would change something. - `pub fn can_redo(&self) -> bool`. A redo would change something. - `craft_behavior::edit_history::Step`: `pub enum Step { Undo, Redo }`. Which way [`EditHistory::step`] goes. ## `craft_behavior::editor` `EditorInput`: the one ordered input stream the IME engine produces and an editor part reads (18.4). - `craft_behavior::editor::EditorInput`: `pub enum EditorInput { Text(Arc), Move(NavMove, MoveMods), Delete { forward: bool, by: Granularity }, DeleteSurrounding { before: usize, after: usize }, Select { anchor: TextPos, focus: TextPos }, Preedit { text: Arc, cursor: Option> }, ImeCommit, Edit(EditCommand), Newline, Tab, Cancel }`. One input of an editor part. - `pub const fn delete(forward: bool, by: Granularity) -> Self`. A `Delete` of `by`. - `pub fn preedit(text: impl Into>, cursor: Option>) -> Self`. A `Preedit` of `text` with the IME's cursor. - `pub const fn select(anchor: TextPos, focus: TextPos) -> Self`. A `Select` of `anchor` to `focus`. - `pub const fn is_read_only_safe(&self) -> bool`. Whether the input changes no text: a read-only editor receives only these (18.4). ## `craft_behavior::eviction` When a component's remembered state is due for eviction. - `craft_behavior::eviction::owner_due`: `pub fn owner_due(last_pass: u64, last_at: f64, pass_now: u64, now: f64, viewport_live: bool) -> bool`. Whether the owner last registered at pass `last_pass` and time `last_at` is due: both the pass count and the ## `craft_behavior::fit` The fit rules: which tabs, bar items or titles stay in a strip and which go to an overflow menu. [`fit`] and - `craft_behavior::fit::Fit`: `pub struct Fit { pub shown: Vec, pub overflow: Vec }`. Which items the strip shows and which go to the overflow menu, as indexes into the input, in input order. - `craft_behavior::fit::FitItem`: `pub struct FitItem { pub extent: f32, pub section: u16, pub keep: FitKeep }`. One item as the fit rule sees it: its extent along the strip, its section and whether it may overflow. - `pub const fn new(extent: f32, section: u16, keep: FitKeep) -> Self`. An item `extent` long in `section`. - `craft_behavior::fit::FitKeep`: `pub enum FitKeep { Free, Pinned, Menu }`. Whether an item may move into the overflow menu, or lives there. - `craft_behavior::fit::TabFit`: `pub struct TabFit { pub shown: Vec<(usize, f32)>, pub overflow: Vec, pub overflow_width: f32 }`. Tabs visible on a strip and tabs that need an overflow menu, all in original order. - `craft_behavior::fit::fit`: `pub fn fit(natural: &[f32], selected: usize, available: f32, minimum_width: f32, overflow_width: f32) -> TabFit`. Fit tab widths into `available` points, shrinking the widest tabs first to a common cap. - `craft_behavior::fit::fit_items`: `pub fn fit_items(items: &[FitItem], available: f32, gap: f32, section_gap: f32, overflow_extent: f32) -> Fit`. Decides which items stay in a strip `available` long. Everything fits and no item is `Menu`: all items show. - `craft_behavior::fit::fit_whole`: `pub fn fit_whole(natural: &[f32], selected: usize, available: f32, overflow_width: f32) -> TabFit`. Fit tabs at their natural widths; the tabs that do not fit go to an overflow menu. - `craft_behavior::fit::run_extent`: `pub fn run_extent(items: &[FitItem], shown: &[bool], gap: f64, section_gap: f64) -> f64`. The length of the items marked in `shown`, with `gap` between neighbours of a section and `section_gap` between ## `craft_behavior::flow` `Insets`, `Flow` and `Axis`: start and end geometry resolved once for the layout direction. - `craft_behavior::flow::Axis`: `pub enum Axis { X, Y }`. An axis of the screen or of a document. Saved layouts written with the former split axis names load through - `craft_behavior::flow::Flow`: `pub struct Flow`. The geometry of one rect in one direction. Components place by start and end and never test direction. - `pub const fn new(rect: Rect, rtl: bool) -> Self`. The flow of `rect`, right to left when `rtl`. - `pub const fn rect(&self) -> Rect`. The rect the flow places in. - `pub const fn is_rtl(&self) -> bool`. Whether start is the right edge. - `pub fn start_x(&self) -> f32`. The x of the start edge: the left edge, or the right edge under RTL. - `pub fn end_x(&self) -> f32`. The x of the end edge. - `pub fn span(&self, start: f32, width: f32) -> Rect`. The full-height rect `width` wide that begins `start` from the start edge. - `pub fn take_start(&self, width: f32) -> (Rect, Flow)`. Takes `width` from the start edge: the taken rect, and the flow of the rest. - `pub fn take_end(&self, width: f32) -> (Rect, Flow)`. Takes `width` from the end edge: the taken rect, and the flow of the rest. - `pub fn inset(&self, insets: Insets) -> Rect`. The rect shrunk by `insets`. - `pub fn align(&self, size: Vec2, h: Align, v: Align) -> Rect`. A rect of `size` in the flow's rect: `h` along the reading direction (`Min` is the start edge), `v` - `pub fn to_physical(&self, logical: Rect) -> Rect`. A rect given in logical x (from the start edge of this flow's rect) as a physical rect. - `pub const fn unmirrored(rect: Rect, reason: &'static str) -> Flow`. The same rect placed left to right, for a site that places by explicit rects and must not mirror (a - `craft_behavior::flow::Insets`: `pub struct Insets { pub start: f32, pub end: f32, pub top: f32, pub bottom: f32 }`. Distances from the four edges of a rect; `start` and `end` follow the reading direction. - `pub const fn new(start: f32, end: f32, top: f32, bottom: f32) -> Self`. Insets of `start`, `end`, `top` and `bottom`. - `pub const fn horizontal(h: f32) -> Self`. `h` at the start and the end. - `pub const fn vertical(v: f32) -> Self`. `v` at the top and the bottom. - `pub const fn uniform(all: f32) -> Self`. `all` on every side. ## `craft_behavior::focus` Pure focus rules (spec 9.3, 9.4, 8.3): key ownership, focus after removal, the Escape order and the - `craft_behavior::focus::CancelRule`: `pub enum CancelRule { Close, ClearThenClose, Ignore }`. What Escape does in a scope that has no more specific taker. - `craft_behavior::focus::EscapeFacts`: `pub struct EscapeFacts { pub press_captured: bool, pub component_undoable: bool, pub in_row_child: bool, pub scope_clearable: bool }`. The facts the Escape order reads. - `pub const fn new() -> Self`. No fact set. - `pub const fn press_captured(mut self, on: bool) -> Self`. A press is captured. - `pub const fn in_row_child(mut self, on: bool) -> Self`. Focus is on a row's child. - `pub const fn scope_clearable(mut self, on: bool) -> Self`. The scope has content to clear. - `craft_behavior::focus::EscapeRouting`: `pub struct EscapeRouting { pub cancels_press: bool, pub to_components: usize }`. How the Escapes that arrived in one pass split between the captured press and the components. - `craft_behavior::focus::EscapeStep`: `pub enum EscapeStep { CancelPress, Component, BackToRow, ClearScope, CloseScope, Ignore }`. What the Escape of one pass reaches first. - `craft_behavior::focus::KeyOwner`: `pub enum KeyOwner { Blocked, Class(OwnerClass) }`. Who owns the keys of one pass. - `craft_behavior::focus::OwnerClass`: `pub enum OwnerClass { Widget, Text, Recorder, App, Popup, PassivePopup, Menu, Dialog }`. A key class: the input of key ownership. - `craft_behavior::focus::PressFocus`: `pub enum PressFocus { Take, Keep, Release, Unclaimed }`. How a primary press moves key focus (8.3). - `pub const fn commits_draft(self) -> bool`. Whether a focused text part with a draft commits it in the press pass. - `craft_behavior::focus::ScopeKind`: `pub enum ScopeKind { Window, Pane, Dialog, Popup, Menu, Group }`. What a focus scope is. - `craft_behavior::focus::after_removal`: `pub fn after_removal<'a, T: PartialEq>(last_order: &'a [T], focused: &T, registered: impl Fn(&T) -> bool) -> Option<&'a T>`. The stop that takes focus when `focused` is no longer registered: the one after it in last pass's order - `craft_behavior::focus::classify_press`: `pub fn classify_press(winner: Option) -> PressFocus`. The kind of a press from the sense of the shape that wins it, `None` when no shape senses it. A shape that - `craft_behavior::focus::escape_step`: `pub fn escape_step(facts: EscapeFacts, rule: CancelRule) -> EscapeStep`. The order of Escape for the top egui layer that is not exiting: a captured press, the focused component, - `craft_behavior::focus::key_owner`: `pub fn key_owner(blocked: bool, present: &[OwnerClass]) -> KeyOwner`. Key ownership, in the order blocked, `Menu`, `Recorder`, `Dialog`, `Text`, `Popup` and `PassivePopup`, - `craft_behavior::focus::route_escapes`: `pub fn route_escapes(escapes: usize, press_captured: bool) -> EscapeRouting`. Routes `escapes` Escapes of one pass: with a press captured, the first one is the press's (`escape_step`'s ## `craft_behavior::geometry` Pure canvas geometry in document units: the transform box ([`quad`]), snapping ([`snap`]), the - `craft_behavior::geometry::BoxAllow`: re-export of `craft_behavior::geometry::quad::BoxAllow`. - `craft_behavior::geometry::BoxDrag`: re-export of `craft_behavior::geometry::quad::BoxDrag`. - `craft_behavior::geometry::BoxPart`: re-export of `craft_behavior::geometry::quad::BoxPart`. - `craft_behavior::geometry::BoxRules`: re-export of `craft_behavior::geometry::quad::BoxRules`. - `craft_behavior::geometry::BoxState`: re-export of `craft_behavior::geometry::quad::BoxState`. - `craft_behavior::geometry::ConstrainStyle`: re-export of `craft_behavior::geometry::move_gesture::ConstrainStyle`. - `craft_behavior::geometry::Constraint`: re-export of `craft_behavior::geometry::marquee::Constraint`. - `craft_behavior::geometry::CropBox`: re-export of `craft_behavior::geometry::crop::CropBox`. - `craft_behavior::geometry::CropGuide`: re-export of `craft_behavior::geometry::crop::CropGuide`. - `craft_behavior::geometry::Directions`: re-export of `craft_behavior::geometry::lock::Directions`. - `craft_behavior::geometry::DraftEvent`: re-export of `craft_behavior::geometry::draft::DraftEvent`. - `craft_behavior::geometry::DraftKind`: re-export of `craft_behavior::geometry::draft::DraftKind`. - `craft_behavior::geometry::DraftPoint`: re-export of `craft_behavior::geometry::draft::DraftPoint`. - `craft_behavior::geometry::DraftReach`: re-export of `craft_behavior::geometry::draft::DraftReach`. - `craft_behavior::geometry::GuideShow`: re-export of `craft_behavior::geometry::crop::GuideShow`. - `craft_behavior::geometry::Homography`: re-export of `craft_behavior::geometry::quad::Homography`. - `craft_behavior::geometry::LOCK_HYSTERESIS_DEGREES`: re-export of `craft_behavior::geometry::lock::LOCK_HYSTERESIS_DEGREES`. - `craft_behavior::geometry::MarqueeGesture`: re-export of `craft_behavior::geometry::marquee::MarqueeGesture`. - `craft_behavior::geometry::MarqueeRect`: re-export of `craft_behavior::geometry::marquee::MarqueeRect`. - `craft_behavior::geometry::MoveGesture`: re-export of `craft_behavior::geometry::move_gesture::MoveGesture`. - `craft_behavior::geometry::MoveValue`: re-export of `craft_behavior::geometry::move_gesture::MoveValue`. - `craft_behavior::geometry::OutlineDraft`: re-export of `craft_behavior::geometry::draft::OutlineDraft`. - `craft_behavior::geometry::Parts`: re-export of `craft_behavior::geometry::quad::Parts`. - `craft_behavior::geometry::SKEW_LIMIT`: re-export of `craft_behavior::geometry::quad::SKEW_LIMIT`. - `craft_behavior::geometry::SNAP_PX`: re-export of `craft_behavior::geometry::snap::SNAP_PX`. - `craft_behavior::geometry::ScaleRule`: re-export of `craft_behavior::geometry::quad::ScaleRule`. - `craft_behavior::geometry::SelectionOperation`: re-export of `craft_behavior::geometry::selection_op::SelectionOperation`. - `craft_behavior::geometry::SnapGesture`: re-export of `craft_behavior::geometry::snap::SnapGesture`. - `craft_behavior::geometry::SnapKind`: re-export of `craft_behavior::geometry::snap::SnapKind`. - `craft_behavior::geometry::SnapLine`: re-export of `craft_behavior::geometry::snap::SnapLine`. - `craft_behavior::geometry::SnapOptions`: re-export of `craft_behavior::geometry::snap::SnapOptions`. - `craft_behavior::geometry::SnapTarget`: re-export of `craft_behavior::geometry::snap::SnapTarget`. - `craft_behavior::geometry::SnapTargets`: re-export of `craft_behavior::geometry::snap::SnapTargets`. - `craft_behavior::geometry::StrokeLock`: re-export of `craft_behavior::geometry::move_gesture::StrokeLock`. - `craft_behavior::geometry::TransformMode`: re-export of `craft_behavior::geometry::quad::TransformMode`. - `craft_behavior::geometry::across_axis`: re-export of `craft_behavior::geometry::snap::across_axis`. - `craft_behavior::geometry::coordinate_across`: re-export of `craft_behavior::geometry::snap::coordinate_across`. - `craft_behavior::geometry::crop_view`: re-export of `craft_behavior::geometry::crop::crop_view`. - `craft_behavior::geometry::crop_view_about`: re-export of `craft_behavior::geometry::crop::crop_view_about`. - `craft_behavior::geometry::drag`: re-export of `craft_behavior::geometry::quad::drag`. - `craft_behavior::geometry::fixed_size_pixels`: re-export of `craft_behavior::geometry::marquee::fixed_size_pixels`. - `craft_behavior::geometry::hit_rect`: re-export of `craft_behavior::geometry::crop::hit_rect`. - `craft_behavior::geometry::lock_direction`: re-export of `craft_behavior::geometry::lock::lock_direction`. - `craft_behavior::geometry::marquee_pixels`: re-export of `craft_behavior::geometry::marquee::marquee_pixels`. - `craft_behavior::geometry::motion_across`: re-export of `craft_behavior::geometry::snap::motion_across`. - `craft_behavior::geometry::round_to_direction`: re-export of `craft_behavior::geometry::lock::round_to_direction`. - `craft_behavior::geometry::screen_step`: re-export of `craft_behavior::geometry::crop::screen_step`. - `craft_behavior::geometry::square_pixels`: re-export of `craft_behavior::geometry::marquee::square_pixels`. - `craft_behavior::geometry::turn_to_45`: re-export of `craft_behavior::geometry::lock::turn_to_45`. ## `craft_behavior::geometry::crop` The crop frame's pure geometry: the box, where a press lands on it, what each gesture makes of it, the - `craft_behavior::geometry::crop::CropBox`: `pub struct CropBox { pub rect: Rect, pub angle: f64 }`. The crop frame: a document rect and the angle it is turned by about its centre. - `pub const fn new(rect: Rect, angle: f64) -> Self`. The frame `rect` turned `angle` degrees about its centre. - `pub const fn upright(rect: Rect) -> Self`. An unturned frame. - `pub fn part_at(&self, point: Point, reach: f64) -> BoxPart`. The part a press at `point` (document units) lands on, with `reach` document units of reach: a corner or an - `pub fn is_finite(&self) -> bool`. Whether the rect and the angle are finite numbers. - `pub fn center(&self) -> Point`. The centre the frame turns about. - `pub fn corners(&self) -> [Point; 4]`. The corners on the page, turned: top left, top right, bottom right, bottom left of the upright frame. - `pub fn part_point(&self, part: BoxPart) -> Option`. The document point of `part` on the turned frame: a corner or an edge handle, or the centre for - `pub fn part_direction(&self, part: BoxPart) -> Option`. The direction `part` points out of the frame, as a document vector turned with the frame; none for the - `pub fn quadrant_diagonal(&self, point: Point) -> Vec2`. The diagonal, as a document vector, from the frame's corner nearest `point` towards the frame's centre - `pub fn turned_bounds(&self) -> Rect`. The axis-aligned bounds of the turned frame. - `pub fn moved(&self, by: Vec2) -> Self`. The frame moved by `by` on the page, its angle kept. - `pub fn swapped(&self) -> Self`. Width and height swapped about the centre, the angle kept (X). - `pub fn nudged(&self, part: BoxPart, by: Vec2, ratio: Option) -> Self`. The frame after an arrow key moves `part` by `by`, as a plain drag of the part would, with `ratio` held. - `pub fn crop_size(&self) -> Option<(f64, f64)>`. The size Enter would crop to: the frame's own width and height in whole document units, at least 1; `None` - `pub fn size_ok(&self) -> bool`. Whether both sides are at least one document unit. - `pub fn resized(&self, part: BoxPart, by: Vec2, ratio: Option, alt: bool) -> Self`. The frame with `part` dragged by the page vector `by`: along the frame's own axes, the opposite edges kept on - `pub fn resized_centred(&self, part: BoxPart, by: Vec2, ratio: Option, alt: bool) -> Option`. [`resized`](Self::resized) for Auto Center Preview in image mode: `part` dragged by `by` grows or shrinks the - `pub fn turned_to(&self, grab: f64, to: Point, step: Option, image: bool) -> Self`. The frame turned from this one's angle by the pointer's sweep about the centre, from direction `grab` - `pub fn within(self, bounds: Rect, resizing: bool, held: bool) -> Option`. The frame kept inside `bounds`: an unturned frame is cut to it; a turned one is moved by the least that - `pub fn level_angle(a: Point, b: Point) -> Option`. The frame angle (degrees, clockwise on the page, in -45..=45) that makes the line from `a` to `b` level, or - `pub fn fitted(&self, canvas: Size, angle: f64) -> Option`. The largest frame with this one's proportions that fits a canvas of `canvas` at `angle` degrees, centred on - `craft_behavior::geometry::crop::CropGuide`: `pub enum CropGuide { Thirds, Grid, Diagonal, Triangle, GoldenRatio, GoldenSpiral }`. The composition guide drawn inside a crop frame, in Photoshop's menu order. - `pub const ALL: [CropGuide; 6]`. Every guide, in the order `next` cycles through. - `pub fn orientations(self) -> u8`. How many distinct orientations `next_orientation` steps through: the Triangle's diagonal runs either way, the - `pub fn next(self) -> Self`. The next guide (O); the orientation starts over at 0. - `pub fn next_orientation(self, orientation: u8) -> u8`. The guide's next orientation (Shift+O) after `orientation`; a symmetric guide stays at 0 and a stray value - `pub fn guides(self, orientation: u8, w: f64, h: f64, grid_step: f64, grid_max: usize) -> Vec>`. The guide's polylines for a frame `w` x `h` screen points, in its unit square (0..1 along its top edge, 0..1 - `craft_behavior::geometry::crop::GuideShow`: `pub enum GuideShow { Auto, Always, Never }`. When the guide shows. - `pub const ALL: [GuideShow; 3]`. Every rule, in menu order. - `pub fn shows(self, gesture: bool) -> bool`. Whether the guide shows, `gesture` being a crop drag in progress. - `craft_behavior::geometry::crop::crop_view`: `pub fn crop_view(b: &CropBox, view: &CanvasView) -> CanvasView`. `view` turned so the frame `b` shows upright (rotation `-b.angle`), the frame's centre kept where it is on screen. - `craft_behavior::geometry::crop::crop_view_about`: `pub fn crop_view_about(b: &CropBox, view: &CanvasView, pivot: Point) -> CanvasView`. [`crop_view`] keeping document point `pivot` where it is on screen. `view` itself when anything is not finite. - `craft_behavior::geometry::crop::direction`: `pub fn direction(c: Point, p: Point) -> f64`. The direction of `p` from `c`, in radians. - `craft_behavior::geometry::crop::drawn`: `pub fn drawn(anchor: Point, cur: Point, ratio: Option, mods: Mods) -> Rect`. A new frame drawn from `anchor` to `cur`: ⇧ square, ⌥ from the centre, `ratio` held. - `craft_behavior::geometry::crop::hit_rect`: `pub fn hit_rect(rect: Rect, point: Point, reach: f64) -> BoxPart`. [`CropBox::part_at`] for a plain upright `rect`, with no frame or view. - `craft_behavior::geometry::crop::image_turn`: `pub fn image_turn(frame_angle: f64) -> f64`. The turn the image-mode readout shows: clockwise positive, the frame's angle undone, never -0. - `craft_behavior::geometry::crop::normalized_angle`: `pub fn normalized_angle(deg: f64) -> f64`. An angle in degrees brought into (-180, 180]; 0 for anything not finite. An angle already in range comes back - `craft_behavior::geometry::crop::screen_step`: `pub fn screen_step(view: &CanvasView, by: Vec2) -> Vec2`. An arrow step `by` (screen points) as the document vector it is in `view`, at one document unit per point. - `craft_behavior::geometry::crop::snap_angle`: `pub fn snap_angle(deg: f64, step: f64) -> f64`. `deg` on the nearest multiple of `step` degrees, brought into (-180, 180]; a step that is not finite and positive - `craft_behavior::geometry::crop::turn`: `pub fn turn(p: Point, c: Point, deg: f64) -> Point`. `p` turned `deg` degrees clockwise on screen (y down) about `c`. ## `craft_behavior::geometry::draft` An outline being drawn by a selection or freeform tool, and how it closes: [`OutlineDraft`]. - `craft_behavior::geometry::draft::DraftEvent`: `pub enum DraftEvent { Started { intent: Mods }, Changed, Closed { points: Vec, straight: Vec }, Cancelled }`. What a call on an [`OutlineDraft`] did. Calls that change nothing return `None`. - `craft_behavior::geometry::draft::DraftKind`: `pub enum DraftKind { Freehand, Mixed, Polygonal }`. Which tool's rules an [`OutlineDraft`] follows. - `craft_behavior::geometry::draft::DraftPoint`: `pub struct DraftPoint { pub at: Point, pub mods: Mods, pub zoom: f64 }`. One pointer sample for an [`OutlineDraft`]. - `pub fn new(at: Point, mods: Mods, zoom: f64) -> Self`. A sample at `at` (document units) with `mods` held, at `zoom` screen points per unit. - `craft_behavior::geometry::draft::DraftReach`: `pub struct DraftReach { pub close: f64, pub same_point: f64 }`. How near a press must be to close an outline, in screen points. The caller passes the hit - `pub const fn new(close: f64, same_point: f64) -> Self`. A reach closing within `close` screen points of the first vertex and treating a press - `craft_behavior::geometry::draft::OutlineDraft`: `pub struct OutlineDraft`. The pointer state machine of an outline being drawn, shared by every lasso. - `pub fn new(kind: DraftKind, reach: DraftReach) -> Self`. An empty draft following `kind`'s rules, closing within `reach`. - `pub fn kind(&self) -> DraftKind`. The rules this draft follows. - `pub fn set_reach(&mut self, reach: DraftReach)`. Changes the close radii; an open outline keeps its points. - `pub fn for_document(&mut self, key: u64) -> Option`. Records `key` as the active document's. An open outline begun under another key is - `pub fn press(&mut self, at: DraftPoint, has_selection: bool) -> Option`. The primary button went down at `at`; `has_selection` is whether the document has a - `pub fn drag(&mut self, at: DraftPoint) -> Option`. The pointer moved to `at` with the button down. Freehand and Mixed: the point is added - `pub fn hover(&mut self, at: DraftPoint) -> Option`. The pointer moved to `at` with the button up: only the rubber band follows (hover moves - `pub fn release(&mut self, at: DraftPoint) -> Option`. The primary button went up at `at`. Freehand: closes. Mixed: closes unless straight - `pub fn mods_changed(&mut self, mods: Mods) -> Option`. The held modifiers changed. Mixed only: ⌥ pressed after the press (or pressed again after - `pub fn retract(&mut self) -> Option`. Removes the last vertex while [`takes_retract`](Self::takes_retract); removing the only - `pub fn close(&mut self) -> Option`. Closes an open outline (Enter, a double-click): [`DraftEvent::Closed`] with 3 or more - `pub fn cancel(&mut self) -> Option`. Drops an open outline: [`DraftEvent::Cancelled`]; `None` with no outline. - `pub fn points(&self) -> &[Point]`. The outline's points so far, in document units; empty with no outline. - `pub fn straight(&self) -> &[usize]`. Indices into [`points`](Self::points) whose incoming segment is straight. - `pub fn rubber_band(&self) -> Option<[Point; 2]>`. The rubber band from the last vertex to the pointer while straight segments are on and - `pub fn is_open(&self) -> bool`. Whether an outline is open. - `pub fn is_down(&self) -> bool`. Whether the primary button is down on an open outline. - `pub fn takes_retract(&self) -> bool`. Whether [`retract`](Self::retract) acts: an outline is open and the button is up (between ## `craft_behavior::geometry::geom` Plane geometry the canvas overlays share, in document or screen units: segment clipping. Pure maths beside - `craft_behavior::geometry::geom::clip_segment`: `pub fn clip_segment(a: Point, b: Point, rect: Rect) -> Option<(Point, Point)>`. The part of segment `a`–`b` inside `rect` (Liang–Barsky), or `None` when none is. ## `craft_behavior::geometry::lock` Direction locking for ⇧ drags: [`Directions`], [`lock_direction`], [`round_to_direction`] and [`turn_to_45`]. - `craft_behavior::geometry::lock::Directions`: `pub enum Directions { Four, Eight }`. The directions ⇧ locks a move to. - `pub const fn count(self) -> u32`. How many evenly spaced directions: 4 or 8. - `craft_behavior::geometry::lock::LOCK_HYSTERESIS_DEGREES`: `pub const LOCK_HYSTERESIS_DEGREES: f64`. Extra angle in degrees the pointer must pass the half-way line between two directions by - `craft_behavior::geometry::lock::lock_direction`: `pub fn lock_direction(d: Vec2, previous: Option, directions: Directions) -> Vec2`. `d` locked to the nearest of `directions` evenly spaced directions (0° = right, document y - `craft_behavior::geometry::lock::round_to_direction`: `pub fn round_to_direction(angle: f64, directions: Directions) -> f64`. `angle` (radians, 0 = right, document y down) rounded to the nearest of `directions` evenly - `craft_behavior::geometry::lock::turn_to_45`: `pub fn turn_to_45(from: Point, point: Point) -> Point`. `point` turned about `from` to the nearest multiple of 45°, keeping its distance: the one ⇧ rule for a line, a ## `craft_behavior::geometry::marquee` The Ui-free rules of a marquee drag: [`MarqueeGesture`], the options bar's [`Constraint`], and the - `craft_behavior::geometry::marquee::Constraint`: `pub enum Constraint { Free, Ratio(f64, f64), Size(f64, f64) }`. The options bar's marquee style. Serialises camelCase (`"free"`, `{"ratio": [1, 1]}`, - `pub fn corners(self, start: Point, end: Point, square: bool, centre: bool) -> (Point, Point)`. The corners of the marquee dragged from `start` to `end`: the style applied, ⇧ (`square`) - `craft_behavior::geometry::marquee::MarqueeGesture`: `pub struct MarqueeGesture`. The rules of a marquee drag: ⇧ and ⌥ counted only when pressed after the - `pub fn press(screen: Pos2, at: Point, mods: Mods) -> Self`. A press at `screen` (screen points) and `at` (document units, snapped by the host) with - `pub fn pointer(&self) -> Pos2`. The pointer on screen as last followed. - `pub fn has_begun(&self) -> bool`. The tool began the gesture with its first drag call. - `pub fn follow(&mut self, screen: Option, mods: Mods)`. The pass's mods and pointer (`None` keeps the last one): records ⇧ and ⌥ being - `pub fn begin(&mut self) -> bool`. Begins the gesture: the tool calls it on its first `drag`, the press arena having separated the drag from a - `pub fn square_and_centre(&self) -> (bool, bool)`. ⇧ (square) and ⌥ (from the centre) for the marquee: held now, and either not held at the - `pub fn size_to(&mut self, at: Point, space: bool, constraint: Constraint) -> MarqueeRect`. Sizes the marquee to the pointer's document point `at` (the host's snap applied): with - `craft_behavior::geometry::marquee::MarqueeRect`: `pub struct MarqueeRect { pub a: Point, pub b: Point }`. The two corners of a marquee in document space, as dragged: not ordered, not rounded. - `pub const fn new(a: Point, b: Point) -> Self`. The marquee from the corner `a` to the corner `b`. - `pub fn rect(&self) -> Rect`. The rectangle between the corners, with `x0 <= x1` and `y0 <= y1`. - `craft_behavior::geometry::marquee::fixed_size_pixels`: `pub fn fixed_size_pixels(a: Point, b: Point, size:(f64, f64)) -> Rect`. The pixel rectangle of a fixed-size marquee between the corners `a` and `b`: exactly `size` - `craft_behavior::geometry::marquee::marquee_pixels`: `pub fn marquee_pixels(a: Point, b: Point) -> Rect`. The pixel rectangle a marquee between two corners selects: both edges snapped outwards to - `craft_behavior::geometry::marquee::square_pixels`: `pub fn square_pixels(r: Rect, start: Point, end: Point) -> Rect`. A square marquee's pixel rectangle `r`, as [`marquee_pixels`] returns it, with equal sides. ## `craft_behavior::geometry::move_gesture` A move by drag: direction lock, stroke lock and snapping along a ray. - `craft_behavior::geometry::move_gesture::ConstrainStyle`: `pub struct ConstrainStyle { pub copy_reach: f64, pub stroke_lock: f64 }`. The distances of the move and stroke rules, in screen points. - `pub const fn new(copy_reach: f64, stroke_lock: f64) -> Self`. A style with the two distances; a tool passes `ToolContext::slop` for both. - `craft_behavior::geometry::move_gesture::MoveGesture`: `pub struct MoveGesture`. A Move-tool drag in progress: the press, whether ⌥ was held at it, and the last locked - `pub fn press(style: &ConstrainStyle, start: Point, mods: Mods, directions: Directions) -> MoveGesture`. Starts a drag at `start` (document units) with the keys held at the press. - `pub fn follow(&mut self, at: Point, mods: Mods, zoom: f64) -> Option`. The pointer moved to `at` (document units) with `mods` at `zoom` screen points per - `pub fn release(mut self, at: Point, mods: Mods, zoom: f64) -> MoveValue`. The release at `at`: the same lock as [`follow`](Self::follow) applies, so a release where - `pub fn value(&self) -> MoveValue`. The value of the last [`follow`](Self::follow): the offset and whether it copies. - `pub fn locked(&self) -> Option`. The direction ⇧ holds the offset to, as the last locked offset; `None` while the move is free. - `craft_behavior::geometry::move_gesture::MoveValue`: `pub struct MoveValue { pub delta: Vec2, pub copy: bool }`. The value of a move drag. - `pub fn changed(&self) -> bool`. Whether the drag changes anything: an offset or a copy. A press and release without - `craft_behavior::geometry::move_gesture::StrokeLock`: `pub struct StrokeLock`. ⇧ during a painting stroke (every painting tool, the Freeform Pen; which tools is the app's - `pub fn new(style: &ConstrainStyle) -> Self`. No lock yet; `style` gives the screen distance before the direction locks. - `pub fn constrain(&mut self, last: Point, p: Point, shift: bool, zoom: f64) -> Point`. The stroke point for the pointer at `p` (document units), `last` the stroke's last point, - `pub fn locked(&self) -> bool`. Whether a direction is locked. - `pub fn reset(&mut self)`. Forget the lock (the stroke ended). ## `craft_behavior::geometry::quad` Box geometry of transform boxes: where the box goes when a part of it is dragged, and the - `craft_behavior::geometry::quad::BoxAllow`: `pub struct BoxAllow { pub rotate: bool, pub skew: bool, pub distort: bool }`. What the box's content allows. PhotoCraft: editable type refuses distort and perspective - `pub const fn new(rotate: bool, skew: bool, distort: bool) -> Self`. What the content allows: turning, skewing and distorting. - `craft_behavior::geometry::quad::BoxDrag`: `pub enum BoxDrag { Move, Pivot, Rotate, Scale, Distort, Perspective, Skew, SlideCorner }`. What a drag of a box part does ([`BoxRules::drag_kind`]). - `craft_behavior::geometry::quad::BoxPart`: `pub enum BoxPart { Corner(u8), Edge(u8), Pivot, Inside, Outside }`. A part of a box under the pointer or picked from the keyboard. Edge `k` joins corners `k` and - `pub const fn index(self) -> u64`. The number a part is keyed by in a canvas control's part keys: 0 inside or outside, 1 to 4 the corners, 5 to - `pub const fn from_index(index: u64) -> Option`. The part keyed by `index`: the inverse of [`index`](Self::index), with 0 the inside. - `craft_behavior::geometry::quad::BoxRules`: `pub struct BoxRules { pub mode: TransformMode, pub scale: ScaleRule, pub aspect_linked: bool, pub allow: BoxAllow, pub rotate_step: f64 }`. How drags change a box. - `pub fn in_mode(mode: TransformMode) -> BoxRules`. The rules of `mode` with the default scale rule, a linked aspect, everything allowed and - `pub fn with_scale(mut self, scale: ScaleRule) -> BoxRules`. The rules with `scale` as the plain corner and edge drag rule. - `pub fn with_aspect_linked(mut self, linked: bool) -> BoxRules`. The rules with the options bar's aspect link on or off. - `pub fn with_allow(mut self, allow: BoxAllow) -> BoxRules`. The rules with `allow` as what the content permits. - `pub fn effective_mode(&self) -> TransformMode`. The mode drags follow: a mode the content refuses scales as Free Transform does. - `pub fn allows(&self, part: BoxPart) -> bool`. Whether a drag of `part` changes the box: in Distort only the corners, the inside and the - `pub fn drag_kind(&self, part: BoxPart, mods: Mods) -> Option`. What a drag of `part` with `mods` held (as the host has them, before - `craft_behavior::geometry::quad::BoxState`: `pub struct BoxState { pub quad: [Point; 4], pub pivot: Point }`. A transform box: its four corners clockwise from the top left (as the box was before any - `pub const fn new(quad: [Point; 4], pivot: Point) -> Self`. A box with the corners `quad`, clockwise from the top left, and the reference point `pivot`. - `pub fn from_rect(r: Rect) -> Self`. The box of `r`, the reference point at its centre. - `pub fn moved(&self, by: Vec2) -> Self`. The box and its reference point moved by `by`. - `pub fn is_parallelogram(&self) -> bool`. Whether the box is still an affine image of its rect (opposite sides parallel), so W and H - `pub fn parts(&self, rect: Rect, skew_v: f64) -> Parts`. The box read as the options bar shows it, `rect` being the box before the transform and - `pub fn with_parts(&self, rect: Rect, skew_v: f64, mut to: Parts) -> Self`. The box with the options bar's fields set to `to`: W and H scale it along its own axes, the - `pub fn linked_scale(now:(f64, f64), axis: usize, typed: f64) -> (f64, f64)`. The signed factors `(w, h)` after the side on `axis` (0: W, 1: H) is set to `typed` with W - `pub fn point_at(&self, at: Anchor9) -> Point`. One of the box's nine points, through the box's own frame (a distorted box's centre is - `pub fn anchor_of_pivot(&self) -> Option`. The point of the nine the reference point is on, within 0.05 document units; `None` for a - `pub fn part_at(&self, p: Point, tol: f64) -> BoxPart`. The part at `p`: the nearest of the corners, edge midpoints and reference point within - `pub fn contains(&self, p: Point) -> bool`. Whether `p` is inside the box (even-odd, so a folded box has holes). - `pub fn angle(&self) -> f64`. The direction of the top edge in degrees, clockwise in document space (y down): the rotate - `pub fn scaled_about_pivot(&self, kx: f64, ky: f64) -> Self`. Scaled by `kx` and `ky` along the box's own axes about the reference point. A negative - `pub fn turned_about_pivot(&self, radians: f64) -> Self`. Turned by `radians` about the reference point. - `craft_behavior::geometry::quad::Homography`: `pub struct Homography`. A projective map of the plane: the unit square onto a box, so a box scales along its own axes - `pub fn from_rows(rows: [[f64; 3]; 3]) -> Homography`. The map with these rows of (x, y, w) coefficients, applied to (x, y, 1). - `pub fn row(&self, i: usize) -> [f64; 3]`. Row `i` (0 to 2) of the matrix: the coefficients of x, y and the constant. - `pub fn unit_to_quad(q: [Point; 4]) -> Option`. The map taking (0, 0), (1, 0), (1, 1), (0, 1) to `q`'s corners; `None` for a degenerate - `pub fn apply(&self, p: Point) -> Point`. `p` of the unit square, carried to the box. - `pub fn inverse(&self) -> Option`. The map back from the box to the unit square; `None` when the map is singular. - `craft_behavior::geometry::quad::Parts`: `pub struct Parts { pub w: f64, pub h: f64, pub angle: f64, pub skew_h: f64, pub skew_v: f64 }`. A box read as the options bar shows it: the starting rect scaled by `w` and `h`, skewed by - `pub const fn new(w: f64, h: f64, angle: f64, skew_h: f64, skew_v: f64) -> Self`. The readings: scale factors `w` and `h`, the `angle` in degrees and the two skews in degrees. - `craft_behavior::geometry::quad::SKEW_LIMIT`: `pub const SKEW_LIMIT: f64`. The skew fields' reach in degrees: a skew of ±90° would flatten the box (PhotoCraft's). - `craft_behavior::geometry::quad::ScaleRule`: `pub enum ScaleRule { Proportional, Free }`. What a plain corner or edge drag does. - `craft_behavior::geometry::quad::TransformMode`: `pub enum TransformMode { Free, Rotate, Skew, Distort, Perspective }`. Edit › Transform's modes. - `craft_behavior::geometry::quad::bisector`: `pub fn bisector(screen: &BoxState, i: usize) -> emath::Vec2`. Corner `i` of `screen`'s unit bisector, pointing into the box; zero for a collapsed corner. The - `craft_behavior::geometry::quad::drag`: `pub fn drag(start: &BoxState, last: &BoxState, part: BoxPart, from: Point, to: Point, mods: Mods, rules: &BoxRules) -> BoxState`. The box after dragging `part` from `from` to `to` (document points) with `mods` held, from the - `craft_behavior::geometry::quad::outset`: `pub fn outset(corners: &[emath::Pos2; 4], by: f32) -> [emath::Pos2; 4]`. The closed polygon `corners` moved `by` points outward, each corner along its mitre (kept ## `craft_behavior::geometry::selection_op` [`SelectionOperation`]: how a new selection combines with the current one. - `craft_behavior::geometry::selection_op::SelectionOperation`: `pub enum SelectionOperation { New, Add, Subtract, Intersect }`. How a selection made by a click or a drag combines with the current one: the rule the Channels - `pub const ALL: [SelectionOperation; 4]`. Every operation, in Photoshop's options-bar order. - `pub fn from_mods(mods: Mods) -> SelectionOperation`. The operation `mods` ask for: Shift and Alt `Intersect`, Shift `Add`, Alt `Subtract`, - `pub fn resolve(bar: SelectionOperation, mods: Mods, has_selection: bool) -> SelectionOperation`. The operation a selection tool's gesture uses (Photoshop's): the options bar's `bar`, - `pub fn badge(self) -> Option`. The badge beside the selection pointer: `Add` a plus, `Subtract` a minus, `Intersect` a - `pub const fn name(self) -> &'static str`. The operation's stable name for commands and settings: `"new"`, `"add"`, `"subtract"`, ## `craft_behavior::geometry::snap` [`SnapTargets`]: snapping (View › Snap / Snap To) and smart-guide geometry. - `craft_behavior::geometry::snap::SNAP_PX`: `pub const SNAP_PX: f64`. Screen points within which a position snaps (Photoshop). - `craft_behavior::geometry::snap::SnapGesture`: `pub enum SnapGesture { Point, Rect { at_press: Rect }, Axis { along: Axis } }`. How the host snaps a tool's pointer. - `pub const fn rect(at_press: Rect) -> Self`. A moving rectangle that was `at_press` when the gesture began. - `pub const fn axis(along: Axis) -> Self`. Only the coordinate across the lines that run `along` snaps: x for `Axis::Y`. - `craft_behavior::geometry::snap::SnapKind`: `pub enum SnapKind { Guide, Grid, Bounds, Center, LayerEdge, LayerCenter, Selection }`. What a target is, so an app can filter (Snap To › Guides only) and the lines can be drawn in - `craft_behavior::geometry::snap::SnapLine`: `pub struct SnapLine { pub along: Axis, pub position: f64, pub kind: SnapKind, pub span: Option<(f64, f64)> }`. The line the UI draws for a snap that happened. - `craft_behavior::geometry::snap::SnapOptions`: `pub struct SnapOptions { pub on: bool, pub guides: bool, pub grid: bool, pub layers: bool, pub document_bounds: bool, pub selection: bool, pub smart_guides: bool }`. View › Snap To and View › Show › Smart Guides, as the app stores them. - `craft_behavior::geometry::snap::SnapTarget`: `pub struct SnapTarget { pub along: Axis, pub position: f64, pub kind: SnapKind, pub span: Option<(f64, f64)> }`. One snap position on one axis. - `pub const fn new(along: Axis, position: f64, kind: SnapKind) -> Self`. A full-height line of `kind` running `along` an axis, at `position` across it: a line along `Axis::Y` - `craft_behavior::geometry::snap::SnapTargets`: `pub struct SnapTargets`. The snap targets of one gesture. - `pub fn new() -> Self`. No targets. - `pub fn add(&mut self, target: SnapTarget)`. Add one target. - `pub fn with_document(self, options: &SnapOptions, bounds: Rect, guides: impl IntoIterator, grid: Option<(Point, Vec2)>,) -> Self`. Guides as full-height targets, grid lines of `spacing` from `origin` over `bounds`, the - `pub fn filtered(&self, keep: impl Fn(SnapKind) -> bool) -> SnapTargets`. Only the targets `keep` accepts (Snap To with one kind off). - `pub fn is_empty(&self) -> bool`. Whether there is no target. - `pub fn nearest(&self, along: Axis, value: f64, tolerance: f64) -> Option`. The nearest target among the lines that run `along` an axis, within `tolerance` of `value` across them. - `pub fn snap_point(&self, point: Point, tolerance: f64) -> (Point, Vec)`. `point` snapped on each axis independently, with the lines to draw. - `pub fn snap_rect(&self, rect: Rect, tolerance: f64) -> (Vec2, Vec)`. The offset that moves `rect` so its nearest edge or centre meets a target on each axis, - `craft_behavior::geometry::snap::across_axis`: `pub const fn across_axis(along: Axis) -> Axis`. The axis across `along`: a line running along `Axis::Y` (vertical) is placed on `Axis::X`. - `craft_behavior::geometry::snap::coordinate_across`: `pub const fn coordinate_across(along: Axis, p: Point) -> f64`. The coordinate of `p` a line running `along` an axis is placed by: x for a line along `Axis::Y`. - `craft_behavior::geometry::snap::motion_across`: `pub fn motion_across(along: Axis) -> Vec2`. The document direction a line running `along` an axis moves in: x for a line along `Axis::Y`. A screen caller - `craft_behavior::geometry::snap::union`: `pub fn union(rects: impl IntoIterator) -> Option`. The bounding rectangle of `rects`, or `None` for none. ## `craft_behavior::grid` The `Grid` cursor: columns resolved from last pass's measurements, and the cell each child takes. - `craft_behavior::grid::GridCursor`: `pub struct GridCursor`. Hands out the cells of one `Grid` pass, row-major. Cells are placed from `last` pass's measurements; this - `pub fn new(flow: Flow, columns: &[ColumnWidth], gap: Vec2, last: &GridMeasure) -> Self`. A cursor over `columns` in `flow`'s rect, with `gap` between columns (x) and rows (y), placed by `last`. A - `pub fn sized_by_content(flow: Flow, columns: &[ColumnWidth], gap: Vec2, last: &GridMeasure) -> Self`. A cursor for a measuring run under a body sized from its content: each `Fill` column of `columns` is placed - `pub fn unbounded(flow: Flow, columns: &[ColumnWidth], gap: Vec2) -> Self`. A cursor for the sweep that asks each column for its least: every column but a `Fixed` one is placed as a - `pub fn each_alone(mut self) -> Self`. The cursor with each `Content` column measuring in the room the other columns leave at their least, whatever - `pub fn short(&self) -> bool`. Whether the columns, as this sweep measured them, do not fit beside each other: the columns that do not share - `pub fn cell(&mut self, size: Vec2) -> Rect`. The cell of the next child, whose measured size is `size`. - `pub fn room(&self) -> Vec2`. The room the next child measures in: as wide as its column, or for a `Content` column as wide as the columns - `pub fn region(&self) -> Rect`. The rect the next child measures and is placed in: from its column's start edge and its row's top, as large - `pub fn fill_room(&self) -> Vec2`. The room the next child fills when it fills its width: its column's width, which for a `Content` column is the - `pub fn in_content_column(&self) -> bool`. Whether the next child goes in a `Content` column. - `pub fn widen(&mut self, size: Vec2)`. The cell last placed measured `size` after all: its column and row record that, and a `Content` column offers - `pub fn measured(&self) -> &GridMeasure`. What this pass measured. - `craft_behavior::grid::GridMeasure`: `pub struct GridMeasure { pub columns: Vec, pub rows: Vec, pub least: Vec }`. What a `Grid` pass measured: the widest child per column and the tallest per row, and the least each column - `pub const fn new(columns: Vec, rows: Vec) -> Self`. A measurement of `columns` and `rows`. - `pub fn with_least(mut self, least: Vec) -> Self`. The measurement with the least width of each column. - `craft_behavior::grid::resolve_columns`: `pub fn resolve_columns(columns: &[ColumnWidth], content: &[f32], room: f32, gap: f32) -> Vec`. The width of each column in `room`: `Fixed` is the app's width, `Content` the widest child of last pass ## `craft_behavior::hit` Hit shapes, their priority and the arena's resolve rule (8.3). - `craft_behavior::hit::HitLevel`: `pub enum HitLevel { Background, Body, Edge, Handle }`. The tier of a shape inside one stack position; a higher level wins. - `craft_behavior::hit::HitPriority`: `pub struct HitPriority { pub level: HitLevel, pub sub: u8 }`. A part's rank among the shapes of its stack position: a node editor ranks port above wire above node body. - `pub const fn new(level: HitLevel, sub: u8) -> Self`. A priority at `level` and `sub`. - `pub const BODY: HitPriority`. The priority of a component body. - `craft_behavior::hit::HitShape`: `pub enum HitShape { Rect(Rect), Circle { center: Pos2, radius: f32 }, Segment { a: Pos2, b: Pos2 }, Polyline { points: Vec, closed: bool }, Polygon(Vec), OutsidePolygon { within: Rect, polygon: Vec } }`. The geometry a part registers: the shape painted is the shape hit. - `pub const fn circle(center: Pos2, radius: f32) -> Self`. A disc. - `pub const fn segment(a: Pos2, b: Pos2) -> Self`. A line segment. - `pub fn polyline(points: Vec, closed: bool) -> Self`. A chain of segments, closed when `closed`. - `pub fn outside_polygon(within: Rect, polygon: Vec) -> Self`. The part of `within` outside `polygon`. - `pub fn bounds(&self) -> Rect`. The smallest rectangle around the shape. - `pub fn hit(&self, point: Pos2) -> bool`. Whether `point` hits the shape. - `craft_behavior::hit::LINE_REACH`: `pub const LINE_REACH: f32`. How far from a line a point still hits it, in points. - `craft_behavior::hit::ResolveFor`: `pub enum ResolveFor { Press, Hover }`. What a resolution is for. - `craft_behavior::hit::Shape`: `pub struct Shape { pub shape: HitShape, pub sense: Sense, pub owner: O, pub part: Option, pub priority: HitPriority, pub position: u32, pub local: bool, pub min_across: f32 }`. One registered shape of the shape record: a root's, a member's or a part's. - `pub const fn new(shape: HitShape, sense: Sense, owner: O, part: Option, priority: HitPriority, position: u32) -> Self`. A shape of `owner` at stack `position`. - `pub const fn min_across(mut self, across: f32) -> Self`. The hit area is at least `across` points wide and high. - `pub const fn local(mut self, local: bool) -> Self`. The shape lies in the body layer's space. - `craft_behavior::hit::Winner`: `pub struct Winner { pub index: usize, pub owner: O, pub part: Option, pub sense: Sense, pub local: bool }`. The shape that won a resolution. - `craft_behavior::hit::resolve`: `pub fn resolve(shapes: &[Shape], point: Pos2, what: ResolveFor) -> Option>`. The winner among `shapes` at `point`: stack position first, then level, sub-level, the nearest centre, the last - `craft_behavior::hit::resolve_mapped`: `pub fn resolve_mapped(shapes: &[Shape], point: Pos2, what: ResolveFor, to_local: impl Fn(Pos2) -> Pos2) -> Option>`. [`resolve`] where shapes with `local` set are tested at `to_local(point)`. ## `craft_behavior::input` What a component takes from the user, which decides its default key use. - `craft_behavior::input::Input`: `pub enum Input { Pointer, Text, Display, Editor }`. The input a component takes. ## `craft_behavior::intent` Intents: a key, an AccessKit action or typed text turned into meaning (spec 9.2). - `craft_behavior::intent::AccessRequest`: `pub struct AccessRequest { pub action: accesskit::Action, pub target: Option, pub data: Option }`. An AccessKit action with no intent of its own, or any action on a non-focusable sub-node. - `pub const fn new(action: accesskit::Action, target: Option, data: Option) -> Self`. A request for `action` on `target`. - `craft_behavior::intent::EditCommand`: `pub enum EditCommand { Cut, Copy, Paste, SelectAll, Undo, Redo }`. An edit command a component lists in its `KeyUse` to receive it as `Intent::Edit`. - `craft_behavior::intent::Granularity`: `pub enum Granularity { Unit, Word, Line, Paragraph, Document }`. How far a move reaches. - `craft_behavior::intent::Intent`: `pub enum Intent { Activate, Submit, SubmitForce, Cancel, Move(NavMove, MoveMods), Delete { forward: bool, by: Granularity, shift: bool }, Space, TogglePick, Digit(u8), Rename, ContextMenu, Reset, Text(Arc), Tab, Edit(EditCommand), SwitchPage { forward: bool }, MoveItem { front: bool, all_the_way: bool }, Open, Close, Access(AccessRequest) }`. What the runtime routes to a focused component. - `pub const fn delete(forward: bool, by: Granularity) -> Intent`. `Delete` of `by`, forward or back. - `pub const fn switch_page(forward: bool) -> Intent`. `SwitchPage` to the next page when `forward`. - `pub const fn move_item(front: bool, all_the_way: bool) -> Intent`. `MoveItem` toward the front when `front`, all the way when `all_the_way`. - `pub fn same_kind(&self, other: &Intent) -> bool`. Whether `self` and `other` are the same kind of intent, whatever their data. - `craft_behavior::intent::MoveMods`: `pub struct MoveMods { pub extend: bool, pub lead: bool, pub by: Granularity, pub fine: bool }`. The modifiers of a move, read from the key table. - `pub const PLAIN: MoveMods`. A move by one unit with no modifier. - `pub const fn new(extend: bool, lead: bool, by: Granularity) -> MoveMods`. Modifiers with the given parts and no fine flag. - `pub const fn fine(mut self, on: bool) -> MoveMods`. The same modifiers with the fine flag set to `on`. - `craft_behavior::intent::NavMove`: `pub enum NavMove { Back, Forward, Up, Down, PageUp, PageDown, Start, End }`. A logical move. `Back` and `Forward` follow the reading direction; the runtime flips physical arrows - `craft_behavior::intent::TextPos`: `pub struct TextPos { pub line: usize, pub byte: usize }`. A position in a text document. - `pub const fn new(line: usize, byte: usize) -> TextPos`. The position `byte` bytes into `line`. ## `craft_behavior::item_layout` Item geometry: where each item of a collection sits for a scroll offset and viewport. - `craft_behavior::item_layout::FreeLayout`: `pub struct FreeLayout { pub rects: Vec }`. Items at positions the document stores: a freeform bin or a node graph. - `pub fn new(rects: Vec) -> Self`. Items at `rects`, in content coordinates. - `craft_behavior::item_layout::ItemLayout`: `pub trait ItemLayout`. Item geometry in content units. Offsets are `f64`, so a sheet of a million rows places its last row - `fn mirrors(&self) -> bool`. False for a layout whose positions are document data (`FreeLayout`); the item step then leaves them as given. - `fn content_size(&self) -> ScrollPos`. Finite and non-negative. - `fn visible(&self, offset: ScrollPos, view: Vec2, out: &mut Vec)`. The indices of the items that intersect a viewport of size `view` scrolled to `offset`, ascending. - `fn rect(&self, at: usize, offset: ScrollPos) -> Rect`. The rect of item `at`. - `fn hit(&self, point: Pos2, offset: ScrollPos) -> Option`. The item under `point`. - `fn nav(&self) -> NavShape`. How arrow keys move through the items. - `fn row_len(&self, _row: usize) -> Option`. `NavShape::RaggedGrid`: the number of items in `row`, rows holding consecutive items and a run of hidden items - `fn shown(&self, _at: usize) -> bool`. Whether item `at` takes a place in the layout; a hidden item (in a closed group) cannot take the lead. - `fn cells(&self, _at: usize, _offset: ScrollPos, _out: &mut Vec<(ColumnKey, Rect)>)`. The cells of item `at`, with their rects. - `fn grid(&self) -> Option<&GridView>`. Column virtualisation and sections of a sheet. - `fn frozen_band(&self, _at: usize) -> f32`. The height at the top of the view that item `at` must not paint into: the zoomed frozen-row band for a scrolled - `fn first_navigable(&self) -> usize`. The first item that is not frozen: where Ctrl or Cmd with Home goes. Zero for a layout without frozen rows. - `fn set_columns(&mut self, _columns: &[(ColumnKey, f32)])`. The column widths the collection resolved, from the start edge; layouts without columns ignore them. - `fn column_count(&self) -> usize`. The number of columns of a table or sheet; 0 for a layout with none. - `fn column_shown(&self, _index: usize) -> bool`. Whether the column at position `index` is shown; a hidden column has no cell and the arrows skip it. - `fn column_key(&self, _index: usize) -> Option`. The key of the column at position `index`. - `fn column_at(&self, _point: Pos2, _offset: ScrollPos) -> Option`. The position of the column under `point`. - `fn is_auto(&self, _at: usize) -> bool`. Whether item `at` is as tall as it measures itself. - `fn measured(&mut self, _heights: &dyn Fn(usize) -> Option)`. Takes the measured heights of the auto items: `heights(at)` is `None` before the item's first measure. - `fn set_height(&mut self, _at: usize, _height: f32)`. An auto item measured `height` in this pass; the items after it move. - `fn auto_widths(&self) -> bool`. Whether the items are as wide as they measure themselves. A layout that asks for widths places the items - `fn set_width(&mut self, _at: usize, _ideal: f32, _min: f32)`. An auto-width item measured `ideal` and `min` width. The values of the previous pass arrive before - `fn set_view(&mut self, _viewport: Vec2, _offset: ScrollPos)`. The viewport and scroll offset the grid view describes. Layouts without a grid ignore it. - `craft_behavior::item_layout::LineIndex`: `pub struct LineIndex`. Lines (rows or columns) with a default size, the lines whose size differs and their prefix sums, so the start - `pub fn uniform(size: f32, count: u32) -> Self`. `count` lines of `size` each (negative or NaN sizes count as `0.0`). - `pub fn set(&mut self, line: u32, size: f32)`. Gives `line` the size `size`; the lines after it move. A line at or past `count` is ignored. - `pub fn start(&self, line: u32) -> f64`. The start of `line`: the sum of the sizes before it. A line past the last one continues at the default size. - `pub fn end(&self, line: u32) -> f64`. The end of `line`: its start plus its size. - `pub fn shown(&self, line: u32) -> bool`. Whether `line` exists and has a size above zero. - `pub fn count(&self) -> u32`. The number of lines. - `pub fn total(&self) -> f64`. The sum of all sizes: where the line after the last would start. - `craft_behavior::item_layout::SHEET_ZOOM`: `pub const SHEET_ZOOM: RangeInclusive`. The least and greatest zoom of a sheet (10 %…400 %). - `craft_behavior::item_layout::SheetLayout`: `pub struct SheetLayout`. Rows of a sheet: one position per row, each split into the sheet's columns, over one [`LineIndex`] for the rows - `pub fn new(source: &dyn DisplayOrder, row_h: f32, columns: Vec<(ColumnKey, f32)>) -> Self`. A row of `row_h` per entry of `source`, split into `columns`, each with its key and width. - `pub fn lines(rows: LineIndex, columns: LineIndex) -> Self`. A sheet with the size of every row and column in `rows` and `columns`, at 100 % zoom. A column's key is - `pub fn frozen(mut self, count: usize) -> Self`. The first `count` columns stay in view while the others scroll. - `pub fn frozen_rows(mut self, count: u32) -> Self`. The first `count` rows stay in view while the others scroll. Hidden rows among them take no room. - `pub fn zoom(mut self, zoom: f32) -> Self`. Every row height and column width is multiplied by `zoom`, clamped to [`SHEET_ZOOM`]. - `pub fn rows(&self) -> &LineIndex`. The row extents at 100 %. - `pub fn columns(&self) -> &LineIndex`. The column extents at 100 %. - `craft_behavior::item_layout::SpanLayout`: `pub struct SpanLayout { pub row_h: f32, pub count: usize, pub width: f32, pub columns: Vec<(ColumnKey, f32)>, pub tree: bool }`. Rows of equal height, optionally split into columns: lists, popup lists, tab strips and timeline tracks. - `pub fn new(source: &dyn DisplayOrder, width: f32, row_h: f32) -> Self`. One row of `row_h` per entry of `source`, `width` wide, with no columns. - `pub fn sized(source: &dyn ItemSource, width: f32, row_h: f32) -> Self`. Rows as tall as `source` says: `Height` and `Rect` are the app's, `Aspect` follows the width, and `Auto` - `pub fn columns(mut self, columns: Vec<(ColumnKey, f32)>) -> Self`. The columns with their widths, from the start edge. - `pub fn tree(mut self) -> Self`. Rows that expand and collapse. - `craft_behavior::item_layout::TileLayout`: `pub struct TileLayout { pub tile: Vec2, pub gap: f32, pub count: usize, pub width: f32, pub fixed_columns: Option }`. Equal tiles that wrap at the width: tile grids, preset grids, font cards and swatch grids. - `pub fn new(source: &dyn DisplayOrder, width: f32, tile: Vec2, gap: f32) -> Self`. One tile of `tile` per entry of `source`, `gap` apart, wrapping at `width`. - `pub fn in_columns(mut self, columns: usize) -> Self`. Exactly `columns` tiles per row, whatever the width (a user setting; at least one). - `pub fn columns(&self) -> usize`. Tiles per row: the user's count, else what the width allows; at least one. ## `craft_behavior::item_marquee` `MarqueeSelect`: the rectangle a drag over list items sweeps and the selection it makes (8.7). - `craft_behavior::item_marquee::MarqueeMode`: `pub enum MarqueeMode { Replace, Add, Toggle, Subtract }`. How the swept items combine with the selection the drag started from. Items follow the list rule (Cmd or Ctrl - `pub const fn of(mods: Mods) -> MarqueeMode`. The mode a press with `mods` starts: Shift adds, Cmd or Ctrl toggles, Alt subtracts, none replaces. - `craft_behavior::item_marquee::MarqueeSelect`: `pub struct MarqueeSelect`. A marquee drag in progress. It holds the selection the drag started from, so a cancel restores it. - `pub fn begin(origin: Pos2, mods: Mods, base: Vec) -> Self`. A marquee that began at `origin` over `base`, in the mode `mods` pick. - `pub fn mode(&self) -> MarqueeMode`. The mode the drag runs in. - `pub fn update(&mut self, pos: Pos2)`. Moves the free corner to `pos`. - `pub fn rect(&self) -> Rect`. The swept rectangle. - `pub fn selection(&self, items: impl IntoIterator) -> Vec`. The selection while the marquee is live, from the items `items` (key and rect) it sweeps. - `pub fn cancel(self) -> Vec`. Ends the drag with Escape: the selection it started from. ## `craft_behavior::item_source` Where a collection's items come from: the data traits and the one way to show a slice. - `craft_behavior::item_source::DisplayOrder`: `pub trait DisplayOrder`. The order a collection shows its entries in. The library never owns the data. - `fn len(&self) -> usize`. The number of entries. - `fn key(&self, at: usize) -> K`. The key of entry `at`. Items take their id from it, never from the position. - `fn index_of(&self, key: &K) -> Option where K: PartialEq,`. The position of `key`, `None` when the source no longer holds it. The default scans; a source over a - `fn depth(&self, _at: usize) -> usize`. The nesting depth of entry `at`, 0 for a root. - `fn has_children(&self, _at: usize) -> bool`. Whether entry `at` has children. - `fn open(&self, _at: usize) -> bool`. Whether the children of entry `at` show. - `fn is_section(&self, _at: usize) -> bool`. Whether entry `at` is a section header, which navigation skips. - `fn section_stop(&self, _at: usize) -> bool`. Whether section `at` is a stop of navigation: it holds the lead, takes Enter, the context-menu key and a - `fn section_stops_before(&self, _at: usize) -> usize`. How many section stops (`section_stop`) come before entry `at`. They are not members of the set of items, so - `fn enabled(&self, _at: usize) -> bool`. Whether entry `at` can take the lead. - `fn text(&self, _at: usize) -> Option>`. The text type-ahead matches entry `at` against. - `fn revision(&self) -> Option`. A number that changes whenever the entries or their order change; `None` when the source does not report. - `fn is_empty(&self) -> bool`. Whether there are no entries. - `craft_behavior::item_source::ItemSource`: `pub trait ItemSource: DisplayOrder`. A display order that also says how tall its entries want to be. - `fn size_hint(&self, _at: usize) -> SizeHint`. The size entry `at` wants. - `fn toggled(&self, _at: usize, _column: &ColumnKey) -> bool`. Whether the cell of entry `at` in the toggle column `column` is on. - `fn toggle_enabled(&self, _at: usize, _column: &ColumnKey) -> bool`. Whether the cell of entry `at` in the toggle column `column` can be flipped: a locked field's cell shows its - `craft_behavior::item_source::Keyed`: `pub struct Keyed<'a, T, K>`. A slice as an item source, each entry keyed by `key`. - `pub fn with_text(mut self, text: impl for<'t> Fn(&'t T) -> Cow<'t, str> + 'a) -> Self`. The text type-ahead matches each entry against. - `pub fn with_toggled(mut self, toggled: impl Fn(&T, &ColumnKey) -> bool + 'a) -> Self`. Whether an entry's cell in a toggle column is on. Without it every toggle cell is off. - `craft_behavior::item_source::Outline`: `pub struct Outline<'a, K>`. `DisplayOrder` as the key-free outline the navigation core steps over. - `pub fn new(order: &'a dyn DisplayOrder) -> Self`. The outline of `order`. - `pub fn columns(mut self, columns: usize) -> Self`. The cells of every position, for a sheet's cell navigation. - `craft_behavior::item_source::SizeHint`: `pub enum SizeHint { Auto, Height(f32), Aspect(f32), Rect(Vec2) }`. How tall (or what shape) an item wants to be. - `craft_behavior::item_source::keyed`: `pub fn keyed<'a, T, K>(items: &'a [T], key: impl Fn(&T) -> K + 'a) -> Keyed<'a, T, K>`. Shows `items` keyed by `key`: the one way to show a slice (7.1 rule 4). ## `craft_behavior::keys` The key table (spec 9.2): the one place that maps a key press to an intent and modifiers to `MoveMods`. - `craft_behavior::keys::DropOperation`: `pub enum DropOperation { Move, Copy, Link }`. What a drop of a dragged payload does with it. - `craft_behavior::keys::KeyRole`: `pub struct KeyRole { pub resettable: bool, pub space: bool, pub multi_select: bool, pub reorderable: bool, pub rename: bool, pub pages: bool, pub nudge: bool, pub document: bool, pub type_ahead: bool, pub digits: bool, pub value: bool, pub text: bool, pub moves: bool, pub deletes: bool, pub stacked: bool, pub owner_arrows: bool, pub home_row: usize }`. What the focused stop is, as far as the table's rows differ. - `pub const fn new() -> KeyRole`. A role with no special rows. - `pub const fn resettable(mut self, on: bool) -> Self`. Delete resets the control. - `pub const fn space(mut self, on: bool) -> Self`. Space is the component's own intent. - `pub const fn multi_select(mut self, on: bool) -> Self`. Ctrl+Space toggles the lead's pick. - `pub const fn reorderable(mut self, on: bool) -> Self`. The stacking keys move the selected items. - `pub const fn rename(mut self, on: bool) -> Self`. Rename has its key. - `pub const fn pages(mut self, on: bool) -> Self`. Ctrl+Tab switches pages. - `pub const fn nudge(mut self, on: bool) -> Self`. Arrows are nudges, not moves. - `pub const fn document(mut self, on: bool) -> Self`. Cmd (Ctrl off macOS) turns the page moves sideways: a document canvas. - `pub const fn type_ahead(mut self, on: bool) -> Self`. Typed letters are delivered as text. - `pub const fn digits(mut self, on: bool) -> Self`. Typed digits are delivered as digits. - `pub const fn value(mut self, on: bool) -> Self`. Alt with an arrow is a fine move. - `pub const fn moves(mut self, on: bool) -> Self`. The component acts on the moves routed to it. - `pub const fn deletes(mut self, on: bool) -> Self`. Delete and Backspace are the component's own. - `pub const fn stacked(mut self, on: bool) -> Self`. Shift with Left or Right is no move. - `pub const fn owner_arrows(mut self, on: bool) -> Self`. The arrow keys are the enclosing component's, not this role's moves. - `pub const fn home_row(mut self, row: usize) -> Self`. Ctrl or Cmd with Home goes to item `row`. - `pub const fn text(mut self, on: bool) -> Self`. The stop is a text part. - `craft_behavior::keys::REORDER_KEYS`: `pub const REORDER_KEYS: [Chord; 6]`. The stacking keys (Photoshop's Bring Forward and Send Backward): Cmd+] moves the selected items one place toward the - `craft_behavior::keys::drop_operation`: `pub fn drop_operation(os: Os, mods: Mods) -> DropOperation`. The drop operation the held modifiers pick. - `craft_behavior::keys::intent`: `pub fn intent(os: Os, key: Key, mods: Mods, role: KeyRole) -> Option`. The intent a key press has for a stop of `role`, if any. `Enter` and `Space` as activation are not rows: - `craft_behavior::keys::reorder_intent`: `pub fn reorder_intent(key: Key, mods: Mods) -> Option`. The `Intent::MoveItem` a stacking key asks for, `None` for any other press. - `craft_behavior::keys::split_digits`: `pub fn split_digits(text: &str) -> (Vec, String)`. Typed `text` split for a role that takes digits: the ASCII digits it holds, in order, and the text without them. - `craft_behavior::keys::toward_end`: `pub fn toward_end(front: bool, axis: Axis) -> bool`. Whether a move toward the front goes toward the end of an order laid out along `axis`. The front of a vertical ## `craft_behavior::label_column` `LabelColumn`: label-then-control geometry for one row. - `craft_behavior::label_column::LabelColumn`: `pub struct LabelColumn { pub width: f32, pub stack_below: f32, pub gap: f32 }`. The label column of a row: a width token, and the row width under which the label moves above the control. - `pub const fn new(width: f32, stack_below: f32, gap: f32) -> Self`. A column `width` wide that stacks below `stack_below`, with `gap` between label and control. - `pub fn place(&self, flow: Flow, label: Vec2, label_baseline: f32, control_baseline: Option) -> LabelPlacement`. Places a label of `label` size whose baseline is `label_baseline` below its top, and the control in the - `craft_behavior::label_column::LabelPlacement`: `pub struct LabelPlacement { pub label: Rect, pub control: Rect, pub stacked: bool }`. What `LabelColumn::place` decided for one row. ## `craft_behavior::layout_memory` The tolerance rule of layout memory: when a measured size asks for a discard pass. - `craft_behavior::layout_memory::SizeTween`: `pub struct SizeTween { pub from: Vec2, pub to: Vec2, pub start: f64, pub duration: f64 }`. A size that moves from one value to another over a duration, evaluated at the reader's clock. - `pub const fn new(from: Vec2, to: Vec2, start: f64, duration: f64) -> Self`. A tween from `from` to `to` that begins at `start` and runs for `duration`. - `pub fn at(&self, now: f64) -> Vec2`. The size at clock reading `now`, eased in and out. - `pub fn is_done(&self, now: f64) -> bool`. Whether the tween has reached its end at `now`. - `craft_behavior::layout_memory::measure_tolerance`: `pub fn measure_tolerance(pixels_per_point: f32) -> f32`. The tolerance in points under which a measured size equals the one placement used: half a physical pixel. - `craft_behavior::layout_memory::measured_change_asks_for_discard`: `pub fn measured_change_asks_for_discard(recorded: Option, real: Vec2, changed_last_frame: bool, tolerance: f32) -> bool`. Whether a measured size asks for a discard pass. `recorded` is the size placement used this frame ## `craft_behavior::monitor` The connected monitors, as every window placement reads them. - `craft_behavior::monitor::Monitor`: `pub struct Monitor { pub key: MonitorKey, pub pos_px: [i32; 2], pub size_px: [u32; 2], pub scale: f32, pub work_px: Option<([i32; 2], [u32; 2])> }`. A connected monitor, in physical pixels of the desktop's coordinate space (negative for a monitor left of or - `pub fn new(key: MonitorKey, pos_px: [i32; 2], size_px: [u32; 2], scale: f32) -> Self`. A monitor at `pos_px` of `size_px` pixels with `scale`, usable in full. - `pub fn with_work_px(mut self, pos_px: [i32; 2], size_px: [u32; 2]) -> Self`. Sets the usable area (see [`work_px`](Self::work_px)). - `pub fn rect_px(&self) -> Rect`. The monitor's area in pixels. - `pub fn points_at(&self, window_scale: f32) -> Rect`. The monitor's area in points of a window whose scale is `window_scale`. Monitors that touch in pixels touch - `craft_behavior::monitor::MonitorKey`: `pub struct MonitorKey { pub name: String, pub size_px: [u32; 2] }`. Identifies a monitor across launches: the name the platform reports and its size in pixels. - `pub fn new(name: impl Into, size_px: [u32; 2]) -> Self`. A key for the monitor called `name` with size `size_px`. ## `craft_behavior::motion` The motion level an animation runs at. - `craft_behavior::motion::MotionKind`: `pub enum MotionKind { Fade, Travel, Loop, Blink }`. What an animation is: the kind picks its row of the motion table. - `craft_behavior::motion::MotionMode`: `pub enum MotionMode { Full, Reduced, Off }`. How much motion the interface shows. - `pub const fn playback(self, kind: MotionKind) -> Playback`. What an animation of `kind` does at this mode (the motion table, 13.2). - `pub const fn lowered_by(self, scope: MotionMode) -> MotionMode`. The lower of two modes: a scope can lower the motion mode, never raise it. - `craft_behavior::motion::Playback`: `pub enum Playback { Run, Snap, Still, Solid }`. What an animation does under a mode. ## `craft_behavior::nav` The navigation core (spec 9.5): shapes, the key-free outline, stepping, roving groups, type-ahead and - `craft_behavior::nav::Arrows`: `pub enum Arrows { All, Horizontal, Vertical, None }`. Which arrow keys a roving group moves its lead with. - `craft_behavior::nav::LARGE_STEPS`: `pub const LARGE_STEPS: f64`. How many small steps one large step is, when a control sets no large step of its own. - `craft_behavior::nav::Letters`: `pub enum Letters { None, TypeAhead }`. Whether a roving group matches typed letters to entries. - `craft_behavior::nav::NavOutline`: `pub trait NavOutline`. Positions, not keys: the key-free part of `DisplayOrder`. - `fn len(&self) -> usize`. The number of positions. - `fn depth(&self, at: usize) -> usize`. The nesting depth of the position, 0 for a root. - `fn has_children(&self, at: usize) -> bool`. Whether the position has children. - `fn open(&self, at: usize) -> bool`. Whether the position's children show. - `fn is_section(&self, at: usize) -> bool`. Whether the position is a section header, which a move skips. - `fn enabled(&self, at: usize) -> bool`. Whether the position can take the lead. - `fn row_len(&self, _row: usize) -> Option`. `RaggedGrid`: the number of positions in `row`; rows hold consecutive positions. `None` past the last row. - `fn columns(&self) -> usize`. `Cell`: the cells of every position (a row of a sheet). - `fn first_column(&self) -> Option`. `WrappedGrid`: the column of position 0 when the grid has blank cells before it (the leading days of a - `fn rect(&self, _at: usize) -> Option`. `Spatial`: where the position sits, in any one coordinate space. - `fn is_empty(&self) -> bool`. Whether there are no positions. - `craft_behavior::nav::NavShape`: `pub enum NavShape { Flat, Tree, WrappedGrid { columns: usize }, BoundedGrid { columns: usize }, RaggedGrid, Cell, Spatial }`. The geometry a collection's keyboard navigation follows. - `pub const fn wrapped_grid(columns: usize) -> Self`. Equal-width cells that wrap at `columns`. - `pub const fn bounded_grid(columns: usize) -> Self`. Equal-width cells in `columns` columns whose Left and Right stop at the row ends. - `craft_behavior::nav::NavState`: `pub struct NavState { pub lead: Option, pub anchor: Option, pub page: usize, pub wrap: bool, pub column: usize }`. Where a navigation stands between moves. - `pub const fn new() -> Self`. A state with no lead, a page of ten and no wrap. - `pub const fn at(lead: usize) -> Self`. A state at `lead`. - `pub const fn page(mut self, rows: usize) -> Self`. Sets the page size. - `pub const fn wrap(mut self, on: bool) -> Self`. Sets whether moves wrap. - `pub const fn column(mut self, column: usize) -> Self`. Sets the lead cell's column. - `craft_behavior::nav::NavStep`: `pub enum NavStep { Stay, Moved(usize), Expand(usize), Collapse(usize), Column(usize), Unhandled }`. What one move did. - `craft_behavior::nav::Roving`: `pub struct Roving { pub shape: NavShape, pub wrap: bool, pub home_end: bool, pub page: Option, pub letters: Letters, pub arrows: Arrows, pub first_column: Option, pub hands_back: bool, pub no_lead: bool, pub keeps_lead_moves: bool }`. A roving group's rules: one Tab stop whose members take moves. - `pub const fn new(shape: NavShape) -> Roving`. A group of `shape` with Home and End, no wrap, no paging and no letters. - `pub const fn wrap(mut self, on: bool) -> Self`. Whether moves wrap. - `pub const fn home_end(mut self, on: bool) -> Self`. Whether Home and End move to the ends. - `pub const fn page(mut self, rows: Option) -> Self`. Rows a Page key covers. - `pub const fn letters(mut self, letters: Letters) -> Self`. Whether letters pick entries. - `pub const fn arrows(mut self, arrows: Arrows) -> Self`. The arrows the group takes. - `pub const fn first_column(mut self, column: usize) -> Self`. The column of the first member of a wrapped grid with `column` blank cells before it: Up and Down keep the - `pub const fn hands_back(mut self) -> Self`. A move the group cannot make reaches the owning component, which may page or change what the group shows. - `pub const fn keeps_lead_moves(mut self) -> Self`. Left and Right with the lead modifier reach the focused member. - `pub const fn no_lead(mut self, on: bool) -> Self`. Whether the focused member is no lead: the next move starts at an end, as from a group with no lead. - `pub const fn state(&self, lead: Option) -> NavState`. The state a step over this group starts from, at `lead`, or from no lead when the group has none. - `pub const fn takes(&self, mv: NavMove, mods: MoveMods) -> bool`. Whether the group handles `mv` with `mods`: Page moves only with a page size and without `lead` (on a document - `craft_behavior::nav::STEP_SHARE`: `pub const STEP_SHARE: f64`. The share of a value's span that one small step is, when a control sets no step. - `craft_behavior::nav::StepResult`: `pub enum StepResult { Set(f64), Ignored }`. What a single-value move does. - `craft_behavior::nav::TypeAhead`: `pub struct TypeAhead`. Typed letters of the last second as one prefix. - `pub const fn new() -> Self`. An empty buffer. - `pub fn push(&mut self, letter: char, now: f64) -> &str`. Adds `letter` typed at `now` seconds and returns the prefix. - `pub fn pick<'a>(prefix: &str, from: Option, len: usize, label: impl Fn(usize) -> std::borrow::Cow<'a, str>) -> Option`. The entry a prefix picks: the first match from the position after `from` (from `from` itself when the - `craft_behavior::nav::ValueAxes`: `pub enum ValueAxes { Horizontal, Vertical, Both }`. The axes a single-value control reads moves on. - `craft_behavior::nav::ValueSteps`: `pub struct ValueSteps { pub value: f64, pub min: f64, pub max: f64, pub small: f64, pub large: f64, pub fine: f64, pub notch: f64 }`. The value and steps of a single-value control. - `pub const fn new(value: f64, min: f64, max: f64, small: f64, large: f64) -> Self`. Steps over `min..=max` from `value`. The fine step is `small / LARGE_STEPS` and a wheel notch is `small`. - `pub const fn fine(mut self, fine: f64) -> Self`. The same steps with an Alt arrow of `fine`. - `pub const fn notch(mut self, notch: f64) -> Self`. The same steps with a wheel notch of `notch`. - `craft_behavior::nav::lead_step`: `pub const fn lead_step(mv: NavMove, mods: MoveMods) -> Option`. The step Left or Right with the lead modifier makes, physical as the arrows are: Ctrl+Left and Ctrl+Right (Back - `craft_behavior::nav::snap_to_step`: `pub fn snap_to_step(value: f64, step: f64, origin: f64, range: RangeInclusive) -> f64`. `value` clamped to `range`, then on the nearest of the stops `origin + k * step` and the ends of `range`; a tie - `craft_behavior::nav::step`: `pub fn step(shape: NavShape, outline: &dyn NavOutline, state: &mut NavState, mv: NavMove, mods: MoveMods) -> NavStep`. Steps the lead of a navigation of `shape` over `outline` by `mv`. `mods.extend` keeps the anchor at the - `craft_behavior::nav::step_until_changed`: `pub fn step_until_changed(from: T, step: impl Fn(T) -> T, same: impl Fn(T) -> bool) -> T`. The value `step` reaches from `from`, stepped again while a step still moves it and `same` says the value is the - `craft_behavior::nav::step_value`: `pub fn step_value(steps: &ValueSteps, axes: ValueAxes, mv: NavMove, mods: MoveMods) -> StepResult`. Maps a move to the new value of a slider, dial, rating, resize handle or colour pad. `Forward`, `Up` and - `craft_behavior::nav::wheel_step`: `pub fn wheel_step(steps: &ValueSteps, axes: ValueAxes, wheel: &Wheel, rtl: bool) -> StepResult`. Maps a wheel event to the new value of a single-value control: one `notch` per event, up for positive scroll. ## `craft_behavior::one_press` The one-press-per-pass rule: a pass carries at most one press, as its last pointer event. - `craft_behavior::one_press::split_after_first_press`: `pub fn split_after_first_press(mut events: Vec, is_press: impl Fn(&E) -> bool) -> (Vec, Vec)`. Splits `events` after the first press. The first part is what this pass receives, up to and including the ## `craft_behavior::overlay` `place`: where an overlay of a given content size goes around its anchor. - `craft_behavior::overlay::Align`: `pub enum Align { Start, Center, End }`. How the overlay lines up with the anchor along the edge it hangs from. - `craft_behavior::overlay::MinWidth`: `pub enum MinWidth { None, Anchor, Points(f32) }`. The narrowest an overlay may be. - `pub fn points(self, anchor_width: f32) -> f32`. The width in points, given the anchor's width. - `craft_behavior::overlay::PlaceRequest`: `pub struct PlaceRequest { pub anchor: Rect, pub size: Vec2, pub side: Side, pub align: Align, pub rtl: bool, pub gap: f32, pub min_width: MinWidth, pub bounds: Rect, pub kept: Option }`. What `place` reads. - `pub const fn new(anchor: Rect, size: Vec2, bounds: Rect) -> Self`. A request for `size` around `anchor` inside `bounds`: below, aligned to the start, no gap, free width. - `pub const fn size(mut self, size: Vec2) -> Self`. Sets the content size. - `pub const fn side(mut self, side: Side) -> Self`. Sets the preferred side. - `pub const fn align(mut self, align: Align) -> Self`. Sets the alignment. - `pub const fn rtl(mut self, rtl: bool) -> Self`. Sets the reading direction. - `pub const fn gap(mut self, gap: f32) -> Self`. Sets the gap. - `pub const fn min_width(mut self, min_width: MinWidth) -> Self`. Sets the narrowest width. - `pub const fn kept(mut self, side: Option) -> Self`. Keeps `side` instead of flipping. - `craft_behavior::overlay::Placement`: `pub struct Placement { pub rect: Rect, pub side: Side }`. Where `place` put the overlay. - `craft_behavior::overlay::Side`: `pub enum Side { Below, Above, Start, End }`. The side of the anchor an overlay prefers. `Start` and `End` follow the reading direction. - `craft_behavior::overlay::place`: `pub fn place(request: &PlaceRequest) -> Placement`. Places an overlay: the preferred side unless the other has more room and the content does not fit, shifted to ## `craft_behavior::part` Part keys and part references: the one name for a part in focus, style, results, sub-nodes and decision records. - `craft_behavior::part::PartKey`: `pub struct PartKey`. The key of a part, declared as a const by the component that owns it. - `pub const fn new(name: &'static str) -> PartKey`. A key named `name`; the name is unique within one component. - `pub const CELL: PartKey`. A cell of a sheet row: `CELL.at(column)`. The item step writes the cell's `SELECTED` and `LEAD` flags into - `pub const fn name(self) -> &'static str`. The name the key was declared with. - `pub const fn at(self, i: u64) -> PartRef`. One of a repeated part: `POINT.at(id)`. `i` is a stable sub-key, an entity id where the repeats - `craft_behavior::part::PartRef`: `pub struct PartRef { pub key: PartKey, pub index: Option }`. A part's key with an optional index. ## `craft_behavior::pixel_size` A size in whole pixels. - `craft_behavior::pixel_size::PixelSize`: `pub struct PixelSize { pub width: u32, pub height: u32 }`. The size of an image or document in whole pixels; `PixelSize::new` builds one. - `pub const fn new(width: u32, height: u32) -> Self`. A size of `width` by `height` pixels. ## `craft_behavior::placement` Where windows go on the desktop: where a saved window opens ([`place`]), which monitor a window is on, and where - `craft_behavior::placement::Defaults`: `pub struct Defaults { pub size: [f32; 2], pub min: [f32; 2], pub screen_room: [f32; 2], pub restore_fullscreen: bool, pub no_position: bool }`. What the app wants when nothing (usable) is saved, and how the platform behaves. - `pub fn new(size: [f32; 2], min: [f32; 2]) -> Self`. Defaults for a first window of `size` points and a minimum of `min` points. - `pub fn with_screen_room(mut self, room: [f32; 2]) -> Self`. Set the room a monitor loses to the taskbar, Dock or menu bar. - `pub fn with_restore_fullscreen(mut self, on: bool) -> Self`. Set whether full screen is restored. - `pub fn with_no_position(mut self, on: bool) -> Self`. Set whether the platform hides window positions. - `craft_behavior::placement::NormalRect`: `pub struct NormalRect { pub pos: [f32; 2], pub size: [f32; 2] }`. A rectangle in logical points at zoom 1: top-left corner and size. - `craft_behavior::placement::Placement`: `pub struct Placement { pub normal: NormalRect, pub position_px: Option<[i32; 2]>, pub scale: f32, pub zoom: f32, pub maximized: bool, pub fullscreen: bool, pub monitor: Option }`. What to remember about a window, and what [`place`] returns for the app to open it with. - `pub fn new(size: [f32; 2], scale: f32) -> Self`. A window of `size` points, position unknown, on a monitor of `scale`, not maximized. - `pub fn repaired(&self) -> Option`. The record with out-of-range numbers repaired, or `None` when its size is no size. - `pub fn position(&self) -> Option<[f32; 2]>`. The outer top-left corner in desktop points at the saved scale, where the position is known. - `craft_behavior::placement::cascade`: `pub fn cascade(previous: Rect, size: Vec2, bounds: Rect, step: f32) -> Rect`. Where a window of `size` opens after the one at `previous`: one `step` right and down. An axis on which that - `craft_behavior::placement::cascade_rects`: `pub fn cascade_rects(area: Rect, size: Vec2, n: usize, step: f32) -> Vec`. `n` windows of `size` in a cascade inside `area`: the first at its top left, each next one [`cascade`]d from the - `craft_behavior::placement::monitor_of`: `pub fn monitor_of(monitors: &[Monitor], window_px: Rect) -> Option<&Monitor>`. The monitor the window at `window_px` (desktop pixels) is on: the one showing most of it or, when none shows it, - `craft_behavior::placement::place`: `pub fn place(saved: Option<&Placement>, monitors: &[Monitor], home: Option, d: &Defaults) -> Placement`. Where a window opens: `saved` kept on a connected monitor, else the default size on `home` ## `craft_behavior::press` Pointer values and the press lifecycle (8.1, 8.2), egui-free: the runtime converts egui's events once per - `craft_behavior::press::Buttons`: `pub struct Buttons: u8 (flag set)`. The pointer buttons held. - `pub const fn of(button: PointerButton) -> Buttons`. The flag of one button. - `craft_behavior::press::MULTI_CLICK_TIME`: `pub const MULTI_CLICK_TIME: f64`. The longest gap between presses that still count as one multi-click, in seconds. - `craft_behavior::press::MultiTouch`: `pub struct MultiTouch { pub translation: Vec2, pub zoom: f32, pub rotation: f32, pub center: Pos2 }`. A two-finger gesture. - `pub const fn new(translation: Vec2, zoom: f32, rotation: f32, center: Pos2) -> Self`. A gesture around `center`. - `craft_behavior::press::PassInput`: `pub struct PassInput<'a> { pub events: &'a [PointerEvent], pub slop: f32, pub pos: Pos2, pub delta: Vec2, pub held: bool, pub cancel: Option }`. What the machine reads of one pass. - `pub const fn new(events: &'a [PointerEvent], slop: f32, pos: Pos2, held: bool) -> Self`. A pass with these events, no movement and no cancel. - `pub const fn delta(mut self, delta: Vec2) -> Self`. The pointer movement of the pass. - `pub const fn cancel(mut self, cancel: Option) -> Self`. A reason the captured press ends now. - `craft_behavior::press::PointerButton`: `pub enum PointerButton { Primary, Secondary, Middle, Extra1, Extra2 }`. A pointer button. - `craft_behavior::press::PointerEvent`: `pub enum PointerEvent { Moved(Pos2), Pressed { button: PointerButton, pos: Pos2, time: f64, clicks: u32 }, Released { button: PointerButton, pos: Pos2 }, Gone }`. A button event of one pass, in the order it arrived. The press lifecycle follows the primary button and the - `pub const fn pressed(pos: Pos2, time: f64, clicks: u32) -> Self`. The primary button going down at `pos`, `time`, as the `clicks`th press in a row. - `pub const fn released(pos: Pos2) -> Self`. The primary button going up at `pos`. - `pub const fn pressed_by(button: PointerButton, pos: Pos2, time: f64, clicks: u32) -> Self`. `button` going down at `pos`, `time`, as the `clicks`th press in a row. - `pub const fn released_by(button: PointerButton, pos: Pos2) -> Self`. `button` going up at `pos`. - `craft_behavior::press::PointerKind`: `pub enum PointerKind { Mouse, Pen, Touch }`. What kind of device the pointer is. - `craft_behavior::press::PointerSample`: `pub struct PointerSample { pub pressure: f32, pub tilt: [f32; 2], pub rotation: f32, pub eraser: bool }`. Pressure and tilt of the current contact. - `pub const fn new(pressure: f32) -> Self`. A sample with no tilt or rotation. - `craft_behavior::press::PressCancel`: `pub enum PressCancel { Escape, FocusLost, Disabled, Removed }`. Why a captured press ended without a release. - `craft_behavior::press::PressMachine`: `pub struct PressMachine`. The press lifecycle of one root: the press winner it picked, kept until release or cancel. - `pub const fn new() -> Self`. A machine with no press. - `pub fn target(&self) -> Option`. The target of the open press. - `pub fn button(&self) -> Option`. The button of the open press. - `pub fn dragging(&self) -> bool`. Whether a drag holds the pointer. - `pub fn step(&mut self, input: PassInput<'_>, mut pick: impl FnMut(Pos2) -> Option<(T, Sense)>) -> PressStep`. Runs one pass. `pick` chooses the press winner and what it senses at a press position; it returns `None` - `craft_behavior::press::PressPhase`: `pub enum PressPhase { Idle, Hover, Down { start: PressStart }, Held { start: PressStart }, DragStart { start: PressStart, pos: Pos2 }, Drag { start: PressStart, pos: Pos2, delta: Vec2 }, Release { start: PressStart, pos: Pos2, click: bool }, Cancel { start: PressStart, reason: PressCancel } }`. One part's press state in one pass. - `pub const fn is_press(&self) -> bool`. A press is in progress or just ended: not `Idle` or `Hover`. - `pub const fn start(&self) -> Option`. The press the phase belongs to. - `pub const fn button_down(&self) -> bool`. Whether the button is down: `Down`, `Held`, `DragStart` or `Drag`. - `pub const fn is_drag(&self) -> bool`. Whether the phase is a drag in progress. - `pub const fn is_click(&self) -> bool`. Whether the phase is a click: a release within slop. - `pub fn mapped(self, point: impl Fn(Pos2) -> Pos2, delta: impl Fn(Vec2) -> Vec2) -> PressPhase`. The phase with its positions mapped by `point` and its drag delta by `delta`, for a part whose space - `craft_behavior::press::PressStart`: `pub struct PressStart { pub origin: Pos2, pub button: PointerButton, pub time: f64, pub clicks: u32 }`. Where and when a press began. - `pub const fn new(origin: Pos2, button: PointerButton, time: f64, clicks: u32) -> Self`. A press of `button` at `origin`. - `craft_behavior::press::PressState`: `pub struct PressState { pub phase: PressPhase, pub mods: Mods, pub sample: Option, pub captured: bool }`. A part's phase, the modifiers held, the pen sample and whether it holds the pointer. - `pub const IDLE: PressState`. A part with no press history. - `pub const fn new(phase: PressPhase) -> Self`. A state in `phase` with no modifiers, sample or capture. - `pub const fn mods(mut self, mods: Mods) -> Self`. The modifiers held. - `pub const fn sample(mut self, sample: Option) -> Self`. The pen sample of the contact. - `pub const fn captured(mut self, captured: bool) -> Self`. Whether a drag holds the pointer. - `pub const fn double_pressed(&self) -> bool`. Whether the phase is the `Down` of the second press of a double click: true once, false while the button is - `craft_behavior::press::PressStep`: `pub struct PressStep { pub target: Option, pub phase: Option, pub dragging: bool, pub activated: Option }`. What one pass did to the press. - `craft_behavior::press::count_clicks`: `pub fn count_clicks(previous: Option<(Pos2, f64, u32)>, pos: Pos2, time: f64, slop: f32) -> u32`. The click count of a press at `pos` and `time`, given the previous press `(pos, time, clicks)`: one more when ## `craft_behavior::quantity` `quantity::Reader`: the one number and unit parser (18.3): locale digits, unit spellings, expressions and - `craft_behavior::quantity::Reader`: `pub struct Reader`. Reads numbers, expressions and unit quantities written in one locale. - `pub fn new() -> Self`. A reader for plain numbers written with `.` as the decimal separator. - `pub fn decimal(mut self, decimal: char) -> Self`. The decimal separator. - `pub fn group(mut self, group: char) -> Self`. The digit-group separator, which the reader skips between digits. - `pub fn unit(mut self, spelling: &str, factor: f64) -> Self`. A unit spelling (case-insensitive; letters or the symbols `%`, `°`, `×`) and its factor to the base unit. - `pub fn unit_tagged(mut self, spelling: &str, factor: f64, tag: u32) -> Self`. Like [`Reader::unit`], with a `tag` that [`Reader::read_tagged`] returns when the text names this spelling. - `pub fn decimal_separator(&self) -> char`. The decimal separator the reader reads and writes. - `pub fn read(&self, text: &str, start: Option) -> Result`. The value of `text`. `start` is the value relative input applies to. - `pub fn read_tagged(&self, text: &str, start: Option) -> Result<(f64, Option), NotAValue>`. The value of `text` and the tag of the unit its last quantity named (`None` for a bare number or an untagged - `craft_behavior::quantity::is_unit_spelling`: `pub fn is_unit_spelling(spelling: &str) -> bool`. Whether `spelling` can be registered with [`Reader::unit`]: letters and unit symbols only, so the reader can ## `craft_behavior::role_rule` `RoleRule`: the fields each AccessKit role requires (spec 12.3). - `craft_behavior::role_rule::GridFacts`: `pub struct GridFacts { pub row_index: bool, pub row_count: bool, pub column_index: bool, pub column_count: bool }`. Which of a grid node's indexes and counts it carries. - `pub const fn new() -> Self`. A node that carries none of them. - `pub const fn row_index(mut self, known: bool) -> Self`. The node knows its row index. - `pub const fn row_count(mut self, known: bool) -> Self`. The node knows the number of rows. - `pub const fn column_index(mut self, known: bool) -> Self`. The node knows its column index. - `pub const fn column_count(mut self, known: bool) -> Self`. The node knows the number of columns. - `craft_behavior::role_rule::RoleRule`: `pub struct RoleRule<'a> { pub role: Role, pub named: bool, pub range: Option<&'a RangeInclusive>, pub positioned: bool, pub leveled: bool, pub expanded: Option, pub controls: bool, pub grid: GridFacts }`. What a node carries, as far as the rules read it. - `pub const fn new(role: Role) -> Self`. A node of `role` that carries nothing yet. - `pub const fn range(mut self, range: Option<&'a RangeInclusive>) -> Self`. The node's numeric range. - `pub const fn positioned(mut self, positioned: bool) -> Self`. The node knows its place in a set. - `pub const fn leveled(mut self, leveled: bool) -> Self`. The node has a heading level or tree depth. - `pub const fn expanded(mut self, expanded: Option) -> Self`. The node's expanded state. - `pub const fn controls(mut self, controls: bool) -> Self`. The node controls another node. - `pub const fn grid(mut self, grid: GridFacts) -> Self`. The indexes and counts the node carries. - `craft_behavior::role_rule::is_checkable`: `pub fn is_checkable(role: Role) -> bool`. Roles that are checked or unchecked: a node of one always carries a toggled state. - `craft_behavior::role_rule::is_selectable`: `pub fn is_selectable(role: Role) -> bool`. Roles that are selected or not: a node of one always carries a selected state. - `craft_behavior::role_rule::role_violations`: `pub fn role_violations(rule: &RoleRule<'_>) -> Vec<&'static str>`. The rules `rule` breaks, each as a short phrase. ## `craft_behavior::scroll` Scroll positions and the range a scroll part shows. - `craft_behavior::scroll::ScrollPos`: `pub struct ScrollPos { pub x: f64, pub y: f64 }`. Offsets and extents in content units. They are `f64` so a sheet of a million rows scrolls exactly. - `craft_behavior::scroll::ScrollSpan`: `pub struct ScrollSpan { pub content: Range, pub visible: Range, pub resize_ends: bool }`. The range a scroll part shows. `content` is what the part's track stands for (it may start below zero - `pub const fn new(content: Range, visible: Range) -> ScrollSpan`. A span whose thumb ends do not resize. - `pub const fn resize_ends(mut self, on: bool) -> ScrollSpan`. Lets the thumb ends change the visible length. - `craft_behavior::scroll::drag`: `pub fn drag(span: &ScrollSpan, track: f32, min_thumb: f32, delta: f32) -> Range`. The visible range after the thumb moved `delta` points along the track, kept inside the content range. - `craft_behavior::scroll::jump`: `pub fn jump(span: &ScrollSpan, mv: NavMove) -> Option>`. The visible range after a navigation move that scrolls: a page up or down, or to the start or the end of the - `craft_behavior::scroll::page`: `pub fn page(span: &ScrollSpan, toward_end: bool) -> Range`. The visible range one visible length further toward the end (or the start), kept inside the content range. - `craft_behavior::scroll::thumb`: `pub fn thumb(span: &ScrollSpan, track: f32, min_thumb: f32) -> (f32, f32)`. The thumb of `span` on a track `track` points long: its start along the track and its length, at least ## `craft_behavior::selection` Selection models: what a collection's selection holds and how a change applies to it. - `craft_behavior::selection::CellAt`: `pub struct CellAt { pub row: K, pub column: u32 }`. A cell: its row key and its column position. `CellAt` is a cell by position. - `pub fn new(row: K, column: u32) -> Self`. The cell of `row` at column position `column`. - `craft_behavior::selection::CellRange`: `pub struct CellRange { pub first: K, pub last: K, pub columns: Range, pub lead_column: u32 }`. A rectangle of cells: the rows from `first` to `last` in the display order (either may come first), the column - `pub fn new(first: K, last: K, columns: Range, lead_column: u32) -> Self`. The cells of the rows from `first` to `last` in `columns`, with the lead cell in `lead_column`. A range has at - `pub fn cells(from: CellAt, to: CellAt) -> Self`. The rectangle from the anchor cell `from` to the lead cell `to`, whichever way round they lie. - `pub fn cell(c: CellAt) -> Self`. One cell. - `pub fn contains(&self, c: CellAt) -> bool`. Whether `c` lies in the range. - `pub fn rows(&self) -> RangeInclusive`. The rows the range spans. - `pub fn column_span(&self) -> RangeInclusive`. The columns the range spans. - `pub fn intersects(&self, other: &Self) -> bool`. Whether the two ranges share a cell. - `pub fn union(&self, other: &Self) -> Self`. The smallest range holding both. - `pub fn covering_merges(self, merges: &[CellRange]) -> Self`. The range grown until no merged cell (`merges`: each merge's range) crosses its edge, as Excel, InDesign and - `craft_behavior::selection::CellSelection`: `pub struct CellSelection`. The cell selection of a sheet or table: ranges of cells, the active cell, the anchor and the cells toggled - `pub fn ranges(&self) -> &[CellRange]`. The selected ranges, in the order they were added. - `pub fn current(&self) -> Option<&CellRange>`. The range Shift extends: the last one added, until Enter or Tab moves into another. - `pub fn active(&self) -> Option<&CellAt>`. The active cell: the one an entry goes into. - `pub fn anchor_cell(&self) -> Option<&CellAt>`. The cell of the current range that Shift extends from. - `pub fn toggled(&self) -> &[CellAt]`. The cells taken out of the ranges. - `pub fn cell(c: CellAt) -> Self`. One cell, active and the anchor. A cell inside a merge selects the merge through `select` instead. - `pub fn range(r: CellRange) -> Self`. One range with its first row and first column active and the anchor. - `pub fn from_ranges(ranges: Vec>, active: CellAt) -> Option`. Several ranges with `active` in the last one, which is the current range, and the anchor at `active`. `None` - `pub fn bounds(&self, space: &CellSpace<'_, K>) -> Option>`. The smallest range holding every selected range, by position; `None` for the empty selection. - `pub fn head(&self, space: &CellSpace<'_, K>) -> Option>`. The corner of the current range opposite the anchor: the end Shift+arrows move; `None` for the empty - `pub fn select(&mut self, c: CellAt, space: &CellSpace<'_, K>) -> bool`. A click, or an arrow's landing cell: `c` alone (its merged cell whole, the active cell at the merge's - `pub fn select_range(&mut self, range: CellRange, space: &CellSpace<'_, K>) -> bool`. A header click, a header drag or Select All: `range` alone, covered over merges unless it is whole lines - `pub fn extend_to(&mut self, c: CellAt, space: &CellSpace<'_, K>) -> bool`. Shift+click and a drag: the current range runs from the anchor to `c`, covered over merges; the active cell - `pub fn add(&mut self, c: CellAt, space: &CellSpace<'_, K>) -> bool`. Cmd+click (Ctrl+click) on a cell no range holds: a new range at `c` (its merged cell whole) after the others; - `pub fn add_range(&mut self, range: CellRange, space: &CellSpace<'_, K>) -> bool`. Cmd+click (Ctrl+click) on a row or column header: `range` joins as a new range after the others, covered over - `pub fn extend_current(&mut self, range: CellRange, space: &CellSpace<'_, K>) -> bool`. Shift+click on a header and a drag over the headers: the current range becomes `range`, covered as - `pub fn toggle(&mut self, c: CellAt, space: &CellSpace<'_, K>) -> bool`. Cmd+click (Ctrl+click) on any cell: a cell a range holds is taken out of the selection (and joins it again - `pub fn step(&mut self, direction: CellDirection, space: &CellSpace<'_, K>) -> bool`. An arrow: the selection collapses to the active cell's neighbour toward `direction` - `pub fn change(&self) -> SelectionChange`. The change that reports this selection: [`SelectionChange::Cells`] when one range says it (the anchor cell and - `craft_behavior::selection::RowAt`: `pub struct RowAt<'a, K> { pub key: &'a K, pub at: usize, pub order: &'a dyn DisplayOrder }`. A row as the item step reads it: its key, its position and the order that places other keys. A rectangle of - `pub fn new(key: &'a K, at: usize, order: &'a dyn DisplayOrder) -> Self`. The row `key` at position `at` of `order`. - `craft_behavior::selection::Selection`: `pub struct Selection { pub items: Vec, pub lead: Option, pub anchor: Option }`. A set of keys with a lead and an anchor. - `pub fn new(items: Vec, lead: Option, anchor: Option) -> Self`. A selection of `items` with `lead` and `anchor`. - `pub fn contains(&self, key: &K) -> bool`. Whether `key` is selected. - `pub fn single(key: K) -> Self`. A selection of `key` alone, which is also its lead and its anchor. - `craft_behavior::selection::SelectionChange`: `pub enum SelectionChange { Set(Vec), Toggle(K), Clear, Cells(CellRange), CellSet(Box>) }`. A change to a selection, as a collection reports it. - `craft_behavior::selection::SelectionModel`: `pub trait SelectionModel: Value + Default`. The selection a collection reads and the app owns. - `fn contains(&self, row: RowAt<'_, K>) -> bool`. Whether the row `row` is selected. - `fn lead(&self) -> Option<&K>`. The item keyboard navigation moves. - `fn anchor(&self) -> Option<&K>`. The fixed end of a range extended with Shift. - `fn apply(&mut self, change: SelectionChange)`. Applies a change. - `fn lead_column(&self) -> Option`. The column position of the lead cell; `None` for a model of rows. - `fn contains_cell(&self, row: RowAt<'_, K>, _column: u32) -> bool`. Whether the cell of row `row` in column position `column` is selected. - `fn cells(&self) -> Option<&CellSelection>`. The cell rules of a model of cells, which the item step runs on a copy over the collection's `CellSpace`; the - `fn placed(&self, order: &dyn DisplayOrder) -> PlacedSelection`. The selection by position in `order`, placed once so that the reads of a pass scan no keys. The default - `craft_behavior::selection::CellAdvance`: `pub enum CellAdvance { Enter, Tab }`. Which key moves the active cell after an entry: Enter goes down the rows, Tab along a row. - `craft_behavior::selection::CellDirection`: `pub enum CellDirection { Up, Down, Left, Right }`. A move of one cell. Logical: in a right-to-left sheet the widget maps the Left arrow to - `craft_behavior::selection::PlacedSelection`: `pub struct PlacedSelection`. The selected cells by position in one display order: the rows and columns of each range, and the cells taken out - `pub fn of_rows(spans: impl IntoIterator>) -> Self`. The selected rows `spans`, every column of each. - `pub fn of_cells(ranges: Vec<(Range, Range)>, mut removed: Vec<(usize, u32)>) -> Self`. The ranges `ranges` (row positions, column positions) without the cells `removed`. - `pub fn holds_row(&self, at: usize) -> bool`. Whether the row at position `at` has a selected cell. - `pub fn holds_cell(&self, at: usize, column: u32) -> bool`. Whether the cell at row position `at` and column position `column` is selected. - `pub fn rows(&self) -> Vec`. The positions of the rows that have a selected cell, ascending. - `craft_behavior::selection::Positions`: `pub struct Positions`. The display order of a grid whose row keys are their positions (a sheet, a document table): `key(at) == at`, and - `pub const fn new(rows: u32) -> Self`. The order of `rows` rows. ## `craft_behavior::sense` The library's sense set, for a root or a part. - `craft_behavior::sense::Sense`: `pub struct Sense: u16 (flag set)`. What a root or a part senses. The egui adapter maps the root's sense to egui's. - `pub const PRESS: Sense`. The bits that make a shape a press candidate. - `pub const WHEELS: Sense`. The bits that make a shape register a wheel taker. - `pub const fn takes_press(self) -> bool`. Whether a press can start on a shape with this sense. ## `craft_behavior::sizing` `Proposal`, `Metrics` and `ControlMetrics`: what a measure call is asked and what a style gives it to add. - `craft_behavior::sizing::ControlMetrics`: `pub struct ControlMetrics { pub height: f32, pub icon: f32, pub pad_x: f32, pub gap: f32, pub field: f32, pub number: f32 }`. The sizes a control takes from its `ControlSize`: height, icon side, horizontal padding, gap and the widths of a - `pub fn at(size: ControlSize, height: &BySize, icon: &BySize, pad_x: &BySize, gap: &BySize, field: &BySize, number: &BySize,) -> Self`. The entries of the six tables at `size`. - `pub const fn metrics(&self) -> Metrics`. The `Metrics` of a control of this height: horizontal padding, the height as the least height, the gap. - `craft_behavior::sizing::Metrics`: `pub struct Metrics { pub padding: Insets, pub min_size: Vec2, pub max_width: Option, pub gap: f32, pub min_text: f32, pub ideal_width: f32, pub least_width: Option }`. What the pipeline adds around a component's measured content. - `pub const fn new() -> Self`. No padding, no minimum, no wrap width. - `pub const fn padding(mut self, padding: Insets) -> Self`. Sets the padding. - `pub const fn min_size(mut self, min_size: Vec2) -> Self`. Sets the least size. - `pub const fn max_width(mut self, width: f32) -> Self`. Sets the wrap width. - `pub const fn gap(mut self, gap: f32) -> Self`. Sets the gap between content parts. - `pub const fn min_text(mut self, width: f32) -> Self`. Sets the least text width. - `pub const fn ideal_width(mut self, width: f32) -> Self`. Sets the width the component takes where its room allows. - `pub const fn least_width(mut self, width: f32) -> Self`. Sets the least width, padding included, that the least measure floors at in place of `min_size`'s width. - `craft_behavior::sizing::Proposal`: `pub enum Proposal { Ideal, Min, Width(f32), Size(Vec2) }`. The question one measure call answers. ## `craft_behavior::typing` `TypingRun`: the draft, rejected text, commit, cancel, escape rule and limits of a text part (18.2). - `craft_behavior::typing::EditRun`: `pub struct EditRun { pub start: V, pub draft: Option, pub error: Option, pub rejected: Option<(String, V)>, pub composing: bool, pub gesture: GestureId }`. The state a [`TypingRun`] keeps per text part. - `pub fn new(start: V) -> Self`. No run is open; `start` is the value shown. - `pub fn is_open(&self) -> bool`. A run is open. - `craft_behavior::typing::Ended`: `pub enum Ended { Commit(V), Rejected, Idle }`. How a commit ended. - `craft_behavior::typing::EscapeRule`: `pub enum EscapeRule { Restore, Clear }`. What Escape does to a draft. - `craft_behavior::typing::Escaped`: `pub enum Escaped { Cleared(V), Restore(V), Idle }`. What Escape did. - `craft_behavior::typing::Typed`: `pub enum Typed { Draft, Apply(V) }`. What typing did to the run. - `craft_behavior::typing::TypingRun`: `pub struct TypingRun`. The behaviour of a text part over a codec. - `pub fn new(codec: C) -> Self`. A run that applies a draft as typed when the codec says so, with no length limit. - `pub fn live(mut self, live: bool) -> Self`. Whether every parsable draft applies as typed, whatever the codec says. - `pub fn limit(mut self, limit: usize) -> Self`. The most characters a draft holds. - `pub fn escape_rule(mut self, rule: EscapeRule) -> Self`. What Escape does. - `pub fn codec(&self) -> &C`. The codec. - `pub fn shown(&self, run: &EditRun, value: &C::Value) -> String`. The text to show: the draft, else the value's text. - `pub fn open(&self, run: &mut EditRun, start: &C::Value)`. Opens the run on `start` when none is open. - `pub fn edit(&self, run: &mut EditRun, start: &C::Value, text: &str) -> Typed`. The draft is now `text`: characters the codec refuses and characters past the limit drop out. - `pub fn commit(&self, run: &mut EditRun) -> Ended`. Commits the draft: a value closes the run, a draft that is no value keeps it open. - `pub fn commit_tagged(&self, run: &mut EditRun) -> (Ended, Option)`. [`commit`](Self::commit), with the tag of the unit the committed text named (`Codec::parse_tagged`). - `pub fn cancel(&self, run: &mut EditRun) -> Option`. Closes the run without a commit and returns the value from before it; `None` when no run was open. - `pub fn escape(&self, run: &mut EditRun) -> Escaped`. Applies the escape rule. A codec that refuses the empty text keeps the cleared draft open under ## `craft_behavior::value` The value core of chapter 10: the bound every value type meets, `Mixed`, edit events and the list a pass's events - `craft_behavior::value::Applied`: `pub enum Applied { Changed, Unchanged, Restored }`. What applying an event did to a value. - `craft_behavior::value::CancelReason`: `pub enum CancelReason { Refused, Dismissed, Escape, Blur, Removed, HostChanged, UndoDuringGesture }`. Why a gesture ended without a commit. - `pub const fn document_moved(self) -> bool`. The document changed under the gesture, so the gesture's own edits stay and a revert would also take back the - `craft_behavior::value::EditEvent`: `pub enum EditEvent { Begin { id: GestureId, before: Mixed, label: Arc, doc_key: Option }, Update { id: GestureId, value: T }, Commit { id: GestureId, before: Mixed, after: T }, Cancel { id: GestureId, reason: CancelReason, before: Option> }, Set { before: Mixed, after: T, label: Arc, doc_key: Option } }`. One step of an edit. A pass raises several; [`EditEvents`] holds them in order. - `pub fn begin(id: GestureId, before: Mixed, label: Arc, doc_key: Option) -> Self`. A gesture began. - `pub fn update(id: GestureId, value: T) -> Self`. A proposed value of the running gesture. - `pub fn commit(id: GestureId, before: Mixed, after: T) -> Self`. The gesture committed `after`. - `pub fn cancel(id: GestureId, reason: CancelReason, before: Option>) -> Self`. The gesture ended without a commit. - `pub fn set(before: Mixed, after: T, label: Arc, doc_key: Option) -> Self`. A one-step change, named the way a `Begin` names its gesture. - `pub fn id(&self) -> Option`. The gesture the event belongs to; a `Set` belongs to none. - `pub fn map(self, f: impl Fn(T) -> U) -> EditEvent`. Maps the carried values and keeps the gesture. - `pub fn filter_map(self, f: impl Fn(T) -> Option) -> Option>`. Maps the carried values and keeps the gesture; `None` when `f` has no value for one of them. - `pub fn value(&self) -> Option<&T>`. The value the event carries: a proposal, a commit or a set. - `pub fn landed(&self) -> Option<&T>`. The value the binding holds after the event: the carried value, or the value a cancel restores. - `pub fn phase(&self) -> Option`. Where the gesture stands after this event; a `Set` is not a gesture. - `pub fn apply(&self, v: &mut T) -> Applied`. Applies the event to `v`: a proposal, commit or set writes its value, a cancel restores the value from before - `pub fn apply_mixed(&self, v: &mut Mixed) -> Applied`. Applies the event to a value that may be mixed: the written value is a concrete one. - `craft_behavior::value::EditEvents`: `pub struct EditEvents`. The edit events of one pass, in order. `push` folds what loses nothing, within one gesture: a later `Update`, - `pub fn new() -> Self`. No events. - `pub fn push(&mut self, event: EditEvent)`. Adds the next event of the pass, folding it with the one before when that loses nothing. - `pub fn is_empty(&self) -> bool`. No event happened. - `pub fn len(&self) -> usize`. The number of events. - `pub fn iter(&self) -> std::slice::Iter<'_, EditEvent>`. The events in order. - `pub fn last(&self) -> Option<&EditEvent>`. The latest event. - `pub fn value(&self) -> Option<&T>`. The latest value the events carry: a proposal, a commit or a set. - `pub fn landed(&self) -> Option<&T>`. The value the binding holds after the events: the latest carried value, or the value a cancel restores. - `pub fn began(&self) -> bool`. A gesture began. - `pub fn ended(&self) -> Option<&EditEvent>`. The `Commit`, `Cancel` or `Set` that ended an edit in this pass; the latest one. - `pub fn cancel_reason(&self) -> Option`. Why a gesture was cancelled in this pass; the latest cancel. - `pub fn map(self, f: impl Fn(T) -> U) -> EditEvents`. Maps the carried values of every event. - `pub fn filter_map(self, f: impl Fn(T) -> Option) -> EditEvents`. Maps the carried values of every event, dropping the events `f` has no value for. - `craft_behavior::value::EditPolicy`: `pub enum EditPolicy { WriteThrough, OnCommit }`. When a write-through source is written: on every proposal of a gesture or only on its commit. - `craft_behavior::value::Gesture`: `pub struct Gesture { pub id: GestureId, pub before: Option>, pub proposal: Option, pub last_given: Option, pub emitted: Option, pub reported: Option, pub dead: bool, pub cancel_seen: u64, pub watched: bool }`. The running gesture of a value component, kept in shown memory under the component. Plain data; the pipeline - `pub fn ended(&self, dead: bool) -> Gesture`. The gesture after it ended: no value, the id kept, and `dead` while the press that carried it is held. - `pub fn is_running(&self) -> bool`. A gesture is running. - `craft_behavior::value::GestureId`: `pub struct GestureId(pub u64)`. Names a gesture; ids grow in the order the gestures begin. - `pub const fn new(n: u64) -> GestureId`. The id numbered `n`. - `pub const fn next(self) -> GestureId`. The id of the gesture after this one. - `craft_behavior::value::GesturePhase`: `pub enum GesturePhase { Begin, Update, Commit, Cancel }`. Where a gesture stands in one pass. - `craft_behavior::value::Mixed`: `pub enum Mixed { Same(T), Mixed }`. A value that may differ across a multi-selection. - `pub const fn same(&self) -> Option<&T>`. The shared value, `None` while the items differ. - `pub const fn or<'a>(&'a self, start: &'a T) -> &'a T`. The shared value, or `start` while the items differ. - `pub fn each(values: [T; N]) -> [Mixed; N]`. Every part of `values` as a shared value: the per-part form of a composite value no part of which differs. - `pub fn parts(self) -> [Mixed; N]`. The per-part form of a composite value: a whole `Mixed` binding means every part differs. - `craft_behavior::value::Validity`: `pub enum Validity { Ok, Fix(T), Warn(M), Refuse(M), Error(M) }`. What a check says about a value. `M` is the message type: craft-ui exports the alias with its own `Message`. - `craft_behavior::value::Value`: `pub trait Value: Clone + PartialEq + Send + Sync + 'static`. What a bound value must be: cloneable, comparable and shareable across threads. ## `craft_behavior::value_drag` `ValueDrag`: the drag maths of sliders, dials, scrubbing number fields and rulers, written once (8.7). - `craft_behavior::value_drag::DragWarp`: `pub struct DragWarp`. The pointer warps of one drag. The OS reports the pointer at its new place a frame after a warp, so a warp - `pub fn shift(&mut self, pos: Pos2) -> Vec2`. The total warp so far, given the pointer `pos` of this pass. Pass it to [`ValueDrag::value_shifted`]. - `pub const fn pending(&self) -> bool`. Whether a warp waits for the pointer to show up at its new place: no second warp starts before it does. - `pub fn sent(&mut self, from: Pos2, by: Vec2)`. Records that the pointer at `from` was warped by `by`. - `craft_behavior::value_drag::ValueDrag`: `pub struct ValueDrag`. Turns a press into a value. Components set it as data and call [`ValueDrag::value`] in `update`. - `pub fn absolute(track: Range, range: RangeInclusive) -> Self`. The value follows the pointer on `track`: `range.start()` at `track.start`, `range.end()` at `track.end`. - `pub fn relative(rate: f64, range: RangeInclusive) -> Self`. The value changes by `rate` units per point of travel from the press. Vertical travel upwards increases it. - `pub const fn axis(mut self, axis: Axis) -> Self`. The axis the pointer travels on; the default is horizontal. - `pub const fn fine(mut self, factor: f64) -> Self`. The factor Alt (Option) applies to travel. - `pub const fn coarse(mut self, factor: f64) -> Self`. The factor Shift applies to travel. A drag sets none by default: on an absolute drag such as a slider's a - `pub const fn warp(mut self, on: bool) -> Self`. Warps the pointer to the other side of the window when the drag reaches an edge, so the drag has no end - `pub const fn hide_cursor(mut self, on: bool) -> Self`. Hides the pointer while the drag runs, as a scrub does that warps the pointer. - `pub const fn warps(&self) -> bool`. Whether the pointer warps at a window edge. - `pub fn warp_by(&self, pos: Pos2, bounds: Rect) -> Option`. How far to move the pointer when the drag at `pos` has reached an edge of `bounds` on the drag's axis: to - `pub fn value(&self, start: f64, press: &PressState, rtl: bool) -> Option`. The value the press gives, `None` while it gives none: before a drag starts, and after a cancel. `start` is the - `pub fn value_shifted(&self, start: f64, press: &PressState, rtl: bool, shift: Vec2) -> Option`. [`ValueDrag::value`] for a pointer that warped by `shift` in total ([`DragWarp::shift`]): the pointer - `pub fn at(&self, pos: Pos2, rtl: bool) -> Option`. The value at `pos` on an absolute drag's track, in the range: what a press there sets. `None` for a relative - `craft_behavior::value_drag::wrap_value`: `pub fn wrap_value(value: f64, low: f64, period: f64) -> f64`. `value` moved by whole periods into `low..low + period`, as a wrapping slider or dial holds it. A period that is ## `craft_behavior::wheel` Wheel gesture values, as craft-behavior's copy of egui's types so the wheel split is egui-free. - `craft_behavior::wheel::Wheel`: `pub struct Wheel { pub scroll: Vec2, pub zoom: f32, pub mods: Mods, pub unit: WheelUnit, pub phase: WheelPhase, pub at: Option, pub zooms: bool }`. One wheel event, or the sum of one pass's, as a taker reads it with `take_wheel`. - `pub const fn new(scroll: Vec2, mods: Mods, unit: WheelUnit, phase: WheelPhase) -> Self`. A scroll of `scroll` points with no zoom. - `pub const fn zoom(mut self, zoom: f32) -> Self`. The same gesture with zoom factor `zoom`. - `pub const fn at(mut self, at: Pos2) -> Self`. The same gesture with the pointer at `at`. - `craft_behavior::wheel::WheelNotch`: `pub enum WheelNotch { Points(f32), ViewShare(f32) }`. The distance one wheel line scrolls a taker. - `pub const DEFAULT: WheelNotch`. The distance of a taker that states none. - `pub fn points(self, extent: f32) -> f32`. The notch in points, for a taker whose view is `extent` points along the axis. - `craft_behavior::wheel::WheelPhase`: `pub enum WheelPhase { Start, Move, End, Cancel }`. A wheel gesture's phase. - `craft_behavior::wheel::WheelRoom`: `pub struct WheelRoom { pub positive: Vec2, pub negative: Vec2 }`. The scroll left in a region, in points of wheel scroll: `positive` is what a wheel with positive `scroll` can - `pub const fn new(positive: Vec2, negative: Vec2) -> Self`. A room of `positive` and `negative` points. - `craft_behavior::wheel::WheelTaker`: `pub struct WheelTaker { pub owner: O, pub rect: Rect, pub horizontal: bool, pub vertical: bool, pub zoom: bool, pub gated: bool, pub scrolls: bool, pub notch: WheelNotch, pub room: Option, pub zooms_view: bool }`. A component that takes wheel input, as registered last pass. - `pub const fn new(owner: O, rect: Rect) -> Self`. A taker over `rect` that takes no axis yet. - `pub fn for_sense(owner: O, rect: Rect, sense: Sense) -> Option`. The taker a shape with `sense` registers, `None` when `sense` has no wheel bit: `WHEEL` takes both scroll - `pub const fn zooms_view(mut self, on: bool) -> Self`. Whether it is a zoom zone (`WheelTaker::zooms_view`). - `pub const fn horizontal(mut self, on: bool) -> Self`. Whether it takes horizontal scroll. - `pub const fn vertical(mut self, on: bool) -> Self`. Whether it takes vertical scroll. - `pub const fn zoom(mut self, on: bool) -> Self`. Whether it takes zoom. - `pub const fn gated(mut self, on: bool) -> Self`. Whether every axis needs focus or arming. - `pub const fn notch(mut self, notch: WheelNotch) -> Self`. The distance of one wheel line. - `pub const fn scrolls(mut self, on: bool) -> Self`. The taker is a scroll region (`WheelTaker::scrolls`). - `pub const fn room(mut self, room: WheelRoom) -> Self`. The taker's scroll room: it passes a wheel on an axis it has no room left for to the next enclosing taker. - `pub fn points(&self, scroll: Vec2, unit: WheelUnit) -> Vec2`. `scroll`, given in `unit`s of the device, as points of this taker's view: a line is one notch, a page is - `craft_behavior::wheel::WheelUnit`: `pub enum WheelUnit { Point, Line, Page }`. How far one wheel event reaches. - `craft_behavior::wheel::split`: `pub fn split(takers: &[WheelTaker], at: Pos2, wheel: Wheel, focused: Option, armed: Option) -> Vec<(O, Wheel)>`. The split rule: each axis of `wheel` goes to the innermost taker under `at` that takes it; a share no taker ## `craft_ui` The base of the craft UI library: runtime, style, fonts, primitives, the component contract, layout and the test - `craft_ui::testing_registered!`: `macro_rules! testing_registered`. Writes `pub fn registered()` for the invoking package: its library crate's registrations in the running binary. - `craft_ui::InstallError`: re-export of `craft_ui::runtime::install::InstallError`. - `craft_ui::InstallSpec`: re-export of `craft_ui::runtime::install::InstallSpec`. - `craft_ui::install`: re-export of `craft_ui::contract::install`. - `craft_ui::words`: re-export of `craft_ui_macros::words` (outside these crates). ## `craft_ui::contract` The component traits, context types, `PaintUi`, `Looks`, the pipeline and its step functions, the label, body and item steps, the mount and overlay hosts and `contract::tooltip`. - `craft_ui::contract::Collection`: `pub trait Collection: Component + HasProps + Meta`. A component that shows an item per visible entry of a source. - `type Key`. The item key. - `type ItemLayout`. Kept in session memory so step 8 can hit-test against last frame's layout. - `type Selection`. The selection model. - `type Item`. The item component. - `type ItemEvent`. Events an item reports. - `const MEMBERS: bool`. Whether the items are members of the collection's run instead of runs of their own. Each visible item is then - `fn items(&self) -> &CollectionProps`. Plain data: selection mode, reorder, rename, columns. - `fn selection(&mut self) -> Option>`. The selection binding; `None` keeps it in session memory. - `fn cell_space<'s>(&'s self, space: CellSpace<'s, Self::Key>) -> CellSpace<'s, Self::Key>`. The grid a model of cells selects in (17.7). The item step passes the grid it knows, the source's rows and the - `fn reveal(&self) -> Option<&Self::Key>`. A one-shot request to scroll an item into view. - `fn item_layout(&self, source: &dyn ItemSource, width: f32, cx: &StyleCx<'_>) -> Self::ItemLayout`. The layout of `source` at `width`. - `fn item_layout_from(&self, _previous: Option, source: &dyn ItemSource, width: f32, _item: Option, cx: &StyleCx<'_>,) -> Self::ItemLayout`. The layout of `source` at `width`, given the layout of the last pass. An implementor may reuse `previous` - `fn measures_items(&self) -> bool`. Whether the layout sizes its items from their own measure: the items step measures every item at its ideal - `fn dress_inputs(&self) -> u64`. What `dress` reads of the collection, hashed: a kept measure of the items serves only while it is the same. - `fn ideal_width(&self, _item: Option, _cx: &StyleCx<'_>) -> f32`. The width the collection asks for when it takes its width from its content, over its widest row: a grid of - `fn filtered<'s>(&self, _source: &'s dyn ItemSource, _env: &crate::runtime::env::Env) -> Option + 's>>`. A view of `source` for this pass, such as the rows a filter keeps; `None` shows `source` as it is. - `fn dress<'r>(&self, item: Self::Item<'r>, _row: &RowState) -> Self::Item<'r>`. Adjusts the item the closure built for a row, from the row's state. - `fn rename_editor(&mut self, _ui: &mut Ui, _draft: Bind<'_, String>, _label: Rect, _name: &str) -> Option>`. The rename editor at `label`: the label rect the renaming item reports (`ItemOutput::label_rect`), else its row. - `fn rename_draft(&self, _key: &Self::Key) -> Option`. The text the rename field of the item `key` opens with; `None` for the item's own text. - `fn can_rename(&self, _key: &Self::Key) -> bool`. Whether the item `key` may be renamed; a rename request on another item does nothing. - `fn can_drag(&self, _key: &Self::Key) -> bool`. Whether the item `key` may be dragged (reordered, moved in a free layout, or dragged to another collection). - `fn accepts(&self, _drag: &ListDrag, _over: Option<&Self::Key>, _insert: usize) -> bool`. Whether the collection's own dragged items may land before `insert` (a position of the display order, `over` is - `fn drops(&self) -> &[DropKind<'_, Self::Key>]`. What the collection takes from drags that did not start in it, in order: the first kind that takes the drag's - `fn edge_press(&self) -> Option<&EdgePress<'_, Self::Key>>`. The press on the line between two adjacent rows the collection takes, reported as - `fn zooms(&self) -> bool`. Whether the collection takes the zoom share of the wheel (Ctrl or Cmd with the wheel): it reports - `fn empty_height(&self, width: f32, ui: &Ui, _cx: &StyleCx<'_>) -> f32`. The height of the empty state at `width`: a `Sizing::Content` collection with no rows is this tall. The - `fn empty(&mut self, ui: &mut Ui, cx: &mut BodyCx<'_>)`. The empty state at the rect the item step placed. The default shows `CollectionProps::empty`. - `craft_ui::contract::Component`: `pub trait Component: Meta + Sized`. The core trait: every UI type is a `Component`. - `const ROLE: Role`. The AccessKit role. - `const ALT_ROLES: &'static [Role]`. Roles `access` may pick per instance. - `const INPUT: Input`. How input reaches the component. - `const OVERLAYS: bool`. Whether the component hosts popups: `false` skips the overlay bookkeeping of steps 9, 10, 12, 15 and 16. - `const PARTS: bool`. Whether the component declares parts, a text part or an editor part: `false` skips the parts step (the parts - `const STOPS: bool`. Whether the component or its parts can take key focus: `false` skips the stop registration of step 7, except - `const KEYS: crate::runtime::focus::KeyUse`. Keys the focused component keeps from egui and the shortcut dispatcher. - `fn keys(&self) -> crate::runtime::focus::KeyUse`. The keys this instance keeps in its current state. The default is `KEYS`; a component whose key use depends - `const SHOWS_LABEL: bool`. Whether the component paints its label as visible text. `false` for a face that shows only an icon or a - `const LABELLED_AFTER: bool`. Whether the control draws only its mark and its text is the label step's, placed after it: a check box, a - `const SINGLE_VALUE: bool`. Whether the component edits one value that several selected things cannot disagree on (a colour picker's - `const BINDS_VIEW: bool`. Whether the binding is the component's view of what it shows (a time area's scroll and zoom, a navigator's - `const DISABLED: DisabledLook`. How a disabled instance looks: token states (the default), or its enabled look faded. - `type Style`. The style type. - `type Output`. `Response`, `EditResponse` or a richer type. - `fn shows_label(&self) -> bool`. Whether this instance paints its label as visible text; `SHOWS_LABEL` unless an instance prop decides, as - `fn paint_outset(_tokens: &crate::style::UiTokens) -> f32`. How far the component paints outside its rect by design, in points (a graph node's ports sit on its edge). - `fn style(cx: &StyleCx<'_>, key: Self::StyleKey) -> Self::Style`. Pure function of the resolved context and the key. - `fn padding(&self, _rect: Rect, style: &Self::Style) -> craft_behavior::Insets`. The insets from `rect` to the content rect where the component is shown: the style's padding. A component - `fn measure(&mut self, _cx: &MeasureCx<'_, Self>) -> Vec2`. Content size only; the pipeline adds padding and minimum size. - `fn fills(&self) -> Option`. The axis along which the component takes all the room the flow offers when that is more than it measured, - `fn cut_first(&self) -> bool`. Whether the content is made to be cut where it does not fit: an elided line or a path. In a row too short for - `fn sense(&self) -> Sense`. The root's sense; the shape's default unless a canvas control. - `fn parts(&mut self, _rect: Rect, _cx: &mut PartsCx<'_, Self>)`. Named sub-rects: thumbs, chevrons, handles, segments and the roving groups over them. - `fn bind(&mut self) -> Option>>`. Value components return their binding; the same binding on every call, with no side effects. - `fn same_value(&self, proposed: &ValueOf, host: &ValueOf) -> bool`. Whether `host`, a value the app wrote back, is the value `proposed` as the component holds values: a host that - `fn scrub(&self) -> Option>>`. Lets a drag on the scrub's sources (the side label, the body, a part) change the value; the pipeline runs the - `fn scroll(&mut self) -> Option>`. The scroll offset's owner when the app drives scrolling; `None` keeps it in session memory. The app restores a - `fn content_env(&self, _cx: &Cx<'_, Self>, _values: &mut crate::runtime::env::AppValues)`. App values for content the component does not build: its body or its items. Runs once, at step 13. - `fn update(&mut self, _cx: &mut Cx<'_, Self>)`. After sensing, before paint: value maths, memory, popup triggers. - `fn overlay(&mut self, _ui: &mut OverlayUi<'_>, _cx: &mut Cx<'_, Self>)`. Anchored popups. Runs before flags and paint. - `fn flags(&self) -> Flags`. Value-driven flags (checked, open, invalid, busy). - `fn activated(&self, cx: &Cx<'_, Self>) -> bool`. When a bound command fires; the default is a primary click or `Intent::Activate`. - `fn paint(&mut self, _ui: &mut PaintUi<'_>, _cx: &Cx<'_, Self>)`. Content only; surface, state fill and focus ring are painted by the pipeline. - `fn paint_over(&mut self, _ui: &mut PaintUi<'_>, _cx: &Cx<'_, Self>)`. Content above the body or items. - `fn access(&self, _access: &mut Access, _cx: &Cx<'_, Self>)`. Value, range, relations, sub-nodes and custom actions beyond role, label and flags. - `fn value_text(&self, _cx: &Cx<'_, Self>) -> Option`. The shown value as the component words it ("40.0", "20 to 60"), which assistive technology reads and a viewer - `fn finish(self, cx: Cx<'_, Self>) -> Self::Output`. Builds the output from the finished context. - `craft_ui::contract::Container`: `pub trait Container: Component + HasProps + Meta`. A component whose caller supplies a body. - `fn open(&mut self) -> Option>`. The open state's owner: the caller's binding. `None`: a session slot under the id. - `fn header(&mut self, _ui: &mut Ui, _cx: &mut BodyCx<'_>)`. Fills the header region the body step laid out. - `fn header_parts(&self, _cx: &MeasureCx<'_, Self>) -> HeaderParts`. The room the container's own parts take at the edges of its header's line (a menu button, a drag band). The - `fn controls(&mut self, _ui: &mut Ui, _cx: &mut BodyCx<'_>)`. Fills the header's trailing region. - `fn footer(&mut self, _ui: &mut Ui, _cx: &mut BodyCx<'_>)`. Fills the footer region. - `fn end(&mut self, _ui: &mut Ui, _cx: &mut BodyCx<'_>)`. Fills the end region, after the body. - `fn closed(&mut self, _why: CloseReason)`. The container closed, and why: a layer's dismissal rule, a close the body or footer asked for with - `fn placement_changed(&mut self, _change: &overlay::PlacementChange)`. The user moved or resized the container's layer: by the move band, a grip or the keyboard Move and Size - `craft_ui::contract::ContentPainter`: `pub trait ContentPainter: Component`. Implemented by the allowlisted components that paint content with a raw painter (a preview, a waveform). - `craft_ui::contract::DisabledLook`: `pub enum DisabledLook { States, Faded }`. How a component that is not enabled looks (`Component::DISABLED`). Either way it takes no input, its access node - `craft_ui::contract::HasProps`: `pub trait HasProps`. Written by the derive from a `#[container]` field, for containers and collections. - `fn props(&self, _: Internal) -> &ContainerProps`. - `craft_ui::contract::IdSource`: `pub enum IdSource { Auto, Salt(IdSalt), Id(Id) }`. Where an element's id comes from. - `craft_ui::contract::Inner`: `pub struct Inner { pub output: O, pub inner: Option, pub settle: Option }`. The container show output: the component's own output and the body's result. - `pub fn settle(&mut self, f: impl FnOnce(&mut SettleCx<'_>, &mut R) -> T) -> Option`. Runs `f` once, after the pass's real run, with the body's memory (`keep`, `memory`, `saved`, `pending`, - `pub fn map_output(self, f: impl FnOnce(O) -> O2) -> Inner`. Maps the component's own output and keeps the body's result and its settle handle. - `craft_ui::contract::Internal`: `pub struct Internal`. A token only craft-ui can build: the private field and `pub(crate)` constructor let derive output in any - `craft_ui::contract::ItemFn`: `pub type ItemFn<'r, C> = dyn FnMut(&::Key, &mut ItemCx<'_, 'r,::Key>) ->::Item<'r> + 'r`. The item closure of `ShowCollection::show_items`: one call per visible key. - `craft_ui::contract::MAX_EXTENT`: `pub const MAX_EXTENT: f32`. The most a component may measure on either side, in points. - `craft_ui::contract::Meta`: `pub trait Meta`. Written by `#[derive(Component)]`; never by hand. - `type Shape`. The shape: leaf, body or items. - `type StyleKey`. The instance inputs the style depends on. - `const CANVAS_CONTROL: bool`. A leaf the `Canvas` body shows (`#[component(canvas_control)]`): its default sense is empty, so a press away - `fn style_key(&self) -> Self::StyleKey`. The style key of this instance. - `fn common(&self, _: Internal) -> &Common`. - `fn common_mut(&mut self, _: Internal) -> &mut Common`. - `fn set_sizing(&mut self, sizing: Sizing, _: Internal)`. Takes the caller's `Props::sizing`: a leaf keeps it in its `Common`; the derive writes a container's or a - `craft_ui::contract::Pattern`: `pub trait Pattern`. A type that only assembles components: a composition with no contract shape of its own (24.4). - `craft_ui::contract::ShapeKind`: `pub enum ShapeKind { Leaf, Body, Items }`. The shape of a component, as a value: what a registration records. - `craft_ui::contract::Show`: `pub trait Show: Component + Meta + sealed::Show`. Shows a leaf. - `fn show(self, ui: &mut Ui) -> Self::Output`. Shows the component in the flow of `ui`. - `fn show_at(self, ui: &mut Ui, rect: Rect) -> Self::Output`. Shows the component at `rect`, with no allocation. - `fn show_with_tip(self, ui: &mut Ui, tip: impl FnOnce(&mut Ui)) -> Self::Output`. Shows the component with rich tooltip content from the same call. - `fn show_at_with_tip(self, ui: &mut Ui, rect: Rect, tip: impl FnOnce(&mut Ui)) -> Self::Output`. Shows the component at `rect` with rich tooltip content. - `fn measure_in(&mut self, ui: &Ui, proposal: Proposal) -> Vec2`. Measures without allocating: steps 1 to 5 under the id `show` would use next. It registers no id, opens no - `craft_ui::contract::ShowCollection`: `pub trait ShowCollection: Collection + sealed::ShowCollection`. Shows a collection's items. - `fn show_items<'r>(self, ui: &mut Ui, source: &dyn ItemSource, item: &mut ItemFn<'r, Self>) -> Self::Output`. Shows the visible items of `source`, one `item` call each. - `craft_ui::contract::ShowContainer`: `pub trait ShowContainer: Container + sealed::ShowContainer`. Shows a container with its body. - `fn show(self, ui: &mut Ui, body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Inner`. Shows the container in the flow of `ui`. - `fn show_at(self, ui: &mut Ui, rect: Rect, body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Inner`. Shows the container at `rect`, with no allocation: a frame over a split or a layer the parent places. - `fn show_at_taking_room(self, ui: &mut Ui, rect: Rect, body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Inner`. Shows the container at `rect` and takes that rect's room in the flow of `ui`: what is shown after it lies - `fn measure_in(&mut self, ui: &Ui, proposal: Proposal, body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Vec2`. Measures the container with `body` without allocating: steps 1 to 5 under the id `show` would use next, with - `fn show_with_tip(self, ui: &mut Ui, body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R, tip: impl FnOnce(&mut Ui)) -> Inner`. Shows the container with rich tooltip content. - `fn show_at_with_tip(self, ui: &mut Ui, rect: Rect, body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R, tip: impl FnOnce(&mut Ui),) -> Inner`. Shows the container at `rect` with rich tooltip content. - `craft_ui::contract::ShowShape`: `pub trait ShowShape: sealed::ShowShape`. Which show trait applies, and the shape's default sense. - `const KIND: ShapeKind`. The shape as a value. - `const DEFAULT_SENSE: Sense`. Leaf `CLICK | FOCUS`; body empty; items `CLICK | DRAG | FOCUS | WHEEL | TAKE_FOCUS`. - `craft_ui::contract::install`: `pub fn install(ctx: &egui::Context, spec: crate::runtime::InstallSpec) -> Result<(), crate::runtime::InstallError>`. Adds the runtime to `ctx`: `runtime::install` with the overlay host's ghost-layer painter in the end hook. - `craft_ui::contract::Access`: re-export of `craft_ui::runtime::access::Access`. - `craft_ui::contract::Accessible`: `pub trait Accessible`. Live announcements and the enclosing field label (chapter 12). - `fn announce(&mut self, text: impl Into, politeness: Politeness)`. Announces transient text; it is flushed at frame end as one status node and returned in `FrameOutput`. - `fn field_label(&self) -> Option`. The label of the enclosing field container, when the component sits in one. - `craft_ui::contract::ActivateOn`: `pub enum ActivateOn { DoubleClick, Click }`. The pointer gesture that activates an item. - `craft_ui::contract::Activation`: `pub struct Activation { pub by_key: bool, pub mods: craft_keymap::Mods }`. How a component was activated this pass. - `craft_ui::contract::Animate`: re-export of `craft_ui::runtime::motion::Animate`. - `craft_ui::contract::BandFill`: `pub enum BandFill { Surface(SurfaceKind), Tone(Tone) }`. What the band behind a header paints. - `craft_ui::contract::Bind`: `pub struct Bind<'a, T>`. The binding of a value component: a value the app owns, the check on it and the value a reset restores. The same - `pub fn given(v: impl Into>) -> Self`. A value in; every edit comes out as an event. - `pub fn bound(v: &'a mut T) -> Self`. Edits write through to `v`. - `pub fn bound_mixed(v: &'a mut Mixed) -> Self`. Edits write through to a field that may be mixed; an edit makes it concrete. - `pub fn kept() -> Self`. No caller value: the component keeps it in session memory under its id. - `pub fn saved(mut self, key: SaveKey) -> Self where T: Savable,`. A kept value that is also saved across runs under `key`. The `Savable` bound sits here; the pipeline reaches - `pub fn policy(mut self, policy: EditPolicy) -> Self`. When a write-through source is written. - `pub fn check(mut self, check: impl Fn(&T) -> Validity + 'a) -> Self`. The check on a value: `Fix` replaces it; `Warn`, `Refuse` and `Error` set the component's state, and `Refuse` - `pub fn reset(mut self, default: T) -> Self`. The value a reset gesture restores. - `pub fn reborrowed(&mut self) -> Bind<'_, T>`. A binding with the same source, check, policy and reset that borrows this one, so a composite can hand its - `pub fn reborrow(&mut self) -> BindMut<'_, T>`. The binding as the pipeline reads and writes it. - `craft_ui::contract::BindMut`: `pub struct BindMut<'a, T>`. A reborrow of a [`Bind`] the pipeline reads at steps 4, 11, 15 and 17. `Component::bind` returns it, and returns the - `pub fn read(&self, cx: &mut impl StageAccess) -> Option>`. The binding's value for code that runs no pipeline step: a given or write-through value, or the kept value - `pub fn write(&mut self, cx: &mut impl StageAccess, event: &EditEvent) -> bool`. Writes `event` as the pipeline's apply step does: the check may replace the value (`Fix`) or refuse it - `craft_ui::contract::BodyCx`: `pub struct BodyCx<'a> { pub id: Id, pub env: EnvView<'a>, pub resolved: &'a Resolved<'a>, pub rect: Rect, pub memory: &'a mut MemoryStage }`. What a body closure and the header, footer and empty hooks read: a view over the pipeline's memory stage - `pub fn open_url(&mut self, url: &str, new_tab: bool)`. Asks the platform to open `url`, in a new tab where the platform has tabs and `new_tab` is set: the opener - `pub fn take_pick_answer(&self, ticket: craft_host::PickId) -> Option`. The host file service's answer to the picker `ticket`, taken once. A measuring run gets none and leaves - `pub fn field_message(&self) -> Option<(Message, craft_theme::variant::Tone)>`. The validity message of the first control in the container's label scope, recorded last frame, with the - `pub fn is_open(&self) -> bool`. Whether the body is open. - `pub fn open(&mut self) -> &mut bool`. The open state: a title row's disclosure binds to it, and step 15 writes a change to its owner. - `pub fn gate(&mut self) -> Option<&mut bool>`. The gate's shown copy, for a container whose value is a bool: a title row's check box binds to it, and - `pub fn gate_is_mixed(&self) -> bool`. Whether the gate's value is mixed: `gate` then reads off, and a title row's check box shows the mixed face. - `pub fn request_close(&mut self)`. Asks the container to close, as `CloseReason::Requested`: step 15 closes it. - `pub fn request_close_as(&mut self, why: CloseReason)`. Asks the container to close and tells it why (an OK button is `Activated`, Enter is `Enter`): step 15 - `pub fn labelled(&mut self, ui: &mut Ui, key: impl Hash + Debug, label: Label, side: SideLabel, child: C) -> C::Output`. Runs the label step (B2, 16.3) for one leaf child in the body's flow: `label` sits beside the child or above - `pub fn labelled_with(&mut self, ui: &mut Ui, key: impl Hash + Debug, label: Label, side: SideLabel, child: C, content: D,) -> C::Output`. `labelled`, with `content` shown inside the label after its text (a sample of what the option picks). The - `pub fn style(&self) -> Option<&'a C::Style>`. The style of the container `C` whose body this is, as step 2 resolved it for this pass: the one way a body - `pub fn gap(&self) -> Option`. The gap the body's layout puts between its children (`ContainerProps::body_gap`), for a body that places - `pub fn take_cancel(&mut self) -> bool`. Takes the Escape of this pass that no component took: a field that clears on Escape passes it on once it - `craft_ui::contract::BodyLayout`: `pub enum BodyLayout { Stack, Row { wrap: bool, align: RowAlign }, Grid { columns: Cow<'static, [ColumnWidth]> } }`. How a body lays out its children, in reading order: mirrored under a right-to-left direction. - `pub const fn stack() -> Self`. Children one under another. - `pub const fn row() -> Self`. Children side by side from the start edge, with no wrap. - `pub fn grid(columns: impl Into>) -> Self`. Children row-major over `columns`: a `'static` slice, or columns built in the pass. - `pub fn wrap(self, on: bool) -> Self`. A `Row` that wraps; any other layout is unchanged. - `pub fn align(self, align: RowAlign) -> Self`. A `Row` with `align`; any other layout is unchanged. - `craft_ui::contract::CellWidth`: `pub type CellWidth = ColumnWidth`. The width of a caption's cell. - `craft_ui::contract::Collapse`: `pub struct Collapse { pub initially_open: bool, pub animated: bool }`. Collapse configuration. - `pub const fn new() -> Self`. A collapsible body that starts open, animated. - `pub const fn initially_open(mut self, on: bool) -> Self`. Whether the body starts open. - `pub const fn animated(mut self, on: bool) -> Self`. Whether opening and closing animate. - `craft_ui::contract::CollectionEvent`: `pub enum CollectionEvent { Selection(SelectionChange), LeadMoved { key: K, by: LeadSource }, Activate(K), EmptyActivated, EmptyContextMenu { at: Pos2 }, Preview(K), ContextMenu(ContextMenuRequest), EdgePressed { above: K, below: K, mods: craft_keymap::Mods }, CommandClick { key: K, mods: craft_keymap::Mods }, Delete(Vec), Open(OpenChange), Reorder(EditEvent>), Move(EditEvent), Dropped { at: DropAt, op: DropOperation, payload: DropPayload }, Zoom { factor: f32, about: Pos2 }, Rename(EditEvent>), Toggle(EditEvent>), Column(ColumnEvent), Item(K, E) }`. What a collection reports, in drawing order. - `craft_ui::contract::CollectionProps`: `pub struct CollectionProps { pub select: SelectMode, pub reorder: Option, pub rename: bool, pub rename_column: Option, pub slow_click_rename: bool, pub columns: Vec, pub sort: Option, pub empty: Option

+ Send + Sync + 'static) -> Self`. A row drag carries `map` of it, for the drop targets of type `P`; a row the map gives `None` for does not drag - `pub const fn drag_count(mut self, count: Counted) -> Self`. The drag badge reads `count` for the number of dragged items. - `pub const fn pages(mut self, on: bool) -> Self`. The items are pages (`CollectionProps::pages`). - `pub fn rename(mut self, on: bool) -> Self`. Rename runs through the collection's editor. - `pub fn rename_column(mut self, column: ColumnKey) -> Self`. A double click on `column` of a renamable item (`rename`, `Collection::can_rename`) opens its rename editor; the - `pub const fn slow_click_rename(mut self, on: bool) -> Self`. A slow second click on the label of the only selected item opens its rename editor. - `pub fn columns(mut self, columns: Vec) -> Self`. The columns. - `pub fn sort(mut self, sort: impl Into>) -> Self`. The column the rows are sorted by. - `pub const fn activate(mut self, on: ActivateOn) -> Self`. What activates an item with the pointer. - `pub const fn striped(mut self, on: bool) -> Self`. Odd rows carry `RowState.striped`. - `pub const fn allow_empty(mut self, on: bool) -> Self`. A press on the empty space below the rows empties the selection. - `pub const fn lead_on_open(mut self, at: LeadOnOpen) -> Self`. Where the lead starts. - `pub const fn lead_follows_hover(mut self, on: bool) -> Self`. The lead follows the pointer over the rows. - `pub const fn arrows_select(mut self, on: bool) -> Self`. Whether the arrow keys select the row they move the lead to. - `pub const fn type_ahead(mut self, on: bool) -> Self`. Typed letters move the lead (`CollectionProps::type_ahead`). - `pub const fn arrows_wrap(mut self, on: bool) -> Self`. The arrow keys wrap at the ends (`CollectionProps::arrows_wrap`). - `pub const fn rows_stamp(mut self, stamp: u64) -> Self`. The rows are the set `stamp` names; the lead starts over when the stamp changes. - `pub const fn focus_on_press(mut self, on: bool) -> Self`. A primary press moves key focus to the collection; off, it leaves focus where it is. - `pub const fn space(mut self, action: SpaceAction) -> Self`. What Space does. - `pub const fn header(mut self, on: bool) -> Self`. Whether the header row shows. - `pub const fn digit_keys(mut self, on: bool) -> Self`. Typed digits go to the collection's `update` as `Intent::Digit`. - `pub const fn menu_on_click(mut self, on: bool) -> Self`. A plain click on a row asks for its menu, as a secondary click does. - `pub const fn item_keys(mut self, keys: ItemKeys) -> Self`. Who takes the arrow keys while the collection has the key focus. - `pub const fn marquee(mut self, on: bool) -> Self`. A drag from empty space selects with a marquee. - `pub const fn deletable(mut self, on: bool) -> Self`. Delete and Backspace at the lead report the items to delete (`CollectionEvent::Delete`). - `pub const fn natural_height(mut self, on: bool) -> Self`. The collection takes its full content height and owns no scroll (see [`CollectionProps::natural_height`]). - `pub const fn min_rows(mut self, rows: u16) -> Self`. The collection is at least `rows` rows tall (see [`CollectionProps::min_rows`]). - `pub const fn max_rows(mut self, rows: u16) -> Self`. The collection shows at most `rows` rows and scrolls the rest (see [`CollectionProps::max_rows`]). - `pub const fn row_height(mut self, height: RowHeight) -> Self`. The rows are `height` tall (see [`RowHeight`]). - `pub const fn command_click(mut self, on: bool) -> Self`. A Cmd/Ctrl click on an item is a command, not a pick (see [`CollectionProps::command_click`]). - `pub const fn notch(mut self, notch: Notch) -> Self`. The distance one wheel notch scrolls the rows (see [`CollectionProps::notch`]). - `pub fn wheel_notch(&self, line: f32) -> craft_behavior::WheelNotch`. The wheel distance of one notch, with a text line `line` points high: the set notch, else the default. - `pub const fn overflow(mut self, axis: Axis) -> Self`. The axis the rows overflow along (see [`CollectionProps::overflow`]). - `pub fn current(mut self, key: Option) -> Self`. The current item: `Some(key)` marks the item with that key, `None` marks none. `K` is the collection's key type; - `pub fn empty(mut self, text: impl Into

+ Send + Sync + 'static) -> Self`. The payload `map` makes of a drag of the collection whose keys are `K`; `None` for a row that carries none. - `craft_ui::contract::DragPreview`: re-export of `craft_ui::runtime::drag::DragPreview`. - `craft_ui::contract::DropAt`: `pub enum DropAt { Gap { key: Option, insert: usize }, Onto(K) }`. The place of one drop. - `pub const fn gap(key: Option, insert: usize) -> Self`. Between items, over `key`, before `insert`. - `pub fn key(&self) -> Option<&K>`. The item under the pointer. - `craft_ui::contract::DropKind`: `pub struct DropKind<'a, K>`. A payload type a collection takes from a drag that did not start in it, at one place, where `accepts` passes. A - `pub fn new(place: DropPlace, accepts: impl Fn(&P, &DropAt) -> bool + 'a) -> Self`. Drops of payload type `P` at `place` where `accepts` passes for the payload and the place under the pointer. - `craft_ui::contract::DropMark`: re-export of `craft_ui::runtime::drag::DropMark`. - `craft_ui::contract::DropOperation`: re-export of `craft_behavior::keys::DropOperation`. - `craft_ui::contract::DropPayload`: `pub struct DropPayload`. The payload of a drop a collection took, read by its type. - `pub fn get(&self) -> Option<&P>`. The payload, when it is a `P`. - `craft_ui::contract::DropPlace`: `pub enum DropPlace { Between, Onto }`. Where a drop kind takes its drops. - `craft_ui::contract::DropTarget`: re-export of `craft_ui::runtime::drag::DropTarget`. - `craft_ui::contract::EdgePress`: `pub struct EdgePress<'a, K>`. The line between two adjacent rows as a target of its own while `mods` are held (Photoshop's Alt-click between two - `pub fn new(mods: Mods, test: impl Fn(&K, &K) -> Option + 'a) -> Self`. The edge press while exactly `mods` are held, on the lines `test` takes. - `craft_ui::contract::Edit`: `pub trait Edit`. Values and edits (chapter 10). `value`, `validity`, `gesture`, `adopt` and `edit_response` take `&self`, so `paint` - `type Value`. The component's value type. - `fn value(&self) -> Option<&Self::Value>`. The shown value: the running gesture's proposal, else the binding's. `None` for a mixed binding, a kept - `fn validity(&self) -> Validity`. What the binding's check says about the shown value. - `fn gesture(&self) -> Option`. Where this pass's gesture stands. - `fn adopt(&self, child: &EditResponse, start: &Self::Value, map: impl Fn(&V, &mut Self::Value))`. Maps each of the child's events onto a clone of this component's shown value and queues the resulting events, in - `fn edit_response(&self) -> EditResponse`. The `EditResponse` a value component returns from `finish`. - `fn propose(&mut self, v: Self::Value)`. Sets the running gesture's value, beginning a gesture if none runs and the press that carries it has had no - `fn set(&mut self, v: Self::Value)`. A one-shot change outside a gesture. - `fn begin(&mut self)`. Opens a gesture. - `fn commit(&mut self)`. Commits the proposed value. - `fn cancel(&mut self, reason: CancelReason)`. Cancels the running gesture. - `craft_ui::contract::EditResponse`: `pub struct EditResponse { pub response: Response, pub events: EditEvents, pub submitted: bool, pub submit_mods: craft_keymap::Mods, pub left_by_tab: Option, pub escaped: bool, pub unparsed: bool, pub validity: Validity, pub shown: Option>>, pub value_text: Option }`. The output of a component that edits a value. Only `cx.edit_response()` builds it. - `pub fn lifted(response: Response, events: EditEvents, shown: Option>>) -> Self`. The response of a composite that edits one value through several child components: `events` are the edits of - `pub fn value(&self) -> Option<&T>`. The latest value the pass's events carry: a proposal, a commit or a set; `None` when nothing was edited or no - `pub fn map(self, f: impl Fn(T) -> U) -> EditResponse`. The response of a child component's edit as the response of the edit of a value built from it: the events, the - `craft_ui::contract::EndRegion`: `pub struct EndRegion { pub full_height: bool, pub gap: Gap, pub rule: bool }`. An end region, filled by `Container::end`: content in reading order at the line's end edge, beside the body and - `pub const fn new() -> Self`. An end region as high as the line, `space.gap.tight` from the body, with no rule. - `pub const fn rule(mut self, on: bool) -> Self`. Whether a rule separates the end region from the body. - `pub const fn full_height(mut self, on: bool) -> Self`. Whether the region takes the full height under the header. - `pub const fn gap(mut self, gap: Gap) -> Self`. Sets the gap between the body and the region. - `craft_ui::contract::Entry`: `pub struct Entry`. A row of entries: an item that reports its value when picked, a heading over a group of items, or a separator - `pub fn new(value: T, label: impl Into

, Pos2)>`. The active drag payload of type `P` and the pointer position in this component's egui layer space (8.3), from any - `fn drop_target>(&mut self, target: &T) -> Option`. Registers `target` over this component's rect for this pass, in `update`. Returns the drop released over it this - `fn window_drop_target>(&mut self, target: &T) -> Option`. Registers `target` over the whole window of the running viewport for this pass, in `update`; a target over a - `fn drag_ended(&self) -> Option`. The operation of a drop of this component's payload, in the pass after the drop; `None` while dragging, when the - `fn scroll_moved(&self, key: PartKey) -> Option>`. The visible range the scroll part `key` moved to this pass (thumb or end drag, page press, or an AccessKit click - `craft_ui::contract::Politeness`: re-export of `craft_ui::runtime::access::Politeness`. - `craft_ui::contract::Popup`: `pub struct Popup`. The open state of a container's layer that has an opener and no binding, driven from the opener's side. - `pub fn open(opener: impl Into, cx: &mut Cx<'_, C>)`. Opens the container hung from `opener` (a [`PopupHandle`] or the id of the opener's response). - `pub fn close(opener: impl Into, cx: &mut Cx<'_, C>)`. Closes the container hung from `opener`. - `pub fn toggle(opener: impl Into, cx: &mut Cx<'_, C>)`. Opens the container hung from `opener` when it is closed, else closes it. - `pub fn opening(popup: PopupHandle, cx: &Cx<'_, C>) -> bool`. Whether the layer `popup` shows first in this pass: true in the passes of the frame it first shows, false - `craft_ui::contract::PopupHandle`: `pub struct PopupHandle`. An id and a name; `Copy`, never a snapshot of the open state. - `pub fn at(self, index: usize) -> PopupHandle`. The popup of the repeat `index` of this name: a component with one popup per part or per entry gives each its - `pub fn id(self) -> Id`. The popup's id: its open state's and its entry in the layer stack. - `pub fn name(self) -> &'static str`. The name given to `cx.popup`. - `pub fn trigger(self, trigger: Trigger, cx: &mut Cx<'_, C>)`. Toggles or opens the popup from `trigger` at step 9, as the pass's pending open change. - `pub fn open(self, cx: &mut Cx<'_, C>)`. Queues an open that step 15 writes. For `Trigger::Manual` this and the binding are the only ways it opens. - `pub fn close(self, cx: &mut Cx<'_, C>)`. Queues a close; step 15 writes the slot, so this pass still shows the popup open. - `pub fn changed(self, cx: &mut Cx<'_, C>) -> bool`. Whether a toggle, `open` or `close` queued in this pass leaves the popup's open state different from the - `pub fn bind_open(self, cx: &mut Cx<'_, C>, mut open: BindMut<'_, bool>) -> bool`. Binds the popup's open state to `open`: call it in `update`, after the toggles and closes the component - `pub fn is_open(self, cx: &mut Cx<'_, C>) -> bool`. Whether the popup is open in this pass: valid from step 8, with the changes queued so far applied. - `craft_ui::contract::PopupKind`: re-export of `craft_ui::runtime::access::PopupKind`. - `craft_ui::contract::Presence`: re-export of `craft_ui::runtime::motion::Presence`. - `craft_ui::contract::Progress`: re-export of `craft_ui::runtime::pending::Progress`. - `craft_ui::contract::Props`: re-export of `craft_ui_macros::Props` (outside these crates). - `craft_ui::contract::Remember`: re-export of `craft_ui::runtime::memory::Remember`. - `craft_ui::contract::Rename`: `pub struct Rename { pub key: K, pub name: String }`. A committed rename. - `craft_ui::contract::ReorderMove`: `pub struct ReorderMove { pub key: K, pub keys: Vec, pub to: usize, pub copy: bool, pub parent: Option }`. A reorder: the items `keys` move together, and the first of them lands at position `to`. - `pub fn new(key: K, keys: Vec, to: usize, copy: bool) -> Self`. A move of `keys` (`key` among them) to position `to` at the top level. - `pub fn in_group(mut self, parent: Option) -> Self`. The items land in the group `parent`, `None` for the top level. - `craft_ui::contract::ReorderRule`: `pub struct ReorderRule { pub copy_with_alt: bool, pub into_groups: bool }`. How the user may reorder items. - `pub const fn new() -> Self`. A rule that only moves. - `pub const fn into_groups(mut self) -> Self`. Items may land inside the groups of a tree. - `pub const fn copy_with_alt(mut self) -> Self`. Alt copies. - `craft_ui::contract::Resolved`: `pub struct Resolved<'p> { pub id: Id, pub label: &'p str, pub enabled: bool, pub read_only: bool, pub size: ControlSize, pub variant: Variant, pub selected: Option, pub tooltip: Option<&'p Tooltip>, pub doc_key: Option }`. `Common` after step 1; it borrows locals of the pipeline frame, never the component. - `pub fn sizing(&self) -> Option`. The sizing the host set on this component, if any: a leaf with `Sizing::Content` sizes to its content. - `craft_ui::contract::Role`: re-export of `craft_ui::runtime::access::Role`. - `craft_ui::contract::RowAlign`: `pub enum RowAlign { Start, Center, End, SpaceBetween }`. Where a `Row` places its block of children along the row. - `craft_ui::contract::RowHeight`: `pub enum RowHeight { Control, Text }`. How tall a collection's rows are. Read-only display tables (a metadata table) take text rows; lists the user picks - `pub fn of(self, cx: &StyleCx<'_>) -> f32`. The height of one row under `cx`. - `craft_ui::contract::RowPressed`: `pub enum RowPressed { Row, Cell(ColumnKey), Part { was_lead: bool } }`. Where the collection holds a primary press on a row, within slop, or the press a part of the row holds. - `craft_ui::contract::RowState`: `pub struct RowState { pub selected: bool, pub lead: bool, pub drop_target: bool, pub dragging: bool, pub renaming: bool, pub emphasized: bool, pub current: bool, pub striped: bool, pub open: bool, pub hovered: bool, pub pressed: Option, pub menu_open: bool, pub activated_by_key: bool }`. What an item reads of its place in the collection; the item step joins it to the item's flags at step 12. - `craft_ui::contract::Sampler`: `pub trait Sampler: sealed::Host`. The canvas reach under a modal layer (15.5, 8.3): a control of a dialog keeps the canvas below it usable. It is - `fn arm_sampler(&mut self, canvas: Id)`. Arms a sampler for `canvas` (the canvas component's id): while the modal layer is open, primary presses on the - `fn keep_view_open(&mut self, canvas: Id)`. Keeps the view of `canvas` (the canvas component's id) usable under the modal layer: the wheel scrolls and - `craft_ui::contract::Savable`: re-export of `craft_ui::runtime::memory::Savable`. - `craft_ui::contract::SaveKey`: re-export of `craft_ui::runtime::memory::SaveKey`. - `craft_ui::contract::Scroll`: `pub struct Scroll { pub axes: ScrollAxes, pub anchor: ScrollAnchor, pub notch: Notch }`. A scrolling body. - `pub const fn vertical() -> Scroll`. Scrolls along y. - `pub const fn horizontal() -> Scroll`. Scrolls along x. - `pub const fn both() -> Scroll`. Scrolls along both axes. - `pub const fn anchored_end(mut self) -> Scroll`. Stays at the end when the content grows. - `pub const fn notch(mut self, notch: Notch) -> Scroll`. The distance of one wheel notch. - `pub const fn horizontal_on(&self) -> bool`. Whether the x axis scrolls. - `pub const fn vertical_on(&self) -> bool`. Whether the y axis scrolls. - `craft_ui::contract::ScrollAnchor`: `pub enum ScrollAnchor { Start, End }`. Which end of the content a scroll region stays at when the content grows. - `craft_ui::contract::ScrollAxes`: `pub enum ScrollAxes { Vertical, Horizontal, Both }`. The axes a body scrolls on. - `craft_ui::contract::Scrub`: `pub struct Scrub`. How a drag changes a control's value: the drag maths over the control's number, and the sources a drag starts on - `pub fn new(drag: ValueDrag, read: impl Fn(&V) -> f64 + Send + Sync + 'static, write: impl Fn(f64) -> V + Send + Sync + 'static) -> Self`. A scrub by `drag`, reading the number a value holds with `read` and making a value of a number with `write`. - `pub fn by_label(mut self) -> Self`. A drag on the control's side label scrubs, with or without the focus in the control; the label senses the - `pub fn part(mut self, part: impl Into, drag: ValueDrag) -> Self`. A drag on the part `part` scrubs by `drag`, with or without the focus in the control: a scrub handle, or an - `pub fn on_field(mut self) -> Self`. A drag on the control's body scrubs while its text part does not take the pointer: a field that is not in - `craft_ui::contract::SelectMode`: `pub enum SelectMode { None, Single, Multi, Cells }`. What a collection lets the user select. - `craft_ui::contract::SetPosition`: re-export of `craft_ui::runtime::access::SetPosition`. - `craft_ui::contract::SettleCx`: `pub struct SettleCx<'a>`. The body's memory after the real run: the same `Remember` access the body's context has, and the `Held` and - `craft_ui::contract::ShellPane`: `pub struct ShellPane { pub name: &'static str, pub edge: PaneEdge, pub extent: Option, pub at: Option }`. One of `AppShell`'s panes. - `pub const fn new(name: &'static str) -> Self`. The central pane named `name`. - `pub const fn edge(mut self, edge: PaneEdge) -> Self`. The pane at `edge`. - `pub const fn extent(mut self, extent: f32) -> Self`. The pane's size along its edge, exactly: the pane host shows it at this extent in every pass. - `pub const fn at(mut self, rect: Rect) -> Self`. The pane in `rect`, which the caller laid out for this pass. The pane takes no room from its siblings. - `craft_ui::contract::ShownRow`: `pub struct ShownRow { pub key: K, pub rect: egui::Rect, pub cells: Vec<(ColumnKey, egui::Rect)>, pub openers: Vec<(crate::contract::ItemOpener, Response)> }`. The geometry of one row the collection showed this pass. - `craft_ui::contract::SideLabel`: `pub struct SideLabel { pub kind: LabelKind, pub layout: FieldLayout, pub role: FieldLabelRole, pub scrub: bool, pub reset_dot: bool, pub icon: Option>, pub detail: Option

`. What a component registers with `Pointer::window_drop_target`: a target over the whole window, which needs no - `type Drop`. What a drop on this target carries to the component's caller. - `fn accept(&self, payload: &P, op: DropOperation) -> Option`. `None` rejects. `op` is the operation the held modifiers pick, which a target may refuse. - `fn mark(&self, drop: &Self::Drop) -> DropMark`. Where `drop` would land, a value the ghost layer paints. - `craft_ui::runtime::drag::active`: `pub fn active(ctx: &Context) -> Option>`. The active drag payload of type `P`, from any viewport. For code without a `Cx`. - `craft_ui::runtime::drag::amend`: `pub fn amend(ctx: &Context, change: impl FnOnce(&mut P)) -> bool`. Changes the running session's payload of type `P` (or its second payload of that type) with `change`, in the frame - `craft_ui::runtime::drag::cancel`: `pub fn cancel(ctx: &Context, reason: CancelReason)`. Ends the session without a drop; the source's press ends with it, so nobody gets a drop. ## `craft_ui::runtime::edit` The pass's edit events and edit-command routing: the context-free calls an app makes around edits. - `craft_ui::runtime::edit::cancel_all`: `pub fn cancel_all(ctx: &Context, reason: CancelReason)`. Cancels every running gesture at its next step 4, which then stays cancelled under its press. The app's undo and - `craft_ui::runtime::edit::next_gesture_id`: `pub fn next_gesture_id(ctx: &Context) -> GestureId`. A gesture id no gesture of this context has had: ids grow in the order gestures begin, across components and - `craft_ui::runtime::edit::watch_gestures`: `pub fn watch_gestures(ctx: &Context, body: impl FnOnce() -> R) -> (R, bool)`. Runs `body` and says whether a gesture of a component shown inside it was running after the component's apply ## `craft_ui::runtime::egui::access` AccessKit node building, `register_accesskit_parent` and `set_accesskit_focus`: the one place that names - `craft_ui::runtime::egui::access::AccessTree`: `pub struct AccessTree`. The AccessKit tree update of one frame. - `pub fn has(&self, id: Id) -> bool`. Whether the node of `id` exists. - `pub fn role(&self, id: Id) -> Option`. The role of the node of `id`. - `pub fn name(&self, id: Id) -> Option<&str>`. The name of the node of `id`. - `pub fn description(&self, id: Id) -> Option<&str>`. The description of the node of `id`. - `pub fn description_of(&self, key: NodeKey) -> Option<&str>`. The description of a node by key. - `pub fn shortcut_of(&self, key: NodeKey) -> Option<&str>`. The keyboard shortcut a node by key lists. - `pub fn value_of(&self, key: NodeKey) -> Option<&str>`. The text value of a node by key. - `pub fn value(&self, id: Id) -> Option<&str>`. The text value of the node of `id`. - `pub fn numeric(&self, id: Id) -> Option`. The numeric value and range of the node of `id`. - `pub fn numeric_of(&self, key: NodeKey) -> Option`. The numeric value and range of a node by key. - `pub fn is_disabled(&self, id: Id) -> bool`. Whether the node of `id` is reported as disabled. - `pub fn declares(&self, id: Id, action: Declared) -> bool`. Whether the node of `id` declares `action`. - `pub fn labelled_by(&self, id: Id) -> Vec`. The nodes that name the node of `id`. - `pub fn labelled_by_key(&self, key: NodeKey) -> Vec`. [`AccessTree::labelled_by`] for a node by key. - `pub fn described_by(&self, id: Id) -> Vec`. The nodes that describe the node of `id`. - `pub fn position(&self, id: Id) -> Option<(usize, usize)>`. The place of the node of `id` in its set: its zero-based index and the size of the set. - `pub fn grid_of(&self, key: NodeKey) -> GridPlace`. The row and column indexes and counts of a node by key. - `pub fn sort_of(&self, key: NodeKey) -> Option`. The sort order a column header node by key shows: `true` descending. - `pub fn declares_sort(&self, key: NodeKey) -> bool`. Whether a column header node declares a sort direction: it sorts when activated, sorted now or not. - `pub fn expanded(&self, id: Id) -> Option`. The expanded state of the node of `id`. - `pub fn has_popup(&self, id: Id) -> Option`. The kind of popup the node of `id` opens. - `pub fn controls(&self, id: Id) -> Vec`. The nodes the node of `id` controls. - `pub fn is_modal(&self, key: NodeKey) -> bool`. Whether the node of `key` is modal. - `pub fn live(&self, id: Id) -> Option`. The live politeness of the node of `id`. - `pub fn invalid(&self, id: Id) -> bool`. Whether the node of `id` is marked invalid. - `pub fn run_texts(&self, id: Id) -> Vec`. The text of each `TextRun` node below `id`, in order. - `pub fn text_selection(&self, id: Id) -> Option<((NodeKey, usize),(NodeKey, usize))>`. The selection of the text node `id` as the run node and character index of its anchor and focus. - `pub fn name_of(&self, key: NodeKey) -> Option<&str>`. The name of a node by key. - `pub fn toggled_of(&self, key: NodeKey) -> Option>`. The toggled state of a node by key. - `pub fn expanded_of(&self, key: NodeKey) -> Option`. The expanded state of a node by key. - `pub fn has_popup_of(&self, key: NodeKey) -> Option`. The kind of popup the node of `key` opens. - `pub fn access_key_of(&self, key: NodeKey) -> Option`. The access key of the node of `key`. - `pub fn current_of(&self, key: NodeKey) -> bool`. Whether the node of `key` is the current item of its set (the current page). - `pub fn parent_of(&self, id: Id) -> Option`. The nearest ancestor of `id` that screen readers see: AccessKit's consumer drops generic containers. - `pub fn parent_of_key(&self, key: NodeKey) -> Option`. [`AccessTree::parent_of`] for a node by key. - `pub fn in_ltr_axis(&self, key: NodeKey) -> bool`. Whether the node is, or lies inside, a component whose horizontal axis keeps its left-to-right order - `pub fn keys(&self) -> Vec`. Every node that assistive technology reports. - `pub fn node_count(&self) -> usize`. The number of nodes that assistive technology reports. - `pub fn role_of(&self, key: NodeKey) -> Option`. The role of a node by key. - `pub fn selected_of(&self, key: NodeKey) -> Option`. Whether a node by key is reported as selected: `None` for a node that reports no selected state. - `pub fn bounds_of(&self, key: NodeKey) -> Option`. The bounds of a node by key, in points. - `pub fn is_disabled_key(&self, key: NodeKey) -> bool`. Whether a node by key is reported as disabled. - `pub fn declares_key(&self, key: NodeKey, action: Declared) -> bool`. Whether a node by key declares `action`. - `pub fn children_of(&self, key: NodeKey) -> Vec`. The children of a node by key. - `craft_ui::runtime::egui::access::Declared`: `pub enum Declared { Focus, Click, Increment, Decrement, SetValue, SetTextSelection, Expand, Collapse, Custom, ScrollUp, ScrollDown, ScrollLeft, ScrollRight }`. An action a node declares. - `craft_ui::runtime::egui::access::NodeKey`: `pub struct NodeKey`. A node's number in the tree. - `pub fn of(id: Id) -> NodeKey`. The key of the node of `id`. ## `craft_ui::runtime::egui::areas` `Area` with its left-top pivot, `Order`, sublayers, transform layers and `set_layer_order`. - `craft_ui::runtime::egui::areas::LayerKey`: `pub type LayerKey = egui::LayerId`. An egui layer, as the runtime's shape records name it. - `craft_ui::runtime::egui::areas::LayerOrder`: `pub struct LayerOrder { pub listed_on_top: bool, pub unlisted_keep_order: bool, pub unknown_ignored: bool }`. The layer order after `Context::set_layer_order`. - `craft_ui::runtime::egui::areas::layer_order`: `pub fn layer_order() -> LayerOrder`. Two frames over three areas; the second lists the first area and an unknown layer. ## `craft_ui::runtime::egui::injected` Injected input: pointer moves, clicks, keys and text an automation client asks for, and the event builders - `craft_ui::runtime::egui::injected::hook_without_pass`: `pub fn hook_without_pass(ctx: &Context, viewport: ViewportId) -> Vec`. The input of one hook call for `viewport` with no pass behind it: the events the hook appends. Stands in for - `craft_ui::runtime::egui::injected::move_focus_without_pass`: `pub fn move_focus_without_pass(ctx: &Context, viewport: ViewportId, id: Id)`. Moves the focus the end hook recorded for `viewport` to the component `id` with no pass, as the application does ## `craft_ui::runtime::egui::input` Raw input in the input hook, key events converted to craft-keymap's key types, `InputOptions`. - `craft_ui::runtime::egui::input::RawInput`: re-export of `egui::RawInput` (outside these crates). ## `craft_ui::runtime::egui::screenshot` One-shot screenshot slots and the facts a screenshot is measured against. - `craft_ui::runtime::egui::screenshot::ScreenshotError`: `pub enum ScreenshotError { DimensionsOverflow { width: usize, height: usize }, MalformedImage { width: usize, height: usize, pixels: usize }, ImageTooLarge { bytes: usize, max_bytes: usize } }`. Why a completed screenshot was rejected and released. - `craft_ui::runtime::egui::screenshot::ScreenshotFacts`: `pub struct ScreenshotFacts { pub size_points: Vec2, pub pixels_per_point: f32, pub zoom: f32, pub max_texture_side: usize, pub minimized: bool }`. What a screenshot of the running viewport measures this pass. - `craft_ui::runtime::egui::screenshot::ScreenshotSlot`: `pub struct ScreenshotSlot`. The live request side of a screenshot. Keep it alive until the result is taken or the request is cancelled; - `pub fn take(&self) -> Option, ScreenshotError>>`. Takes the completed result, at most once. - `pub fn cancel(&self)`. Cancels the request and releases any completed image. A completion that published its result before this - `pub fn detached(ctx: &Context, viewport: ViewportId, max_image_bytes: usize) -> (Self, ScreenshotCallback)`. A slot with its callback and no command sent, for trials that stand in for the renderer. - `pub fn complete(&self, image: Arc)`. Completes the slot with `image` as the renderer would, without the callback. - `pub fn lock_is_free(&self) -> bool`. Whether the slot mutex is free, proving the wakeup runs after the lock was released. ## `craft_ui::runtime::env` `Env` and scopes, app values and `content_env`. - `craft_ui::runtime::env::Env`: `pub struct Env`. The inherited context of a `Ui`: one `Arc` clone per read. - `pub fn words(&self) -> Arc`. The word set `L` in the scope's language. - `pub fn format(&self) -> &Format`. How the scope writes numbers: locale digits, separators and grouping. - `pub fn dates(&self) -> Arc`. How the scope writes dates: the host's catalog format, else the system region's. - `pub fn today(&self) -> Option`. Today's date as the host supplied it with `RootEnv::today`; `None` when it gave none. - `pub fn units(&self) -> Units`. The scope's number format and unit words, to read and write numbers with their unit. - `pub fn relative_age(&self, seconds: u64, style: AgeStyle) -> String`. How long ago `seconds` was, in the scope's language and digits: "Just now", "3 minutes ago", "Yesterday". - `pub fn of(ui: &Ui) -> Env`. The env of `ui`: the nearest entry up the `Ui` stack, else the running viewport's root env, so the `Ui` - `pub fn get(&self) -> T`. A clone of the innermost app value, else `T::root()`. Large values hold an `Arc`. - `pub fn capture(&self) -> EnvCapture`. The inherited group only; layer-local fields start fresh where the capture is installed. - `pub fn view(&self) -> EnvView<'_>`. What component code sees of this env. - `pub fn folder(&self) -> Folder`. Folds text for search in the scope's language: case and accents ignored, dotted and dotless i by locale. - `pub fn collator(&self) -> Arc`. Orders text in the scope's language, with runs of digits by value (`Layer 2` before `Layer 10`). - `craft_ui::runtime::env::EnvCapture`: `pub struct EnvCapture`. The inherited group of an env, captured to open a popup or viewport: the layer-local fields are reset. - `craft_ui::runtime::env::Inherited`: `pub struct Inherited { pub tokens: Arc, pub os: Os, pub active: bool, pub words: Arc, pub line_ratio: f32, pub motion: MotionPolicy, pub scale: Scale, pub values: AppValues }`. The values of an env that a scope rarely changes: the resolved tokens, the platform, the language and the app's - `craft_ui::runtime::env::Scoped`: `pub struct Scoped { pub ink: Ink, pub key: EnvKey, pub size: ControlSize, pub glyphs: GlyphRole, pub enabled: bool, pub read_only: bool, pub wheel: WheelScope, pub direction: Direction, pub text_direction: Direction, pub ids_stable: bool, pub arena: Option, pub transform: Option }`. The values of an env. - `craft_ui::runtime::env::AgeStyle`: re-export of `craft_i18n::AgeStyle` (outside these crates). - `craft_ui::runtime::env::AppValues`: `pub struct AppValues`. The app values a root, a scope or a component's `content_env` carries: one entry per `EnvValue` type, the - `pub fn set(&mut self, value: T) -> &mut Self`. Sets the value of type `T`. - `craft_ui::runtime::env::ArenaId`: `pub struct ArenaId(pub Id)`. The id of an arena, carried in `Env.arena`. - `pub const fn new(id: Id) -> Self`. The arena whose id is `id`. - `craft_ui::runtime::env::BodyMode`: `pub enum BodyMode { Normal, Only }`. What the window shows besides its body. - `craft_ui::runtime::env::Count`: re-export of `craft_i18n::Count` (outside these crates). - `craft_ui::runtime::env::Counted`: re-export of `craft_i18n::Counted` (outside these crates). - `craft_ui::runtime::env::Direction`: re-export of `craft_i18n::Direction` (outside these crates). - `craft_ui::runtime::env::EnvValue`: re-export of `craft_ui_macros::EnvValue` (outside these crates). - `craft_ui::runtime::env::EnvView`: `pub struct EnvView<'a>`. What component code sees: everything in `Env` except tokens, size, enabled, read-only, arena, transform - `pub fn inside_label(&self) -> Option<&'a crate::contract::InsideLabel>`. The inside label the component shows in its slot, when it is the control of a side label with - `pub fn surface(&self) -> crate::style::SurfaceKind`. The surface the component sits on: the innermost container or collection surface that paints a fill, else the - `pub fn direction(&self) -> Direction`. The flow direction: layout order, arrow keys and roving. - `pub fn text_direction(&self) -> Direction`. The paragraph direction of text, which only a scope that sets the interface's direction changes. - `pub fn mode(&self) -> Mode`. The light or dark mode the scope's tokens are resolved in: the app's, or the one a scope with its own tokens - `pub fn motion(&self) -> MotionPolicy`. The motion mode in effect. - `pub fn scale(&self) -> Scale`. The pixels per point. - `pub fn shell(&self) -> &'a ShellInfo`. The platform and the running viewport's window facts: the OS, the capabilities and the window's kind, - `pub fn keyboard_layout(&self) -> &'a craft_keymap::Layout`. The keyboard layout: which character each key position types, for text that names a key. - `pub fn host(&self) -> Option<&'a Arc>`. The app's `Host`, from `FrameInput.host`. - `pub fn get(&self) -> T`. A clone of the innermost app value, else `T::root()`. - `pub fn words(&self) -> Arc`. The word set `L` in the scope's language, built once per `Words`. - `pub fn format(&self) -> &'a Format`. How the scope writes numbers: locale digits, separators and grouping. - `pub fn dates(&self) -> Arc`. How the scope writes dates: the host's catalog format, else the system region's. - `pub fn today(&self) -> Option`. Today's date as the host supplied it with `RootEnv::today`; `None` when it gave none. - `pub fn units(&self) -> Units`. The scope's number format and unit words, to read and write numbers with their unit. - `pub fn relative_age(&self, seconds: u64, style: AgeStyle) -> String`. How long ago `seconds` was, in the scope's language and digits: "Just now", "3 minutes ago", "Yesterday". - `pub fn counted(&self, count: Counted, n: u64) -> String`. `n` things by the count word `count`, in the scope's language and digits: "1 page", "3 pages". - `pub fn resolve(&self, label: &Label) -> Label`. `label` with a `Word` replaced by its text in the scope's language: what domain code that draws a `Label` - `craft_ui::runtime::env::Label`: `pub enum Label { Empty, Static(&'static str), Shared(Arc), Word(Word) }`. A label: a literal stays borrowed, a built string is shared. Cloning is cheap. - `pub fn as_str(&self) -> &str`. The text of a label whose `Word` is not resolved yet reads as its English text. - `pub fn from_cow(text: Cow<'static, str>) -> Self`. The label of `text`: a borrowed text stays borrowed. - `craft_ui::runtime::env::LengthUnits`: `pub struct LengthUnits { pub stored: UnitKind, pub shown: UnitKind, pub pixels_per_inch: f64 }`. A length kept in one unit and shown in another: what a length field reads and writes (`stored`, the document's - `pub const fn new(stored: UnitKind, shown: UnitKind, pixels_per_inch: f64) -> Self`. A length kept in `stored` and shown in `shown`, with `pixels_per_inch` sizing pixels. - `craft_ui::runtime::env::Message`: `pub struct Message { pub text: Label, pub tone: Option }`. The text of a `Validity`: a label and an optional tone override. `Warn` defaults to `Tone::Warn`, `Refuse` to - `pub fn new(text: impl Into