pub enum Event {
Show 53 variants
Pressed,
TextChanged(String),
Submitted,
ToggleChanged(bool),
ValueChanged(f64),
ValueCommitted(f64),
SelectionChanged(i64),
ListActivated(usize),
Undo {
redo: bool,
},
Edit(EditOp),
SelectionSet(Vec<i64>),
FocusChanged(bool),
Tap(Point),
LinkActivated(String),
LongPress(Point),
ContextMenu {
local: Point,
window: Point,
},
Drag {
phase: DragPhase,
location: Point,
translation: Point,
},
Pinch {
phase: DragPhase,
scale: f64,
location: Point,
},
Pan {
phase: DragPhase,
delta: Point,
location: Point,
},
Hover {
phase: DragPhase,
location: Point,
},
ScrollChanged(Point),
FrameChanged(Size),
NavBack {
already_popped: bool,
},
NavPresentationChanged(NavPresentation),
Key(KeyEvent),
Pointer(PointerEvent),
WindowResized(Size),
RouteRequested(String),
PresentResult {
req: u64,
result: PresentResult,
},
ImageDecoded {
req: u64,
result: Result<BitmapInfo, ImageError>,
},
ImageEncoded {
req: u64,
result: Result<Vec<u8>, ImageError>,
},
BitmapRendered {
req: u64,
result: Result<BitmapInfo, ExportError>,
},
PdfRendered {
req: u64,
result: Result<Vec<u8>, ExportError>,
},
Custom {
tag: &'static str,
num: f64,
text: String,
},
MenuAction(u64),
ToolbarChanged {
action: u64,
value: ToolbarValue,
},
SearchChanged(String),
SearchScopeChanged(usize),
SearchSuggestionChosen(usize),
SearchSubmitted(String),
Lifecycle(Lifecycle),
WindowClosed,
WindowFocused(bool),
WindowStateChanged(WindowState),
ListReorder {
from: usize,
to: usize,
},
ListDelete(usize),
RefreshRequested,
ListSwipe {
index: usize,
edge: SwipeEdge,
action: usize,
},
CoverHidden,
InspectorChanged(bool),
TreeExpanded {
token: u64,
expanded: bool,
},
TreeMove {
token: u64,
parent: Option<u64>,
index: Option<usize>,
},
TreeSelection(Vec<u64>),
}Variants§
Pressed
TextChanged(String)
Submitted
ToggleChanged(bool)
ValueChanged(f64)
ValueCommitted(f64)
A continuous control’s value settled: the drag ended (mouse/touch up), or the value moved
by a discrete action (a keyboard arrow, a click on the track). Always preceded by the
ValueChanged carrying the same value.
The pair exists because one gesture produces two different facts. ValueChanged is the
live one (bindings follow it so the UI tracks the thumb) and it fires continuously, which
is why nothing durable should key off it: a drag from 1 to 100 and back to 50 emits every
value in between. ValueCommitted fires once, with the value the user chose, and is what
a recording, a log, or a refetch should use.
A backend that cannot tell the two apart emits only ValueChanged; its sliders then do not
record (docs/coverage-matrix.md).
SelectionChanged(i64)
ListActivated(usize)
A list row was activated: desktop double-click/Enter, or a touch tap. Separate from selection so keyboard browsing need not open or play the row.
Undo
The platform’s own undo affordance fired through a native front (⌘Z on the Edit menu,
a three-finger swipe, shake-to-undo); redo distinguishes the pair. Only backends
with a native undo system emit it; everywhere else the app’s own controls call the
stack directly and this event never exists (docs/model.md).
Edit(EditOp)
The platform’s own standard edit command fired through its native route (Edit ▸
Cut/Copy/Paste, ⌘X/⌘C/⌘V, the browser’s copy/paste DOM events) with no text
widget claiming it first; the app’s edit bridge answers (docs/menus.md). Transport
is the system clipboard (day-part-clipboard), not the event.
SelectionSet(Vec<i64>)
A multi-select list’s selection changed: the full set of selected row indices,
ascending (empty = nothing selected). Emitted instead of SelectionChanged where
ListProps::multi_select is honored (docs/list.md).
FocusChanged(bool)
Tap(Point)
LinkActivated(String)
A link run inside a label was activated; the payload is TextRun::link verbatim.
LongPress(Point)
ContextMenu
A context-menu summon reported by a toolkit that presents no native menu of its own
(web-dom): the pieces layer shows the composed menu (docs/menus.md). local is the
point in the node’s own coordinates (what the app’s provider receives); window the
same point in window coordinates (where the composed panel goes). Toolkits that serve
context menus natively never emit this.
Drag
A drag/pan gesture (docs/shapes.md). location is in the node’s local coordinates;
translation is the cumulative movement since Began.
Pinch
A pinch/magnify gesture over the node (docs/shapes.md): scale is cumulative since
Began (1.0 = unchanged), location the gesture’s centroid in local coordinates,
the anchor a zoom keeps stationary. Only nodes that enabled
GestureKind::Pinch receive it; a backend with no recognizer emits nothing.
Pan
A viewport pan over the node (docs/shapes.md): delta is the movement since the
previous event; incremental, not cumulative, because desktop wheels have no gesture
session to accumulate over (a discrete wheel tick arrives as a lone Changed).
Two-finger touch pans bracket theirs with Began/Ended. Distinct from
Event::Drag, the primary pointer’s press-drag.
Hover
The pointer moved over the node, or left it (docs/canvas.md “Interaction”). location is
in the node’s local coordinates. Phases follow the drag vocabulary: Began on entry,
Changed for each move, Ended on exit, where location is the last point seen inside,
so a handler always knows where the pointer went out.
Only nodes that enabled GestureKind::Hover receive it, and only on a device with a
pointer at all.
ScrollChanged(Point)
FrameChanged(Size)
A canvas node was re-framed by layout; re-record (§11). Nav pane/page containers also report their allocated size with this (docs/navigation.md).
Native back navigation (iOS back button/swipe, Android system back or toolbar up).
already_popped = the toolkit already performed the pop natively (iOS); the nav
host then syncs its stack without re-issuing NavPatch::Popped.
A nav host’s own adaptive container changed presentation, and Day is being told about it after the fact (docs/size-classes.md).
The counterpart to props::NavPatch::Presentation, for the toolkits that answer
Cap::NavRepresent = Emulated: UISplitViewController collapsing as a Pro Max iPhone
rotates into portrait, SlidingPaneLayout deciding at measure time that two panes no
longer fit. Day did not ask for it and must not fight it; the pieces layer only
reconciles what follows, which is the selection rule (a split presentation cannot draw an
empty detail pane, so expanding with nothing selected picks the first item).
Emitted on the NAV host node, and only when the presentation actually changed.
Key(KeyEvent)
Pointer(PointerEvent)
WindowResized(Size)
RouteRequested(String)
The platform asks the app to show a route (docs/navigation.md), a runtime deep link:
on web-dom, the URL hash changing under the app (hand-edited, or browser back/forward);
on mobile, a warm scheme link (iOS application:openURL:, Android onNewIntent via
BridgeKind::Deeplink). Emitted on WINDOW_NODE (day-core answers with navigate()
when the route differs from the current one) or on the active nav host’s node (the nav
piece answers with navigate() itself, docs/deep-links.md). Launch-time deep links use
DAY_DEEPLINK/set_launch_deeplink instead; this variant is for changes while the
app runs.
PresentResult
A native modal answered request req (docs/dialogs.md).
ImageDecoded
A decode started by Toolkit::decode_image finished (docs/images.md).
Keyed by request id like Event::PresentResult, and for the same reason: the answer
belongs to a waiting caller, not to a tree node. It never crosses a native boundary
(every backend raises it from its own Rust arm once the platform decoder answers), so it
has no bridge::BridgeKind, exactly like the completion events dialogs use in-process.
No bitmap id rides here: day-core minted it and handed it to the backend with the bytes, so it already knows which image a request answers for. A backend that stored the image under that id has nothing more to say than the facts it read.
ImageEncoded
An encode started by Toolkit::encode_image finished (docs/images.md): the encoded
bytes, or why they could not be produced.
BitmapRendered
A canvas drawing started by Toolkit::render_bitmap finished rendering
(docs/canvas.md “Exporting”). Keyed by request id like Event::ImageDecoded, and like
it carries no bitmap id: day-core minted the id and handed it over with the ops, so the
answer is only the facts of the image the backend stored under it.
PdfRendered
A PDF started by Toolkit::render_pdf finished (docs/canvas.md “Exporting”): the
document’s bytes, or why they could not be produced.
Custom
An open, piece-defined event (§8.2). tag names the event for in-process emitters (a static
literal); it is empty for events that cross a native boundary (JNI/C-ABI), which carry only the
primitive num/text payload. A piece’s cx.on reads whichever fields it needs. This is the
escape hatch for events the fixed variants above don’t cover (a web view’s URL, a picked date, …).
MenuAction(u64)
A menu item (app menu or context menu) with this action id was activated (§ menus). day-core
routes it to the app closure registered for the id. Standard-role items don’t carry an id
(role items are handled natively) so they never emit this.
ToolbarChanged
A toolbar item produced a value: a search field’s text, a toggle’s new state
(docs/toolbars.md). action is the item’s dispatch id, from the same registry
Event::MenuAction uses, and day-core routes it to the closure registered for it.
A plain toolbar button has no value and emits MenuAction instead.
SearchChanged(String)
A searchable navigation surface’s field changed (docs/search.md). Emitted against the nav host’s node, not through the toolbar’s dispatch registry: search belongs to the surface, so the field can move between the toolbar and the navigation list without the app re-registering anything.
SearchScopeChanged(usize)
The user picked a different scope. Carries the index into SearchProps::scopes.
SearchSuggestionChosen(usize)
The user chose one of SearchProps::suggestions, by index. The toolkit has already put
that completion in the field and emitted Event::SearchChanged for it; this says which
one, for an app that wants to act on the choice itself.
SearchSubmitted(String)
The user submitted the inline field’s text with its Return or Search key. Emitted
after the last Event::SearchChanged, with the text as submitted, for a search that
runs on demand (a server query) rather than narrowing as the text changes.
Lifecycle(Lifecycle)
The app moved through a lifecycle phase (docs/lifecycle.md). Backends emit this from the
native app/activity delegate; day-core routes it to the app’s on_lifecycle handlers.
WindowClosed
A secondary native window closed (the title-bar close, a platform gesture such as an
app-switcher swipe or an activity finish, or Toolkit::close_window); emitted on the
window’s root node after the platform committed the close. day-core disposes the
window’s subtree on receipt, so native and programmatic closes share one teardown
path (docs/windows.md). Never emitted for the primary window (its close terminates
the app).
WindowFocused(bool)
A secondary window’s key/active state changed; emitted on the window’s root node. day-core tracks the focused window with it (dialog parenting, dayscript targeting).
WindowStateChanged(WindowState)
A window’s display state changed (docs/windows.md): the user minimized, zoomed or took it
fullscreen, or a WindowChange::State request landed. Emitted on the window’s root node
(the primary’s may arrive on WINDOW_NODE); day-core feeds the window’s state()
signal with it, so the app reads what the platform did rather than what it asked for.
ListReorder
A native list committed a drag-reorder (docs/list.md): row from landed at row to.
Emitted on the LIST node by the list piece’s commit hook: the reorder driver
rotates its snapshot synchronously inside the platform’s drop callback, then reports
through the event queue so the app’s on_reorder never runs inside a native animation
callstack.
ListDelete(usize)
A native list committed a swipe-delete (docs/list.md): the row at this index is gone.
Deferred through the event queue exactly as Event::ListReorder is.
RefreshRequested
The native pull-to-refresh control requested an update. The app owns its busy state.
ListSwipe
A native list activated a swipe action (docs/list.md): the user pressed button action
(an index into the row’s ListSwipe::actions_at offer for edge) on row index, or
swiped clear across for the edge’s first action. Emitted on the LIST node by the list
piece’s commit hook and deferred through the event queue exactly as
Event::ListReorder is, so the app’s handler never runs inside a native animation
callstack.
CoverHidden
A fullscreen cover’s hide transition finished (docs/cover.md): the content can now be
disposed. Answers props::CoverPatch::Dismiss; delivery is a hard guarantee, and
backends over-report rather than under-report; consumers gate on their own closing
flag, so duplicates and belated reports are no-ops.
InspectorChanged(bool)
The user showed or hid an inspector pane through a native affordance (a dock widget’s
close button, a divider dragged shut) rather than through Day (docs/inspector.md).
Emitted on the kinds::INSPECTOR node, and only when the visibility actually changed;
the piece writes it back to the bound signal. Applying
props::InspectorPatch::Visible must never re-emit it (the from-native echo rule).
TreeExpanded
The user disclosed or collapsed a tree row through the native affordance (docs/tree.md).
Emitted on the kinds::TREE node; the piece writes it back to the app’s expansion
signal. Applying props::TreePatch::Expand must never re-emit it (the from-native
echo rule).
TreeMove
A native tree committed a drag move (docs/tree.md): token now sits under parent
(None = the root) at index (None = dropped onto the parent, an append). Deferred
through the event queue exactly as Event::ListReorder is; the app’s on_move
writes its own data, whose refresh reloads the tree.
TreeSelection(Vec<u64>)
A tree’s selection changed: the full set of selected row tokens (empty = cleared). Token-addressed, since a tree cannot speak row indices: expanding a row renumbers everything below it (docs/tree.md).