Sign in

    LunarEvent

    MoonBit terminal event API backed by TerminalEvent C FFI

    terminal
    event
    tui
    Download zip
    Version
    0.1.0
    License
    Apache-2.0
    Last updated
    4 months ago
    Downloads
    121

    #FrozenLemonTee/LunarEvent

    MoonBit terminal event layer backed by TerminalEvent's C FFI surface.

    Package boundaries:

    • FrozenLemonTee/TerminalEvent/moonbit/lte_native owns the raw lte_* C ABI binding.
    • FrozenLemonTee/LunarEvent maps that ABI into MoonBit Event / EventBackend types.
    • FrozenLemonTee/LunarEvent/lunartui adapts Event into LunarTUI @base.Event and exposes EventSource.

    LunarEvent does not include or reference TerminalEvent C++ headers or source files. It only imports the MoonBit FFI package.

    Event

    pub(all) enum Event {
    Key(KeyEvent)
    Resize(ResizeEvent)
    Paste(String)
    Mouse(MouseEvent)
    Focus(FocusEvent)
    Unknown(String)
    } derive(Eq)

    EventBackend

    pub struct EventBackend {
    }

    EventBackend::enter_raw_mode

    fn EventBackend::enter_raw_mode(self : EventBackend) -> Result[Unit, TerminalError]

    EventBackend::new

    EventBackend::poll_event

    fn EventBackend::poll_event(self : EventBackend, timeout_ms : Int) -> Event?

    EventBackend::restore_terminal

    fn EventBackend::restore_terminal(self : EventBackend) -> Unit

    EventBackend::shutdown

    fn EventBackend::shutdown(self : EventBackend) -> Unit

    EventBackend::terminal_size

    fn EventBackend::terminal_size(self : EventBackend) -> Result[Size, TerminalError]

    EventStream

    pub struct EventStream {
    buf : Array[Event]
    }

    impl Add for EventStream

    EventStream::add

    fn EventStream::add(self : EventStream, event : Event) -> EventStream

    EventStream::add_all

    fn EventStream::add_all(self : EventStream, stream : Array[Event]) -> EventStream

    EventStream::new

    fn EventStream::new(stream : Array[Event]) -> EventStream

    FocusEvent

    pub(all) struct FocusEvent {
    state : FocusState
    } derive(Eq)

    FocusState

    pub(all) enum FocusState {
    Gained
    Lost
    } derive(Eq)

    KeyCode

    pub(all) enum KeyCode {
    Character
    Enter
    Escape
    Backspace
    Tab
    Left
    Right
    Up
    Down
    Home
    End
    PageUp
    PageDown
    Insert
    Delete
    Function(Int)
    Unknown
    } derive(Eq)

    KeyEvent

    pub(all) struct KeyEvent {
    code : KeyCode
    text : String?
    modifiers : Modifiers
    } derive(Eq)

    Modifiers

    pub(all) struct Modifiers {
    shift : Bool
    ctrl : Bool
    alt : Bool
    meta : Bool
    } derive(Eq)

    Modifiers::new

    fn Modifiers::new(shift? : Bool, ctrl? : Bool, alt? : Bool, meta? : Bool) -> Modifiers

    MouseAction

    pub(all) enum MouseAction {
    Move
    Down
    Up
    Drag
    Scroll
    Unknown
    } derive(Eq)

    MouseButton

    pub(all) enum MouseButton {
    Left
    Right
    Middle
    Back
    Forward
    Unknown
    } derive(Eq)

    MouseEvent

    pub(all) struct MouseEvent {
    button : MouseButton
    action : MouseAction
    x : Int
    y : Int
    modifiers : Modifiers
    } derive(Eq)

    ResizeEvent

    pub(all) struct ResizeEvent {
    width : Int
    height : Int
    } derive(Eq)

    Size

    pub(all) struct Size {
    width : Int
    height : Int
    } derive(Eq)

    TerminalError

    pub(all) enum TerminalError {
    NativeError(Int)
    } derive(Eq)

    Powered by MoonBit

    Site sourceReport issuePackagesBuild queueSkillsStatistics

    © 2026 mooncakes.io