plushie/event

Typed events emitted by the Plushie runtime.

The renderer sends raw protocol messages, and the SDK decodes them into this public Event API before your app sees them. In a simple app these events are passed to update; custom-message apps can map them through on_event first. The top-level Event type categorizes events into families (Widget, Key, Window, etc.), each wrapping a dedicated sub-type with typed fields.

case event {
  Widget(Click(target: EventTarget(id: "inc", ..))) ->
    #(Model(..model, count: model.count + 1), command.none())
  Widget(Input(target: EventTarget(id: "name", ..), value: text)) ->
    #(Model(..model, name: text), command.none())
  Key(KeyEvent(event_type: KeyPressed, key: "Escape", ..)) ->
    #(Model(..model, menu_open: False), command.none())
  _ -> #(model, command.none())
}

Types

An async task completed.

pub type AsyncEvent {
  AsyncEvent(
    tag: String,
    result: Result(dynamic.Dynamic, dynamic.Dynamic),
  )
}

Constructors

Typed diagnostic payload emitted by the renderer. Each variant mirrors the renderer’s plushie-core::Diagnostic enum and carries the structured fields the emitter knew at the time.

pub type Diagnostic {
  DuplicateId(id: String, window_id: option.Option(String))
  EmptyId(type_name: String)
  MultipleTopLevelWindows(window_ids: List(String))
  UnknownWindow(window_id: String, subscription_tag: String)
  UnrecognizedWidgetPlaceholder(id: String)
  TreeDepthExceeded(id: String, max_depth: Int)
  TooManyDuplicates(limit: Int)
  WidgetIdInvalid(
    reason: String,
    type_name: String,
    id: String,
    detail: String,
  )
  MissingAccessibleName(type_name: String, id: String)
  A11yRefUnresolved(
    id: String,
    key: String,
    value: String,
    is_member: Bool,
  )
  PropRangeExceeded(
    id: String,
    type_name: String,
    prop: String,
    raw: Float,
    clamped: Float,
    non_finite: Bool,
  )
  PropTypeMismatch(
    id: String,
    type_name: String,
    prop: String,
    value_debug: String,
    expected_debug: String,
  )
  PropUnknown(
    id: String,
    type_name: String,
    prop: String,
    known_debug: String,
  )
  ContentLengthExceeded(
    id: String,
    field: String,
    actual: Int,
    cap: Int,
    truncated: Int,
  )
  FontCacheCapExceeded(max: Int)
  FontCapExceeded(
    max: Int,
    requested: Int,
    granted: Int,
    dropped: Int,
  )
  FontFamilyNotFound(family: String)
  InvalidSettings(detail: String)
  RequiredWidgetsMissing(missing: List(String))
  WidgetPanic(id: String, type_name: String, label: String)
  SvgParseError(id: String, source: String, detail: String)
  SvgDecodeTimeout(
    id: String,
    source: String,
    deadline_debug: String,
  )
  DashCacheCapExceeded(max: Int)
  EmitterCoalesceCapExceeded(cap: Int)
  WidgetIdTypeCollision(
    id: String,
    existing_type: String,
    incoming_type: String,
  )
  ViewPanicked(consecutive: Int, message: String)
  UpdatePanicked(consecutive: Int, message: String)
  UnknownMessageType(msg_type: String)
  DispatchLoopExceeded(depth: Int, limit: Int)
  BufferOverflow(size: Int, limit: Int)
}

