### Counter App using ExRatatui.App Behaviour Source: https://hexdocs.pm/ex_ratatui Illustrates a counter application built using the `ExRatatui.App` behaviour. This example shows how to manage state and handle events within an ExRatatui application. ```elixir iex> ExRatatui.start() iex> ExRatatui.App.run(MyApp, mouse_capture: true, focus_events: true) ``` -------------------------------- ### Minimal Paragraph Display Source: https://hexdocs.pm/ex_ratatui Demonstrates a minimal ExRatatui application displaying a paragraph. This is a basic example to get started with rendering text in the terminal. ```elixir iex> ExRatatui.start() iex> ExRatatui.Paragraph.new("Hello, world!") |> ExRatatui.render() ``` -------------------------------- ### Basic ExRatatui Application Source: https://hexdocs.pm/ex_ratatui A simple ExRatatui application that displays a centered 'Hello World' message with a rounded border and waits for a keypress to exit. It uses Block and Paragraph widgets. ```elixir alias ExRatatui.Layout.Rect alias ExRatatui.Style alias ExRatatui.Widgets.{Block, Paragraph} ExRatatui.run(fn terminal -> {w, h} = ExRatatui.terminal_size() paragraph = %Paragraph{ text: "Hello from ExRatatui!\n\nPress any key to exit.", style: %Style{fg: :green, modifiers: [:bold]}, alignment: :center, block: %Block{ title: " Hello World ", borders: [:all], border_type: :rounded, border_style: %Style{fg: :cyan} } } ExRatatui.draw(terminal, [{paragraph, %Rect{x: 0, y: 0, width: w, height: h}}]) # Wait for a keypress, then exit ExRatatui.poll_event(60_000) end) ``` -------------------------------- ### Fetch and Compile Dependencies Source: https://hexdocs.pm/ex_ratatui After adding ex_ratatui to your dependencies, fetch and compile them using mix. ```bash mix deps.get && mix compile ``` -------------------------------- ### ExRatatui Architecture Overview Source: https://hexdocs.pm/ex_ratatui Illustrates the data flow between Elixir and Rust for rendering and event handling in ExRatatui. ```text Elixir structs -> encode to maps -> Rust NIF -> decode to ratatui types -> render to terminal Terminal events -> Rust NIF (DirtyIo) -> encode to tuples -> Elixir Event structs ``` -------------------------------- ### Add ExRatatui to Mix Dependencies Source: https://hexdocs.pm/ex_ratatui Add ex_ratatui to your dependencies in mix.exs. A precompiled NIF binary will be downloaded automatically. ```elixir def deps do [ {:ex_ratatui, "~> 0.10"} ] end ``` -------------------------------- ### Set Build Flag for Source Compilation Source: https://hexdocs.pm/ex_ratatui To compile from source instead of using precompiled NIF binaries, set the EX_RATATUI_BUILD environment variable to true. This requires the Rust toolchain. ```bash export EX_RATATUI_BUILD=true ``` -------------------------------- ### Local Transport Process Architecture Source: https://hexdocs.pm/ex_ratatui Details the GenServer-based architecture for the local transport, including the server's responsibilities. ```text Local transport: Supervisor └── Server (GenServer) ├── owns terminal reference (NIF) ├── polls events on DirtyIo scheduler └── calls your mount/render/handle_event ``` -------------------------------- ### Distributed Transport Process Architecture Source: https://hexdocs.pm/ex_ratatui Explains the distributed transport architecture, differentiating between the app node and client node responsibilities. ```text Distributed transport: App node Client node ├── Distributed.Listener └── Distributed.Client (GenServer) │ └── DynamicSupervisor ├── owns terminal reference (NIF) │ └── per client: ├── polls events locally │ Server (GenServer) └── sends events → Server │ └── sends widgets → Client receives widgets ← Server └── No NIF needed here ``` -------------------------------- ### SSH Transport Process Architecture Source: https://hexdocs.pm/ex_ratatui Outlines the architecture for the SSH transport, showing how SSH channels and daemons manage client connections. ```text SSH transport: Supervisor └── SSH.Daemon (GenServer, wraps :ssh.daemon) └── per client: SSH channel (:ssh_server_channel) ├── owns Session (in-memory terminal) ├── parses ANSI input → events └── Server (GenServer) └── calls your mount/render/handle_event ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.