Phoenix LiveView integration for Raxol terminal buffers.
Renders terminal UIs in web browsers with real-time updates, keyboard/mouse event translation, and themeable CSS.
Modules
Raxol.LiveView.TerminalBridge-- buffer-to-HTML conversion with run-length encoding, diff highlighting, and inline/class style output.Raxol.LiveView.InputAdapter-- translates browser keydown events intoRaxol.Core.Events.Eventstructs.Raxol.LiveView.TEALive-- a Phoenix LiveView that hosts a TEA app (requiresphoenix_live_view).Raxol.LiveView.TerminalComponent-- a Phoenix LiveComponent that renders a buffer with theme support (requiresphoenix_live_view).Raxol.LiveView.Themes-- built-in color themes and CSS custom property generation.
Quick start
defmodule MyAppWeb.TerminalLive do
use MyAppWeb, :live_view
alias Raxol.LiveView.TerminalBridge
def mount(_params, _session, socket) do
buffer = Raxol.Core.Buffer.create_blank_buffer(80, 24)
{:ok, assign(socket, buffer: buffer)}
end
def render(assigns) do
~H"""
<div class="terminal-container">
<%= raw(TerminalBridge.buffer_to_html(@buffer, theme: :synthwave84)) %>
</div>
"""
end
endCSS
Include the bundled stylesheet for base terminal styles and named color
classes. Call css_path/0 to get the filesystem path.
Summary
Functions
Returns the absolute filesystem path to the bundled CSS stylesheet.
Returns the version of RaxolLiveView.
Functions
@spec css_path() :: String.t()
Returns the absolute filesystem path to the bundled CSS stylesheet.
Copy or symlink this file into your Phoenix static assets to use the pre-built terminal styles.
Example
# In a Mix task or setup script
File.cp!(RaxolLiveView.css_path(), "priv/static/css/raxol_terminal.css")
@spec version() :: String.t()
Returns the version of RaxolLiveView.