Constructors

  • DuplicateId(id: String, window_id: option.Option(String))

    A widget ID collided with one already declared within the same window scope.

  • EmptyId(type_name: String)

    A widget was declared with an empty ID where a non-empty one was expected.

  • MultipleTopLevelWindows(window_ids: List(String))

    More than one window appeared at the top level of the tree.

  • UnknownWindow(window_id: String, subscription_tag: String)

    A subscription was declared for a window not in the tree.

  • UnrecognizedWidgetPlaceholder(id: String)

    A __widget__ placeholder had no registered expander.

  • TreeDepthExceeded(id: String, max_depth: Int)

    Tree traversal hit the global depth cap.

  • TooManyDuplicates(limit: Int)

    Duplicate-ID collection stopped at the configured cap.

  • WidgetIdInvalid(
      reason: String,
      type_name: String,
      id: String,
      detail: String,
    )

    A user-authored widget ID violated the canonical ID ruleset.

  • MissingAccessibleName(type_name: String, id: String)

    A widget that needs an accessible name was declared without one.

  • A11yRefUnresolved(
      id: String,
      key: String,
      value: String,
      is_member: Bool,
    )

    A cross-widget a11y reference did not resolve to any declared widget.

  • PropRangeExceeded(
      id: String,
      type_name: String,
      prop: String,
      raw: Float,
      clamped: Float,
      non_finite: Bool,
    )

    A numeric prop was outside its declared range and was clamped.

  • PropTypeMismatch(
      id: String,
      type_name: String,
      prop: String,
      value_debug: String,
      expected_debug: String,
    )

    A prop value had an unexpected JSON type.

  • PropUnknown(
      id: String,
      type_name: String,
      prop: String,
      known_debug: String,
    )

    A widget carried a prop name not in its declared schema.

  • ContentLengthExceeded(
      id: String,
      field: String,
      actual: Int,
      cap: Int,
      truncated: Int,
    )

    A text-like content prop exceeded its per-widget byte cap.

  • FontCacheCapExceeded(max: Int)

    The leaked font-family-name cache reached its entry cap.

  • FontCapExceeded(
      max: Int,
      requested: Int,
      granted: Int,
      dropped: Int,
    )

    Inline fonts declared in Settings exceeded the process-wide cap.

  • FontFamilyNotFound(family: String)

    A font family from default_font (or fallbacks) did not resolve to a loaded or built-in family.

  • InvalidSettings(detail: String)

    The Settings payload failed typed validation.

  • RequiredWidgetsMissing(missing: List(String))

    required_widgets named native widgets the renderer doesn’t know about.

  • WidgetPanic(id: String, type_name: String, label: String)

    A widget panicked inside the registry’s catch_unwind firewall.

  • SvgParseError(id: String, source: String, detail: String)

    SVG decode returned a parse error.

  • SvgDecodeTimeout(
      id: String,
      source: String,
      deadline_debug: String,
    )

    SVG decode exceeded its wall-clock budget.

  • DashCacheCapExceeded(max: Int)

    The leaked dash-segment cache reached its entry cap.

  • EmitterCoalesceCapExceeded(cap: Int)

    The renderer-lib event coalesce map hit its cap and was force-flushed.

  • WidgetIdTypeCollision(
      id: String,
      existing_type: String,
      incoming_type: String,
    )

    A composite widget ID was registered against two different widget types.

  • ViewPanicked(consecutive: Int, message: String)

    The view function panicked and was caught by the runtime.

  • UpdatePanicked(consecutive: Int, message: String)

    The update function panicked and was caught by the runtime. The model is reverted to the last-good snapshot so the app keeps running; the consecutive counter is shared with ViewPanicked so the frozen-UI overlay surfaces after enough total panics across either callback.

  • UnknownMessageType(msg_type: String)

    A wire message carried a type field the SDK does not recognise.

  • DispatchLoopExceeded(depth: Int, limit: Int)

    The runtime’s command dispatch chain exceeded the configured depth limit, indicating an update loop that keeps returning a command whose delivered event produces another command.

  • BufferOverflow(size: Int, limit: Int)

    A single wire message exceeded the protocol’s 64 MiB per-message size cap.

Severity level of a diagnostic emitted by the renderer.

pub type DiagnosticLevel {
  DiagnosticInfo
  DiagnosticWarn
  DiagnosticError
}

Constructors

  • DiagnosticInfo
  • DiagnosticWarn
  • DiagnosticError

A platform effect responded.

pub type EffectEvent {
  EffectEvent(tag: String, result: EffectResult)
}

Constructors

Typed outcome of a platform effect.

Matches the Rust SDK’s EffectResult enum. Host SDKs share the concept across language-idiomatic shapes; Gleam models it as a sum type so apps can pattern-match on the variant directly.

pub type EffectResult {
  FileOpened(path: String)
  FilesOpened(paths: List(String))
  FileSaved(path: String)
  DirectorySelected(path: String)
  DirectoriesSelected(paths: List(String))
  ClipboardText(text: String)
  ClipboardHtml(html: String, alt_text: option.Option(String))
  ClipboardWritten
  ClipboardCleared
  NotificationShown
  EffectCancelled
  EffectTimeout
  EffectError(message: String)
  EffectUnsupported
  RendererRestarted
}

