mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-29 17:55:45 +01:00
Merge main into feat/craft-gpu-yuv
This commit is contained in:
commit
d5bdaebdab
6684 files changed
+1047672
-173269
No files matched your search
@@ -0,0 +1,186 @@
|
||||
# Writing a component
|
||||
|
||||
A component is a Rust type on the contract in `craft_ui::contract` (crate `craft-ui-contract`). It supplies its own parts and look; the library runs one show pipeline for it: id, style, sizing, focus, pointer sensing, state, value binding, commands, popups, accessibility, mirroring and the shared test cases. Nothing in a component calls egui's behavioural APIs.
|
||||
|
||||
## File layout
|
||||
|
||||
One file per component in its family module: `<family>/<component>.rs`, for example `choice/radio.rs` in `crates/ui-widgets`. A library component goes in the lowest library crate of its layer: controls and composites in craft-ui-widgets, sections, dialogs, docking and rails in craft-ui-panels, anything on a `Canvas` in craft-ui-canvas, assemblies of components in craft-ui-patterns ([craft-framework.md 3.2](craft-framework.md#32-the-ui-library-crates)). The file holds the type, its style, its words (`words!`) and a `stories` submodule:
|
||||
|
||||
```rust
|
||||
#[cfg(feature = "testing")]
|
||||
mod stories {
|
||||
use super::*;
|
||||
use craft_ui::testing::{StoryData, StoryOutput, story};
|
||||
|
||||
#[story(Block, covers = [Default])]
|
||||
fn block(ui: &mut Ui, _: &mut StoryData) -> StoryOutput {
|
||||
Block::new(CELL).show(ui).into()
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Tests that need more than the shared cases go in the crate's integration binary, `tests/it/<family>/` (for example `crates/ui-widgets/tests/it/pickers/`), as `#[craft_ui::testing::trial]` functions. A check that needs every library crate linked (the components index, the API map) goes in the facade's binary, `crates/ui/tests/it`.
|
||||
|
||||
A family trial drives frames through `Fixture` (`Fixture::new` or `Fixture::story`, then `click`, `drag`, `key`, `by_label`, `part` and the other helpers), the kit's one frame driver. It writes no click or drag helper of its own.
|
||||
|
||||
## A new crate with components
|
||||
|
||||
A crate outside the library that holds contract types (a family crate) runs its suite and trials from one test executable, its library's test target, with `screen-testing` turning on its stories. `crates/color-ui` is the model:
|
||||
|
||||
```toml
|
||||
[lib]
|
||||
harness = false
|
||||
|
||||
[features]
|
||||
ui = ["dep:craft-ui", "dep:egui"]
|
||||
screen-testing = ["ui", "craft-ui/testing"]
|
||||
|
||||
[dev-dependencies]
|
||||
craft-ui = { workspace = true, features = ["testing"] }
|
||||
```
|
||||
|
||||
```rust
|
||||
// src/lib.rs
|
||||
#[cfg(all(test, feature = "screen-testing"))]
|
||||
extern crate self as craft_color_ui;
|
||||
#[cfg(all(test, feature = "screen-testing"))]
|
||||
#[path = "../tests/it/main.rs"]
|
||||
mod integration;
|
||||
|
||||
#[cfg(test)]
|
||||
fn main() {
|
||||
craft_ui::testing::run(module_path!(), env!("CARGO_PKG_NAME"), &craft_ui::testing::registered_in(env!("CARGO_PKG_NAME")));
|
||||
}
|
||||
```
|
||||
|
||||
`craft_ui::testing::run` runs the `#[trial]` functions of the executable and the suite's shared cases over the types the package's library crate registers. The library's own crates each have an integration binary instead (`tests/it/main.rs` with `harness = false`), whose `main` makes the same call with the crate's `testing::registered()`, which `craft_ui::testing_registered!()` writes. The derive writes registrations and stories only under `feature = "testing"`, so release builds carry none. `cl test <crate>` builds and runs the executable with the feature set every build shares ([development.md](development.md)).
|
||||
|
||||
## Shapes
|
||||
|
||||
The shape is a fact of the type, set by what the caller supplies:
|
||||
|
||||
| Shape | Declare | Caller supplies | Shown with |
|
||||
|---|---|---|---|
|
||||
| Leaf | `#[derive(Component)]` | nothing | `Show::show` |
|
||||
| Container | `#[component(container)]` and a `#[container] ContainerProps` field, then `impl Container` | a body closure | `ShowContainer::show` |
|
||||
| Collection | `#[component(collection)]` and a `CollectionProps` field, then `impl Collection` | an item source and an item closure | `ShowCollection::show` |
|
||||
|
||||
A type that only assembles components has no pipeline. It is a pattern and implements the `Pattern` marker trait.
|
||||
|
||||
The show traits are sealed. A component never has an inherent `show`; `contract/shadow` rejects one.
|
||||
|
||||
## The type
|
||||
|
||||
```rust
|
||||
#[derive(Component, Props)]
|
||||
pub struct Badge {
|
||||
#[common]
|
||||
common: Common,
|
||||
/// The count shown beside the label.
|
||||
#[prop]
|
||||
count: Option<u32>,
|
||||
/// Working: shown dimmed.
|
||||
#[prop(flag)]
|
||||
busy: bool,
|
||||
}
|
||||
```
|
||||
|
||||
- `Common` holds what every component has: label, id, variant, size, enabled, read-only, selected, tooltip. Its setters come from `Props`. A component adds no `enabled`, `id_salt` or `tooltip` field of its own (`props/*`).
|
||||
- `#[prop]` fields become setters. A `#[prop]` field is not a size in points (`f32`, `Vec2`, `Px`): sizes come from the style, a token step or the content (`props/point-size`). A number that is not a size, such as an opacity, declares `#[prop(quantity = "opacity")]`.
|
||||
- The derive writes `<Type>StyleKey`, the setters and the registration that lets the suite find the type. A type that implements `Component` by hand registers with `register_contract!`.
|
||||
|
||||
## The trait
|
||||
|
||||
`impl Component for Badge` states the type's facts and implements only the hooks it needs:
|
||||
|
||||
| Item | Purpose |
|
||||
|---|---|
|
||||
| `const ROLE: Role` | The AccessKit role. |
|
||||
| `type Style`, `fn style(cx, key)` | The look, built from style parts. |
|
||||
| `type Output` | What `show` returns: `Response`, `EditResponse<T>`, a collection response. |
|
||||
| `fn sense(&self) -> Sense` | The default follows the shape; override to add or remove click, drag and focus. |
|
||||
| `fn measure(&mut self, cx: &MeasureCx<'_, Self>) -> Vec2` | The content size. Padding and minimum size are added by the pipeline. |
|
||||
| `fn parts(&mut self, rect, cx: &mut PartsCx<'_, Self>)` | Named sub-rects with `PartKey`, `Sense` and `HitShape`. |
|
||||
| `fn paint(&mut self, ui: &mut PaintUi<'_>, cx: &Cx<'_, Self>)` | Content paint through `PaintUi` and `Draw`. |
|
||||
| `fn content_env(&self, cx, values: &mut AppValues)` | App values set for the body or items. |
|
||||
| `fn finish(self, cx: Cx<'_, Self>) -> Self::Output` | The output. |
|
||||
|
||||
A component is shown through a parent's `show`, never by allocating a rect itself: `contract/allocate` rejects `allocate_*`, `ui.interact` and `ui.put`.
|
||||
|
||||
### Parts and faces
|
||||
|
||||
`cx.part(KEY, rect)` registers a part. `ui.face(KEY, Other::new())` paints another component as the look of a part, so a composite reuses the look of the component it wears. A part that only a pointer reaches states why keyboard users do not need it: `.pointer_only("Enter activates the component")`.
|
||||
|
||||
Read-only text the user can select and copy is a selection part: `parts` declares the run with `cx.selectable_text(KEY, &run)`, and `paint` shows it with `ui.selectable_text(KEY, rect, &run)` in place of `draw().text`, with the same run in the state's colours. A press focuses it; drag and double click select; Select All and Copy work; Tab, F6 and the arrows pass over it. A component may declare any number. The text has no node of its own, so the component's node carries it. A notice's title and message, a metadata table's values (`ListRow::cell_selectable`) and `SelectableText` are selection parts.
|
||||
|
||||
### Values
|
||||
|
||||
A value component's `Output` is `EditResponse<T>`. It binds with `Bind<T>` and reports through `cx.propose`, `cx.commit` and `cx.adopt`; each gesture ends in one `EditEvent::Commit`. A part whose press sets the value under the pointer (a colour field, a point on a well) senses `Sense::SETS_ON_PRESS` and runs its gesture with `cx.follow_press`. A drag part that begins at the first move inside slop, so the value follows the pointer with no jump (a transform box's handles), senses `Sense::FOLLOWS_IN_SLOP` and begins its gesture from `PressPhase::Held`. Components with `Input::Editor` own their caret through `ImeSurface`.
|
||||
|
||||
## Looks
|
||||
|
||||
A style is a plain struct deriving `ComponentStyle`:
|
||||
|
||||
```rust
|
||||
#[derive(Clone, Debug, PartialEq, ComponentStyle)]
|
||||
pub struct BadgeStyle {
|
||||
#[style(metrics)]
|
||||
metrics: Metrics,
|
||||
}
|
||||
```
|
||||
|
||||
`#[style(metrics)]` marks the `Metrics` field (padding, minimum size, gap); `#[style(surface)]` and `#[style(focus)]` mark the surface and focus-ring parts. The style function reads semantic tokens and `BySize` tables through `StyleCx`. It does not match on state: state colours come from `States`, and `style/*` rejects colour picks from response state, size arms and per-instance setters.
|
||||
|
||||
An app changes a look with `Looks::style::<Badge>(f)` before `install`; the replacement is frozen at install. A variant is a `const CustomVariant` with a crate-prefixed id and a look function over semantic tokens; a variant describes itself and needs no registration.
|
||||
|
||||
## Tokens
|
||||
|
||||
A component reads only semantic tokens. It has no tokens of its own and no unnamed size literals. A crate's own concepts go in a `#[derive(TokenGroup)]` struct whose `derive(tokens)` function gives defaults from the resolved semantic tokens; a theme overrides them under the group's `PATH`.
|
||||
|
||||
## Stories
|
||||
|
||||
A story shows one registered type in one state. `#[story(Type, covers = [..])]` registers it. `title = ".."` is the caption a viewer shows over the story (by default one made from its name), and `group = ".."` puts it in a named group with the type's other stories that name it, in declaration order: the gallery shows a group in one card, each story under its caption. The probe of the type lists the states it must show:
|
||||
|
||||
| Type has | Required stories |
|
||||
|---|---|
|
||||
| any | `Default` |
|
||||
| a value output | `Mixed`, `Invalid` |
|
||||
| `Input::Text` or `Input::Editor` | `LongText` |
|
||||
| `#[component(overlay)]` | `Open` |
|
||||
| items | `Empty`, `One`, `Many` |
|
||||
|
||||
A value a story edits comes from `StoryData::value(name, init)`. The suite fails when a required state has no story. `Drive::Auto` picks how the suite changes the value; a story names another drive (`Drive::Drag(Grip::part(HANDLE.at(i)).toward(vec2(1.0, 1.0)))`, `Drive::Pick { row }`, `Drive::Custom(f)`) only when the default does not fit; a drag of a part of the subject is a `Drive::Drag`, which also gets the run cancelled by Escape, never a `Drive::Custom`. The runner makes the disabled, read-only, right-to-left and narrow-room variants of each story itself, so a story shows only the type in its state. The cases the runner runs are the `Case::new` entries in `crates/ui-contract/src/testing/suite.rs` and its `suite/` modules: required states, shows, access, tab, values, mixed, activation, text size, motion, language, text input, and the container and collection cases for the shapes that have them.
|
||||
|
||||
Suite rules:
|
||||
|
||||
- Drawing code changes no state and sends no request. The suite's `measure-pure` case runs each story's `show` twice per pass (a measuring run first, then the real one) and again on rerun passes, which an edit's no-input rerun adds. It fails when either changes story values or sends a command, announcement, toast or request. State changes belong in event branches (`if out.clicked()`, `for edit in out.edits`) or before the container.
|
||||
|
||||
A type that cannot meet a shared case lists it, with a reason:
|
||||
|
||||
```rust
|
||||
#[component(exempt(case = "face-only", reason = "A face of the title row, shown only inside it."))]
|
||||
```
|
||||
|
||||
Each exemption is an entry of kind `probe` in `design/exceptions/<crate>/<family>.toml`, with the rule `probe/exempt/<case>` and the file that declares it. A case is a case name of the runner, `face-only` (a type shown only inside another type's stories) or `state:<Required>` (one required state the type cannot show, such as `state:Mixed`). `craft-design-lint structure` reads the `exempt(..)` declarations from the sources, rejects one without a reason, and fails when a declaration has no entry or an entry lists more than exist; the count cannot rise.
|
||||
|
||||
## Seeing and checking the result
|
||||
|
||||
- `cl render <crate> <Component>` writes the component's stories to PNG files, without building the gallery.
|
||||
- `cl build gallery` builds the gallery, which shows every registered story in both directions and both control sizes, in light or dark, with a filter.
|
||||
- `cl test <crate>` runs the shared cases and the trials of one crate; `cl test <crate> -- <filter>` runs some of them.
|
||||
- `cl cargo run -p craft-design-lint -- structure` checks the layer map, imports, exceptions and clones; `check` reports the source rules.
|
||||
- `cl cargo run -p craft-ui-gallery --bin components-index` rewrites `docs/components-index.md`, the list of what exists. Read it before writing a type, to avoid a second copy of one that exists.
|
||||
|
||||
## Decisions an author meets
|
||||
|
||||
- **One press per pass.** A pass carries at most one press. The press is classified once from the hit list, and a focused text field commits in the press pass, so a click handler elsewhere sees the committed text.
|
||||
- **Popups close on an outside press by default.** `Outside::Close` closes the layer and the press reaches the widget below; `Outside::Keep` ignores the press. A dialog and a floating panel keep.
|
||||
- **A popup or layer body sees the opener's environment.** The overlay host installs the opener's captured values (tokens, size, app values) and resets the layer-local ones: the arena, the transform, the row, the in-scroll flag and the ink.
|
||||
- **`content_env` reaches the body and the items only.** A child shown by `PaintUi` inherits the composite's environment with the composite's resolved `enabled` and size, not the values `content_env` set.
|
||||
- **A new body measures zero once.** A container with no `LayoutMemory` entry measures zero in its first pass, records its real size, and the pass is discarded once. A `measure` that returns the content size avoids the discard.
|
||||
- **A roving group is one Tab stop.** A container with `ContainerProps.roving` puts its group id in the body environment; its members join that stop, arrows move between them, and the group's pick arrives through `activated_member()`.
|
||||
- **Reading a text outcome.** `PartsCx::text` returns `&TextOutcome<V>`: an idle outcome for a part first registered in this pass. A key that was never registered panics, like `part`.
|
||||
- **Memory and animation share an owner.** An animation slot is keyed by `("anim", name)` under the component's id and goes with the owner's entries on eviction. A press entry is dropped when its press ends.
|
||||
- **A face registers no parts.** A component worn by `ui.face(KEY, ..)` runs its own `access` for the wearing part's node. Its `paint` computes what its parts would hold from the value, because the part registry is not read in face mode.
|
||||
- **A story output has one edit kind at most**, because `EditResponse` holds one event.
|
||||
- **A content painter's context owns its painter.** `ContentPainterCx` has no lifetime parameter; its painter is clipped to the component's rect.
|
||||
@@ -0,0 +1,308 @@
|
||||
# Built components
|
||||
|
||||
Generated by `cargo run -p craft-ui-gallery --bin components-index`; edit the doc comments, not this file.
|
||||
|
||||
## Registered types
|
||||
|
||||
Grouped by gallery level, then shape, then name.
|
||||
|
||||
### Primitives
|
||||
|
||||
| Type | Shape | Module | Purpose |
|
||||
|---|---|---|---|
|
||||
| `CanvasGrid` | Leaf | `craft_ui_canvas::canvas_controls::grid` | Major and minor grid lines over a document, counted from `origin` |
|
||||
| `CanvasScrollbars` | Leaf | `craft_ui_canvas::canvas::scrollbars` | The scroll bars of a canvas |
|
||||
| `CropOverlay` | Leaf | `craft_ui_canvas::canvas::crop` | The crop frame of a document, edited by dragging it as Photoshop's Classic crop does (or moving and turning the image behind it in image mode) and by the keyboard |
|
||||
| `Divider` | Leaf | `craft_ui_widgets::display::divider` | A separator line in the divider colour, snapped to the pixel grid |
|
||||
| `FaceRuns` | Leaf | `craft_ui_contract::testing::face_runs` | Three runs in a document face, as an input method's composition is drawn in the text's own font: at its own size, with kana the face lacks drawn by the interface fonts, and a run asked at 4,000 points drawn at the atlas's cap |
|
||||
| `FalloffPreview` | Leaf | `craft_ui_canvas::canvas_controls::brush::falloff` | A tip's falloff centred at a document point, with the circle of the brush's size round it: the preview a brush resize and a hover show |
|
||||
| `FooterSlot` | Leaf | `craft_ui_contract::contract::footer_slot` | The cell where a container whose footer stands in its body (`FooterPlace::Body`) draws that footer: a dialog's buttons in the cell its body's arrangement keeps for them, as the Color Picker keeps one above its second field group |
|
||||
| `Guides` | Leaf | `craft_ui_canvas::canvas_controls::guides` | The ruler guides of a canvas: drawn, taken by the pointer and moved with the keyboard |
|
||||
| `HeaderText` | Leaf | `craft_ui_contract::contract::items::header` | A header cell's label |
|
||||
| `HoverOutline` | Leaf | `craft_ui_canvas::canvas_controls::outline` | The outline of the object under the pointer: decoration over the canvas, drawn after the document and before the tool's own marks |
|
||||
| `Icon` | Leaf | `craft_ui_widgets::display::icon` | An icon |
|
||||
| `InspectOverlay` | Leaf | `craft_ui_widgets::display::inspect_overlay` | The inspector's drawing over an inspected region, shown at the region's rect with `show_at` |
|
||||
| `LabelLeaf` | Leaf | `craft_ui_contract::contract::label::leaf` | The side label as a leaf: its own node, press state and reset dot |
|
||||
| `Marquee` | Leaf | `craft_ui_canvas::canvas_controls::marquee` | An outline over the document, shown at the canvas's rect with `show_at` and mapped through the canvas's view |
|
||||
| `Navigator` | Leaf | `craft_ui_canvas::canvas::navigator::preview` | The preview box of the Navigator panel with the proxy rectangle of the view |
|
||||
| `Pasteboard` | Leaf | `craft_ui_canvas::canvas::pasteboard` | The pasteboard and page frames under a document |
|
||||
| `Picture` | Leaf | `craft_ui_widgets::display::picture` | A picture of an image the caller makes (`new`), of what a content painter paints (`painter`) or of an SVG asset (`svg`); all sit in a rect of the same token sizes |
|
||||
| `PixelGrid` | Leaf | `craft_ui_canvas::canvas_controls::pixel_grid` | The pixel grid over a raster document |
|
||||
| `RasterDisplay` | Leaf | `craft_ui_canvas::canvas::raster` | The document display of one canvas: the document drawn through the view of the [`Canvas`](super::Canvas) it is shown in, at the canvas rect |
|
||||
| `RotateView` | Leaf | `craft_ui_canvas::canvas::rotate` | The compass of a turned view: a dial whose needle points where the document's up lies on screen |
|
||||
| `Rulers` | Leaf | `craft_ui_canvas::canvas::rulers` | The rulers of a canvas: ticks and labels counted from a zero point, level whatever the view's rotation, a pointer marker, the guide drag-out and the zero point's corner |
|
||||
| `SelectionOutline` | Leaf | `craft_ui_canvas::canvas_controls::outline` | Highlights over the selected shapes, in the host's colour (a layer's colour), else the overlay line colour |
|
||||
| `SmartGuides` | Leaf | `craft_ui_canvas::canvas_controls::smart_guides` | The alignment lines and distances an app shows while something moves (Smart Guides and Alt distances) |
|
||||
| `SourceMarker` | Leaf | `craft_ui_canvas::canvas_controls::brush::source_marker` | The clone source's crosshair at document point `at`: two arms through the view, a thin line over a thick halo |
|
||||
| `StraightLinePreview` | Leaf | `craft_ui_canvas::canvas_controls::line_preview` | The Shift-click line from `from` (the end of the last stroke) to `to` (the pointer), both in document units |
|
||||
| `StrokeTrail` | Leaf | `craft_ui_canvas::canvas_controls::brush::trail` | The footprint of the stroke being painted, drawn from a [`CoverageMask`] as one textured quad over the mask's document rect |
|
||||
| `Text` | Leaf | `craft_ui_widgets::display::text` | Text in a type role (body by default) and a shade (normal by default), or in the colour of a tone |
|
||||
| `TipCell` | Leaf | `craft_ui_canvas::canvas_controls::brush::cursor` | An aliased tip's whole-pixel cell on the pixel grid, outlined as a square or a disc: what a pencil shows under the hidden pointer |
|
||||
| `TipText` | Leaf | `craft_ui_contract::contract::tooltip` | The text of a tooltip, on a popup surface |
|
||||
| `Canvas` | Body | `craft_ui_canvas::canvas` | A canvas: a pasteboard the caller's canvas controls and the active tool share |
|
||||
| `Grid` | Body | `craft_ui_widgets::layout_components` | Children row-major over a column list: a child in flow takes the next cell |
|
||||
| `Row` | Body | `craft_ui_widgets::layout_components` | Children side by side |
|
||||
| `SplitViews` | Body | `craft_ui_canvas::canvas::split` | One canvas area shown as views of one document, or a grid of panes the caller fills (one document each), in the panes of a [`SplitLayout`] |
|
||||
| `Stack` | Body | `craft_ui_widgets::layout_components` | Children one under another |
|
||||
| `TargetMark` | Body | `craft_ui_widgets::display::target_mark` | A ring around `target` that pulses in the accent colour, still where motion is off |
|
||||
|
||||
### Controls
|
||||
|
||||
| Type | Shape | Module | Purpose |
|
||||
|---|---|---|---|
|
||||
| `AltTextField` | Leaf | `craft_ui_widgets::text::alt_text` | An alt text editor: a multi-line description box and a Mark as decorative check |
|
||||
| `AngleDial` | Leaf | `craft_ui_widgets::value_drag::angle_dial` | An angle in degrees: a dial whose needle points where the pointer is |
|
||||
| `Badge` | Leaf | `craft_ui_widgets::display::badge` | A small label in a tone: a soft tint by default, a solid fill with a solid variant, an edge without fill with the secondary variant (a chip) |
|
||||
| `BreadcrumbBar` | Leaf | `craft_ui_widgets::bars::breadcrumb` | A path of crumbs, the root first |
|
||||
| `Button` | Leaf | `craft_ui_widgets::buttons::button` | A push button |
|
||||
| `Calendar` | Leaf | `craft_ui_widgets::pickers::date::calendar` | The page of a date picker's popover |
|
||||
| `Checkbox` | Leaf | `craft_ui_widgets::choice::check` | A check box over a bool; a `Mixed` binding shows the mixed state and a click makes it checked |
|
||||
| `ChipField` | Leaf | `craft_ui_widgets::text::chips` | A field of removable chips and a draft text part |
|
||||
| `ComboBox` | Leaf | `craft_ui_widgets::pickers::combo_box` | A text field with a list of options |
|
||||
| `CommandSearch` | Leaf | `craft_ui_widgets::buttons::command_search` | The command-search opener: a search field's face showing the search glyph, a placeholder and the chord of its command at the reading end |
|
||||
| `DatePicker` | Leaf | `craft_ui_widgets::pickers::date` | A text field for a date with a calendar popover |
|
||||
| `Disclosure` | Leaf | `craft_ui_widgets::controls::disclosure` | A button bound to an open state, with the expanded state |
|
||||
| `IconButton` | Leaf | `craft_ui_widgets::buttons::icon_button` | A square button showing only an icon |
|
||||
| `Kbd` | Leaf | `craft_ui_widgets::display::kbd` | A key chord |
|
||||
| `Link` | Leaf | `craft_ui_widgets::buttons::link` | A link: drawn in the accent colour in a type role (body by default) and underlined, so colour is not its only cue (`LinkLook::Plain` drops the underline of a link standing alone) |
|
||||
| `LinkedFields` | Leaf | `craft_ui_widgets::text::linked` | `N` number fields joined by a link toggle |
|
||||
| `NumberField` | Leaf | `craft_ui_widgets::text::number` | A number field: a text part over [`NumberCodec`]; empty text is `None` |
|
||||
| `PointPicker` | Leaf | `craft_ui_widgets::value_drag::point_picker` | A point `[x, y]` picked on a well: x grows to the right and y downwards, as image coordinates do, in either reading direction |
|
||||
| `Progress` | Leaf | `craft_ui_widgets::display::progress` | A progress bar |
|
||||
| `Radio` | Leaf | `craft_ui_widgets::choice::radio` | A member of a `RadioGroup`: selected when the group's pick is its value |
|
||||
| `RangeSlider` | Leaf | `craft_ui_widgets::value_drag::range_slider` | A range slider over `range` |
|
||||
| `Rating` | Leaf | `craft_ui_widgets::choice::rating` | A rating over a `u8` from 0 (unrated) to `max` |
|
||||
| `ReferencePoint` | Leaf | `craft_ui_widgets::pickers::reference_point` | The 3 by 3 picker of a box's nine points: the point a transform, a resize or a watermark works about |
|
||||
| `Segment` | Leaf | `craft_ui_widgets::choice::segmented` | What a segment of a `Segmented` shows: a label, or an icon with the label as its tooltip and name |
|
||||
| `Segmented` | Leaf | `craft_ui_widgets::choice::segmented` | A row of segments over one value |
|
||||
| `Select` | Leaf | `craft_ui_widgets::pickers::select` | A field that shows the picked entry and opens a listbox of all of them |
|
||||
| `SelectableText` | Leaf | `craft_ui_widgets::text::selectable_text` | Read-only text the user focuses with a press to select and copy, which Tab passes over |
|
||||
| `SelectFace` | Leaf | `craft_ui_widgets::pickers::face` | The closed box of a picker: `text` elided to the room left of a trailing chevron |
|
||||
| `Slider` | Leaf | `craft_ui_widgets::value_drag::slider` | A slider over `range` |
|
||||
| `Spinner` | Leaf | `craft_ui_widgets::display::spinner` | The busy mark |
|
||||
| `SplitButton` | Leaf | `craft_ui_widgets::buttons::split_button` | A button whose end opens a menu |
|
||||
| `Swatch` | Leaf | `craft_ui_widgets::choice::swatch` | A colour well that shows a colour from data and reports its activation; it edits nothing |
|
||||
| `Switch` | Leaf | `craft_ui_widgets::choice::switch` | A switch over a bool; a `Mixed` binding rests the thumb in the middle and a click turns it on |
|
||||
| `TextField` | Leaf | `craft_ui_widgets::text::text_field` | A text field over a codec: plain text by default |
|
||||
| `ThumbRow` | Leaf | `craft_ui_widgets::value_drag::thumb_row` | Thumbs on one row, tip up, each a value of its own |
|
||||
| `ToggleButton` | Leaf | `craft_ui_widgets::buttons::toggle_button` | A secondary-looking button that stays pressed while on: it takes the accent fill and edge, and its raised surface draws pressed in |
|
||||
| `TreePicker` | Leaf | `craft_ui_widgets::pickers::tree_picker` | A field that opens a tree of items and folders and sets the binding to the picked item's key |
|
||||
| `UnitSelect` | Leaf | `craft_ui_widgets::pickers::unit_select` | A number field with a select of units after it |
|
||||
| `WordRun` | Leaf | `craft_ui_widgets::text::word_run` | A wrapping run of pickable words in one Tab stop: the arrows move focus over the words in reading order, Home and End to the first and last, and Space, Enter or a click picks the focused word into `selected` |
|
||||
| `CalendarPopover` | Body | `craft_ui_widgets::pickers::date::popover` | A calendar hung from any rect, with `DatePicker`'s calendar body: the precision switch, the page, Today and Clear |
|
||||
| `RadioGroup` | Body | `craft_ui_widgets::choice::radio` | A group of radio buttons over one value: one Tab stop, arrows move focus, Space, Enter or a click selects |
|
||||
| `SwatchTable` | Items | `craft_ui_widgets::choice::swatch_table` | A table of touching colour cells, one per entry, wrapping to the width or to a fixed count per row |
|
||||
|
||||
### Composites
|
||||
|
||||
| Type | Shape | Module | Purpose |
|
||||
|---|---|---|---|
|
||||
| `FindingsSummary` | Leaf | `craft_ui_widgets::list::findings` | The line over a list of findings: a status dot that says whether there are errors, then the counts |
|
||||
| `ListRow` | Leaf | `craft_ui_widgets::list::row` | One row of a list |
|
||||
| `MenuBar` | Leaf | `craft_ui_widgets::menu::bar` | A menu bar |
|
||||
| `MenuIconRow` | Leaf | `craft_ui_widgets::menu::icon_row` | A menu row of icons that is one stop: Left and Right rove among the icons, Up and Down leave the row to the neighbouring menu rows as from any row |
|
||||
| `MenuItem` | Leaf | `craft_ui_widgets::menu::item` | A row of a menu: a label, an optional icon, a check or radio mark, shortcut text and a detail line under the label |
|
||||
| `Node` | Leaf | `craft_ui_widgets::graph::node` | A node of a kind: a title, ports, the kind's inline controls and its body paint |
|
||||
| `Notice` | Leaf | `craft_ui_widgets::notices::notice` | A message in a tone |
|
||||
| `RowThumb` | Leaf | `craft_ui_widgets::list::row::thumb` | The picture of a row's thumbnail, painted by the host through the content painter, which is clipped to the thumbnail's rect |
|
||||
| `SliderField` | Leaf | `craft_ui_widgets::form::slider_field` | A caption and number field over a full-width slider, on one value |
|
||||
| `Tab` | Leaf | `craft_ui_widgets::tabs::tab` | One tab of a strip |
|
||||
| `ThumbnailSlider` | Leaf | `craft_ui_widgets::tile_grid::slider` | The tile size slider: a small picture glyph button, a `Slider` over [`TileZoom::range`] and a large picture glyph button |
|
||||
| `Tile` | Leaf | `craft_ui_widgets::tile_grid::tile` | One tile of a tile grid |
|
||||
| `TitleFace` | Leaf | `craft_ui_widgets::menu::bar` | The face of a menu title: lit while its menu is open or the keyboard is on it, its mnemonic underlined while Alt is held or the bar has focus |
|
||||
| `TitleRow` | Leaf | `craft_ui_panels::sections::title_row` | An optional icon, a title with an optional note run on after it ("· note", muted body text) and an optional subtitle at the band's end (faint caption text: the target's kind), a lead (a disclosure bound to the container's open state, or a check box bound to its gate) and action parts |
|
||||
| `DropAction` | Body | `craft_ui_panels::sections::footer` | A container that is as large as its one child and takes drops of payload type `P` over that child |
|
||||
| `Field` | Body | `craft_ui_widgets::form::field` | One control with a side label: beside it, above it, as a caption or after it (`Field::layout`) |
|
||||
| `FieldGroup` | Body | `craft_ui_widgets::form::group` | A stack of `Field`s (and `LinkedFields`) named `label`, filling the width offered |
|
||||
| `FooterBar` | Body | `craft_ui_panels::sections::footer` | A footer region's content: its body is the caller's closure, and each member is its own Tab stop, in display order |
|
||||
| `GroupBox` | Body | `craft_ui_panels::sections::group_box` | A frame around a body, titled by the container's label |
|
||||
| `Menu` | Body | `craft_ui_widgets::menu::popup` | A menu: a popup of [`MenuItem`]s and [`Divider`]s the arrow keys move through, one roving group |
|
||||
| `Section` | Body | `craft_ui_panels::sections::section` | An inline section of a panel that fills the width offered: a rule over a section-strength title row over a body |
|
||||
| `SectionStack` | Body | `craft_ui_panels::sections::stack` | Sections in the order of `order`, each shown by the caller's closure as a `Section::in_stack` |
|
||||
| `EventList` | Items | `craft_ui_widgets::list::events` | The list of events: one selected event; an empty log says so |
|
||||
| `FindingsList` | Items | `craft_ui_widgets::list::findings` | The list of findings: one selected finding, a click or Enter activates it (the app goes to what it is about), and an empty list says so |
|
||||
| `List` | Items | `craft_ui_widgets::list::view` | A list of rows: one Tab stop, the selection rules of the collection contract, type-ahead on the rows' text (off unless `type_ahead`, so tool keys keep working), rename in place, drag to reorder, and the request for the app's context menu |
|
||||
| `NodeGraph` | Items | `craft_ui_widgets::graph` | A graph of nodes at stored positions, joined by wires |
|
||||
| `Table` | Items | `craft_ui_widgets::table::view` | A table: one Tab stop, a header row over the columns, the selection rules of the collection contract, type-ahead on the rows' text (with `type_ahead`), rename in place, drag to reorder, and the requests for the app's row and header menus |
|
||||
| `TabStrip` | Items | `craft_ui_widgets::tabs::strip` | A strip of tabs: one Tab stop, arrows move the lead without showing its tab, a click, Space or Enter shows the tab, Enter and a double click activate, Cmd/Ctrl+] and [ (or a drag) move the tab later and earlier, Shift to the ends, the menu key asks for the tab's context menu |
|
||||
| `TileGrid` | Items | `craft_ui_widgets::tile_grid::grid` | A grid of tiles: one Tab stop, the selection rules of the collection contract, type-ahead on the tiles' names (with `type_ahead`), rename in place (F2, or a slow second click on the caption of the only selected tile), drag to reorder, files dropped from the OS, and the request for the app's context menu |
|
||||
| `UndoList` | Items | `craft_ui_widgets::list::undo` | The undo list: one Tab stop, arrows mark rows through the row, Enter or a click picks it |
|
||||
|
||||
### Patterns
|
||||
|
||||
| Type | Shape | Module | Purpose |
|
||||
|---|---|---|---|
|
||||
| `BarItems` | Leaf | `craft_ui_widgets::bars::items` | A strip of command items |
|
||||
| `FlyoutButton` | Leaf | `craft_ui_panels::rails::flyout` | One rail button that may stand for a group of tools |
|
||||
| `GroupGrip` | Leaf | `craft_ui_panels::docking::group` | The handle a group is dragged by: an unmarked band over the empty room of the group's header |
|
||||
| `PreviewPane` | Leaf | `craft_ui_patterns::patterns::form_dialogs::preview` | A picture in a well, over a checkerboard where it is transparent |
|
||||
| `Splitter` | Leaf | `craft_ui_panels::docking::splitter` | A line between two panes, as thick across as the pointer's grab distance |
|
||||
| `TearOffBar` | Leaf | `craft_ui_panels::rails::flyout` | The bar down a flyout's end edge that tears the group off, as tall as the rows it runs beside: a press on it dragged past the press slop reports where the drag began, a click where it ended, so a press reports once |
|
||||
| `VeilCard` | Leaf | `craft_ui_widgets::popover::drop_veil` | The card of a veil: a popup surface around the label's `Text`, as wide and high as the text with its padding |
|
||||
| `Bar` | Body | `craft_ui_widgets::bars::bar` | A bar over a chrome surface whose body holds the members in reading order: a tool or options bar's at the standard control size, a status bar's at the small one |
|
||||
| `BlockingOverlay` | Body | `craft_ui_panels::dialog::blocking` | A modal layer that takes the window's input while it is shown, with the wait cursor |
|
||||
| `Dialog` | Body | `craft_ui_panels::dialog::modal` | A dialog on its own layer |
|
||||
| `DialogFrame` | Body | `craft_ui_panels::dialog::frame` | The look of a dialog in the flow of its parent: the dialog surface, a title row, the body and a footer |
|
||||
| `DockColumn` | Body | `craft_ui_panels::docking::dock_column` | One column of a side dock: the column bar over the stacked groups of `column` |
|
||||
| `DockGroup` | Body | `craft_ui_panels::docking::group` | A group of panels: a header of tab strip and panel menu button, dragged by its empty part, over the active panel's body |
|
||||
| `DockRoot` | Body | `craft_ui_panels::docking::root` | The room of a docking pattern: it fills the room offered, resolves the docking sizes its body reads, and takes the drops released on it |
|
||||
| `DropVeil` | Body | `craft_ui_widgets::popover::drop_veil` | A body that dims and shows `label` on a card while the OS drags files over the window, and reports the files dropped on the window |
|
||||
| `FloatingGroup` | Body | `craft_ui_panels::docking::floating` | A floating dock group: a titled window the user moves by its title, resizes by its edges and corners, and minimizes by a double click on the title |
|
||||
| `FullWindowDialog` | Body | `craft_ui_canvas::canvas::full_window` | A dialog that fills the window: a title row, a body that takes the room between the header and the footer, and an optional footer |
|
||||
| `FullWindowSide` | Body | `craft_ui_canvas::canvas::full_window_parts::side` | A side column of a full-window dialog: Liquify's and Select and Mask's Properties, Content-Aware Fill's Preview and settings panels, Filter Gallery's settings |
|
||||
| `IconicColumn` | Body | `craft_ui_panels::docking::iconic` | A column collapsed to icons: the column bar over icon groups, one cell per panel |
|
||||
| `ModalDragStrip` | Body | `craft_ui_panels::dialog::modal` | The chrome a modal dialog puts over a drag area of the window it covers, so that the window still moves by it |
|
||||
| `PageBand` | Body | `craft_ui_shell::shell::title_bar::page_band` | The band over a shown page that moves the window, with the window's ends: the traffic lights' room or the caption buttons |
|
||||
| `PaneFrame` | Body | `craft_ui_patterns::patterns::dock::panes` | A docked pane: a shell pane on one edge of the area, with a title row and a scrolling body |
|
||||
| `Panel` | Body | `craft_ui_panels::sections::panel` | A panel of a workspace: scrolling body, optional footer, optional title row |
|
||||
| `Popover` | Body | `craft_ui_widgets::popover::anchored` | A non-modal popup that hangs from the control that opened it and holds the app's body (a colour picker, a stroke editor, a settings form) |
|
||||
| `PopupList` | Body | `craft_ui_widgets::popover::popup_list` | A list popup under a field the app owns (a combo, a history picker) |
|
||||
| `SplitArea` | Body | `craft_ui_panels::docking` | The docked tree of a layout, with a handle between neighbouring groups |
|
||||
| `StackSections` | Body | `craft_ui_panels::docking::stack` | An accordion laid out in the rect it is shown at (`section_heights` with the strip height of the docking sizes), with a divider between its open sections |
|
||||
| `TitleBar` | Body | `craft_ui_shell::shell::title_bar::bar` | The bar of a window whose frame the app draws |
|
||||
| `ToolRail` | Body | `craft_ui_panels::rails::tool` | The rail of tool slots, laid out in a grid of columns: one `FlyoutButton` per visible slot showing the slot's shown tool, the slot with the current tool toggled on |
|
||||
| `AboutDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::about` | Help > About: tabs About, Contributors and Models over the app's [`AboutInfo`] and [`Credits`], with an OK button |
|
||||
| `Alert` | Pattern | `craft_ui_panels::dialog::alert` | A modal notice with one OK button: a prompt whose only answer is OK, which OK, Enter, Escape and the close action all give |
|
||||
| `AlignBar` | Pattern | `craft_ui_widgets::bars::align` | The two sections of four align and distribute buttons, then the menu button, shown as children of a `Bar` |
|
||||
| `BarHome` | Pattern | `craft_ui_widgets::bars::lead` | The Home button at the start of an options bar: a toggle with the home icon at the standard control size, as tall as a bar's tool icons, then a rule |
|
||||
| `BarTool` | Pattern | `craft_ui_widgets::bars::lead` | The active tool's icon at the start of an options bar, after Home: the icon, the dropdown arrow that tells it has a menu, then a rule |
|
||||
| `CanvasSize` | Pattern | `craft_ui_patterns::patterns::form_dialogs::sizing::canvas` | Canvas Size: the current size, the new width and height with a unit each (no chain: the sides are independent), the Relative box, the 3 by 3 anchor and the colour that fills a larger canvas |
|
||||
| `CommandPalette` | Pattern | `craft_ui_patterns::patterns::panels::palette` | A search over the app's commands: a search field over the matching commands, in a centred modal box or in place |
|
||||
| `ConstraintFields` | Pattern | `craft_ui_widgets::bars::constraint_fields` | The Style, Width, swap and Height cells of an options `Bar` that read and write a marquee's [`Constraint`] (Photoshop's Rectangular Marquee bar, the Slice tool's) |
|
||||
| `DeleteWorkspaceDialog` | Pattern | `craft_ui_patterns::patterns::dock::workspace_dialogs` | Window › Workspace › Delete Workspace…: one of the saved workspaces |
|
||||
| `DockArea` | Pattern | `craft_ui_patterns::patterns::dock::area` | The docking pattern over a workspace |
|
||||
| `DocumentTabs` | Pattern | `craft_ui_widgets::tabs::document` | The tab strip of one document group |
|
||||
| `EditMenu` | Pattern | `craft_ui_widgets::menu::edit` | The edit rows of a text control: Undo and Redo, Cut, Copy, Paste and Delete, then Select All |
|
||||
| `ExportAsDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::export::as_dialog` | File, Export, Export As: format, size, quality, metadata, colour profile, a preview and a size estimate the app computes |
|
||||
| `FileListPicker` | Pattern | `craft_ui_patterns::patterns::form_dialogs::file_list` | Photoshop's Load Files into Stack file list, after PhotoCraft's port of it |
|
||||
| `FormatOptionsDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::export::options` | The options dialog of one export format: JPEG (the quality as a field, a slider and a preset list, then the encoding), layered TIFF (keep or discard the layers, and not to ask again), Targa (24 or 32 bits per pixel) or DDS (compression and mipmaps) |
|
||||
| `FormDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::form` | A dialog over one value `V` |
|
||||
| `FullWindowCanvas` | Pattern | `craft_ui_canvas::canvas::full_window_parts::canvas` | The canvas region of a full-window dialog: the app's image, its overlays and one tool, filling what the other regions left |
|
||||
| `FullWindowStatus` | Pattern | `craft_ui_canvas::canvas::full_window_parts::status` | The status of a preview over a [`Pending`]: nothing while it is ready, a progress bar (with the polite label "Updating preview") while it loads, a notice with the error while it failed and a notice that the preview is unavailable when its job ended without delivering |
|
||||
| `FullWindowTitle` | Pattern | `craft_ui_canvas::canvas::full_window_parts::title` | The title strip's text: the workspace's name, then in brackets what it works on and the zoom on screen, "Liquify (Layer 1, 66.67%)" |
|
||||
| `FullWindowZoomBar` | Pattern | `craft_ui_canvas::canvas::full_window_parts::zoom_bar` | The strip under a full-window canvas: Zoom Out, Zoom In, a zoom select, then a progress bar while the preview renders, or a note |
|
||||
| `GuideLayoutDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::guides` | New Guide Layout, Photoshop's dialog: Preset and Target lists, Color, the Columns and Rows groups (each a check box with Number, Width or Height, and Gutter), the Margin group (a check box and Top, Left, Bottom, Right), Center Columns and Clear Existing Guides; beside them a column of OK and Cancel with Preview under it |
|
||||
| `HistoryPanel` | Pattern | `craft_ui_patterns::patterns::panels::history` | The history panel: `rows` with the `current` one marked, thumbnails of the snapshots and a footer of buttons |
|
||||
| `IconPicker` | Pattern | `craft_ui_widgets::pickers::icon_picker` | A searchable grid of icons in named groups |
|
||||
| `ImageSize` | Pattern | `craft_ui_patterns::patterns::form_dialogs::sizing::image` | Image Size: the width, height and resolution with a unit each, the chain that keeps the proportions, Resample with its method list and Scale Styles, over a readout of the file size and the dimensions |
|
||||
| `Inspector` | Pattern | `craft_ui_patterns::patterns::panels::inspector` | A properties panel: a `Panel` whose header names the target (icon and name, and the kind at the end), and whose body the caller fills with the target's controls, labelled as inspector rows (`LabelScheme::Inspector`) |
|
||||
| `JobProgress` | Pattern | `craft_ui_panels::dialog::job_progress` | Modal progress window for a running job: a progress bar (or an indeterminate one), counts and the percentage, the queued line, and Cancel (and Hide, when `can_hide`) |
|
||||
| `ListManager` | Pattern | `craft_ui_patterns::patterns::form_dialogs::list_manager` | A named list with a name box and a column of action buttons (after Excel's Macros dialog) |
|
||||
| `MetadataTable` | Pattern | `craft_ui_widgets::table::metadata` | A key and value table in groups: a search field over the rows keeps the fields whose name or value matches the typed text, and a check column marks the keys the app shows as columns |
|
||||
| `ModifierKeysPanel` | Pattern | `craft_ui_patterns::patterns::panels::modifier_keys` | A panel of latching modifier-key toggles: a press on one holds that modifier for the next click or key |
|
||||
| `NamedPresetRow` | Pattern | `craft_ui_patterns::patterns::presets::named` | A preset picker with the commands that make, rename and delete presets |
|
||||
| `NavigateBar` | Pattern | `craft_ui_canvas::canvas::navigate::bar` | The options of a navigation tool (Zoom, Rotate View, Hand), shown as children of the app's options bar, as in Photoshop |
|
||||
| `NavigatorOptionsDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::navigator_options` | Panel Options of the Navigator: the colour of the proxy rectangle |
|
||||
| `NavigatorPanel` | Pattern | `craft_ui_canvas::canvas::navigator_panel` | The Navigator panel (Photoshop's Window, Navigator): the [`Navigator`] preview box over the [`NavigatorZoomRow`], both bound to one view |
|
||||
| `NavigatorZoomRow` | Pattern | `craft_ui_canvas::canvas::navigator::zoom_row` | The Navigator's zoom row: a percent field, Zoom Out, a slider over the whole zoom range and Zoom In, in reading order |
|
||||
| `NewDocumentDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::new_document` | File > New: category tabs over a grid of preset cards, a details column and Create and Close |
|
||||
| `NewGuideDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::guides::new_guide` | New Guide, and Edit Selected Guides when it edits a guide: an orientation, a position with a unit and a colour |
|
||||
| `NewWorkspaceDialog` | Pattern | `craft_ui_patterns::patterns::dock::workspace_dialogs` | Window › Workspace › New Workspace…: a name for the live layout and the Capture boxes (Keyboard Shortcuts, Menus, Toolbar) |
|
||||
| `NoticeCenter` | Pattern | `craft_ui_widgets::notices::center` | The app's way to post notices to a window |
|
||||
| `OutputPathRow` | Pattern | `craft_ui_patterns::patterns::form_dialogs::export::path_row` | "Output To", a list of name templates (`[Comp Name].[fileExtension]`) and the resulting file name as a link, for render queues and export dialogs (After Effects' Render Queue) |
|
||||
| `PaneArea` | Pattern | `craft_ui_patterns::patterns::dock::panes` | The app's side panes, bottom panes and floating panes around its document |
|
||||
| `PanelMenu` | Pattern | `craft_ui_widgets::menu::panel` | The rows of one panel's menu: the host's rows, a separator, then the dock's rows |
|
||||
| `PanePager` | Pattern | `craft_ui_patterns::patterns::form_dialogs::preview` | The pager row of a preview: a previous button, the caption ("Page {p} of {n}", "Sheet {p} of {n}"; "No pages" or "No sheets" for a count of 0) and a next button |
|
||||
| `ParamDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::dialog` | A dialog from a parameter list: one row per [`Param`], the Preview check box when it [`previews`](ParamDialog::previews), with a preview pane when the host gives a picture, and OK, Cancel, extra buttons and a footer note |
|
||||
| `ParamRows` | Pattern | `craft_ui_patterns::patterns::form_dialogs::rows` | The rows of a parameter list: a group of one labelled field per visible [`Param`], the control chosen by its [`ParamKind`], in a panel the host lays out or inside a dialog |
|
||||
| `PasswordDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::password` | A question with a lock icon, the message, the masked field and the buttons |
|
||||
| `PasswordFields` | Pattern | `craft_ui_patterns::patterns::form_dialogs::password` | The password fields: the masked field with the reveal toggle that hands the focus back, the Re-type field with the mismatch help, the strength help and meter, and an error line |
|
||||
| `PathRow` | Pattern | `craft_ui_patterns::patterns::form_dialogs::path_row` | A text field with the path, taking the row's room, and a Browse button after it, for a row whose enclosing `Field` shows the label |
|
||||
| `PathSetting` | Pattern | `craft_ui_patterns::patterns::preferences::path_setting` | A path setting for a custom row or page of Preferences ([`CustomSettings`](super::CustomSettings)): the label, then a text field with the path and a Browse… button, over the draft value at `key` |
|
||||
| `PdfExportDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::pdf_export` | File > Save as PDF: a preset row, Standard and Compatibility, and a list of sections (General, Compression, Marks and Bleeds, Output, Advanced, Security and Summary) beside the shown section |
|
||||
| `PreferencesPage` | Pattern | `craft_ui_patterns::patterns::preferences::page` | A preferences page that applies each value at once, with search and Reset Section |
|
||||
| `PreferencesWindow` | Pattern | `craft_ui_patterns::patterns::preferences::window` | The preferences window: a search field over a page list and the shown page, with OK, Cancel and Apply under them |
|
||||
| `PresetBrowser` | Pattern | `craft_ui_patterns::patterns::presets::browser` | A library of named presets shown as thumbnails |
|
||||
| `PresetFooter` | Pattern | `craft_ui_patterns::patterns::presets::footer` | The footer of a preset panel: the host's own controls, the thumbnail size slider and the count, then the action buttons Delete, New and New Group and the host's own actions |
|
||||
| `PresetManager` | Pattern | `craft_ui_patterns::patterns::presets::manager` | The preset manager: a select of preset `kinds` over the list of the picked kind's `rows`, with Rename and Delete on each row and buttons for the host's own `actions` (Load, Save, Reset) |
|
||||
| `PresetPicker` | Pattern | `craft_ui_patterns::patterns::presets::picker` | A field that shows the current preset and opens its presets |
|
||||
| `PreviewZoom` | Pattern | `craft_ui_patterns::patterns::form_dialogs::preview` | The zoom row of a preview: a zoom-out button, the zoom as a percentage field and a zoom-in button |
|
||||
| `Prompt` | Pattern | `craft_ui_panels::dialog::prompt` | A question with answers: a dialog on the modal preset, centred and not movable, with a message, optional extras and one footer button per answer |
|
||||
| `PropertiesDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::properties` | A properties dialog: a builder over a tabbed [`ParamDialog`] ([`into_param_dialog`](PropertiesDialog::into_param_dialog)), a `TabStrip` over the tabs (none with one tab) and the rows of the shown tab over the values of all of them |
|
||||
| `ReorderableSections` | Pattern | `craft_ui_panels::sections::reorderable` | Sidebar sections the user folds, hides, pins and reorders, over the host's [`SectionLayout`] |
|
||||
| `ReportDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::report` | A report: the title, one summary line, the count of notes, the notes with their tone icons and, in the footer, Copy and OK |
|
||||
| `SaveForWebDialog` | Pattern | `craft_ui_patterns::patterns::form_dialogs::save_for_web` | The Save for Web dialog: the view tabs over a row of preview panes that share one view, the zoom row, the animation row, and the settings column |
|
||||
| `SectionList` | Pattern | `craft_ui_patterns::patterns::form_dialogs::section_list` | A single-select, click-activated, content-sized list at its natural height without a header and a vertical divider at the start edge, and the body of the shown section in a filling, vertically scrolled stack beside them; the list stays put while the body scrolls |
|
||||
| `SettingsNotices` | Pattern | `craft_ui_widgets::notices::settings` | The notices a `SettingsNoticeState` calls for, newest problem first: an error notice when saving keeps failing and a warning when stored settings were reset |
|
||||
| `StandardPrompt` | Pattern | `craft_ui_panels::dialog::prompts` | A standard confirmation on the dialog host: a prompt with the platform's button order, a letter on every answer and, with `dont_show_again`, a check box under the message |
|
||||
| `StatusMessage` | Pattern | `craft_ui_widgets::bars::status` | A message for the status bar and its tone |
|
||||
| `StatusProgress` | Pattern | `craft_ui_widgets::bars::status` | A background task's progress, for a status bar's trailing group: the task's name, a progress bar that moves a segment while the extent is unknown, the percentage and an optional cancel button |
|
||||
| `StatusReadout` | Pattern | `craft_ui_widgets::bars::status_readout` | The zoom field, the chosen item's text and the menu that chooses it, shown as children of a status `Bar` |
|
||||
| `TaskBar` | Pattern | `craft_ui_canvas::canvas_controls::task_bar` | The contextual task bar: a movable modeless layer hung on a side of the screen bounds of `anchor`, with a body of members and a More menu (Hide, Pin, Reset, then the host's rows) |
|
||||
| `ToastStack` | Pattern | `craft_ui_widgets::notices::toasts` | The cards of a window's toast queue |
|
||||
| `ToolbarDrawer` | Pattern | `craft_ui_panels::rails::drawer` | The All Tools drawer: a popover beside the rail with one list over all groups, a heading row for each group |
|
||||
| `Tour` | Pattern | `craft_ui_patterns::patterns::panels::tour` | A guided tour of the interface: a card with the step count and a close button, the step's heading and text, Skip, Back and Next (Done on the last step), beside the part the step points at, which a pulsing ring marks |
|
||||
| `UnsavedChangesDialog` | Pattern | `craft_ui_panels::dialog::unsaved` | The question for one modified document: a prompt titled "Unsaved changes" with the document's name in the message, Save (the accepting answer), Don't Save and Cancel in the platform's order and words, and, while the guard has more documents, an "Apply to All" check box |
|
||||
| `Watermark` | Pattern | `craft_ui_patterns::patterns::form_dialogs::watermark` | The watermark rows of an export dialog: Style (Text, Graphic), the text field or the image path with Choose…, Orientation, Position as the 3 by 3 reference point, Rotation, Size, Opacity, Inset X and Y, and Shadow |
|
||||
| `WindowMenuRows` | Pattern | `craft_ui_panels::docking::window_menu` | One check row per panel in the order the app gives, for a Window menu |
|
||||
| `WorkspaceSwitcher` | Pattern | `craft_ui_patterns::patterns::dock::switcher` | The switcher at the end of an options bar: a small select showing the current workspace's name |
|
||||
| `ZoomField` | Pattern | `craft_ui_widgets::text::zoom_field` | A zoom field: a `NumberField` over the view's zoom in percent on its [`ZoomScale`] (device pixels unless set), with the zoom codec and the zoom scheme's range |
|
||||
| `RecoveryDialog` | Dialog | `craft_ui_panels::dialog::recovery` | Recover Unsaved Work, one document at a time: a prompt saying when the document was autosaved, with Discard and Recover (the accepting answer) |
|
||||
|
||||
### Shells
|
||||
|
||||
| Type | Shape | Module | Purpose |
|
||||
|---|---|---|---|
|
||||
| `BarGrip` | Leaf | `craft_ui_shell::shell::options_place` | The grip of an options bar: a drag on it starts a drag session that moves the bar and docks or floats it on the release |
|
||||
| `CaptionButton` | Leaf | `craft_ui_shell::shell::caption_button` | One caption button of a title bar |
|
||||
| `DocumentWindow` | Body | `craft_ui_shell::shell::document_window` | A document's window: the container of one entry of the app's window list, in its own OS window |
|
||||
| `ShellRegion` | Body | `craft_ui_shell::shell::app_shell` | A region of the window skeleton: the root window's content, the scope that carries the shell to its slots, or one pane (a bar, a rail or the body) |
|
||||
| `AppShell` | Pattern | `craft_ui_shell::shell::app_shell` | The window skeleton |
|
||||
| `CanvasPanel` | Pattern | `craft_ui_shell::shell::canvas_shell` | The canvas panel of a dock: the document tab strip flush against the document, then the document area, over the canvas surround |
|
||||
| `OpeningCard` | Pattern | `craft_ui_shell::shell::opening` | A centred card: "Opening {name}…" elided on one line with the full text on hover, the muted message, a progress bar (indeterminate without a fraction), the percentage at the start and Cancel at the end of the last row |
|
||||
| `RecentList` | Pattern | `craft_ui_shell::shell::recent_list` | The recent files as rows, with the commands of a recent file and its context menu |
|
||||
| `ScreenModeButton` | Pattern | `craft_ui_shell::shell::screen_mode_button` | A flyout button over the screen modes of the shell's set, with `mode` marked: a click, Enter or Space cycles; a hold, a drag away or a right click lists the modes without cycling |
|
||||
| `StartScreen` | Pattern | `craft_ui_shell::shell::start` | The start screen, shown in a shell's body when no document is open |
|
||||
| `ViewportWindow` | Pattern | `craft_ui_shell::shell::viewport_window` | A window of the app with a body the app fills |
|
||||
|
||||
## Behaviours
|
||||
|
||||
| Module | Purpose |
|
||||
|---|---|
|
||||
| `craft_behavior::anchor` | The nine points of a box, shared by the transform box rules and the reference point picker |
|
||||
| `craft_behavior::arrangement` | `Arrangement`: a custom placement for a body, in logical coordinates |
|
||||
| `craft_behavior::codec` | `Codec`: how a text part turns a value into text and text into a value (18.2), with the library codecs of this crate |
|
||||
| `craft_behavior::columns` | Column keys, widths and the sections a grid layout reports |
|
||||
| `craft_behavior::command` | The pure rules of command routing (spec 11.3): which state a command resolves to, and which live instance of a scope receives a command fired by a key, the menu bar, the palette or automation |
|
||||
| `craft_behavior::cursor` | Cursor requests as plain data and the rule that picks the winner (8.5) |
|
||||
| `craft_behavior::digit_keys` | [`DigitKeys`]: Photoshop's number keys for a tool's opacity |
|
||||
| `craft_behavior::divider` | The resize of a row of segments separated by dividers |
|
||||
| `craft_behavior::doc_key` | A stable, crate-prefixed semantic key for presence, automation, undo names and programmatic focus |
|
||||
| `craft_behavior::edit_history` | `EditHistory<T>`: the undo and redo of a dialog, a tool session or the keymap editor, fed by edit events |
|
||||
| `craft_behavior::editor` | `EditorInput`: the one ordered input stream the IME engine produces and an editor part reads (18.4) |
|
||||
| `craft_behavior::eviction` | When a component's remembered state is due for eviction |
|
||||
| `craft_behavior::fit` | The fit rules: which tabs, bar items or titles stay in a strip and which go to an overflow menu |
|
||||
| `craft_behavior::flow` | `Insets`, `Flow` and `Axis`: start and end geometry resolved once for the layout direction |
|
||||
| `craft_behavior::focus` | Pure focus rules (spec 9.3, 9.4, 8.3): key ownership, the Escape order and the focus-on-press kinds |
|
||||
| `craft_behavior::frame_step` | The step of one pass of motion: a Hand glide, a held Zoom press and an autoscroll integrate over it |
|
||||
| `craft_behavior::grid` | The `Grid` cursor: columns resolved from last pass's measurements, and the cell each child takes |
|
||||
| `craft_behavior::hit` | Hit shapes, their priority and the arena's resolve rule (8.3) |
|
||||
| `craft_behavior::hold_repeat` | Steps due while a press is held, as a spinner button repeats |
|
||||
| `craft_behavior::input` | What a component takes from the user, which decides its default key use |
|
||||
| `craft_behavior::intent` | Intents: a key, an AccessKit action or typed text turned into meaning (spec 9.2) |
|
||||
| `craft_behavior::item_layout` | Item geometry: where each item of a collection sits for a scroll offset and viewport |
|
||||
| `craft_behavior::item_marquee` | `MarqueeSelect`: the rectangle a drag over list items sweeps and the selection it makes (8.7) |
|
||||
| `craft_behavior::item_source` | Where a collection's items come from: the data traits and the one way to show a slice |
|
||||
| `craft_behavior::keys` | The key table (spec 9.2): the one place that maps a key press to an intent and modifiers to `MoveMods` |
|
||||
| `craft_behavior::label_column` | `LabelColumn`: label-then-control geometry for one row |
|
||||
| `craft_behavior::layout_memory` | The tolerance rule of layout memory: when a measured size asks for a discard pass |
|
||||
| `craft_behavior::middle_scroll` | The middle button's auto-scroll latch: the gesture state of one middle press |
|
||||
| `craft_behavior::monitor` | The connected monitors, as every window placement reads them |
|
||||
| `craft_behavior::motion` | The motion level an animation runs at |
|
||||
| `craft_behavior::nav` | The navigation core (spec 9.5): shapes, the key-free outline, stepping, roving groups, type-ahead and single-value keys |
|
||||
| `craft_behavior::one_press` | The one-press-per-pass rule: a pass carries at most one press, as its last pointer event |
|
||||
| `craft_behavior::overlay` | `place`: where an overlay of a given content size goes around its anchor |
|
||||
| `craft_behavior::part` | Part keys and part references: the one name for a part in focus, style, results, sub-nodes and decision records |
|
||||
| `craft_behavior::pixel_size` | A size in whole pixels |
|
||||
| `craft_behavior::placement` | Where windows go on the desktop: where a saved window opens ([`place`]), which monitor a window is on, and where the next window of a cascade opens |
|
||||
| `craft_behavior::press` | Pointer values and the press lifecycle (8.1, 8.2), egui-free: the runtime converts egui's events once per pass and feeds them to a [`PressMachine`] |
|
||||
| `craft_behavior::quantity` | `quantity::Reader`: the one number and unit parser (18.3): locale digits, unit spellings, expressions and relative input |
|
||||
| `craft_behavior::role_rule` | `RoleRule`: the fields each AccessKit role requires (spec 12.3) |
|
||||
| `craft_behavior::scroll` | Scroll positions and the range a scroll part shows |
|
||||
| `craft_behavior::selection` | Selection models: what a collection's selection holds and how a change applies to it |
|
||||
| `craft_behavior::sense` | The library's sense set, for a root or a part |
|
||||
| `craft_behavior::sizing` | `Proposal`, `Metrics` and `ControlMetrics`: what a measure call is asked and what a style gives it to add |
|
||||
| `craft_behavior::typing` | `TypingRun<C>`: the draft, rejected text, commit, cancel, escape rule and limits of a text part (18.2) |
|
||||
| `craft_behavior::value` | The value core of chapter 10: the bound every value type meets, `Mixed`, edit events and the list a pass's events fold into |
|
||||
| `craft_behavior::value_drag` | `ValueDrag`: the drag maths of sliders, dials, scrubbing number fields and rulers, written once (8.7) |
|
||||
| `craft_behavior::wheel` | Wheel gesture values, as craft-behavior's copy of egui's types so the wheel split is egui-free |
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,116 @@
|
||||
# Development workflow
|
||||
|
||||
How to build, test and look at this workspace without waiting for it. Porting an app onto the framework is described in [porting.md](porting.md). The rules here exist because a cargo workspace of 157 crates, with a framework that every domain crate links, rebuilds far more than the change touched whenever two commands disagree about features or profiles.
|
||||
|
||||
## The commands
|
||||
|
||||
`tools/cl` is the entry point for every local cargo command (put it on your PATH, or run `tools/cl` from the worktree):
|
||||
|
||||
| What | Command | Builds |
|
||||
|---|---|---|
|
||||
| check a crate you changed but don't test | `cl check <crate>` | `cargo check` of the crate's lib, bins and tests |
|
||||
| build its tests | `cl test <crate> --no-run` | `cargo test -p <crate> --tests --no-run`; prints each test binary's path |
|
||||
| run some trials | `cl test <crate> -- <filter> --test-threads 4` | nothing new when warm; then runs each test binary with the filter |
|
||||
| the debug gallery | `cl build gallery` | the `craft-ui-gallery` binary only |
|
||||
| one component's stories as PNGs | `cl render <crate\|ui> <Component> [--story <name>] [--out <dir>]` | the `story-render` binary with that crate's feature |
|
||||
| anything else | `cl cargo <args>` | what you asked for, through the job pool, nothing added |
|
||||
| the features `cl` adds for a crate | `cl features <crate>` | nothing |
|
||||
|
||||
For a crate whose tests you build next, skip `cl check`: a check is a separate cargo build (metadata only) of the same crates, so after a framework edit the check and the test build each compile the edited crates' front end, and the test build reports the same errors at about the same point.
|
||||
|
||||
`<crate>` is the package name with or without `craft-` (`color`, `craft-ui-widgets`). `cl` uses `<worktree>-target` as the target directory when that directory exists beside the worktree, else `CARGO_TARGET_DIR`, else `target/`.
|
||||
|
||||
### The one-minute component loop
|
||||
|
||||
A fix to one gallery component, from the edit to its old/new picture on a page: edit the component's crate, then `cl render <crate> <Component>` (about 10–25 s warm: the changed crate, the renderer's link, the render) and compare the PNGs with the previous ones; put the old and the new image side by side in whatever image viewer or comparison page you use. `story-render` links the framework and only the domain crates its features name, so a change in craft-color-ui rebuilds craft-color-ui and the renderer, not the gallery and its 17 crates. `cl render ui <Component>` renders the framework's own components.
|
||||
|
||||
## One feature resolution
|
||||
|
||||
cargo compiles a crate once per distinct feature set, and every crate above it once more, and it unifies features only over the packages a command selects. A framework crate's tests have no eframe in their graph; a domain crate's tests do; the gallery adds every domain crate, whose dependencies turn on more features of egui, wgpu, craft-window, image and others below the framework. Each kind of command would build its own copy of the framework, and wgpu with it.
|
||||
|
||||
`cl` selects the `feature-root` package beside the package of every command (`-p <crate> -p feature-root`). Its dependencies are the gallery's, with every domain crate's `suite`, so every local build resolves features as the gallery does, and a target directory holds one build of each crate. Nothing of `feature-root` is compiled: its one target is a bin no `cl` command selects (`cl` names the crate's own targets), and only the targets a command names are built, so a render still links one domain crate and a framework crate's tests still link no app. On top, `cl` adds the crate's own test feature (`suite`, else `screen-testing`, else `testing`). The Mac's and CI's commands never select `feature-root` and are unaffected.
|
||||
|
||||
Five manifest facts keep this true, and `cl doctor` checks them: the gallery links each domain crate's stories as an optional dependency behind a feature of its own (so a render links one domain crate); `feature-root` lists every optional domain crate of the gallery with the gallery's features, and depends on the gallery without its default features (so the gallery lib's own features stay each command's: `apps` for the gallery, one crate for a render); the story renderer asks its shared dependencies for no feature beyond what the gallery's lines turn on (one those features imply, as `suite` implies `testing`, adds nothing); dev-dependency lines ask the egui crates (egui, epaint, epaint_default_fonts, emath, ecolor) for no feature that `feature-root`'s or the normal lines lack (a feature there differs between a crate's tests and everything else); the proc-macro crate pins syn's and proc-macro2's features to everything other derive crates may add, so the one syn every proc macro shares is the same with or without design-lint in the graph. `cl` names any new build of a framework crate in the target directory after each command; after a manifest change one is expected, otherwise run `cl doctor`.
|
||||
|
||||
The `testing` feature (or `screen-testing` on domain crates) supplies fixtures and helpers for app tests. The `suite` feature implies that kit and adds framework stories, registrations, trials, snapshots, and the suite runner. Framework and gallery tests enable `suite`; apps should use the kit without it.
|
||||
|
||||
## App workspaces
|
||||
|
||||
`tools/cl` finds its workspace with `git rev-parse --show-toplevel` from the current directory, so `/path/to/craft-libs/tools/cl` run inside an app's tree builds and tests that tree. An app workspace is one whose root `Cargo.toml` has a `[workspace.metadata.cl]` table. There every command selects the same packages (`selection`), in test mode, without `--features` (the test features come from the dev-dependencies). Each package brings features the others lack, so a command that drops one builds a second copy of the shared crates below it (in PhotoCraft egui, photocraft-io and craft-affinity) and of everything above them. The craft-libs workspace has no such table and keeps the commands above.
|
||||
|
||||
| to | run | what it does |
|
||||
| --- | --- | --- |
|
||||
| test one crate | `cl test <crate> [-- <filters>]` | builds `--lib --tests` over the selection, then runs only that crate's test binaries |
|
||||
| test a crate's lib fast | `cl test <crate> --unit [-- <filters>]` | builds and runs the lib binaries only |
|
||||
| the integration round | `cl test all [-- <filters>]` | builds all, runs every binary of the selection `run_slots` at a time, longest first |
|
||||
| check | `cl check <crate>` | `cargo check --lib --tests` over the selection (the selection is fixed, so every package is checked) |
|
||||
| an example | `cl build <example>` | `cargo test --no-run --example <example>` over the selection |
|
||||
| the packages and builds | `cl doctor` | the selected packages exist; the target holds one build of each `expected_features` crate, with those features |
|
||||
|
||||
`<crate>` is the package name, or the name without its first word (`ui-egui` and `engine` in PhotoCraft; `photocraft` for the app). `--no-run` builds only.
|
||||
|
||||
The keys of `[workspace.metadata.cl]`; cl refuses a table with an unknown key or a value of the wrong type:
|
||||
|
||||
| key | type | default | what it does |
|
||||
| --- | --- | --- | --- |
|
||||
| `selection` | list of packages | required | the packages every command selects |
|
||||
| `tracked` | list of crates | none | crates whose new builds in the target directory are named after each command, besides the framework's |
|
||||
| `expected_features` | table: crate = list of features | none | the features of the one build of each crate that `cl doctor` expects in the target directory |
|
||||
| `unset_env` | list of variable names | none | removed from every command's environment: variables that change a build input, so a command run with another value rebuilds |
|
||||
| `set_env` | table: name = value | none | set in every command's environment |
|
||||
| `shard` | table: `"<package>/<test target>"` = count | none | runs that test binary as that many shards when no filter is given |
|
||||
| `default_seconds` | table: `"<package>/<test target>"` = seconds | none | orders the first `cl test all` run, longest first; later runs use the times recorded in `<target>/cl-test-times.json` |
|
||||
| `run_slots` | integer | 1 | test binaries run at once |
|
||||
| `test_threads` | integer | libtest's | `--test-threads` for each test binary, unless the command passes its own |
|
||||
|
||||
PhotoCraft's root `Cargo.toml` is the worked example: 11 packages selected, `TMPDIR=/tmp` set (its tests keep a scratch reserve that a TMPDIR on a nearly full disk trips), `RUST_MIN_STACK`, `CARGO_INCREMENTAL` and `CRAFT_FONTS_DIR` unset (the text crate's build script tracks the fonts directory), three binaries at a time with four test threads each, and the ui-egui lib binary in three shards.
|
||||
|
||||
A shard is chosen by top-level module from the binary's `--list` (a module over a shard's share of the tests is split by its submodules); each test runs in exactly one shard. The last line of `cl test` is `N passed, M failed, B binaries, K overflowed stacks, T s`; failures follow as `binary test_name`.
|
||||
|
||||
`CL_LAUNCHER` and `CL_RUNNER` play the same roles as in craft-libs (see [The job pool](#the-job-pool)): every cargo command runs through `CL_LAUNCHER`, every test binary through `CL_RUNNER`.
|
||||
|
||||
Refused in an app workspace, with the reason: a selection other than the whole of `selection` (one `-p <crate>`, or none, through `cl cargo`), `--features`/`-F`/`--no-default-features`, `--all-features`, `--workspace`, and a `cargo test` without `--lib`, `--tests` or `--example`. After every command, a new build of a `tracked` or framework crate is named with its feature set. `CL_DRY_RUN=1` prints the composed cargo command and the environment and runs nothing.
|
||||
|
||||
## What not to run locally
|
||||
|
||||
- `--all-features`: enables `snapshot`, `system_fonts`, `color_fonts`, text's `all-languages` and more, a set no loop uses; it rebuilt 206 dependency crates and every framework crate once. CI runs it.
|
||||
- `--bins` on the gallery: three 1 GB executables nobody opens locally.
|
||||
- Workspace-wide builds and tests (`--workspace`): 43 minutes for the test build alone. Locally, build the crate you changed and run its trials; `workspace.yml` runs the workspace-wide checks in CI.
|
||||
|
||||
What CI covers (.github/workflows). Pushes to `main` and `next` and every pull request run the workflows whose paths changed; on `next` the Linux jobs run:
|
||||
|
||||
- `workspace.yml` runs `cargo fmt --check`, clippy and tests for the whole workspace, with and without `--all-features`, on every push and pull request (Linux only on `next`; Linux, Windows and macOS elsewhere). This is the full gate.
|
||||
- `ui.yml` is the framework's fast gate: clippy and tests of the seven ui crates (`craft-ui` and the six it re-exports) with and without `--all-features`, their docs, and a wasm check of the facade. It runs on changes under those crates, `craft-ui-macros` and `craft-i18n`.
|
||||
- `theme.yml` covers craft-theme and craft-theme-store, and checks that craft-ui's library still builds.
|
||||
- `docs.yml` builds the documentation of the workspace.
|
||||
- `formats.yml` covers the shared format crates; `video.yml` covers craft-video.
|
||||
- Leaf crates with their own path-filtered workflow: ai-core, atomic, audio, cms, crw, dialogs, doc, docpath, ecproj-format, font-store, i18n, jpeg, keymap, media, menu, pcraft-format, pdf, print, proof, update, vectorcraft-format, web-api, web-host, window.
|
||||
- `house-rules.yml` runs the organisation's shared house-rules check.
|
||||
|
||||
A crate without its own workflow (craft-behavior, craft-host, the domain crates that use the framework, the gallery, the story renderer and the benchmark) is tested only by `workspace.yml` in CI. Locally, check it with its own `cl test`.
|
||||
|
||||
## Profiles
|
||||
|
||||
`cl` passes the dev settings below to every cargo command as `--config` arguments (`DEV_PROFILE_CONFIG` in `tools/cl`), so Cargo.toml's `[profile]` table stays the one CI's cache key hashes and local builds keep these settings.
|
||||
|
||||
- Dependencies build at `opt-level = 2` in dev and test builds, once per target directory, so screen tests and the debug gallery run at a usable speed.
|
||||
- `lto = "off"` in dev: with cargo's default (`lto = false`) rustc runs thin-local LTO across every optimised crate's codegen units on each rebuild; off, a one-line edit re-optimises only the changed units (widgets' one-line rebuild went from 41 s to 4 s).
|
||||
- craft-theme, craft-behavior and craft-proof build at `opt-level = 1`: their code runs in every screen-test frame (colour maths, behaviour cores) or in dictionary-sized tests, and they are rarely edited. Every other workspace crate, the runtime (craft-ui-contract) included, builds at 0, where rustc shares generic instantiations across crates and an edit rebuilds in seconds (the runtime's 65k lines cost 35–90 s of codegen per edit at opt-level 1).
|
||||
|
||||
## Measuring frame time
|
||||
|
||||
Frame-time numbers come from the release build of the gallery, the build a developer runs on the target machine: `cargo run --release -p craft-ui-gallery`. Build it in a worktree kept for measuring only, so its release build stays warm and a rebuild after a change compiles only the crates the change reaches. Build the old gallery with the same settings, so a ratio compares the code and not the optimisation. Measure the old and the new gallery at the same time, on two virtual displays, in every round: load on a shared machine moves both by more than one fix does, and the same load cancels in the comparison. What a frame runs (passes per frame, measuring runs, runs per interaction) is asserted by count trials, not counted in the measured build.
|
||||
|
||||
## The job pool
|
||||
|
||||
cargo gives each build a jobserver with one token per core, so a build alone uses the whole machine, but several builds at once (worktrees, agents) each take every core and slow each other down. To share one job pool between them, set `CL_LAUNCHER` to a command that runs its arguments with a shared jobserver in `MAKEFLAGS` (cargo joins a jobserver it finds there). `cl` runs every cargo command through that command, in craft-libs and in every app workspace; without `CL_LAUNCHER` it runs cargo directly.
|
||||
|
||||
Test binaries take no tokens: each starts its own test threads, and screen tests a software renderer's threads as well. `cl test` therefore builds with `cargo test --no-run` through `CL_LAUNCHER` and then runs each test binary itself, as cargo would (from its package's directory, the lib's unit tests first, stopping at the first that fails), through `CL_RUNNER` when it is set: a command that limits how many test binaries run at once. `cl render` runs the story renderer through `CL_RUNNER` too. Keep the two apart: a limit held for a whole build only queues the builds behind it, and the job pool already shares the cores between builds.
|
||||
|
||||
## Build records
|
||||
|
||||
Every build `cl` composes passes cargo's `--timings`: a report per build in `<target>/cargo-timings/` (each unit's start and duration, whether it was fresh, and how many units waited for a job token; the newest 200 are kept). Every `cl` command also appends one line to `<target>/cl.log`: when it started, the command, the wall time of its build and of its test runs, the exit code and the build's report. A slow loop is read from these, not timed again: a build much longer than its report's units points at a wait before cargo started, a run much longer than the tests' own `finished in` at a wait for `CL_RUNNER`.
|
||||
|
||||
## A new worktree's first build
|
||||
|
||||
A new target directory builds the dependencies once (about 240 crates, 2–3 minutes with 16 cores) and then the framework for the first crate you work on (contract, widgets, panels, canvas, patterns, shell: another 1–2 minutes). After that, a one-line edit in a framework crate rebuilds that crate (seconds) and its test binary; a domain crate's test binary after a framework edit takes about 25 s (the chain above the edit at opt-level 0).
|
||||
File diff suppressed because it is too large.
Load diff
@@ -1,461 +0,0 @@
|
||||
# Craft suite: egui 0.37 rollout and acceptance plan
|
||||
|
||||
Status: local implementation underway, updated 2026-10-24. The reviewed local egui fork is
|
||||
`173cc7375d35dc5fbc5b5d0994fdf787f547c5d1`; the reviewed local winit fork is
|
||||
`ae48c756a3b81125eb796c0cc6dccf60990d1181`. craft-libs is reconciled on merged PR 199 and now
|
||||
records those immutable canonical sources in its manifest and lock. Its 118 craft-ui tests, strict
|
||||
package clippy, canonical source audit and formatting checks pass. Full workspace, platform/native,
|
||||
accepted comparative performance and clean post-publication remote-fetch gates are not implied.
|
||||
No push or new pull request is authorized.
|
||||
|
||||
The inventory below retains the 2026-10-22 planning snapshot and source references for provenance;
|
||||
the current repository status supersedes its old implementation/PR-conflict statements. Every
|
||||
repository has a separate `docs/egui-037-migration-plan.md`. This document defines the shared
|
||||
dependency order and acceptance contract; each repository plan supplies its actual source anchors,
|
||||
commands, fixtures and behavior-specific assertions.
|
||||
|
||||
## Scope and current dependency state
|
||||
|
||||
The inventory covers 15 applications: CADCraft, DeckCraft, DesignCraft, EffectCraft, FigCraft,
|
||||
FilmCraft, GridCraft, LightCraft, PdfCraft, PhotoCraft, SoundCraft, VectorCraft, WordCraft,
|
||||
ArtCraft Launcher (`craft-launcher`) and ArtCraft Native (`artcraft/artcraft-native`).
|
||||
It also covers `craft-libs`, `craft-ai-integrations`, `storytold/egui` and the required
|
||||
`storytold/winit` companion fork. CLI, web, headless, examples, benchmarks and nested workspaces
|
||||
that consume these libraries belong to their repository's migration.
|
||||
|
||||
The first 14 applications were present in the earlier suite audit; ArtCraft Native and
|
||||
`craft-ai-integrations/crates/ai-egui` must not be lost from the rollout. `craft-fonts` and
|
||||
`craft-i18n` are relevant data/API inputs, not egui rendering consumers in the inspected sources.
|
||||
The older `storyteller-bevy` studio and `bevy-mocap` examples use Bevy-specific integrations
|
||||
(`bevy-inspector-egui` 0.23 and 0.22); they are outside this Craft suite/fork migration. A
|
||||
future expansion to those projects needs their own Bevy compatibility plan, not a root egui override.
|
||||
|
||||
The [launcher's pinned catalog](https://github.com/storytold/craft-launcher/blob/9419d8977bc70f80373da8558356e4ba7387c7b2/crates/core/src/catalog.rs)
|
||||
enumerates the 13 creative apps above. Repository discovery also covered all 68 repositories
|
||||
returned for `storytold` (the next page was empty), with a separate code search excluding the
|
||||
19 migration repositories so one large app could not crowd out smaller consumers. Search is a
|
||||
discovery aid, not proof about unindexed code. Manifest/source inspection confirmed the additional
|
||||
ArtCraft Native and AI UI consumers. ArtCraft-X is a Tauri/Vite frontend, the repository-status
|
||||
app uses a TypeScript UI, and ArtCraft Services' inspected workspace contains service/CLI code;
|
||||
the latter's old Docker comments mentioning egui are not a dependency declaration. Asset/data
|
||||
repositories and the empty AniCraft/CraftHub repositories do not require an egui port. Re-run
|
||||
this inventory before final integration to catch newly added consumers or branches.
|
||||
|
||||
Most inspected suite roots still resolve egui 0.36.2. CADCraft at
|
||||
`1977a493c7d8340249185126744c5143f096dc86` and SoundCraft at
|
||||
`52471b37e957feaea56dfd48932ef16d314cc74a` have already bumped direct dependencies to 0.37,
|
||||
while their pinned `craft-ui` still requires 0.36. Both lockfiles therefore contain two egui versions.
|
||||
Their first deliverable is a coherent graph and preserved behavior, not another version bump.
|
||||
|
||||
The existing application code already uses the root-Ui lifecycle on 0.36.2; some web shells
|
||||
implement only `App::ui` and inherit default `logic`. Do not attribute that split to 0.37
|
||||
or rewrite it mechanically. Inspect the remaining incompatibilities and
|
||||
revalidate the lifecycle, especially hidden windows, child viewports and repeated UI passes.
|
||||
|
||||
## Pinned starting points and existing work
|
||||
|
||||
| Source | Exact reference | Use |
|
||||
|---|---|---|
|
||||
| Upstream egui 0.37.0 | `841a328ba2dd8f6996beb7189ebb7fc00e668a2a` | Release commit, not moving main or the annotated tag object |
|
||||
| Upstream egui 0.36.2 | `49682f8baa058bf49e011035cfbd6e825f88a5ef` | Stock comparison, where useful |
|
||||
| Published storytold egui | `767b1cad294120689a514bb4bd68c077e46679b9` | Existing `craft/0.36.2` patch inventory |
|
||||
| aiongg egui candidate | `a4f9a17f64a6bae61350fb85804c9df0d9865916` | `craft/0.37`; review E1–E21 before integration |
|
||||
| Published storytold winit | `ffae5198770d7730e718043f035a772b7dbc3b1b` | Existing `craft/0.30.13` behavior |
|
||||
| aiongg winit candidate | `8b35388bd719e8cc86a95971ba0bc026c9a8f058` | `craft/0.30.13-lang`; review companion patches and downstream vendors |
|
||||
| craft-libs plan baseline | `49190884278f16c9a9f5823d7698a8ffb5deb062` | Current shared-library tree used by this plan |
|
||||
| craft-libs PR 199 | `b68de8c5f4f1c060904d211a7b1320aa0f7bce78` | Existing aiongg API port; open and conflicting at inspection |
|
||||
|
||||
[PR 199](https://github.com/storytold/craft-libs/pull/199) supplies reusable API-port hunks,
|
||||
not a mergeable replacement tree. Its head `b68de8c` and historical audit tree `ec8840a`
|
||||
omit current `craft-platform` and revert security, settings, docking and printing fixes.
|
||||
Apply the port from `8614e4a04fae516fba16c22b31ff1008cb6be10b` and relevant README
|
||||
changes from `1764bca` onto current `4919088`, preserving intervening fixes and provenance.
|
||||
Re-run actual gates; neither the PR nor historical checks qualify the resulting tree.
|
||||
[Issue 198](https://github.com/storytold/craft-libs/issues/198) is a broader language-support
|
||||
proposal, not a merged dependency. Its locale/formatting roadmap is not silently included in
|
||||
this upgrade. Changes required to consume the selected fork correctly are included: remove
|
||||
double bidi processing, maintain logical text at OS/accessibility boundaries, preserve IME and
|
||||
shortcut behavior, and ensure installed/bundled font coverage under each app's asset policy.
|
||||
Do not import prohibited font assets from the proposal; existing licensing rules still apply.
|
||||
|
||||
The candidate also has a confirmed IME integration gap: winit W27 exposes outgoing
|
||||
surrounding-text support but egui-winit never sends it. Egui E21b/P7b adds the bounded
|
||||
transient payload, TextEdit producer and Wayland adapter. Word/Vector/Fig/Effect/Film/
|
||||
Design/Deck/Photo custom editors require model/preedit/byte-index adapters; this is
|
||||
part of their atomic compatibility work. Outgoing state, focus/password clearing,
|
||||
long selections and native IME evidence are explicit acceptance gates. The input-owner generation
|
||||
exists even for `Unavailable`; an empty available document is distinct. W27 must clear cached and
|
||||
protocol surrounding state at an owner/unavailable transition using a committed disable/enable
|
||||
boundary and cancel old pending preedit/commit/delete batches. Ordinary updates retain composition.
|
||||
Within a current focus epoch, mismatched text-input-v3 `done` serials still apply incoming edits
|
||||
once while deferring outgoing state until a match; old epochs cannot edit a new owner. Egui's
|
||||
latest completed pass, including `IMEOutput = None`, replaces earlier IME output. Fork P7b/W27
|
||||
own these fixes and tests before downstream compatibility PRs; see their detailed contracts.
|
||||
P7b also separates the web TextAgent DOM-position equality key from transient IME payload
|
||||
equality, testing browser composition and no extra style writes for unchanged caret geometry.
|
||||
|
||||
The winit plan must pin the candidate's full SHA and compare its tree against the published
|
||||
`craft/0.30.13`. The selected egui language APIs and winit language APIs form one compatibility
|
||||
unit. winit remains 0.30.13 and wgpu remains 30 unless a separately justified change is needed.
|
||||
|
||||
## Implementation and publication dependency order
|
||||
|
||||
1. Finish each plan, then obtain a fresh independent adversarial review of that exact document.
|
||||
Resolve concrete findings, retain the review and final document hash, and prepare documentation
|
||||
PRs. Obtain publication approval after showing the proposed branches, files and checks.
|
||||
Implementation begins after the plans land; local drafts are not described as landed.
|
||||
2. Add regression and benchmark harnesses on the recorded baseline revisions before changing
|
||||
production behavior. Record pre-existing failures separately. For CADCraft and SoundCraft,
|
||||
locate the last coherent pre-bump revision; keep both the current broken graph and the
|
||||
coherent performance baseline identified. No fabricated baseline from a failing binary.
|
||||
3. Integrate the reviewed winit patch series, new W15P PRIMARY support and tests. Integrate egui
|
||||
E1–E21 plus E21b outgoing IME state and E4/P2b PRIMARY integration in dependency order,
|
||||
including P7 held-key pairing and P7c selection-action/hidden-child fixes, then final P8;
|
||||
include only justified performance fixes. Preserve patch authorship, source links, test mappings
|
||||
and removal conditions. Publish approved dependency commits before consumers reference them.
|
||||
4. Port craft-libs using the selected PR 199 hunks, including `craft-ui`, egui-enabled
|
||||
`craft-quit`/`craft-window` and all relevant optional features. The current shared workspace
|
||||
has no binary/example targets; excluded vendor examples retain their separate disposition.
|
||||
Add narrowly justified shared helpers and their
|
||||
regressions. Port `craft-ai-egui` in parallel once its dependency contracts are fixed.
|
||||
5. Port each application in its own reviewable PR series. Atomic compatibility changes include
|
||||
manifests, lockfiles, source adaptations and harness changes; never land an intermediate
|
||||
dependency bump that leaves main unbuildable. Eleven craft-ui consumers adopt the capture
|
||||
helper from CL-1 + CL-2F in that atomic stage; DesignCraft/GridCraft explicitly pilot the
|
||||
reviewed CL-2 prototype before CL-2F. Only Deck/Fig/Art Native use local capture adapters.
|
||||
Non-capture helpers may follow separately when compatible. Required IME/bidi adapters
|
||||
belong in the first fork pin; later language-policy and expanded coverage PRs stay focused.
|
||||
6. Run per-app functional, visual, platform and performance acceptance, then a fresh independent
|
||||
adversarial implementation review at the exact candidate revision. Fix findings and re-run
|
||||
affected checks. Perform a final suite-wide dependency and capability audit before rollout.
|
||||
|
||||
Consumers can be implemented in parallel after the shared contracts stabilize, using separate
|
||||
source checkouts, build resources and test VMs. Start integration with ArtCraft Launcher plus
|
||||
CADCraft/SoundCraft to expose graph/API problems, then the office apps and complex canvas/media
|
||||
apps. This order is risk management, not permission to skip a later app or its platform checks.
|
||||
FilmCraft/EffectCraft cross-repository pins require an explicit reverse-dependency check.
|
||||
|
||||
Each push and each new PR still requires the user's explicit approval for that publication.
|
||||
Implementation authorization does not authorize pushing, merging, releasing or closing other
|
||||
contributors' issues. Public descriptions contain the problem, change and validation, without
|
||||
agent/model/tool signatures. Contributor metadata remains username-only.
|
||||
|
||||
## Dependency and vendoring acceptance
|
||||
|
||||
- Record manifests and lockfile package IDs, sources, versions, revisions and features for every
|
||||
root and nested workspace. Inspect target-specific, dev and build dependencies, not just the
|
||||
default executable. Parse `cargo metadata` and `cargo tree` under native and wasm feature sets.
|
||||
- Every selected egui family crate, including tests, renderers, `epaint_default_fonts` and
|
||||
`egui_system_font_provider` when used, must resolve from the intended immutable fork revision.
|
||||
A package version match alone is insufficient: registry and git packages have different identities.
|
||||
- Root `[patch]` sections must exist where resolution occurs; a dependency's patch section is
|
||||
ignored by its consumer. Verify fork-specific APIs under real consumer roots. Align craft-libs
|
||||
revisions wherever shared public types cross crate boundaries; do not churn unrelated pins blindly.
|
||||
- Resolve features for every accepted native/wasm/package-test root with `cargo tree -e features`.
|
||||
Egui 0.37 has no default `default_fonts`; eframe's default feature set is different. Each root
|
||||
declares its bundled/provider policy and passes a no-tofu fixture without relying on another
|
||||
workspace member's feature unification. Check clipboard, accessibility, color-font and renderer
|
||||
features explicitly. All-family source audits include optional lock-only crates such as `egui_glow`.
|
||||
- Record the full coherent version/source set in a canonical manifest and check all consumer
|
||||
roots against it in CI. Tooling must catch a missing patch, duplicate egui/winit, an old transitive
|
||||
`craft-ui`, a moving branch dependency, and a machine-local path. Test these failure cases.
|
||||
- Compare PdfCraft's vendored winit and egui-wgpu fixes against the selected fork semantically,
|
||||
including fixes added since the old audit. Transfer regression coverage before deleting only
|
||||
superseded vendors. Preserve krilla, hayro (including hayro-cmap), lopdf, vello and VectorCraft's windows-link patches unless a
|
||||
separate comparison proves a migration-related replacement. Review open Android/IME/Wayland
|
||||
vendor work as evidence; do not merge unrelated changes or close its PRs as a side effect.
|
||||
- A clean checkout must fetch every approved revision and pass `--locked` without local overrides.
|
||||
Before merge, recheck remote heads for drift and rebase/revalidate affected source and evidence.
|
||||
|
||||
The initial root-patch disposition is exhaustive for the 19 recorded roots. Nested workspaces,
|
||||
vendored manifests and command-line overrides remain separately enumerated in the static
|
||||
inventory and must be checked under their actual resolution roots:
|
||||
|
||||
| Root | Existing override | Migration disposition |
|
||||
|---|---|---|
|
||||
| DesignCraft | winit `storytold/winit@3d51077fd1a966f84df9ef287839dc84fd5b4ca7` | Replace with final reviewed W14/W15P/W27-compatible storytold revision; preserve cancelable-quit regression |
|
||||
| PdfCraft | `vendor/winit`, `vendor/egui-wgpu` 0.36.2 | Transfer all window/GPU fixes and guards centrally, prove equivalence, then remove these overrides/vendors atomically |
|
||||
| craft-libs | local krilla, hayro, hayro-interpret, hayro-syntax, hayro-jbig2 | Retain PDF/printing fixes, provenance and tests |
|
||||
| DesignCraft | krilla and four hayro packages at craft-libs `89dcbb3060377a26c99a6d80caa16084366704c4` | Retain independently of the UI pin |
|
||||
| DeckCraft, WordCraft | krilla at craft-libs `c348732…` | Retain exact existing revision from each manifest |
|
||||
| EffectCraft | hayro-syntax at craft-libs `ca50d63b773c99f96e75c77ce5a1d21e7c9cda0d` | Retain |
|
||||
| VectorCraft | hayro-syntax, hayro-interpret, hayro-jbig2, krilla at the same `ca50d63…` | Retain; also preserve Windows 7 packaging's command-line windows-link path override and its dedicated test |
|
||||
| PdfCraft | local hayro, hayro-interpret, hayro-syntax, hayro-cmap, hayro-jbig2, lopdf, vello_common | Retain unrelated PDF fixes |
|
||||
| Other 12 roots | No root patch at the recorded source | Add required immutable family/winit overrides at the actual consuming roots |
|
||||
|
||||
Candidate fork branch dependencies are research inputs; final manifests use approved reachable
|
||||
storytold revisions containing the completed series. CI checks actual package IDs, not textual
|
||||
version matches. Negative fixtures inject DesignCraft's old winit override, PdfCraft's old path
|
||||
override, a missing family patch and an unapproved moving branch; each must fail the graph gate.
|
||||
Inspect inverse trees for winit and egui-wgpu under every selected root/target/feature set.
|
||||
The canonical inventory contains all 19 sources, including ArtCraft Native, AI UI and winit;
|
||||
gate inventory/ledger source-set equality and reject missing or unreadable tracked manifests.
|
||||
The synchronized `dependency-inventory.json` at this planning workspace root and in the task's
|
||||
`ssd2/task-evidence/egui037-migration-20261022` directory contain the same 19-source inventory;
|
||||
record its hash in each gate, compare against Git's tracked manifests, and reject stale copies.
|
||||
|
||||
## Shared components: justified boundaries
|
||||
|
||||
Screenshot completion has 14 consumers: CADCraft, DeckCraft, DesignCraft, EffectCraft, FigCraft,
|
||||
FilmCraft, GridCraft, LightCraft, PdfCraft, PhotoCraft, SoundCraft, VectorCraft, WordCraft and
|
||||
ArtCraft Native. Eleven creative apps already depend on craft-ui and will adopt its new helper after CL-2F
|
||||
(the DesignCraft/GridCraft pilots first use the reviewed CL-2 prototype).
|
||||
DeckCraft, FigCraft and ArtCraft Native do not depend on it and keep small local adapters
|
||||
with the same tested contract. Exact manifest-key inspection distinguishes `craft-ui`
|
||||
from each app's own `*-ui-egui` crate name. The launcher has no screenshot consumer.
|
||||
egui 0.37 replaces screenshot input events with a one-shot callback.
|
||||
The screenshot command itself requests a hidden paint; callback arrival does not. A request
|
||||
queued in app logic but issued only in UI, including every remaining settling frame, must
|
||||
send `RequestPaintWhileHidden` to reach issuance. A wake alone may run hidden logic only.
|
||||
The callback receives only `Arc<ColorImage>` and does not schedule another repaint itself.
|
||||
See the [release callback implementation](https://github.com/emilk/egui/blob/841a328ba2dd8f6996beb7189ebb7fc00e668a2a/crates/egui/src/data/screenshot_callback.rs).
|
||||
|
||||
Keep app request IDs, output paths, serialization, timeouts, settling policy and reply schemas
|
||||
in each app. A shared mechanism may provide a bounded, cancelable per-request completion slot,
|
||||
capture correlation and viewport-aware wakeup. The callback must not encode PNGs, write files,
|
||||
run commands, hold a long lock or borrow mutable app state. After timeout/close, a late callback
|
||||
must release its image without sending another reply. Limits must bound pending images and
|
||||
requests; counter wrap and a reused viewport must not bind an old capture to a new document.
|
||||
|
||||
The selected starting design is one completion slot per admitted request, with the callback holding
|
||||
only a weak reference to that slot. Several app plans need the same one-result lifecycle, while
|
||||
their request records already own IDs, deadlines and reply routing. Keeping the slot inside that
|
||||
record gives correlation without a second global token map. Dropping/canceling the record releases
|
||||
its image; a late callback cannot retain the app or produce a file/reply. Keep any context/wakeup
|
||||
handle in the live slot, not strongly captured by a callback that may itself be queued in that
|
||||
context. Release the slot lock before waking the owning viewport. The app retains admission limits
|
||||
and must bound aggregate pending image memory, not merely the number of results in each slot.
|
||||
|
||||
The default capture admission policy is 4 pending requests, 128 MiB image bytes per request
|
||||
and 256 MiB aggregate reserved in-flight/completed bytes; apps may select stricter explicit
|
||||
limits (CADCraft uses its documented smaller budget). Use checked dimensions × 4 arithmetic,
|
||||
reject excess admission without evicting earlier requests, and measure transient readback/encoder
|
||||
RSS separately. Callback arguments contain pixels only. The default adapter records target-UI
|
||||
logical content/screen bounds and a geometry epoch at issuance, then rejects/retries any intervening
|
||||
resize/DPI/zoom/surface epoch change before save, even a change back. With an unchanged epoch,
|
||||
derive pixel scale from returned image dimensions and verify aspect/rounding. Do not assume
|
||||
Wayland `inner_rect` exists or that callback arrival supplies capture metadata. A renderer-specific
|
||||
frame annotation is an alternative only after an actual tested API is established. Distinct-image
|
||||
correlation tests manually complete callbacks in reverse order; kittest's ordinary renderer shares
|
||||
one image across callbacks, so real two-window pixels require native evidence. Before
|
||||
baselines, reconcile every app admission table to these defaults or stricter limits; no
|
||||
app silently retains 8/16 requests or larger per-image/aggregate budgets.
|
||||
|
||||
Stress concurrent captures, cancellation, shutdown, delayed GPU readback, out-of-order completion,
|
||||
memory and hidden-window wakeup. Compare a bounded nonblocking channel prototype with explicit
|
||||
overflow/error handling if these tests or measurements expose a weakness in the slot design.
|
||||
Do not encode/save images on the callback thread or add a generic UI compatibility framework.
|
||||
Applications without craft-ui need not adopt the entire crate solely for this helper. Prototype
|
||||
the shared API in CL-2, then integrate DesignCraft's multiple viewports and GridCraft's single
|
||||
window against an approved provisional revision. Review those adapters before CL-2F freezes the
|
||||
API. This is an initial topology check, not a reduction of scope: all eleven shared
|
||||
consumers and the three local adapters must pass their capture/cancel/close/DPI tests.
|
||||
|
||||
The DockArea direction policy is explicit and opt-in: custom RTL tab/control chrome,
|
||||
hit tests, drag insertion and keyboard traversal share one geometry calculation;
|
||||
serialized physical splits, rectangles and logical tab order are preserved. The
|
||||
shared-library plan defines the builder and tests. No app may reverse saved panel
|
||||
order to simulate RTL.
|
||||
|
||||
Other candidates are a tested wheel-event adapter that preserves `MouseWheelSource`, and focused
|
||||
font/direction/IME helpers with multiple named callers. Retain native widget roles/names rather
|
||||
than hiding all role changes behind `Unknown`. Existing app themes, units, document models,
|
||||
canvas engines and undo stacks remain owned by the applications.
|
||||
|
||||
## Shared regression matrix
|
||||
|
||||
| Risk | Required observable assertion |
|
||||
|---|---|
|
||||
| Callback screenshot routing | Distinct requests for two viewports receive the right pixels and exactly one reply; timeout/close/cancel prevents a late file write or reply; pending queue drains |
|
||||
| UI passes and hidden logic | A forced second UI pass does not duplicate a command/undo step; background results, autosave and media continue under logic-only iterations without replaying stale input |
|
||||
| Hidden parent and child viewports | With the parent occluded or overdue, open, update and close a child; the visible child receives content and close acknowledgement without restoring the parent |
|
||||
| Root UI and panels | Existing Ui is passed through; no recursive `root_ui` borrow; panels reserve space in order; canvas geometry, clip and hit positions agree after resizing |
|
||||
| Stable widget identity | Changing language, hiding a panel or inserting/reordering a row does not transfer focus/edit/drag state to another item; persisted workspace restores |
|
||||
| Accessibility | Named inputs expose correct roles, values, selected/disabled/focus states; hidden controls disappear; tab/arrow/Enter/Space actions trigger the same commands |
|
||||
| Fonts and text | Controlled licensed fonts cover fixture glyphs; no tofu, clipped combining marks or doubled bidi; logical clipboard/save/accessibility strings remain unchanged |
|
||||
| Selection regression | Select text, click a toolbar/context action and verify the intended selected range is used; pointer and keyboard paths agree |
|
||||
| IME/graphemes | Preedit, replacement, commit and cancel produce one intended edit/undo step; surrounding byte ranges cannot split UTF-8; emoji clusters and RTL caret/selection remain consistent |
|
||||
| Scroll and zoom | Wheel, trackpad and momentum preserve source, phase and modifiers; overscroll uses the correct clamped/unclamped coordinate for painting and hit tests; zoom stays anchored |
|
||||
| Input/native platform | Child focus/close/reopen, mixed DPI, native pickers, clipboard/PRIMARY, file drop and pen/tablet behavior are observed in real native workflows |
|
||||
| Wayland PRIMARY | Password selection is never offered; unchanged selection does not reclaim ownership; pointer- and keyboard-triggered ownership (including keyboard-only focus), fresh triggering serials per seat/origin, owner/seat changes, empty/absent offers, self-paste and slow/canceled transfers work under wlroots, KWin and Mutter with supported capabilities recorded |
|
||||
| GPU/resources | Surface limits/configuration errors do not panic; textures are updated/freed correctly after DPI/resize/device errors; color emoji and nearest/linear/wrap sampling stay correct |
|
||||
| Persistence | Edit, save, close and reopen a synthetic document plus layout; compare document meaning, selection/workspace expectations and undo semantics |
|
||||
|
||||
Use deterministic synthetic fixtures and explicitly pinned fonts/DPI/theme/viewport. Test small
|
||||
windows and 1x/1.5x/2x scaling in both themes; add RTL/CJK/combining/emoji cases where the app's
|
||||
UI or document text uses them. Keep geometry and semantic assertions alongside rendered images.
|
||||
Review each intended image change; never bulk-refresh goldens to make CI pass. Demonstrate detection
|
||||
with bounded negative controls (wrong callback/viewport association, missing accessible name, wrong clip/offset,
|
||||
dropped callback or forced duplicate command), then remove the deliberate defect.
|
||||
|
||||
Rerun's [testing guide](https://github.com/rerun-io/rerun/blob/42677ef9b096abbce742f0929dea58bb75f740ad/TESTING.md)
|
||||
provides relevant prior art: drive viewer interactions through the harness and examine image diffs.
|
||||
Apply that principle to Craft workflows; direct state setup is for fixtures, not a substitute for
|
||||
clicking the changed control. Use egui_kittest's strict missing-name and missing-glyph behavior.
|
||||
Native IME, focus, system dialogs and compositor behavior still need native evidence.
|
||||
W15/W15P use bounded asynchronous read/write transfer handles, a total monotonic deadline,
|
||||
byte/request/worker limits and cancellation. The candidate's two-second inactivity poll timeout
|
||||
is not a total deadline. Egui E4/P2b routes completions only to a live paste request with unchanged
|
||||
input owner/generation; focus changes cancel it. Test slow trickles, oversized offers, cancellation
|
||||
and concurrent peers while measuring event-loop responsiveness. Serial selection uses the actual
|
||||
triggering pointer/keyboard event and seat; no arbitrary first-seat fallback.
|
||||
|
||||
Text conformance fixtures must match the data in the selected dependencies: the candidate locks
|
||||
`unicode-bidi` 0.3.18 (Unicode 16) and `unicode-segmentation` 1.13.3 (Unicode 17). Test the fork's
|
||||
layout/editing adapters against versioned [bidi](https://www.unicode.org/reports/tr9/) and
|
||||
[grapheme](https://www.unicode.org/reports/tr29/) cases; do not silently use the latest data as the
|
||||
locked contract. For [Wayland text-input-v3](https://cgit.freedesktop.org/wayland/wayland-protocols/tree/unstable/text-input/text-input-unstable-v3.xml),
|
||||
assert the full preedit/deletion/commit sequence, valid UTF-8 byte boundaries and freshly updated
|
||||
outgoing surrounding text. Cover deletion-only batches, focus/reset/serial changes and two windows.
|
||||
A [similar Mozilla report](https://bugzilla.mozilla.org/show_bug.cgi?id=2080478) motivates the
|
||||
stale-surrounding-text case; it is not evidence that this fork has that bug.
|
||||
|
||||
## Performance protocol and stop conditions
|
||||
|
||||
Capture baseline before production edits. Rebuild baseline and candidate with the same compiler,
|
||||
profile, features, fonts, fixture, renderer/backend, driver, viewport and DPI. Record full Git and
|
||||
lockfile identities, CPU/GPU/OS, raw samples and any shared-host load. Use separate allocations,
|
||||
then alternate execution order to reduce thermal/cache bias. Never benchmark concurrently with
|
||||
builds or another noisy workload and claim a small improvement.
|
||||
|
||||
Use at least 10 warmups and 30 timed iterations for steady operations, and at least 20 fresh
|
||||
processes for startup. For frame distributions capture at least 1,000 frames and report p50/p95/p99;
|
||||
do not claim a reliable p99 from 30 samples. Report median/p95 for discrete operations with the
|
||||
sample count, a paired confidence interval where suitable, peak RSS, allocations/texture uploads,
|
||||
idle CPU/repaint count, and cold versus warm caches separately. Preserve startup/font-provider
|
||||
timings and raw/compressed WASM sizes. Software renderers and real GPUs are separate results.
|
||||
|
||||
Preliminary gates, to be frozen in baseline reports before candidates are measured: investigate
|
||||
a repeatable >5% median or >10% p95 latency regression, >5% peak-RSS increase, any new idle
|
||||
busy-loop or audio underrun, and any loss of the app's existing absolute performance budget.
|
||||
For sub-millisecond measurements require the relative increase also exceed 0.05 ms or corroborate
|
||||
it with stable instruction/allocation counts. Reject noisy comparisons as inconclusive and rerun;
|
||||
do not expand tolerances after seeing a failure. Any exception needs a documented tradeoff and
|
||||
review before acceptance. Existing stricter repository budgets win.
|
||||
|
||||
These sample counts are minimums and the investigation thresholds are maximum tolerances across
|
||||
the suite: an app may tighten them, never silently loosen them. Any proposed exception must be
|
||||
documented and approved before candidate measurements; an exploratory small sample is not tail
|
||||
acceptance. Reconcile every app's table against this contract before baseline capture. In
|
||||
particular, the earlier FilmCraft five-warmup, EffectCraft three-warmup/relaxed startup and winit
|
||||
three-warmup proposals are superseded: use the shared floor and investigate at the shared latency
|
||||
thresholds unless an explicit pre-measurement exception has been approved. FilmCraft’s old
|
||||
absolute +20 ms startup allowance is also superseded by the shared relative thresholds.
|
||||
|
||||
The first baseline report and every investigated regression include an equivalent stock-0.37
|
||||
control alongside 0.36 and the selected fork. Fork-only app code need not compile unchanged on
|
||||
stock: use the same operation in a pinned minimal adapter/harness and explain any remaining
|
||||
semantic differences. Record all three source/lock identities; unavailable equivalence remains
|
||||
an attribution limitation, not evidence that an upstream regression is unavoidable.
|
||||
|
||||
App plans select meaningful workloads: canvas pan/zoom/selection and text editing; spreadsheet
|
||||
scroll/recalculation; timeline scrub/playback and waveform updates; slide transition/presenter
|
||||
windows; thumbnail grids and RAW previews; PDF page navigation/annotations/search; launcher catalog
|
||||
and download progress; AI job history/progress. Include idle and first-use paths, not just engine
|
||||
CLI throughput. Rendering hashes and document state must remain correct during measurement.
|
||||
|
||||
Three upstream reports require targeted reproduction on our own fixtures and environments:
|
||||
|
||||
- [#8731](https://github.com/emilk/egui/issues/8731): plain-text tessellation regression associated
|
||||
with color-glyph handling. Compare unchanged 0.36, stock 0.37 and selected fork. If confirmed,
|
||||
evaluate a row-level fast path and cached color-glyph metadata while testing mixed/color rows.
|
||||
- [#8736](https://github.com/emilk/egui/issues/8736): DX12 FXC shader compilation cost even when
|
||||
predictable filtering is disabled. Measure renderer construction separately from first frame.
|
||||
Compare an override-constant design with semantically equivalent wrap arithmetic only if needed;
|
||||
clamp-only output is not a valid fix for Repeat/MirroredRepeat.
|
||||
- [#8512](https://github.com/emilk/egui/pull/8512): a system-font startup-cost report in the
|
||||
discussion. Measure discovery separately, preserve glyph coverage, and compare current app
|
||||
loaders with explicitly configured system providers before enabling a new default everywhere.
|
||||
|
||||
These are external reports, not reproduced measurements or promises of a speedup.
|
||||
|
||||
Known functional reports also require explicit decisions before the fork is frozen:
|
||||
|
||||
- [#8763](https://github.com/emilk/egui/issues/8763) and unmerged
|
||||
[#8764](https://github.com/emilk/egui/pull/8764): reproduce selection loss when clicking an
|
||||
outside toolbar/context action. The fork owns the selected fix, with pointer and keyboard
|
||||
regressions proving that the intended range reaches the action in that pass. A necessary app
|
||||
workaround must preserve the range and undo semantics and have its own removal condition.
|
||||
- [#8748](https://github.com/emilk/egui/pull/8748) is closed and unmerged, not behavior in the
|
||||
selected release. The fork owns a tested hidden-parent/deferred-child solution; exercise
|
||||
overdue redraw with unknown visibility as well as actual occlusion/minimization. Do not infer
|
||||
phase from `visible()`, or describe ordinary logic-only calls as full UI passes.
|
||||
- [#8657](https://github.com/emilk/egui/issues/8657) and
|
||||
[#8428](https://github.com/emilk/egui/pull/8428) inform the clipboard/PRIMARY matrix;
|
||||
[#8577](https://github.com/emilk/egui/pull/8577) informs logical-text/bidi regressions.
|
||||
Their status is evidence to inspect, not permission to assume a reported behavior is fixed.
|
||||
|
||||
For a reproduced required workflow failure, a reviewed fork fix or tested app workaround is
|
||||
required. An explicit deferral records an unresolved rollout gate; it is not a passing result.
|
||||
|
||||
## Platform evidence, review and rollback
|
||||
|
||||
Each app's required gates include its existing fmt/lints/tests/assets/layers/wasm commands plus
|
||||
selected feature checks that default CI misses. Record actual selected test counts and failures.
|
||||
Linux covers native X11 and Wayland with compositor identity; Windows uses a uniquely owned
|
||||
baseline clone and visible edited/saved/reopened workflows. Browser workflows must run, not merely
|
||||
compile to wasm. macOS IME, Metal/GL, keyboard layouts and native termination need real macOS
|
||||
evidence; cross-compilation is not acceptance. FreeBSD/Android rows follow the app's support claims.
|
||||
Unavailable environments remain explicit rollout blockers, not implicit passes.
|
||||
|
||||
Current readiness and allocation plan (recheck immediately before each wave):
|
||||
|
||||
| Wave/environment | Current evidence | Required preparation and capacity gate |
|
||||
|---|---|---|
|
||||
| Static planning | 19 owned checkouts; no tests/builds run | No build reservation needed; preserve review artifacts |
|
||||
| Shared/fork CPU and headless regressions | No qualified runtime yet | Estimate one baseline/candidate build's growth from dependencies, reserve through task.py, execute sequentially and preserve paired binaries; defaults do not fit current capacity |
|
||||
| Linux X11 | No inherited DISPLAY; Xvfb/window manager absent at inspection | Provision an isolated display/window manager, record versions and qualify native focus/clipboard; label virtual-display/software results accurately |
|
||||
| Linux Wayland | No inherited WAYLAND_DISPLAY; Weston/Sway/KWin absent | Provision the compositor/input-method environments required by the matrix; qualify keyboard/IME/PRIMARY protocol behavior and identify unsupported capabilities |
|
||||
| Linux GPU | Parent can access i915 8086:3E96 renderD128; worker sandbox may hide it | Managed renderer/device probe must identify actual driver/backend; access alone is not GPU acceptance |
|
||||
| Windows | Sealed baseline uses Basic Render Driver; 128 GiB default clone cannot currently fit | Estimate guest source/build/evidence growth; allocate a unique full clone if capacity permits or a baseline-backed overlay with an adequate reservation (at least 10 GiB); otherwise block this wave |
|
||||
| Browser | Wasm compile is not runtime evidence | Provision/pin browser and WebGPU/WebGL backend; run interactive fixtures and record browser/adapter identity |
|
||||
| macOS and physical Windows/audio | No qualified environment in this task | Obtain real platform access and owned execution/evidence before those gates pass; software VM results do not qualify these rows |
|
||||
|
||||
The allocator snapshot had about 23.6 GiB and 37.7 GiB allocatable on the two separate drives;
|
||||
they cannot be combined for one target. Overlay creation is already authorized by the standing
|
||||
workflow; its budget must cover expected growth, not merely the minimum. Per-wave reservations
|
||||
are set from that estimate and current capacity before submission. Do not invent a fixed small
|
||||
budget now to claim all platform gates are ready.
|
||||
|
||||
All new host tests/builds and owned-VM commands use the managed run/status/finish workflow.
|
||||
Keep exact source, evidence and resource identities; export logs, screenshots, fixtures, hashes,
|
||||
source patches and deliverables before cleanup. No existing job/VM is adopted or stopped.
|
||||
|
||||
Schedule builds and VMs from current allocator capacity, not from the number of available review
|
||||
workers. At planning inspection, both drives together had less than one default 64 GiB host-build
|
||||
reservation available after existing reservations. Before each validation wave, inspect capacity
|
||||
and budget each owned task from its expected growth; do not lower an estimate simply to pass the
|
||||
guard. Start only the workloads that fit, retain paired baseline/candidate executables outside
|
||||
disposable targets, and finish a resource only after its required reviews and evidence are complete.
|
||||
Use a smaller reservation only for a demonstrably smaller workload. Resize before substantial
|
||||
growth. If a required build or clone cannot fit, preserve its records and report the capacity gate;
|
||||
do not reclaim another task, move an active allocation or bypass the allocator. Keep performance
|
||||
measurement sequential even when correctness builds can safely run concurrently.
|
||||
|
||||
Every plan and every implementation gets a new independent reviewer with a bounded assignment.
|
||||
Reviewers inspect source, tests, dependency identities and negative cases; a passing build or an
|
||||
author's own checklist is insufficient. Track finding, severity, evidence, resolution, recheck and
|
||||
reviewed hash. No unresolved correctness finding is silently downgraded to a future task.
|
||||
|
||||
The authoritative ledger records all 19 repository plans plus this suite document separately:
|
||||
current hash, review-request ID, reviewed hash, verdict, finding resolutions and fresh closure
|
||||
review. Preserve earlier drafts and reports. A changed document invalidates its earlier approval;
|
||||
implementation remains blocked until all 20 current documents have accepted reviews and their
|
||||
documentation PRs have landed. The evidence copy of the ledger is a synchronized snapshot.
|
||||
|
||||
Rollback restores the entire previous coherent manifests/lockfiles/source set, not just an egui
|
||||
version string. Keep prior dependency revisions reachable. Avoid persistence format changes for
|
||||
this upgrade; if one is necessary, specify backward compatibility and preserve unreadable data.
|
||||
Do not release a mixed suite dependency graph or delete old source/evidence during cache cleanup.
|
||||
At each dependency/app integration stage, rehearse restoration of the previous coherent source,
|
||||
lockfiles and settings using preserved source refs and the baseline executable. Reopen the saved
|
||||
fixture and verify the old behavior before accepting the stage. If rebuilding is necessary, use
|
||||
a separate managed allocation. Keep the old executable/source identities reachable through the
|
||||
rollback window; restoring only an old lockfile does not constitute the rehearsal.
|
||||
|
||||
|
||||
## Local implementation clarification — 2026-10-23
|
||||
|
||||
The user explicitly corrected the publication-first workflow: all reviewed plans stay local while implementation proceeds. Published dependency reachability remains a release requirement, not a condition for local prototypes, source ports, tests or reviews. Local development may use isolated candidate worktrees and explicit local Cargo patches; no machine-local path enters a publication draft.
|
||||
|
||||
Canonical integration sources were refreshed for all19 repositories; sixteen advanced by220 commits in total. See the task evidence `REMOTE-REFRESH-SUMMARY.json`, canonical ref/diff snapshots and the per-repository local-update appendices. Keep the original review source refs for historical comparison. Current-main paired measurements must use refreshed integration sources so unrelated security/performance work is not attributed to the toolkit migration.
|
||||
@@ -0,0 +1,308 @@
|
||||
# Glossary
|
||||
|
||||
One row per name in the author table (Overview) and per `pub` item a component author touches (`contract`, `style`, `primitives`, the `Cx` traits and their re-exports). "Lives in" is the defining module by its path under the `craft_ui` facade, which re-exports each library crate's modules under the same name ([craft-framework.md 3.2](craft-framework.md#32-the-ui-library-crates)); a re-exported item has one row, under its defining module. "Defined in" names the section of the framework specification that defines the term; the specification is not part of this repository.
|
||||
|
||||
| Term | What it is | Lives in | Defined in |
|
||||
|---|---|---|---|
|
||||
| `Access` | The builder a component's `access` hook fills | `craft_ui::runtime::access` | 12.1 |
|
||||
| `Accessible` | The `Cx` trait for `announce` and `field_label` | `craft_ui::contract` | 1.5, 12 |
|
||||
| `AccessRequest` | An AccessKit action that arrives as `Intent::Access` | craft-behavior | 9.2 |
|
||||
| Active part | The part of a focused component that has focus, held by the runtime focus service | `craft_ui::runtime::focus` | 1.7 |
|
||||
| `Animate` | The motion trait on every context | `craft_ui::runtime::motion` | 13.1 |
|
||||
| App layer | Layer 8, in app repos only | each app repo | Overview |
|
||||
| App-modal | The rule for `Rank::Modal` layers | `craft_ui::runtime` (layer stack) | 15.5 |
|
||||
| `AppSizes`, `sizes.json` | An app's overrides of library base sizes | craft-theme | 4.6 |
|
||||
| `AppValues` | The private set of app values a root, a scope or a component's `content_env` sets with `set::<T>(v)` | `craft_ui::runtime::env` | 2.2 |
|
||||
| Arena | The set of shapes one press is resolved among | `craft_ui::primitives` (the registration store and the sensing core; the resolve rule is a craft-behavior pure function; `ArenaId` in `craft_ui::runtime::env`) | 8.3 |
|
||||
| Arena member | A component that joins the innermost `Env.arena` because it is neither an arena root nor a text or editor leaf | `craft_ui::contract` | 8.3 |
|
||||
| Arena root | A container with `ContainerProps.arena`, or any collection | `craft_ui::contract` | 8.3 |
|
||||
| `ArenaId` | The id of an arena, carried in `Env.arena` | `craft_ui::runtime::env` | 8.3 |
|
||||
| `Backdrop` | A modal's scrim (`None`, `Scrim`), carried by `Rank::Modal` | `craft_ui::runtime` (layer stack) | 15.2 |
|
||||
| `Bind<T>` | The one value binding | `craft_ui::contract` | 10.2 |
|
||||
| `BindMut<T>` | A reborrowed `Bind<T>` that `bind()`, `open()`, `scroll()` and `selection()` return | `craft_ui::contract` | 10.2 |
|
||||
| Body | The caller's closure that a container shows, its one caller region | — | 16.3 |
|
||||
| `BarItems`, `BarItem` | A leaf inside a `Bar`'s body that shows command items in a strip and overflows them by `fit` into a menu of command rows | the bar family | 20.3 |
|
||||
| `BodyCx` | The non-generic context a body closure, header, footer or empty hook and popup content receive, as `&mut` | `craft_ui::contract` | 1.5 |
|
||||
| `BodyLayout`, `RowAlign` | How the body step lays out a body (`ContainerProps.layout`) | `craft_ui::layout` | 6.3, 16.2 |
|
||||
| `CancelReason` | Why a gesture or press was cancelled (`Refused`, `Dismissed`, `HostChanged`, `UndoDuringGesture`, ...) | craft-behavior | 10.2 |
|
||||
| `cancel_all` | `runtime::edit::cancel_all(ctx, reason)`: cancels every running gesture; the app's undo and redo call it first | `craft_ui::runtime::edit` | 10.3 |
|
||||
| `propose_with`, `gesture_note` | `cx.propose_with(value, note)` proposes like `propose` and, when the component takes the proposal, sets a typed note on the running gesture; `runtime::edit::gesture_note::<V, N>(ctx, id)` reads that note from outside the component's pass (`None` while no gesture runs) and the note goes when the gesture ends | `craft_ui::contract`, `craft_ui::runtime::edit` | 10.3 |
|
||||
| Canvas control | A leaf a `Canvas` body shows, declared with `#[component(canvas_control)]` | the component's family | 8.3, 20.6 |
|
||||
| Command form | A canvas tool's keyboard path | the tool's crate | 8.3 |
|
||||
| `CanvasTransform` | The transform a canvas body is shown through, from `ContainerProps.transform` | craft-behavior | 8.3 |
|
||||
| `CellSelection` | The sheet's selection model | craft-behavior | 17.7 |
|
||||
| `Chord` | A key with modifiers, the one shortcut type, shown with `ChordText` | craft-keymap | 11.1 |
|
||||
| `ClipboardHandle`, `ClipItem` | The handle `cx.clipboard()` returns over `craft_platform::clipboard` | `craft_ui::runtime::commands` | 11.3 |
|
||||
| `Codec` library codecs | `PlainText` and `NumberCodec` beside `Codec` and `quantity::Reader` (craft-behavior); `HexCodec`, `DateCodec` and the text fields' other codecs in craft-ui | craft-behavior, craft-ui | 18.3 |
|
||||
| Collection | A component that also implements `Collection` | `craft_ui::contract` | 1.3, 17 |
|
||||
| `CollectionEvent`, `ColumnEvent` | The events a collection reports, and its column events | `craft_ui::contract` | 17.1, 17.6 |
|
||||
| `CollectionProps` | A collection's plain data | `craft_ui::contract` | 17.1 |
|
||||
| `CollectionResponse` | A collection's output | `craft_ui::contract` | 17.6 |
|
||||
| Column, `ColumnSpec` | A `ColumnSpec` in `CollectionProps.columns` | `craft_ui::contract` | 17.1 |
|
||||
| `ColumnGroup` | Rows that are not one `Grid` (`Field` rows) sharing the widest label per column key, by the same function as a `Grid` `Content` column. A field's control keeps its own labels and shares the group's other columns: content-sized number fields line up their values and units across the group | `craft_ui::layout` | 6.3 |
|
||||
| `ColumnWidth`, `ColumnKey` | A column's width rule | craft-behavior | 17.1, 6.3 |
|
||||
| Command scope | A `CommandScope`, live while a container declaring it is live | craft-keymap | 11.3 |
|
||||
| `CommandRef`, `CommandKind`, `ModalRule` | A command's id, its kind (`Command`, `Toggle`, `Radio`, `Tool`, `Momentary`) and whether it fires while a dialog is open | craft-keymap | 11.2 |
|
||||
| `Board::bound_around` | The command of a set that a chord runs on a canvas inside a command chain, through the keymap and the scopes the window's keys match in; the tool host uses it so a key that automation holds starts the momentary tool the real key starts | `craft_ui::runtime::commands` | 11.2 |
|
||||
| `ToolInput::hold`, `ToolInput::let_go` | Injected tool inputs for a key going down and coming up again with no key event: the window host holds the key from the pass of the hold to the pass of the release, so a held Space pans a press the way the real key does | `craft_ui_canvas::canvas::tool_host` | 8.3 |
|
||||
| `Frames::over` | A frame driver over a given `egui::Context` (`Frames::new` makes its own), for tests that run the app's own context | `craft_ui::testing` | 22.4 |
|
||||
| `CommandGate` | The one gate that can disable commands (dialog open, workspace, recorder, pending operation) | `craft_ui::runtime::commands` | 11.3 |
|
||||
| `Commands` | The context trait on `Cx`, `BodyCx` and `ItemCx` for commands and the clipboard | `craft_ui::runtime::commands` | 11.3 |
|
||||
| `CommandSet` | A typed set of commands with one scope, written by `#[derive(CommandSet)]` and read with `take_command::<S>()` | craft-keymap (trait), `craft_ui::runtime::commands` (board) | 11.2, 11.3 |
|
||||
| `CommandState`, `CommandStates`, `CommandInput` | A command's state, the app-scope states an app holds in a `Tracked`, and the frame's command input in `FrameInput.commands` | `craft_ui::runtime::commands` | 11.3 |
|
||||
| `Common` | The props every component has, with no public fields | `craft_ui::contract` | 3.1 |
|
||||
| Component | Any type implementing the core trait | `craft_ui::contract` | 1.2 |
|
||||
| `ComponentStyle` | The trait every `type Style` implements, usually with `#[derive(ComponentStyle)]` | `craft_ui::style` | 4.3 |
|
||||
| `ContainerProps` | The plain-data props of containers and collections | `craft_ui::contract` | 16.2 |
|
||||
| Content painter | A `ContentPainter` type that paints document content with a raw painter | `craft_ui::contract` (trait) | 5.4 |
|
||||
| Container | A component that also implements `Container` | — | 1.3, 16 |
|
||||
| `ContentPainterCx` | What `PaintUi::content_painter(cx)` returns | `craft_ui::primitives` | 5.3, 5.4 |
|
||||
| Content step | Step 14 | `craft_ui::contract` | 1.6 |
|
||||
| `content_env` | The `Component` hook, run once at step 13, that sets app values for content the component does not build, its body or items | `Component` method | 2.2 |
|
||||
| `ControlMetrics` | Height, icon, horizontal padding and gap per `ControlSize`, read from a craft-theme `BySize` table to build `Metrics` | craft-behavior | 4.3 |
|
||||
| `ControlSize` | The control size scale `BySize` tables are read by | craft-theme | Overview, 2.1 |
|
||||
| `Corners` | Which corners of a surface are rounded | `craft_ui::style` | 4.3 |
|
||||
| `runtime::cursor` | The cursor service: it picks the winning cursor request in the end hook and records it as data | `craft_ui::runtime` | 8.5 |
|
||||
| `Cursor`, `PaintedCursor`, `CursorBadge`, `CursorPriority` | A cursor request (system or painted), a painted cursor's shape, its badge, and the request's priority | craft-behavior | 8.5 |
|
||||
| `CustomVariant` | A `const` variant built for one component's `StyleKey` with a crate-prefixed id and a look function over semantic tokens | craft-theme | 4.4 |
|
||||
| `CxCore`, `Cx` | The per-show interaction context | `craft_ui::contract` | 1.5 |
|
||||
| `DataColor` | A colour from data (a swatch, a label dot), the one colour `Draw` accepts besides `StyleColor` | `craft_ui::style` | 4.3 |
|
||||
| Decision record | The record each step writes about why it decided what it did, read by `runtime::inspect` | `craft_ui::runtime::inspect` | 1.7 |
|
||||
| Decorator | A container whose body shows the decorated component (a badge, an attention dot) | component families | 16.1 |
|
||||
| Dense item | An ordinary item with many parts (a sheet row, a timeline track) | — | 17.2 |
|
||||
| `Dismiss` | An egui layer's dismissal rules, in `Overlay.dismiss` | `craft_ui::contract` | 15.4 |
|
||||
| `DocKey` | A stable, crate-prefixed semantic key for presence, automation, undo names and programmatic focus | craft-behavior (re-exported by craft-ui) | 3.1 |
|
||||
| `Direction`, `Scale` | The layout direction (left-to-right or right-to-left) and the interface scale, inherited through `Env` | craft-i18n, `craft_ui::runtime::env` | 2.1 |
|
||||
| `DocText`, `DocRun`, `FontRef` | Document text a content painter lays out with `ContentPainterCx::layout` | `craft_ui::primitives`, `craft_ui::fonts` | 5.4 |
|
||||
| `DragPreview` | What the overlay host paints under a drag | `craft_ui::runtime` (drag session) | 8.4 |
|
||||
| `Draw` | The content-paint API `PaintUi::draw` gives | `craft_ui::primitives` | 5.3 |
|
||||
| `DropOperation` | A drop's operation | craft-behavior | 8.4 |
|
||||
| `DropTarget<P>`, `DropMark` | A drop target registered with `cx.drop_target(&target)` | `craft_ui::runtime` (drag session) | 8.4 |
|
||||
| `Edit` | The value trait on `Cx` | `craft_ui::contract` | 10.2 |
|
||||
| `EditHistory<T>` | A local undo history for dialogs, tool sessions and the keymap editor, fed by `EditEvent`s | craft-behavior | 10.5 |
|
||||
| `EditEvent`, `EditResponse` | The value events a value component emits, and the output that carries one per pass | craft-behavior (`EditEvent`), `craft_ui::contract` (`EditResponse`) | 10.2 |
|
||||
| `EditCommand` | An edit command delivered as `Intent::Edit` or `EditorInput::Edit` | craft-behavior | 9.2, 11.3 |
|
||||
| `EditKind` | The kind of an edit event a story recorded | `craft_ui::testing` | 22.4 |
|
||||
| `EditorInput`, `EditorState` | The input stream an own-caret editor reads, and the state it reports (with `can_undo` and `can_redo`) | craft-behavior (`EditorInput`), `craft_ui::primitives` (`EditorState`) | 18.4 |
|
||||
| `EditorLine`, `EditorPurpose` | One visible line an editor reports, and the editor part's purpose | `craft_ui::primitives` | 18.4 |
|
||||
| `EditorRun`, `LayoutRun` | One bidi run of a line | `craft_ui::primitives` | 18.4 |
|
||||
| `EditPolicy` | When a write-through source is written | craft-behavior | 10.2 |
|
||||
| egui layer | An egui `LayerId` | egui | 15.2 |
|
||||
| egui options the runtime owns | The table of egui options and calls only the runtime sets | `craft_ui::runtime::egui` | 1.8 |
|
||||
| `Emphasis` | The emphasis axis of a variant | craft-theme | 4.4 |
|
||||
| `Env` | The inherited context of a `Ui` | `craft_ui::runtime::env` | 2.1 |
|
||||
| Env scope | A stretch of code with changed inherited values, from `with_env(ui, set, body)` and `Overrides` | `craft_ui::runtime::env` | 2.3 |
|
||||
| `EnvKey` | The key of everything a style depends on besides its own key | `craft_ui::style` | 4.5 |
|
||||
| `EnvValue`, `StyleValue` | An app-defined value inherited down the tree like the library's own | `craft_ui::runtime::env` | 2.2 |
|
||||
| `EnvView` | The view of `Env` that component code reads | `craft_ui::runtime::env` | 2.1 |
|
||||
| Face | An instance of a component painted by another component's `paint` as the look of one of its parts, with `PaintUi::face` | — | 5.3, 20.1 |
|
||||
| Field container | `Field` | `craft_ui` form family | 20.1, 20.3 |
|
||||
| `Help`, `LabelKind`, `FieldLayout` | A field's help text, its label's kind and its layout | `craft_ui` form family | 20.3 |
|
||||
| `Fired`, `FireSource`, `FirePhase` | One fired command in the queue | `craft_ui::runtime::commands` | 11.3 |
|
||||
| `Flags` | Value-driven and interaction flags, merged at step 12 | craft-theme | 4.1 |
|
||||
| `Flow` | Start and end geometry resolved once for the layout direction | craft-behavior | 6.2 |
|
||||
| `Focus` | The `Cx` trait for `intents`, `claim`, `take_claimed`, `active_part`, `is_focused`, `focus_visible` and `reveal` | `craft_ui::contract` | 1.5, 9 |
|
||||
| Focus on press | Which presses move key focus | `craft_ui::runtime::focus` | 8.3 |
|
||||
| Commit now | The mark the focus service sets at H7 on a focused text part with a draft when a press lands elsewhere, so the draft commits in the press pass | `craft_ui::runtime::focus` | 8.3 |
|
||||
| Focus scope | A part of the UI with a `FocusPolicy` | `craft_ui::runtime::focus` | 9.4 |
|
||||
| `FocusLook`, `IconLook`, `SurfaceLook`, `TextLook` | The style parts a `*Style` struct holds for the focus ring, icons, the surface and text | `craft_ui::style` | 4.3 |
|
||||
| `FocusPolicy` | A focus scope's rules | `craft_ui::runtime::focus` | 9.4 |
|
||||
| `FocusTarget` | What `runtime::focus::request` focuses | `craft_ui::runtime::focus` | 9.4 |
|
||||
| `FrameInput`, `FrameOutput` | What an app sets before each pass and drains after it | `craft_ui::runtime::frame` | 1.8 |
|
||||
| `InstallSpec` | What `install` takes: shell info, the window system, style replacements and the ghost-layer painter (`frame_layers`) | `craft_ui::runtime` | 1.8 |
|
||||
| `install` | The install entry apps and the fixture call: fills `InstallSpec.frame_layers` and calls `runtime::install` | `craft_ui` | 1.8 |
|
||||
| `paint_frame_layers` | Paints the ghost egui layer (drag preview, drop mark, painted cursor) once per pass from the end hook | `craft_ui::contract::overlay` | 15.1 |
|
||||
| `Gap` | A body's item spacing token, `ContainerProps.body_gap` | `craft_ui::contract` | 16.2 |
|
||||
| Gate | A container's `bool` view of its shown value that enables or disables its body, edited through `BodyCx::gate()` | — | 10.4 |
|
||||
| `Facts<T>` | Cross-widget facts registered in one pass and read in the next | `craft_ui::runtime::memory` | 7.2 |
|
||||
| `Gesture`, `GesturePhase`, `GestureId` | The pipeline-owned edit in progress, its phase this frame, and its id | craft-behavior | 8.2, 10 |
|
||||
| `GridView`, `GridSection` | A sheet layout's column sections (one per frozen area, rects relative to the viewport) given to each row through `ItemCx::grid()` | craft-behavior | 17.7 |
|
||||
| Group form | A container and arena root whose members, placed anywhere in its body, join its arena and register with its `GroupHandle` | `craft_ui::contract` (handle), component families | 20.3 |
|
||||
| Group's pick | The member a group form selects at step 9, from `cx.activated_member()` | — | 20.3 |
|
||||
| `GroupHandle<G>` | A group form's handle, put into its body's env with `content_env` | `craft_ui::contract` | 20.3 |
|
||||
| `GroupKind` | The kind of a group form (radio, chip), naming its member value type | `craft_ui::contract` | 20.3 |
|
||||
| Header and footer regions | Areas the body step lays out from `ContainerProps.header` and `footer`, filled by `Container::header` and `footer` | `craft_ui::contract` | 16.3 |
|
||||
| `HeaderRegion`, `FooterRegion` | The header and footer regions in `ContainerProps` | `craft_ui::contract` | 16.2 |
|
||||
| `HitShape`, `HitLevel`, `HitPriority` | A part's hit and paint shape, its level, and its level with a sub-level | craft-behavior | 8.3 |
|
||||
| Hook steps H0 to H8 | The numbered input-hook and begin-hook steps of the frame loop, beside the end hook | `craft_ui::runtime` | 1.8 |
|
||||
| Host `Ui` | The `Ui` a mount gives a container (the parent's, an egui Area's, a viewport's child root) | — | 1.6 |
|
||||
| `IconId` | An SVG-set or tool icon's egui-free key, its name | craft-behavior | 5.2 |
|
||||
| `IconSpec` | An icon to paint | `craft_ui::primitives` | 5.2 |
|
||||
| `IdSource` | Where an id comes from | `craft_ui::contract` | 7.1 |
|
||||
| `ImeSurface` | The public editor contract for components that draw their own caret | `craft_ui::primitives` | 18.4 |
|
||||
| Inherited and layer-local env | The two groups of `Scoped` | `craft_ui::runtime::env` | 2.1, 2.3 |
|
||||
| `Ink` | The text and icon colour that reads on a surface, resolved at step 12 | `craft_ui::style` | 5.1 |
|
||||
| `Inner` | A container's show output | `craft_ui::contract` | 1.1 |
|
||||
| `Input` | How input reaches a component | craft-behavior | 1.1 |
|
||||
| `Insets` | Start, end, top and bottom distances, mirrored by `Flow` | craft-behavior | 6.2 |
|
||||
| `Intent` | A key, AccessKit action or typed text turned into meaning | craft-behavior | 9.2 |
|
||||
| `Intent::MoveItem` | A stacking key (Cmd+] or Cmd+[, Shift to the ends) on a reorderable collection: moves its selected items | craft-behavior | 9.2, 17.3 |
|
||||
| `Intent::Open` | Opens a `Trigger::Hold` or dropdown opener | craft-behavior | 9.2, 15.5 |
|
||||
| `Intents` | The owned copy of the intents routed to one id this pass, read with `cx.intents()` and its `take_*` calls | `craft_ui::runtime::keys` | 9.2 |
|
||||
| `Internal` | A token only craft-ui can build, taken by the derive-written accessors | `craft_ui::contract` | 1.1 |
|
||||
| `Interpolate`, `Tween`, `Presence`, `MotionSpec` | An animatable value, a running tween, an open-close presence, and a motion constant | `craft_ui::runtime` (motion service) | 13.1 |
|
||||
| Item step | The collection's content step | `craft_ui::contract` | 17.3 |
|
||||
| `item_layout` | The `Collection` hook that builds this frame's `ItemLayout` from the source, width and `StyleCx` | `Collection` method | 1.3, 17.3 |
|
||||
| `ItemCx` | The context of the item closure, `ItemCx<'a, 'r, K>` | `craft_ui::contract` | 1.5, 17.2 |
|
||||
| `ItemLayout` | A collection's geometry, logical (x from the start edge), relative to the viewport and computed in f64 inside; the item step mirrors it unless `mirrors()` is false | craft-behavior | 17.4 |
|
||||
| `ItemOutput` | The trait an item's `Output` implements, converting it into `Option<ItemEvent>` | `craft_ui::contract` | 17.1 |
|
||||
| `DisplayOrder` | The source trait: keys, depth, open state and text in display order | craft-behavior | 17.2 |
|
||||
| `ItemSource` | The source a collection shows | craft-behavior | 17.2 |
|
||||
| `SizeHint` | An item's size hint from its source | craft-behavior | 17.2 |
|
||||
| `Key`, `Mods`, `KeyInput` | Craft-keymap's key types | craft-keymap | 9.2, 11.1 |
|
||||
| `KeyUse` | A component's declared keys | `craft_ui::runtime::focus` | 9.3 |
|
||||
| Key table, `KeyRole` | The one table per OS that maps keys and modifiers to intents and `MoveMods`, as the pure function `keys::intent(os, key, mods, role)` | craft-behavior | 9.2 |
|
||||
| `craft_keymap::layout` | The keyboard-layout rule for shortcut matching and key labels, used by the dispatcher, the key table and `ChordText` | craft-keymap | 11.1 |
|
||||
| `Label` | Given or library text | `craft_ui::runtime::env` | 19.2 |
|
||||
| Label scope | The scope a container with a side label opens for the controls inside; a control reads the label's `FieldLabel` (id, rect, press state, text) with `cx.field_label()` | `craft_ui::runtime::access` | 12.4 |
|
||||
| Label step | Body sub-step B2, run for every container with a side label and by `PaintUi::labelled` | `craft_ui::contract` | 16.3 |
|
||||
| Layer | One of the architecture layers 0 to 8 | — | Overview |
|
||||
| Layer stack | The runtime's per-viewport record of shown egui layers and their order | `craft_ui::runtime` | 15.2 |
|
||||
| `Arrangement`, `arrange` | A logical custom placement for a body's keyed children, and the function that measures, mirrors (unless `mirrors()` is false) and shows them once | craft-behavior (`Arrangement`), `craft_ui::layout` (`arrange`) | 6.3 |
|
||||
| `runtime::layout_memory` | Values measured in one pass and read in the next, with size tweens and the tolerance rule for discard passes | `craft_ui::runtime` | 6.3 |
|
||||
| Leaf | A component with neither body nor items | — | 1.1 |
|
||||
| Lifetime | How long a memory slot lives | `craft_ui::runtime::memory` | 7.2 |
|
||||
| Lock rule | No app-supplied code runs while a runtime or context lock is held | `craft_ui::runtime` | 7.2 |
|
||||
| `Looks` | The app's style replacements (`Looks::style`), passed to `install` and frozen | `craft_ui::contract` | 4.4 |
|
||||
| `MAX_EXTENT` | The largest side a component may allocate, 32,768 points | `craft_ui::contract` | 1.3 |
|
||||
| `MeasureCx` | What `measure` gets | `craft_ui::contract` | 6.2 |
|
||||
| Memory stage | The pipeline-owned set of a component's memory slots, moved in at step 3 and back after `finish` | `craft_ui::runtime::memory` | 7.2 |
|
||||
| `Message` | The text of a `Validity` verdict | `craft_ui::runtime::env` | 10.2 |
|
||||
| `Meta`, `HasProps` | Traits the derive writes | `craft_ui::contract` | 1.1 |
|
||||
| `Metrics` | A style's padding, minimum size, wrap width, gap and least text width | craft-behavior | 6.2 |
|
||||
| `Mixed<T>` | A value that is the same across a multi-selection, or mixed | craft-behavior | 10.2 |
|
||||
| `MotionMode`, `MotionKind` | The motion level (`Full`, `Reduced`, `Off`) and an animation's kind (`Fade`, `Travel`, `Loop`, `Blink`), inputs of the motion table | craft-behavior | 13 |
|
||||
| `MotionPolicy` | The motion mode in effect with the motion tokens, carried in `Env.motion` | `craft_ui::runtime::env` | 13.1 |
|
||||
| `MoveMods`, `Granularity` | A move's modifiers (extend the selection, move the lead only) and its unit (`Unit`, `Word`, `Line`, `Paragraph`, `Document`) | craft-behavior | 9.2 |
|
||||
| `Mount` | Where a container lives | `craft_ui::contract` | 16.2 |
|
||||
| `Move` and `Size` commands | The `window` command set's keyboard path for moving and resizing the focused floating container (Alt+F7 and Alt+F8 on Windows and Linux, menu only on macOS) | `WindowCommand` variants | 16.3 |
|
||||
| `NavMove` | A logical navigation move (`Back`, `Forward`, `Up`, ...) | craft-behavior | 9.2 |
|
||||
| `Name` | How a node is named | `craft_ui::runtime::access` | 12.1 |
|
||||
| `NavOutline`, `NavShape` | The key-free outline the navigation core steps through, and the navigation shape | craft-behavior | 9.5 |
|
||||
| `NodeGraph`, `Node`, `NodeKind` | The node-editor collection, its item component and the app trait for node kinds, each generic over the graph's edit type `E: 'static = ()` | `craft_ui::graph` | 20.6 |
|
||||
| `NodeEvent` | A node graph's event: `Wired`, `WireEnded`, or `Edit(E)` from a kind's inline controls | `craft_ui::graph` | 20.6 |
|
||||
| `Numeric` | A node's numeric value, range, step and value text, set with `a.numeric(..)` | `craft_ui::runtime::access` | 12.1 |
|
||||
| One press per pass | The input hook's rule (H0) | `craft_ui::runtime::egui` (input) | 1.8, 8.3 |
|
||||
| `Opener` | The component that opens a free-standing popup | `craft_ui::contract` | 15.4 |
|
||||
| `Outcome` | The trait every `Output` implements | `craft_ui::contract` | 10.2 |
|
||||
| `OpenEntry` | One shown egui layer in the layer stack | `craft_ui::runtime` (layer stack) | 15.2 |
|
||||
| `Overlay` | Data describing an egui layer | `craft_ui::contract` | 15.4 |
|
||||
| `Overrides` | The values an env scope changes | `craft_ui::runtime::env` | 2.3 |
|
||||
| `OverlayFit` | How an egui layer sizes | `craft_ui::contract` | 15.4 |
|
||||
| `Overlays` | The `Cx` trait with `popup(name)` | `craft_ui::contract` | 1.5, 15 |
|
||||
| `OverlayUi` | What the `overlay` hook gets | `craft_ui::contract` | 15.4 |
|
||||
| Owner (memory) | The component id registered at step 3 whose pipeline opened the stage a runtime entry was written through | `craft_ui::runtime::memory` | 7.2 |
|
||||
| `OwnerClass` | A key class, the input of key ownership | craft-behavior | 9.3 |
|
||||
| Paint record | The one interior-mutable cell in `Cx`, written during `paint` | `craft_ui::primitives` | 1.5 |
|
||||
| Painters | `Surface`, `StateLayer`, `FocusRing`, `Rule`, `TextRun`, `ChordText`, `IconSpec`, `Handle`, `ScrollBar` and `ResetMark` | `craft_ui::primitives` | 5.2 |
|
||||
| `PaintShape` | The shape `Draw::fill` and `Draw::stroke` paint: a rect with corners, a circle, a polygon or a path | `craft_ui::primitives` | 5.3 |
|
||||
| `PaintUi` | What `paint` receives | `craft_ui::contract` | 5.3 |
|
||||
| Pane | An F6 stop | `craft_ui::runtime::focus` | 9.4 |
|
||||
| Part | A named sub-rect of a component's own surface with its own hit shape, state, tooltip and sub-node, keyed by a `PartKey` | — | 8.3 |
|
||||
| `PartBuilder` | What `PartsCx::part` returns | `craft_ui::contract` | 1.5, 9.4 |
|
||||
| `PartKey`, `PartKey::CELL` | The one key type of parts, declared as consts | craft-behavior | 1.5, 17.2 |
|
||||
| `PartRef` | A part's name | craft-behavior | 1.5 |
|
||||
| `PartResult` | A part's results this pass | `craft_ui::primitives` | 1.5, 8.3 |
|
||||
| `PartsCx` | What `parts` gets, with last pass's `hovered` and `focus_visible` | `craft_ui::contract` | 1.5 |
|
||||
| Pattern | A type that only assembles components | `craft_ui::contract` | 24.4 |
|
||||
| `Place`, `Resize` | Where an egui layer sits (`Anchored { anchor, side, align }` or `Float`) and how the user may resize it, in `Overlay` | `craft_ui::contract` | 15.4 |
|
||||
| `Pending<T, E>` | A memory slot holding a background result | `craft_ui::runtime::pending` | 14 |
|
||||
| `Placed` | A keyed child given to `arrange` for a custom `Arrangement` | `craft_ui::layout` | 6.3 |
|
||||
| Placement rule | A type lives in the lowest layer that names it | — | Overview |
|
||||
| `Pointer` | The `Cx` trait for part results, presses, activation, wheel, cursors and drag and drop | `craft_ui::contract` | 1.5, 8 |
|
||||
| `PointerFrame` | The pass's pointer snapshot, per viewport | `craft_ui::runtime::pointer` | 8.1 |
|
||||
| `PointerSample` | A pen or touch sample | craft-behavior | 8.1 |
|
||||
| `MultiTouch` | A two-finger gesture summary | craft-behavior | 8.1 |
|
||||
| `PointerButton`, `Buttons` | Pointer buttons, egui-free | craft-behavior | 8.1 |
|
||||
| `Politeness` | An announcement's or live region's urgency | `craft_ui::runtime::access` | 12.1 |
|
||||
| `PopupHandle` | A `Copy` id and name for one of a component's own popups, from `cx.popup(name)`, with `trigger`, `open`, `close` and `is_open` | `craft_ui::contract` | 15.5 |
|
||||
| Prelude | The stable surface of a crate | each crate | 1.11 |
|
||||
| Press-target rule | Exactly one root starts each press: on the topmost layer under it, the root whose press-taking shape is painted on top there; none when egui's hit test names a raw egui widget | `craft_ui::primitives` (sensing core) | 8.3 |
|
||||
| `PressPhase`, `PressState` | A press lifecycle's phase, and its state with mods, sample and capture | craft-behavior | 8.2 |
|
||||
| `PressStart` | A press's start: origin, button, time and click count | craft-behavior | 8.1 |
|
||||
| Probe | The derive-written test entry for a registered type, with its required states | `craft_ui::testing` | 22.4 |
|
||||
| `Proposal` | The question a measure call answers | craft-behavior | 6.2 |
|
||||
| `Props` | The blanket setter trait over `Common` | `craft_ui::contract` | 3.2 |
|
||||
| `Rank` | An overlay's place in the order (window, toast, popup, modal with its backdrop, modal chrome, tooltip) | `craft_ui::runtime` (layer stack) | 15.2 |
|
||||
| Read-only | A component or scope whose values cannot change | — | 3.1, 12.4 |
|
||||
| Region | A sub-rect a container lays out | — | 16.3 |
|
||||
| Registration macro | The one craft-ui macro the `Component` and `CommandSet` derives call to register | `craft_ui` (macros) | 1.11 |
|
||||
| Read-only output | A struct craft-ui builds and apps only read (`CxCore`, `MeasureCx`, `PartsCx`, `TextLayout`) | — | 1.11 |
|
||||
| `Remember` | The memory trait on every context, over four lifetimes | `craft_ui::runtime::memory` | 7.2 |
|
||||
| `ReorderMove<K>` | The value of a reorder edit in a collection | `craft_ui::contract` | 17.6 |
|
||||
| `Resolved` | `Common` merged with the env and the command, assembled at step 3 | `craft_ui::contract` | 3.3 |
|
||||
| `ResolvedCommand` | A command resolved for this frame and instance | `craft_ui::runtime::commands` | 11.3 |
|
||||
| `Role` | A component's or sub-node's AccessKit role | `craft_ui::runtime::access` | 12.1 |
|
||||
| `RootEnv` | The app's root values each frame | `craft_ui::runtime::env` | 2.3 |
|
||||
| `Roving` | A roving group | craft-behavior | 9.5 |
|
||||
| `RowState` | An item's row facts from the collection; the row's id scope is its key | `craft_ui::contract` | 17.2, 17.5 |
|
||||
| `ListRowStyle` | `ListRow`'s style struct | `craft_ui::list` | 17.7 |
|
||||
| `runtime::toast::post` | Posts a toast to a window's queue from any code with a `Context`; the window's shell shows it at its body's end-bottom corner | `craft_ui::runtime::toast` | 15.5 |
|
||||
| `SaveKey` | A crate-prefixed key for the saved lifetime, never derived from an id | `craft_ui::runtime::memory` | 7.2 |
|
||||
| `ScopeKind`, `CancelRule`, `Initial`, `EnterRule` | A focus scope's kind, Escape rule, initial focus and Enter rule | craft-behavior (`ScopeKind`, `CancelRule`), `craft_ui::runtime::focus` (`Initial`, `EnterRule`) | 9.4 |
|
||||
| `Scroll`, `ScrollAnchor`, `Notch` | `ContainerProps.scroll`, its anchor and its wheel notch distance | `craft_ui::contract` | 16.2 |
|
||||
| Scroll part | The track and thumb of one axis, registered with `PartsCx::scroll(key, rect, axis, span)`, run by the pipeline and painted by `ScrollBar` | `craft_ui::contract` | 8.6 |
|
||||
| Shape record | The per-viewport, egui-free record of last pass's registered shapes that H7 classifies presses from | `craft_ui::runtime::pointer` | 8.3 |
|
||||
| `ScrollSpan` | What a scroll part shows on one axis | craft-behavior | 8.6 |
|
||||
| `ScrollPos` | A scroll offset or extent in content units, as `f64` | craft-behavior | 8.6 |
|
||||
| `SelectionModel` | A collection's selection type | craft-behavior | 17.4 |
|
||||
| `SelectMode` | A collection's selection mode | `craft_ui::contract` | 17.1 |
|
||||
| `Sense` | The library's sense set for a root or part | craft-behavior | 1.1 |
|
||||
| `Sense::TAKE_FOCUS` | A sense bit: a press this shape wins moves key focus to its component | craft-behavior | 1.1, 8.3 |
|
||||
| `Sense::WHEEL_X` | A sense bit: takes the horizontal wheel share without focus or arming | craft-behavior | 1.1, 8.6 |
|
||||
| `SetPosition` | An item's index, set size and level for AccessKit | `craft_ui::runtime::access` | 12.1 |
|
||||
| Settle | Step 15 | `craft_ui::contract` | 1.6 |
|
||||
| `ShellInfo` | OS, runtime, backend, capabilities, menu placement and window info | craft-host (`target`) | 21.1 |
|
||||
| `ShellPane` | One of `AppShell`'s panes, named by `Mount::Pane` | `craft_ui::contract` | 16.2 |
|
||||
| `Show`, `ShowContainer`, `ShowCollection` | The sealed show traits the library writes for each shape | `craft_ui::contract` | 1.3 |
|
||||
| `ShowAt` | Where the pipeline places a component | `craft_ui::contract` | 1.6 |
|
||||
| `ShowShape` | The shape a type has (`Leaf`, `Body`, `Items`), which picks its show trait and default sense | `craft_ui::contract` | 1.1 |
|
||||
| `SideLabel` | `ContainerProps.label` | `craft_ui::contract` | 16.2 |
|
||||
| `FieldLabelRole` | Whether a field label names or describes its control, in `SideLabel` | `craft_ui::runtime::access` | 16.2 |
|
||||
| `Sizing` | `ContainerProps.sizing` | `craft_ui::contract` | 16.2 |
|
||||
| `Slot`, `Savable` | The bounds of a memory slot type, and of one the saved lifetime can store | `craft_ui::runtime::memory` | 7.2 |
|
||||
| Stack position | An arena's first ordering key | — | 8.3 |
|
||||
| `Stateful<T>` | The only per-state type a style field holds, resolved by one rule | craft-theme | 4.2 |
|
||||
| `StateSet` | A component's or part's state, flags and animated mix for one frame | `craft_ui::style` | 4.1 |
|
||||
| `Story`, `StoryOutput` | A named way to show one registered type, and its type-erased output | `craft_ui::testing` | 22.4 |
|
||||
| `StoryData` | A story's own values, `value<T: Value>(name, init)`, snapshotted by the runner before and after a drive | `craft_ui::testing` | 22.4 |
|
||||
| `*Style` structs | A component's `type Style` | the component's family | 1.11 |
|
||||
| `StyleColor` | A colour a style builder picked from tokens | `craft_ui::style` | 4.3 |
|
||||
| `StyleCx` | What `style` and the app colour hooks get | `craft_ui::style` | 1.5, 4 |
|
||||
| `Styled` | The `Cx` trait with `resolve`, `resolve_part`, `state()` and `ink()`, all reading step 12's output | `craft_ui::contract` | 1.5, 4.2 |
|
||||
| `StyleKey` | The derive-written `'static` key of the instance inputs a style depends on, generic over a generic component's type parameters (one per instantiation) | `craft_ui::style` | 1.1 |
|
||||
| `StyleReplacements` | The type-erased, frozen form of `Looks` that `InstallSpec.looks` holds | `craft_ui::style` | 1.8, 4.4 |
|
||||
| Sub-node, `SubNode` | An AccessKit node below a component's node, built with `Access::node(part, role)` for parts, cells and content, keyed by `PartRef` | `craft_ui::runtime::access` | 12.1 |
|
||||
| Runtime sub-id | An id the runtime derives from a component id through `sub(base, tag)` | `craft_ui::runtime::memory` | 7.1 |
|
||||
| `SurfaceKind` | The surface a container or part sits on (`Panel`, `Raised`, `Well`, `Popup`, ...), which picks fill, edge, shadow and ink | `craft_ui::style` | 5.2 |
|
||||
| `TextKey`, `Codec` | The key of a text part and the conversion between its text and value | `craft_ui::primitives` (`TextKey`), craft-behavior (`Codec`) | 18.2 |
|
||||
| `TextPos` | A position in an editor's visible lines | craft-behavior | 18.4 |
|
||||
| `TextOptions`, `Completer`, `Completion` | A text part's options, and the trait and candidate type of its completion list | `craft_ui::primitives` (text adapter) | 18.2 |
|
||||
| `TextOutcome` | A text part's result this pass, with its `TextLayout`, from `cx.text(&key)` | `craft_ui::primitives` | 18.2 |
|
||||
| Text parts | `layout`, text outcomes and the editor stream and state, methods of `MeasureCx` and `PartsCx` | `craft_ui::contract` | 1.5, 18 |
|
||||
| `TextRun`, `TextLayout` | The one description of UI text, and its laid-out form | `craft_ui::primitives` | 5.2 |
|
||||
| `TextureCache` | The one texture path | `craft_ui::primitives::textures` | 5.5 |
|
||||
| `ThemeScope` | Another theme definition, mode, contrast or density for a container, everything it shows and the layers opened from it | `craft_ui::runtime::env` | 2.3 |
|
||||
| `TitleRow`, `FooterBar` | The layer-5 components library containers show in their header and footer regions | `craft_ui` title-row and bar families | 16.4 |
|
||||
| `Tokens` | craft-theme's resolved semantic token set | craft-theme | 4.4, 4.5 |
|
||||
| Token group | A crate-prefixed group of semantic colour and shape tokens for a crate's own concepts | craft-theme (trait), `craft_ui::style` (cache) | 4.5 |
|
||||
| `TokenGroup` | The trait a token group implements | craft-theme | 4.5 |
|
||||
| `Tone` | The tone axis of a variant | craft-theme | 4.4 |
|
||||
| `Tooltip`, `TooltipSpec` | The one tooltip type, for components (`Common.tooltip`) and parts (`PartBuilder::tooltip`), and its boxed data | `craft_ui::contract` | 3.4 |
|
||||
| Trial | One test in an integration binary, registered through the one registration macro | `craft_ui::testing` | 22.2 |
|
||||
| `Trigger` | How a popup opens (`Manual`: only through `PopupHandle::open` and the binding) | `craft_ui::contract` | 15.5 |
|
||||
| `UiTokens` | The runtime's egui-ready view of one resolved token set | `craft_ui::style` | 4.5 |
|
||||
| `Validity<T>` | A binding check's verdict | craft-behavior | 10.2 |
|
||||
| `Value` | The bound every value type meets | craft-behavior | 10.2 |
|
||||
| `ValueOf<C>` | The value type of component `C`, `<C::Output as Outcome>::Value` | `craft_ui::contract` | 10.2 |
|
||||
| Variant | A component's look within its style | craft-theme | 4.4 |
|
||||
| Viewport mount | `Mount::Viewport` | `craft_ui::contract` | 16.2 |
|
||||
| `ViewportShare` | A fraction of the viewport per axis, the cap of `OverlayFit::ContentCapped` | `craft_ui::contract` | 15.4 |
|
||||
| `Wheel` | A component's share of wheel and pinch input after the split rule | craft-behavior | 8.6 |
|
||||
| `WheelUnit`, `WheelPhase` | A wheel event's unit and phase, craft-behavior copies of egui's | craft-behavior | 8.6 |
|
||||
| `WindowChrome` | How a window's frame is drawn (OS, custom, none), part of `WindowInfo` | craft-host (`target`) | 21.1 |
|
||||
| `WindowInfo` | A window's kind, chrome, state, insets and `active` (OS focus), refreshed in `set_input` | craft-host (`target`) | 21.1 |
|
||||
| `WordSet` | The trait a `words!` block writes | the word core (open question 13) | 19.2 |
|
||||
| `WordSetCx` | The trait on every context with `label()` and `words::<L>()` | `craft_ui::contract` | 19.2 |
|
||||
| `words::<L>()` | The `WordSetCx` method that returns the word set `L` | `WordSetCx` method | 19.2 |
|
||||
|
||||
@@ -14,8 +14,8 @@ Leave these to the automated tests; repeat them by hand only to investigate a fa
|
||||
|
||||
| Automated | Where |
|
||||
|---|---|
|
||||
| Linux input methods on this box: fcitx5 on Xvfb (XIM), fcitx5 on headless sway (text-input-v3) and IBus on Xvfb; Pinyin, Hangul, Telex and Anthy compositions, a click into a composing field, a pointer unplugged while composing | [IME harness](https://github.com/storytold/craft-libs/pull/212), `tools/ime-harness/` |
|
||||
| Each app's key screens in Arabic, Japanese, Traditional Chinese, Korean, Thai and Vietnamese with no system fonts; one scripted IME composition and one non-Latin shortcut per app | `craft_ui::testing` ([craft-ui README](../crates/ui/README.md#testing-screens-in-each-language)) |
|
||||
| Linux input methods in the test setup: fcitx5 on Xvfb (XIM), fcitx5 on headless sway (text-input-v3) and IBus on Xvfb; Pinyin, Hangul, Telex and Anthy compositions, a click into a composing field, a pointer unplugged while composing | [IME harness](https://github.com/storytold/craft-libs/pull/212), `tools/ime-harness/` |
|
||||
| Each app's key screens in Arabic, Japanese, Traditional Chinese, Korean, Thai and Vietnamese with no system fonts; one scripted IME composition and one non-Latin shortcut per app | `craft_ui::testing` ([gates](craft-framework.md#82-gates)) |
|
||||
| The shortcut rule for Russian, Arabic 101, Hebrew, Greek, Thai, AZERTY, Dvorak and QWERTZ presses as egui reports them | craft-keymap's tests |
|
||||
|
||||
The manual list covers what those can't reach: the input methods and layouts of Windows and
|
||||
|
||||
+347
@@ -0,0 +1,347 @@
|
||||
# Porting an app to the Craft framework
|
||||
|
||||
This guide is for developers, and the agents they brief, who move a craft app's UI onto the Craft framework on craft-libs' `next` branch. It describes the whole workflow: from finding what the app has, through mapping it to framework components, to merging the port. It assumes no particular machine or tooling; where a step needs a tool, it says what the tool must do.
|
||||
|
||||
Read first:
|
||||
|
||||
| Doc | For |
|
||||
|---|---|
|
||||
| [craft-framework.md](craft-framework.md) sections 1–4 | What the framework is, its crates, layers, and how an app hosts it |
|
||||
| [authoring.md](authoring.md) | Writing a component, its stories, and checking it |
|
||||
| [components-index.md](components-index.md) | Every component that exists, with its shape and purpose |
|
||||
| [ui-dialogs.md](ui-dialogs.md), [ui-docking.md](ui-docking.md) | Dialogs and the dock, which most ports touch early |
|
||||
| [contract-api.md](contract-api.md) | The public API surface |
|
||||
|
||||
## 1. The workflow at a glance
|
||||
|
||||
| Phase | Output | Section |
|
||||
|---|---|---|
|
||||
| Pin | The app builds against a `next` revision | [2](#2-branches-and-pins) |
|
||||
| Inventory | Every user-visible part of the app's UI, with its code and tests | [3](#3-inventory) |
|
||||
| Map | For each part: the framework component, the gaps, the test verdicts | [4](#4-map) |
|
||||
| Plan | Tasks with dependencies, sizes and a done-when each | [5](#5-tasks) |
|
||||
| Port | One task at a time: plan, write, prune, compare, tests, review, merge | [6](#6-porting-one-task) |
|
||||
| Integrate | Repin, the app's full test run, a check on each platform | [7](#7-integration) |
|
||||
|
||||
Framework work found on the way (a missing component, a missing option) is its own task on `next`, merged before the app task that needs it.
|
||||
|
||||
## 2. Branches and pins
|
||||
|
||||
- The framework lives on `next` in storytold/craft-libs. Apps keep pinning `main` until they port.
|
||||
- A port branch in the app pins one `next` revision by git rev. Move the pin forward deliberately (a "repin"), never to a moving branch name.
|
||||
- Framework changes go to `next` as normal PRs. Do not patch the framework inside the app.
|
||||
- `next` is synced with `main` regularly. When `main` changes code that `next` replaces, the sync ports the change across.
|
||||
|
||||
## 3. Inventory
|
||||
|
||||
List every user-visible part of the app's UI: panels, dialogs, bars, menus, canvas overlays, popups, and shared widgets. For each part record:
|
||||
|
||||
- the app files and line ranges that build it
|
||||
- the test files that cover it, with their test counts
|
||||
- what the user does with it (the states worth seeing: empty, filled, open, disabled, error)
|
||||
|
||||
Split a large app into areas (for example: panels and chrome, dialogs, tools, canvas, menus and settings) so each area's inventory can be done separately. An agent can draft the inventory from the source; a person checks that nothing user-visible is missing.
|
||||
|
||||
## 4. Map
|
||||
|
||||
For each inventoried part, decide what it becomes. Record:
|
||||
|
||||
| Field | Meaning |
|
||||
|---|---|
|
||||
| Framework replacement | The component(s) that replace it, from components-index.md |
|
||||
| Fit | `direct` (use as is), `needs props` (the component lacks options; list them), `missing component` (describe it), `app-only` (stays app code, built from framework components) |
|
||||
| Gaps | Framework changes the part needs, each a `next` task |
|
||||
| App glue | What the app still does: commands it sends, state it owns, settings it saves |
|
||||
| Test verdicts | Per test file: `delete` (the framework now owns the behaviour, or the code goes), `table` (event-to-command mapping, folded into a few table-driven tests per event family), `keep` (the app's own decisions: command ids, engine effects, saved settings), `new` |
|
||||
| States | The states to compare old against new (section [6.4](#64-compare-old-and-new)) |
|
||||
| Depends on | Other parts and gaps that must land first |
|
||||
| Size | S, M or L in agent tool calls (S under about 40, M up to about 100, L up to about 150; split anything larger) |
|
||||
|
||||
Gaps that several parts share are listed once, as shared framework gaps, so they are built once.
|
||||
|
||||
### Reuse before adding
|
||||
|
||||
Before marking a part `missing component`, walk this ladder and stop at the first step that works:
|
||||
|
||||
1. **An existing component as is.** Search components-index.md by purpose and by shape, and look at the component's stories in the gallery.
|
||||
2. **An existing component with a new story or variant.** If the component already does the job and only lacks a shown state, add the story (authoring.md, "Stories"). A story is a state of an existing type, not a new type.
|
||||
3. **A builder option on an existing component.** A structural difference gets a new option on the component, not a new component (craft-framework.md 4.6, step 3).
|
||||
4. **Density or size overrides.** Visual differences an app needs are tokens and size overrides, never a theme value for one component (craft-framework.md 4.6, steps 1–2).
|
||||
5. **Per-app colour overrides** in the theme file (craft-framework.md 4.6, step 4).
|
||||
6. **A family component** in the crate that owns the document concept, when the part names one (layer, colour model, path): craft-framework.md 4.3.
|
||||
7. **A new library component**, when its inputs are general data and no existing component fits. Place it in the lowest crate of its layer (craft-framework.md 4.3).
|
||||
8. **A one-off app component**, built from shared pieces, as a last resort.
|
||||
|
||||
If two apps need the same family component, it moves down to the library once its inputs are general.
|
||||
|
||||
### Adding a component or story to the gallery
|
||||
|
||||
The gallery shows every registered story; there is no separate gallery list to edit.
|
||||
|
||||
- A new component is registered by its type (`#[derive(Component)]` or a pattern) and gets its required stories (`Default`, plus `Mixed`, `Invalid`, `LongText`, `Open`, `Empty`/`One`/`Many` as its probe requires): authoring.md, "Stories". The shared suite fails while a required story is missing.
|
||||
- A variant of an existing component is a story with a `title`, grouped with the type's other stories by `group`.
|
||||
- The component's gallery level follows its architectural kind (primitive, control, composite, pattern, shell), not the app it came from.
|
||||
- After adding or renaming a type, regenerate components-index.md (`cargo run -p craft-ui-gallery --bin components-index`) and commit it.
|
||||
- Check the result with `render` (the stories to PNG files, without the gallery) or the gallery itself: authoring.md, "Seeing and checking the result".
|
||||
|
||||
## 5. Tasks
|
||||
|
||||
Turn the map into tasks:
|
||||
|
||||
- One task per map section (one part, or a few small parts that share a host). Each task fits one agent run of about 150 tool calls; split larger ones.
|
||||
- Each task names its sections of the map, its dependencies, and a **done-when**: the states that must match, the tests rewritten, the old code removed.
|
||||
- Framework gaps are their own tasks, scheduled before the app tasks that need them.
|
||||
- Order by the dependency graph; the longest chain (often the canvas or the dock) is the critical path and starts first.
|
||||
|
||||
## 6. Porting one task
|
||||
|
||||
A task keeps one assignee from start to finish: review fixes and later follow-ups go back to the same person or agent.
|
||||
|
||||
### 6.1 Brief
|
||||
|
||||
The brief is complete before work starts: the map sections, the app files, the framework components with their files, the test verdicts, the states to compare, the done-when, and any decisions already made. If the brief leaves a design question open, the assignee stops and asks rather than guessing.
|
||||
|
||||
### 6.2 Plan checkpoint
|
||||
|
||||
Before editing, the assignee writes a short plan: the mechanism, the files, and how the result will be checked. A reviewer (the lead, or a second agent) checks it against the map and the rules below. A plan that adds a framework mechanism, or departs from the map, needs the lead's answer before code is written.
|
||||
|
||||
### 6.3 Write and prune
|
||||
|
||||
- Write the new host code on the framework components and move the callers.
|
||||
- Delete the app code the map replaces, and the tests marked `delete`, with a one-line reason each. No old code stays beside the new.
|
||||
- A fix that adds a mechanism removes the one it replaces in the same change.
|
||||
|
||||
### 6.4 Compare old and new
|
||||
|
||||
The old app is the visual reference, but not automatically right: judge each difference on its own (old better, new better, or both need work).
|
||||
|
||||
- Script each state so it can be reproduced: a state is a reset, then steps sent through the app's control channel ([craft-automation](../crates/automation/README.md)), such as opening a panel, setting a value, opening a dialog. Keep the states in a file per panel or dialog.
|
||||
- Capture each state in the old app and in the port, side by side, at the same size and theme.
|
||||
- Shapes, colours, borders, glyphs and parts match; exact pixel values may differ. Nothing overlaps or cuts into a neighbour.
|
||||
- A difference from the old needs a reason: a standardized framework mechanism, or one way replacing an old inconsistency.
|
||||
- Repeat until the done-when states match.
|
||||
|
||||
#### What the library gives and what the app adds
|
||||
|
||||
`craft-automation` provides the transport, the authentication, the request queue, the screenshot queue and a few methods. The app provides the method table.
|
||||
|
||||
| Part | Library (`craft_automation`) | App |
|
||||
|---|---|---|
|
||||
| Command-line values | `args::ControlOptions`, `EnvNames` | Parses its own flags and calls `ControlOptions::resolve` |
|
||||
| Transport | `server::listen`, `server::serve`, `ControlClient` | Calls `listen` (or `serve` on a listener it bound earlier), 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` |
|
||||
| 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 |
|
||||
| View and window state | nothing | Methods such as `ui.set` (tool, panels, theme), `ui.resize`, `engine.execute` |
|
||||
|
||||
Not provided yet, so the porter supplies each today:
|
||||
|
||||
- a capture tool: a small client program (the sample below) that reads a states file, sends the steps and saves the PNGs;
|
||||
- a states-file format and its runner (the sample below defines one);
|
||||
- window-size, theme and reset methods: each app defines its own (PhotoCraft: `ui.resize`, `ui.set {theme}`);
|
||||
- a picture comparison: place the two PNGs side by side with any image tool.
|
||||
|
||||
#### Expose the control channel in the app
|
||||
|
||||
The app starts the server and keeps the channel on its UI thread. The server runs until its `Listening` is dropped.
|
||||
|
||||
```rust
|
||||
use craft_automation::args::{ControlOptions, EnvNames};
|
||||
use craft_automation::control::ControlChannel;
|
||||
use craft_automation::server;
|
||||
use craft_ui::runtime::windows::WindowHost;
|
||||
|
||||
// At start: `flags` holds what the app's own parser read for --control, --control-token
|
||||
// and --control-token-file (a value of the right type, or None).
|
||||
let names = EnvNames::for_app("MYAPP"); // MYAPP_CONTROL_PORT, MYAPP_CONTROL_TOKEN, ...
|
||||
let options = ControlOptions::resolve(flags, &names)?;
|
||||
if let Some(port) = options.port {
|
||||
let token = options.server_token()?;
|
||||
eprintln!("myapp: {}", options.token_notice(&token));
|
||||
// Port 0 lets the OS pick; the address is the one a client needs.
|
||||
let (requests, listening) = server::listen(port, token, WindowHost::of(&egui_ctx))?;
|
||||
eprintln!("myapp: control server listening on {}", listening.addr);
|
||||
app.control = Some(ControlChannel::new(requests));
|
||||
app.control_server = Some(listening);
|
||||
}
|
||||
```
|
||||
|
||||
Each frame, in the logic phase, the app runs the queued requests. In the UI phase of a real pass it issues due screenshots; in the logic phase it collects finished ones (PhotoCraft's `crates/ui-egui/src/app/control.rs` on the `spike/framework-sample` branch is a complete example).
|
||||
|
||||
```rust
|
||||
use craft_automation::control::{Reply, result_reply};
|
||||
use craft_automation::screenshot::{CaptureGeometry, ScreenshotParams, settle_ms};
|
||||
use craft_ui::runtime::motion;
|
||||
use egui::ViewportId;
|
||||
|
||||
// Logic phase.
|
||||
let Some(mut channel) = self.control.take() else { return };
|
||||
let document = self.document_identity(); // None when the app has no document identity
|
||||
let host = WindowHost::of(ctx);
|
||||
let viewport = host.current();
|
||||
if let Some(facts) = host.screenshot_facts(viewport) {
|
||||
channel.captures.note_geometry(viewport, CaptureGeometry::from_facts(facts, document));
|
||||
}
|
||||
let finished = channel.captures.drain(motion::now(), document);
|
||||
channel.finish_captures(finished, &mut |path, bytes| self.write_automation_file(path, bytes));
|
||||
let settle = settle_ms(ctx.global_style().animation_time);
|
||||
while let Some(req) = channel.next_request() {
|
||||
let reply = match req.method.as_str() {
|
||||
"ui.screenshot" => match ScreenshotParams::from_params(&req.params) {
|
||||
Ok(params) => Reply::screenshot(self.next_capture_token(), params, viewport),
|
||||
Err(e) => Reply::from_result(Err(e)),
|
||||
},
|
||||
"ui.resize" => { /* send ViewportCommand::InnerSize */ Reply::from_result(Ok(json!(null))) }
|
||||
"ui.set" => Reply::from_result(self.ui_set(&req.params)),
|
||||
other => Reply::from_result(Err(format!("unknown method {other}"))),
|
||||
};
|
||||
channel.settle(req, reply, document, settle);
|
||||
}
|
||||
self.control = Some(channel);
|
||||
|
||||
// UI phase of a real pass: count it for settling, record the geometry, then issue what is due.
|
||||
channel.captures.note_pass();
|
||||
let finished = channel.captures.issue(&WindowHost::of(ctx), motion::now(), document);
|
||||
```
|
||||
|
||||
`write_automation_file` is the app's file authority: it must refuse paths outside the folder the app lets automation write to. A `ui.screenshot` without a `path` returns the PNG as base64 in the reply. A `region` (`[x0, y0, x1, y1]` in points) crops the picture; one outside the window is refused. Both replies carry the window's `pixels_per_point`.
|
||||
|
||||
On the web there is no server: the app feeds `ControlChannel::new(rx)` from the request closure of `craft_web_api::page::PageApi`, sending each page request as a `ControlRequest::new(method, params)` and answering the page from its reply receiver. The channel, `Reply` and the screenshot queue are the same as on the desktop.
|
||||
|
||||
#### States file
|
||||
|
||||
A state is a title and steps. Each step is one request: a method and its parameters. The methods below are PhotoCraft's (`ui.set`, `ui.resize`, `ui.dialog.open`, `engine.execute`) and the library's (`ui.click`, `ui.key`, `ui.dialog.*`); use the ones the app registers.
|
||||
|
||||
```json
|
||||
{
|
||||
"size": { "width": 1280, "height": 800 },
|
||||
"theme": "pro",
|
||||
"states": [
|
||||
{ "id": "default", "title": "Default", "steps": [] },
|
||||
{ "id": "pencil", "title": "Pencil tool", "steps": [
|
||||
{ "method": "ui.set", "params": { "tool": "Pencil" } } ] },
|
||||
{ "id": "about", "title": "About dialog", "steps": [
|
||||
{ "method": "ui.dialog.open", "params": { "kind": "about" } } ] },
|
||||
{ "id": "click", "title": "Pointer at a canvas position", "steps": [
|
||||
{ "method": "ui.click", "params": { "x": 640, "y": 400 } } ] }
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
Before each state the client sends the same two set-up requests (`ui.resize`, then `ui.set {theme}`), so both apps render at one size and theme. A state that leaves a dialog open ends with its `ui.dialog.cancel` before the next one.
|
||||
|
||||
#### Take the captures
|
||||
|
||||
The client connects with `ControlClient`, sends each state's steps and asks for a capture with `ui.screenshot {path}`. The `path` is relative to the folder the app lets automation write to.
|
||||
|
||||
```rust
|
||||
use craft_automation::client::ControlClient;
|
||||
use serde_json::{Value, json};
|
||||
|
||||
/// Sends one state of the states file and saves its capture as `<label>-<id>.png`.
|
||||
fn capture_state(client: &mut ControlClient, doc: &Value, state: &Value, label: &str) -> Result<Value, String> {
|
||||
let set = |client: &mut ControlClient, method: &str, params: Value| client.call(method, params).map(|_| ());
|
||||
set(client, "ui.resize", doc["size"].clone())?;
|
||||
set(client, "ui.set", json!({"theme": doc["theme"]}))?;
|
||||
for step in state["steps"].as_array().into_iter().flatten() {
|
||||
client.call(step["method"].as_str().ok_or("a step needs a method")?, step["params"].clone())?;
|
||||
}
|
||||
let id = state["id"].as_str().ok_or("a state needs an id")?;
|
||||
client.call("ui.screenshot", json!({"path": format!("{label}-{id}.png")}))
|
||||
}
|
||||
```
|
||||
|
||||
The reply is `{"path", "width", "height"}`. Run it once per app: start the old app and the port each with `--control 0` and a token file, read the address each prints (`control server listening on 127.0.0.1:<port>`), connect, and call `capture_state` for every state with the labels `old` and `new`. Check that both replies give the same `width` and `height`; a different size means the window did not reach the requested size, and the pair is not comparable.
|
||||
|
||||
Send the steps with `ControlClient::call`: a call returns after the input it queued was processed, so the next step sees its result. After a state's steps, `ui.screenshot` waits until open and close animations settle before it captures.
|
||||
|
||||
### 6.5 Tests
|
||||
|
||||
- Rewrite the `keep` and `table` tests on the framework. Event mappings become a few table-driven tests per event family.
|
||||
- Test behaviour that could regress, not exact sizes.
|
||||
- Framework changes get trials in their own crate (`cl test <crate> -- <filter>`).
|
||||
|
||||
### 6.6 Review and merge
|
||||
|
||||
- A reviewer reads the diff and the last old/new comparison, then passes the task or lists fixes. Fixes go back to the same assignee; a fix that restructures gets reviewed again.
|
||||
- Merge the framework branch to `next` first, then the app branch onto the port branch.
|
||||
|
||||
### 6.7 Rules the review checks
|
||||
|
||||
- One mechanism per concept; one set of components.
|
||||
- No workarounds or quick fixes; make the fix where it belongs, in any crate.
|
||||
- Use the framework's own signals; never infer a fact from side effects. A missing signal is added where it belongs.
|
||||
- Behaviour follows the app's conventions; the framework shares focus, Tab order, Escape, undo steps, themes and translation.
|
||||
- Dialog footer buttons follow the platform order (OK last on macOS and Linux, first on Windows).
|
||||
|
||||
## 7. Integration
|
||||
|
||||
At the end of a batch of tasks (a "wave"):
|
||||
|
||||
1. Repin the port branch to the `next` head that holds the batch's framework merges, and run a compile check.
|
||||
2. Run the app's whole test suite once, and sort each failure to the task that caused it; it goes back to that task's assignee.
|
||||
3. Build and run the app on each platform it ships on, and check what the batch changed by eye. Platform-only behaviour (GPU drawing, cursors, window chrome) is checked here.
|
||||
4. Record what the batch cost (time, tool calls, review rounds) and change the process where it went wrong.
|
||||
|
||||
## 8. Working with agents
|
||||
|
||||
- Brief each agent with one task and its map sections, not the whole map.
|
||||
- Tell the agent how to test: the narrowest check while writing, trials of the crates it changes, and no workspace-wide builds. The full test run belongs to integration.
|
||||
- Ask for a plan before edits and answer it before the agent writes.
|
||||
- Have the agent keep a report with a **Resume** section (the step, what is done, the next command) and push its branches at every step end, so a fresh agent can continue after an interruption.
|
||||
- One reviewer per task, at the end, not per round.
|
||||
|
||||
## 9. Templates
|
||||
|
||||
### Map section
|
||||
|
||||
```markdown
|
||||
### A4 Brush Settings panel
|
||||
|
||||
- **App code**: panels/brush_panel.rs (all), panels/brush_preview.rs:1-240
|
||||
- **Framework**: `Section`, `ListRow`, `Slider`, `CheckRow`; preview through `RasterDisplay`
|
||||
- **Fit**: needs props: `ListRow` label column (gap G-12)
|
||||
- **Gaps**: G-12 ListRow label column
|
||||
- **App glue**: sends `brush.set` commands; owns the brush settings model and its saved presets
|
||||
- **Tests**: brush_panel/tests.rs (42): 30 table (event family "slider edits"), 8 keep (preset save/load), 4 delete (preview cache: the framework owns previews)
|
||||
- **States**: default; tip-shape section open; dual-brush on; long preset name
|
||||
- **Depends on**: G-12
|
||||
- **Size**: M
|
||||
- **Done when**: the four states match the old panel; preview cache code and its tests are gone; kept tests rewritten
|
||||
```
|
||||
|
||||
### State file
|
||||
|
||||
The file format, the methods and the runner are in [6.4](#64-compare-old-and-new). One state:
|
||||
|
||||
```json
|
||||
{ "id": "tip-open", "title": "Tip shape open", "steps": [
|
||||
{ "method": "ui.set", "params": { "tool": "Brush" } } ] }
|
||||
```
|
||||
|
||||
The method names come from the app's control channel; use the ones it registers.
|
||||
|
||||
### Task report
|
||||
|
||||
```markdown
|
||||
# <task id>: <title>
|
||||
|
||||
## Resume
|
||||
- Step: <brief | plan | write | prune | compare | tests | review>
|
||||
- Done: <what is finished, with commits>
|
||||
- Next: <exact next command or action>
|
||||
|
||||
## Plan
|
||||
<mechanism, files, checks>
|
||||
|
||||
## Progress
|
||||
- <time> <one line per step>
|
||||
|
||||
## Differences from the old app
|
||||
- <state>: <difference> - <reason: old better / new better / both need work, and the target>
|
||||
|
||||
## Open
|
||||
- <questions for the lead, follow-ups>
|
||||
```
|
||||
@@ -67,8 +67,15 @@ mount), the store opens read-only and says so at startup.
|
||||
broken: only that `[section]` falls back to defaults and the app is told which one.
|
||||
- A file written by a newer build is shown but never overwritten.
|
||||
- Comments, key order and keys the app does not know survive saves. If two instances of an app
|
||||
are open, each re-reads the file before writing so those survive; known keys are
|
||||
last-writer-wins.
|
||||
are open, each re-reads the file before writing and merges in only its own changes, so the
|
||||
other's survive. The app names how each item merges with `Settings::merge_rule`: key by key
|
||||
(the default), whole (a window's place and size come from one instance), a recent list (what
|
||||
this instance opened or used again leads, cut to its limit) or a list of user entries
|
||||
(additions and removals from both are kept, an added entry stays after the entry before it).
|
||||
- Each save holds an advisory lock, `.config.toml.lock` beside the file, from re-reading the file
|
||||
to writing it, so two instances saving at the same moment take turns instead of one writing
|
||||
over the other's merge. A save waits at most 2 seconds for it, then saves anyway and logs a
|
||||
warning, so a stuck process never stops another from saving.
|
||||
|
||||
## Migration
|
||||
|
||||
@@ -98,8 +105,17 @@ files there too.
|
||||
Adoption order: PhotoCraft and DesignCraft first (closest to and furthest from the target
|
||||
behaviour), then the rest.
|
||||
|
||||
## Settings on the web
|
||||
|
||||
A browser build (`wasm32`) opens the same `SettingsStore`. Its files are localStorage items
|
||||
(`LocalStorageFiles`, the default there), keyed by path, so `Location::Dir(dir)` names the key
|
||||
prefix; `Location::Auto` keeps settings in memory. Storage holds about 5 MB per site, so the
|
||||
store caps an item at 4 MB: a stored item over the cap reads as absent and the next save replaces
|
||||
it, and a save over the cap fails and keeps the old item. An app's older hand-written item is a
|
||||
`LegacyFile` read through the same storage. Browser storage takes no lock; tabs of one site share
|
||||
the items, and each save still merges in what another tab wrote since.
|
||||
|
||||
## Not yet
|
||||
|
||||
- Reloading settings when the file changes on disk while the app runs
|
||||
- Removing imported legacy files
|
||||
- Settings on the web (`wasm32`), where only the trait, document helpers and error types exist
|
||||
@@ -0,0 +1,183 @@
|
||||
# SQLite reader comparison
|
||||
|
||||
This comparison addresses the LightCraft and Craft Anything SQLite item in [#778](https://github.com/storytold/craft-libs/issues/778#issuecomment-7022490467).
|
||||
|
||||
## Readers and results
|
||||
|
||||
- LightCraft's Lightroom importer checks the WAL and passes the validated committed prefix to its file-backed page reader. The probe calls that reader directly with a complete, committed WAL produced by SQLite. [LightCraft baseline `78b57565`](https://github.com/storytold/lightcraft/blob/78b575658a61d17bd392b4b81b64c92c8beecbac/crates/engine/src/lightroom_catalog.rs#L512-L530)
|
||||
- Craft Anything's `db_sqlite_show` reads the main-file image and checks for a WAL sidecar so it can disclose a potentially older view. The probe calls the same parser and row-pagination method as the tool. [Craft Anything baseline `df227090`](https://github.com/storytold/craft-anything/blob/df2270904c36d6904883ba4442fb80fb383ed350/crates/engine/src/tools/database_tools.rs#L49-L93)
|
||||
|
||||
The fixture is one table with 512-byte pages. SQLite queries verified the seven stored values: row ID 1, integer −8,388,607, real 1.25, null, label `Päris`, 6,000 ASCII `x` characters, and bytes `00 ff`. The text spans overflow pages. An update changes the label to `committed`.
|
||||
|
||||
| Input | LightCraft import reader | Craft Anything inspection reader |
|
||||
| --- | --- | --- |
|
||||
| Same pre-update main image | `Päris` | `Päris` |
|
||||
| Same main image with SQLite's committed WAL available | `committed` after the caller supplies the committed prefix | Main-file view remains `Päris` |
|
||||
| Same checkpointed main image | `committed` | `committed` |
|
||||
| Overflow text in every tested view | All 6,000 bytes | First 4,096 bytes, marked truncated |
|
||||
| BLOB in every tested view | Exact `00 ff` bytes | Length 2 and SHA-256 prefix `06eb7d6a69ee19e5` |
|
||||
|
||||
The scalar values other than the updated label agreed across every view. Both pinned reader modules compiled and all five probe calls passed on Windows with Rust 1.99.0 and Python 3.14.4 using SQLite 3.50.4. The WAL was 7,536 bytes. These are module-level checks. The production WAL checksum scanner, app frontends, malformed database recovery, and schema-default edge cases were outside this run.
|
||||
|
||||
## Candidate shared boundary
|
||||
|
||||
Shared wire mechanics in `craft-sqlite` (`crates/sqlite/src/lib.rs`) cover only the parts that genuinely match across both readers:
|
||||
- `read_varint` — bounded 1..=9-byte SQLite varint decoding
|
||||
- `serial_type_len` — SQLite record serial-type body width (refusing reserved codes 10 and 11)
|
||||
- `local_payload_len` and `PayloadKind` (#2696) — SQLite B-tree local payload formula (`TableLeaf` and `Index`) before overflow spilling
|
||||
- `page_size_from_raw` and `usable_page_size` — 16-bit header page-size decoding (`1` -> `65_536`, power of two in `512..=65_536`) and `usable >= 480` validation
|
||||
- `parse_btree_page_header` and `btree_cell_offset` — B-tree page header (`0x02`/`0x05`/`0x0a`/`0x0d`) and cell-pointer array bounds within a usable page
|
||||
- `decode_signed_be_int` — 1..=8-byte big-endian signed integer decoding
|
||||
|
||||
### Intentional app-specific differences (kept local)
|
||||
- **WAL & snapshot policy:** LightCraft (`lightroom_catalog.rs` + `lightroom_sqlite.rs`) validates the `-wal` checksum chain and overlays the committed prefix onto the main image (including multi-commit growth, shrink over a larger main file, and page-1 header/schema overrides). Craft Anything (`crates/formats/src/sqlite.rs`) inspects the main database file only and discloses `wal_mode` / `db_size_pages` mismatches in `overview().integrity_notes` (and `-wal` sidecar presence in `database_tools.rs`).
|
||||
- **Error & truncation policy:** LightCraft is strict for catalog import (errors on reserved serial types, non-finite `f64`, invalid UTF-8/UTF-16, or truncated payloads/pages). Craft Anything is best-effort for inspection (`CellValue::NotRead`, `CellValue::PartialBlob`, lossy/capped `MAX_TEXT` / `4096`-byte `CellValue::Text { truncated: true, .. }`, SHA-256 blob digests).
|
||||
- **Schema & table support:** LightCraft handles table B-trees (`0x05`/`0x0d`) and Lightroom `sqlite_schema` / `rowid` alias resolution. Craft Anything additionally inspects index B-trees (`0x02`/`0x0a`), `WITHOUT ROWID` tables, `STRICT` affinities (including `Affinity::Real` promotion), `GENERATED` columns, and `DEFAULT` column fill.
|
||||
|
||||
Keep snapshot selection and caller validation with the Lightroom importer. Keep schema defaults, pagination, text previews and BLOB presentation with Craft Anything. Coordinate a consumer change against the current catalog bounds and old-row default work. [LightCraft #3674](https://github.com/storytold/lightcraft/pull/3674) · [Craft Anything #1349](https://github.com/storytold/craft-anything/pull/1349)
|
||||
|
||||
## Reproduce
|
||||
|
||||
Place the three repositories under one parent directory and check out the two app revisions above. In a scratch directory at `craft-libs/target/sqlite-reader-parity`, save the three blocks below as `generate.py`, `Cargo.toml` and `src/main.rs`. Run from that scratch directory. Use a new fixture path on each run.
|
||||
|
||||
```text
|
||||
python generate.py fixtures
|
||||
cargo run --quiet -- fixtures
|
||||
```
|
||||
|
||||
### Fixture generator
|
||||
|
||||
```python
|
||||
from pathlib import Path
|
||||
import sqlite3
|
||||
import sys
|
||||
|
||||
root = Path(sys.argv[1])
|
||||
root.mkdir(parents=True, exist_ok=False)
|
||||
live = root / "live.db"
|
||||
with sqlite3.connect(live) as connection:
|
||||
connection.execute("PRAGMA page_size=512")
|
||||
assert connection.execute("PRAGMA journal_mode=WAL").fetchone() == ("wal",)
|
||||
connection.execute("PRAGMA wal_autocheckpoint=0")
|
||||
connection.execute(
|
||||
"CREATE TABLE samples(id INTEGER PRIMARY KEY, n INTEGER, r REAL,"
|
||||
" missing, label TEXT, overflow TEXT, binary BLOB)"
|
||||
)
|
||||
expected = (1, -8388607, 1.25, None, "Päris", "x" * 6000, b"\0\xff")
|
||||
connection.execute("INSERT INTO samples VALUES (?,?,?,?,?,?,?)", expected)
|
||||
connection.commit()
|
||||
assert connection.execute("SELECT * FROM samples").fetchone() == expected
|
||||
assert connection.execute("PRAGMA page_size").fetchone() == (512,)
|
||||
assert connection.execute("PRAGMA wal_checkpoint(TRUNCATE)").fetchone() == (0, 0, 0)
|
||||
(root / "base.db").write_bytes(live.read_bytes())
|
||||
|
||||
connection.execute("UPDATE samples SET label='committed'")
|
||||
connection.commit()
|
||||
committed = expected[:4] + ("committed",) + expected[5:]
|
||||
assert connection.execute("SELECT * FROM samples").fetchone() == committed
|
||||
wal = live.with_name(live.name + "-wal").read_bytes()
|
||||
assert len(wal) >= 32 + 24 + 512 and (len(wal) - 32) % (24 + 512) == 0
|
||||
assert int.from_bytes(wal[-(512 + 20):-(512 + 16)], "big") > 0
|
||||
(root / "committed.wal").write_bytes(wal)
|
||||
assert connection.execute("PRAGMA wal_checkpoint(TRUNCATE)").fetchone() == (0, 0, 0)
|
||||
(root / "checkpoint.db").write_bytes(live.read_bytes())
|
||||
assert connection.execute("SELECT * FROM samples").fetchone() == committed
|
||||
print("SQLite", sqlite3.sqlite_version, "| 512-byte pages |", len(wal), "WAL bytes")
|
||||
```
|
||||
|
||||
### Runner manifest
|
||||
|
||||
```toml
|
||||
[package]
|
||||
name = "sqlite-parity-probe"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
serde = { version = "=1.0.229", features = ["derive"] }
|
||||
sha2 = "=0.10.9"
|
||||
|
||||
[workspace]
|
||||
```
|
||||
|
||||
### Runner
|
||||
|
||||
```rust
|
||||
#[path = "../../../../lightcraft/crates/engine/src/lightroom_sqlite.rs"]
|
||||
mod light;
|
||||
#[path = "../../../../craft-anything/crates/formats/src/sqlite.rs"]
|
||||
mod inspect;
|
||||
|
||||
use inspect::{CellValue, SqliteDb};
|
||||
use light::{Database, FileSource, Value};
|
||||
use std::fs;
|
||||
use std::path::Path;
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug)]
|
||||
enum FormatError {
|
||||
TooLarge(String),
|
||||
Unsupported(String),
|
||||
Truncated(String),
|
||||
Malformed(String),
|
||||
}
|
||||
|
||||
fn light_row(main: &Path, wal: &[u8], label: &str) {
|
||||
let database = Database::open_file_with_wal(FileSource::open(main).unwrap(), wal).unwrap();
|
||||
let table = database.live_tables().unwrap().into_iter().find(|table| table.name == "samples").unwrap();
|
||||
let rows = database.read_table(table.rootpage, 7).unwrap();
|
||||
assert_eq!(rows.len(), 1);
|
||||
assert_eq!(
|
||||
rows[0].values,
|
||||
[
|
||||
Value::Integer(1),
|
||||
Value::Integer(-8388607),
|
||||
Value::Real(1.25),
|
||||
Value::Null,
|
||||
Value::Text(label.to_owned()),
|
||||
Value::Text("x".repeat(6000)),
|
||||
Value::Blob(vec![0, 255]),
|
||||
]
|
||||
);
|
||||
database.ensure_unchanged().unwrap();
|
||||
println!("LightCraft: {label}; all 7 values; full 6000-byte text and 2-byte BLOB");
|
||||
}
|
||||
|
||||
fn inspector_row(main: &Path, label: &str) {
|
||||
let bytes = fs::read(main).unwrap();
|
||||
let database = SqliteDb::parse(&bytes).unwrap();
|
||||
let table = database.find_object("samples").unwrap();
|
||||
let page = database.read_rows(table.rootpage, 0, 2);
|
||||
assert_eq!(page.rows.len(), 1);
|
||||
assert_eq!(page.rows[0].rowid, Some(1));
|
||||
assert_eq!(
|
||||
page.rows[0].values,
|
||||
[
|
||||
CellValue::Int(1),
|
||||
CellValue::Int(-8388607),
|
||||
CellValue::Real(1.25),
|
||||
CellValue::Null,
|
||||
CellValue::Text { text: label.to_owned(), truncated: false },
|
||||
CellValue::Text { text: "x".repeat(4096), truncated: true },
|
||||
CellValue::Blob { len: 2, sha256_prefix: "06eb7d6a69ee19e5".into() },
|
||||
]
|
||||
);
|
||||
println!("Craft Anything: {label}; all 7 values; 4096-byte projection and BLOB digest");
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let fixture_arg = std::env::args_os().nth(1).expect("fixture directory");
|
||||
let fixtures = Path::new(&fixture_arg);
|
||||
let base = fixtures.join("base.db");
|
||||
let checkpoint = fixtures.join("checkpoint.db");
|
||||
let wal = fs::read(fixtures.join("committed.wal")).unwrap();
|
||||
println!("Main image");
|
||||
light_row(&base, &[], "Päris");
|
||||
inspector_row(&base, "Päris");
|
||||
println!("Committed WAL overlay");
|
||||
light_row(&base, &wal, "committed");
|
||||
println!("Checkpointed control");
|
||||
light_row(&checkpoint, &[], "committed");
|
||||
inspector_row(&checkpoint, "committed");
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,255 @@
|
||||
# Suite themes
|
||||
|
||||
A suite theme is a named set of seeds and pins from which every Craft app derives its colours,
|
||||
shape and size tokens, so one choice in one app can restyle the whole suite. This page is the
|
||||
reference for theme authors and for app developers adopting the suite theme.
|
||||
|
||||
| Crate | Contents |
|
||||
|---|---|
|
||||
| [`craft-theme`](../crates/theme/README.md) | Token model, derivation, contrast rules, theme file format, built-ins, selection and its resolution. No egui, no I/O; builds for wasm. |
|
||||
| [`craft-theme-store`](../crates/theme-store/README.md) | The suite folder: user themes, `selection.json`, the lock/revision protocol and the change watcher. |
|
||||
| [`craft_ui::style`](craft-framework.md#42-ownership) | The bridge to egui: `UiTokens`, `StyleCx` and the component styles that read them. |
|
||||
|
||||
## Tokens
|
||||
|
||||
Tokens come in two layers. A theme file only states seeds and exceptions; everything else is
|
||||
derived.
|
||||
|
||||
1. **Primitives**: colour, 12-step ramps, fixed scales (space, radius, stroke, opacity,
|
||||
duration, easing, elevation).
|
||||
2. **Semantic tokens**: `surface.*`, `text.*`, `line.*`, `state.*`, `accent.*`, status, overlay,
|
||||
data and caption colours, plus shape, size, space, motion and type tokens.
|
||||
|
||||
There are no component tokens: every component computes its look from the semantic tokens, in its
|
||||
style in the UI library crates.
|
||||
|
||||
`resolve(theme, appearance, app)` builds the tokens for one appearance: mode (light, dark),
|
||||
contrast (standard, high), size (compact, comfortable), text size (small, default, large and
|
||||
larger) and reduced motion. Derivation order, later steps winning: seeds (the theme's, with the mode's overrides), then ramps, then the theme's pins, then
|
||||
the app's pins (`apps.<id>`), then the theme's high-contrast pins, then the app's
|
||||
(`apps.<id>.high_contrast`).
|
||||
|
||||
## Theme file (`craft-design-theme`, version 1)
|
||||
|
||||
```json
|
||||
{
|
||||
"schema": "craft-design-theme", "schema_version": 1,
|
||||
"id": "user.navy", "name": "Navy", "version": 1,
|
||||
"variants": "both",
|
||||
"contrast_intent": "standard",
|
||||
"icon_pack": "craft.carbon",
|
||||
"seeds": { "neutral": "#535353", "accent": "#78ADF6",
|
||||
"status": { "good": "#85DC6A", "warn": "#E8B046", "bad": "#FF8080", "info": "#78ADF6" } },
|
||||
"shape": null,
|
||||
"light": { "surface.panel": "#F0F0F0" },
|
||||
"dark": { "surface.panel": "#535353" },
|
||||
"high_contrast": { "light": {}, "dark": {} },
|
||||
"apps": { "photocraft": { "light": {}, "dark": { "surface.canvas": "#282828" }, "high_contrast": {} } }
|
||||
}
|
||||
```
|
||||
|
||||
| Key | Required | Value |
|
||||
|---|---|---|
|
||||
| `schema`, `schema_version` | yes | `"craft-design-theme"`, `1` |
|
||||
| `id` | yes | `[a-z0-9][a-z0-9._-]{1,63}`; `craft.` is reserved for built-ins and refused in the library; Windows device names (`con`, `nul`, `com1` ...) are refused as the first dot-separated part |
|
||||
| `name` | no | display name; default the id |
|
||||
| `version` | no | the author's revision, default 1 |
|
||||
| `variants` | no | `"both"` (default), `"light"` or `"dark"` |
|
||||
| `contrast_intent` | no | `"standard"` (default) or `"low"`: the theme is meant to be soft, and pickers label it "Low contrast" |
|
||||
| `icon_pack` | no | the id of the icon pack the theme draws its icons from (same form as `id`); absent or `null` draws the suite's default set (Lucide). `craft.lucide`, `craft.phosphor`, `craft.carbon` and `craft.tabler` are the built-in sets, which fall back to Phosphor for icons they lack; other ids name packs in the suite library. A pack that is not installed draws the default icons; it is not a file error |
|
||||
| `seeds` | yes | `neutral`, `accent` and `status.good/warn/bad/info`, all required |
|
||||
| `shape` | no | `null`, or `{ "radius": { control, popup, window, panel, button, pill? }, "radius_offset": { control?, popup?, window? }, "edge": "flat" or {"bevel": {"width": 1}}, "knob": "round" or "tab", "wells": "square" or "round" }`; `knob` is the shape of a value track's thumb (default `"round"`; Classic's `"tab"` is an upright tab); `wells` is the shape of a colour well that stands on its own, SwatchPair's (default `"square"`; Adwaita, Breeze and Soft are `"round"`); a radius is a number or `"full"`; `radius` needs the first five keys when present and fixes the radii at every Size; `radius_offset` (numbers, negative allowed, missing keys 0) is added to the control, popup and window radii in force, so the theme keeps its own shape at every Size (Soft: control +1, popup +2, window +2, which makes 7/10/14 at Comfortable and 4/6/8 at Compact); a "full" radius and `panel`, `button` and `pill` are not offset, and a sum below 0 is 0; `pill` (switch, slider, progress and badge shapes, clamped to half the part's height) defaults to `"full"`, and Classic sets it to 0 |
|
||||
| `light`, `dark` | no | colour pins: dotted token path to `#RRGGBB`, `#RRGGBBAA` or a reference `"{token.path}"` (see References); surfaces (`surface.*` except `surface.scrim`) must be opaque. A `seeds` key holds that mode's seed overrides: `neutral`, `accent` and `status.good/warn/bad/info`, each optional; a field it names replaces the theme's `seeds` value in that mode and the rest fall through |
|
||||
| `high_contrast` | no | `{ "light": {...}, "dark": {...} }`, pins used only in high contrast; no `seeds` key (it is an error there and in `apps`) |
|
||||
| `apps` | no | per-app `{ light, dark, high_contrast, shape }`, applied over the theme's values for that app; its `high_contrast` pins apply after the theme's; its `shape` (as the theme's `shape`) replaces the theme's whole for that app, and `null` or no key keeps the theme's |
|
||||
|
||||
- JSON, at most 256 KiB. `schema_version` is the format; `version` is the author's revision.
|
||||
- Paths are flat dotted strings (`"surface.panel"`), never nested objects.
|
||||
- References: a pin value `"{accent.solid}"` takes the final value of that colour token (after derivation and the contrast pass) for the theme, mode, contrast and size being resolved, so it follows the accent when the theme's accent changes. A target the theme pins reads the pinned value, a reference may name another reference, and a derived target reads the value derived from the other references' final values (the theme resolves again with every reference applied until no reference's value changes). References that never settle, such as `"state.selected": "{state.selected_hover}"` where the hover state derives from the selected one, are an error naming the key. It works in `light`, `dark`, `high_contrast` and `apps` maps. A name that is no colour token, and a cycle of references, are errors naming the key and the reference. Only colour pins take references; `seeds` do not.
|
||||
- A pin map or `seeds` override for a mode the theme lacks is an error when it is not empty.
|
||||
- Two-variant themes whose modes need different seeds (Pro, Soft) put the differing fields in `light.seeds` or `dark.seeds` instead of pinning the derived colours.
|
||||
- `write` refuses a theme that would not parse back (`ThemeDef::validate`: pins for a missing
|
||||
mode, overrides of the wrong kind, translucent surfaces, negative or non-finite lengths).
|
||||
- Unknown keys outside the pin maps are allowed and kept byte for byte when the store rewrites
|
||||
the file. An unknown path inside a pin map is an error.
|
||||
- A newer `schema_version` is refused and the file left alone. A file with another `schema`
|
||||
(the earlier `craft-theme` format) is skipped by the library and counted, not reported.
|
||||
- `craft-theme check <file>... [--json]` reports every error with its path (`dark."surface.panel":
|
||||
not a colour`) and every contrast warning per appearance. Exit code 1 for errors, 0 otherwise.
|
||||
|
||||
### Built-in themes
|
||||
|
||||
`craft.artcraft`, `craft.graphite`, `craft.studio`, `craft.adwaita`, `craft.breeze`, `craft.pro`,
|
||||
`craft.soft` (both variants); `craft.pro-light-gray`, `craft.classic` (light only);
|
||||
`craft.solarized-dark` (dark only). `craft.soft` has `contrast_intent: low`. `craft.app-default` is not a theme: it stands for the
|
||||
app's own palette, and settings lists it beside the others. High contrast is a setting, not a
|
||||
theme. `SUITE_DEFAULT` is `craft.artcraft`.
|
||||
|
||||
## Contrast rules
|
||||
|
||||
Users must be able to tell text and state indicators apart; nothing else is a rule.
|
||||
|
||||
High contrast meets every minimum below: it moves pinned values that miss one. Standard contrast follows the theme's design: a pinned value never moves, and a pair it misses is reported as a warning (the `warning =` lines of the token dumps), not a failure. Colours a theme leaves unpinned are still derived to meet the Standard minimums.
|
||||
|
||||
| Pair | Standard | High |
|
||||
|---|---|---|
|
||||
| `text.normal`, `text.muted`, `text.faint` on surfaces (background, panel, chrome, raised, sunken, control), `state.hover` and `state.pressed` | 4.5 | 7 |
|
||||
| `text.on_selected` on `state.selected` and `state.selected_hover`; `text.on_inverse` on `surface.inverse` | 4.5 | 7 |
|
||||
| `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 |
|
||||
| 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 |
|
||||
|
||||
Component styles in `craft-ui` derive their state fills from these tokens. In high contrast a selected or on state is identifiable (WCAG 1.4.11): a fill, an edge or a mark reaches 4.5 on what it sits on. Where a fill carries the state alone, it moves along OKLCH lightness to the nearest step that does, with its text still readable on it (`craft_theme::Identify`, `identifiable_outline`). The hover fill of a list row stays at least 1.12:1 from the rest surface and from the selected fill (`visible_hover`), so the mouse cue always shows. Standard contrast keeps the theme's own fills and has no minimum for these cues.
|
||||
|
||||
Hover, pressed, dividers and disabled text have no rule, and control edges have none in Standard, so they take their derived
|
||||
or pinned values in Standard contrast (and in High contrast, for hover, pressed, dividers and disabled text), as do the guide colours and `overlay.line`, the bare accent
|
||||
line of a transform box, path outlines, a pen draft and warp boundaries: a bare line on an image
|
||||
can't promise a ratio. `overlay.handle_stroke` follows `overlay.stroke`, pinned or not, and the
|
||||
contrast pass moves it from there as far as `overlay.handle_fill` needs; so a theme that pins an
|
||||
`overlay.stroke` failing on the white handle fill gets handle outlines off its pin, and no
|
||||
warning names them. A translucent fill is measured over `surface.panel`.
|
||||
`text.on_selected` defaults to `text.normal`'s ramp step, so a neutral selection looks like the
|
||||
rest of the text and a coloured one (a navy or blue selection) gets its own readable text.
|
||||
`text.on_strong` is white, and `accent.strong` is `accent.solid` with only its OKLCH lightness
|
||||
moved, as far as white text needs to reach the minimum: the accent itself where white already
|
||||
reads on it, a slightly deeper accent where it doesn't (Pro's dark #378EF0 becomes #1B77D7). A
|
||||
`accent.strong_hover` and `accent.strong_pressed` are `accent.strong` with its lightness moved away from the text (darker under white text) by the distance `accent.hover` and `accent.pressed` lie from `accent.solid`, in every appearance, so the three fills differ and the variants read wherever `accent.strong` does. Accent fills that carry text use the strong pair; fills without text (check marks, slider fills) use `accent.solid`. A
|
||||
pinned `accent.strong` stays in standard contrast; unpinned text on it turns black where white
|
||||
misses, as on the other solid fills, and pinned text that misses is reported.
|
||||
|
||||
| | Standard contrast | High contrast |
|
||||
|---|---|---|
|
||||
| Unpinned colour that misses | moved to the minimum | moved to the minimum |
|
||||
| Pinned colour that misses | kept, reported as a warning | fixed, pins included |
|
||||
| Pinned text on solid fills that misses | kept; the unpinned fills under it move | fixed, pins included |
|
||||
| State fill under text that cannot reach 7 | n/a | the fill moves away from the text, as far as needed |
|
||||
|
||||
A failing pair is reported once, as the semantic pair.
|
||||
|
||||
A theme with `contrast_intent: standard` should resolve with no warnings; built-ins do in both
|
||||
contrasts, except the soft themes in standard contrast.
|
||||
|
||||
## Selection
|
||||
|
||||
The suite has one selection, in `selection.json` of the suite folder. Each field is set once a
|
||||
user picks it in some app; unset fields come from each app's own defaults, so one app's default
|
||||
never reaches the others.
|
||||
|
||||
```json
|
||||
{ "schema_version": 2, "revision": 17, "library_revision": 4,
|
||||
"suite": { "theme": { "light": "craft.artcraft", "dark": "craft.graphite" },
|
||||
"mode": "system", "contrast": "system", "size": "compact", "text_size": "default" },
|
||||
"written_by": "pdfcraft 0.15.0" }
|
||||
```
|
||||
|
||||
| Field | Values |
|
||||
|---|---|
|
||||
| `suite.theme.light`, `suite.theme.dark` | a theme id per mode; each slot optional |
|
||||
| `suite.mode` | `light`, `dark`, `system` |
|
||||
| `suite.contrast` | `standard`, `high`, `system` |
|
||||
| `suite.size` | `compact`, `comfortable` |
|
||||
| `suite.text_size` | `small`, `default`, `large`, `larger` |
|
||||
|
||||
- Picking a two-variant theme sets both slots; a single-variant theme sets only its own mode's
|
||||
slot.
|
||||
- Version 1 files (`suite.theme` a string, `mode` only) are read by putting the theme in both
|
||||
slots; the next write is version 2. A `schema_version` of 3 or above is refused and never
|
||||
changed. Keys the app doesn't know are kept on every write.
|
||||
- No `selection.json` means nobody has chosen anything. An app writes it only when the user
|
||||
picks, never on first start.
|
||||
|
||||
### In an app
|
||||
|
||||
- `SuiteChoice::with_defaults(&AppDefaults)` fills the unset fields from the app's
|
||||
`AppDefaults { theme: ThemePair, mode, size, sizes: AppSizes }`. `sizes` is the app's own size
|
||||
overrides, read from its `sizes.json` with `AppSizes::parse`: base values (`size.control.md`,
|
||||
`space.gap.row`, `radius.button`, `typography.body.size`) that derived sizes follow. `all`, `compact` and `comfortable` hold the paths; a size set's
|
||||
own map wins over `all`. Themes don't set sizes.
|
||||
- Each app keeps an `AppChoice { theme, mode, size }` in its own preferences for "use a
|
||||
different theme / mode / size in this app"; `apply` lays it over the suite's selection. It has no `Default`:
|
||||
the app states what a fresh install shows.
|
||||
- `resolve_selection(&selection, system, fallback_mode, &defaults, app, lookup)`, with `lookup` a
|
||||
`&mut dyn FnMut(&ThemeId) -> Option<ThemeDef>` (`&mut |id| store.theme(id)`), returns
|
||||
`Shown { theme, appearance, resolved, notices }`. `System` mode or contrast uses what the OS
|
||||
reports (`SystemAppearance`); with no answer, mode uses `fallback_mode` (notice
|
||||
`SystemSilent`) and contrast is standard.
|
||||
- An unknown theme id falls back to the app default's slot, then to `SUITE_DEFAULT`, with an
|
||||
`UnknownTheme` notice. A single-variant theme in the other mode's slot shows its own variant
|
||||
(notice `OnlyVariant`).
|
||||
|
||||
## Suite folder and store
|
||||
|
||||
`SuiteDir::resolve(app_isolated)` picks the folder in this order:
|
||||
|
||||
1. `CRAFT_SUITE_DIR`. Set but empty: in memory, nothing on disk is read or written.
|
||||
2. In memory when the app runs without a disk store (`app_isolated`: constructors, tests,
|
||||
portable installs).
|
||||
3. `ArtCraft/themes` under the local config folder: `~/.config` on Linux and the BSDs,
|
||||
`~/Library/Application Support` on macOS, `%LOCALAPPDATA%` on Windows.
|
||||
|
||||
Web builds are always in memory, with the same operations.
|
||||
|
||||
```text
|
||||
ArtCraft/themes/selection.json suite selection and revisions
|
||||
ArtCraft/themes/selection.lock lock file, never deleted
|
||||
ArtCraft/themes/library/<id>.json one user theme per file
|
||||
ArtCraft/themes/selection.broken-<unix-ts>.json a damaged selection, moved aside on the next write
|
||||
```
|
||||
|
||||
Reading never creates anything; the folder appears with the first write.
|
||||
|
||||
### Writes
|
||||
|
||||
Reads take no lock; every write replaces the file by atomic rename. A write takes the exclusive
|
||||
`selection.lock` (retries for 2 s, then `Busy`), reads `selection.json`, merges, writes with
|
||||
`revision` one above the file's, and checks the file again just before the rename.
|
||||
|
||||
A damaged `selection.json` (or one over 64 KiB) is moved to `selection.broken-<unix-ts>.json`
|
||||
before the next write. A file from a newer build gives `TooNew` and stays read-only.
|
||||
|
||||
`Store::update(base, change)` takes the state the user's change was made on and a
|
||||
`SelectionChange` with the fields that changed (`theme_light`, `theme_dark`, `mode`, `contrast`,
|
||||
`size`, `text_size`). Per field:
|
||||
|
||||
| Field | Disk | Result |
|
||||
|---|---|---|
|
||||
| not changed | anything | disk's value |
|
||||
| changed | not chosen | mine |
|
||||
| changed | equal to mine | disk's value |
|
||||
| changed | another value, equal to base's | mine |
|
||||
| changed | another value, not base's | conflict: another app chose it after the caller read |
|
||||
|
||||
A conflict returns `Conflict { disk, mine }` and writes nothing; the app offers "Apply mine".
|
||||
A change naming a library theme that no longer exists is `NotFound`.
|
||||
|
||||
Library operations take the same lock and bump `library_revision`:
|
||||
|
||||
- **Import** validates the file and writes its original bytes to `library/<id>.json`, never
|
||||
replacing a file (`IdExists`); "import as copy" picks the first free `<id>-2`, `<id>-3` ...
|
||||
- **Save** replaces a library theme with new bytes when its file still has the stamp the caller
|
||||
loaded it with; a file another app replaced since is `Changed` and stays as it is. Built-ins
|
||||
are refused (`BuiltIn`).
|
||||
- **Delete** refuses built-ins and a theme in either suite slot (`InUse`).
|
||||
- **Export** returns a library theme's stored bytes, or a built-in written as a theme file.
|
||||
|
||||
Ids a user couldn't create (`craft.` prefix, device names) are `NotFound` and never reach the
|
||||
file system. A failed write is undone and the error returned.
|
||||
|
||||
### Watching
|
||||
|
||||
Apps use `SuiteWatch::open(dir, options, wake)`, which owns the store on a worker thread and
|
||||
publishes an immutable `Snapshot` (`accepted`, `index`, `active`, `app_theme`, `problems`,
|
||||
`results`, `generation`). The worker checks the stamp of `selection.json` and of the themes in
|
||||
use every 500 ms, compares bytes every 10 s, and lists the library only when `library_revision`
|
||||
changes or on `Op::Rescan`. Each change publishes a snapshot and calls `wake` once.
|
||||
|
||||
Each frame the app compares `generation()` (one atomic load) with its cache key and rebuilds its
|
||||
styles only when it changed. Changes go through `request(Op)`: `Update`, `Import`, `Save`,
|
||||
`Delete`, `Export`, `Rescan` and `AppTheme`; the result appears in `snapshot().result(id)`. `SuiteWatch::memory()`
|
||||
runs without a thread, applying each request before it returns.
|
||||
|
||||
The lock file and revision protocol follow
|
||||
[pdfcraft#1090](https://github.com/storytold/pdfcraft/pull/1090).
|
||||
@@ -1,166 +0,0 @@
|
||||
# Shared theme infrastructure
|
||||
|
||||
The first shared mechanism is `craft-ui::theme::WidgetPalette`: it applies colors to egui's five
|
||||
widget states, with a supplied foreground stroke and corner radius. VectorCraft, DesignCraft and
|
||||
LightCraft use the same operation. Their complete palettes, theme choices, fonts and preferences
|
||||
remain in their frontends.
|
||||
|
||||
This follows the reusable-UI workstream of [craft-libs issue 2](https://github.com/storytold/craft-libs/issues/2).
|
||||
The [cross-app architecture discussion](https://github.com/storytold/vectorcraft/issues/647) and
|
||||
[base-crate request](https://github.com/storytold/photocraft/issues/1217) provide context; this change
|
||||
keeps the existing repository, document and release boundaries.
|
||||
|
||||
## Source comparison
|
||||
|
||||
Reviewed 2026-10-09 at the revisions below. All links point to
|
||||
`crates/ui-egui/src/theme.rs`. The 3,454-line total includes font setup, specialized helpers and
|
||||
tests; it is not a count of duplicate theme code. Token-field counts include non-color fields.
|
||||
|
||||
| App | Source revision | Lines | Token fields | Theme model |
|
||||
| --- | --- | ---: | ---: | --- |
|
||||
| PhotoCraft | [`e7a83ca342cd`](https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/theme.rs) | 832 | 37 | Five presets; per-preset metrics and Classic bevels |
|
||||
| VectorCraft | [`825d4fdb8b52`](https://github.com/storytold/vectorcraft/blob/825d4fdb8b527c597855d273fb4bcc1971855b6a/crates/ui-egui/src/theme.rs) | 345 | 38 | Four brightness presets |
|
||||
| DesignCraft | [`66c7ce7e96ec`](https://github.com/storytold/designcraft/blob/66c7ce7e96ec286a091878cc2541ee8369aa79d6/crates/ui-egui/src/theme.rs) | 426 | 33 | Four brightness presets plus High Contrast |
|
||||
| WordCraft | [`d7d9702bda1f`](https://github.com/storytold/wordcraft/blob/d7d9702bda1fe626952024dc37fd2624323dad0f/crates/ui-egui/src/theme.rs) | 231 | 32 | Light/dark, ribbon and page colors |
|
||||
| PdfCraft | [`f626db25cca2`](https://github.com/storytold/pdfcraft/blob/f626db25cca2c89f8fa3f7e30d22bf59faea65ec/crates/ui-egui/src/theme.rs) | 314 | 22 | System/light/dark preference |
|
||||
| LightCraft | [`88ea1a804b35`](https://github.com/storytold/lightcraft/blob/88ea1a804b35709e1fe436e3792adf0428b97daa/crates/ui-egui/src/theme.rs) | 345 | 35 | Dark photo workflow palette |
|
||||
| FilmCraft | [`7b6c13447228`](https://github.com/storytold/filmcraft/blob/7b6c134472287db4367fca80bcb498240ba36567/crates/ui-egui/src/theme.rs) | 447 | 43 | Three presets, custom accent and accessible contrast |
|
||||
| EffectCraft | [`2a460986ee7a`](https://github.com/storytold/effectcraft/blob/2a460986ee7a4b32656a3d434849693904b486bc/crates/ui-egui/src/theme.rs) | 514 | 44 | Three presets, brightness and label colors |
|
||||
|
||||
The matching widget-state operation is visible in [VectorCraft lines 299–312][vector-loop],
|
||||
[DesignCraft lines 336–348][design-loop] and [LightCraft lines 235–247][light-loop]. It assigns
|
||||
`bg_fill`, `weak_bg_fill`, `corner_radius` and `fg_stroke` across noninteractive, inactive, hovered,
|
||||
active and open states. The state colors differ, but the assignments and their meaning agree.
|
||||
|
||||
The surrounding `Visuals` operations differ materially:
|
||||
|
||||
| App | Differences that remain local |
|
||||
| --- | --- |
|
||||
| VectorCraft | Selection uses accent at 0.55 gamma with an accent stroke. Popup/window radius is 6; shadows vary with light/dark. Inactive border is absent, hover uses input border and active uses accent. Body/button text is 13 pt. |
|
||||
| DesignCraft | Selection uses strong accent and strong-text stroke. Radius is 4; window shadow stays egui's default. Interactive borders use field border. Inactive buttons get transparent weak fill and input background after the shared operation. Body/button text is 11 pt. High Contrast keeps black/white/yellow colors. |
|
||||
| LightCraft | The matching loop uses `text_label`, intentionally dimmer than the app's main text, and a fixed dark palette. Catalog label helpers depend on its own model. |
|
||||
| FilmCraft | Custom highlight and contrast preferences feed its palette. Widget states use ordinary text for inactive/noninteractive and brighter text for hovered/active; open foreground remains inherited. |
|
||||
| EffectCraft | Its widget assignment block matches FilmCraft's, but brightness adjustment, label/gradient helpers, popup radius, shadows, spacing and solid scrollbars differ. |
|
||||
| PhotoCraft | Noninteractive text is dimmer; interactive states have separate border and expansion policies. Classic styling includes bevels, and font size is preference-driven. |
|
||||
| PdfCraft | System theme resolution and named context storage are local. Its foreground loop preserves each inherited stroke width; a blanket full-stroke assignment would change that contract. Light text and font subpixel settings differ. |
|
||||
| WordCraft | Tokens derive from egui's current dark mode. Only three interactive states get explicit radii; other states inherit egui defaults. Ribbon/document colors have separate meaning. |
|
||||
|
||||
FilmCraft and EffectCraft's separate matching block is a useful second extraction candidate, but
|
||||
it has a different foreground-state contract. Extending the first helper to cover it immediately
|
||||
would obscure the small invariant being shared. There is no single cleanest complete theme:
|
||||
the first pair offers the clearest common operation, and the other apps preserve different
|
||||
requirements rather than providing interchangeable replacements.
|
||||
|
||||
## Boundary and API
|
||||
|
||||
```rust
|
||||
pub struct WidgetPalette {
|
||||
pub noninteractive: egui::Color32,
|
||||
pub inactive: egui::Color32,
|
||||
pub hovered: egui::Color32,
|
||||
pub active: egui::Color32,
|
||||
pub open: egui::Color32,
|
||||
}
|
||||
|
||||
impl WidgetPalette {
|
||||
pub fn apply_to(
|
||||
self,
|
||||
widgets: &mut egui::style::Widgets,
|
||||
radius: egui::CornerRadius,
|
||||
foreground: egui::Stroke,
|
||||
);
|
||||
}
|
||||
```
|
||||
|
||||
The implementation lives in [`crates/ui/src/theme`](../crates/ui/src/theme/mod.rs). It changes only
|
||||
those four properties. Borders, expansion, selection, shadows and the rest of egui's visuals
|
||||
stay untouched. Apps apply their state-specific exceptions afterward. `noninteractive` names
|
||||
egui's state, not a new disabled-control policy.
|
||||
|
||||
A separate `craft-theme` crate adds no useful boundary: this mechanism already depends on egui
|
||||
and belongs beside the controls it styles. A universal token structure, theme enum, application
|
||||
identifier or global context key is unnecessary. Constructing another large visual-options
|
||||
object would mostly rename `egui::Visuals` fields without simplifying their use. Context lookup
|
||||
and storage are already small and retain different fallback themes.
|
||||
|
||||
The identical packed-RGB helper in VectorCraft and DesignCraft is only a few casts; it remains
|
||||
local in this extraction. A contrast API also needs a second runtime consumer before extraction.
|
||||
|
||||
## Fonts and styling outside theme modules
|
||||
|
||||
Font setup occupies hundreds of the audited lines. It depends on app-specific font catalogs,
|
||||
locale handling and fallback order: PhotoCraft uses its text and preference crates; VectorCraft
|
||||
uses `vectorcraft_text`; DesignCraft and WordCraft use their font crates; PdfCraft adds script
|
||||
and system fallback; LightCraft uses its engine catalog; FilmCraft and EffectCraft use their text
|
||||
crates and local font discovery. DesignCraft also configures named Arabic shaping families.
|
||||
Those dependencies and the font files stay in the apps. What they had in common, the fallback
|
||||
order and the system-font fallback, is `craft_ui::fonts` (see the
|
||||
[craft-ui README](../crates/ui/README.md#ui-fonts)); each app hands it the faces it embeds.
|
||||
|
||||
Theme references occur throughout panels, menus and tools, with local visual/spacing overrides
|
||||
in every app. A source search alone cannot turn this into a percentage of correctly themed UI:
|
||||
many literal colors are document content, swatches, previews or intentional contrast choices.
|
||||
A search of UI source files outside `theme.rs` found the following. The columns count files,
|
||||
including tests, containing token/theme references, local visual/spacing mutation, or literal
|
||||
`Color32` construction. They are navigation aids, not counts of defective controls.
|
||||
|
||||
| App | Theme references | Local overrides | Literal colors |
|
||||
| --- | ---: | ---: | ---: |
|
||||
| PhotoCraft | 115 | 37 | 59 |
|
||||
| VectorCraft | 149 | 40 | 41 |
|
||||
| DesignCraft | 26 | 8 | 19 |
|
||||
| WordCraft | 10 | 4 | 9 |
|
||||
| PdfCraft | 40 | 11 | 30 |
|
||||
| LightCraft | 40 | 20 | 27 |
|
||||
| FilmCraft | 53 | 4 | 46 |
|
||||
| EffectCraft | 61 | 1 | 55 |
|
||||
|
||||
Examples worth preserving or reviewing separately:
|
||||
|
||||
- PhotoCraft's `widgets.rs` draws fixed light/dark Classic bevels and removes field chrome;
|
||||
`menus.rs` supplies its own menu styling.
|
||||
- VectorCraft's `widgets.rs` uses white primary-button labels and contrasting fill/stroke wells.
|
||||
- DesignCraft's `widgets.rs:147` sets focused numeric-field colors independently of High Contrast;
|
||||
fixed dialog warning/error colors also merit a later accessibility review.
|
||||
- WordCraft's ribbon Share control uses white; PdfCraft's notification surfaces and dialog
|
||||
widgets have local light/dark styling.
|
||||
- LightCraft's dialog download errors use a fixed hue, while its color helpers also draw actual
|
||||
photo-workflow values.
|
||||
- FilmCraft's header customizes menu chrome; EffectCraft's effect widgets and ScriptUI controls
|
||||
customize backgrounds and slider widths.
|
||||
|
||||
This extraction preserves those choices. It does not certify whole-app accessibility or theme
|
||||
consistency. Font installation is separate from theme application: `craft_ui::fonts` handles it.
|
||||
|
||||
## Migration and validation
|
||||
|
||||
1. Capture VectorCraft's four themes and DesignCraft's five, including High Contrast, before
|
||||
replacing either loop. Use synthetic documents, panels/inspectors, menus and preferences at
|
||||
1× and 2× scales. Save the complete egui Style and app Tokens for comparison.
|
||||
2. Add the shared helper with a test that preserves custom borders and expansion while replacing
|
||||
all state fills, including reapplying a theme after a local override.
|
||||
3. Replace only each app's five-state loop. Keep its existing colors, strokes, post-loop
|
||||
exceptions, fonts, spacing, context state, commands and saved preference schema.
|
||||
4. Repeat the renders and compare complete styles/tokens and images. Exercise theme commands,
|
||||
menu check states and an in-memory saved-preference round trip. A process restart or native
|
||||
display acceptance remains a separate check.
|
||||
5. Run shared fmt, strict Clippy, tests and wasm, then each app's own gates. Each app pins the
|
||||
shared revision independently and can revert its adapter/pin without migrating preferences.
|
||||
|
||||
The main risks are accidentally resetting inherited egui fields, losing DesignCraft's inactive
|
||||
outline exception or High Contrast colors, and confusing font/locale behavior with theme
|
||||
application. Exact style comparison plus visual checks covers the first two; keeping font code
|
||||
unchanged limits the third. Shared code depends only on egui, and layer checks keep it above
|
||||
engines and document models.
|
||||
|
||||
The suite trial also adopts LightCraft's identical loop. FilmCraft/EffectCraft's widget-state matrix
|
||||
and consistent focused numeric fields remain candidates for separate work. Theme adapters for the
|
||||
shared tabs and buttons now also serve PdfCraft, WordCraft, GridCraft, DeckCraft, CADCraft and
|
||||
SoundCraft; their full palettes stay local. Further extractions need two real consumers and their
|
||||
own visual and interaction checks.
|
||||
|
||||
[vector-loop]: https://github.com/storytold/vectorcraft/blob/825d4fdb8b527c597855d273fb4bcc1971855b6a/crates/ui-egui/src/theme.rs#L299-L312
|
||||
|
||||
[design-loop]: https://github.com/storytold/designcraft/blob/66c7ce7e96ec286a091878cc2541ee8369aa79d6/crates/ui-egui/src/theme.rs#L336-L348
|
||||
|
||||
[light-loop]: https://github.com/storytold/lightcraft/blob/88ea1a804b35709e1fe436e3792adf0428b97daa/crates/ui-egui/src/theme.rs#L235-L247
|
||||
@@ -1,270 +0,0 @@
|
||||
{
|
||||
"snapshot_date": "2026-10-09",
|
||||
"sources": [
|
||||
{
|
||||
"repository": "storytold/photocraft",
|
||||
"revision": "e7a83ca342cdff568254f85f442b9cc8afb08066",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/photocraft",
|
||||
"revision": "e7a83ca342cdff568254f85f442b9cc8afb08066",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/photocraft",
|
||||
"revision": "e7a83ca342cdff568254f85f442b9cc8afb08066",
|
||||
"path": "crates/ui-egui/src/icons.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/photocraft",
|
||||
"revision": "e7a83ca342cdff568254f85f442b9cc8afb08066",
|
||||
"path": "crates/ui-egui/src/dock.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/photocraft",
|
||||
"revision": "e7a83ca342cdff568254f85f442b9cc8afb08066",
|
||||
"path": "crates/ui-egui/src/rulers.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/photocraft",
|
||||
"revision": "e7a83ca342cdff568254f85f442b9cc8afb08066",
|
||||
"path": "crates/ui-egui/src/color_picker_ui.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/photocraft",
|
||||
"revision": "e7a83ca342cdff568254f85f442b9cc8afb08066",
|
||||
"path": "crates/ui-egui/src/menu_nav.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/photocraft",
|
||||
"revision": "e7a83ca342cdff568254f85f442b9cc8afb08066",
|
||||
"path": "crates/ui-egui/src/menu_nav_tests.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/photocraft",
|
||||
"revision": "e7a83ca342cdff568254f85f442b9cc8afb08066",
|
||||
"path": "crates/ui-egui/src/dock_tests.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/photocraft",
|
||||
"revision": "e7a83ca342cdff568254f85f442b9cc8afb08066",
|
||||
"path": "crates/ui-egui/src/dialogs.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/vectorcraft",
|
||||
"revision": "825d4fdb8b527c597855d273fb4bcc1971855b6a",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/vectorcraft",
|
||||
"revision": "825d4fdb8b527c597855d273fb4bcc1971855b6a",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/vectorcraft",
|
||||
"revision": "825d4fdb8b527c597855d273fb4bcc1971855b6a",
|
||||
"path": "crates/ui-egui/src/icons.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/vectorcraft",
|
||||
"revision": "825d4fdb8b527c597855d273fb4bcc1971855b6a",
|
||||
"path": "crates/ui-egui/src/dock.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/vectorcraft",
|
||||
"revision": "825d4fdb8b527c597855d273fb4bcc1971855b6a",
|
||||
"path": "crates/ui-egui/src/canvas.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/vectorcraft",
|
||||
"revision": "825d4fdb8b527c597855d273fb4bcc1971855b6a",
|
||||
"path": "crates/ui-egui/src/dialogs/color_picker.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/vectorcraft",
|
||||
"revision": "825d4fdb8b527c597855d273fb4bcc1971855b6a",
|
||||
"path": "crates/ui-egui/src/menus.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/designcraft",
|
||||
"revision": "66c7ce7e96ec286a091878cc2541ee8369aa79d6",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/designcraft",
|
||||
"revision": "66c7ce7e96ec286a091878cc2541ee8369aa79d6",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/designcraft",
|
||||
"revision": "66c7ce7e96ec286a091878cc2541ee8369aa79d6",
|
||||
"path": "crates/ui-egui/src/icons.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/designcraft",
|
||||
"revision": "66c7ce7e96ec286a091878cc2541ee8369aa79d6",
|
||||
"path": "crates/ui-egui/src/dock.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/designcraft",
|
||||
"revision": "66c7ce7e96ec286a091878cc2541ee8369aa79d6",
|
||||
"path": "crates/ui-egui/src/canvas.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/pdfcraft",
|
||||
"revision": "f626db25cca2c89f8fa3f7e30d22bf59faea65ec",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/pdfcraft",
|
||||
"revision": "f626db25cca2c89f8fa3f7e30d22bf59faea65ec",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/pdfcraft",
|
||||
"revision": "f626db25cca2c89f8fa3f7e30d22bf59faea65ec",
|
||||
"path": "crates/ui-egui/src/icons.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/pdfcraft",
|
||||
"revision": "f626db25cca2c89f8fa3f7e30d22bf59faea65ec",
|
||||
"path": "crates/ui-egui/src/dialogs.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/lightcraft",
|
||||
"revision": "88ea1a804b35709e1fe436e3792adf0428b97daa",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/lightcraft",
|
||||
"revision": "88ea1a804b35709e1fe436e3792adf0428b97daa",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/lightcraft",
|
||||
"revision": "88ea1a804b35709e1fe436e3792adf0428b97daa",
|
||||
"path": "crates/ui-egui/src/menubar.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/lightcraft",
|
||||
"revision": "88ea1a804b35709e1fe436e3792adf0428b97daa",
|
||||
"path": "crates/ui-egui/src/menu_level.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/filmcraft",
|
||||
"revision": "7b6c134472287db4367fca80bcb498240ba36567",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/filmcraft",
|
||||
"revision": "7b6c134472287db4367fca80bcb498240ba36567",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/filmcraft",
|
||||
"revision": "7b6c134472287db4367fca80bcb498240ba36567",
|
||||
"path": "crates/ui-egui/src/dock.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/effectcraft",
|
||||
"revision": "2a460986ee7a4b32656a3d434849693904b486bc",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/effectcraft",
|
||||
"revision": "2a460986ee7a4b32656a3d434849693904b486bc",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/effectcraft",
|
||||
"revision": "2a460986ee7a4b32656a3d434849693904b486bc",
|
||||
"path": "crates/ui-egui/src/dock.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/wordcraft",
|
||||
"revision": "d7d9702bda1fe626952024dc37fd2624323dad0f",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/wordcraft",
|
||||
"revision": "d7d9702bda1fe626952024dc37fd2624323dad0f",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/wordcraft",
|
||||
"revision": "d7d9702bda1fe626952024dc37fd2624323dad0f",
|
||||
"path": "crates/ui-egui/src/canvas.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/gridcraft",
|
||||
"revision": "51b531be3e8b3f5a19d2b7714a4780a79569ca92",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/gridcraft",
|
||||
"revision": "51b531be3e8b3f5a19d2b7714a4780a79569ca92",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/gridcraft",
|
||||
"revision": "51b531be3e8b3f5a19d2b7714a4780a79569ca92",
|
||||
"path": "crates/ui-egui/src/dialogs.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/deckcraft",
|
||||
"revision": "4b09f35c1d6fa50e2d94243a5d65d98fe49558e0",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/deckcraft",
|
||||
"revision": "4b09f35c1d6fa50e2d94243a5d65d98fe49558e0",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/deckcraft",
|
||||
"revision": "4b09f35c1d6fa50e2d94243a5d65d98fe49558e0",
|
||||
"path": "crates/ui-egui/src/canvas.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/cadcraft",
|
||||
"revision": "86f3199b400c271a1166103519b3785e4ac88e72",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/cadcraft",
|
||||
"revision": "86f3199b400c271a1166103519b3785e4ac88e72",
|
||||
"path": "crates/ui-egui/src/chrome.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/cadcraft",
|
||||
"revision": "86f3199b400c271a1166103519b3785e4ac88e72",
|
||||
"path": "crates/ui-egui/src/palettes.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/cadcraft",
|
||||
"revision": "86f3199b400c271a1166103519b3785e4ac88e72",
|
||||
"path": "crates/ui-egui/src/dialogs.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/soundcraft",
|
||||
"revision": "eac0edd896cd6bdf27c0cdd0f9f9158c8956248a",
|
||||
"path": "crates/ui-egui/src/theme.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/soundcraft",
|
||||
"revision": "eac0edd896cd6bdf27c0cdd0f9f9158c8956248a",
|
||||
"path": "crates/ui-egui/src/widgets.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/soundcraft",
|
||||
"revision": "eac0edd896cd6bdf27c0cdd0f9f9158c8956248a",
|
||||
"path": "crates/ui-egui/src/toolbar.rs"
|
||||
},
|
||||
{
|
||||
"repository": "storytold/soundcraft",
|
||||
"revision": "eac0edd896cd6bdf27c0cdd0f9f9158c8956248a",
|
||||
"path": "crates/ui-egui/src/edit_window.rs"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,240 +0,0 @@
|
||||
# Shared UI component audit
|
||||
|
||||
The best first extraction is the embedded SVG icon catalog used by PhotoCraft, VectorCraft and PdfCraft. It has a small boundary, real consumers and little dependence on application behavior. The pilot puts that machinery in `craft-ui::icons` and adopts it in all three apps. A second component, `craft-ui::buttons::IconButton`, is adopted by PhotoCraft and PdfCraft. The pane extension adds tab fitting and interaction in PhotoCraft/VectorCraft, split geometry in DesignCraft/PhotoCraft, and split geometry plus resize handles in FilmCraft/EffectCraft.
|
||||
|
||||
The broader opportunity is a collection of reusable UI components. All twelve Rust Craft apps use egui 0.36, but their themes, document models, numeric fields and docking behavior have evolved differently. Shared components should accept small style values and return interactions; each app should continue to choose its layout, command, localization and document semantics.
|
||||
|
||||
This covers item 3 of [craft-libs issue 2](https://github.com/storytold/craft-libs/issues/2). The [earlier four-app comparison](https://github.com/storytold/vectorcraft/issues/647) is useful background, but the findings below come from the pinned source revisions listed at the end. This is a source audit, not a claim that every application has passed interactive or cross-platform acceptance.
|
||||
|
||||
## Scope and current libraries
|
||||
|
||||
The inventory covers the twelve Rust editor apps. The current docking migration covers nine creative editors: PhotoCraft, VectorCraft, DesignCraft, LightCraft, FilmCraft, EffectCraft, SoundCraft, CADCraft and PdfCraft. The WordCraft, GridCraft and DeckCraft pilots remain supporting evidence for earlier component reuse and are outside that migration. Service repositories, fonts, test corpora, archived predecessors and unrelated organization repositories are outside the UI scope.
|
||||
|
||||
| App | Current UI and useful source | Behavior a shared component must preserve |
|
||||
| --- | --- | --- |
|
||||
| PhotoCraft | egui/eframe 0.36; [tokens][pc-theme], [widgets][pc-widgets], [SVG icons][pc-icons], [dock][pc-dock], [rulers][pc-rulers] | Five themes, raster units and resolution, foreground/background colors, grouped panels, tool cursors and command coalescing. |
|
||||
| VectorCraft | egui/eframe 0.36; [tokens][vc-theme], [widgets][vc-widgets], [SVG icons][vc-icons], [dock][vc-dock], [canvas rulers][vc-canvas] | Four brightness levels, point-based units, icon rails and flyouts, named/spot/gradient swatches, tool-name aliases. |
|
||||
| DesignCraft | egui/eframe 0.36; [tokens][dc-theme], [widgets][dc-widgets], [painter icons][dc-icons], [dock][dc-dock], [canvas][dc-canvas] | Four brightness levels plus high contrast, page/spread coordinates, mixed measurements, numeric spinners, floating panels and RTL text. |
|
||||
| PdfCraft | egui/eframe 0.36; [tokens][pdf-theme], [widgets][pdf-widgets], [SVG icons][pdf-icons], [dialogs][pdf-dialogs] | System/light/dark preferences, tool catalog, accessible button labels, PDF page coordinates and progress cancellation. |
|
||||
| LightCraft | egui/eframe 0.36; [tokens][lc-theme], [widgets][lc-widgets], [menus][lc-menu] | Develop control specifications, reset/fine-adjust gestures, catalog selection and label colors, preview-only explanations. |
|
||||
| FilmCraft | egui/eframe 0.36; [tokens][fc-theme], [widgets][fc-widgets], [dock][fc-dock] | Three themes, configurable highlights/contrast, split/tab workspaces, compact tool/meter panels, timecode and media focus. |
|
||||
| EffectCraft | egui/eframe 0.36; [tokens][ec-theme], [widgets][ec-widgets], [dock][ec-dock] | Three themes plus brightness adjustment, stacked panels and floating layouts, panel-local Tab navigation, composition/viewer identity. |
|
||||
| WordCraft | egui/eframe 0.36; [tokens][wc-theme], [ribbon widgets][wc-widgets], [canvas rulers][wc-canvas] | Light/dark appearance, contextual command availability and shortcuts, document theme colors, paragraph indents and tabs. |
|
||||
| GridCraft | egui/eframe 0.36; [tokens][gc-theme], [ribbon widgets][gc-widgets], [dialogs][gc-dialogs] | Light/dark appearance, spreadsheet cell styles and theme tints, formula/selection focus, command-backed dialogs. |
|
||||
| DeckCraft | egui/eframe 0.36; [tokens][deck-theme], [ribbon widgets][deck-widgets], [canvas rulers][deck-canvas] | Light/dark appearance, split buttons and galleries, slide theme references, contextual ribbon tabs and shape editing. |
|
||||
| CADCraft | egui/eframe 0.36; [tokens][cad-theme], [chrome][cad-chrome], [palettes][cad-palettes], [dialogs][cad-dialogs] | Drafting toggles, command-line state, model/layout tabs, CAD property types and multicolor painter icons. |
|
||||
| SoundCraft | egui/eframe 0.36; [tokens][sc-theme], [widgets][sc-widgets], [toolbar][sc-toolbar], [edit window][sc-edit] | Edit/mix controls, nonlinear dB meters, pan/fader interaction, record state and selectable audio rulers. |
|
||||
|
||||
The Rust applications keep egui at the frontend layer. The pilot follows that rule: only their UI crates depend on `craft-ui`; engine, document and rendering crates do not. Their layer checkers reject a direct dependency on the shared crate below the UI layer: L6 in PhotoCraft/VectorCraft/DesignCraft/WordCraft/GridCraft/DeckCraft/SoundCraft, L5 in FilmCraft/EffectCraft/LightCraft/CADCraft and L7 in PdfCraft. The crate depends on egui without enabling its default features. Apps retain their existing `egui_extras` SVG loader and renderer setup.
|
||||
|
||||
## Extraction priorities
|
||||
|
||||
These are proposed boundaries and adoption pairs, not a commitment to build a framework or migrate every app at once.
|
||||
|
||||
| Order | Component | Type of sharing | Initial consumers | Reference and reason |
|
||||
| --- | --- | --- | --- | --- |
|
||||
| 1 | Embedded SVG catalog | Extract with two small style policies | PhotoCraft, VectorCraft, PdfCraft | PhotoCraft's owned `Arc` bytes avoid leaked allocations; the existing loaders already have almost the same responsibilities. Implemented in the pilot. |
|
||||
| 2 | Small controls and component styles | Share components | PdfCraft and PhotoCraft for buttons; GridCraft and DeckCraft for ribbon pieces | PdfCraft exposes accessibility metadata on its painted controls. Keep the caller's label, geometry, colors, enabled state and command handling. Icon buttons and ribbon-tab interaction are implemented; split buttons and galleries remain proposed. |
|
||||
| 3 | Numeric editing state | Consolidate selected behavior | FilmCraft and EffectCraft, then LightCraft | EffectCraft adds finite-value checks and panel-local Tab behavior; LightCraft has explicit cancel/reset and step semantics. These are useful references, not interchangeable implementations. |
|
||||
| 4 | Swatch grid and color-field painting | Share components | WordCraft/GridCraft/DeckCraft for grids; PhotoCraft/VectorCraft for fields | The visual primitives overlap, while the values returned and color-management requirements differ. |
|
||||
| 5 | Menu viewport and navigation helpers | Consolidate selected behavior | PhotoCraft, LightCraft, VectorCraft | Scrolling, overflow and focus are reusable. Menu catalogs, native menus, shortcut resolution and dispatch remain app-owned. |
|
||||
| 6 | Ruler tick layout and painting | Standardize a primitive API | VectorCraft and DesignCraft, then PhotoCraft/WordCraft/DeckCraft | Share bounded tick placement and painting with caller-supplied labels and coordinates. Keep units, guide commands and paragraph markers outside. |
|
||||
| 7 | Pane controls | Share geometry and interactions; keep application policy in apps | PhotoCraft, VectorCraft, DesignCraft, FilmCraft, EffectCraft | Tabs, bounded splits and resize handles are implemented. The subsequent optional [docking model and renderer](ui-docking.md) have separate consumer migration and acceptance requirements. |
|
||||
|
||||
The [theme comparison](theme-infrastructure.md) verifies all eight principal theme modules and extracts their first common mechanism: `theme::WidgetPalette`, used by VectorCraft, DesignCraft and LightCraft to style egui widget states while retaining their full palettes.
|
||||
|
||||
Theme roles belong beside the components that consume them. `IconButtonStyle` contains fills, borders, icon and focus colors for the implemented button. That does not require all apps to replace their `Tokens` structs or serialize the same theme enum. Panels, inspectors and dialogs can then reuse those controls while retaining their application-specific contents.
|
||||
|
||||
## Icons and the first extraction
|
||||
|
||||
PhotoCraft embeds 118 SVGs, VectorCraft 259, and PdfCraft 184 through their `icon_data.rs` catalogs. PhotoCraft and PdfCraft have identical `white_icons` preparation functions at these revisions. VectorCraft uses the same replacement approach but leaks each prepared buffer to obtain a static slice. The pilot takes the owned-byte approach from PhotoCraft.
|
||||
|
||||
| Policy | PhotoCraft | VectorCraft | PdfCraft |
|
||||
| --- | --- | --- | --- |
|
||||
| `currentColor` replacement | `#ffffff` | `white` | `#ffffff` |
|
||||
| Exact two-unit stroke replacement | `1.75` | `1.6` | `1.75` |
|
||||
| Fallback icon | `square` | `square-dashed` | `square` |
|
||||
| Existing URI prefix | `bytes://icons/` | `bytes://icon/` | `bytes://icons/` |
|
||||
| Name used in fallback URI | Requested name | Requested name | Resolved fallback name |
|
||||
| Existing prepared storage | Shared `Arc` | Leaked static slice | Shared `Arc` |
|
||||
|
||||
`SvgIconSet` owns prepared bytes and returns egui image sources. Each app supplies its embedded catalog, literal SVG substitutions, URI prefix and fallback. Tool aliases, tint, size, labels and tool cursors remain in the app; the button component accepts the app's hover/selected/pressed style policy. SVG parsing and rasterization stay with `egui_extras`.
|
||||
|
||||
The pilot retains all three consumers' cache keys and exact SVG bytes. Its characterization tests cover all 561 catalog entries, tool aliases and missing-name fallbacks. Shared-crate tests cover both style policies, repeated shared-byte lookups, an absent fallback, duplicate names, lossy UTF-8 compatibility and actual SVG rasterization at 16, 24 and 48 pixels. See the [crate guide](../crates/ui/README.md) for the API and limits.
|
||||
|
||||
The SVG substitution is deliberately narrow: it preserves the existing literal replacements rather than becoming a general SVG/CSS processor. The catalog is trusted compiled-in data. A new set in the same egui context must use a distinct URI prefix, because egui caches by URI. The existing app prefixes remain appropriate when each app owns its context.
|
||||
|
||||
PdfCraft resolves the fallback name before requesting a source, preserving its existing URI policy. This replaces its indexed fallback lookup with the shared non-panicking lookup; the shared absent-fallback test covers a catalog without that entry. No icon assets move.
|
||||
|
||||
Most other Rust apps draw icons with egui's painter. Converting them all to SVG would be a separate visual change with different cost and fidelity questions. Common icon assets are a future candidate after checking file hashes, ownership and each app's asset manifest; ArtCraft trademarks remain outside such a library.
|
||||
|
||||
## Themes and common controls
|
||||
|
||||
The `Tokens` name does not imply a common schema. PhotoCraft combines palette, layout radii, layer-label colors and histogram styling. DesignCraft includes high contrast and page-layout chrome. FilmCraft and EffectCraft include timeline/panel colors; GridCraft's theme also covers grid headers and selection. CADCraft and SoundCraft use domain-specific colors for drafting or transport states. The [theme sources above](#scope-and-current-libraries) show why replacing them with a union of every field would increase coupling.
|
||||
|
||||
The implemented icon button uses an explicit style struct and a supplied icon painter. It returns `egui::Response` so the app owns dispatch. A future split button should return distinct main/arrow responses. Prefer stable IDs supplied by the caller to IDs derived from translated labels. Keep dimensions configurable where they already differ. Use PdfCraft's [button and split-pill accessibility metadata][pdf-widgets] and LightCraft's [control descriptions and tests][lc-widgets] as references; appearance alone is insufficient.
|
||||
|
||||
An icon button or ribbon split button should be accepted only after mouse, keyboard activation, disabled behavior, focus indication, accessible label and main-versus-arrow hit regions are covered. The icon button deliberately adds a visible keyboard-focus outline in PhotoCraft and PdfCraft, and an accessible label/selection state in PhotoCraft. Existing hover, selected and pressed treatments remain app-specific. Tests cover click cancellation, keyboard activation, disabled state, label translation without losing identity, duplicate labels and Tab order, focus painting, and invalid geometry. Ribbon split buttons remain proposed.
|
||||
|
||||
Inspectors remain app-owned. A layer inspector, a CAD property palette, a spreadsheet format panel and an audio mixer describe different document data and editing transactions. They can share labels, rows, numeric fields, sections and color chips without sharing a panel enum or pulling an engine into a UI utility crate. Similarly, common dialog framing can be separated from save confirmation, color sampling, export settings and progress/cancellation semantics.
|
||||
|
||||
## Numeric controls
|
||||
|
||||
[VectorCraft's fields][vc-widgets] parse document units and expressions, scrub labels, select text on focus and handle wheel/key steps with modifier policies. [DesignCraft's `NumField`][dc-widgets] carries measure/number kinds, optional mixed values and spinner controls. Both need their own unit conversion and commit rules.
|
||||
|
||||
[FilmCraft's `hot_number`][fc-widgets] and [EffectCraft's `hot_number_at`][ec-widgets] are a more focused comparison. EffectCraft supports panel-local Tab order, decimal commas, cancellation and finite-value validation, and returns drag-completion information. FilmCraft's simpler helper does not expose the same completion contract. [LightCraft's slider][lc-widgets] uses `ControlSpec`, stepped/clamped parsing, Shift for fine adjustment and double-click reset. Shift multiplies the film/effect scrub step instead. Sharing those gestures without a policy would change behavior.
|
||||
|
||||
A useful shared layer would manage the edit buffer, focus transitions and commit/cancel/drag lifecycle, with caller-supplied parse/format functions and step/modifier policy. It should return a value plus an edit phase; the caller groups undo history. Keep timecode, percentages, picas and color channels in adapters. Tests need non-finite values, invalid or inverted ranges, empty/mixed values, overflow, Escape, focus loss, Tab, repeated keys, wheel ownership and exactly one undo transaction per drag. Do not extract the current helpers wholesale before those differences are characterized.
|
||||
|
||||
## Colors and swatches
|
||||
|
||||
WordCraft's [color grid][wc-widgets] returns a hex string from RGB colors. GridCraft's [palette][gc-widgets] applies the spreadsheet model's tint function and also returns hex strings. DeckCraft's [grid][deck-widgets] returns `ColorRef`, preserving theme-slot references; it distinguishes no selection from an explicit no-color result. A shared grid should receive already-resolved display colors plus opaque IDs and return an ID. It must not flatten DeckCraft's theme reference into RGB or impose one tint formula on the three apps.
|
||||
|
||||
PhotoCraft's [picker][pc-picker] has component fields, Lab/CMYK/hex inputs, gamut/web warnings and canvas sampling, with foreground/background and command-backed commit behavior. VectorCraft's [picker][vc-picker] has a related field/slider model and feeds its own paint and swatch types. These are good sources for a shared 2D color-field painter and hit testing. Color conversions, profile choice, original/new color, sampling and dialog acceptance should remain injected or app-owned. An sRGB preview chip is not a document color model.
|
||||
|
||||
egui's built-in color widgets are worth using for simple sRGB controls. They do not replace these complete document-aware dialogs. Before sharing a custom field, test hue retention at zero saturation, field/slider round trips, out-of-range input, alpha previews and the app's existing color-profile behavior.
|
||||
|
||||
## Menus and dialogs
|
||||
|
||||
[PhotoCraft's menu navigation][pc-menu-nav] has scrolling and keyboard behavior with a [dedicated test module][pc-menu-tests]; `widgets::menu_scroll` also serves context menus. LightCraft separates a [menu level][lc-menu-level] from its menu definitions. VectorCraft's [menus][vc-menus] add dynamic labels, command availability, swatches, fonts and native-menu integration. Those are different layers.
|
||||
|
||||
Share viewport-constrained popup geometry, scrolling, hover delays and focus/navigation state before sharing a menu tree. Inputs should be display labels, stable IDs, checked/enabled state and callbacks or returned selections. The app resolves shortcuts, localizes labels and runs commands. Native menu services belong to issue 2's platform workstream, so this audit does not propose a second OS integration abstraction.
|
||||
|
||||
Dialog shells need explicit modality, Escape/default-button policy, focus restoration and child-popup handling. CADCraft uses ordinary [egui windows][cad-dialogs] for some tools; PhotoCraft has a [dialog stack][pc-dialogs] and canvas interactions during color sampling. One unconditional modal wrapper would lose these differences. Preserve existing save/cancel behavior and test nested popups, narrow windows and focus recovery before adopting a shell.
|
||||
|
||||
## Rulers and docking
|
||||
|
||||
[PhotoCraft's rulers][pc-rulers] use pixels and document resolution, have unit-menu/guide-drag tests and normalize flipped ranges. [VectorCraft][vc-canvas] and [DesignCraft][dc-canvas] use document units and their own tick/label painting; DesignCraft also has page/spread origins and stacked vertical labels. [WordCraft][wc-canvas] adds paragraph indent and tab-stop interaction. [DeckCraft][deck-canvas] paints slide rulers. SoundCraft's [ruler area][sc-edit] is based on audio time formats. A generic list of ticks can serve these consumers; a shared unit enum or guide controller cannot yet.
|
||||
|
||||
Start with an axis range, screen transform, tick budget and caller-produced labels. Tick generation must terminate for tiny zoom, non-finite values and enormous ranges. Guides, indent markers, unit menus and time conversion stay in adapters. Reuse the existing ruler tests as characterization and add bounded-work tests before extracting loops.
|
||||
|
||||
FilmCraft's [dock tree][fc-dock] has splits, fixed/relative sizes and tab groups. EffectCraft's [dock tree][ec-dock] adds stacks, floating layouts and additional panel/viewer identities. PhotoCraft's [dock][pc-dock] allocates vertical groups with preferred/minimum/fill heights and has [interaction/persistence tests][pc-dock-tests]. VectorCraft and DesignCraft also have icon rails and flyouts. These are related capabilities, not a single interchangeable serialized model.
|
||||
|
||||
The pane extraction compared [egui_dock 0.21.1](https://docs.rs/egui_dock/0.21.1/egui_dock/) and [egui_tiles 0.17.1](https://docs.rs/egui_tiles/0.17.1/egui_tiles/) at their egui 0.36 APIs. `egui_dock` offers binary fraction splits and floating egui windows within one OS window. `egui_tiles` offers tab, linear and grid containers with relative shares. Neither directly represents EffectCraft's accordion stack plus FilmCraft/EffectCraft's fixed-first/fixed-second sizing. Migrating either would require adapters for saved layouts, panel IDs and commands, as well as bounds on untrusted layout traversal. This source comparison does not establish runtime acceptance of either library.
|
||||
|
||||
The initial extraction kept a small boundary: `craft-ui::tabs` fits labels and registers accessible tab interactions; `craft-ui::layout` computes one bounded split and reports resize movement. At that stage, apps retained dock trees, panel contents, stacks, floating state and serialization. PhotoCraft and VectorCraft retained their existing overflow/drag policies in adapters; VectorCraft gained fitted tabs and an overflow menu. FilmCraft and EffectCraft retained fixed and relative sizing, with focusable resize handles. DesignCraft and PhotoCraft reused geometry for their existing split document views.
|
||||
|
||||
The subsequent optional `craft-ui::docking` module adds validated layout transactions, saved locations and an optional customizable renderer. Its [contract and host boundary](ui-docking.md) supersede the primitive-only boundary for consumers that adopt it. Panel registries, document state, commands, application menus and native window ownership remain in each app. Primitive-adapter checks do not establish acceptance of a later docking migration.
|
||||
|
||||
The shared geometry relaxes minima in tiny areas and rejects non-finite or inverted inputs. EffectCraft's former inverted-clamp case receives a synthetic regression test. Interaction tests cover pointer deltas, arrow keys, focus indication and AccessKit identity/value/actions; application tests retain responsibility for docking, pane focus, document cameras and saved layouts.
|
||||
|
||||
## Adoption and acceptance
|
||||
|
||||
`craft-ui` exposes focused components; each app adopts them independently through its UI crate and pins an immutable shared revision. The original primitive-adapter trial covered all twelve Rust apps; its evidence below is separate from the current nine-app docking integration:
|
||||
|
||||
| App | Shared mechanisms | Preserved application responsibilities |
|
||||
| --- | --- | --- |
|
||||
| PhotoCraft | SVG catalogs, icon buttons, tabs, split geometry | Five themes, Classic bevels, dock groups, canvas state and commands |
|
||||
| VectorCraft | SVG catalogs, tabs, widget-state theme application | Theme presets, dock/floating models and tool aliases |
|
||||
| DesignCraft | Split geometry, widget-state theme application | High Contrast, input exceptions, taskbars and document focus |
|
||||
| PdfCraft | SVG catalogs, icon buttons, document/Combine tab interaction | Horizontal scrolling, stable document IDs, dirty/RTL labels and close requests |
|
||||
| FilmCraft | Split geometry and resize handles | Fixed/relative pane sizing, workspace state and timeline focus |
|
||||
| EffectCraft | Split geometry and resize handles | Accordion stacks, floating layouts and composition identity |
|
||||
| LightCraft | Widget-state theme application | Full dark palette, label colors, fonts and catalog state |
|
||||
| WordCraft | Ribbon-tab interaction | File/backstage state, contextual tabs, double-click collapse and commands |
|
||||
| GridCraft | Ribbon-tab interaction and icon/toggle buttons | Formula/cell focus, command dispatch, undo and contextual tabs |
|
||||
| DeckCraft | Ribbon-tab interaction | Active-tab collapse, contextual selection, galleries and split buttons |
|
||||
| CADCraft | Icon buttons | Multicolor icon painting, disabled tint and drafting commands |
|
||||
| SoundCraft | Icon and record-enable buttons | Transport-specific colors, track arming and audio commands |
|
||||
|
||||
The trials reuse existing APIs except for an opt-in `IconButton::single_shape_frame()` method.
|
||||
SoundCraft paints fill and border with one `Painter::rect`; splitting them changes translucent
|
||||
edges. The option preserves that tessellation while the default retains existing consumers'
|
||||
separate fill/stroke behavior. A shared regression compares the original and adapted meshes at
|
||||
three display scales, enabled and disabled.
|
||||
|
||||
WordCraft's pressed/selected button precedence and DeckCraft's disabled hover behavior differ
|
||||
from the shared button contract, so those controls stay local. PdfCraft preserves inherited
|
||||
foreground-stroke widths; FilmCraft/EffectCraft use different foregrounds by widget state. Those
|
||||
themes retain their own application functions.
|
||||
|
||||
Acceptance is recorded per application. The suite trial compares native offscreen renders at
|
||||
normal and narrow widths and exercises keyboard, pointer, disabled and accessible-selection
|
||||
behavior through the real adapters. Matching renders preserve each application's current layout;
|
||||
they do not certify whole-app usability or physical-control behavior on every platform.
|
||||
|
||||
Six candidates remain held by existing application checks: CADCraft's renderer has a tautological
|
||||
test assertion rejected by Clippy; GridCraft has date-conversion and frontend boolean-expression
|
||||
lints; SoundCraft's CLI argument filter and WordCraft's hit-testing expression trigger
|
||||
`nonminimal_bool`; LightCraft has two GPU neural-network numerical failures; EffectCraft retains
|
||||
its earlier Audio Spectrum golden mismatch. The lint diagnostics occur in unchanged source with
|
||||
Rust 1.96. LightCraft's numerical failures also reproduce individually and together on its original
|
||||
commit with GPU denoising enabled. Their focused adapter checks pass, but the full application
|
||||
gates remain blocked. These candidates remain separate from the adapters whose complete local
|
||||
checks pass.
|
||||
|
||||
Run the shared crate's fmt, strict Clippy, tests and wasm check, followed by each adopting app's own gates. Compare actual UI renders at normal and narrow sizes, verify pointer and keyboard interactions, and distinguish passing focused checks from full application acceptance. Local path overrides are development tools; dependency manifests use immutable Git pins.
|
||||
|
||||
A shared UI dependency stays above the engine boundary, compiles for wasm, preserves source notices and avoids panic paths. An app can roll back adoption independently by reverting its adapter and dependency pin. Dock trees, layout persistence, document identity, command catalogs and platform windows remain app-owned.
|
||||
## Source revisions
|
||||
|
||||
Snapshot date: 2026-10-09. The source-audit links throughout this report resolve to the original revisions below. The later adapter scope is recorded above; source-audit revisions are not adapter release revisions.
|
||||
|
||||
| Repository | Revision |
|
||||
| --- | --- |
|
||||
| `storytold/cadcraft` | [`86f3199b400c`](https://github.com/storytold/cadcraft/tree/86f3199b400c271a1166103519b3785e4ac88e72) |
|
||||
| `storytold/deckcraft` | [`4b09f35c1d6f`](https://github.com/storytold/deckcraft/tree/4b09f35c1d6fa50e2d94243a5d65d98fe49558e0) |
|
||||
| `storytold/designcraft` | [`66c7ce7e96ec`](https://github.com/storytold/designcraft/tree/66c7ce7e96ec286a091878cc2541ee8369aa79d6) |
|
||||
| `storytold/effectcraft` | [`2a460986ee7a`](https://github.com/storytold/effectcraft/tree/2a460986ee7a4b32656a3d434849693904b486bc) |
|
||||
| `storytold/filmcraft` | [`7b6c13447228`](https://github.com/storytold/filmcraft/tree/7b6c134472287db4367fca80bcb498240ba36567) |
|
||||
| `storytold/gridcraft` | [`51b531be3e8b`](https://github.com/storytold/gridcraft/tree/51b531be3e8b3f5a19d2b7714a4780a79569ca92) |
|
||||
| `storytold/lightcraft` | [`88ea1a804b35`](https://github.com/storytold/lightcraft/tree/88ea1a804b35709e1fe436e3792adf0428b97daa) |
|
||||
| `storytold/pdfcraft` | [`f626db25cca2`](https://github.com/storytold/pdfcraft/tree/f626db25cca2c89f8fa3f7e30d22bf59faea65ec) |
|
||||
| `storytold/photocraft` | [`e7a83ca342cd`](https://github.com/storytold/photocraft/tree/e7a83ca342cdff568254f85f442b9cc8afb08066) |
|
||||
| `storytold/soundcraft` | [`eac0edd896cd`](https://github.com/storytold/soundcraft/tree/eac0edd896cd6bdf27c0cdd0f9f9158c8956248a) |
|
||||
| `storytold/vectorcraft` | [`825d4fdb8b52`](https://github.com/storytold/vectorcraft/tree/825d4fdb8b527c597855d273fb4bcc1971855b6a) |
|
||||
| `storytold/wordcraft` | [`d7d9702bda1f`](https://github.com/storytold/wordcraft/tree/d7d9702bda1fe626952024dc37fd2624323dad0f) |
|
||||
|
||||
[pc-theme]: https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/theme.rs
|
||||
[pc-widgets]: https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/widgets.rs
|
||||
[pc-icons]: https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/icons.rs
|
||||
[pc-dock]: https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/dock.rs
|
||||
[pc-rulers]: https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/rulers.rs
|
||||
[pc-picker]: https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/color_picker_ui.rs
|
||||
[pc-menu-nav]: https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/menu_nav.rs
|
||||
[pc-menu-tests]: https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/menu_nav_tests.rs
|
||||
[pc-dock-tests]: https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/dock_tests.rs
|
||||
[pc-dialogs]: https://github.com/storytold/photocraft/blob/e7a83ca342cdff568254f85f442b9cc8afb08066/crates/ui-egui/src/dialogs.rs
|
||||
[vc-theme]: https://github.com/storytold/vectorcraft/blob/825d4fdb8b527c597855d273fb4bcc1971855b6a/crates/ui-egui/src/theme.rs
|
||||
[vc-widgets]: https://github.com/storytold/vectorcraft/blob/825d4fdb8b527c597855d273fb4bcc1971855b6a/crates/ui-egui/src/widgets.rs
|
||||
[vc-icons]: https://github.com/storytold/vectorcraft/blob/825d4fdb8b527c597855d273fb4bcc1971855b6a/crates/ui-egui/src/icons.rs
|
||||
[vc-dock]: https://github.com/storytold/vectorcraft/blob/825d4fdb8b527c597855d273fb4bcc1971855b6a/crates/ui-egui/src/dock.rs
|
||||
[vc-canvas]: https://github.com/storytold/vectorcraft/blob/825d4fdb8b527c597855d273fb4bcc1971855b6a/crates/ui-egui/src/canvas.rs
|
||||
[vc-picker]: https://github.com/storytold/vectorcraft/blob/825d4fdb8b527c597855d273fb4bcc1971855b6a/crates/ui-egui/src/dialogs/color_picker.rs
|
||||
[vc-menus]: https://github.com/storytold/vectorcraft/blob/825d4fdb8b527c597855d273fb4bcc1971855b6a/crates/ui-egui/src/menus.rs
|
||||
[dc-theme]: https://github.com/storytold/designcraft/blob/66c7ce7e96ec286a091878cc2541ee8369aa79d6/crates/ui-egui/src/theme.rs
|
||||
[dc-widgets]: https://github.com/storytold/designcraft/blob/66c7ce7e96ec286a091878cc2541ee8369aa79d6/crates/ui-egui/src/widgets.rs
|
||||
[dc-icons]: https://github.com/storytold/designcraft/blob/66c7ce7e96ec286a091878cc2541ee8369aa79d6/crates/ui-egui/src/icons.rs
|
||||
[dc-dock]: https://github.com/storytold/designcraft/blob/66c7ce7e96ec286a091878cc2541ee8369aa79d6/crates/ui-egui/src/dock.rs
|
||||
[dc-canvas]: https://github.com/storytold/designcraft/blob/66c7ce7e96ec286a091878cc2541ee8369aa79d6/crates/ui-egui/src/canvas.rs
|
||||
[pdf-theme]: https://github.com/storytold/pdfcraft/blob/f626db25cca2c89f8fa3f7e30d22bf59faea65ec/crates/ui-egui/src/theme.rs
|
||||
[pdf-widgets]: https://github.com/storytold/pdfcraft/blob/f626db25cca2c89f8fa3f7e30d22bf59faea65ec/crates/ui-egui/src/widgets.rs
|
||||
[pdf-icons]: https://github.com/storytold/pdfcraft/blob/f626db25cca2c89f8fa3f7e30d22bf59faea65ec/crates/ui-egui/src/icons.rs
|
||||
[pdf-dialogs]: https://github.com/storytold/pdfcraft/blob/f626db25cca2c89f8fa3f7e30d22bf59faea65ec/crates/ui-egui/src/dialogs.rs
|
||||
[lc-theme]: https://github.com/storytold/lightcraft/blob/88ea1a804b35709e1fe436e3792adf0428b97daa/crates/ui-egui/src/theme.rs
|
||||
[lc-widgets]: https://github.com/storytold/lightcraft/blob/88ea1a804b35709e1fe436e3792adf0428b97daa/crates/ui-egui/src/widgets.rs
|
||||
[lc-menu]: https://github.com/storytold/lightcraft/blob/88ea1a804b35709e1fe436e3792adf0428b97daa/crates/ui-egui/src/menubar.rs
|
||||
[lc-menu-level]: https://github.com/storytold/lightcraft/blob/88ea1a804b35709e1fe436e3792adf0428b97daa/crates/ui-egui/src/menu_level.rs
|
||||
[fc-theme]: https://github.com/storytold/filmcraft/blob/7b6c134472287db4367fca80bcb498240ba36567/crates/ui-egui/src/theme.rs
|
||||
[fc-widgets]: https://github.com/storytold/filmcraft/blob/7b6c134472287db4367fca80bcb498240ba36567/crates/ui-egui/src/widgets.rs
|
||||
[fc-dock]: https://github.com/storytold/filmcraft/blob/7b6c134472287db4367fca80bcb498240ba36567/crates/ui-egui/src/dock.rs
|
||||
[ec-theme]: https://github.com/storytold/effectcraft/blob/2a460986ee7a4b32656a3d434849693904b486bc/crates/ui-egui/src/theme.rs
|
||||
[ec-widgets]: https://github.com/storytold/effectcraft/blob/2a460986ee7a4b32656a3d434849693904b486bc/crates/ui-egui/src/widgets.rs
|
||||
[ec-dock]: https://github.com/storytold/effectcraft/blob/2a460986ee7a4b32656a3d434849693904b486bc/crates/ui-egui/src/dock.rs
|
||||
[wc-theme]: https://github.com/storytold/wordcraft/blob/d7d9702bda1fe626952024dc37fd2624323dad0f/crates/ui-egui/src/theme.rs
|
||||
[wc-widgets]: https://github.com/storytold/wordcraft/blob/d7d9702bda1fe626952024dc37fd2624323dad0f/crates/ui-egui/src/widgets.rs
|
||||
[wc-canvas]: https://github.com/storytold/wordcraft/blob/d7d9702bda1fe626952024dc37fd2624323dad0f/crates/ui-egui/src/canvas.rs
|
||||
[gc-theme]: https://github.com/storytold/gridcraft/blob/51b531be3e8b3f5a19d2b7714a4780a79569ca92/crates/ui-egui/src/theme.rs
|
||||
[gc-widgets]: https://github.com/storytold/gridcraft/blob/51b531be3e8b3f5a19d2b7714a4780a79569ca92/crates/ui-egui/src/widgets.rs
|
||||
[gc-dialogs]: https://github.com/storytold/gridcraft/blob/51b531be3e8b3f5a19d2b7714a4780a79569ca92/crates/ui-egui/src/dialogs.rs
|
||||
[deck-theme]: https://github.com/storytold/deckcraft/blob/4b09f35c1d6fa50e2d94243a5d65d98fe49558e0/crates/ui-egui/src/theme.rs
|
||||
[deck-widgets]: https://github.com/storytold/deckcraft/blob/4b09f35c1d6fa50e2d94243a5d65d98fe49558e0/crates/ui-egui/src/widgets.rs
|
||||
[deck-canvas]: https://github.com/storytold/deckcraft/blob/4b09f35c1d6fa50e2d94243a5d65d98fe49558e0/crates/ui-egui/src/canvas.rs
|
||||
[cad-theme]: https://github.com/storytold/cadcraft/blob/86f3199b400c271a1166103519b3785e4ac88e72/crates/ui-egui/src/theme.rs
|
||||
[cad-chrome]: https://github.com/storytold/cadcraft/blob/86f3199b400c271a1166103519b3785e4ac88e72/crates/ui-egui/src/chrome.rs
|
||||
[cad-palettes]: https://github.com/storytold/cadcraft/blob/86f3199b400c271a1166103519b3785e4ac88e72/crates/ui-egui/src/palettes.rs
|
||||
[cad-dialogs]: https://github.com/storytold/cadcraft/blob/86f3199b400c271a1166103519b3785e4ac88e72/crates/ui-egui/src/dialogs.rs
|
||||
[sc-theme]: https://github.com/storytold/soundcraft/blob/eac0edd896cd6bdf27c0cdd0f9f9158c8956248a/crates/ui-egui/src/theme.rs
|
||||
[sc-widgets]: https://github.com/storytold/soundcraft/blob/eac0edd896cd6bdf27c0cdd0f9f9158c8956248a/crates/ui-egui/src/widgets.rs
|
||||
[sc-toolbar]: https://github.com/storytold/soundcraft/blob/eac0edd896cd6bdf27c0cdd0f9f9158c8956248a/crates/ui-egui/src/toolbar.rs
|
||||
[sc-edit]: https://github.com/storytold/soundcraft/blob/eac0edd896cd6bdf27c0cdd0f9f9158c8956248a/crates/ui-egui/src/edit_window.rs
|
||||
@@ -0,0 +1,111 @@
|
||||
# Dialogs
|
||||
|
||||
`craft_ui::dialog` holds the dialog shells, the prompts, and the host that runs an app's dialogs and keeps their answers. craft-ui-panels defines it; craft-ui-canvas adds `FullWindowDialog` and its parts, and the `craft-ui` facade re-exports that combined module.
|
||||
|
||||
| Type | Is |
|
||||
| --- | --- |
|
||||
| `Dialog` | A dialog on its own layer: modal or modeless, movable by its title band, with a focus trap and a footer of buttons. |
|
||||
| `DialogFrame` | The chrome every shell shares: title row, close action, footer region. |
|
||||
| `FullWindowDialog` | A dialog over the whole window. |
|
||||
| `BlockingOverlay` | A modal layer with no title, for work the window must not interrupt. |
|
||||
| `Prompt` | A question with answers on the modal preset of `Dialog`. |
|
||||
| `Alert`, `StandardPrompt`, `UnsavedChangesDialog`, `RecoveryDialog` | Configurations of `Prompt`. |
|
||||
| `DialogHost` | Runs the open dialogs of a window and keeps their results. |
|
||||
| `DialogStack` | Which open modal dialog takes the input. |
|
||||
|
||||
Form dialogs (`ParamDialog`, image size, properties, new document and others) build on these in `craft_ui::patterns::form_dialogs` (craft-ui-patterns).
|
||||
|
||||
## Dialog
|
||||
|
||||
`Dialog` is a container: build it, then `show(ui, body)`.
|
||||
|
||||
```rust
|
||||
let shown = Dialog::new("Layer Properties")
|
||||
.opened(Bind::bound(&mut state.properties_open))
|
||||
.remember(PROPERTIES_KEY)
|
||||
.close_on_enter(true)
|
||||
.buttons([FooterButton::new("OK", DialogRole::Accept), FooterButton::new("Cancel", DialogRole::Cancel)])
|
||||
.show(ui, |ui, cx| properties_body(ui, cx, &mut state.layer));
|
||||
if shown.output.picked == Some(0) {
|
||||
state.apply_properties();
|
||||
}
|
||||
```
|
||||
|
||||
- Open state: `opened` binds it to the app's value; without it the dialog keeps a session value that starts open. The close action, Escape and `BodyCx::request_close` write `false`.
|
||||
- Buttons: each `FooterButton` has a `DialogRole` (`Accept`, `Destructive`, `Cancel`, `Other`) that sets its look and its place in the row: the accepting button is last on macOS and Linux and first on Windows. A click closes the dialog unless the button `stays_open`. `FooterButton::letter` gives it an access letter.
|
||||
- Enter: with `close_on_enter`, Enter activates the enabled `Accept` button, so Enter and a click take the same path. Without such a button, Enter closes the dialog with `CloseReason::Enter`.
|
||||
- Output: `DialogOutput::closed` is the `CloseReason` in the pass the dialog closed, `picked` is the index of the button clicked or activated, and `result(answer)` turns them into a `DialogResult`.
|
||||
- Hooks: `close_guard` may refuse the close of a picked button, `on_pick` acts on a pick before the close is decided, and `settle_buttons` sets the buttons' state each pass after the body ran.
|
||||
|
||||
Other settings:
|
||||
|
||||
| Setting | Effect |
|
||||
| --- | --- |
|
||||
| `Dialog::prompt` | A prompt: centred, content capped, fixed in place, not remembered. |
|
||||
| `modeless` | A tool window: no modal layer and no backdrop. |
|
||||
| `viewport` | Shows the dialog in its own OS window, with the layer as the fallback where windows are unavailable. |
|
||||
| `resizable` | Edge grips resize it; the size is saved with `remember`. |
|
||||
| `remember` | Saves placement and size under a `SaveKey`. |
|
||||
| `initial_focus` | What takes focus when it opens (`runtime::focus::Initial`). |
|
||||
| `backdrop` | What is drawn behind a modal dialog (`runtime::overlay::Backdrop`). |
|
||||
| `outer_gesture` | One undo step over the body's edits from open to close: OK commits it, every other close takes the edits back. Modal dialogs only. |
|
||||
| `footer` | Content in a footer bar above the buttons. |
|
||||
|
||||
A modal dialog blocks input below it in every window, and a press outside does nothing.
|
||||
|
||||
## DialogHost
|
||||
|
||||
An app usually leaves its dialogs to the window's host. The `AppShell` of each window keeps one `DialogHost` and runs it after the body in every pass. A body reaches it with `BodyCx::dialogs`, which returns a `WindowDialogs` handle:
|
||||
|
||||
```rust
|
||||
if let Some(dialogs) = cx.dialogs() {
|
||||
dialogs.with(|host| {
|
||||
if delete_asked {
|
||||
host.open(StandardPrompt::confirm_delete([name], 1));
|
||||
}
|
||||
if let Some(DialogResult::Ok(answer)) = host.take::<StandardPrompt>() {
|
||||
if answer.choice == PromptChoice::Proceed {
|
||||
document.delete_layer();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
```
|
||||
|
||||
A dialog on the host is a `StackDialog`: the app builds the value, `open`s it, and reads `take::<D>()` on a later pass. `StackDialog::show` shows one pass and returns `Some(DialogResult)` on the pass it finished; the host then removes it and keeps the result. `DialogResult<T>` is `Ok(T)` or `Cancel`.
|
||||
|
||||
Rules of the host:
|
||||
|
||||
- One modal at a time: the newest open dialog takes the input. `open_child` opens a dialog over its parent; it closes with the parent.
|
||||
- One open dialog per type and `StackDialog::instance`. Opening a second one cancels the first and drops its untaken result. `open_unless_open` refuses while one is open.
|
||||
- A result stays until it is taken or a dialog of the same type and instance opens.
|
||||
- `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.
|
||||
- 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.
|
||||
- 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 `ParamDialog` with `tabs` shows a tab strip and the rows of the shown tab. Its own `params` are the shared rows, above the strip or under the tab's rows (`SharedRows`). Every tab's values open, are checked and answer together, whichever tab shows. A `ParamTab::read_only` tab shows its values without controls, under its note. A `read_only` dialog has only OK, no Alt reset, and answers with no values.
|
||||
- While the host runs its dialogs, or inside a `with` closure, `BodyCx::dialogs` returns `None`. A dialog that the host runs opens children through its own `DialogHost` value.
|
||||
|
||||
## DialogStack
|
||||
|
||||
`DialogStack` is the routing stack: `push(id, parent)`, `remove`, `remove_tree` (a parent and every dialog opened from it), `top`, `is_top`, `has_child`. `dialog_id(key)` gives a dialog its stable `DialogId`. The host keeps one; an app that shows a `Dialog` itself beside the host reads it with `DialogHost::stack`.
|
||||
|
||||
## Prompts
|
||||
|
||||
`Prompt::new(title, message)` takes `answers` (`FooterButton`s), and optionally `paragraph`, `lines`, `details` and `extras`. Escape and the close action give the escape answer: Cancel, else the first Other answer, else the default answer. Enter gives the Accept answer while that button is enabled. Both come back as `PromptOutput::picked`.
|
||||
|
||||
`StandardPrompt` is the set of confirmations every app asks the same way. Each one has the platform's button order and a letter on every answer, and Escape cancels:
|
||||
|
||||
| Constructor | Asks |
|
||||
| --- | --- |
|
||||
| `confirm_delete(names, count)` | Delete the items? |
|
||||
| `changed_on_disk` | The document's file changed on disk: Replace or Cancel. |
|
||||
| `replace_file` | A save would overwrite a file the save dialog did not ask about. |
|
||||
| `trash_mask` | Trash a layer mask: Apply, Delete or Cancel. |
|
||||
| `custom` | The app's own message and buttons. |
|
||||
|
||||
`dont_show_again` adds a check box. The answer is a `PromptAnswer`: its `choice` (`PromptChoice::Proceed`, `Alternate` or `Cancel`), `skip` (the box was ticked and the choice is Proceed; the app stores it) and the `tag` the app attached to say which question it answers.
|
||||
|
||||
`Alert` is a notice with one OK. `UnsavedChangesDialog` asks Save, Don't Save or Cancel for one document and answers an `UnsavedAnswer`. `RecoveryDialog` offers to recover documents an earlier run autosaved, and answers a `RecoveryChoice`: a `RecoveryAnswer` and whether to apply it to every document still waiting.
|
||||
+120
-768
@@ -1,816 +1,168 @@
|
||||
# Panel docking
|
||||
# Docking
|
||||
|
||||
`craft_ui::docking` lets the user arrange an app's panels: tab groups, docks with columns,
|
||||
splits, floating windows and iconic columns. craft-ui owns the layout model, the renderer and the
|
||||
gestures. The app owns panel contents, commands, document state and where layouts are saved.
|
||||
Docking has three layers:
|
||||
|
||||
Office apps that draw their own document with a few task panes beside it use
|
||||
[`craft_ui::panes`](ui-panes.md) instead.
|
||||
| Layer | Holds |
|
||||
| --- | --- |
|
||||
| `craft_behavior::dock` (craft-behavior) | The model: `Workspace`, `Layout`, `Node`, `Action`, `Permissions`, `WorkspaceSet`. No egui; this is the saved data. |
|
||||
| `craft_ui::docking` (craft-ui-panels) | The parts: `SplitArea`, `DockGroup`, `DockColumn`, `IconicColumn`, `Flyout`, `FloatingGroup`, `DockRoot`, `Splitter`; drop resolution; the dock commands. |
|
||||
| `craft_ui::patterns::dock` (craft-ui-patterns) | The patterns an app shows: `DockArea` over a workspace, `PaneArea` for task panes, `WorkspaceSwitcher`. |
|
||||
|
||||
## Arrangements
|
||||
|
||||
One model serves every app. What differs between apps is the default layout and a few
|
||||
`DockStyle` settings. An app builds its style with `DockStyle::from_ui`, `from_visuals` or
|
||||
`default` and then sets fields; new fields can be added, so the struct has no literal form
|
||||
outside the crate.
|
||||
|
||||
| Arrangement | Layout | Style settings | Apps |
|
||||
|---|---|---|---|
|
||||
| Docks beside a canvas (the defaults) | `Node::Dock`s on the window's start and end edges. A dock has columns; a column has stacked groups and can collapse to icons. Frames (tab groups and splits) fill the space between the docks. | `new_dock_zones` on | Creative apps with a canvas and panel docks |
|
||||
| A split tree of tab groups | `Split`s and `Tabs` only. | `side_edge_zones`, `maximize_item`, `close_others_item`, `command_press_floats`, `float_hint`, `wheel_selects_tabs`, `middle_click_closes_tabs` on, `new_dock_zones`, `float_on_empty_drop` and `title_bar_docks` off; menu labels such as "Undock Panel" set on `float_label`, `float_group_label` and `close_group_label` | Apps whose whole window is frames |
|
||||
|
||||
Sides are logical: `Side::Start` is the left edge, or the right edge when
|
||||
`DockStyle::right_to_left` is set. egui has no app-wide direction, so the app sets it from its
|
||||
locale. Right to left, tab strips also mirror: the first tab is rightmost, the group header and
|
||||
drag bar are at the left, and drop insertion slots follow. Accordion headers and floating title
|
||||
bars (`chrome::TitleBar`, through `ChromeStyle::right_to_left`) mirror too. Frame splits keep
|
||||
their sides.
|
||||
An app with dockable panels shows a `DockArea`. The parts are for patterns that need one piece, such as a two-body split.
|
||||
|
||||
## Model
|
||||
|
||||
`Layout<P>` holds an optional root `Node<P>` and a list of `Floating` windows.
|
||||
A `Workspace` is a saved arrangement: its `layout()` and the `hidden()` panels with the place each one goes back to. Its fields are private; it changes only through its methods. A `Layout` is a docked tree (`root: Option<Node<P>>`) plus floating windows (`floating: Vec<Floating<P>>`). `P` is the app's panel key. Every panel occurs once.
|
||||
|
||||
| Node | Holds |
|
||||
|---|---|
|
||||
| `Tabs` | A tab group: panels and the active index. |
|
||||
| `Split` | Two children, horizontal or vertical, and a size: a ratio, a fixed first size or a fixed second size. A moved divider keeps the mode: a fixed side stores its new size in points, a ratio its new ratio. |
|
||||
| `Stack` | Accordion entries, each open or closed, with an optional height. |
|
||||
| `Dock` | A side and its columns. A `Column` has `Group`s, a width, and `iconic`. |
|
||||
`Node` has four forms:
|
||||
|
||||
A `Floating` window holds a tree like the docked layout's (`root`: splits, tab groups and
|
||||
accordions, no docks), a rect, an optional native-window rect with the monitor it is on, and
|
||||
`minimized`. Its `id` names the window across panel moves (see [Native windows](#native-windows)).
|
||||
`Floating::single` makes a window with one group, `Floating::new` one with a tree, and
|
||||
`Floating::stack` one with groups stacked top to bottom (a vertical split sized by the groups'
|
||||
heights, as an app's own stacked layouts migrate); `panels()` and `contains()` read it. Each of
|
||||
these calls makes a new window with a fresh `id`. Build a layout once and keep it, or give its
|
||||
windows ids with `with_id`: a layout built anew each frame, as an unsaved default layout might
|
||||
be, otherwise opens new OS windows each frame and loses their drags and places. Debug builds log
|
||||
a warning when native windows are replaced by new ones with the same panels three frames running. Saved layouts keep loading: a window stored as one group (v1) or as a
|
||||
stack of groups loads as that group or as a vertical split of the stacked groups, sized by their
|
||||
heights.
|
||||
- `Split`: two children along an `Axis`, sized by a `SplitSize`.
|
||||
- `Tabs`: a group of panels with one active tab.
|
||||
- `Stack`: an accordion; each `StackEntry` keeps its open state and height when other panels move.
|
||||
- `Dock`: the dock on one window edge (`DockEdge`), with its `Column`s from the edge inwards. At most one per side.
|
||||
|
||||
`P` is the app's panel id: stable, not localized, `Clone + Eq + Hash`. The renderer also needs
|
||||
`Debug + Send + Sync + 'static`. A panel occurs at most once in a layout.
|
||||
A floating window is one `Column` that floats: its groups stacked top to bottom, nothing beside them. Every column, docked or floating, collapses to icons (`Column::iconic`, `Action::SetIconic`) on its own.
|
||||
|
||||
Change a layout only through `Action`s:
|
||||
The tree is in reading order: a split's first child is its start (or top) child. Under right-to-left the renderer maps rects with `Flow::to_physical`.
|
||||
|
||||
Edits are `Action`s: `Move`, `Float`, `Close`, `Activate`, `Open`, `OpenAt`, `MoveFloating`, `ResizeSplit`, `SetIconic` and the rest. `Workspace::apply` and `Workspace::apply_all` apply them against each panel's `Permissions` and the lock, and refuse what the rules forbid with a `DockError`. `Permissions::ALL` allows everything. `Permissions::PROTECTED` is a document canvas: it stays docked and open, and takes neither tabs nor side splits.
|
||||
|
||||
To load a saved workspace:
|
||||
|
||||
1. Deserialize it (`Workspace` implements `serde`).
|
||||
2. Check it with `Workspace::validate`. Keep a file that fails, or that comes from a newer `Workspace::VERSION`, on disk; do not overwrite it.
|
||||
3. Call `Workspace::reconcile` with the panels the app registers now and a default workspace.
|
||||
|
||||
`WorkspaceSet` holds the app's named workspaces (built-in and saved), the current one and Lock Workspace.
|
||||
|
||||
## DockArea
|
||||
|
||||
```rust
|
||||
use craft_ui::docking::{Action, Floating, Layout, Node, Placement};
|
||||
|
||||
let mut layout = Layout {
|
||||
root: Some(Node::Tabs { panels: vec!["layers", "properties"], active: 0 }),
|
||||
floating: vec![Floating::single(vec!["brushes"], 0, [40.0, 80.0, 240.0, 300.0]).with_id(1)],
|
||||
};
|
||||
layout.apply(Action::Move {
|
||||
panel: "brushes",
|
||||
anchor: "layers",
|
||||
placement: Placement::Tab { before: Some("properties") },
|
||||
})?;
|
||||
# Ok::<(), craft_ui::docking::DockError>(())
|
||||
let mut panels = Panels { document: &mut state.document };
|
||||
let mut area = DockArea::new("Dock", Bind::bound(&mut state.workspace), &state.specs, &mut panels, DockConfig::default());
|
||||
if let Some(panel) = state.maximized {
|
||||
area = area.maximized(panel);
|
||||
}
|
||||
for event in area.show(ui).events {
|
||||
if let DockEvent::ToggleMaximize { panel, .. } = event {
|
||||
state.maximized = if state.maximized == Some(panel) { None } else { Some(panel) };
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
- `Move`, `MovePanel`, `Float` and `Close` act on one panel. `MoveGroup`, `MoveColumn` and
|
||||
`MoveWindow` move a group, a dock column or a floating window, named by any panel in it.
|
||||
- `Open` reveals an absent panel as the last tab of its `anchor`'s group. Without an anchor it
|
||||
becomes the root of an empty layout, else joins the first dock group that accepts tabs and is
|
||||
shown, not minimized or in an iconic column (the end-side dock's first), else gets a new frame a quarter wide at the right edge of the docked
|
||||
area. `OpenAt` takes any placement.
|
||||
- A `Target` is `At { anchor, placement }`, `Float { rect }` or `NewDock { side }`.
|
||||
- A `Placement` is a tab position, a split zone, a new group above or below (with an optional
|
||||
preferred `height`), a new column, or a new frame on an outer edge.
|
||||
- Containers take different placements: a dock column takes groups and columns, not splits.
|
||||
`Placement::for_zone(layout, anchor, zone, right_to_left)` maps a left, right, top, bottom or
|
||||
center zone onto what the anchor's container takes: a split in the frame tree, a new column on
|
||||
that side or a new group above or below in a dock. A floating window takes splits as the
|
||||
docked layout does; `Placement::Group` on a floating anchor splits its group above or below.
|
||||
- A side split zone puts what moves in a new half-size split of the anchor's frame, and no
|
||||
other frame changes size. The new split has its own divider. `Placement::SplitSized` sizes
|
||||
that split instead (`size`) and resizes the enclosing split whose divider runs along the
|
||||
anchor frame's side (`outer`), so the frames beyond that divider give the new frame its room.
|
||||
- Other actions select, minimize, collapse to icons, resize splits (`ResizeSplit` in the docked
|
||||
layout, `ResizeWindowSplit` in the floating window holding a panel), columns and groups, and
|
||||
move a floating window to its own OS window (`SetNative`, and `SetMonitor` for the monitor it
|
||||
is on, feature `native-windows`).
|
||||
- A move between windows (docked to floating, floating to floating) is one action, checked as a
|
||||
whole like any other.
|
||||
The host holds the workspace as an `Arc<Workspace<P>>` (`state.workspace`): a pass shares it instead of cloning it, and an edit writes a new one (`Arc::make_mut`). Keep that one `Arc` across frames and clone the `Arc`, not the workspace: a new workspace value is a new revision, so a host that wraps a fresh copy each frame makes the area read every spec each frame.
|
||||
|
||||
Every action checks the whole result before it commits. A bad target, a duplicate id, a stale
|
||||
split path or invalid geometry returns a `DockError` and leaves the layout unchanged. The source
|
||||
panel is never lost. `apply`, `apply_with_permissions` and `apply_all` return the panels the
|
||||
actions closed, so the app can release their state; `closed_by` lists them before applying.
|
||||
|
||||
`Permissions` limit what may happen to a panel: `movable`, `floatable`, `closable`,
|
||||
`accepts_tabs` and `accepts_splits`. `apply_with_permissions` enforces them for every action,
|
||||
whoever issues it. `Permissions::PROTECTED` keeps a canvas docked and open and takes neither tabs
|
||||
nor side splits; a group dropped on it floats there. An app that opens panels beside its canvas
|
||||
uses `Permissions { accepts_splits: true, ..Permissions::PROTECTED }`.
|
||||
|
||||
## Workspace
|
||||
|
||||
`Workspace<P>` is what an app saves: the layout, the hidden panels with where each one goes back,
|
||||
an optional saved arrangement for Reset, and `locked`.
|
||||
The host keeps its panels' specs in a plain-data model that implements `PanelSpecs<P>`, held in a `Tracked` (`state.specs`):
|
||||
|
||||
| Method | Does |
|
||||
|---|---|
|
||||
| `apply`, `apply_all` | Apply actions all or none, with the app's permissions. Closed panels are recorded in `hidden`. While `locked`, moving, floating and closing are refused; `SetNative`, which records the OS windows, still applies. |
|
||||
| `set_visible(panel, visible, fallback, permissions)` | Hide a panel that may close, or show it at its recorded place, else as `Open` beside `fallback`, or where `Open` without an anchor puts it. A group or window closed one panel at a time comes back as one group as its panels are shown again. |
|
||||
| `reconcile(registered, permissions, default)` | Fit a loaded workspace to the panels the app has now. Unknown panels move to `hidden`, so they come back when registered again. A registered panel that cannot close, such as the canvas, is always shown. |
|
||||
| `reset(default)` | Return to the saved arrangement, or to `default` for a built-in workspace. |
|
||||
| `validate` | Check a loaded workspace before use. |
|
||||
| --- | --- |
|
||||
| `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`. |
|
||||
| `permissions` | The panel's `Permissions` (default `ALL`). |
|
||||
|
||||
With the `serde` feature, `Workspace`, `Layout` and `Action` serialize. Files without a version
|
||||
are v1 and load unchanged. craft-ui does not choose where files go; the app does.
|
||||
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.
|
||||
|
||||
## Rendering
|
||||
The area reads them only when the model's revision, the workspace's revision or the lock changes (`runtime::derived`), and keeps what it read otherwise, so an idle pass reads no spec. A host changes a label or a limit by editing the model. A spec reads no style: a tool rail's grid is `DockGrid::rail(cells)`, which the dock sizes from its own tokens.
|
||||
|
||||
`DockArea::new(id).show_content(ui, &layout, &style, &mut content)` draws a layout snapshot and
|
||||
returns a `DockOutput`. It does not change the layout. The app applies `output.actions` through
|
||||
its own command path, so pointer, keyboard and control commands share one path.
|
||||
The host implements `DockPanels<P>` for the views:
|
||||
|
||||
`DockContent<P>` is the app's adapter. It draws each panel body and gives its label, icon,
|
||||
permissions, size limits, dock column heights, preferred floating size, panel menu and group header. The group header
|
||||
sits at the end of the tab strip; `group_header_width` gets the strip width, so a header that
|
||||
draws its own tabs can size them to the room left. Extra tabs (`group_extra_tabs_width` and
|
||||
`group_extra_tabs`) sit right after the group's panel tabs, before the drag bar, and fit with
|
||||
them: both shrink widest first to `min_tab_width`, the extra tabs as one tab, and in a row
|
||||
narrower still the panel tabs overflow while the extra tabs keep that width. The host fits its
|
||||
own tabs into the rect it gets. An icon is an image (`icon`), or drawn in code by `paint_icon`, which
|
||||
gets a painter, the icon rect and the tint color and returns true when it painted. Panel bodies keep a stable egui id when they move, so widget memory
|
||||
survives.
|
||||
| Method | Does |
|
||||
| --- | --- |
|
||||
| `body` | Shows the panel's body in the group's body, which the group insets by the panel padding (`Pad::Regular`). The group is the body's panel, so the body adds no `Panel` or padding of its own. A document panel's body (`WindowKind::Document`) is shown edge to edge. |
|
||||
| `group_view` | Takes a whole group in place of its tab strip and body, in a `Ui` held to the group's rect; a canvas group draws its document here. Default `None`. |
|
||||
| `group_header` | The host's controls in a group header, before the tab strip. |
|
||||
| `panel_rows` | The host's rows of a panel's menu, before the dock's own. |
|
||||
|
||||
`DockOutput` also has:
|
||||
A body lays out with the group's spacing, which framework components expect. A panel whose body is the app's own egui code sets `PanelSpec::host_body()`: the dock then hands its `body`, `footer`, `group_header`, `rail_footer` and, while it is the panel its group shows, its group's `group_view` a `Ui` with the style of the `Ui` the area was shown in, so that code lays out as it does outside the dock. Its body also keeps the app's background and room: the dock fills the body with that style's panel fill (`Visuals::panel_fill`) and gives it no body padding, and a press on the body is the app's, so it does not focus the group's tabs. That code runs once per pass, in the pass's real run: where the framework measures a group before it shows it, the code's parts take the size they took when they last ran, and egui sees each of the app's widgets once (`HostStyle::show`). The dock's own parts keep the framework style. An app hosting its old egui panels moves onto the framework panel by panel, clearing `host_body` on each panel it ports.
|
||||
|
||||
- `focused`: the panel the user focused this frame: a clicked tab, a drop, or a press of any
|
||||
pointer button in a panel body (protected panels included) or in the group header,
|
||||
which focuses the group's shown panel. Commands, `raise_panel` and
|
||||
workspace resets never set it; a host that tracks the last focused panel clears it when a reset
|
||||
or command hides, closes or moves that panel.
|
||||
- `events`: requests outside the layout, such as `DockEvent::ToggleMaximize` (`maximize_item`) and
|
||||
`DockEvent::ToggleAutoCollapse` and `DockEvent::FlyoutChanged { panel }` (docks): the
|
||||
flyout opened, switched or closed (`None`). It comes once per change, whatever made it: an
|
||||
icon, Escape, a press outside, a raised panel, `open_flyout` or `close_flyout`.
|
||||
- `error`: a rejected gesture.
|
||||
The binding decides who applies the edits. With `Bind::bound` the area writes every action to the workspace itself. With `Bind::given` it writes nothing, and the host applies `DockAreaOutput::actions` (or `edit`, the same changes as edit events) to its own copy: the actions hold every change of the pass, divider sizes and window moves included. `DockArea::read_only` shows a workspace locked, keyed by its revision.
|
||||
|
||||
Builder options on `DockArea`:
|
||||
A panel body, or code a body calls, changes the workspace during the pass with `docking::request_actions(ctx, actions)`, never by writing the workspace the area shows. The running area takes them unapplied and returns them in `DockAreaOutput::requested`, in order, for the host to apply after `actions` in the same frame. With no area over that panel type running, `request_actions` hands the actions back for the caller to apply.
|
||||
|
||||
| Option | Use |
|
||||
|---|---|
|
||||
| `maximized(panel)` | Maximize Frame: that frame fills the area. |
|
||||
| `hide_panels(HidePanels)` | Hide panels for Tab and Shift+Tab. Protected panels stay. |
|
||||
| `auto_collapse_iconic(on)` | Close a flyout on Escape or a click outside (default off: a flyout stays open until its icon or another icon is clicked). |
|
||||
| `raise_panel(panel)` | Raise a panel's floating window, or open its flyout, this frame. It moves no keyboard focus and does not set `DockOutput::focused`. |
|
||||
| `locked(on)` | Draw `Workspace::locked`: every panel gets `Permissions::locked`, so nothing starts a move, float or close the workspace would refuse. |
|
||||
| `blocked_rects(rects)` | App overlays that docking gestures must ignore. |
|
||||
| `float_bounds(rect)` | Where floating windows, flyouts and drag ghosts may go (default: the whole viewport). Pass the viewport below a title bar drawn under a transparent OS title bar, so no floating window sits where a press moves the app window. |
|
||||
Props: `hide` (`HidePanels::None`, `All` or `Except`), `maximized`, `auto_collapse`, `locked`, `raise` (the floating window holding the panel comes to the front in this pass: an OS window gets the focus, an in-app window goes to the top of the floating windows; a host passes it in the pass after it opens or activates a floating panel), and `flyout`, which binds the open flyout to the host's value (the area keeps it otherwise). A hidden panel keeps its place for restore. Inside an `AppShell`, the shell's hiding wins over `hide`: while it hides the panels and keeps the tools (Shift+Tab, `ShellCx::panels_hidden`), only the panels an `Except` names stay, docked or floating (a toolbar); while it hides the dock (Tab), no panel shows. Under Tab and Shift+Tab, an edge the pointer reveals (`ShellCx::edge_revealed`) shows its `Start` or `End` dock, with the host's `hide` applied to it. Protected panels always show.
|
||||
|
||||
`DockStyle::close_menu_items` and `DockStyle::close_button` hide the built-in Close menu items
|
||||
and the floating window ×. They hide controls only: a panel that stays `closable` still closes
|
||||
by the app's own Close items and commands.
|
||||
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`.
|
||||
|
||||
`DockArea::chrome_has_focus` tells whether keyboard focus is on docking chrome (any control a
|
||||
`Hit` names) rather than on a panel body. Focus follows only the user's input: a tab keeps keyboard focus until a command or a
|
||||
workspace reset hides, closes or moves its panel, and then gives it up. A divider or a floating
|
||||
window's resize grip holds focus only while the pointer drags it, so the app's shortcuts and
|
||||
canvas arrow keys work right after; one reached with Tab or F6 keeps its focus, and arrow keys
|
||||
resize it. Hovering focuses nothing. `begin_drag` hands a drag that started in the app's own chrome to the area.
|
||||
`docking::chrome` has the floating frame, the title bar and `drop_preview` (the drag ghost
|
||||
and region preview docking and `craft_ui::panes` both draw) for apps that draw their own windows.
|
||||
`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.
|
||||
|
||||
## Tab strips
|
||||
The host handles these `DockEvent`s:
|
||||
|
||||
Tabs start at their natural width, wide enough for the panel's name. When the strip is too
|
||||
narrow, the widest tabs shrink first, to a common width; tabs whose names fit that width keep
|
||||
their natural width. A tab narrower than its name cuts the name with "…" and shows it in full as a
|
||||
tooltip. Shrunk tabs keep their hit areas, drag and keyboard behaviour, and accessibility labels
|
||||
with the full names.
|
||||
| Event | Host does |
|
||||
| --- | --- |
|
||||
| `ToggleMaximize` | Sets or clears the panel it passes as `maximized`. |
|
||||
| `ToggleAutoCollapse` | Flips its preference and passes it back. |
|
||||
| `PanelCommand` | Carries out Move Panel To and Move Group To: asks for a destination and calls `move_actions`. |
|
||||
| `FlyoutChanged` | Nothing when the area or a write-through binding holds the flyout; applies the request when the binding is given. |
|
||||
| `DocumentPicked` | Shows the document in the panel (the area has activated the panel). |
|
||||
| `DocumentClosed` | Closes the document and removes it from the panel's spec. |
|
||||
| `FloatPlaced` | Reports for a host that anchors its own surfaces to the dock; `DockAreaOutput::columns` gives every column's rect each pass. |
|
||||
|
||||
No tab shrinks below `DockStyle::min_tab_width`: by default about three characters and the "…"
|
||||
plus the tab's padding, 54 pt at the 12 pt font. Only when the tabs at that width do not all fit
|
||||
do the rest go to the "…" button at the end of the strip, whose menu lists the hidden panels;
|
||||
choosing one makes it active. The active tab is always shown, in its logical place, and the
|
||||
others take the remaining room in their order. An active tab with less room than its minimum
|
||||
width, or a lone tab wider than the strip, is cut the same way. The drag bar always keeps its
|
||||
reserved width: tabs shrink, then overflow, before it narrows, and only a strip narrower than the
|
||||
group header plus the bar shrinks it. A tab dropped on the "…" button goes to the end of the group.
|
||||
## DockConfig
|
||||
|
||||
## Floating size
|
||||
| Field | Default | Effect |
|
||||
| --- | --- | --- |
|
||||
| `side_edge_zones` | off | Picture-frame profile: deep side zones on groups, and the outer start and end edges add full-height columns. |
|
||||
| `drop_edges` | `DockSides::ALL` | Which outer edges (and sides of a group that takes no tabs) take a drop. |
|
||||
| `new_dock_zones` | on | The start and end edges of the docked area take a drop as a new dock. |
|
||||
| `close_others_item`, `maximize_item` | off | Group menu items Close Other Panels in Group and Maximize Frame. |
|
||||
| `float_on_empty_drop` | on | A release over no drop target floats what the drag carries. Off: it cancels the drag. |
|
||||
| `title_bar_docks` | on | Dragging a floating window's title bar onto a target docks the whole window. |
|
||||
| `close_menu_items`, `close_button` | on | Built-in Close items, and the close action on floating windows. |
|
||||
| `tab_close_buttons` | off | Close buttons on tabs (middle click closes too), for tabs that act as documents. |
|
||||
| `panel_menu_always` | off | Every group shows its panel menu button, with the dock's own rows when the shown panel has none. Off: only a panel with rows of its own (`DockPanels::panel_rows`) gets the button. |
|
||||
| `panel_menu_icon` | `more` | The panel menu button's icon; `menu` gives the three-line mark. |
|
||||
| `native_windows` | on | Floating windows open as OS windows where the window host opens them and reports their positions (not on Wayland) and `PanelSpec::allow_native` allows. |
|
||||
|
||||
A panel or group floated by a drag, a menu or a command without a rect takes its content height:
|
||||
the title bar, the tab strip and the height the active panel's content used when it was last
|
||||
drawn (the content ui's `min_rect`), at least 120 points. The most it takes is the height of
|
||||
`DockContent::floating_size`, or 320 points for a panel leaving a dock or frame and a group
|
||||
leaving a dock. A short panel therefore floats as a short window. Content that reaches the bottom
|
||||
of its body (a panel that allocates its whole rect) has no height of its own: it floats at the
|
||||
`floating_size` height, else at 320 points. A panel's width is its `floating_size` width, else
|
||||
its docked width; a group keeps its docked width.
|
||||
A flyout fits its content the same way, without the title bar.
|
||||
The theme's docking sizes (`DockSizes`) set the drop bands and zones. `DockWords` holds the words.
|
||||
|
||||
- A panel the area has not drawn floats at the `floating_size` height, else the docked height
|
||||
capped at 320, or at a `FloatSpace::with_panel_size` size for commands.
|
||||
- A group from a frame without a `floating_size` keeps its frame size. A dock column of several
|
||||
groups floats at the tallest `floating_size` height, else its column height capped at 320.
|
||||
- A rect from a command and a window the user resized keep their size; floating windows are not
|
||||
refitted while open.
|
||||
- Docked layout does not change: a column's last group still fills the column.
|
||||
## Rules
|
||||
|
||||
## Gestures
|
||||
- A tab drag carries a `PanelDrag`; a group or column drag carries a `GroupDrag`. Groups and columns register `DockSpot`s in `DockTargets`, and `resolve_drop` maps the spot under the pointer to an `Action`.
|
||||
- A column collapsed to icons takes drops as an expanded column does: its edges (a new column beside it, docked only), the seams between its icon groups, the top of the first group and the bottom of the last (a new group above or below), and each icon group's cells (join its tabs). The column's state wins: a panel dropped into a collapsed column shows as an icon, one dropped into an expanded column shows expanded.
|
||||
- Nothing goes beside a floating window: its column registers no edge bands, and its groups (`DockGroup::in_window`) take no drop on their start and end sides.
|
||||
- A collapsed column's flyouts open on the side `IconicColumn::opens` names: away from a dock's window edge, and towards the room of the float area for a floating window. A floating window keeps to its edge of the float area: `Floating::edge`, else the one nearer its rect. A move keeps the edge it began with. A collapsed window's move ends at the edge nearer its strip where it was dropped, with the rect that shows the strip there (`WindowColumn::dropped`), and the area records that edge (`Action::MoveFloating`'s `edge`); a unit dragged out of a collapsed column (`start_icon_drag`) floats collapsed the same way, its strip under the pointer (`Target::Float`'s `edge`). Collapsing a floating column and moving an expanded window clear the edge. A column that neither collapses nor has steps shows no double arrow and offers no collapse in its menu (`ColumnArrow::Fixed`).
|
||||
- A panel that lays its content in a grid (a toolbar) declares it with `PanelSpec::grid` (`DockGrid`: the width at one content column, the width each further column adds, and the most columns; `DockGrid::rail` for a tool rail, sized by the dock). Its column, given steps (`Column::steps`), is a whole number of content columns wide. Docked, it takes the dock's height like any column, its content at the top (the references' docked toolbar keeps its surface down to the dock's foot), and content taller than the dock scrolls inside; floating, it is as tall as the content measures at that width, under the title row, at the window's place. A drag of the column's edge, or of a floating window's side, sets the most steps that fit, and a drag of a floating window's left side keeps its right edge, one of its top its bottom edge; a drag of a floating window's top or bottom sets the fewest whose content fits. When the column's panels do not collapse, its double arrow switches between one and two steps (`ColumnArrow::Steps`), named for the count it switches to and pointing the way the column grows or shrinks. A dock side's total width (`DockSizes::resize_side`) leaves a stepped column's width alone.
|
||||
- A floating window whose every group is minimized shows its title row and their tab strips, at its rect's place and width (`WindowColumn::minimized`). Its sides resize its width, never its height, and its rect, in the app window and in an OS window's recorded placement, keeps the expanded height, which the window takes back when a group is restored. A window with some groups open keeps its size, and its open groups share the room the strips leave.
|
||||
- Ctrl or Cmd held at the release floats the drop. A release over the dragged unit's own group leaves it where it is.
|
||||
- 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.
|
||||
- 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.
|
||||
- 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.
|
||||
|
||||
- A tab drags one panel. A group's drag bar (the space beside its tabs) or its top border drags
|
||||
the whole group. A column bar drags a column. A floating window's title bar drags the window;
|
||||
with `title_bar_docks` a release over a target docks the whole window there, else it only
|
||||
moves. While the drag highlights a drop target, the window is drawn at 75% opacity so the
|
||||
target shows through it; over empty space, and once the drag ends, it is opaque. A native
|
||||
window moved by its only tab or tab row fades the same way.
|
||||
- Inside a floating window, tabs and drag bars drag and dock as they do in the docked layout,
|
||||
into any window. A drag bar or border of a window's only group takes the whole window along,
|
||||
so, like the title bar, it looks through the window: the groups, docks and windows behind it
|
||||
take the drop while the pointer is still inside it. In a window of several groups, the other
|
||||
groups stay targets. Its groups split, join and resize like frames, with dividers and four-way
|
||||
handles (`Divider::WindowSplit` and `Divider::WindowIntersection`, named by the window's first
|
||||
panel). Double-clicking the title bar minimizes the window to its title bar, or to the tab strip
|
||||
of its only group; so does double-clicking that group's strip. The group menu's float item
|
||||
floats one group of a window that has several. Closing the window closes its panels; each
|
||||
reopens where it was while the window or its neighbour in it is open, else in a window at the
|
||||
window's last rect.
|
||||
- A movable floating window resizes from every edge and corner. The top edge and corners are a
|
||||
4 pt band above the title bar (`chrome::RESIZE_BAND`), so they take no moves and no clicks on
|
||||
the title bar's buttons. A resize keeps the opposite edges in place and stays within the size
|
||||
limits and the screen. A focused resize handle moves its edge 8 pt per arrow key.
|
||||
- Over a group (a frame, a dock column's group or a floating group), the pointer's place
|
||||
decides:
|
||||
- The tab strip joins the group's tabs at the insertion slot under the pointer.
|
||||
- In the body below the strip, the outer `DockStyle::side_zone_fraction` (one third) of its
|
||||
width from the left or right edge, or of its height from the top or bottom edge, docks
|
||||
beside the group on that side. Where two sides meet, at a corner, the side the pointer is
|
||||
relatively nearer wins.
|
||||
- The middle third joins the group's tabs.
|
||||
- A group that takes no tabs, such as a protected canvas, takes nothing on its strip, and its
|
||||
body has no middle: every point docks beside it on the relatively nearest side.
|
||||
- In the docking profile (`new_dock_zones` without `side_edge_zones`), the body of a frame or
|
||||
floating group that takes no tabs takes nothing, whatever its `accepts_splits`: a release
|
||||
there is a release over no target, so a floating window stays floating and a docked panel
|
||||
or group floats as `float_on_empty_drop` says. Only the bands along borders (below) dock
|
||||
beside it, as in Adobe apps, whose document area is no drop zone. A dock column's group
|
||||
keeps its sides.
|
||||
- Beside a frame is a split of that frame. Beside a group in a dock column, the top and bottom
|
||||
stack a new group above or below it, and the left and right make a new column on that side.
|
||||
A group dragged to an edge of its own column, such as the window edge of the column it heads,
|
||||
makes a new column there, as one of its tabs would; when it is the column's only group,
|
||||
nothing changes.
|
||||
- A frame too narrow or short for two halves of `DockStyle::min_pane` still splits when the
|
||||
frames beyond it can give the room, as they do for a dragged divider. When they cannot, the
|
||||
frame keeps its size and the new frame takes the width (or height) the moved panels have now,
|
||||
at least its minimum, from the frames beyond the frame's divider on that side
|
||||
(`Placement::SplitSized`). When those have no room either, that side joins the frame's tabs
|
||||
instead, or takes nothing when the frame takes no tabs. The gap
|
||||
between two frames is no target.
|
||||
- Bands along borders come before the group zones. Each is centred on its border where the
|
||||
pointer can reach both sides:
|
||||
## Commands and workspaces
|
||||
|
||||
| Band | Drop | Field (default) |
|
||||
|---|---|---|
|
||||
| The seam between two stacked groups of a dock column | A new group between them | `seam_band` (28 pt) |
|
||||
| Each edge of a dock column | A new column on that side | `column_edge_band` (28 pt) |
|
||||
| The docked area's left or right edge without a dock, and an empty dock | A new dock | `new_dock_band` (28 pt) |
|
||||
| The edge area's top and bottom in `drop_edges` (all four sides with `side_edge_zones`) | A new frame along that whole side, a quarter of the edge area | `edge_band` (28 pt, 8 pt with `side_edge_zones`; at most a quarter of the edge area) |
|
||||
| Set | Commands | Run with |
|
||||
| --- | --- | --- |
|
||||
| `DockCommands` | Float, move, close, step, minimize, collapse to icons, maximize | The `DockArea` itself. A host that shows its own dock calls `actions` and `Workspace::apply_all`. |
|
||||
| `WorkspaceCommands` | Reset, New, Delete, Lock | `run_workspace`, which returns a `WorkspaceAsk` when the host must ask for a name or a workspace. `WorkspaceSet::select` switches. |
|
||||
| `ArrangeCommands` | Arranging document windows | `arrange` over `DocumentWindows`. |
|
||||
|
||||
Where a band overlaps a group's outer third, both mean the same side. Without
|
||||
`side_edge_zones`, a band reaches only 4 pt past its line into a tab strip that takes tabs;
|
||||
the rest of the strip joins. The outer
|
||||
edge band is offered only when every frame keeps its minimum.
|
||||
- The edge area is the root, or the part between the docks. Without `side_edge_zones` it also
|
||||
narrows to the canvas column: where neither side of a side-by-side split is a dock and only
|
||||
one side holds a protected panel, that side. The top (bottom) band also narrows a split of
|
||||
rows to its first (last) row when only that row holds the canvas, so a full-width row below
|
||||
the canvas keeps the bottom band. Side panels in split frames then get no band across the
|
||||
whole window, and the drop wraps only the canvas column. A drop on a narrowed band anchors
|
||||
on the canvas, so `Placement::Edge` narrows the same way when applied; on a band that is not
|
||||
narrowed it anchors on a panel that is not protected. The renderer tries the drop with its
|
||||
own permissions and offers the band only when the drop wraps the panels the band shows.
|
||||
`window.panel.dock` to an outer edge picks its anchor the same way, from the permissions
|
||||
`apply` (or `to_actions`) gets and the area's `FloatSpace` (`with_side_edge_zones` before it
|
||||
has drawn).
|
||||
- `DockStyle::drop_edges` (a `Sides`, all four by default) lists which sides of the layout's
|
||||
outer edge, and of a group that takes no tabs (a canvas) without `new_dock_zones`, take a
|
||||
drop. There a canvas's whole body goes to the nearest listed side; with none listed it takes
|
||||
nothing. In the docking profile the canvas body takes no drop and the outer left and right
|
||||
edges are new docks, so only the outer top and bottom apply. Groups that take tabs keep all
|
||||
four sides. A dock-column app whose palettes dock only at the left
|
||||
and right, as in AutoCAD, sets `Sides::NONE` with `new_dock_zones` on. Not used with
|
||||
`side_edge_zones`.
|
||||
- With `side_edge_zones` (the split-tree arrangement), a frame's zones are a picture frame
|
||||
instead: trapezoids along the four edges of the body below the tab strip, all four the same
|
||||
depth, `docking::SIDE_EDGE_ZONE_DEPTH` (40 pt), or a quarter of the body's smaller side when
|
||||
that is less, so every frame keeps a center. A dock column's groups take the same depth.
|
||||
`drop_zone` and `resolve_drop` give these zones to hosts that draw their own frames.
|
||||
- A host that resolves drops over its own groups calls `resolve_drop_by` with
|
||||
`DockStyle::zone_rule()`, so its zones and previews match the dock area's in either profile.
|
||||
`resolve_drop` always gives the split-tree zones.
|
||||
- A dragged divider grows the frames that touch it on one side, up to their maximums. On the
|
||||
other side the frame touching it shrinks to its minimum, then the next frame along the same
|
||||
axis, and so on: the divider stops when every frame on that side is at its minimum. Frames
|
||||
side by side across the axis shrink together, and the next frame gives way once one of them
|
||||
is at its minimum. The line of frames ends at a split across the axis or at a dock; every
|
||||
other frame keeps its size. Dividers between stacked panels and between the groups of a dock
|
||||
column work the same way. Where a divider ends on another divider, a four-way handle
|
||||
(`Divider::Intersection`) moves both.
|
||||
- Every frame has the same minimum, `DockStyle::min_pane` (plus its tab strip), unless its panels
|
||||
ask for more through `PanelLimits::min`. Frames have no maximum unless every panel in them asks
|
||||
for one through `PanelLimits::max`: a panel without a maximum lifts the maximum of the panels it
|
||||
joins.
|
||||
- A dock column stacks its groups top to bottom. A minimized group shows only its tab strip, and a
|
||||
group the user resized keeps that `Group::height`. A group the user never resized (`height` is
|
||||
`None`) takes the default height its panels ask for through `DockContent::dock_heights`. Groups
|
||||
whose panels ask for a `fill` height share the rest of the column, and groups whose panels ask
|
||||
for no heights take their minimum. When no group asks for a fill, the groups without heights
|
||||
share the rest, and when every open group has a height, the last one fills the column. In a short column the groups at their default give way first, down
|
||||
to their `compact` heights, so the filling group gets its `fill` height. When the column is still
|
||||
too short, every group gives way down to its minimum, and past that the column scrolls. Defaults
|
||||
give way nearest the filling group first: one is at its compact height before the next gives
|
||||
way. Towards the minimums, groups give way in proportion to their room. A group takes the
|
||||
largest default, compact and fill height of its panels. All three are body heights, without
|
||||
the tab strip, like `PanelLimits`.
|
||||
- Drop previews have four shapes, the same for tab and group drags:
|
||||
- A drop beside something shows the rect the dragged panel, group or column will take, at its
|
||||
real position and size, as a 2 pt accent outline with a light fill. The renderer applies
|
||||
the drop to a copy of the layout and lays it out with the code that draws it, so the rect
|
||||
is the one the panel's group gets on release: the new frame for a split (including
|
||||
`Placement::SplitSized`), the new group for a stack above or below a dock group or on a
|
||||
seam, and the whole column, bar included, for a new column between columns or beside a
|
||||
dock group's side.
|
||||
- A drop on a band along the layout's outer edge shows a `DockStyle::drop_line_width` (4 pt)
|
||||
accent line along that edge: the new-dock band, the window edge of a dock's outermost
|
||||
column, and the outer edge band (`Placement::Edge`), whose line spans the edge area it
|
||||
wraps. A drop between the icon groups of an iconic column shows the same line there.
|
||||
- A drop that joins a group shows the same outline and fill around the whole group, and on
|
||||
its strip the 2 pt insertion marker.
|
||||
- A drop that floats shows the floating rect.
|
||||
`WorkspaceSwitcher` is a select over the set's names with the workspace commands in its list.
|
||||
|
||||
A drop that would leave every panel where it is, changing only sizes, shows nothing and
|
||||
changes nothing: a lone group dropped beside the group it already borders, or a frame's tab
|
||||
on the layout edge the frame already holds. Split sizes, column widths, group heights and
|
||||
window rectangles are not compared, and a run of splits along one axis is the same however
|
||||
it nests.
|
||||
## Floating and native windows
|
||||
|
||||
A group drag also shows its ghost at the pointer. With `side_edge_zones`, a drag over a group
|
||||
instead outlines each of its zones that a drop would change something in (the side
|
||||
trapezoids, the center rectangle and the tab strip; `zone_shape` gives the outlines) and
|
||||
fills the zone under the pointer. Sides the group does not take, by its permissions or
|
||||
because a split leaves no room, are not drawn; nor is the center of the group a tab comes
|
||||
from. A drop there that the zones do not show, such as the outer edge band, fills the region
|
||||
it takes, and dock drops show the line along the edge they dock to. Escape or losing window focus cancels a drag.
|
||||
- A drag in progress (a tab, group, column, window bar, native window bar or divider, in any of
|
||||
the app's windows) also ends when the layout passed to the area is not the one it drew last
|
||||
frame, with or without its returned actions applied: the app switched workspaces, ran Reset
|
||||
or changed the layout by command. Sizes and rectangles are not compared, so an app may clamp
|
||||
a moved window or adjust a split during the drag. Nothing is restored from before the drag;
|
||||
windows go where the new layout has them. `cancel_drag` ends the area's drags at any other
|
||||
time. A native window moved by the compositor (`ViewportCommand::StartDrag`, as on Wayland)
|
||||
is not the area's drag: it ends when the user releases the button. On macOS, where AppKit
|
||||
moves a native window by its bar, a cancel ends the area's drag, so the release drops
|
||||
nothing, but AppKit keeps moving the window until the release.
|
||||
- With `float_on_empty_drop`, a release over no target floats what moves at the pointer, such
|
||||
as a panel dropped on a protected canvas. Without it, that release cancels the drag and
|
||||
nothing moves: the gap between two groups, a menu bar or a status bar is no target. A release
|
||||
outside the app window floats in both cases.
|
||||
- Ctrl (⌘ on macOS) held at the drop floats it wherever it lands. With `command_press_floats`,
|
||||
the key held when a tab drag of a frame starts is enough. With `float_hint`, a hint under the
|
||||
pointer names the modifier while a drag offers a docking target: `float_hint_label`, where
|
||||
`{key}` becomes ⌘ or Ctrl.
|
||||
- Double-click a tab or drag bar to minimize a group to its strip.
|
||||
- Right-click a tab for its menu, or a drag bar for the group menu; Enter or Space on a focused
|
||||
drag bar opens it too. A left click on the drag bar only focuses it.
|
||||
- With `DockStyle::wheel_selects_tabs`, the mouse wheel over a tab strip selects the next or
|
||||
previous tab. With `middle_click_closes_tabs`, a middle click on a closable panel's tab closes
|
||||
it.
|
||||
- A column's »/« button collapses it to icons, one icon per panel with a separator between groups.
|
||||
Widen an iconic column to show panel names. Click an icon to open its group as a flyout on the
|
||||
canvas side. Drag an icon to move its panel, or an icon group's top edge (the separator line above it) to move the group.
|
||||
A floating window is a `Floating` in the layout: its one `column`, its `rect` in logical points in the app's viewport, and `native` and `monitor` while it is an OS window. `FloatingGroup` shows it, with the column inside drawn as a dock column is (`ColumnBar::Window`): the window's title row is the column's bar, whose double arrow, like a double click on the row, collapses the column to icons. The title row is one text row high (`HeaderStrength::Bar`). A window in the main window keeps a band above it for its top grip (`contract::grip_band`), so the grip never covers the row; an OS window keeps none, and on macOS AppKit resizes it from its own edges, with no app grips there (`DockSizes::window_chrome`). A collapsed window shows its icons against the edge of the float area it keeps to, under a title row of the band and the double arrow alone (a context request on the band opens the window's menu), and keeps its expanded size for when it expands. Its sides resize its width, and only its width, within the bounds of a docked collapsed column (`DockSizes::iconic_bounds`), on every platform and in the main window alike; names show beside the icons from `IconicSizes::labels`, and the width is the column's `iconic_width` (`Action::ResizeIconic`, `FloatingGroupOutput::collapsed_width`), kept across collapse and expand. With `DockConfig::native_windows` (on by default), every floating window opens in its own OS window (`docking::native`) where the window host opens OS windows and reports where they are (`WindowHost::positions_reported`; not on Wayland); a window never shown native yet opens over its place in the main window. Elsewhere, and for a panel with `allow_native` off, the window stays inside the main window. The OS close of a native window is its Close action: the window closes when every panel in it may close. Dragging a native window by its title row moves the whole window and docks it where it is released over a group of the main window, as a floating window inside the main window does: the app runs that move (`Overlay::moved_by_app`, which the group's mount carries, so the window is opened knowing it). On macOS the row's press hands the move to the OS, the app follows the system pointer and button (`Caps::OS_MOVES_TRACKED`), and a press that ends within the click distance is a click, which docks nothing; elsewhere the app moves the window, and Escape puts it back. The app sends an OS window its place only when the app changes it (an undo, a reloaded layout); the OS's own moves and resizes are recorded and never sent back. `window_kind` says whether an OS window is a document or a tool window. A tool window's title row is its only title bar, whatever frame the main window has (`craft_window::policy::tool_frame`).
|
||||
|
||||
## Commands
|
||||
A panel or group floated out of the dock (a drag, the Float command, a tab torn out of the window) opens at the width it had docked and at the height its group measures at in a floating window's room (`Proposal::Size`), at most `size.float.height`: content that fills its body opens at that height, other content at its own. A column opens at its docked size, at most that height. The area measures once, where the float starts: for a drag in the pass it starts, which adds the size to the drag's payload (`runtime::drag::amend`). A panel's own `PanelSpec` float size wins, and a window that already floats keeps its size.
|
||||
|
||||
With the `serde` feature, `DockCommand<P>` is the shared control vocabulary. The app puts the
|
||||
command id under `"command"` in the params and deserializes them. craft-ui has no `serde_json`
|
||||
dependency.
|
||||
## SplitArea on its own
|
||||
|
||||
```rust,ignore
|
||||
let mut params = params.clone();
|
||||
params["command"] = json!(id);
|
||||
let command: DockCommand<PanelId> = serde_json::from_value(params)?;
|
||||
if command.is_app_owned() {
|
||||
return app.workspace_command(command);
|
||||
}
|
||||
let space = float_space(ctx, DOCK_ID).unwrap_or_else(|| FloatSpace::new(ctx.content_rect()));
|
||||
let closed = command.apply(&mut app.workspace, style.right_to_left, &space, |panel| app.permissions(panel))?;
|
||||
```
|
||||
`SplitArea::new(label, layout, rules)` shows the docked tree of a `Layout` with handles between groups; `FrameRules` give each panel's limits. `SplitArea::pair(label, axis, bodies, share, rules)` is a two-body split with one divider. The host keeps the share and reads its edits from `SplitAreaOutput::share`; the timeline's track split works this way.
|
||||
|
||||
| Id | Params (`?` is optional) |
|
||||
|---|---|
|
||||
| `window.panel.layout` | `{action}`: a serialized `Action` |
|
||||
| `window.panel.move` | `{panel, anchor, zone?, before?, group?, placement?}` |
|
||||
| `window.panel.float` | `{panel, x?, y?, width?, height?, group?, column?}` |
|
||||
| `window.panel.dock` | `{panel, anchor?, zone?, before?, group?, column?, side?}` |
|
||||
| `window.panel.activate`, `.close`, `.closeGroup`, `.closeOthers` | `{panel}` |
|
||||
| `window.panel.minimize` | `{panel, minimized?}` |
|
||||
| `window.panel.iconic` | `{panel, iconic?}` |
|
||||
| `window.panel.window` | `{panel, native?}` |
|
||||
| `window.workspace`, `.new`, `.delete` | `{name}` |
|
||||
| `window.workspace.reset`, `ui.dock.reset` | `{}` |
|
||||
| `window.workspace.lock` | `{locked?}` |
|
||||
| `ui.dock` | `{action}`, or `{operation, …}` |
|
||||
## PaneArea
|
||||
|
||||
- `zone` is `tab`, `center`, `left`, `right`, `top`, `bottom`, `above` or `below`. `before` names
|
||||
the tab to insert before; `null` appends. `left`, `right`, `top` and `bottom` follow
|
||||
`Placement::for_zone`, so beside a docked panel they make a new column or group. `apply` and
|
||||
`to_actions` take the layout's `right_to_left` for that.
|
||||
- `group` moves the panel's whole group; `column` moves its dock column, or its whole window when
|
||||
it floats. `side` is `Start` or `End`: what moves becomes a new last column of that dock, or
|
||||
a new dock; when it already is that dock's last column, the command does nothing.
|
||||
- `window.panel.dock` with `left`, `right`, `top` or `bottom` and no `anchor` or `side` makes a
|
||||
new frame on that outer edge (`Placement::Edge`), wrapping what a drag to that edge would
|
||||
(see the edge area above). A hidden panel is shown first.
|
||||
- Showing a panel (`activate`, `dock` without a destination, `ui.dock` `open`) restores a hidden
|
||||
panel's place; a panel never laid out opens as `Open` without an anchor does.
|
||||
- `window.panel.float` without a rect floats what it moves at the size a drag floats it at (see
|
||||
Floating size). It goes
|
||||
inside the dock area, 24 points from its top-left corner, so it stays clear of the menu bar.
|
||||
The area records that geometry in a `FloatSpace` each frame; `float_space(ctx, id)` reads it
|
||||
and `apply` and `to_actions` take it. Before the area has drawn, `FloatSpace::new(area)` floats
|
||||
a panel at 260x320 and a group or column at its column width by 320.
|
||||
`FloatSpace::with_panel_size(panel, size)` gives a panel the area has not drawn (a hidden
|
||||
panel, a headless run) the host's own size; a size the area recorded wins. `x`, `y`, `width` and
|
||||
`height` replace the matching values, and a group or column that is already a whole floating
|
||||
window keeps its rect.
|
||||
- Without a value, `minimized`, `iconic` and `locked` toggle.
|
||||
- `ui.dock` operations are those of LightCraft, PDFCraft, CADCraft and SoundCraft: `open`,
|
||||
`close`, `activate`, `float {rect}`, `moveFloating {rect}`, `move {target, zone?, before?}`,
|
||||
`setStackOpen {open}`, `resizeStack {height}` and `resizeSplit {path, size}`. `rect` is
|
||||
`[x, y, width, height]`.
|
||||
`PaneArea` shows task panes around a document, without a dock `Layout`. The app keeps which panes are open, where they are and how big:
|
||||
|
||||
`to_actions` returns the actions a command makes without applying them. `apply` applies them all
|
||||
or none and returns the panels it closed, so the app can release their state. Showing a hidden
|
||||
panel and Lock change the workspace directly. Named workspaces and Reset belong to the app:
|
||||
`is_app_owned` is true for them and `apply` refuses them. `DockCommand::IDS` lists every id for
|
||||
the app's command registry. App-specific aliases stay in the app.
|
||||
|
||||
## Native windows
|
||||
|
||||
With feature `native-windows`, on a backend with egui viewports (`!ctx.embed_viewports()`,
|
||||
eframe on desktop), every floating window opens in its own OS window: a Ctrl/Cmd-drag, Undock
|
||||
Panel and Undock Panel Group, every other drop that floats, and the floating windows of a
|
||||
restored layout. A window still in-window opens over its place in the app window (the main
|
||||
viewport's `inner_rect.min` plus its rect). A window with a panel whose
|
||||
`DockContent::allow_native` returns false (it returns true unless the app overrides it), or
|
||||
that is not floatable, stays in-window. Floating windows get no taskbar or Alt-Tab entry
|
||||
(`with_taskbar(false)`).
|
||||
|
||||
On Wayland floating windows stay in-window: the compositor reports no window positions, so a
|
||||
native window could not dock again by drag or reopen where it was. Their `native` rects are
|
||||
kept, and the same layout opens native windows on X11, macOS and Windows. The dock area takes
|
||||
Wayland to be the backend when `WAYLAND_DISPLAY` or `WAYLAND_SOCKET` is set (winit's rule) and
|
||||
the main window has never reported its `outer_rect`; an app that forces X11 in code gets native
|
||||
windows from the first frame. `DockArea::native_windows(bool)` overrides the choice either way.
|
||||
|
||||
- **Identity.** `Floating::id` names the OS window, so a window keeps it when its panels change,
|
||||
including when its first panel moves out. `Floating::new` draws a fresh id and
|
||||
`Floating::with_id` sets one. A saved layout stores every window's id and loads with unique
|
||||
ids: a window saved without an id, or with one an earlier window took, gets a fresh one. A
|
||||
window that merges into another takes the receiver's id, and a whole window that moves
|
||||
(floated again, or its only group dragged) keeps its own.
|
||||
- **Kind and level.** `DockContent::window_kind` sorts panels into palettes
|
||||
(`WindowKind::Palette`, the default) and viewers (`WindowKind::Normal`), such as a video
|
||||
monitor on a second display. A window holding any `Normal` panel is a normal window, whichever
|
||||
of its tabs shows; the rest are palettes.
|
||||
- Palettes stay above other windows (`WindowLevel::AlwaysOnTop`), so clicking the document
|
||||
does not bury them. They stay shown while the app is in the background, so files dragged
|
||||
from another app reach them and an OS sheet attached to one stays open. While none of the
|
||||
app's windows has focus they take `WindowLevel::Normal`, so they do not cover other apps
|
||||
(on Windows `WindowLevel::AlwaysOnBottom`: there `Normal` would put them in front of the
|
||||
app the user switched to), and they go back to `AlwaysOnTop` when one has it again. The app counts as in the
|
||||
background after 250 ms without focus, so focus moving between its own windows changes
|
||||
nothing. The level is sent only when it changes.
|
||||
- Normal windows have `WindowLevel::Normal` and stay shown while the app is in the
|
||||
background. They stack with the main window by focus, below every palette; a drag over a
|
||||
normal window that lies behind the main window targets the main window where the two
|
||||
overlap, and the normal window outside the main window.
|
||||
- Like palettes, normal windows have no taskbar entry; they come forward with the app
|
||||
instead. When one of the app's windows gains focus after none had it for 250 ms,
|
||||
the main window and each normal window get `WindowLevel::AlwaysOnTop` and then
|
||||
`WindowLevel::Normal`, one window per frame, in their focus order from back to front.
|
||||
They keep their order, nothing takes focus, and the window the user activated is raised
|
||||
last, so it stays in front. The focus order counts a press in the main window as focusing
|
||||
it, since the window system raises it then. The main window is left at the normal level,
|
||||
so an app that keeps its main window always on top should not use normal windows. On
|
||||
Windows the toggle puts the window in front of every window that is not topmost, without
|
||||
activating it; on X11 the window manager raises a window as it takes
|
||||
`_NET_WM_STATE_ABOVE`. egui 0.36 cannot make the main window a native window's owner,
|
||||
which on Windows would bring the window forward with the main window, and
|
||||
`ViewportCommand::Focus` would take focus. On
|
||||
macOS nothing is raised: activation from the Dock or the application switcher brings all
|
||||
of the app's windows forward, and a click brings the clicked window alone, as with the
|
||||
app's other windows.
|
||||
- **Bar.** Each window has a bar at the top, 18 points high, in the floating title bar's style:
|
||||
the title (the shown panel of its first group) and ×. Dragging the bar moves the window. On
|
||||
macOS the press on the bar hands the move to AppKit, and on Wayland, where a window cannot
|
||||
be placed, the bar hands the move to the compositor. On
|
||||
Windows and Linux the OS frame is off. On macOS the frame stays, with its title bar and
|
||||
buttons hidden, for its resizing, rounded corners and standard window shadow. The dock area
|
||||
paints no shadow of its own around a native window.
|
||||
- **The ×.** Its place is set in `render/native.rs` (`MACOS_CLOSE`, `OTHER_CLOSE`): the
|
||||
glyph's inset from the top and trailing edges, its size, and how far the hit area reaches
|
||||
past the glyph on each side. On macOS the 9 pt glyph sits where macOS puts the close button
|
||||
of its own windows: centered in the bar, its trailing side 8 pt in. AppKit's corner resize
|
||||
area covers the glyph's trailing half and takes presses there, so the hit area reaches 10 pt
|
||||
further toward the leading edge and down to the bar's bottom. Elsewhere the × is an 18 pt
|
||||
square, its trailing side 7 pt in. With `CRAFT_DOCK_DEBUG_CLOSE=1` in the environment,
|
||||
native windows outline the ×'s hit area in red and, on macOS, AppKit's resize areas in
|
||||
orange.
|
||||
- **Resize.** A movable window resizes from its edges and corners. On macOS AppKit does it,
|
||||
with its own areas and cursors. Its corner area reaches about 15 pt into the window along
|
||||
each edge (a 19 pt square, measured on macOS 26) and takes presses before the content sees
|
||||
them. Over AppKit's areas the window sets no cursor of its own, which would flicker with
|
||||
AppKit's. Elsewhere the window resizes from bands 6 pt deep along its edges, and each corner
|
||||
is an L along both edges, 16 pt long and as deep as the edges. The bands leave out the bar's
|
||||
buttons, so the corner's grab runs down beside the ×; elsewhere the top band lies over the
|
||||
bar's drag area. The OS runs the resize from a band (`ViewportCommand::BeginResize`).
|
||||
- **Close.** The bar's × and the OS close request close the window's panels, as the
|
||||
floating window's × does. They reopen from the app's Window menu. A window with a panel that
|
||||
may not close, or in a locked area, has no × and answers the OS close request with
|
||||
`ViewportCommand::CancelClose`.
|
||||
- **Place.** `Floating::native` is the desktop rect of the window's content (egui's
|
||||
`inner_rect`), and the in-window `rect` follows it for builds that draw the window in-window.
|
||||
The content is also the window's origin for drags; only `ViewportCommand::OuterPosition`
|
||||
takes the outer position, which the renderer works out from the reported outer and inner
|
||||
rects. Where the window system puts a new window's frame, not its content, at the place asked
|
||||
for, the window is moved once so its content is there. When the app changes `native` (undo,
|
||||
a workspace reset, a reloaded layout whose ids match), the OS window moves there; a report
|
||||
that differs from `native` while a commanded move has not landed (up to 0.5 s) is ignored. `Floating::monitor` is the monitor
|
||||
holding the window's center, from the list the app passes to `DockArea::monitors` (each a
|
||||
`Monitor { name, rect, scale }` in desktop logical points). egui 0.36 reports no monitors, so
|
||||
an app fills the list from its backend when it can; without one, `Floating::monitor_size`
|
||||
keeps the monitor size egui reports.
|
||||
- **Restore.** Only the windows of a loaded layout (a `native` the session has not shown yet)
|
||||
are restored. A window made this session (a drag out, Undock, a Ctrl/Cmd drop) opens at the
|
||||
rect it was given, only made safe, wherever that is on the desktop. A restored window opens on
|
||||
its saved monitor when one with that name (or else that rect) is connected, moved in
|
||||
proportion if the monitor's rect changed, and moved onto it when too little of its bar lies on
|
||||
a monitor to grab (40 by 9 points). Otherwise it opens on the main window's monitor at the
|
||||
same offset from that monitor's origin, wholly on screen. Without a monitor list, it is
|
||||
clamped onto the main window's monitor, taken from `monitor_size` and the main window's
|
||||
position. Hostile rects are made safe first. With a monitor list, a window whose `native` the
|
||||
app changes, or whose bar drag ends with too little of the bar on a monitor, goes onto the
|
||||
nearest monitor too.
|
||||
- **Mixed scale factors.** Rects are stored in egui points as the window reports them, and
|
||||
`Monitor::scale` is kept but not used. On macOS every window shares one point space, so this
|
||||
is exact. On Windows egui-winit divides each window's physical position by that window's own
|
||||
scale factor, so with monitors at different scales (say 100 % and 150 %) the points of windows
|
||||
on different monitors are in different units. Across such monitors, a restored or
|
||||
app-changed place can land off by the ratio of the scales, and a drop across windows on
|
||||
different monitors can resolve against the wrong point. Same-scale setups are unaffected.
|
||||
- **Shortcuts.** egui gives each OS window only its own input. Key, text, copy, cut and paste
|
||||
events that reach a native window and that none of its widgets used come back in
|
||||
`DockOutput::forwarded_events`, with the modifiers held in that window in
|
||||
`DockOutput::forwarded_modifiers` (egui-winit sends Cmd/Ctrl+C, X and V as `Copy`, `Cut` and
|
||||
`Paste` without the key). The app feeds them to the shortcut handling it runs on the main
|
||||
window. A window where any widget has keyboard focus forwards nothing, and an Escape that
|
||||
cancels a drag is not forwarded.
|
||||
- **Input methods.** egui's IME descriptor (`PlatformOutput::ime`) goes out from the pass of
|
||||
the window whose editor has the keyboard. A `craft_ui::ime::Composer` in a panel body of a
|
||||
native window records its descriptor while the window draws, and the dock area publishes it
|
||||
once per pass, after the window's last body. A body drawn after the editor's cannot clear it
|
||||
(egui-winit turns the IME off in a pass without one, ending the composition). A descriptor
|
||||
written directly in that pass, as a focused `TextEdit` writes one, is kept. An app whose own
|
||||
editor publishes the descriptor does it in `DockContent::window_drawn`, called once per
|
||||
window pass after the last body. Floating windows drawn in the main window (the web,
|
||||
Wayland) are part of its pass, which publishes as it does without docking.
|
||||
- **Modal dialogs.** egui's `Modal` blocks input only in the viewport it is shown in. While the
|
||||
app shows one, it passes `DockArea::input_blocked(true)`. Each native window is then drawn
|
||||
under `DockStyle::blocked_dim` (by default the panel fill at 60 %), and its bar, tabs, body
|
||||
and resize edges take no input: its widgets are disabled, the pointer, key, text and scroll
|
||||
events are dropped at the start of its frame, and a layer over its content takes the pointer,
|
||||
so a popup left open takes no click either. It forwards only key releases, so a key pressed
|
||||
before the block does not stay down in the app's shortcuts. It reports no `window_files`,
|
||||
offers no drop targets, starts no move or resize, is not focused by `raise_panel`, and
|
||||
answers the OS close request with `ViewportCommand::CancelClose`. On macOS it is not
|
||||
resizable meanwhile.
|
||||
- *Stacking.* A palette drops to `WindowLevel::Normal` while blocked, so a click on the main
|
||||
window brings it in front of a palette that covers the modal. It stays shown and at that
|
||||
level when the app goes to the background and returns. When the app is activated meanwhile, the
|
||||
main window is raised last, in front of the normal windows and of a palette the user
|
||||
clicked.
|
||||
- *Edges.* Turning blocking on cancels a drag in progress, and a widget of a native window
|
||||
loses keyboard focus. If a native window has the OS keyboard focus then (the modal was
|
||||
opened from it, say by a double-click in a floating panel) and still has it 0.2 s later,
|
||||
the main window gets `ViewportCommand::Focus`, so the modal gets the keys. The wait lets an
|
||||
OS dialog opened with the modal (a file dialog) take focus first; then nothing is sent. A
|
||||
zoom gesture still shows in egui's `InputState::zoom_delta`, which cannot be cleared; a
|
||||
widget that zooms only while hovered ignores it. egui smooths wheel
|
||||
scrolling, so a scroll area in a native window may still scroll for about 100 ms after
|
||||
blocking ends, with the remainder of a wheel turn made just before it began.
|
||||
- Floating windows drawn in the main window need nothing: the modal covers them.
|
||||
- **Input hook.** eframe runs `App::raw_input_hook` for the main window only. An app that
|
||||
rewrites input there (say, Ctrl+click to a secondary click on macOS, or blocking input
|
||||
during automation) passes the same rewrite to `DockArea::native_input_hook` every frame as a
|
||||
closure. eframe's hook takes `&mut self`, so state it shares with the closure goes in an
|
||||
`Arc<Mutex<…>>`. The dock area runs it on each native window's `RawInput` (`viewport_id` names the window; see
|
||||
`DockArea::window_viewport`). It runs as an egui `Plugin::input_hook`, before egui reads the
|
||||
input, so widgets see rewritten pointer and key events as if the window system had sent them.
|
||||
It runs once per pass, so a frame that egui runs twice calls it a second time with the
|
||||
events already taken. The hook must be `Send + 'static`, as egui plugins are.
|
||||
- **Dropped files.** Files dragged over or dropped on a native window come back in
|
||||
`DockOutput::window_files`, one `WindowFiles` per window that had any this frame: the
|
||||
window's id and viewport, the panel whose body is under the pointer (else the window's
|
||||
shown panel, since the window system may send no pointer moves during a file drag), the
|
||||
pointer's last position in the window, and the window's `hovered_files` and
|
||||
`dropped_files`. Files on the main window stay in its own `RawInput`.
|
||||
- **Drags.** Tabs, groups and whole windows drag between the app's OS windows, and the app's
|
||||
own drags in panel bodies reach the window under the pointer.
|
||||
- *Ownership.* The window where the button went down owns the drag: the window system sends it
|
||||
the pointer's moves and the release while the button is held, inside the window or not. So
|
||||
the pointer leaving a window (`PointerGone`) is not a release. A drag ends on release,
|
||||
Escape (pressed in any of the app's windows, since keys go to the one with keyboard focus),
|
||||
when none of the app's windows has focus, or when its window closes or its panel goes. A
|
||||
window that AppKit moves (macOS, below) ignores Escape.
|
||||
- *Hit-testing.* The owner adds its desktop origin to the pointer: a native window's reported
|
||||
`inner_rect.min`, or while it moves by its bar, the place it was last put less the pointer's
|
||||
offset from the pressed point. On macOS a window moving by its bar is hit-tested at
|
||||
AppKit's cursor (`NSEvent::mouseLocation`). The window under that
|
||||
desktop point is a floating native window in front of the main window first (palettes, then
|
||||
normal windows, most recently focused first), then the main window, then a normal window
|
||||
behind it. A window moving by its bar is never its own target. A point in no window is on the
|
||||
desktop.
|
||||
- *Targets and previews.* Each window draws its drop targets in its own coordinates, and the
|
||||
window under the pointer draws the drop preview (zone, result rect, ghost) in its own frame.
|
||||
The source window shows only the "Hold {key} to undock" hint. The release is resolved at the
|
||||
end of the main window's frame, after every native window has drawn.
|
||||
- *Drops.* Over a window, a tab or group docks or joins there with the usual targets: dock lines
|
||||
and frame zones in the main window, frame zones and tab rows in floating windows. Over the
|
||||
desktop, it floats into a new OS window placed so the grabbed tab stays under the pointer
|
||||
(the window's top-left is the pointer minus the grab offset, less the bar's height). A
|
||||
Ctrl/Cmd-drag floats there wherever it is released.
|
||||
- *Moving a window.* Dragging the bar, the only tab of a window, or the drag area of its only
|
||||
group moves the window, so the pressed point stays under the pointer.
|
||||
- *macOS.* AppKit moves the window (`ViewportCommand::StartDrag`, which winit turns into
|
||||
`performWindowDragWithEvent`), as it moves its own windows: from the press on the bar,
|
||||
or from the start of the tab or group drag. The dock area sends no `OuterPosition`
|
||||
meanwhile. egui keeps running frames, but the window's reported place lags the move by up
|
||||
to a tenth of a second, so each frame takes the window's place as AppKit's cursor
|
||||
(`NSEvent::mouseLocation`, flipped against the primary screen's height and divided by the
|
||||
zoom factor) less the pressed point, and hit-tests targets, fades the window and routes
|
||||
the drag at the cursor. The drag ends on the first frame where AppKit
|
||||
(`NSEvent::pressedMouseButtons`) or egui reports the release; egui's can come a frame
|
||||
later, and the drag is resolved once. Ctrl/Cmd is read from AppKit's modifier flags,
|
||||
since AppKit sends egui no key events during the move; for the same reason Escape does
|
||||
not cancel it, as with Finder's windows. A press on the bar released within the click
|
||||
distance docks nothing.
|
||||
- *Elsewhere.* The dock area moves the window with `OuterPosition`. Each move is worked
|
||||
out from a pointer move of that frame and the window's reported place, which the
|
||||
pointer's position is relative to; a move commanded earlier may land late. A frame with
|
||||
no pointer move leaves the window. X11 sends no move whose position in the window repeats
|
||||
the last one, so while the pointer keeps exact pace with the window the window can trail
|
||||
it by one move until the next. Escape puts the window back.
|
||||
- *Drops.* Released over a target in another window, the whole window docks or joins there
|
||||
as its groups (`Action::MoveWindow`). The bar docks only with
|
||||
`DockStyle::title_bar_docks`; the only tab or group docks either way, since it is the way
|
||||
back in with that flag off. Targets: in the main window a dock line, a frame's tab row or
|
||||
edge zone, or the layout's outer edge; in a floating window a frame zone or tab row. A
|
||||
frame body's center takes a window moved by its only tab or group, as that tab or group
|
||||
drag would, but not one moved by its bar. Over the desktop, or with Ctrl/Cmd held, it
|
||||
stays where it was moved, and the layout takes its place once, at the release. An
|
||||
in-window floating window's title bar still splits only groups of other floating windows.
|
||||
- *Wayland.* With `DockArea::native_windows(true)` on Wayland, or wherever `outer_rect` is
|
||||
`None`, desktop positions are unknown, so drops across windows cannot be resolved. A drag
|
||||
works inside its own window, and a release outside it floats a new window that the
|
||||
compositor places. Moving a window hands the move to the
|
||||
compositor, which never docks it.
|
||||
- *App drags in panel bodies.* A drag the app starts in a panel body can reach the window
|
||||
under the pointer, so a drop site there works as it does inside one window.
|
||||
- *Which drags.* An egui drag of one of the app's widgets, pressed with the primary button
|
||||
in a panel body, that carries something: egui's `DragAndDrop` holds a payload
|
||||
(`dnd_set_drag_payload`), or the app calls `docking::route_app_drag(ctx, area_id)` each
|
||||
frame while the drag lasts, from the body or before the area shows. An app that keeps its
|
||||
payload in the context's data makes that call. Other drags (sliders, scrollbars, text
|
||||
selection, canvas pans) stay in their window and keep getting its pointer. A call counts
|
||||
for its frame and the next; once routing starts, it lasts until the drag ends.
|
||||
- *Events.* While the drag lasts, the owner's pointer moves over another of the app's
|
||||
windows (found as for tab drags, front window first) go to that window in its own
|
||||
coordinates: `PointerMoved` while the pointer is over it, `PointerGone` when it leaves,
|
||||
and the release as a primary `PointerButton` with `pressed: false`. That window sees
|
||||
`pointer_hover_pos` and `any_released` as if the window system had sent them. It sees no
|
||||
press, so `any_down` stays false there and nothing in it is clicked. The owner sees the
|
||||
pointer gone while it is over another window, so its panels under a palette see no hover
|
||||
and no drop.
|
||||
- *Input path.* Events go in through the area's egui input plugin, before any widget reads
|
||||
the input; the app calls nothing more. In a native window this runs before the app's
|
||||
`native_input_hook`. eframe runs the main window's `App::raw_input_hook` earlier, so that
|
||||
hook sees the main window's input without the routed events.
|
||||
- *Release timing.* A window drawn after the owner in the same pass gets the events in that
|
||||
pass (from the main window, every native window does). The main window, and a native
|
||||
window drawn before the owner, get them on the next pass, which is requested. When the
|
||||
release goes to another window, the owner gets its own release, and the pointer events
|
||||
that came after it, in the main window's next pass (a rerun of a discarded pass does not
|
||||
count), so its drag stops (`drag_stopped`) then. egui clears a `DragAndDrop` payload when the owner sees the
|
||||
release, so the target always reads its release while the payload is there. An app that
|
||||
keeps its own payload clears it no earlier than the owner's release.
|
||||
- *Limits.* Nothing is routed where desktop positions are unknown (Wayland,
|
||||
`native_windows(false)`, embedded viewports) or while input is blocked. Escape in any of
|
||||
the app's windows, a focus loss, `cancel_drag` and a replaced layout stop the routing:
|
||||
the window under the pointer sees it go and gets no release it has not read yet. The drag
|
||||
goes on in its own window until the button comes up, and the owner still gets its
|
||||
release.
|
||||
|
||||
On the web and wherever egui embeds viewports, nothing changes: floating windows stay in the
|
||||
page at their in-window rect, `native` and the monitor fields are kept but unused, the input
|
||||
hook never runs, and `forwarded_events` and `window_files` stay empty. Without the feature, the fields exist and are never set by the
|
||||
renderer.
|
||||
|
||||
## Labels
|
||||
|
||||
Every visible and accessibility label is a `*_label` field of `DockStyle`, with an English
|
||||
default: title case for menu items, sentence case for names only screen readers announce. `DockStyle::localized` sets them all from one keyed lookup:
|
||||
|
||||
```rust,ignore
|
||||
let style = DockStyle::from_ui(ui).localized(|key| app.strings.get(key).cloned());
|
||||
```
|
||||
|
||||
Keys are `dock.close`, `dock.float`, `dock.collapseToIcons` and so on; the rustdoc of `localized`
|
||||
lists them all. `DockContent::label` and `action_label` can shape panel and action text further;
|
||||
the logical label stays the accessibility name.
|
||||
|
||||
Each group and each column has one move handle in the accessibility tree: the group's drag bar
|
||||
and the column bar. A group's top border band only drags and is not announced, except in a group
|
||||
drawn without a drag bar, where the band is its move handle. By default these
|
||||
share one name per kind. Naming them is opt-in: an app puts `{name}` in `move_group_label` or
|
||||
`move_column_label`, and in each of its translations ("Move the {name} tab group"). It stands for
|
||||
what the handle moves: the logical label of the panel the group shows, or of the panels a
|
||||
column's groups show, joined by ", " (fixed, not localized). An untitled panel is left out. With
|
||||
no title at all, the placeholder goes with the brackets or quotes around it, a separator right
|
||||
after it and one of the spaces beside it ("Move the tab group", "Move tab group ({name})" gives
|
||||
"Move tab group", "移动{name}标签组" gives "移动标签组"); a label left with no letter or digit falls
|
||||
back to the English default. Two groups showing panels of the same title still get the same name.
|
||||
|
||||
## Testing
|
||||
|
||||
`DockArea::hit_rects(ctx, id)` lists every gesture source drawn last frame as a `Hit` with its
|
||||
rect: tabs, drag bars, borders, column bars, »/« buttons, title bars, close buttons, icons, icon
|
||||
grips, resize edges and dividers. It is always compiled, so an app can return it from a
|
||||
`ui.docking` control method next to the layout and the focused panel.
|
||||
|
||||
`DockArea::hit_id(id, &hit)` is the egui widget id of a control, for tests and automation that
|
||||
focus it or read its response. `DockArea::floating_layer(id, &window)` is a floating window's
|
||||
egui layer: compare its place in `memory.layer_ids()` with another layer to tell whether the
|
||||
window covers it, and read its rect with `memory.area_rect(layer.id)`. A window the area does not
|
||||
draw (its panels hidden, or a frame maximized) keeps its last rect there, so check
|
||||
`memory.areas().is_visible(&layer)` first.
|
||||
|
||||
The `testing` feature adds `docking::testing::DockDriver`. It runs a `DockArea` in a headless
|
||||
egui context with real pointer and key events, and applies the actions each frame emits.
|
||||
|
||||
```rust,ignore
|
||||
let mut driver = DockDriver::new(app_layout(), Panels::default());
|
||||
let bar = driver.hit(&Hit::DragBar(PanelId::Layers)).unwrap();
|
||||
driver.drag(bar.center(), egui::pos2(2.0, 300.0));
|
||||
driver.settle();
|
||||
assert!(driver.hit(&Hit::ColumnBar(PanelId::Layers)).is_some());
|
||||
```
|
||||
|
||||
It also has `press`, `release`, `click`, `hold`, `key`, `focus`, `hits`, and checks for painted
|
||||
previews (`filled`, `outlined`). With `native-windows`, `with_native_host(origin)` stands in for
|
||||
OS windows: the main window's content sits at `origin` on the desktop, and each native window
|
||||
runs its own frame with its own input and desktop rect (`host()`, `window_step`,
|
||||
`window_click`). `NativeHost` can report a monitor size (`monitor_size`), give windows a frame
|
||||
between their outer position and content (`frame`), land `OuterPosition` a frame late (`lag`),
|
||||
and report no positions (`no_position`, as on Wayland). `window_pointer` moves the pointer to a
|
||||
desktop point in a native window. With `moves_windows` the host moves a window for
|
||||
`StartDrag` itself, as AppKit does: the window keeps the pointer at the pressed point, reports
|
||||
its place as where the drag began until the release, and the host tells the cursor and the
|
||||
button (`held`; a test sets it to `false` to report a release before egui does). A `HostWindow` takes files dragged
|
||||
over it (`hovered_files`) or dropped on it (`dropped_files`), and `with_native_input_hook`
|
||||
passes a hook to `DockArea::native_input_hook` every frame.
|
||||
|
||||
`crates/ui/examples/docking_native.rs` (`cargo run -p craft-ui --example docking_native
|
||||
--features native-windows`) shows a dock with two native floating windows and prints every
|
||||
action and window place, for checking moves on a real window system.
|
||||
|
||||
craft-ui's own tests in `crates/ui/tests/docking_workflows.rs`:
|
||||
|
||||
- Load every app's v1 layout fixture, dock groups into a new dock, a bottom band and a seam,
|
||||
collapse and expand the column, float it by command and drag it back, then check the layout
|
||||
reads back as written.
|
||||
- Render Layers, Properties and Brushes panels with real content, and merge, detach and redock
|
||||
Brushes by pointer at two widths, two scales and both themes. Set `CRAFT_UI_DOCK_VISUAL_DIR`
|
||||
to keep the captures:
|
||||
|
||||
```sh
|
||||
CRAFT_UI_DOCK_VISUAL_DIR=/absolute/output/path cargo test -p craft-ui --test docking_workflows --all-features
|
||||
```
|
||||
|
||||
An adopting app still tests its own commands, contents, saved workspaces and themes.
|
||||
- `PaneArea::new(label, panes, content).show(ui, centre)`: `panes` are the open panes in edge order, and `centre` fills what the docked panes leave.
|
||||
- `PaneContent<P>` gives each pane's `PaneSpec`, its `PaneState` (`None` shows the default), its body and its menu rows.
|
||||
- The output lists `PaneRequest`s (`Close`, `Place`, `FloatRect`, `Minimize`, `Resize`, `Focus`, `Before`) in the order they happened. The app applies them in that order.
|
||||
- `SidePolicy::Columns` shows every pane on an edge side by side. `SidePolicy::OneSlot` shows one closable pane per edge.
|
||||
- `PaneCommands` (move to an edge, float, close) act on the pane that holds focus.
|
||||
|
||||
## What stays in the app
|
||||
|
||||
- The panel registry, panel contents and document state.
|
||||
- Named workspaces, Reset, and when and where layouts are saved.
|
||||
- Menus and key bindings outside the docking chrome.
|
||||
- Native window ownership on platforms without egui viewports.
|
||||
- The panel keys, the panel registry and the panel bodies.
|
||||
- Workspace files: where they live, their names and their size caps.
|
||||
- The answers to `DockEvent`s and `WorkspaceAsk`s.
|
||||
@@ -1,175 +0,0 @@
|
||||
# Task panes
|
||||
|
||||
`craft_ui::panes` draws task panes around an app's own document: Navigation, Styles, Comments,
|
||||
Format Shape and the like. Each pane is an egui side or bottom panel, or a floating frame. The
|
||||
document stays the app's `CentralPanel`.
|
||||
|
||||
## Panes or docking
|
||||
|
||||
| Use | When |
|
||||
|---|---|
|
||||
| `panes` | Office-style apps (WordCraft, DeckCraft, GridCraft). A few panes at the sides of a document the app draws itself; the app's commands own which panes are open. |
|
||||
| `docking` | Creative apps whose whole window is panels: tab groups, splits, stacked groups, workspaces, a protected canvas panel. See [ui-docking.md](ui-docking.md). |
|
||||
| plain egui panels | Fixed view parts: slide thumbnails, notes, formula bar, sheet tabs, status bar. |
|
||||
| `egui::Window` | Free tool windows that never dock (Read Aloud, Power Query). |
|
||||
|
||||
`panes` needs no docking types; it uses only the docking chrome (`ChromeStyle`,
|
||||
`FloatingFrame`, `TitleBar`, `live_move`).
|
||||
|
||||
## API
|
||||
|
||||
```rust
|
||||
use craft_ui::panes::{Edge, PaneContent, PaneHost, PaneRequest, PaneState, Place, SidePolicy};
|
||||
|
||||
impl PaneContent<Pane> for MyPanes<'_> {
|
||||
fn title(&self, pane: &Pane) -> String { tr(pane.title()) }
|
||||
fn body(&mut self, ui: &mut egui::Ui, pane: &Pane) { /* the pane's contents */ }
|
||||
fn default_state(&self, pane: &Pane) -> PaneState { PaneState::docked(Edge::End, 250.0) }
|
||||
// Optional: size_range (200..=520), movable, closable, menu (app items in the ▾ menu),
|
||||
// title_bar (false: a docked pane draws no title bar; floating panes always draw one).
|
||||
}
|
||||
|
||||
// Every frame, after the top and bottom bars and before the CentralPanel:
|
||||
let out = PaneHost::new(egui::Id::unique("task-panes"))
|
||||
.rtl(ui_is_rtl)
|
||||
.policy(SidePolicy::Columns)
|
||||
.show(ui, &open_panes, |pane| prefs.pane_state(pane), &mut MyPanes { app });
|
||||
for request in out.requests {
|
||||
match request {
|
||||
PaneRequest::Close(pane) => app.run(pane.close_command()),
|
||||
PaneRequest::Place(pane, place) => prefs.set_place(pane, place),
|
||||
PaneRequest::Resize(pane, size) => prefs.set_size(pane, size),
|
||||
PaneRequest::FloatRect(pane, rect) => prefs.set_float_rect(pane, rect),
|
||||
// Move `pane` to directly before `before` in the open list (`None`: to its end).
|
||||
PaneRequest::Before(pane, before) => app.move_pane_before(pane, before),
|
||||
PaneRequest::Focus(_) => {}
|
||||
}
|
||||
}
|
||||
egui::CentralPanel::default().show(ui, |ui| {
|
||||
let response = document(ui);
|
||||
if out.to_document {
|
||||
// F6 or Shift+F6 left the panes: the document takes keyboard focus.
|
||||
response.request_focus();
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
| Piece | Behavior |
|
||||
|---|---|
|
||||
| `Edge::{Start, End, Bottom}` | Logical edges. `Start` is left, or right with `.rtl(true)`. |
|
||||
| `SidePolicy::Columns` | Every docked pane shows; panes on one edge sit side by side in `open` order, the first outermost. A drop that picks a position on an edge sends `Before(pane, next)` after its `Place`, so the app's `open` order puts the pane there. |
|
||||
| `SidePolicy::OneSlot` | One closable pane per edge: the last one in `open`. Non-closable context panes (PivotTable Fields) show beside the slot. A closable pane dropped on an edge takes the slot: `Before` moves it after the slot's pane. |
|
||||
| `.max_fraction(f)` | One docked pane takes at most `f` of the host's width (height for bottom panes). |
|
||||
| Chrome | Title, ▾ menu (app items, Move to Start, Move to End, Move to Bottom for bottom panes, Float, Close), ×, a resize edge with pointer and arrow keys. The edge takes presses on both sides of its line, over the document's own widgets too, and stays under floating windows. The title bar mirrors with `.rtl(true)`. Its accessible name is `PaneLabels::move_pane` with `{title}` replaced by the pane's title ("Move Styles pane"). |
|
||||
| Size | A docked pane reserves exactly its size and clips its body, so a body wider than the pane never pushes into the document. |
|
||||
| Drag out | A docked pane's title dragged more than `DOCK_SNAP` (32 pt) out of the pane floats it under the pointer when dropped, unless it is dropped on a dock target: within 32 pt of the host's left or right edge it docks there, outermost; over the outer third of another side pane (toward the window edge) it docks directly outside that pane, over its inner third directly inside it. The middle third is no target. While the pointer is on a target, a preview shows the rect the pane will take once the app applies the requests. A drop where the pane already is sends nothing. |
|
||||
| Floating | `FloatingFrame` with its resize handles; the title bar moves it. Escape or window focus loss during a move puts it back. A drop on a dock target docks it, with the same targets and preview as a drag out. Rects are clamped to the host area. |
|
||||
| Focus | `out.focused` is the pane holding keyboard focus or last clicked; a click or focus in the document clears it. F6 and Shift+F6 cycle through the shown panes and then report `out.to_document`: give focus to the document. `.f6(false)` leaves F6 to the app, which calls `panes::focus_next(ctx, id, reverse)` instead. |
|
||||
|
||||
State:
|
||||
|
||||
- The host never stores which panes are open and never writes files.
|
||||
- `states` returns the app's saved `PaneState` (place, size, float rect; serde with the `serde`
|
||||
feature). Return `None` to let the host keep the state in egui memory for the session, as
|
||||
egui panels keep widths today.
|
||||
- Apply `Resize` and `FloatRect` as they come: they arrive every frame of a gesture, and an
|
||||
Escape sends the start rect back.
|
||||
- `panes::float_rect` brings a saved rect back inside the window, whatever the file says.
|
||||
|
||||
## Rail
|
||||
|
||||
`panes::Rail` is a vertical strip of icons, always shown at one edge. Each icon stands for a
|
||||
task pane, and one pane at a time is open beside the strip. A click on an icon opens its pane in
|
||||
place of the open one; a click on the open pane's icon closes it. The rail stores nothing: the
|
||||
app owns which pane is open, as with `PaneHost`.
|
||||
|
||||
```rust
|
||||
use craft_ui::panes::{Edge, PaneHost, Rail, RailItem, RailRequest, SidePolicy};
|
||||
|
||||
let items = [
|
||||
RailItem::new(Pane::Comments, icons.source("comments"), tr("Comments")).marker(has_comments),
|
||||
RailItem::new(Pane::Bookmarks, icons.source("bookmark"), tr("Bookmarks")).enabled(has_outline),
|
||||
];
|
||||
// After the top and bottom bars, before PaneHost: the rail is the outermost panel on its edge.
|
||||
let rail = Rail::new(egui::Id::unique("rail")).edge(Edge::End).rtl(ui_is_rtl).show(ui, &items, app.pane.as_ref(), |ui| {
|
||||
page_navigation(ui); // the foot: below the items, always visible; may draw nothing
|
||||
});
|
||||
match rail.request {
|
||||
Some(RailRequest::Open(pane)) => app.pane = Some(pane),
|
||||
Some(RailRequest::Close(_)) => app.pane = None,
|
||||
_ => {}
|
||||
}
|
||||
// The open pane, between the document and the rail. Its PaneContent returns `movable = false`
|
||||
// and a `default_state` docked at the rail's edge.
|
||||
// Apps whose panes draw their own headers return false from `title_bar`.
|
||||
let open: Vec<Pane> = app.pane.into_iter().collect();
|
||||
let out = PaneHost::new(egui::Id::unique("task-panes")).rtl(ui_is_rtl).policy(SidePolicy::OneSlot).show(ui, &open, |_| None, &mut MyPanes { app });
|
||||
egui::CentralPanel::default().show(ui, |ui| document(ui));
|
||||
```
|
||||
|
||||
| Piece | Behavior |
|
||||
|---|---|
|
||||
| `RailItem` | `pane`, `icon` (an `egui::ImageSource`, like docking's `DockContent::icon`), `label` (tooltip and accessible name; translate it in the app), `enabled`, `marker`, `marker_label` (the accessible description while the marker shows, such as "Has comments"). `RailItem::new` makes an enabled item without a marker. |
|
||||
| `.edge(e)` | `End` (default) or `Start`. `Start` is left, or right with `.rtl(true)`. The rail is vertical, so `Bottom` draws at `End`. |
|
||||
| `.width(w)`, `.button_size(s)` | Rail width (48) and item size (34; the icon is 16 smaller). Non-finite values fall back to the defaults. |
|
||||
| `.frame(f)` | Default: the panel fill, 8 pt above and below. The panel's separator line draws the inner edge. Item colors come from `ChromeStyle`, like the pane title bars. |
|
||||
| Panel | Exact width, not resizable. Shown before `PaneHost::show`, it is outermost, so a docked pane on the same edge sits between it and the document. |
|
||||
| Items | Top-down in a vertical scroll area. The foot is a bottom sub-panel, so in a short window the items scroll and never run into it. A pane listed twice is drawn once. An empty list draws an empty rail. |
|
||||
| States | The open pane's item draws selected. `marker` draws a dot while the pane is not open. A disabled item draws disabled, takes no focus and sends nothing. An item disabled while focused hands focus to the nearest enabled item, the one below first. |
|
||||
| `RailOutput` | `#[non_exhaustive]`. `request`: `Open(p)` or `Close(p)` (`#[non_exhaustive]`), at most one per frame. `focused`: the item holding keyboard focus. `rect`: where the rail was drawn. |
|
||||
| Accessibility | Each item is a toggle button (accesskit `Button` with a toggled state) named by its `label`. |
|
||||
| Keyboard | Items take Tab focus. Enter or Space clicks the focused item. Up and Down move focus between enabled items and stop at the ends. Escape is the app's: the rail neither closes the pane nor moves focus on it. |
|
||||
|
||||
F6 stays with the app. To include the rail in an F6 cycle, give `PaneHost` `.f6(false)` and,
|
||||
when the cycle reaches the rail, focus the open pane's item if it is enabled, else the first
|
||||
enabled one:
|
||||
|
||||
```rust
|
||||
let enabled = || items.iter().filter(|item| item.enabled);
|
||||
let target = enabled().find(|item| Some(&item.pane) == app.pane.as_ref()).or_else(|| enabled().next());
|
||||
if let Some(item) = target {
|
||||
ctx.memory_mut(|m| m.request_focus(Rail::new(egui::Id::unique("rail")).item_id(&item.pane)));
|
||||
}
|
||||
```
|
||||
|
||||
While `rail.focused` is `Some`, focus is in the rail: the next F6 moves on, for example to the
|
||||
panes with `panes::focus_next`.
|
||||
|
||||
## Adoption
|
||||
|
||||
### WordCraft (`Columns`)
|
||||
|
||||
- Add a `Pane` enum for the nine panes and implement `PaneContent` by calling the existing
|
||||
bodies; drop their `header()` calls, since the host draws the title and ×.
|
||||
- Build `open` each frame from the `ViewState` flags, in today's order: SmartArt Text Pane (only
|
||||
while SmartArt is selected), Navigation and Clipboard at `Start`; Styles, Style Inspector,
|
||||
Accessibility, Alt Text, Restrict Editing and Comments at `End`. Default widths as today.
|
||||
- `Close(p)` runs the pane's existing command (`view.navigationPane {value: false}`, …). Command
|
||||
ids and `nav_pane` in `ui.json` stay as they are.
|
||||
- Styles takes #2584's behavior through the host: map `StylesPaneDock::{Left, Right, Floating}`
|
||||
to `Place` (`Left` is `Docked(Start)` in left-to-right interfaces), run `view.stylesPaneDock`
|
||||
on `Place`, keep the float rect in UI prefs. #2584's own drag, snap and `float_rect` code goes.
|
||||
- Other panes return `None` from `states`; their widths stay session-only, as now.
|
||||
- Pane title bars are focusable. Check that Tab in the canvas still stays in the document, so
|
||||
panes stay off its keyboard focus. Use `.f6(false)` if F6 is bound elsewhere.
|
||||
|
||||
### DeckCraft (`OneSlot`)
|
||||
|
||||
- `open` is `ui.pane` (one entry) at `End`; `states` returns `PaneState::docked(Edge::End,
|
||||
pane_width)`; `Resize` writes `pane_width`; `Close` clears `ui.pane` as the × does today.
|
||||
`size_range` is 240..=520. The `ui.json` fields stay.
|
||||
- Format, Animation and Selection return `movable = true`; the rest `false`. Saving their place
|
||||
needs new optional `ui.json` fields (`#[serde(default)]`).
|
||||
- Thumbnails, outline, notes and the #835 canvas shell stay plain panels.
|
||||
- F6 from the host closes the ui-parity F6 gap.
|
||||
|
||||
### GridCraft (`OneSlot`, `.max_fraction(0.5)`)
|
||||
|
||||
- `open` is the task slot pane (`grid.pane`, or "comments" while `session.comments_pane`) plus
|
||||
PivotTable Fields while the active cell is in a pivot. PivotTable Fields returns
|
||||
`closable = false` and `movable = false`, so it stays beside the slot.
|
||||
- `Close("comments")` runs `review.showComments {on: false}`; agents still drive it through the
|
||||
engine.
|
||||
- No pane prefs today: return `None` from `states`.
|
||||
- Code Editor (#1193) and Queries & Connections (#1203) become slot panes. The formula bar,
|
||||
sheet tabs and status bar stay plain panels.
|
||||
@@ -1,51 +0,0 @@
|
||||
# Shared UI visual regressions
|
||||
|
||||
`crates/ui/tests/visual_regression.rs` runs actual shared components through egui and renders
|
||||
paired images with the same offscreen wgpu renderer. `visual/fixtures.rs` supplies independent
|
||||
reference painters with fixed geometry and state colors. References do not call the shared
|
||||
components or obtain expected rectangles from component responses. These fixtures specify the
|
||||
shared components' visual contracts; they are not historical screenshots of applications.
|
||||
|
||||
## Coverage
|
||||
|
||||
| Surface | Paired cases | Dimensions exercised |
|
||||
| --- | ---: | --- |
|
||||
| Icon buttons (separate and single-shape frames), tabs, horizontal and vertical split handles | 372 | Light/dark, 1/1.5/2 pixels per point, normal/compact, normal/hover/pressed/disabled/focused; buttons and tabs also selected/selected-pressed |
|
||||
| Toolbar fitting | 18 | Light/dark, three display scales, all groups visible / a group plus overflow / overflow only |
|
||||
| Widget palette | 12 | Light/dark, three display scales, normal/compact; all five widget states, both fills, radius, foreground and preserved border/expansion |
|
||||
| SVG preparation | 12 | Light/dark colors, three display scales, 12/24 point icons; literal recolor and stroke references |
|
||||
|
||||
The 414 positive pairs require identical RGBA pixels. The 402 wgpu pairs also require identical
|
||||
tessellated vertices, indices, texture IDs and clip rectangles. SVG pairs compare the actual
|
||||
image loader's raster output against literal prepared SVGs. Every SVG must contain visible pixels.
|
||||
|
||||
Controls receive real egui pointer movement, pointer press or focus requests; assertions verify
|
||||
that the intended response state was reached. Disabled controls receive pointer input and must
|
||||
remain inert. Selection takes precedence over a pointer press. Resize handles exercise a drag
|
||||
and both split orientations. Compact fixtures test the same visual contracts at smaller sizes.
|
||||
|
||||
An additional 36 negative comparisons deliberately change normal fill color, inter-button
|
||||
spacing or stroke width. Each must differ in both pixels and meshes. No tolerance, mask, crop,
|
||||
perceptual score or automatic baseline update can turn a changed pixel into a passing result.
|
||||
Toolbar unit tests separately reject malformed and excessive input, require a reachable overflow
|
||||
control, and verify that accepted layouts preserve every group and fit the supplied width.
|
||||
|
||||
## Running and reviewing
|
||||
|
||||
```sh
|
||||
cargo test -p craft-ui --test visual_regression
|
||||
CRAFT_UI_VISUAL_DIR=/absolute/path/to/visuals cargo test -p craft-ui --test visual_regression
|
||||
```
|
||||
|
||||
The optional directory receives one subdirectory per suite. Each case writes `-before.png`
|
||||
(the independent reference), `-after.png` (the production component) and `-difference.png`
|
||||
(changed pixels in magenta), plus a `comparison.tsv` with dimensions, changed pixel count,
|
||||
mesh equality and whether a change is expected. Completed rows survive a subsequent failed
|
||||
assertion. The fixture count and image dimensions are fixed and bounded; the largest control
|
||||
image is 256 by 144 pixels. Tests fail if a renderer cannot initialize or render.
|
||||
|
||||
The test renderer compares both sides on the current machine. It does not assert cross-driver
|
||||
pixel identity or substitute for application-specific native screenshots, complete themes,
|
||||
text/font layout, command dispatch, window resizing, accessibility service acceptance, or
|
||||
cross-platform runtime tests. Application baselines must retain their own source and binary
|
||||
provenance. Review those captures separately when adopting or changing a shared adapter.
|
||||
Reference in new issue
Block a user