Skip to main content

Crate ashlar_ui

Crate ashlar_ui 

Source
Expand description

General-purpose egui components for ashlar apps.

  • Theme: tokens (design tokens, light/dark/system, interface scale), fonts (install app-supplied faces with a CJK fallback chain), theme (widget-state colouring).
  • Inputs: value_field (drag/scrub and formatted numeric fields), slider (slider, knob), swatches, search, buttons, tabs; all value edits report edit phases.
  • Text: markdown (chat replies and short documents, streaming-safe), code_view, diff_view (unified and split diffs of ashlar_diff files).
  • Data: virtual_list (list and table, O(visible) per frame), tree.
  • Shell: dialog, toasts, status_bar, layout, docking, printing, labels (every built-in string, localizable).
  • Commands: commands (menu model and bar, palette, keymap editor, key dispatch).
  • Infrastructure: automation (ids and rects for ui.inspect/ui.click), devtools (the UI debugger: element tree with refs, injected input, waits, screenshots, inspector), cache (revision-keyed galleys and meshes), motion (animated values that idle when settled), wake (frame requests with a reason, per-reason frame counts), idle (trim caches when idle or in the background; memory and frame-rate readouts).

Apps own their data, selection, assets and command handling: components take state by reference and report what the user asked for. Domain widgets (timelines, canvases) stay in the apps and are built from these pieces.

Re-exports§

pub use overlay::help;

Modules§

automation
Automation ids: every interactive component registers a stable id, label and on-screen rect each frame, so an agent can find and click controls by id and ui.inspect can report what is on screen without per-app code.
buttons
Icon-only buttons: the app picks the colours of each state and paints the icon.
cache
Revision-keyed caching of galleys, meshes and other derived paint data across frames.
chat
Chat kit: a transcript, message and tool-call views, and a composer with an @ / / popup.
code_view
A read-only code view: virtualized lines, a line-number gutter, optional wrapping, mouse selection with copy, search marks, and syntax colours from ashlar_syntax.
commands
Commands in the UI: the menu bar, the command palette, the keymap editor and keyboard dispatch, all driven by ashlar_command::CommandInfo and ashlar_command::Keymap.
content
Small content components: EmptyState, Banner (a live region), Card, Collapsible and Accordion (at most one section open).
controls
Everyday controls drawn from the design tokens: text buttons, a switch, a segmented control and radio group, badges and keycaps, progress bars, circles and spinners, and skeleton rows.
devtools
The UI debugger: drive any egui app the way a browser automation tool drives a web page. Snapshot the UI as an element tree with short refs (e12), act on refs (click, fill, press, drag…), wait for conditions, read values, take screenshots, and an in-app inspector (F12).
dialog
Modal dialog shell: title, body, and a row of buttons with keyboard defaults.
diff_view
A diff view over ashlar_diff::FileDiffs: unified or split, virtualized, syntax-coloured per file language, with word-level emphasis, collapsed unchanged ranges, a sticky file header, line selection and hunk navigation.
docking
Panel docking: a layout of tab groups, accordions, splits and floating groups that apps change only through validated, atomic transactions, plus drop-target resolution and an optional egui renderer that reports what the user asked for as actions.
edit
Edit phases: how a continuous gesture (a drag, a typed entry) maps onto one undo step.
fonts
Install font families from bytes the app supplies, with a CJK fallback chain.
form
The settings form pattern: sections of rows (label, description, control), a “modified” marker with a reset button, a filter that hides rows which do not match a query, and Field for a labelled input with a required marker and an announced error.
icons
Catalogs of trusted, compiled-in monochrome SVG icons.
idle
Give memory back when nobody is using the app: an idle / background trim policy, and the numbers that show where memory goes.
labels
Every word ashlar’s components show, in one UiLabels installed on the context (like the theme tokens). Components use the installed labels unless the app passes its own to that component (Toasts::labels, Form::labels, DiffView::labels, …), which always win.
layout
Layout building blocks that hold no state of their own.
list
Cheap rows for plain lists, and a debug check that points long plain lists to VirtualList.
markdown
Markdown for chat replies and short documents: headings, paragraphs, bullet, numbered and task lists, block quotes, rules, tables and fenced code blocks (with a Copy button), and inline code, bold, italic, strike-through and links.
motion
Animated values for egui, built on ashlar_motion: one call per value per frame, frames requested only while something moves.
motion_gate
A motion and jank gate for tests: record what moved, then flag motion that looks wrong.
overlay
Floating surfaces anchored to a control: Select, Combobox, Popover and the help tooltip. Context menus built from a MenuSpec are crate::commands::menu::context.
printing
Printer selection controls and their transient state.
rolling
Rolling text: counters, timers and live readouts that change without jumping.
search
Search field: a single-line editor with a search glyph, a clear button and Escape to clear.
selection
An app-owned multi-selection for VirtualList and VirtualTable: a cursor, an anchor and a set of rows.
sidebar
A sidebar (source list): titled sections that fold, each with a count, holding rows with an icon, a label, a weak detail and a badge.
slider
Slider and knob, reporting the same Edit phases as crate::value_field.
status_bar
Status bar: a thin strip along the bottom of the window with left and right sections.
swatches
A grid of colour swatches (a palette, recent colours, label colours).
tabs
Tab strips: fitting tab widths with an overflow menu, and an accessible tab hit-region that the caller paints.
theme
Widget-state colouring: the low-level step crate::tokens uses to colour egui’s widgets.
toasts
Toast notifications: a bounded queue the app pushes to, painted in a corner.
tokens
Design tokens: the colours, radii, spacing and type sizes every ashlar component reads.
tree
Tree view: an expandable hierarchy shown as a virtualized list.
value_field
Numeric drag/scrub field with an explicit edit phase.
virtual_list
Virtualized list and table: only visible rows are laid out, painted and registered, so a frame costs O(visible rows) whatever the row count.
wake
The frame scheduler: ask for frames with a named Reason, so an app can say why each frame ran.