Constructors

  • FileOpened(path: String)

    A file was selected from an open-file dialog.

  • FilesOpened(paths: List(String))

    Multiple files were selected from a multi-file open dialog.

  • FileSaved(path: String)

    A file path was chosen in a save dialog.

  • DirectorySelected(path: String)

    A directory was selected from a directory picker.

  • DirectoriesSelected(paths: List(String))

    Multiple directories were selected.

  • ClipboardText(text: String)

    Clipboard text was read.

  • ClipboardHtml(html: String, alt_text: option.Option(String))

    Clipboard HTML was read. alt_text may be None.

  • ClipboardWritten

    Clipboard write completed.

  • ClipboardCleared

    Clipboard was cleared.

  • NotificationShown

    An OS notification was shown.

  • EffectCancelled

    The user dismissed a dialog.

  • EffectTimeout

    The effect did not receive a response within its timeout.

  • EffectError(message: String)

    A platform error occurred. message is renderer-supplied.

  • EffectUnsupported

    The backend does not support this effect.

  • RendererRestarted

    The renderer restarted while this effect was in flight.

Runtime and renderer errors.

pub type ErrorEvent {
  CommandError(
    reason: String,
    id: option.Option(String),
    family: option.Option(String),
    widget_type: option.Option(String),
    message: option.Option(String),
  )
  RendererError(id: String, data: dynamic.Dynamic)
  DuplicateNodeIds(details: dynamic.Dynamic)
  Diagnostic(session: String, level: String, payload: Diagnostic)
  PropValidation(
    node_id: String,
    node_type: String,
    warnings: List(String),
  )
  ProtocolVersionMismatch(expected: Int, got: Int)
}

Constructors

  • CommandError(
      reason: String,
      id: option.Option(String),
      family: option.Option(String),
      widget_type: option.Option(String),
      message: option.Option(String),
    )

    A widget command failed.

  • RendererError(id: String, data: dynamic.Dynamic)

    A generic renderer error.

  • DuplicateNodeIds(details: dynamic.Dynamic)

    The tree contains duplicate node IDs after normalization.

  • Diagnostic(session: String, level: String, payload: Diagnostic)

    A structured diagnostic emitted by the renderer.

    session is the session ID this diagnostic is attributable to, or an empty string for process-scoped diagnostics (font load failures, renderer startup / panic, writer-dead, anything that affects the whole renderer rather than one session). Session-scoped diagnostics (widget panics, view errors, tree validation warnings) always carry a non-empty session. level is "info", "warn", or "error". payload is one of the typed [Diagnostic] variants.

  • PropValidation(
      node_id: String,
      node_type: String,
      warnings: List(String),
    )

    Prop validation warning from the renderer.

  • ProtocolVersionMismatch(expected: Int, got: Int)

    The renderer’s advertised protocol version did not match the version this SDK was built against. The runtime stops after surfacing this event so the app can observe it before teardown.

All events from the plushie runtime, grouped by category.

pub type Event {
  Widget(WidgetEvent)
  Key(KeyEvent)
  Window(WindowEvent)
  Timer(TimerEvent)
  Async(AsyncEvent)
  Stream(StreamEvent)
  Effect(EffectEvent)
  System(SystemEvent)
  Ime(ImeEvent)
  ModifiersChanged(ModifiersEvent)
  Error(ErrorEvent)
  Session(SessionEvent)
}

Constructors

  • Widget(WidgetEvent)

    Widget interaction events (clicks, input, focus, pointer, etc.)

  • Key(KeyEvent)

    Keyboard events from subscriptions.

  • Window(WindowEvent)

    Window lifecycle events.

  • Timer(TimerEvent)

    Timer tick events.

  • Async(AsyncEvent)

    Async task results.

  • Stream(StreamEvent)

    Stream intermediate values.

  • Effect(EffectEvent)

    Platform effect responses (file dialogs, clipboard, etc.)

  • System(SystemEvent)

    System queries, theme changes, animation frames, etc.

  • Ime(ImeEvent)

    IME (Input Method Editor) events.

  • ModifiersChanged(ModifiersEvent)

    Modifier key state changes.

  • Error(ErrorEvent)

    Errors from the renderer or runtime.

  • Session(SessionEvent)

    Multiplexed session lifecycle events.

