mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-30 18:27:00 +01:00
Merge craft-libs main 07a8c471ed into the port (skeleton: conflict markers left in for the area merges)
Cargo.toml takes main's egui pin (932a73b2) and vendor list; Cargo.lock is main's, resolved again after the combine. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
a3bd3e5e07
1709 files changed
+179384
-10423
No files matched your search
+74
-31
@@ -209,7 +209,7 @@ Pure UI behaviours (layer 1): press lifecycle, `ValueDrag`, navigation, item lay
|
||||
- `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) -> RangeInclusive<usize>`. The least and most decimals a ruler writes a tick of labelled step `step` with. Whole ticks are whole numbers;
|
||||
- `pub fn label_decimals(&self, step: f64) -> RangeInclusive<usize>`. The least and most decimals a ruler writes a tick of labelled step `step` with.
|
||||
- `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`.
|
||||
@@ -330,7 +330,7 @@ The transform a canvas body is shown through, and the canvas view with its zoom
|
||||
- `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) -> RangeInclusive<usize>`. The least and most decimals a ruler writes a tick of labelled step `step` with. Whole ticks are whole numbers;
|
||||
- `pub fn label_decimals(&self, step: f64) -> RangeInclusive<usize>`. The least and most decimals a ruler writes a tick of labelled step `step` with.
|
||||
- `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::TickLabels`: `pub enum TickLabels { Distance, Signed }`. How a ruler writes the number at a labelled tick.
|
||||
- `craft_behavior::canvas::Ticks`: `pub enum Ticks { Decimal { whole: bool }, Custom(fn(f64) -> (f64, u32)) }`. How a ruler divides its unit at a zoom.
|
||||
@@ -504,7 +504,7 @@ The dock model: the tree of splits over panel frames, the side of a group a drop
|
||||
- `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<Axis>`. 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<P> { Move { panel: P, anchor: P, placement: DockPlacement<P> }, Float { panel: P, rect: Rect }, Close { panel: P }, Activate { panel: P }, Open { panel: P, anchor: Option<P> }, OpenAt { panel: P, anchor: P, placement: DockPlacement<P> }, MoveFloating { panel: P, rect: Rect, edge: Option<DockEdge> }, ResizeSplit { path: Vec<bool>, size: SplitSize }, SetStackOpen { panel: P, open: bool }, ResizeStack { panel: P, height: Option<f32> }, MoveGroup { panel: P, to: Target<P> }, StepGroup { panel: P, up: bool }, MoveColumn { panel: P, to: Target<P> }, MoveWindow { panel: P, to: Target<P> }, CloseGroup { panel: P }, CloseWindow { panel: P }, CloseOthers { panel: P }, SetMinimized { panel: P, minimized: bool }, SetIconic { panel: P, iconic: bool }, ResizeColumn { panel: P, width: f32 }, SetColumnSteps { panel: P, steps: u16 }, ResizeGroup { panel: P, height: Option<f32> }, ResizeFlyoutWidth { panel: P, width: Option<f32> }, MoveFlyoutTop { panel: P, offset: Option<f32> }, ResizeIconic { panel: P, width: Option<f32> }, SetNative { panel: P, placement: Option<Placement> }, MovePanel { panel: P, to: Target<P> } }`. Groups, columns and floating windows are named by a panel they contain.
|
||||
- `craft_behavior::dock::Action`: `pub enum Action<P> { Move { panel: P, anchor: P, placement: DockPlacement<P> }, Float { panel: P, rect: Rect }, Close { panel: P }, Activate { panel: P }, Open { panel: P, anchor: Option<P> }, OpenAt { panel: P, anchor: P, placement: DockPlacement<P> }, MoveFloating { panel: P, rect: Rect, edge: Option<DockEdge> }, ResizeSplit { path: Vec<bool>, size: SplitSize }, SetStackOpen { panel: P, open: bool }, ResizeStack { panel: P, height: Option<f32> }, MoveGroup { panel: P, to: Target<P> }, StepGroup { panel: P, up: bool }, MoveColumn { panel: P, to: Target<P> }, MoveWindow { panel: P, to: Target<P> }, CloseGroup { panel: P }, CloseWindow { panel: P }, CloseOthers { panel: P }, SetMinimized { panel: P, minimized: bool }, SetIconic { panel: P, iconic: bool }, ResizeColumn { panel: P, width: f32 }, SetColumnSteps { panel: P, steps: u16 }, ResizeGroup { panel: P, height: Option<f32> }, ResizeFlyoutWidth { panel: P, width: Option<f32> }, MoveFlyoutTop { panel: P, offset: Option<f32> }, ResizeIconic { panel: P, width: Option<f32> }, SetNative { panel: P, placement: Option<Placement> }, MovePanel { panel: P, to: Target<P> }, Restore { panel: P, location: Location<P> } }`. Groups, columns and floating windows are named by a panel they contain.
|
||||
- `pub fn move_beside(panel: P, anchor: P, placement: DockPlacement<P>) -> Self`. Builds [`Action::Move`].
|
||||
- `pub fn float(panel: P, rect: Rect) -> Self`. Builds [`Action::Float`].
|
||||
- `pub fn close(panel: P) -> Self`. Builds [`Action::Close`].
|
||||
@@ -533,6 +533,7 @@ The dock model: the tree of splits over panel frames, the side of a group a drop
|
||||
- `pub fn resize_iconic(panel: P, width: Option<f32>) -> Self`. Builds [`Action::ResizeIconic`].
|
||||
- `pub fn set_native(panel: P, placement: Option<Placement>) -> Self`. Builds [`Action::SetNative`].
|
||||
- `pub fn move_panel(panel: P, to: Target<P>) -> Self`. Builds [`Action::MovePanel`].
|
||||
- `pub fn restore(panel: P, location: Location<P>) -> Self`. Builds [`Action::Restore`].
|
||||
- `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<usize>`. 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:
|
||||
@@ -633,7 +634,7 @@ The dock model: the tree of splits over panel frames, the side of a group a drop
|
||||
- `pub fn version(&self) -> u32`. The format version the workspace was read with.
|
||||
- `pub fn layout(&self) -> &Layout<P>`. The current arrangement.
|
||||
- `pub fn hidden(&self) -> &[(P, Location<P>)]`. The closed panels, and panels the application does not register now, with where each one goes back.
|
||||
- `pub fn floated(&self) -> &[(P, Location<P>)]`. The floating panels with the docked location each one left.
|
||||
- `pub fn floated(&self) -> &[(P, Location<P>)]`. The floating panels, and the closed panels that were floating, with the docked location each one left.
|
||||
- `pub fn revision(&self) -> Revision`. The revision of this workspace value: it moves with every write, and no other value has it.
|
||||
- `pub fn generation(&self) -> u64`. The generation of this live workspace: it moves with every [`replace`](Self::replace) and nothing else.
|
||||
- `pub fn raise_window_floor(&mut self, floor: u64)`. Keeps the ids of new floating windows at or above `floor`. A dock that showed windows below `floor` raises a
|
||||
@@ -708,9 +709,11 @@ When a component's remembered state is due for eviction.
|
||||
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<usize>, pub overflow: Vec<usize>, pub short: Vec<usize> }`. 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, pub short: Option<f32> }`. One item as the fit rule sees it: its extent along the strip, its section and whether it may overflow.
|
||||
- `craft_behavior::fit::FitItem`: `pub struct FitItem { pub extent: f32, pub section: u16, pub keep: FitKeep, pub short: Option<f32>, pub short_order: u16, pub short_late: bool }`. 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`.
|
||||
- `pub const fn short(mut self, extent: f32) -> Self`. The item with a shorter form `extent` long, which it takes before any free item leaves.
|
||||
- `pub const fn short(mut self, extent: f32) -> Self`. The item with a shorter form `extent` long, which it takes before any free item leaves unless it is late.
|
||||
- `pub const fn short_order(mut self, order: u16) -> Self`. The item with its short form ranked `order`: lower ranks shorten first, and the last item of a rank first.
|
||||
- `pub const fn short_late(mut self) -> Self`. The item takes its short form only after every free item that can leave has left.
|
||||
- `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<usize>, 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, keep_selected: bool) -> TabFit`. Fit tab widths into `available` points, shrinking the widest tabs first to a common cap.
|
||||
@@ -769,7 +772,7 @@ Pure focus rules (spec 9.3, 9.4, 8.3): key ownership, the Escape order and the f
|
||||
The step of one pass of motion: a Hand glide, a held Zoom press and an autoscroll integrate over it.
|
||||
|
||||
- `craft_behavior::frame_step::FRAME_STEP_MAX`: `pub const FRAME_STEP_MAX: f64`. The longest step motion integrates, in seconds, so a stalled pass never jumps the view.
|
||||
- `craft_behavior::frame_step::frame_step`: `pub fn frame_step(dt: f64) -> f64`. The step of a pass that came `dt` seconds after the previous one, `dt` being the time between two readings of the
|
||||
- `craft_behavior::frame_step::frame_step`: `pub fn frame_step(dt: f64) -> f64`. The step of a pass that came `dt` seconds after the previous one, kept within `0..=FRAME_STEP_MAX`.
|
||||
|
||||
## `craft_behavior::geometry`
|
||||
|
||||
@@ -854,7 +857,7 @@ The crop frame's pure geometry: the box, where a press lands on it, what each ge
|
||||
- `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<f64>) -> 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, min: f64) -> bool`. Whether both sides are at least `min`, and never under one document unit whatever `min` says (a `min` that is
|
||||
- `pub fn size_ok(&self, min: f64) -> bool`. Whether both sides are at least `min`, and never under one document unit whatever `min` says.
|
||||
- `pub fn resized(&self, part: BoxPart, by: Vec2, hold: AspectHold, 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, hold: AspectHold, alt: bool) -> Option<Self>`. [`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<f64>, image: bool) -> Self`. The frame turned from this one's angle by the pointer's sweep about the centre, from direction `grab`
|
||||
@@ -1583,7 +1586,7 @@ Pointer values and the press lifecycle (8.1, 8.2), egui-free: the runtime conver
|
||||
- `pub fn new() -> Self`. A reader for plain numbers written with `.` as the decimal separator.
|
||||
- `pub fn bare(mut self, factor: f64) -> Self`. A number with no unit counts as `factor` of the reader's base unit (a picas field reads bare numbers as
|
||||
- `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 group(mut self, group: char) -> Self`. The digit-group separator, which the reader skips between digits. A comma or point after zero reads as a
|
||||
- `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 split_unit(mut self, spelling: &str, factor: f64, rest: f64, tag: u32) -> Self`. Like [`Reader::unit_tagged`], where a number written right after the spelling adds that many of `rest`: picas
|
||||
@@ -1832,9 +1835,10 @@ The value core of chapter 10: the bound every value type meets, `Mixed`, edit ev
|
||||
Wheel gesture values, as craft-behavior's copy of egui's types so the wheel split is egui-free.
|
||||
|
||||
- `craft_behavior::wheel::GESTURE_GAP`: `pub const GESTURE_GAP: f64`. The seconds between wheel events that still belong to one gesture.
|
||||
- `craft_behavior::wheel::Wheel`: `pub struct Wheel { pub scroll: Vec2, pub lines: Vec2, pub zoom: f32, pub mods: Mods, pub unit: WheelUnit, pub phase: WheelPhase, pub source: WheelSource, pub at: Option<Pos2>, pub zooms: bool, pub touch_zoom: f32, pub rotation: f32, pub touch_rotation: f32, pub touch_pan: Vec2, pub gathered: Vec2, pub moved: bool }`. One wheel event, or the sum of one pass's, as a taker reads it with `take_wheel`.
|
||||
- `craft_behavior::wheel::Wheel`: `pub struct Wheel { pub scroll: Vec2, pub lines: Vec2, pub zoom: f32, pub zoom_lines: Vec2, pub zoom_gathered: Vec2, pub mods: Mods, pub unit: WheelUnit, pub phase: WheelPhase, pub source: WheelSource, pub at: Option<Pos2>, pub zooms: bool, pub touch_zoom: f32, pub rotation: f32, pub touch_rotation: f32, pub touch_pan: Vec2, pub gathered: Vec2, pub moved: 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 zoom_lines(mut self, lines: Vec2) -> Self`. The same gesture with `lines` wheel lines of motion that zoom (`Wheel::zoom_lines`).
|
||||
- `pub const fn touch_zoom(mut self, zoom: f32) -> Self`. The same gesture with the two-finger touch zoom factor `zoom`.
|
||||
- `pub const fn rotation(mut self, radians: f32) -> Self`. The same gesture with rotation `radians`, clockwise on screen.
|
||||
- `pub const fn touch_rotation(mut self, radians: f32) -> Self`. The same gesture with the two-finger touch rotation `radians`.
|
||||
@@ -1902,6 +1906,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `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 shows_row_focus(&self) -> bool`. Whether keyboard focus shows a ring on the lead row, or on a populated rows viewport with no visible lead.
|
||||
- `fn selection(&mut self) -> Option<BindMut<'_, Self::Selection>>`. The selection binding; `None` keeps it in session memory.
|
||||
- `fn column_layout(&mut self) -> Option<BindMut<'_, ColumnLayout>>`. The column arrangement binding; `None` keeps it in the header's own memory. The header starts each pass from
|
||||
- `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
|
||||
@@ -1912,6 +1917,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `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<Vec2>, _rows: usize, _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<Self::Key>, _env: &crate::runtime::env::Env, _kept: Option<&Self::Key>,) -> Option<Box<dyn ItemSource<Self::Key> + 's>>`. A view of `source` for this pass, such as the rows a filter keeps; `None` shows `source` as it is. `kept` is the
|
||||
- `fn rings_lead(&self) -> bool`. Whether the focus ring goes around the lead item while the collection has keyboard-visible focus: the item step
|
||||
- `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. An auto row's measure reads the item this
|
||||
- `fn rename_editor(&mut self, _ui: &mut Ui, _draft: Bind<'_, String>, _label: Rect, _name: &str) -> Option<EditResponse<String>>`. The rename editor at `label`: the label rect the renaming item reports (`ItemOutput::label_rect`), else its row.
|
||||
- `fn hosts_header(&self, _column: &ColumnKey) -> bool`. Whether the collection hosts a component in the header cell of `column`: the header then calls `header_cell`
|
||||
@@ -1943,7 +1949,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `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.
|
||||
- `const RULE: bool`. Whether the component is a rule between groups of members (a divider). In a bar's line a rule shows only when
|
||||
- `const RULE: bool`. Whether the component is a rule between groups of members (a divider). In a bar's line the bar draws it, as a
|
||||
- `type Style`. The style type.
|
||||
- `type Output`. `Response`, `EditResponse<T>` 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
|
||||
@@ -2271,6 +2277,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `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<U>(self, f: impl Fn(T) -> U) -> EditResponse<U>`. 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::EditorHandle`: `pub struct EditorHandle`. The editor part's widget, rect, purpose, focus and read-only state of this pass, which a body that runs inside a
|
||||
- `pub fn focused(&self) -> bool`. Whether the editor part holds the key focus this pass, whether or not its window has the system's.
|
||||
- `pub fn report(&self, ctx: &egui::Context, state: EditorState<'_>)`. Reports the caret and composition to the input-method engine and puts the text facts in the running pass's
|
||||
- `pub fn ime_receipt(&self, ctx: &egui::Context, before: ImeStamp, after: ImeStamp) -> bool`. Notes the input-method receipt between the stamps `before` and `after` for this editor part; true when the
|
||||
- `pub fn ime_application_change(&self, ctx: &egui::Context)`. Notes an application change of this editor part's committed text.
|
||||
@@ -2364,10 +2371,11 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `craft_ui::contract::GroupState`: `pub struct GroupState<M> { pub selected: Option<M>, pub members: Vec<(M, Id, bool)> }`. A group's registrations: the members shown in the last pass and the member the group picked.
|
||||
- `craft_ui::contract::HeaderEdge`: `pub enum HeaderEdge { Start, End }`. An edge of a header's line, where a container's own header parts sit.
|
||||
- `craft_ui::contract::HeaderMenuRequest`: `pub struct HeaderMenuRequest { pub column: Option<ColumnKey>, pub at: Pos2 }`. A request for the header menu: a secondary click on a header cell or on the empty header after the last one, or the
|
||||
- `craft_ui::contract::HeaderParts`: `pub struct HeaderParts { pub start: f32, pub end: f32 }`. The room a container's own parts take on its header's line (`Container::header_parts`): a width at the start edge
|
||||
- `craft_ui::contract::HeaderParts`: `pub struct HeaderParts { pub start: f32, pub end: f32, pub end_least: Option<f32>, pub keep: f32 }`. The room a container's own parts take on its header's line (`Container::header_parts`): a width at the start edge
|
||||
- `pub const NONE: HeaderParts`. No room for parts.
|
||||
- `pub const fn start(mut self, width: f32) -> Self`. `width` at the start edge.
|
||||
- `pub const fn end(mut self, width: f32) -> Self`. `width` at the end edge.
|
||||
- `pub const fn end_narrows(mut self, least: f32, keep: f32) -> Self`. The end edge narrows, down to `least`, so the header's children keep `keep` of the line: on a line too narrow
|
||||
- `craft_ui::contract::HeaderRegion`: `pub struct HeaderRegion { pub band: DragBand, pub rule: bool, pub heads: bool, pub rule_above: bool, pub inline: bool, pub trailing: bool, pub fill: Option<BandFill>, pub inset: Pad, pub gap: Option<Gap> }`. A header region, filled by `Container::header`.
|
||||
- `pub const fn new() -> Self`. A header with no drag band, no rule, on its own line, with no trailing region, no fill and no inset.
|
||||
- `pub const fn fill(mut self, kind: SurfaceKind) -> Self`. The surface of a band behind the header.
|
||||
@@ -2414,6 +2422,8 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `fn open_request(&self) -> Option<super::OpenChange<()>>`. The item asks to open or close its children, as a click on its disclosure does. The collection reports it
|
||||
- `fn menu_request(&self) -> Option<egui::Rect>`. The item asks for its menu from one of its parts (a row's "More" button): the part's rect, in the item's layer.
|
||||
- `fn label_rect(&self) -> Option<egui::Rect>`. The rect of the item's label, where a rename editor goes; `None` puts it over the whole row.
|
||||
- `fn lead_fill(&self) -> Option<craft_theme::Rgba>`. The lead item's resolved fill, which the collection uses as the background of its focus ring.
|
||||
- `fn lead_focus_bounds(&self) -> Option<egui::Rect>`. The lead item's focus ring bounds, in the item's layer. The default uses the item's full bounds.
|
||||
- `craft_ui::contract::Job`: re-export of `craft_ui::runtime::pending::Job`.
|
||||
- `craft_ui::contract::LabelKind`: `pub enum LabelKind { Text, Hidden, Glyph(GlyphLabel), Short(Label) }`. How a side label is shown.
|
||||
- `craft_ui::contract::LabelPress`: `pub enum LabelPress { Focus, Link }`. What a click on a control's side label does.
|
||||
@@ -2424,7 +2434,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `pub fn show<R>(self, ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> Option<R>`. Runs `add` in a child `Ui` placed in flow in `ui`, or takes the remembered extent there; `None` when it did not
|
||||
- `craft_ui::contract::LeadOnOpen`: `pub enum LeadOnOpen { Selected, First }`. Where the lead starts when the collection first shows rows.
|
||||
- `craft_ui::contract::LeadSource`: `pub enum LeadSource { Keys, Pointer }`. What moved the lead.
|
||||
- `craft_ui::contract::LeastWidth`: `pub enum LeastWidth { Popup, Dialog, DialogButton, DialogSideButton, Rail(std::num::NonZeroU8), WideDialog, SideMenu, DockColumn }`. A size role that sets the least width of a container's content or of a button.
|
||||
- `craft_ui::contract::LeastWidth`: `pub enum LeastWidth { Popup, Dialog, DialogButton, DialogSideButton, Rail(std::num::NonZeroU8), WideDialog, SideMenu, DockColumn, Palette }`. A size role that sets the least width of a container's content or of a button.
|
||||
- `pub fn points(self, tokens: &craft_theme::Tokens) -> f32`. The width the role names in `tokens`.
|
||||
- `craft_ui::contract::LinkLabelInk`: `pub enum LinkLabelInk { Accent, Neutral }`. The ink of a field's label shown as a link ([`SideLabel::link`]), which opens its control's options. An app sets it
|
||||
- `craft_ui::contract::LinkLabelUnderline`: `pub enum LinkLabelUnderline { Edge, Inside }`. Where a one-line link label ([`SideLabel::link`]) draws its underline. An app sets it once at its root
|
||||
@@ -2494,7 +2504,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `fn unshown(response: Response) -> Option<Self> where Self: Sized,`. The output of a layer-like container that shows nothing this pass (closed, past its exit fade): `response` is
|
||||
- `fn value_text(&self) -> Option<&str>`. The shown value as the component words it to assistive technology; `None` for a component that gives none.
|
||||
- `fn story_facts(&self) -> crate::testing::StoryOutput`. The facts a story reports about this output: its id, click, edit kinds, collection kinds and visible range.
|
||||
- `craft_ui::contract::Overlay`: `pub struct Overlay { pub place: Place, pub fit: OverlayFit, pub min_width: MinWidth, pub movable: bool, pub resize: Resize, pub rank: Rank, pub keys: OwnerClass, pub focus: FocusPolicy, pub dismiss: Dismiss, pub motion: MotionSpec, pub opener: Option<Opener>, pub popup: PopupKind, pub size: Option<Vec2>, pub size_limits: SizeLimits, pub placed: Option<Rect>, pub placed_at: Option<Pos2>, pub bounds: Option<Rect>, pub opacity: f32, pub body_scroll: bool, pub moves_window: bool, pub moved_by_app: bool, pub continue_move: Option<Vec2>, pub role: LayerRole }`. Data describing an egui layer. Presets fill focus and dismissal; builders change single fields.
|
||||
- `craft_ui::contract::Overlay`: `pub struct Overlay { pub place: Place, pub fit: OverlayFit, pub min_width: MinWidth, pub movable: bool, pub drag_bounds: DragBounds, pub resize: Resize, pub rank: Rank, pub keys: OwnerClass, pub focus: FocusPolicy, pub dismiss: Dismiss, pub motion: MotionSpec, pub opener: Option<Opener>, pub popup: PopupKind, pub size: Option<Vec2>, pub size_limits: SizeLimits, pub placed: Option<Rect>, pub placed_at: Option<Pos2>, pub bounds: Option<Rect>, pub opacity: f32, pub body_scroll: bool, pub moves_window: bool, pub moved_by_app: bool, pub continue_move: Option<Vec2>, pub role: LayerRole, pub among_windows: bool }`. Data describing an egui layer. Presets fill focus and dismissal; builders change single fields.
|
||||
- `pub fn popover() -> Overlay`. A popover: a popup anchored below, from its content, at least as wide as its anchor and capped by the window,
|
||||
- `pub fn dropdown() -> Overlay`. A dropdown list: from its content, at least as wide as its anchor and capped, focus stays on the anchor. It
|
||||
- `pub fn menu() -> Overlay`. A menu: a popup the arrow keys move through. A press outside closes it and goes no further.
|
||||
@@ -2524,7 +2534,9 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `pub fn opacity(mut self, opacity: f32) -> Overlay`. Sets the layer's opacity, from 0 (invisible) to 1.
|
||||
- `pub fn min_width(mut self, min_width: MinWidth) -> Overlay`. Sets the narrowest width.
|
||||
- `pub fn movable(mut self, on: bool) -> Overlay`. Sets whether the user may move it.
|
||||
- `pub fn drag_bounds(mut self, bounds: DragBounds) -> Overlay`. Sets how much of the layer stays inside the window when the user moves it ([`DragBounds`]):
|
||||
- `pub fn role(mut self, role: LayerRole) -> Overlay`. Sets what the layer is for ([`Overlay::role`]).
|
||||
- `pub fn among_windows(mut self, on: bool) -> Overlay`. Sets whether the layer stands among the floating windows ([`Overlay::among_windows`]).
|
||||
- `pub fn moves_window(mut self, on: bool) -> Overlay`. Sets whether the move band moves the OS window the layer is shown in, in place of the layer.
|
||||
- `pub fn moved_by_app(mut self) -> Overlay`. The app moves the OS window from the move band ([`Overlay::moved_by_app`]).
|
||||
- `pub fn continue_move(mut self, grab: Vec2) -> Overlay`. The move band takes over the held primary press in this pass, with the pointer at `grab` inside the layer
|
||||
@@ -2536,7 +2548,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `pub fn opener_anchor(mut self, anchor: Anchor) -> Overlay`. Sets where the layer hangs when the opener named last opened it. A rect or point is in that opener's layer
|
||||
- `craft_ui::contract::OverlayUi`: `pub struct OverlayUi<'a> { pub closed: Vec<(Id, CloseReason)> }`. What the `overlay` hook gets: one call per anchored popup of this component, built at step 10 with the open state
|
||||
- `pub fn closing(&self, popup: PopupHandle) -> Option<CloseReason>`. Why `popup` closes at the end of this pass, as its `show` decided (its dismissal, or a close its body asked for);
|
||||
- `pub fn is_rtl(&self) -> bool`. Whether the owner lays out right to left: a layer its caller places by position mirrors its own geometry by it,
|
||||
- `pub fn is_rtl(&self) -> bool`. Whether a layer the owner opens lays out right to left (`Scoped::layer_direction`): a layer its caller places by
|
||||
- `pub fn anchor_part(&self, part: impl Into<PartRef>) -> Anchor`. The anchor at the rect of the toggling part `part` of the owner. The layer's placement mirrors the side and
|
||||
- `pub fn contain_popups_below(&mut self)`. Keeps the popups this component shows from here on, and every popup opened from them, below the component:
|
||||
- `pub fn show<R>(&mut self, popup: PopupHandle, overlay: Overlay, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Option<R>`. Shows the popup while its handle is open, on a popup surface, inside `POPUP_PAD`; the content is a body closure.
|
||||
@@ -2554,6 +2566,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `pub fn with_style<R>(&self, variant: Variant, f: impl FnOnce(&StyleCx<'_>) -> R) -> R`. Runs `f` with the style context of this component's env, so app hooks called from `paint` pick colours and
|
||||
- `pub fn child<C: Show>(&mut self, key: impl Hash + Debug, rect: Rect, child: C) -> C::Output`. Shows a child component at a physical rect, with id `cx.key(key)`. The child `Ui` is pinned left to
|
||||
- `pub fn inner<C: Show>(&mut self, key: impl Hash + Debug, rect: Rect, child: C) -> C::Output`. Shows `child` as the owner's own control, such as a picker the owner draws its field with. The child's node
|
||||
- `pub fn label_target(&mut self, key: impl Hash + Debug)`. Makes the child shown with `key` the one a click on the composite's label focuses, in place of the composite's
|
||||
- `pub fn child_with_tip<C: Show>(&mut self, key: impl Hash + Debug, rect: Rect, child: C, tip: impl FnOnce(&mut Ui)) -> C::Output`. Shows a child with rich tooltip content.
|
||||
- `pub fn labelled<C: Show>(&mut self, key: impl Hash + Debug, rect: Rect, label: Label, side: SideLabel, child: C) -> C::Output`. Runs the label step (B2) for one leaf child at `rect`: the label's placement beside or above the child, the
|
||||
- `pub fn face<C: Show>(&mut self, part: impl Into<PartRef>, face: C)`. Paints `face` as the look of `part`: its style, surface and state fill from the part's state merged with the
|
||||
@@ -2679,11 +2692,13 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `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, pub indicator: ScrollIndicator }`. A scrolling body.
|
||||
- `craft_ui::contract::Scroll`: `pub struct Scroll { pub axes: ScrollAxes, pub anchor: ScrollAnchor, pub notch: Notch, pub indicator: ScrollIndicator, pub at_rest: bool }`. A scrolling body.
|
||||
- `pub const fn strips(mut self) -> Scroll`. Shows the overflow along y as scroll strips instead of a bar.
|
||||
- `pub const fn has_strips(&self) -> bool`. Whether the overflow along y shows as scroll strips.
|
||||
- `pub const fn overlay(mut self) -> Scroll`. Shows the overflow as a bar in the container's padding that takes no room from the content and shows only
|
||||
- `pub const fn has_overlay(&self) -> bool`. Whether the overflow shows as an overlay bar.
|
||||
- `pub const fn at_rest(mut self) -> Scroll`. Shows an overlay bar whenever the content overflows, also while the pointer is away from the container. A bar of
|
||||
- `pub const fn overlay_hides_at_rest(&self) -> bool`. Whether the overlay bar shows only while the pointer is over the container or presses the bar.
|
||||
- `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.
|
||||
@@ -2732,7 +2747,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `pub const fn content_width(self) -> bool`. Whether the width follows the content: `Content` and `FillHeight`.
|
||||
- `pub const fn fills_height(self) -> bool`. Whether the height is the available height: `Fill` and `FillHeight`.
|
||||
- `craft_ui::contract::Slot`: re-export of `craft_ui::runtime::memory::Slot`.
|
||||
- `craft_ui::contract::SpaceAction`: `pub enum SpaceAction { Activate, ToggleCell, Preview, None }`. What Space does in a collection (Enter always activates the lead).
|
||||
- `craft_ui::contract::SpaceAction`: `pub enum SpaceAction { Activate, ActivateLead, ToggleCell, Preview, None }`. What Space does in a collection (Enter always activates the lead).
|
||||
- `craft_ui::contract::Stateless`: `pub struct Stateless<F>`. A callback in props: a fn item or a capture-free closure, which is zero-sized, so its type alone says what it
|
||||
- `pub const fn new(f: F) -> Stateless<F>`. `f` as a prop; `f` must capture nothing.
|
||||
- `pub fn get(&self) -> F`. The callback.
|
||||
@@ -2788,6 +2803,7 @@ The component traits, context types, `PaintUi`, `Looks`, the pipeline and its st
|
||||
- `craft_ui::contract::clicked`: `pub fn clicked(response: &Response) -> bool`. Whether `response` reports a click, by pointer or by keyboard activation.
|
||||
- `craft_ui::contract::item_node`: `pub fn item_node<K: std::hash::Hash>(id: Id, key: &K) -> Id`. The access node of the item `key` of the members collection `id` (a tab strip, a swatch table): the sub-node of its
|
||||
- `craft_ui::contract::item_part_open`: `pub fn item_part_open(ctx: &Context, item: Id, part: impl Into<craft_behavior::PartRef>) -> bool`. Whether a menu or popover hung from the part `part` of the item `item` (`ItemCx::part_opener`) is open: an item
|
||||
- `craft_ui::contract::keep_inside`: `pub fn keep_inside(rect: Rect, bounds: Rect) -> Rect`. `rect` moved, at its size, the least distance that puts it inside `bounds`: the one keep rule for a layer's
|
||||
- `craft_ui::contract::measure_item`: `pub fn measure_item<C>(ui: &mut Ui, item: &mut C, at: crate::runtime::access::SetPosition, proposal: craft_behavior::Proposal) -> Vec2 where C: super::Component + super::Props + super::Show,`. Measures `item` as the item at `at` of a set, under the id and the item facts [`show_item`] shows it with.
|
||||
- `craft_ui::contract::pressed`: `pub fn pressed(response: &Response) -> bool`. Whether a pointer press went down on `response`'s component and is still held.
|
||||
- `craft_ui::contract::register_contract`: re-export of `craft_ui_macros::register_contract` (outside these crates).
|
||||
@@ -2821,6 +2837,7 @@ Chapter 15: the `Overlay` data, its presets, popup handles, `OverlayUi` and the
|
||||
- `pub const fn on_activate(mut self, on: bool) -> Self`. Closes when a component inside is activated, except an opener toggling its popup.
|
||||
- `pub const fn commands(mut self, on: bool) -> Self`. Closes when a key, a native menu pick or the palette runs a command from outside it; off for a layer its host
|
||||
- `pub const fn timeout(mut self, seconds: Option<f32>) -> Self`. Closes after `seconds`.
|
||||
- `craft_ui::contract::overlay::DragBounds`: `pub enum DragBounds { Inside, TitleVisible }`. How much of a floating layer stays inside the window: the whole layer (`Inside`, the default) or a strip of its title.
|
||||
- `craft_ui::contract::overlay::FloatPlace`: `pub struct FloatPlace { pub pos: Option<Pos2>, pub corner: Align2 }`. Where a floating layer sits.
|
||||
- `pub const fn centred() -> Self`. Centred in the viewport.
|
||||
- `pub const fn at(pos: Pos2) -> Self`. With its left-top at `pos`.
|
||||
@@ -2830,7 +2847,7 @@ Chapter 15: the `Overlay` data, its presets, popup handles, `OverlayUi` and the
|
||||
- `craft_ui::contract::overlay::OpenFilter`: re-export of `craft_ui::runtime::overlay::OpenFilter`.
|
||||
- `craft_ui::contract::overlay::Opener`: `pub struct Opener { pub id: Id, pub rect: Rect, pub layer: areas::Layer, pub trigger: Trigger, pub enabled: bool, pub anchor: Option<Anchor>, pub others: Vec<Opener> }`. A component that opens a free-standing popup, and how. A layer with several openers keeps the first as its
|
||||
- `craft_ui::contract::overlay::Outside`: `pub enum Outside { Close, Keep, Absorb }`. What a press outside the layer and its anchor does.
|
||||
- `craft_ui::contract::overlay::Overlay`: `pub struct Overlay { pub place: Place, pub fit: OverlayFit, pub min_width: MinWidth, pub movable: bool, pub resize: Resize, pub rank: Rank, pub keys: OwnerClass, pub focus: FocusPolicy, pub dismiss: Dismiss, pub motion: MotionSpec, pub opener: Option<Opener>, pub popup: PopupKind, pub size: Option<Vec2>, pub size_limits: SizeLimits, pub placed: Option<Rect>, pub placed_at: Option<Pos2>, pub bounds: Option<Rect>, pub opacity: f32, pub body_scroll: bool, pub moves_window: bool, pub moved_by_app: bool, pub continue_move: Option<Vec2>, pub role: LayerRole }`. Data describing an egui layer. Presets fill focus and dismissal; builders change single fields.
|
||||
- `craft_ui::contract::overlay::Overlay`: `pub struct Overlay { pub place: Place, pub fit: OverlayFit, pub min_width: MinWidth, pub movable: bool, pub drag_bounds: DragBounds, pub resize: Resize, pub rank: Rank, pub keys: OwnerClass, pub focus: FocusPolicy, pub dismiss: Dismiss, pub motion: MotionSpec, pub opener: Option<Opener>, pub popup: PopupKind, pub size: Option<Vec2>, pub size_limits: SizeLimits, pub placed: Option<Rect>, pub placed_at: Option<Pos2>, pub bounds: Option<Rect>, pub opacity: f32, pub body_scroll: bool, pub moves_window: bool, pub moved_by_app: bool, pub continue_move: Option<Vec2>, pub role: LayerRole, pub among_windows: bool }`. Data describing an egui layer. Presets fill focus and dismissal; builders change single fields.
|
||||
- `pub fn popover() -> Overlay`. A popover: a popup anchored below, from its content, at least as wide as its anchor and capped by the window,
|
||||
- `pub fn dropdown() -> Overlay`. A dropdown list: from its content, at least as wide as its anchor and capped, focus stays on the anchor. It
|
||||
- `pub fn menu() -> Overlay`. A menu: a popup the arrow keys move through. A press outside closes it and goes no further.
|
||||
@@ -2860,7 +2877,9 @@ Chapter 15: the `Overlay` data, its presets, popup handles, `OverlayUi` and the
|
||||
- `pub fn opacity(mut self, opacity: f32) -> Overlay`. Sets the layer's opacity, from 0 (invisible) to 1.
|
||||
- `pub fn min_width(mut self, min_width: MinWidth) -> Overlay`. Sets the narrowest width.
|
||||
- `pub fn movable(mut self, on: bool) -> Overlay`. Sets whether the user may move it.
|
||||
- `pub fn drag_bounds(mut self, bounds: DragBounds) -> Overlay`. Sets how much of the layer stays inside the window when the user moves it ([`DragBounds`]):
|
||||
- `pub fn role(mut self, role: LayerRole) -> Overlay`. Sets what the layer is for ([`Overlay::role`]).
|
||||
- `pub fn among_windows(mut self, on: bool) -> Overlay`. Sets whether the layer stands among the floating windows ([`Overlay::among_windows`]).
|
||||
- `pub fn moves_window(mut self, on: bool) -> Overlay`. Sets whether the move band moves the OS window the layer is shown in, in place of the layer.
|
||||
- `pub fn moved_by_app(mut self) -> Overlay`. The app moves the OS window from the move band ([`Overlay::moved_by_app`]).
|
||||
- `pub fn continue_move(mut self, grab: Vec2) -> Overlay`. The move band takes over the held primary press in this pass, with the pointer at `grab` inside the layer
|
||||
@@ -2873,7 +2892,7 @@ Chapter 15: the `Overlay` data, its presets, popup handles, `OverlayUi` and the
|
||||
- `craft_ui::contract::overlay::OverlayFit`: `pub enum OverlayFit { Content, Resizable, ContentCapped(ViewportShare) }`. How an egui layer sizes.
|
||||
- `craft_ui::contract::overlay::OverlayUi`: `pub struct OverlayUi<'a> { pub closed: Vec<(Id, CloseReason)> }`. What the `overlay` hook gets: one call per anchored popup of this component, built at step 10 with the open state
|
||||
- `pub fn closing(&self, popup: PopupHandle) -> Option<CloseReason>`. Why `popup` closes at the end of this pass, as its `show` decided (its dismissal, or a close its body asked for);
|
||||
- `pub fn is_rtl(&self) -> bool`. Whether the owner lays out right to left: a layer its caller places by position mirrors its own geometry by it,
|
||||
- `pub fn is_rtl(&self) -> bool`. Whether a layer the owner opens lays out right to left (`Scoped::layer_direction`): a layer its caller places by
|
||||
- `pub fn anchor_part(&self, part: impl Into<PartRef>) -> Anchor`. The anchor at the rect of the toggling part `part` of the owner. The layer's placement mirrors the side and
|
||||
- `pub fn contain_popups_below(&mut self)`. Keeps the popups this component shows from here on, and every popup opened from them, below the component:
|
||||
- `pub fn show<R>(&mut self, popup: PopupHandle, overlay: Overlay, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Option<R>`. Shows the popup while its handle is open, on a popup surface, inside `POPUP_PAD`; the content is a body closure.
|
||||
@@ -3018,6 +3037,7 @@ Painters, `Draw`, the sensing core, the text adapter and `ImeSurface`.
|
||||
- `pub const fn with_fills(mut self, fills: &'static [(&'static str, &'static [u8], [u8; 4])]) -> Self`. The set with `fills`: for each icon name, an SVG drawn under the icon in a fixed sRGBA colour.
|
||||
- `craft_ui::primitives::AutoScrollMark`: `pub struct AutoScrollMark`. The auto-scroll mark painter.
|
||||
- `pub fn shapes(look: &AutoScrollMarkLook, anchor: Pos2) -> Vec<Shape>`. The mark centred on `anchor`: the ring, the dot, and an arrowhead above and below, all sized from the look's
|
||||
- `craft_ui::primitives::COLORED_TEXT_LIMIT`: `pub const COLORED_TEXT_LIMIT: usize`. The longest text, in bytes, a part colours: a longer one is laid out in its plain ink, and its
|
||||
- `craft_ui::primitives::CachedTexture`: `pub struct CachedTexture { pub id: TextureId, pub size: PixelSize, pub origin: [u32; 2], pub page: PixelSize }`. A stored picture as a painter draws it: `painter.image(texture.id, rect, uv, tint)`.
|
||||
- `pub fn uv(&self) -> Rect`. The picture's part of its page texture, in uv coordinates, to paint with `id`: the full rect for an unpacked
|
||||
- `pub fn size_vec2(&self) -> Vec2`. `size` as a vector, for fitting: only the aspect matters to a cell. It is the picture's own size, also for a
|
||||
@@ -3033,6 +3053,9 @@ Painters, `Draw`, the sensing core, the text adapter and `ImeSurface`.
|
||||
- `pub fn new(formatted: impl Into<String>) -> Self`. A chord already formatted by craft-keymap's pure function over `craft_keymap::layout`.
|
||||
- `pub fn run(&self) -> TextRun<'_>`. The chord as a run laid out left to right in any direction.
|
||||
- `pub fn isolated(&self) -> String`. The chord isolated as a left-to-right run (LRI ... PDI) for use inside a longer label.
|
||||
- `craft_ui::primitives::ColorRange`: `pub struct ColorRange { pub range: Range<usize>, pub ink: RangeInk }`. One stretch of a text in an ink of its own: `range` is in bytes of the text the [`ColorRanges`] was given.
|
||||
- `pub fn new(range: Range<usize>, ink: RangeInk) -> Self`. The bytes `range` in `ink`.
|
||||
- `craft_ui::primitives::ColorRanges`: `pub type ColorRanges = dyn Fn(&str) -> Vec<ColorRange>`. The colour ranges of a text ([`TextOptions::color_ranges`](crate::primitives::TextOptions::color_ranges)): called with
|
||||
- `craft_ui::primitives::Completer`: `pub trait Completer: Send + Sync`. Completion candidates for a text part.
|
||||
- `fn complete(&self, text: &str, caret: usize, out: &mut Vec<Completion>) -> Option<Range<usize>>`. The candidates for the text before the caret, and the byte range they replace.
|
||||
- `craft_ui::primitives::Completion`: `pub struct Completion { pub label: Label, pub insert: String, pub mark: Option<Label>, pub description: Option<Label> }`. One completion candidate.
|
||||
@@ -3149,6 +3172,7 @@ Painters, `Draw`, the sensing core, the text adapter and `ImeSurface`.
|
||||
- `craft_ui::primitives::Glyph`: `pub trait Glyph: Any + MemoProps + Sync`. A value glyph: an icon drawn from a value. It is `Sync` because container props that show one are kept with a
|
||||
- `fn directional(&self) -> bool`. Whether the glyph has a reading direction (an arrow) and so flips under right-to-left.
|
||||
- `fn paint(&self, painter: &Painter, tokens: &UiTokens, rect: Rect, color: Color32, mirrored: bool)`. Paints the glyph into `rect` in `color`, with the strokes of `tokens`. `mirrored` is set when a directional
|
||||
- `fn paint_draw(&self, draw: &Draw<'_>, rect: Rect, color: Color32, mirrored: bool)`. Paints the glyph into `rect` in `color` with `draw`, the content painter of the component that shows the icon
|
||||
- `craft_ui::primitives::GridAxis`: `pub struct GridAxis { pub minor: Vec<f64>, pub major: Vec<f64> }`. The lines of one axis: positions along it, in the grid's space.
|
||||
- `craft_ui::primitives::GridCrowding`: `pub enum GridCrowding { Hide, Thin }`. What a grid does when its lines come closer than the minimum step.
|
||||
- `craft_ui::primitives::GridInk`: `pub struct GridInk { pub major: Option<DataColor>, pub minor: Option<DataColor>, pub stroke: GridStroke }`. The colours a grid's lines take; an unset one is the theme's.
|
||||
@@ -3225,10 +3249,11 @@ Painters, `Draw`, the sensing core, the text adapter and `ImeSurface`.
|
||||
- `pub fn reserve(painter: &Painter) -> Self`. Reserves an empty shape at the end of `painter`'s layer, clipped like the painter.
|
||||
- `pub fn extend(self, ctx: &Context, shapes: Vec<Shape>)`. Adds `shapes` to the slot, after the shapes it holds, keeping the slot's clip.
|
||||
- `pub fn take_after(self, ctx: &Context) -> Vec<Shape>`. Takes the shapes painted on the slot's layer after it, in paint order, leaving empty shapes in their places.
|
||||
- `craft_ui::primitives::PartResult`: `pub struct PartResult { pub rect: Rect, pub press: PressState, pub hovered: bool, pub hover_pos: Option<Pos2>, pub flags: Flags, pub sense: Sense, pub inactive: bool, pub held: bool }`. A part's results this pass.
|
||||
- `craft_ui::primitives::PartResult`: `pub struct PartResult { pub rect: Rect, pub press: PressState, pub hovered: bool, pub flags: Flags, pub sense: Sense, pub inactive: bool, pub held: bool }`. A part's results this pass.
|
||||
- `pub const IDLE: PartResult`. What a read returns for a part with no press history: face mode, or a part first registered this pass.
|
||||
- `pub fn pressed(&self) -> bool`. The part paints pressed: its own press, or one its component holds on it.
|
||||
- `craft_ui::primitives::Priority`: re-export of `craft_ui::primitives::textures::Priority` (defined outside these crates).
|
||||
- `craft_ui::primitives::RangeInk`: `pub enum RangeInk { Muted, Accent, Good, Warn, Bad, Info }`. A theme colour for a stretch of a field's text. Each is the token's colour moved, where it has to be, to the text
|
||||
- `craft_ui::primitives::ReadingMeasure`: `pub struct ReadingMeasure { pub target: f32, pub least: f32 }`. The width of a reading column, from the text it holds: a count of characters of the role's average character
|
||||
- `pub const TARGET_CHARACTERS: f32`. The characters in the measure a reading column aims for.
|
||||
- `pub const LEAST_CHARACTERS: f32`. The characters in the shortest measure a reading column allows.
|
||||
@@ -3293,9 +3318,9 @@ Painters, `Draw`, the sensing core, the text adapter and `ImeSurface`.
|
||||
- `pub fn row_lines(&self) -> Vec<(String, egui::Rect, Vec<LayoutRun>)>`. Every row as its text, its rect from the galley's origin and its bidi runs: the one per-row geometry, read by
|
||||
- `pub fn size(&self) -> egui::Vec2`. The galley size.
|
||||
- `pub fn char_x(&self, chars: usize) -> f32`. Where a caret before character `chars` (counted from the start of the text) stands, from the layout's left edge:
|
||||
- `craft_ui::primitives::TextOptions`: `pub struct TextOptions { pub placeholder: Option<Label>, pub lines: Option<usize>, pub limit: Option<usize>, pub mask: bool, pub live: bool, pub clear_on_escape: bool, pub keep_on_escape: bool, pub mono: bool, pub role: TypeRole, pub ink: Option<Ink>, pub tab: TabKey, pub caret: Option<usize>, pub complete: Option<Arc<dyn Completer>>, pub complete_on_enter: bool, pub replace_selection: Option<String>, pub commit_on: &'static [char], pub enabled: bool, pub steps_value: bool, pub select_on_focus: bool, pub keep_caret_on_open: bool, pub select_all: bool, pub submits: bool, pub mixed: bool, pub centred: bool, pub end_aligned: bool, pub arrows_from_end: bool, pub unparsed: Option<Message>, pub own_menu: bool, pub holds_drafts: bool, pub whole_paste: Option<Arc<WholePaste>>, pub submit_key: SubmitKey, pub resting: Option<String> }`. How a text part behaves beyond its codec.
|
||||
- `craft_ui::primitives::TextOptions`: `pub struct TextOptions { pub placeholder: Option<Label>, pub look: crate::style::FieldLook, pub lines: Option<usize>, pub limit: Option<usize>, pub mask: bool, pub live: bool, pub edit_target: Option<egui::IdSalt>, pub clear_on_escape: bool, pub keep_on_escape: bool, pub mono: bool, pub role: TypeRole, pub size: Option<f32>, pub top: bool, pub ink: Option<Ink>, pub tab: TabKey, pub caret: Option<usize>, pub complete: Option<Arc<dyn Completer>>, pub complete_on_enter: bool, pub replace_selection: Option<String>, pub commit_on: &'static [char], pub enabled: bool, pub steps_value: bool, pub select_on_focus: bool, pub keep_caret_on_open: bool, pub select_all: bool, pub submits: bool, pub mixed: bool, pub centred: bool, pub end_aligned: bool, pub arrows_from_end: bool, pub unparsed: Option<Message>, pub own_menu: bool, pub holds_drafts: bool, pub whole_paste: Option<Arc<WholePaste>>, pub submit_key: SubmitKey, pub resting: Option<String>, pub color_ranges: Option<Arc<ColorRanges>> }`. How a text part behaves beyond its codec.
|
||||
- `pub fn new() -> Self`. Options with every default.
|
||||
- `craft_ui::primitives::TextOutcome`: `pub struct TextOutcome<V> { pub rect: Rect, pub draft: Option<String>, pub value: Option<V>, pub layout: Option<super::TextLayout>, pub caret_visible: bool, pub invalid: bool, pub committed: Option<craft_behavior::ParseNote>, pub composing: bool, pub completions: Vec<super::Completion>, pub clicked: bool }`. A text part's result this pass.
|
||||
- `craft_ui::primitives::TextOutcome`: `pub struct TextOutcome<V> { pub rect: Rect, pub draft: Option<String>, pub value: Option<V>, pub layout: Option<super::TextLayout>, pub origin: egui::Pos2, pub caret_visible: bool, pub invalid: bool, pub committed: Option<craft_behavior::ParseNote>, pub composing: bool, pub completions: Vec<super::Completion>, pub clicked: bool }`. A text part's result this pass.
|
||||
- `pub const fn new(rect: Rect) -> Self`. An outcome over `rect` with no draft or value.
|
||||
- `craft_ui::primitives::TextRun`: `pub struct TextRun<'a> { pub spans: Vec<Span<'a>>, pub role: TypeRole, pub color: Option<StyleColor>, pub wrap: Wrap, pub ltr: bool, pub align: HAlign, pub rotation: f32, pub link_color: Option<Color32> }`. The one description of UI text.
|
||||
- `pub const READABLE_CHARACTERS: usize`. The characters a run that elides keeps before its ellipsis at its least, its readable least: a row narrows
|
||||
@@ -3583,6 +3608,7 @@ Per-pass and per-frame services and the one egui adapter.
|
||||
- `pub fn unit(&mut self, unit: impl Into<String>) -> &mut Self`. The unit a text component draws after its text: the node's value reads it after the text ("160 pt"), while
|
||||
- `pub fn color(&mut self, color: Srgba) -> &mut Self`. The colour value of a colour well.
|
||||
- `pub fn numeric(&mut self, numeric: Numeric) -> &mut Self`. The numeric value of a value component; a step also declares increment and decrement.
|
||||
- `pub fn variable_steps(&mut self, increment: bool, decrement: bool) -> &mut Self`. Offers the available Increment and Decrement actions for a numeric value with no fixed step size.
|
||||
- `pub fn expanded(&mut self, on: bool) -> &mut Self`. Whether a disclosure is open, when no flag says it.
|
||||
- `pub fn has_popup(&mut self, kind: PopupKind) -> &mut Self`. What kind of popup the component opens.
|
||||
- `pub fn level(&mut self, level: usize) -> &mut Self`. The heading level or tree depth.
|
||||
@@ -3716,7 +3742,7 @@ The command board: the registry and typed sets, per-frame state, the queue, firi
|
||||
- `craft_ui::runtime::commands::chord`: `pub fn chord(ctx: &Context, command: &CommandRef) -> Option<Chord>`. The chord a surface shows for `command`: its first single-press binding in the runtime's keymap that runs it
|
||||
- `craft_ui::runtime::commands::fire`: `pub fn fire(ctx: &Context, command: impl Into<CommandRef>, source: FireSource) -> bool`. Fires `command` from a surface that has no component of its own: a menu, the palette or automation. Scoped
|
||||
- `craft_ui::runtime::commands::holder`: `pub fn holder(ctx: &Context, chord: &Chord) -> Option<CommandRef>`. The command a key `chord` belongs to for a surface that takes it whatever has focus, such as a system menu item:
|
||||
- `craft_ui::runtime::commands::holds`: `pub fn holds(ctx: &Context, layer: LayerKey, rect: egui::Rect, commands: &[CommandRef], label: Label)`. Records that a container at `rect` holds `commands`, for this pass and viewport. Not [`CommandInput::holds`], which
|
||||
- `craft_ui::runtime::commands::holds`: `pub fn holds(ctx: &Context, layer: LayerKey, rect: egui::Rect, commands: &Arc<[CommandRef]>, label: Label)`. Records that a container at `rect` holds `commands`, for this pass and viewport. Not [`CommandInput::holds`], which
|
||||
- `craft_ui::runtime::commands::request_paste_at`: `pub fn request_paste_at(ctx: &Context, at: egui::Pos2)`. Requests a paste at a screen point; the delivered command carries the point with its content. The next clipboard
|
||||
- `craft_ui::runtime::commands::resolve`: `pub fn resolve(ctx: &Context, command: impl Into<CommandRef>) -> Arc<ResolvedCommand>`. `command` as a surface with no component of its own shows it: the label, icon, chord, enabled and checked state
|
||||
- `craft_ui::runtime::commands::resolver_in`: `pub fn resolver_in(ui: &egui::Ui) -> impl Fn(CommandRef) -> Option<Arc<ResolvedCommand>> + 'static`. A resolver for the commands as the context of `ui` shows them, as [`Commands::resolve_command`] does for a
|
||||
@@ -3747,6 +3773,7 @@ The command board: the registry and typed sets, per-frame state, the queue, firi
|
||||
- `craft_ui::runtime::commands::CommandKind`: re-export of `craft_keymap::CommandKind` (outside these crates).
|
||||
- `craft_ui::runtime::commands::CommandRef`: re-export of `craft_keymap::CommandRef` (outside these crates).
|
||||
- `craft_ui::runtime::commands::CommandScope`: re-export of `craft_keymap::CommandScope` (outside these crates).
|
||||
- `craft_ui::runtime::commands::Dispatch`: re-export of `craft_keymap::Dispatch` (outside these crates).
|
||||
- `craft_ui::runtime::commands::EditCommand`: re-export of `craft_behavior::intent::EditCommand`.
|
||||
- `craft_ui::runtime::commands::EditCommands`: `pub enum EditCommands { Cut, Copy, Paste, SelectAll, Undo, Redo, Delete }`. The edit commands (11.3). A focused component that lists one in `KEYS.edits` takes it as
|
||||
- `pub const ALL: [EditCommands; 7]`. Every edit command that a focused component can take as an `Intent::Edit`.
|
||||
@@ -3954,6 +3981,7 @@ One-shot screenshot slots and the facts a screenshot is measured against.
|
||||
- `craft_ui::runtime::env::Inherited`: `pub struct Inherited { pub tokens: Arc<UiTokens>, pub os: Os, pub active: bool, pub words: Arc<Words>, pub canvas_pattern: bool, 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<ArenaId>, pub transform: Option<CanvasTransform> }`. The values of an env.
|
||||
- `pub fn hit_reach(&self) -> f32`. How far from a handle, point or edge a press still takes it, in screen points: the theme's `size.hit.target`.
|
||||
- `pub fn layer_direction(&self) -> Direction`. The direction of a layer opened from this scope: the interface's (`text_direction`), which an axis that keeps
|
||||
- `craft_ui::runtime::env::AgeStyle`: re-export of `craft_i18n::AgeStyle` (outside these crates).
|
||||
- `craft_ui::runtime::env::AltCodePages`: `pub struct AltCodePages { pub ansi: u16, pub oem: u16 }`. Code pages that decode Alt+numpad codes; the app sets them from the system locale.
|
||||
- `pub const fn new(ansi: u16, oem: u16) -> Self`. The ANSI and OEM code pages.
|
||||
@@ -4026,7 +4054,7 @@ One-shot screenshot slots and the facts a screenshot is measured against.
|
||||
- `pub fn resolved_for(&self, system: SystemAppearance) -> ResolvedRoot`. What the choices resolve to when the OS reports `system`.
|
||||
- `pub fn appearance(&self, ctx: &Context) -> Appearance`. The appearance the root's tokens resolve under on `ctx`: the mode, contrast, density and text size.
|
||||
- `pub fn contrast(mut self, contrast: impl Into<ContrastChoice>) -> Self`. Sets the contrast choice.
|
||||
- `pub fn cursor_follows_zoom(mut self, on: bool) -> Self`. Sets whether painted cursor images scale with the interface zoom (the Scale Cursor Proportional to UI
|
||||
- `pub fn cursor_follows_zoom(mut self, on: bool) -> Self`. Sets whether painted pointers grow with the interface zoom (the Scale Cursor Proportional to UI preference).
|
||||
- `pub fn tooltips(mut self, on: bool) -> Self`. Sets whether tooltips show (the Show Tool Tips preference). On by default.
|
||||
- `pub fn density(mut self, density: Size) -> Self`. Sets the density preset.
|
||||
- `pub fn set(mut self, set: ComponentSet) -> Self`. Sets the component set (`Selection::set`): a root app value, so a container can set another for its subtree.
|
||||
@@ -4075,7 +4103,7 @@ One-shot screenshot slots and the facts a screenshot is measured against.
|
||||
- `pub fn mode(mut self, mode: Mode) -> Self`. Resolves in `mode`: a plot that is dark in every theme, a preview of the other mode.
|
||||
- `pub fn contrast(mut self, contrast: Contrast) -> Self`. Resolves under `contrast`.
|
||||
- `pub fn density(mut self, density: Size) -> Self`. Resolves at the density preset `density`.
|
||||
- `craft_ui::runtime::env::UnitKind`: `pub enum UnitKind { Pixels, Percent, Degrees, Points, Times, Inches, Centimetres, Millimetres, Picas, PixelsPerInch, PixelsPerCentimetre, Minutes, Columns, LinesPerInch, LinesPerCentimetre, Feet, Yards, Metres, Q, Ha, Letters, Hyphens }`. What a number counts.
|
||||
- `craft_ui::runtime::env::UnitKind`: `pub enum UnitKind { Pixels, Percent, Degrees, Points, Times, Inches, Centimetres, Millimetres, Picas, PixelsPerInch, PixelsPerCentimetre, Minutes, Columns, LinesPerInch, LinesPerCentimetre, Feet, Yards, Metres, Q, Ha, Letters, Hyphens, PerInch }`. What a number counts.
|
||||
- `pub const LENGTHS: [UnitKind; 5]`. The lengths a unit choice offers. [`per_inch`](Self::per_inch) answers for more kinds (feet, yards, metres, Q,
|
||||
- `pub const fn decimals(self) -> RangeInclusive<usize>`. The digits after the decimal mark a number of this kind shows by default, at most.
|
||||
- `pub const fn step(self) -> f64`. What one arrow press, wheel notch or scrub point changes a number of this kind by, where the control that shows
|
||||
@@ -4120,6 +4148,7 @@ One-shot screenshot slots and the facts a screenshot is measured against.
|
||||
- `craft_ui::runtime::env::WordTemplate`: re-export of `craft_i18n::WordTemplate` (outside these crates).
|
||||
- `craft_ui::runtime::env::Words`: re-export of `craft_i18n::Words` (outside these crates).
|
||||
- `craft_ui::runtime::env::WordsOverride`: `pub enum WordsOverride { Replace(Arc<Words>), Overlay(WordRows) }`. How a scope changes the built-in text: the only override path for words.
|
||||
- `craft_ui::runtime::env::ZoomPrecision`: `pub enum ZoomPrecision { Fractional, Whole }`. How many decimals a zoom shows. An app sets it once on its root env with `RootEnv::values`; [`Units::zoom_codec`]
|
||||
- `craft_ui::runtime::env::in_room`: `pub fn in_room<R>(ui: &mut Ui, rect: Rect, body: impl FnOnce(&mut Ui) -> R) -> R`. Runs `body` in a child `Ui` held to `rect` and clipped to it, as a layout room of its own: the flow grid, content
|
||||
- `craft_ui::runtime::env::system_appearance`: `pub fn system_appearance(ctx: &Context) -> SystemState`. What the OS reports on `ctx` now: the host's reader (`InstallSpec::system`), with the colour scheme egui's
|
||||
- `craft_ui::runtime::env::system_text_scale`: `pub fn system_text_scale(ctx: &Context) -> Option<f32>`. The desktop text scale from the installed [`SystemReader`], `None` where the OS gives none.
|
||||
@@ -4331,6 +4360,7 @@ The key stage (spec 9.1, 9.2, 9.3, 9.7): the input hook strips the keys the runt
|
||||
- `craft_ui::runtime::keys::escape_mods`: `pub fn escape_mods(ctx: &Context) -> Option<Mods>`. The Alt and Shift held at the press of the pass's last Escape that became a `Cancel`; `None` when the pass had none.
|
||||
- `craft_ui::runtime::keys::focus_holds`: `pub fn focus_holds(ctx: &Context, chord: Chord) -> bool`. Whether the focused component of the running viewport holds a press of `chord`, as routing decides for the press:
|
||||
- `craft_ui::runtime::keys::held`: `pub fn held(ctx: &Context) -> Vec<Key>`. The keys down in the running viewport this pass: the key stage's `down` (withheld presses included), plus each key
|
||||
- `craft_ui::runtime::keys::leftover_events`: `pub fn leftover_events(ctx: &Context) -> Vec<Event>`. The key, text and clipboard events of the running pass that nothing took, in the order they arrived.
|
||||
- `craft_ui::runtime::keys::textless_paste`: `pub fn textless_paste(ctx: &Context) -> bool`. Whether the running viewport's input hook read a paste with no text in this pass: the paste chord came while the
|
||||
- `craft_ui::runtime::keys::with_canvas_window_intents`: `pub fn with_canvas_window_intents(ctx: &Context, rtl: bool, take: impl FnOnce(&mut Intents) -> bool) -> bool`. Offers window intents to a canvas while the canvas or one of its controls has focus, or nothing has focus.
|
||||
- `craft_ui::runtime::keys::with_window_intents`: `pub fn with_window_intents(ctx: &Context, rtl: bool, take: impl FnOnce(&mut Intents) -> bool) -> bool`. Offers the window's intents and the focused framework stop's unused Escape to `take`, and writes back what it
|
||||
@@ -4399,7 +4429,8 @@ The motion service (13): tweens over one clock, the motion table, and one repain
|
||||
- `pub fn target(&self) -> T`. The value it runs toward.
|
||||
- `pub fn is_settled(&self) -> bool`. True once the shown value is the target.
|
||||
- `pub fn retarget(&mut self, to: T, now: f64)`. Runs toward `to` from the value shown now.
|
||||
- `craft_ui::runtime::motion::now`: `pub fn now() -> web_time::Instant`. The wall clock's reading, for a host that drives a store on real time (`ShellApp::tick`). It is the one place
|
||||
- `craft_ui::runtime::motion::now`: `pub fn now() -> Instant`. The wall clock's reading, for a host that drives a store on real time (`ShellApp::tick`). It is the one place
|
||||
- `craft_ui::runtime::motion::Instant`: re-export of `web_time::Instant` (outside these crates).
|
||||
|
||||
## `craft_ui::runtime::motion::spec`
|
||||
|
||||
@@ -4423,8 +4454,8 @@ The layer stack (15.2): the record of the egui layers shown, their order and the
|
||||
- `craft_ui::runtime::overlay::Backdrop`: `pub enum Backdrop { None, Scrim }`. A modal's backdrop.
|
||||
- `craft_ui::runtime::overlay::CloseReason`: `pub enum CloseReason { Requested, Escape, Outside, FocusLeft(crate::runtime::focus::FocusMove), Activated, Enter, Timeout, AnchorGone }`. Why a layer closes.
|
||||
- `craft_ui::runtime::overlay::LayerRole`: `pub enum LayerRole { Plain, Progress, InPlaceEditor }`. What a layer is for, beyond its rank.
|
||||
- `craft_ui::runtime::overlay::OpenFilter`: `pub enum OpenFilter { Any, Modal, Keys }`. What `any_open` counts.
|
||||
- `craft_ui::runtime::overlay::Rank`: `pub enum Rank { Window, Toast, Popup, Modal { backdrop: Backdrop }, ModalChrome, Tooltip }`. An overlay's place in the order. `Rank` is the only place a layer's egui order is chosen.
|
||||
- `craft_ui::runtime::overlay::OpenFilter`: `pub enum OpenFilter { Any, Modal, Keys, Asks }`. What `any_open` counts.
|
||||
- `craft_ui::runtime::overlay::Rank`: `pub enum Rank { Window, Toast, Popup, Modal { backdrop: Backdrop }, ModalChrome, Tooltip }`. An overlay's place in the order. `Rank` chooses a layer's egui order; a popup that stands among the floating
|
||||
- `pub const fn modal(backdrop: Backdrop) -> Rank`. A modal rank with `backdrop`.
|
||||
- `craft_ui::runtime::overlay::any_open`: `pub fn any_open(ctx: &Context, filter: OpenFilter) -> bool`. Whether any layer of the running viewport that `filter` counts was shown last frame.
|
||||
- `craft_ui::runtime::overlay::close_popups`: `pub fn close_popups(ctx: &Context)`. Queues a close of every popup layer of the running viewport shown last frame that a command closes
|
||||
@@ -4462,10 +4493,17 @@ Background results (14): one result per key in runtime memory, produced by a job
|
||||
The pointer snapshot, press targets, the shape record and press cancels (8.1, 8.3).
|
||||
|
||||
- `craft_ui::runtime::pointer::PointerFrame`: `pub struct PointerFrame { pub pos: Option<Pos2>, pub delta: Vec2, pub buttons: Buttons, pub press: Option<PressStart>, pub press_mods: Option<Mods>, pub release: Option<PointerButton>, pub mods: Mods, pub pick_mods: Mods, pub pick_pos: Option<Pos2>, pub multi_tap: Option<craft_behavior::MultiTap>, pub time: f64, pub kind: PointerKind, pub sample: Option<PointerSample>, pub multi_touch: Option<MultiTouch>, pub scroll: Vec2, pub zoom: f32, pub rotation: f32, pub slop: f32, pub target: f32 }`. The pointer input of one pass of one viewport, egui-converted. Input enters a frame's first pass only (egui hands
|
||||
- `craft_ui::runtime::pointer::PressState`: `pub struct PressState { pub buttons: Buttons, pub press: Option<PressStart>, pub release: Option<PointerButton> }`. The press state of a pass: the buttons held, and the primary press and the release the pass brought.
|
||||
- `craft_ui::runtime::pointer::active_part`: `pub fn active_part(ctx: &Context, owner: Id) -> Option<PartRef>`. The part of `owner` holding the pointer's hover or an open press in this viewport.
|
||||
- `craft_ui::runtime::pointer::follows_pointer`: `pub fn follows_pointer(ctx: &Context, rect: Rect)`. Records that what the running pass shows in `rect` (screen points) follows the pointer: a cursor drawn at the
|
||||
- `craft_ui::runtime::pointer::frame`: `pub fn frame(ctx: &Context) -> PointerFrame`. The running pass's pointer input. A tracked input (`runtime::inputs`): a memoized view that reads it runs when the
|
||||
- `craft_ui::runtime::pointer::gate_pointer_moves`: `pub fn gate_pointer_moves(ctx: &Context)`. Lets a pointer move run no pass when nothing it would change differs: egui's gate
|
||||
- `craft_ui::runtime::pointer::hover_point_in`: `pub fn hover_point_in(ctx: &Context, rect: Rect) -> Option<Pos2>`. The running pass's hover point (screen points) when it lies in `rect` (screen points), for code that shows what
|
||||
- `craft_ui::runtime::pointer::hovers`: `pub fn hovers(ctx: &Context, id: Id) -> bool`. Whether a shape the component `id` registered shows hover in the running pass, by the pass's one resolution of
|
||||
- `craft_ui::runtime::pointer::mods`: `pub fn mods(ctx: &Context) -> Mods`. The modifiers held in the running pass, with the latched ones (`PointerFrame::mods`). A tracked input: a memoized
|
||||
- `craft_ui::runtime::pointer::move_needs_pass`: `pub fn move_needs_pass(ctx: &Context, viewport: ViewportId, from: Option<Pos2>, to: Pos2) -> bool`. Whether a pointer move from `from` to `to` in `viewport`, with no button held, needs a pass, judged on the last
|
||||
- `craft_ui::runtime::pointer::press_state`: `pub fn press_state(ctx: &Context) -> PressState`. The press state of the running pass. A tracked input (`Input::Press`): a memoized view that reads it runs on a
|
||||
- `craft_ui::runtime::pointer::pressed_part`: `pub fn pressed_part(ctx: &Context, owner: Id) -> Option<PartRef>`. The part of `owner` holding a press in this viewport, in the pass that ends the press and in none after it.
|
||||
- `craft_ui::runtime::pointer::shapes_at`: `pub fn shapes_at(ctx: &Context, at: Pos2) -> Vec<(Id, Option<PartRef>)>`. Every shape of the last pass on the topmost layer at `at` (screen points) whose area contains it, as
|
||||
- `craft_ui::runtime::pointer::withhold_members`: `pub fn withhold_members(ctx: &Context, root: Id, withheld: bool)`. Whether the arena of `root` resolves the presses and hover of the next pass without its members' shapes. A canvas
|
||||
|
||||
@@ -4611,7 +4649,7 @@ The toast queues: one per window (`WindowKey`), filled from any code with a `Con
|
||||
- `pub fn install_hit_sink(&self, viewport: ViewportId) -> HitSink`. The hit-test sink of `viewport`'s window, made on the first call. The platform layer calls it once it has put
|
||||
- `pub fn pointer_in(&self, viewport: ViewportId) -> Option<Pos2>`. The desktop pointer in the coordinates of `viewport`, when it lies inside that window.
|
||||
- `craft_ui::runtime::windows::WindowLevel`: `pub enum WindowLevel { Normal, Palette, AlwaysOnTop }`. Where a window stands in the stack of windows.
|
||||
- `craft_ui::runtime::windows::WindowSpec`: `pub struct WindowSpec { pub kind: WindowKind, pub chrome: Option<WindowChrome>, pub captions: Option<Captions>, pub level: WindowLevel, pub taskbar: bool, pub shown_after_first_paint: bool, pub takes_focus: bool, pub passes_pointer: bool }`. How an OS window opens (21.2): what it is for, who draws its frame, where it stands and whether it has a taskbar
|
||||
- `craft_ui::runtime::windows::WindowSpec`: `pub struct WindowSpec { pub kind: WindowKind, pub chrome: Option<WindowChrome>, pub captions: Option<Captions>, pub level: WindowLevel, pub taskbar: bool, pub shown_after_first_paint: bool, pub takes_focus: bool, pub passes_pointer: bool, pub hands_on_cancel: bool }`. How an OS window opens (21.2): what it is for, who draws its frame, where it stands and whether it has a taskbar entry.
|
||||
- `pub fn tool() -> Self`. A tool window (a native dock window): its own title row in place of the OS title bar
|
||||
- `pub fn popup() -> Self`. A popup window: a layer opened from a palette window (a flyout, menu or tooltip) in an OS window of its own. It
|
||||
- `pub fn document() -> Self`. A document window with the installed decision's frame.
|
||||
@@ -4624,6 +4662,7 @@ The toast queues: one per window (`WindowKey`), filled from any code with a `Con
|
||||
- `pub fn taskbar(mut self, taskbar: bool) -> Self`. Sets whether the window has a taskbar or Dock entry.
|
||||
- `pub fn takes_focus(mut self, takes_focus: bool) -> Self`. Sets whether the window takes OS focus when it opens.
|
||||
- `pub fn passes_pointer(mut self, passes_pointer: bool) -> Self`. Sets whether pointer input passes through the window to the window below it (a tooltip's).
|
||||
- `pub fn hands_on_cancel(mut self, hands_on_cancel: bool) -> Self`. Sets whether an Escape nothing in the window takes is the Cancel of the window it was opened from.
|
||||
- `craft_ui::runtime::windows::act`: `pub fn act(ctx: &Context, viewport: ViewportId, action: WindowAction) -> bool`. Sends `action` to `viewport`. It is the only sender of window commands: it checks the capabilities and the
|
||||
- `craft_ui::runtime::windows::double_click_action`: `pub fn double_click_action(frame: &Frame, setting: DoubleClick, maximized: bool) -> Option<WindowAction>`. What a double click on a window's free move band (its title bar, or the strip a modal leaves over it) asks of the
|
||||
|
||||
@@ -4650,11 +4689,12 @@ The style layer: the state set and its resolver, style parts and `ComponentStyle
|
||||
- `craft_ui::style::DuplicateStyle`: `pub struct DuplicateStyle(pub &'static str)`. Two replacements named one style key.
|
||||
- `craft_ui::style::EnvKey`: `pub struct EnvKey`. The key of everything a style depends on besides its own key: tokens, direction, scale, the OS, the window's
|
||||
- `pub fn new(tokens: u64, direction: Direction, scale: Scale, os: Os, active: bool, values: u64) -> Self`. The key of these inputs. `tokens` is `UiTokens::key` and `values` the hash of the style-affecting app values.
|
||||
- `craft_ui::style::FieldLook`: `pub enum FieldLook { Normal, Quiet }`. How a text field looks where it sits: one value picks its fill, its edge and its placeholder together, so they
|
||||
- `craft_ui::style::FlagMask`: re-export of `craft_theme::FlagMask` (outside these crates).
|
||||
- `craft_ui::style::Flags`: re-export of `craft_theme::Flags` (outside these crates).
|
||||
- `craft_ui::style::FocusLook`: `pub struct FocusLook { pub stroke: Stroke, pub offset: f32 }`. A component's focus ring.
|
||||
- `pub const fn new(stroke: Stroke, offset: f32) -> Self`. A focus look.
|
||||
- `craft_ui::style::GlyphRole`: `pub enum GlyphRole { Control, Tool, ToolRail, PanelRail }`. How the icon-only buttons of a scope show their glyph, set by the container that holds them
|
||||
- `craft_ui::style::GlyphRole`: `pub enum GlyphRole { Control, Tool, ToolRail, PanelRail, Compact }`. How the icon-only buttons of a scope show their glyph, set by the container that holds them
|
||||
- `craft_ui::style::HandleLook`: `pub struct HandleLook { pub side: f32, pub fill: Stateful<StyleColor>, pub stroke: StyleColor, pub stroke_width: f32 }`. A canvas handle's fills and stroke.
|
||||
- `craft_ui::style::IconLook`: `pub struct IconLook { pub side: f32, pub color: Stateful<StyleColor>, pub ground: Option<Stateful<StyleColor>> }`. A component's icon.
|
||||
- `pub fn new(side: f32, color: Stateful<StyleColor>) -> Self`. An icon look.
|
||||
@@ -4705,11 +4745,12 @@ The style layer: the state set and its resolver, style parts and `ComponentStyle
|
||||
- `pub fn of_env(ctx: &'a Context, env: &'a crate::runtime::env::Env) -> Self`. The style context of the scope `env` describes, in the secondary variant: for code outside a style function
|
||||
- `pub fn with_root<R>(ctx: &Context, f: impl FnOnce(&StyleCx<'_>) -> R) -> R`. Runs `f` with the style context of the root scope (`Env::of_root(ctx)`), for code with no `Ui` that reads a
|
||||
- `pub fn with_root_scoped<R>(ctx: &Context, scope: &crate::runtime::env::ThemeScope, f: impl FnOnce(&StyleCx<'_>) -> R) -> R`. Runs `f` with the root style at the tokens `scope` resolves, for code that has a context and no `Ui`.
|
||||
- `pub fn link_look(&self, enabled: bool) -> super::look::TextLook`. The one link look: body role, underlined, `accent.solid` (`accent.text` at high contrast), `text.disabled` when
|
||||
- `pub fn link_look(&self, enabled: bool) -> super::look::TextLook`. The one link look: body role, underlined, `accent.text`, `text.disabled` when not `enabled`.
|
||||
- `pub fn exiting<P: Clone + Send + Sync + 'static>(&self, name: &'static str, spec: MotionSpec, listed: &[impl Hash]) -> Vec<(Presence, P)>`. The keyed presences of `name` in the motion memory of the component this context is scoped to, for the keys
|
||||
- `pub fn env<T: StyleValue>(&self) -> T`. An app value set by a scope. Its hash is part of the style cache key.
|
||||
- `pub fn color(&self, color: Rgba) -> StyleColor`. The constructor of `StyleColor` for styles: a semantic token read or a token-group field becomes a style colour
|
||||
- `pub fn ink_on(&self, fill: DataColor) -> StyleColor`. The ink for text on a user colour: the higher-contrast of `text.normal` and `text.on_strong` on the fill,
|
||||
- `pub fn icon_ink_on(&self, fill: DataColor) -> StyleColor`. The ink for icons and non-text on a user colour, pushed to the non-text contrast it needs.
|
||||
- `pub fn ink_of(&self, color: DataColor, on: Rgba) -> StyleColor`. The ink of a glyph or label in the data colour `color` on the surface `on`, pushed to the contrast the text
|
||||
- `pub fn focus_look(&self) -> FocusLook`. The one builder of the focus ring: the line's focus colour at the medium stroke, on the shape's edge.
|
||||
- `pub fn tone(&self, tone: Tone) -> StyleColor`. The colour text and icons of `tone` read in.
|
||||
@@ -4733,6 +4774,7 @@ The style layer: the state set and its resolver, style parts and `ComponentStyle
|
||||
- `pub fn surface(&self, kind: SurfaceKind) -> SurfaceStyle`. What a surface of `kind` draws.
|
||||
- `pub fn text_well(&self) -> SurfaceLook`. The look of a text well: the well surface with an edge that takes the focus colour while the well holds
|
||||
- `pub fn field(&self) -> SurfaceLook`. The look of a text or value field: the text well with the failure colour on its edge while its value is
|
||||
- `pub fn quiet_field(&self) -> SurfaceLook`. The look of a field that sits in a bar (a title bar's search box,
|
||||
- `pub fn dropdown(&self) -> SurfaceLook`. The look of the closed box of a dropdown picker: the field, filled with the hover fill under the pointer and
|
||||
- `pub fn rule(&self, kind: RuleKind) -> RuleLook`. The line a rule of `kind` draws.
|
||||
- `pub fn handle(&self) -> HandleLook`. The look of a canvas handle.
|
||||
@@ -5081,6 +5123,7 @@ The focus service's fixture: egui widgets for stops, the egui focus, and the eve
|
||||
- `craft_ui::testing::focus::commit_now`: `pub fn commit_now(ctx: &Context) -> Option<Id>`. The text part that commits its draft in this pass because a press moved focus away from it.
|
||||
- `craft_ui::testing::focus::context_request`: `pub fn context_request(ctx: &Context, id: Id) -> Option<Rect>`. The rect `id`'s context request of this pass opens at, when it made one.
|
||||
- `craft_ui::testing::focus::egui_focused`: `pub fn egui_focused(ctx: &Context) -> Option<Id>`. The widget egui holds key focus on.
|
||||
- `craft_ui::testing::focus::end_body`: `pub fn end_body(ctx: &Context)`. Ends the body [`begin_body`] marked: the stops registered from here on in the innermost open scope are its end
|
||||
- `craft_ui::testing::focus::focus_visible`: `pub fn focus_visible(ctx: &Context, id: Id) -> bool`. `is_focused` with focus visible.
|
||||
- `craft_ui::testing::focus::intents_of`: `pub fn intents_of(ctx: &Context, id: Option<Id>, rtl: bool) -> Intents`. The intents routed to `id` this pass, with horizontal moves read in the component's direction.
|
||||
- `craft_ui::testing::focus::is_focused`: `pub fn is_focused(ctx: &Context, id: Id) -> bool`. Whether the focus stop is the component `id`.
|
||||
|
||||
@@ -326,7 +326,7 @@ Host code that does work once per shown frame (a frame count, a screenshot's set
|
||||
|
||||
Content runs in every pass, and its sizes come from this pass. Layouts also read some state earlier passes left, for example a scroll area's offset and its last view and extent (step 4 and the scroll bars read them) and the sizes layout memory keeps (`runtime::layout_memory`; a changed size asks for a discard pass). The one exception to running in every pass is out-of-view content.
|
||||
|
||||
**Layout memory.** A record of layout memory holds a measure or a text. A body whose inputs did not change takes its kept measurement instead of running a measuring run. A text that a measuring run found for content outside the body (a value readout beside a story, for example) is kept with the measurement: `layout_memory::emit_text` hands it forward, `layout_memory::text` reads it, and a body that takes its kept measurement gives the text its measuring run found. A real run that finds another text marks the kept transcript as changed.
|
||||
**Layout memory.** A record of layout memory holds a measure, a text or a width. A body whose inputs did not change takes its kept measurement instead of running a measuring run. A text that a measuring run found for content outside the body (a value readout beside a story, for example) is kept with the measurement: `layout_memory::emit_text` hands it forward, `layout_memory::text` reads it, and a body that takes its kept measurement gives the text its measuring run found. A real run that finds another text marks the kept transcript as changed. `layout_memory::emit_width` and `layout_memory::width` hand forward a measured width the same way, for a step that sizes by content it runs before (a dock group's header parts keep room for the items the host adds to its header). A real run that finds a width that differs by more than the measuring tolerance marks the kept transcript as changed.
|
||||
|
||||
**Memoized views.** A memoized view (`MemoView::new(id, props, show).show(ui)`) runs only when one of its inputs changed, and otherwise adds its last real run to the pass again: its paint, widgets, accessibility nodes, focus stops and the other per-pass registrations, and the value its run returned. Its content is a `fn` that captures nothing, and its props (`#[derive(MemoProps)]`) hold every app input it reads, so the compiler checks that the framework sees them; large app data goes in a `Tracked<T>`, which keys by revision. The view runs when its props key differs from its last run's, when its place or environment differs (room, clip, layer, scale, theme, density, language, the scope's inherited values), when a framework input it read moved (modifiers, pointer, keymap, focus, a bound value, a command state), when it is engaged (the pointer over it, focus in it, a press or drag in it, an intent routed to it), and while something in it still moves (an animation, a loading texture, a repaint asked in its run with `frame::request_repaint`, a wake time). Input elsewhere in the window and repaint requests outside every view run no view: what changed reaches a view through its props. Content outside every memoized view runs in every pass.
|
||||
|
||||
@@ -1132,7 +1132,7 @@ Control channel, screenshot queue, profiler and recorded actions for tests and s
|
||||
| `server` | Loopback JSON-lines TCP transport (native): `listen`, `serve`, stopped by dropping its `Listening` | exists |
|
||||
| `agents`, `ui::agents` | AI agents in the open window: the agent settings, the ArtCraft Launcher's switch, the connection file and the CLI's live client (re-exported from `craft-control`), the link host and the Agents page of Preferences | exists |
|
||||
| `client` | JSON-lines client for tests and command-line tools (native) | exists |
|
||||
| `synthetic` | Synthetic pointer and keyboard input: `ui.click`, `ui.move`, `ui.key`, `ui.type` | exists |
|
||||
| `synthetic` | Synthetic pointer and keyboard input: `ui.click`, `ui.move`, `ui.drag`, `ui.key`, `ui.type` | exists |
|
||||
| `dialogs` | `ui.dialog.set`, `ui.dialog.confirm` and `ui.dialog.cancel` over a `DialogHost` | exists |
|
||||
| `profiler` | Frame profiler | exists |
|
||||
| `screenshot` | Screenshot request queue | exists |
|
||||
|
||||
@@ -7,6 +7,7 @@ Provider ids:
|
||||
- `craft.mask`: CPU stand-in for FilmCraft mask composite until WGSL lands on wgpu
|
||||
- `craft.composite.premul`: CPU premultiplied "over" (Normal path from `composite.wgsl`) until WGSL lands on wgpu
|
||||
- `craft.readback`: CPU decode of staging buffers (`f16` RGBA → `f32`, or `fmt:u8` passthrough); uses [`chunk_buffer`](../crates/gpu/src/chunk.rs) against device caps and [`f16_to_f32*`](../crates/gpu/src/readback.rs) from **craft-gpu**
|
||||
- `craft.yuv`: RGBA8 to NV12, P010 or I420 with scaling, registered from **craft-gpu-yuv** (`YuvProvider`, see [its README](../crates/gpu-yuv/README.md)). It is not in `register_all()`, since it depends on wgpu. `YuvProvider::new()` converts on the CPU on any context; `YuvProvider::with_device` runs its WGSL render passes on a device the host passes in.
|
||||
- `{app}.*`: registered by application wasm at init
|
||||
|
||||
Generic worker code must only call `ProviderRegistry::dispatch`: never import app gpu crates.
|
||||
|
||||
+1
-1
@@ -130,7 +130,7 @@ The old app is the visual reference, but not automatically right: judge each dif
|
||||
| Command-line values | `args::ControlOptions`, `EnvNames` | Parses its own flags and calls `ControlOptions::resolve` |
|
||||
| Transport | `server::listen`, `server::serve`, `server::listen_with`, `server::serve_with`, `ServerLimits`, `ControlClient` | Calls `listen` (or `serve` on a listener it bound earlier), supplies `ServerLimits` to the `_with` forms for app-specific caps, keeps the `Listening` and owns the `ControlChannel` |
|
||||
| Request queue, replies | `ControlChannel`, `Reply`, `result_reply` | Runs each request and returns a `Reply` |
|
||||
| Input methods | `synthetic::input_method`, or one by one `synthetic::Click` (a point, or a node of the access tree by `id` or `label` as its `target`), `Focus`, `KeyPress`, `Move::from_params`: the checked parameters of `ui.click`, `ui.focus`, `ui.key`, `ui.move` and the other input methods | Dispatches the method names to them and replies `Reply::AfterInput` |
|
||||
| Input methods | `synthetic::input_method`, or one by one `synthetic::Click` (a point, or a node of the access tree by `id` or `label` as its `target`), `Focus`, `KeyPress`, `Move::from_params`, `Drag`: the checked parameters of `ui.click`, `ui.focus`, `ui.key`, `ui.move`, `ui.drag` and the other input methods | Dispatches the method names to them and replies `Reply::AfterInput` |
|
||||
| Widget tree | `access::inspect` (`ui.inspect`'s widget list), `access::resolve` (the one node an `id` or `label` names), read from the tree `server::serve` has the window host keep | Adds its own fields to `ui.inspect`'s reply |
|
||||
| Dialog methods | `dialogs`: `ui.dialog.set`, `ui.dialog.confirm`, `ui.dialog.cancel` and the dialog list | Dispatches them; may add `ui.dialog.open` for its own dialog kinds |
|
||||
| Screenshots | `ScreenshotParams` (`ui.screenshot {path?, region?}`), `Captures` (the bounded queue), `screenshot_reply` (the crop to the region, PNG encoding) | Allocates a token for `ui.screenshot`, drives the queue each frame, supplies the file writer |
|
||||
|
||||
@@ -98,7 +98,7 @@ High contrast meets every minimum below: it moves pinned values that miss one. S
|
||||
| `accent.text` on `surface.panel`, `surface.raised` and `surface.sunken`; `accent.on_soft` on `accent.soft` | 4.5 | 7 |
|
||||
| Status text (`status.good.fg` ...) on `surface.panel`, `surface.raised` and its own `status.*.bg` | 4.5 | 7 |
|
||||
| `text.on_accent` on `accent.solid`, `accent.hover` and `accent.pressed`; `text.on_strong` on `accent.strong`, `accent.strong_hover` and `accent.strong_pressed`; `text.on_status` on the status solids and their hover and pressed steps | 4.5 | 7 |
|
||||
| `line.focus` on the surfaces; `accent.solid` on the control surfaces (panel, raised, sunken: checked and selected marks); `line.mark` (slider marks and ticks, the badge ring) on the control surfaces, `state.hover` and `state.pressed`; `overlay.stroke` on `overlay.halo` over black and over white | 3 | 4.5 |
|
||||
| `line.focus` on the surfaces; `accent.solid` on the control surfaces (panel, raised, sunken: checked and selected marks); `line.mark` (slider marks and ticks, the badge ring) on the control surfaces, `state.hover` and `state.pressed`; `overlay.stroke` and `overlay.cursor` on `overlay.halo` over black and over white | 3 | 4.5 |
|
||||
| State cues: `accent.border` (the outline of a selected or on control) on the control surfaces; `overlay.handle_stroke` on `overlay.handle_fill` (a selected anchor against a hollow one); the data channel colours (`data.red` ... `data.yellow`) on `surface.sunken` (a curve editor's plot) | 0 (listed, never warned) | 4.5 |
|
||||
| The thumb of a canvas scroll bar (`text.faint`, `text.muted`) on its track (`surface.chrome`) | 0 (listed, never warned) | 3 |
|
||||
|
||||
|
||||
@@ -82,8 +82,13 @@ Rules of the host:
|
||||
- `enqueue` queues a startup modal by `StartupStage` (recovery, first-launch offer, warning, update). Each opens when the stack is empty, one at a time.
|
||||
- `cancel::<D>()` closes a dialog from outside as Escape would, and `StackDialog::cancelled` lets it release what it holds.
|
||||
- `get`, `get_mut` and `confirm::<D>()` reach the open dialog's value, so a script or a test sets fields and answers OK as a user would.
|
||||
<<<<<<< HEAD
|
||||
- Automation that doesn't know the dialog's type goes by id. `open_dialogs` lists the open dialogs with their `StackDialog::json_fields`; `set_json_field(ctx, id, field, value)` sets one as the user would (a prompt's answer is its `choice` field, one it has an enabled button for); `confirm_by_id` and `cancel_by_id` close it. A dialog type opts in by implementing `json_fields` and `set_json_field`; `HostedParamDialog`, `StandardPrompt` and `UnsavedChangesDialog` do. `craft_automation::dialogs` runs `ui.dialog.set`, `ui.dialog.confirm` and `ui.dialog.cancel` on a host and lists its dialogs for `ui.inspect`, so an app's control channel needs no code per dialog type.
|
||||
- `take_keyed` returns the result with `StackDialog::key`, so a Cancel still names the command it answers. `ParagraphDialog`, `TabStopsDialog`, `HyperlinkDialog`, `CheckSpellingDialog` and `FindReplaceDialog` opt in with `.key(String)`; without it their results remain unkeyed. The key does not change a dialog's identity or modality.
|
||||
=======
|
||||
- Automation that doesn't know the dialog's type goes by id. `open_dialogs` lists the open dialogs with their `StackDialog::json_fields`; `set_json_field(ctx, id, field, value)` sets one as the user would (a prompt's answer is its `choice` field, one it has an enabled button for); `confirm_by_id` and `cancel_by_id` close it. A dialog type opts in by implementing `json_fields` and `set_json_field`; `HostedParamDialog`, `StandardPrompt` and `UnsavedChangesDialog` do. `craft_automation::dialogs` runs `ui.dialog.set`, `ui.dialog.confirm` and `ui.dialog.cancel` on a host and lists its dialogs for `ui.inspect`, so an app's control channel needs no code per dialog type. Its `dialog_reply` holds the reply to a `ui.dialog.confirm` that files a held OK until the app answers it (`ControlChannel::poll_held`): the caller gets success when the app accepts, and the refusal's reason, in English for a `Word`, as the error when it refuses.
|
||||
- `take_keyed` returns the result with `StackDialog::key`, so a Cancel still names the command it answers.
|
||||
>>>>>>> 07a8c471ed
|
||||
- A hosted form owns what its dialog edits. What the dialog asks of the app while open (a preview, a path, a colour, a link) waits on the hosted value until the app takes it, and the app answers through the hosted value's methods. The hosted forms: `HostedParamDialog`, `HostedFormatOptions`, `HostedImageSize`, `HostedCanvasSize`, `HostedExportAs`, `HostedSaveForWeb`, `HostedAbout`, `HostedNewDocument`, `HostedGuideLayoutDialog`, `HostedNewGuideDialog` (ui-patterns), `HostedAlert` (ui-panels), `HostedLayerStyle` and `HostedAdjustDialog<V, E>` around any adjustment editor (craft-imaging). A properties dialog is hosted as a `HostedParamDialog` over `PropertiesDialog::into_param_dialog()`. A footer button or a custom row's button that keeps a hosted form open comes back once, by its id, from `take_action`. Footer and row ids share that one channel.
|
||||
- A closing extra button accepts the values and names itself in `ParamResult::button`; OK and automation confirmation leave `button` empty. `ParamResult::tab` is the accepted tab (zero without tabs), preserved while a held answer waits for settlement. Confirmation queries the dialog scope's current framework text drafts, so a custom field's invalid draft holds automation as well as OK and Enter. Hiding a row or writing its value retires only that row's drafts before the next confirmation, including custom controls and companion fields; reset and close retire the scope's drafts. These operations preserve drafts owned by other rows and sibling dialogs.
|
||||
- A `HostedParamDialog::accept_stays_open` form holds OK for the host and withdraws a successful answer, leaving the values ready for another OK. A refusal still shows its reason. `HostedParamDialog::modeless` uses the host's modality mechanism and a modeless dialog layer.
|
||||
|
||||
+6
-3
@@ -56,7 +56,7 @@ The host keeps its panels' specs in a plain-data model that implements `PanelSpe
|
||||
|
||||
| Method | Does |
|
||||
| --- | --- |
|
||||
| `spec` | The panel's `PanelSpec`: label, icon, `SizeLimits`, `DockHeights`, float size, `allow_native`, `window_kind`, `canvas`, `grid`, `host_body`, `count`, `caption`, `swatch` (a data colour before the tab's name; `Some(None)` is the theme's empty swatch) and `documents`. |
|
||||
| `spec` | The panel's `PanelSpec`: label, icon, `SizeLimits`, `DockHeights`, `FlyoutHeight`, float size, `allow_native`, `window_kind`, `canvas`, `grid`, `host_body`, `count`, `caption`, `swatch` (a data colour before the tab's name; `Some(None)` is the theme's empty swatch) and `documents`. |
|
||||
| `permissions` | The panel's `Permissions` (default `ALL`). |
|
||||
|
||||
A panel's `documents` (`PanelDocument`: id, label, swatch, `closable`, `shown`) are tabs of its group's strip after the panel tabs, whichever panel the group shows: one fit and one overflow menu for both. The tab of the shown panel's `shown` document is the selected tab. A pick reports `DockEvent::DocumentPicked` and activates the panel; a close button or middle click reports `DockEvent::DocumentClosed`. The host opens, shows and closes documents by editing the spec. Document tabs do not drag and take no tab drop.
|
||||
@@ -82,7 +82,9 @@ Props: `hide` (`HidePanels::None`, `All` or `Except`), `maximized`, `auto_collap
|
||||
|
||||
A panel in a column collapsed to icons shows in its flyout (`Layout::opens_in_flyout`). The host opens and closes it by writing the `flyout` binding, not the layout: `WindowMenuRows` checks such a panel's row while its flyout is open (`WindowMenuRows::flyout`) and reports a pick in `WindowMenuRowsOutput::flyout`.
|
||||
|
||||
`DockAreaOutput` holds the `actions` taken, the bodies' `requested` actions, the `events` for the host, the `focused` and `picked` panels, the `pressed` panel (the shown panel of the group whose body the primary press went down in, whatever took it, so a host whose bodies are its own egui code knows the panel clicked into), the gesture `sources` (a panel tab, a document tab, a group bar, a tab strip's overflow button, window grips, dividers), `edit`, `float_space`, `columns`, the OS `windows` the floating windows showed in (by a panel of each), `window_files` (one `WindowFiles` per drop on a floating OS window: the shown panel of the group under the drop, the first group's for a drop on the title row, and the files), and `error`: an `InvalidGeometry` when the workspace fails `validate`, in which case the area draws nothing.
|
||||
`DockAreaOutput` holds the `actions` taken, the bodies' `requested` actions, the `events` for the host, the `focused` and `picked` panels, the `pressed` panel (the shown panel of the group whose body the primary press went down in, whatever took it, so a host whose bodies are its own egui code knows the panel clicked into), the gesture `sources` (a panel tab, a document tab, a group bar, a tab strip's overflow button, window grips, dividers), `edit`, `float_space`, `columns`, the OS `windows` the floating windows showed in (by a panel of each), `window_files` (one `WindowFiles` per drop on a floating OS window: the shown panel of the group under the drop, the first group's for a drop on the title row, and the files), `window_events` (one `WindowEvents` per floating OS window that left any, in the order the windows were drawn: the panel the area names the window by, the modifiers held in that window, and its events), `forwarded_events` and `forwarded_modifiers` (the same events flattened in that order, with the modifiers of the last window that left any, for a host with one floating window), and `error`: an `InvalidGeometry` when the workspace fails `validate`, in which case the area draws nothing.
|
||||
|
||||
`window_events` holds the key, text and clipboard events (`Key`, `Text`, `Copy`, `Cut`, `Paste`, `PasteImage`) of the floating windows that show in OS windows of their own and that nothing took this pass, window by window: each batch carries the modifiers held in its own window, because a clipboard event carries none of its own and two floats can leave input in one pass. `forwarded_events` is every window's events flattened in the same order, and `forwarded_modifiers` the modifiers held in the window that left the last of them: a host with one floating window reads those. egui gives each OS window only its own input, so a host that runs shortcuts from its main window's input runs them on these as well, to keep them working while a floating window has the focus. The key stage's own keys (Escape, Tab and focus moves, claimed and edit chords) and what the window's widgets read are not in them, and the key of a command the shortcut dispatcher fired is not forwarded too: neither its press nor, while it is held, its repeats (whether or not `RootEnv::shortcuts_repeat` runs the command again on them), nor its release. The hold ends at any release of the key, wherever it lands (in a focused field, or in another window), so the window's next press and release of that key are forwarded. A press that starts a hold binding's wait is the dispatcher's in the same way. A press the dispatcher declines, a chord whose commands are all disabled, is forwarded, and its repeats that run nothing are too. A window where a component has keyboard focus forwards nothing: its keys are that component's. Floating windows in the app window forward nothing, as their keys are the app window's. Each floating window reads its events with `runtime::keys::leftover_events` once its content has run; a host that shows content in OS windows of its own reads them the same way.
|
||||
|
||||
The host handles these `DockEvent`s:
|
||||
|
||||
@@ -126,9 +128,10 @@ The theme's docking sizes (`DockSizes`) set the drop bands and zones. `DockWords
|
||||
- A drag ends without a change when another arrangement replaces the workspace it started on: it records the workspace's generation, which `Workspace::replace` and the `WorkspaceSet` switch and reset change. The dock's own edits keep the generation, so they keep the drag. Every write moves the workspace's revision (`Workspace::revision`), which keys what the area derives.
|
||||
- A floating window's id comes from a counter its layout owns (`Layout::fresh_window_id`). It starts above every id the layout is built or loaded with and only grows while the layout lives; `Workspace::replace` gives the incoming windows ids the replaced layout never gave out, and a dock area keeps the windows its actions add above every id it has shown, so a workspace an undo brings back draws no id twice (`Workspace::raise_window_floor`). An OS window never passes to another window.
|
||||
- A dock column's last open group fills the column: it takes the height the other groups leave and asks for its `DockHeights::fill`. The other groups keep the height the user gave them, or take their `DockHeights::default`, which shrinks towards `compact` before the filling group gets less than its fill. Groups that ask for no heights share the free height with the filling group.
|
||||
- A flyout is as tall as its group measures, within the room below its top, and at least the `DockHeights::default` of each of its panels whose `PanelSpec::flyout_height` is `FlyoutHeight::Docked`, the default. A panel with `FlyoutHeight::Content` opens a flyout as tall as its body measures, while its `DockHeights` still size its group docked in a column. A group the user sized keeps that height.
|
||||
- Split handles are Tab stops, and the arrow keys move them. A pointer press or drag on a handle leaves key focus where it was, so the arrows after a drag still reach the app; only a handle reached by Tab takes them. A divider drag is one gesture in `DockAreaOutput::edit`.
|
||||
- A pointer press on a panel tab (a click, a drag's press, the tab menu's secondary press) leaves key focus where it was, so the document's keys keep working; Tab still reaches the tab row.
|
||||
- Floating windows stack with the app's own egui windows in egui's area order: the one shown, pressed or raised last (`FloatingGroup::raise`, which the host's `DockArea::focus` request sets on the window holding the panel) is on top, so a dialog the app opens over a floating panel shows above it.
|
||||
- Floating windows stack with the app's own egui windows in egui's area order: the one shown, pressed or raised last (`FloatingGroup::raise`, which the host's `DockArea::focus` request sets on the window holding the panel) is on top, so a dialog the app opens over a floating panel shows above it. A collapsed column's flyout stands in that order too: one opened after a window is over it, and a press on either brings it in front, while the menus opened from a flyout stand above every window.
|
||||
- A panel command (`DockCommands`) acts on the shown panel of the group that takes it. A menu row, a key and the command palette run the same code: `actions` turns the command into `Action`s.
|
||||
|
||||
## Commands and workspaces
|
||||
|
||||
Reference in new issue
Block a user