Skip to main content

Crate blockworx_kernel

Crate blockworx_kernel 

Source
Expand description

The editor as a function.

kernel(&mut Session, events, &impl TextLayout) -> View

events is everything a front end can say — the pointer, a command, an action an overlay emitted, the clock, the size of the surface. There is no clock argument and no viewport argument, because a tick and a resize are things that happen. View is what the front end should show: the display list the frame painted, the cursor, the in-place editor a tool asked for, the selection’s bounds on screen, the commands that are live, the window title, whatever the editor had to hand back, and whether another frame is owed.

Nothing here names a UI toolkit. The three habits an immediate-mode host left in the core are inputs now: time arrives as an Event::Tick and the easing table is the session’s, text metrics arrive as a TextLayout, and a repaint request comes back out in the View instead of going out to a context.

The egui shell drives the same Session through the same methods — canvas_frame, dispatch, record_history — so there is one editor, not one per surface.

Re-exports§

pub use camera::CameraWork;
pub use camera::Glide;
pub use camera::Refit;
pub use chrome::Acknowledged;
pub use chrome::Crumb;
pub use chrome::Ground;
pub use chrome::Hung;
pub use chrome::Lens;
pub use chrome::Liveness;
pub use chrome::Locked;
pub use chrome::NavNode;
pub use chrome::NavTree;
pub use chrome::Notice;
pub use chrome::Notices;
pub use chrome::Overlay;
pub use chrome::Reading;
pub use chrome::ScopePath;
pub use chrome::Selection;
pub use chrome::TitleBlock;
pub use chrome::TopBar;
pub use session::Consequences;
pub use session::Diagnostic;
pub use session::FrameRate;
pub use session::NavPick;
pub use session::Session;
pub use session::saturation;

Modules§

bar
The selection overlay’s own policy: which verbs it carries, in what order, where the row ends and the overflow begins, and where the bar stands over the diagram.
camera
The camera the session owns: where the diagram is shown from, how a framing glides into place, and what the host’s own moves — a pan, a wheel notch, a pinch — do to it.
chrome
The chrome model: what a front end shows around the canvas, as values the session builds and a View carries.
dispatch 🔒
Applying one Action to the session.
driving
Driving the kernel the way a front end does — batches of events on a 60 Hz clock over a fixed viewport — for the suites and benches above it.
export 🔒
What leaves the document.
frame 🔒
One canvas frame, over whatever Canvas the host hands in.
handoff 🔒
The one channel out of the editor.
nav
The navigator’s tree, flattened into the rows a panel draws.
palette
The command palette’s rows: what a typed query reaches, how it is scored, and what order the answers come back in.
pointer
The pointer, resolved: raw motions and button edges in, one Event a frame out.
session
Everything the editor is, apart from the surface it is shown on.

Structs§

Framed
What one canvas frame left for the chrome around it.
Sheet
What an export says about the drawing it writes, beyond the document itself: how the host names it, the block a printed sheet is stamped with, and the palette that sheet is printed in.
View
What the front end should show.

Enums§

Event
What a front end can say.
Handoff
What the editor hands back, once it has something to hand back.

Functions§

acts 🔒
What this frame asks for: the actions stated outright, and whatever a command resolves to through the registry.
kernel
One frame of the editor: apply what the front end said, paint, and answer with what it should show.
observe 🔒
What the batch says before anything is painted: the clock, the viewport, the camera’s moves and the pointer, taken in the order the front end said them.
recorded_camera
How a manifest row records vantage (§10.1 of docs/log-vs-snapshot.md): the world point at the centre of viewport, and the zoom.
recorder 🔒
title 🔒
vantage_of
And back, against the viewport the reader has now.