Widget identity: which widget, in which scope, in which window.

  • id: the widget’s local ID (last segment after scope splitting)
  • scope: ancestor chain (nearest first, window_id last)
  • window_id: the originating window
  • full: the canonical wire ID (e.g. “main#form/email”)
pub type EventTarget {
  EventTarget(
    window_id: String,
    id: String,
    scope: List(String),
    full: String,
  )
}

Constructors

  • EventTarget(
      window_id: String,
      id: String,
      scope: List(String),
      full: String,
    )

An Input Method Editor event for CJK and complex text input.

pub type ImeEvent {
  ImeEvent(
    event_type: ImeEventType,
    window_id: String,
    text: option.Option(String),
    cursor: option.Option(#(Int, Int)),
    captured: Bool,
  )
}

Constructors

IME event type. Lifecycle: Opened -> Preedit* -> Commit -> Closed.

pub type ImeEventType {
  ImeOpened
  ImePreedit
  ImeCommit
  ImeClosed
}

Constructors

  • ImeOpened
  • ImePreedit
  • ImeCommit
  • ImeClosed

A keyboard event from a subscription.

pub type KeyEvent {
  KeyEvent(
    event_type: KeyEventType,
    window_id: String,
    key: String,
    modified_key: String,
    modifiers: Modifiers,
    physical_key: option.Option(String),
    location: KeyLocation,
    text: option.Option(String),
    repeat: Bool,
    captured: Bool,
  )
}

Constructors

  • KeyEvent(
      event_type: KeyEventType,
      window_id: String,
      key: String,
      modified_key: String,
      modifiers: Modifiers,
      physical_key: option.Option(String),
      location: KeyLocation,
      text: option.Option(String),
      repeat: Bool,
      captured: Bool,
    )

    Arguments

    modified_key

    Key value after modifier transforms (e.g. Shift+a -> “A”).

    captured

    Whether a widget already consumed this event.

Keyboard event type.

pub type KeyEventType {
  KeyPressed
  KeyReleased
}

Constructors

  • KeyPressed
  • KeyReleased

Key location on the keyboard.

pub type KeyLocation {
  Standard
  LeftSide
  RightSide
  Numpad
}

Constructors

  • Standard
  • LeftSide
  • RightSide
  • Numpad

Keyboard modifier state.

pub type Modifiers {
  Modifiers(
    shift: Bool,
    ctrl: Bool,
    alt: Bool,
    logo: Bool,
    command: Bool,
  )
}

Constructors

  • Modifiers(
      shift: Bool,
      ctrl: Bool,
      alt: Bool,
      logo: Bool,
      command: Bool,
    )

The set of held modifier keys changed.

pub type ModifiersEvent {
  ModifiersEvent(
    window_id: String,
    modifiers: Modifiers,
    captured: Bool,
  )
}

Constructors

  • ModifiersEvent(
      window_id: String,
      modifiers: Modifiers,
      captured: Bool,
    )

Mouse button identifier.

pub type MouseButton {
  LeftButton
  RightButton
  MiddleButton
  BackButton
  ForwardButton
  OtherButton(String)
}

Constructors

  • LeftButton
  • RightButton
  • MiddleButton
  • BackButton
  • ForwardButton
  • OtherButton(String)

Input device type for pointer events.

pub type PointerType {
  Mouse
  Touch
  Pen
}

Constructors

  • Mouse
  • Touch
  • Pen

Widget scroll viewport data.

pub type ScrollData {
  ScrollData(
    absolute_x: Float,
    absolute_y: Float,
    relative_x: Float,
    relative_y: Float,
    bounds_width: Float,
    bounds_height: Float,
    content_width: Float,
    content_height: Float,
  )
}

Constructors

  • ScrollData(
      absolute_x: Float,
      absolute_y: Float,
      relative_x: Float,
      relative_y: Float,
      bounds_width: Float,
      bounds_height: Float,
      content_width: Float,
      content_height: Float,
    )

Scroll measurement unit.

pub type ScrollUnit {
  Line
  Pixel
}

Constructors

  • Line
  • Pixel

Session lifecycle events emitted when the renderer is run with --max-sessions > 1.

pub type SessionEvent {
  SessionError(session: String, code: String, error: String)
  SessionClosed(session: String, reason: String)
}

Constructors

  • SessionError(session: String, code: String, error: String)

    A session encountered an error (panic, cap, transport failure).

    code is the stable diagnostic code from the protocol spec (max_sessions_reached, session_panic, session_channel_closed, etc.) used for programmatic matching; error carries the free-form message intended for logs.

  • SessionClosed(session: String, reason: String)

    A session was closed by the renderer (Reset complete, etc.).

A stream emitted an intermediate value.

pub type StreamEvent {
  StreamEvent(tag: String, value: dynamic.Dynamic)
}

Constructors

System queries, theme changes, and runtime events.

pub type SystemEvent {
  SystemInfo(tag: String, value: dynamic.Dynamic)
  SystemTheme(tag: String, theme: String)
  ThemeChanged(theme: String)
  AnimationFrame(timestamp: Int)
  AllWindowsClosed
  ImageList(tag: String, handles: List(String))
  TreeHash(tag: String, hash: String)
  FocusedWidget(tag: String, widget_id: option.Option(String))
  ScreenshotData(
    tag: String,
    hash: String,
    width: Int,
    height: Int,
    pixels: BitArray,
  )
  Announce(text: String)
  RecoveryFailed(
    kind: String,
    error: String,
    renderer_exit: renderer_exit.RendererExit,
  )
}

Constructors

  • SystemInfo(tag: String, value: dynamic.Dynamic)

    Response to a GetSystemInfo query.

  • SystemTheme(tag: String, theme: String)

    Response to a GetSystemTheme query. Use theme.system_theme_from_string to convert the raw renderer value.

  • ThemeChanged(theme: String)

    The OS theme preference changed at runtime. Use theme.system_theme_from_string to convert the raw renderer value.

  • AnimationFrame(timestamp: Int)

    An animation frame tick (monotonic ms).

  • AllWindowsClosed

    All windows have been closed.

  • ImageList(tag: String, handles: List(String))

    Response to a ListImages query.

  • TreeHash(tag: String, hash: String)

    Response to a TreeHashQuery.

  • FocusedWidget(tag: String, widget_id: option.Option(String))

    Response to a FindFocused query.

  • ScreenshotData(
      tag: String,
      hash: String,
      width: Int,
      height: Int,
      pixels: BitArray,
    )

    Response to a Screenshot command with decoded pixel data.

  • Announce(text: String)

    Screen reader announcement (headless/mock mode).

  • RecoveryFailed(
      kind: String,
      error: String,
      renderer_exit: renderer_exit.RendererExit,
    )

    The renderer recovery callback (on_renderer_exit) crashed. The app can use this to reset to a safe state or show an error.

A timer subscription fired.

pub type TimerEvent {
  TimerEvent(tag: String, timestamp: Int)
}

Constructors

  • TimerEvent(tag: String, timestamp: Int)

Widget interaction events. Each variant carries an EventTarget identifying which widget, in which scope, in which window.

pub type WidgetEvent {
  Click(target: EventTarget)
  Input(target: EventTarget, value: String)
  Submit(target: EventTarget, value: String)
  Toggle(target: EventTarget, value: Bool)
  Select(target: EventTarget, value: String)
  Slide(target: EventTarget, value: Float)
  SlideRelease(target: EventTarget, value: Float)
  Paste(target: EventTarget, value: String)
  Scrolled(target: EventTarget, data: ScrollData)
  Open(target: EventTarget)
  Close(target: EventTarget)
  OptionHovered(target: EventTarget, value: String)
  Sort(target: EventTarget, value: String)
  KeyBinding(target: EventTarget, value: String)
  LinkClicked(target: EventTarget, link: String)
  Press(
    target: EventTarget,
    x: Float,
    y: Float,
    button: MouseButton,
    pointer: PointerType,
    finger: option.Option(Int),
    modifiers: Modifiers,
    captured: Bool,
  )
  Release(
    target: EventTarget,
    x: Float,
    y: Float,
    button: MouseButton,
    pointer: PointerType,
    finger: option.Option(Int),
    modifiers: Modifiers,
    captured: Bool,
    lost: option.Option(Bool),
  )
  Move(
    target: EventTarget,
    x: Float,
    y: Float,
    pointer: PointerType,
    finger: option.Option(Int),
    modifiers: Modifiers,
    captured: Bool,
  )
  Scroll(
    target: EventTarget,
    x: Float,
    y: Float,
    delta_x: Float,
    delta_y: Float,
    pointer: PointerType,
    modifiers: Modifiers,
    unit: option.Option(ScrollUnit),
    captured: Bool,
  )
  Enter(
    target: EventTarget,
    x: option.Option(Float),
    y: option.Option(Float),
  )
  Exit(
    target: EventTarget,
    x: option.Option(Float),
    y: option.Option(Float),
  )
  DoubleClick(
    target: EventTarget,
    x: Float,
    y: Float,
    pointer: PointerType,
    modifiers: Modifiers,
  )
  Resize(target: EventTarget, width: Float, height: Float)
  Focused(target: EventTarget)
  Blurred(target: EventTarget)
  Drag(
    target: EventTarget,
    x: Float,
    y: Float,
    delta_x: Float,
    delta_y: Float,
  )
  DragEnd(target: EventTarget, x: Float, y: Float)
  WidgetKeyPress(
    target: EventTarget,
    key: String,
    modified_key: String,
    physical_key: option.Option(String),
    modifiers: Modifiers,
    location: KeyLocation,
    text: option.Option(String),
    repeat: Bool,
  )
  WidgetKeyRelease(
    target: EventTarget,
    key: String,
    modified_key: String,
    physical_key: option.Option(String),
    modifiers: Modifiers,
    location: KeyLocation,
    text: option.Option(String),
  )
  TransitionComplete(
    target: EventTarget,
    tag: String,
    prop: String,
  )
  Status(target: EventTarget, value: dynamic.Dynamic)
  PaneResized(
    target: EventTarget,
    split: dynamic.Dynamic,
    ratio: Float,
  )
  PaneDragged(
    target: EventTarget,
    pane: dynamic.Dynamic,
    drop_target: dynamic.Dynamic,
    action: String,
    region: option.Option(String),
    edge: option.Option(String),
  )
  PaneClicked(target: EventTarget, pane: dynamic.Dynamic)
  PaneFocusCycle(target: EventTarget, pane: dynamic.Dynamic)
  CustomWidget(
    kind: String,
    target: EventTarget,
    value: dynamic.Dynamic,
    data: dynamic.Dynamic,
  )
}

Constructors

  • Click(target: EventTarget)

    A widget was clicked.

  • Input(target: EventTarget, value: String)

    Text was entered into a text_input or text_editor.

  • Submit(target: EventTarget, value: String)

    A text input was submitted (e.g. Enter pressed).

  • Toggle(target: EventTarget, value: Bool)

    A toggler or checkbox changed state.

  • Select(target: EventTarget, value: String)

    An option was selected in a pick_list or combo_box.

  • Slide(target: EventTarget, value: Float)

    A slider value changed during dragging.

  • SlideRelease(target: EventTarget, value: Float)

    A slider was released at its final value.

  • Paste(target: EventTarget, value: String)

    Text was pasted into a text input or editor.

  • Scrolled(target: EventTarget, data: ScrollData)

    A scrollable widget’s viewport position changed.

  • Open(target: EventTarget)

    A collapsible widget was opened (e.g. combo_box dropdown).

  • Close(target: EventTarget)

    A collapsible widget was closed.

  • OptionHovered(target: EventTarget, value: String)

    An option in a pick_list or combo_box was hovered.

  • Sort(target: EventTarget, value: String)

    A sortable column header was clicked.

  • KeyBinding(target: EventTarget, value: String)

    A registered key binding was triggered on a widget.

  • LinkClicked(target: EventTarget, link: String)

    A hyperlink in a link-capable widget (rich_text, markdown) was clicked. Carries the link URL extracted from the event payload.

  • Press(
      target: EventTarget,
      x: Float,
      y: Float,
      button: MouseButton,
      pointer: PointerType,
      finger: option.Option(Int),
      modifiers: Modifiers,
      captured: Bool,
    )

    A pointer button was pressed (mouse click, touch start).

  • Release(
      target: EventTarget,
      x: Float,
      y: Float,
      button: MouseButton,
      pointer: PointerType,
      finger: option.Option(Int),
      modifiers: Modifiers,
      captured: Bool,
      lost: option.Option(Bool),
    )

    A pointer button was released.

    Arguments

    lost

    Present on touch release events when the release happened outside the widget’s bounds. Absent for mouse / pen releases.

  • Move(
      target: EventTarget,
      x: Float,
      y: Float,
      pointer: PointerType,
      finger: option.Option(Int),
      modifiers: Modifiers,
      captured: Bool,
    )

    A pointer moved.

  • Scroll(
      target: EventTarget,
      x: Float,
      y: Float,
      delta_x: Float,
      delta_y: Float,
      pointer: PointerType,
      modifiers: Modifiers,
      unit: option.Option(ScrollUnit),
      captured: Bool,
    )

    A pointer wheel/scroll event.

  • Enter(
      target: EventTarget,
      x: option.Option(Float),
      y: option.Option(Float),
    )

    A pointer entered a widget’s bounds. Canvas elements include x/y coordinates; widget-level events leave them as None.

  • Exit(
      target: EventTarget,
      x: option.Option(Float),
      y: option.Option(Float),
    )

    A pointer exited a widget’s bounds. Canvas elements may include x/y coordinates; widget-level events leave them as None.

  • DoubleClick(
      target: EventTarget,
      x: Float,
      y: Float,
      pointer: PointerType,
      modifiers: Modifiers,
    )

    A double-click was detected.

  • Resize(target: EventTarget, width: Float, height: Float)

    A widget was resized (e.g. sensor detecting layout changes).

  • Focused(target: EventTarget)

    A focusable element gained focus.

  • Blurred(target: EventTarget)

    A focusable element lost focus.

  • Drag(
      target: EventTarget,
      x: Float,
      y: Float,
      delta_x: Float,
      delta_y: Float,
    )

    A draggable element is being dragged.

  • DragEnd(target: EventTarget, x: Float, y: Float)

    A drag ended on a draggable element.

  • WidgetKeyPress(
      target: EventTarget,
      key: String,
      modified_key: String,
      physical_key: option.Option(String),
      modifiers: Modifiers,
      location: KeyLocation,
      text: option.Option(String),
      repeat: Bool,
    )

    A key was pressed while a widget had keyboard focus. Distinct from the global Key event: this variant is scoped to a widget via target so apps can react without a global subscription.

  • WidgetKeyRelease(
      target: EventTarget,
      key: String,
      modified_key: String,
      physical_key: option.Option(String),
      modifiers: Modifiers,
      location: KeyLocation,
      text: option.Option(String),
    )

    A key was released while a widget had keyboard focus.

  • TransitionComplete(
      target: EventTarget,
      tag: String,
      prop: String,
    )

    A renderer-side transition completed.

  • Status(target: EventTarget, value: dynamic.Dynamic)

    A widget status event (used internally for focus tracking).

  • PaneResized(
      target: EventTarget,
      split: dynamic.Dynamic,
      ratio: Float,
    )

    A pane grid split was resized.

  • PaneDragged(
      target: EventTarget,
      pane: dynamic.Dynamic,
      drop_target: dynamic.Dynamic,
      action: String,
      region: option.Option(String),
      edge: option.Option(String),
    )

    A pane was dragged (drag-and-drop reorder).

  • PaneClicked(target: EventTarget, pane: dynamic.Dynamic)

    A pane was clicked.

  • PaneFocusCycle(target: EventTarget, pane: dynamic.Dynamic)

    A pane focus cycle was triggered (Tab navigation).

  • CustomWidget(
      kind: String,
      target: EventTarget,
      value: dynamic.Dynamic,
      data: dynamic.Dynamic,
    )

    Catch-all for custom or future widget event families.

A window lifecycle event. Optional fields carry data relevant to the specific event type (e.g. width/height for Resized).

pub type WindowEvent {
  WindowEvent(
    event_type: WindowEventType,
    window_id: String,
    width: option.Option(Float),
    height: option.Option(Float),
    x: option.Option(Float),
    y: option.Option(Float),
    scale_factor: option.Option(Float),
    path: option.Option(String),
  )
}

Constructors

Window lifecycle event type.

pub type WindowEventType {
  Opened
  Closed
  CloseRequested
  Resized
  Moved
  WindowFocused
  WindowUnfocused
  Rescaled
  FileHovered
  FileDropped
  FilesHoveredLeft
}

Constructors

  • Opened
  • Closed
  • CloseRequested
  • Resized
  • Moved
  • WindowFocused
  • WindowUnfocused
  • Rescaled
  • FileHovered
  • FileDropped
  • FilesHoveredLeft

Values

pub fn make_target(
  wire_id: String,
  window_id: String,
) -> EventTarget

Build an EventTarget from a wire-format scoped ID and explicit window ID.

Prefers the window extracted from the # in the ID. Falls back to the explicit window_id parameter for backwards compatibility.

pub fn modifiers_none() -> Modifiers

No modifiers pressed.

pub fn split_scoped_id(
  wire_id: String,
) -> #(String, List(String), String)

Parse a wire-format scoped ID into (local_id, scope_list, window_id).

Handles the canonical window#scope/path/id format.

Search Document