diff --git a/docs/components-index.md b/docs/components-index.md index fb6552b0a..f973fa469 100644 --- a/docs/components-index.md +++ b/docs/components-index.md @@ -18,7 +18,7 @@ Generated by `cargo run -p craft-ui-gallery --bin components-index`; edit the do | `NavigatorZoomRow<'_>` | Pattern | `craft_ui_canvas::canvas::navigator::zoom_row` | The Navigator's zoom row: a percent field, Zoom Out, a slider over the whole zoom range and Zoom In, in reading order | | `NavigatorPanel<'_>` | Pattern | `craft_ui_canvas::canvas::navigator_panel` | The Navigator panel (Photoshop's Window, Navigator): the [`Navigator`] preview box over the [`NavigatorZoomRow`], both bound to one view | | `Pasteboard<'_>` | Leaf | `craft_ui_canvas::canvas::pasteboard` | The pasteboard and page frames under a document | -| `RasterDisplay<'_>` | Leaf | `craft_ui_canvas::canvas::raster` | The CPU raster display of one canvas: the document drawn through the view of the [`Canvas`](super::Canvas) it is shown in, at the canvas rect | +| `RasterDisplay<'_>` | Leaf | `craft_ui_canvas::canvas::raster` | The document display of one canvas: the document drawn through the view of the [`Canvas`](super::Canvas) it is shown in, at the canvas rect | | `RotateView<'_>` | Leaf | `craft_ui_canvas::canvas::rotate` | The compass of a turned view: a dial whose needle points where the document's up lies on screen | | `Rulers<'_>` | Leaf | `craft_ui_canvas::canvas::rulers` | The rulers of a canvas: ticks and labels counted from a zero point, level whatever the view's rotation, a pointer marker, the guide drag-out and the zero point's corner | | `CanvasScrollbars<'_>` | Leaf | `craft_ui_canvas::canvas::scrollbars` | The scroll bars of a canvas | diff --git a/docs/contract-api.md b/docs/contract-api.md index 267858931..e4d70b027 100644 --- a/docs/contract-api.md +++ b/docs/contract-api.md @@ -248,6 +248,7 @@ Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item lay - `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::sub_row_cells`: re-export of `craft_behavior::columns::sub_row_cells`. - `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`. @@ -371,13 +372,14 @@ Column keys, widths and the sections a grid layout reports. - `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. +- `craft_behavior::columns::ColumnWidth`: `pub enum ColumnWidth { Content, Fixed(f32), Controls(f32), Toggle, 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::columns::sub_row_cells`: `pub fn sub_row_cells(cells: &mut [(ColumnKey, Rect)], is_toggle: impl Fn(&ColumnKey) -> bool, indent: f32, rtl: bool)`. Moves the toggle cells of a sub-row (`ItemSource::sub_row`) into its content: side by side in column order, each ## `craft_behavior::command` @@ -1004,7 +1006,7 @@ 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::EditCommand`: `pub enum EditCommand { Cut, Copy, Paste, SelectAll, Undo, Redo, Delete }`. 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. @@ -1112,6 +1114,7 @@ Where a collection's items come from: the data traits and the one way to show a - `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 + - `fn sub_row(&self, _at: usize) -> Option`. `Some(steps)` when entry `at` is a sub-row of an entry above it (a layer's effects): a compact row whose toggle - `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. @@ -1345,6 +1348,7 @@ Pointer values and the press lifecycle (8.1, 8.2), egui-free: the runtime conver - `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 release_held(&self) -> bool`. Whether the button went up and the release waits for a later pass, which the caller must ask for: no input may - `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`. @@ -1867,6 +1871,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st - `pub const fn descending(key: ColumnKey) -> Self`. Rows sorted by `key`, descending. - `craft_ui::contract::ColumnSpec`: `pub struct ColumnSpec { pub key: ColumnKey, pub header: Label, pub width: ColumnWidth, pub resizable: bool, pub sortable: bool, pub movable: bool, pub frozen: bool, pub kind: ColumnKind, pub align: ColumnAlign, pub tabular: bool, pub first_descending: bool, pub icon: Option, pub tip: Option