#![allow(non_snake_case)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::new_without_default)]
pub mod builders;
use js_sys::Array;
use js_sys::Boolean;
use js_sys::Function;
use js_sys::JsOption;
use js_sys::JsString;
use js_sys::Number;
use js_sys::Object;
use js_sys::Promise;
use js_sys::Set;
use js_sys::Uint8Array;
use js_sys::Undefined;
use js_sys::WebAssembly;
pub use wasm_bindgen::JsGeneric;
use wasm_bindgen::prelude::*;
use web_sys::HtmlCanvasElement;
use web_sys::HtmlElement;
use web_sys::HtmlTextAreaElement;
use web_sys::KeyboardEvent;
use web_sys::MouseEvent;
use web_sys::WheelEvent;
pub type TerminalHandle = f64;
pub type IEvent<T> = Function<fn(Function<fn(T) -> Undefined>) -> IDisposable>;
pub type IEventVoid = Function<fn(Function<fn() -> Undefined>) -> IDisposable>;
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[repr(transparent)]
pub struct CellFlags(pub u32);
impl CellFlags
{
pub const BOLD: Self = Self(1);
pub const ITALIC: Self = Self(2);
pub const UNDERLINE: Self = Self(4);
pub const STRIKETHROUGH: Self = Self(8);
pub const INVERSE: Self = Self(16);
pub const INVISIBLE: Self = Self(32);
pub const BLINK: Self = Self(64);
pub const FAINT: Self = Self(128);
#[inline]
pub const fn bits(self) -> u32 { self.0 }
#[inline]
pub const fn contains(self, other: Self) -> bool { (self.0 & other.0) == other.0 }
}
impl core::ops::BitOr for CellFlags
{
type Output = Self;
#[inline]
fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) }
}
impl core::ops::BitAnd for CellFlags
{
type Output = Self;
#[inline]
fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[repr(u32)]
pub enum DirtyState
{
None = 0,
Partial = 1,
Full = 2,
}
impl DirtyState
{
pub fn from_u32(value: u32) -> Self
{
match value
{
1 => Self::Partial,
2 => Self::Full,
_ => Self::None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[repr(u32)]
pub enum KeyAction
{
Release = 0,
Press = 1,
Repeat = 2,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[repr(u32)]
pub enum KeyEncoderOption
{
CursorKeyApplication = 0,
KeypadKeyApplication = 1,
IgnoreKeypadWithNumlock = 2,
AltEscPrefix = 3,
ModifyOtherKeysState2 = 4,
KittyKeyboardFlags = 5,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[repr(transparent)]
pub struct KittyKeyFlags(pub u32);
impl KittyKeyFlags
{
pub const DISABLED: Self = Self(0);
pub const DISAMBIGUATE: Self = Self(1);
pub const REPORT_EVENTS: Self = Self(2);
pub const REPORT_ALTERNATES: Self = Self(4);
pub const REPORT_ALL: Self = Self(8);
pub const REPORT_ASSOCIATED: Self = Self(16);
pub const ALL: Self = Self(31);
#[inline]
pub const fn bits(self) -> u32 { self.0 }
}
impl core::ops::BitOr for KittyKeyFlags
{
type Output = Self;
#[inline]
fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[repr(transparent)]
pub struct Mods(pub u32);
impl Mods
{
pub const NONE: Self = Self(0);
pub const SHIFT: Self = Self(1);
pub const CTRL: Self = Self(2);
pub const ALT: Self = Self(4);
pub const SUPER: Self = Self(8);
pub const CAPSLOCK: Self = Self(16);
pub const NUMLOCK: Self = Self(32);
#[inline]
pub const fn bits(self) -> u32 { self.0 }
#[inline]
pub const fn contains(self, other: Self) -> bool { (self.0 & other.0) == other.0 }
}
impl core::ops::BitOr for Mods
{
type Output = Self;
#[inline]
fn bitor(self, rhs: Self) -> Self { Self(self.0 | rhs.0) }
}
impl core::ops::BitAnd for Mods
{
type Output = Self;
#[inline]
fn bitand(self, rhs: Self) -> Self { Self(self.0 & rhs.0) }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[repr(u32)]
pub enum Key
{
Unidentified = 0,
Grave = 1,
Backslash = 2,
BracketLeft = 3,
BracketRight = 4,
Comma = 5,
Zero = 6,
One = 7,
Two = 8,
Three = 9,
Four = 10,
Five = 11,
Six = 12,
Seven = 13,
Eight = 14,
Nine = 15,
Equal = 16,
IntlBackslash = 17,
IntlRo = 18,
IntlYen = 19,
A = 20,
B = 21,
C = 22,
D = 23,
E = 24,
F = 25,
G = 26,
H = 27,
I = 28,
J = 29,
K = 30,
L = 31,
M = 32,
N = 33,
O = 34,
P = 35,
Q = 36,
R = 37,
S = 38,
T = 39,
U = 40,
V = 41,
W = 42,
X = 43,
Y = 44,
Z = 45,
Minus = 46,
Period = 47,
Quote = 48,
Semicolon = 49,
Slash = 50,
AltLeft = 51,
AltRight = 52,
Backspace = 53,
CapsLock = 54,
ContextMenu = 55,
ControlLeft = 56,
ControlRight = 57,
Enter = 58,
MetaLeft = 59,
MetaRight = 60,
ShiftLeft = 61,
ShiftRight = 62,
Space = 63,
Tab = 64,
Convert = 65,
KanaMode = 66,
NonConvert = 67,
Delete = 68,
End = 69,
Help = 70,
Home = 71,
Insert = 72,
PageDown = 73,
PageUp = 74,
Down = 75,
Left = 76,
Right = 77,
Up = 78,
NumLock = 79,
Kp0 = 80,
Kp1 = 81,
Kp2 = 82,
Kp3 = 83,
Kp4 = 84,
Kp5 = 85,
Kp6 = 86,
Kp7 = 87,
Kp8 = 88,
Kp9 = 89,
KpPlus = 90,
KpBackspace = 91,
KpClear = 92,
KpClearEntry = 93,
KpComma = 94,
KpPeriod = 95,
KpDivide = 96,
KpEnter = 97,
KpEqual = 98,
KpMemoryAdd = 99,
KpMemoryClear = 100,
KpMemoryRecall = 101,
KpMemoryStore = 102,
KpMemorySubtract = 103,
KpMultiply = 104,
KpParenLeft = 105,
KpParenRight = 106,
KpMinus = 107,
KpSeparator = 108,
NumpadUp = 109,
NumpadDown = 110,
NumpadRight = 111,
NumpadLeft = 112,
NumpadBegin = 113,
NumpadHome = 114,
NumpadEnd = 115,
NumpadInsert = 116,
NumpadDelete = 117,
NumpadPageUp = 118,
NumpadPageDown = 119,
Escape = 120,
F1 = 121,
F2 = 122,
F3 = 123,
F4 = 124,
F5 = 125,
F6 = 126,
F7 = 127,
F8 = 128,
F9 = 129,
F10 = 130,
F11 = 131,
F12 = 132,
F13 = 133,
F14 = 134,
F15 = 135,
F16 = 136,
F17 = 137,
F18 = 138,
F19 = 139,
F20 = 140,
F21 = 141,
F22 = 142,
F23 = 143,
F24 = 144,
F25 = 145,
FnLock = 146,
PrintScreen = 147,
ScrollLock = 148,
Pause = 149,
BrowserBack = 150,
BrowserFavorites = 151,
BrowserForward = 152,
BrowserHome = 153,
BrowserRefresh = 154,
BrowserSearch = 155,
BrowserStop = 156,
Eject = 157,
LaunchApp1 = 158,
LaunchApp2 = 159,
LaunchMail = 160,
MediaPlayPause = 161,
MediaSelect = 162,
MediaStop = 163,
MediaTrackNext = 164,
MediaTrackPrevious = 165,
Power = 166,
Sleep = 167,
AudioVolumeDown = 168,
AudioVolumeMute = 169,
AudioVolumeUp = 170,
WakeUp = 171,
Copy = 172,
Cut = 173,
Paste = 174,
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type ITheme;
#[wasm_bindgen(method, setter, js_name = foreground)]
pub fn set_foreground(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = background)]
pub fn set_background(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = cursor)]
pub fn set_cursor(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = cursorAccent)]
pub fn set_cursor_accent(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = selectionBackground)]
pub fn set_selection_background(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = selectionForeground)]
pub fn set_selection_foreground(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter)]
pub fn set_black(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter)]
pub fn set_red(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter)]
pub fn set_green(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter)]
pub fn set_yellow(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter)]
pub fn set_blue(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter)]
pub fn set_magenta(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter)]
pub fn set_cyan(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter)]
pub fn set_white(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = brightBlack)]
pub fn set_bright_black(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = brightRed)]
pub fn set_bright_red(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = brightGreen)]
pub fn set_bright_green(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = brightYellow)]
pub fn set_bright_yellow(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = brightBlue)]
pub fn set_bright_blue(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = brightMagenta)]
pub fn set_bright_magenta(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = brightCyan)]
pub fn set_bright_cyan(this: &ITheme, value: &str);
#[wasm_bindgen(method, setter, js_name = brightWhite)]
pub fn set_bright_white(this: &ITheme, value: &str);
}
impl ITheme
{
pub fn new() -> Self { Object::new().unchecked_into() }
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type ITerminalOptions;
#[wasm_bindgen(method, setter)]
pub fn set_cols(this: &ITerminalOptions, value: u32);
#[wasm_bindgen(method, setter)]
pub fn set_rows(this: &ITerminalOptions, value: u32);
#[wasm_bindgen(method, setter, js_name = cursorBlink)]
pub fn set_cursor_blink(this: &ITerminalOptions, value: bool);
#[wasm_bindgen(method, setter, js_name = cursorStyle)]
pub fn set_cursor_style(this: &ITerminalOptions, value: &str);
#[wasm_bindgen(method, setter)]
pub fn set_theme(this: &ITerminalOptions, value: &ITheme);
#[wasm_bindgen(method, setter)]
pub fn set_scrollback(this: &ITerminalOptions, value: u32);
#[wasm_bindgen(method, setter, js_name = fontSize)]
pub fn set_font_size(this: &ITerminalOptions, value: f64);
#[wasm_bindgen(method, setter, js_name = fontFamily)]
pub fn set_font_family(this: &ITerminalOptions, value: &str);
#[wasm_bindgen(method, setter, js_name = allowTransparency)]
pub fn set_allow_transparency(this: &ITerminalOptions, value: bool);
#[wasm_bindgen(method, setter, js_name = convertEol)]
pub fn set_convert_eol(this: &ITerminalOptions, value: bool);
#[wasm_bindgen(method, setter, js_name = disableStdin)]
pub fn set_disable_stdin(this: &ITerminalOptions, value: bool);
#[wasm_bindgen(method, setter, js_name = smoothScrollDuration)]
pub fn set_smooth_scroll_duration(this: &ITerminalOptions, value: f64);
#[wasm_bindgen(method, setter)]
pub fn set_ghostty(this: &ITerminalOptions, value: &Ghostty);
}
impl ITerminalOptions
{
pub fn new() -> Self { Object::new().unchecked_into() }
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type RendererOptions;
#[wasm_bindgen(method, setter, js_name = fontSize)]
pub fn set_font_size(this: &RendererOptions, value: f64);
#[wasm_bindgen(method, setter, js_name = fontFamily)]
pub fn set_font_family(this: &RendererOptions, value: &str);
#[wasm_bindgen(method, setter, js_name = cursorStyle)]
pub fn set_cursor_style(this: &RendererOptions, value: &str);
#[wasm_bindgen(method, setter, js_name = cursorBlink)]
pub fn set_cursor_blink(this: &RendererOptions, value: bool);
#[wasm_bindgen(method, setter)]
pub fn set_theme(this: &RendererOptions, value: &ITheme);
#[wasm_bindgen(method, setter, js_name = devicePixelRatio)]
pub fn set_device_pixel_ratio(this: &RendererOptions, value: f64);
}
impl RendererOptions
{
pub fn new() -> Self { Object::new().unchecked_into() }
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type GhosttyTerminalConfig;
#[wasm_bindgen(method, setter, js_name = scrollbackLimit)]
pub fn set_scrollback_limit(this: &GhosttyTerminalConfig, value: u32);
#[wasm_bindgen(method, setter, js_name = fgColor)]
pub fn set_fg_color(this: &GhosttyTerminalConfig, value: u32);
#[wasm_bindgen(method, setter, js_name = bgColor)]
pub fn set_bg_color(this: &GhosttyTerminalConfig, value: u32);
#[wasm_bindgen(method, setter, js_name = cursorColor)]
pub fn set_cursor_color(this: &GhosttyTerminalConfig, value: u32);
#[wasm_bindgen(method, setter)]
pub fn set_palette(this: &GhosttyTerminalConfig, value: &Array<Number>);
}
impl GhosttyTerminalConfig
{
pub fn new() -> Self { Object::new().unchecked_into() }
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type KeyEvent;
#[wasm_bindgen(method, setter)]
pub fn set_action(this: &KeyEvent, value: u32);
#[wasm_bindgen(method, setter)]
pub fn set_key(this: &KeyEvent, value: u32);
#[wasm_bindgen(method, setter)]
pub fn set_mods(this: &KeyEvent, value: u32);
#[wasm_bindgen(method, setter, js_name = consumedMods)]
pub fn set_consumed_mods(this: &KeyEvent, value: u32);
#[wasm_bindgen(method, setter)]
pub fn set_composing(this: &KeyEvent, value: bool);
#[wasm_bindgen(method, setter)]
pub fn set_utf8(this: &KeyEvent, value: &str);
#[wasm_bindgen(method, setter, js_name = unshiftedCodepoint)]
pub fn set_unshifted_codepoint(this: &KeyEvent, value: u32);
}
impl KeyEvent
{
pub fn new() -> Self { Object::new().unchecked_into() }
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IDisposable;
#[wasm_bindgen(method)]
pub fn dispose(this: &IDisposable);
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type RGB;
#[wasm_bindgen(method, getter)]
pub fn r(this: &RGB) -> u8;
#[wasm_bindgen(method, getter)]
pub fn g(this: &RGB) -> u8;
#[wasm_bindgen(method, getter)]
pub fn b(this: &RGB) -> u8;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type FontMetrics;
#[wasm_bindgen(method, getter)]
pub fn width(this: &FontMetrics) -> f64;
#[wasm_bindgen(method, getter)]
pub fn height(this: &FontMetrics) -> f64;
#[wasm_bindgen(method, getter)]
pub fn baseline(this: &FontMetrics) -> f64;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Cursor;
#[wasm_bindgen(method, getter)]
pub fn x(this: &Cursor) -> u32;
#[wasm_bindgen(method, getter)]
pub fn y(this: &Cursor) -> u32;
#[wasm_bindgen(method, getter)]
pub fn visible(this: &Cursor) -> bool;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type GhosttyCell;
#[wasm_bindgen(method, getter)]
pub fn codepoint(this: &GhosttyCell) -> u32;
#[wasm_bindgen(method, getter)]
pub fn fg_r(this: &GhosttyCell) -> u8;
#[wasm_bindgen(method, getter)]
pub fn fg_g(this: &GhosttyCell) -> u8;
#[wasm_bindgen(method, getter)]
pub fn fg_b(this: &GhosttyCell) -> u8;
#[wasm_bindgen(method, getter)]
pub fn bg_r(this: &GhosttyCell) -> u8;
#[wasm_bindgen(method, getter)]
pub fn bg_g(this: &GhosttyCell) -> u8;
#[wasm_bindgen(method, getter)]
pub fn bg_b(this: &GhosttyCell) -> u8;
#[wasm_bindgen(method, getter)]
pub fn flags(this: &GhosttyCell) -> u32;
#[wasm_bindgen(method, getter)]
pub fn width(this: &GhosttyCell) -> u8;
#[wasm_bindgen(method, getter)]
pub fn hyperlink_id(this: &GhosttyCell) -> u32;
#[wasm_bindgen(method, getter)]
pub fn grapheme_len(this: &GhosttyCell) -> u8;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type RenderStateCursor;
#[wasm_bindgen(method, getter)]
pub fn x(this: &RenderStateCursor) -> u32;
#[wasm_bindgen(method, getter)]
pub fn y(this: &RenderStateCursor) -> u32;
#[wasm_bindgen(method, getter, js_name = viewportX)]
pub fn viewport_x(this: &RenderStateCursor) -> i32;
#[wasm_bindgen(method, getter, js_name = viewportY)]
pub fn viewport_y(this: &RenderStateCursor) -> i32;
#[wasm_bindgen(method, getter)]
pub fn visible(this: &RenderStateCursor) -> bool;
#[wasm_bindgen(method, getter)]
pub fn blinking(this: &RenderStateCursor) -> bool;
#[wasm_bindgen(method, getter)]
pub fn style(this: &RenderStateCursor) -> JsString;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type RenderStateColors;
#[wasm_bindgen(method, getter)]
pub fn background(this: &RenderStateColors) -> RGB;
#[wasm_bindgen(method, getter)]
pub fn foreground(this: &RenderStateColors) -> RGB;
#[wasm_bindgen(method, getter)]
pub fn cursor(this: &RenderStateColors) -> Option<RGB>;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IBufferCellPosition;
#[wasm_bindgen(method, getter)]
pub fn x(this: &IBufferCellPosition) -> u32;
#[wasm_bindgen(method, getter)]
pub fn y(this: &IBufferCellPosition) -> u32;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IBufferRange;
#[wasm_bindgen(method, getter)]
pub fn start(this: &IBufferRange) -> IBufferCellPosition;
#[wasm_bindgen(method, getter)]
pub fn end(this: &IBufferRange) -> IBufferCellPosition;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type SelectionCoordinates;
#[wasm_bindgen(method, getter, js_name = startCol)]
pub fn start_col(this: &SelectionCoordinates) -> u32;
#[wasm_bindgen(method, getter, js_name = startRow)]
pub fn start_row(this: &SelectionCoordinates) -> u32;
#[wasm_bindgen(method, getter, js_name = endCol)]
pub fn end_col(this: &SelectionCoordinates) -> u32;
#[wasm_bindgen(method, getter, js_name = endRow)]
pub fn end_row(this: &SelectionCoordinates) -> u32;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type ITerminalDimensions;
#[wasm_bindgen(method, getter)]
pub fn cols(this: &ITerminalDimensions) -> u32;
#[wasm_bindgen(method, getter)]
pub fn rows(this: &ITerminalDimensions) -> u32;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type ResizeEvent;
#[wasm_bindgen(method, getter)]
pub fn cols(this: &ResizeEvent) -> u32;
#[wasm_bindgen(method, getter)]
pub fn rows(this: &ResizeEvent) -> u32;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type RenderEvent;
#[wasm_bindgen(method, getter)]
pub fn start(this: &RenderEvent) -> u32;
#[wasm_bindgen(method, getter)]
pub fn end(this: &RenderEvent) -> u32;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type Dimensions;
#[wasm_bindgen(method, getter)]
pub fn cols(this: &Dimensions) -> u32;
#[wasm_bindgen(method, getter)]
pub fn rows(this: &Dimensions) -> u32;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IKeyEvent;
#[wasm_bindgen(method, getter)]
pub fn key(this: &IKeyEvent) -> JsString;
#[wasm_bindgen(method, getter, js_name = domEvent)]
pub fn dom_event(this: &IKeyEvent) -> KeyboardEvent;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type HoveredLinkRange;
#[wasm_bindgen(method, getter, js_name = startX)]
pub fn start_x(this: &HoveredLinkRange) -> u32;
#[wasm_bindgen(method, getter, js_name = startY)]
pub fn start_y(this: &HoveredLinkRange) -> u32;
#[wasm_bindgen(method, getter, js_name = endX)]
pub fn end_x(this: &HoveredLinkRange) -> u32;
#[wasm_bindgen(method, getter, js_name = endY)]
pub fn end_y(this: &HoveredLinkRange) -> u32;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type ILink;
#[wasm_bindgen(method, getter)]
pub fn text(this: &ILink) -> JsString;
#[wasm_bindgen(method, getter)]
pub fn range(this: &ILink) -> IBufferRange;
#[wasm_bindgen(method)]
pub fn activate(this: &ILink, event: &MouseEvent);
#[wasm_bindgen(method)]
pub fn hover(this: &ILink, is_hovered: bool);
#[wasm_bindgen(method)]
pub fn dispose(this: &ILink);
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type ILinkProvider;
#[wasm_bindgen(method, js_name = provideLinks)]
pub fn provide_links(
this: &ILinkProvider,
y: u32,
callback: &Function<fn(JsOption<Array<ILink>>) -> Undefined>,
);
#[wasm_bindgen(method)]
pub fn dispose(this: &ILinkProvider);
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IBufferCell;
#[wasm_bindgen(method, js_name = getChars)]
pub fn get_chars(this: &IBufferCell) -> JsString;
#[wasm_bindgen(method, js_name = getCode)]
pub fn get_code(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = getWidth)]
pub fn get_width(this: &IBufferCell) -> u8;
#[wasm_bindgen(method, js_name = getFgColorMode)]
pub fn get_fg_color_mode(this: &IBufferCell) -> i32;
#[wasm_bindgen(method, js_name = getBgColorMode)]
pub fn get_bg_color_mode(this: &IBufferCell) -> i32;
#[wasm_bindgen(method, js_name = getFgColor)]
pub fn get_fg_color(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = getBgColor)]
pub fn get_bg_color(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = isBold)]
pub fn is_bold(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = isItalic)]
pub fn is_italic(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = isUnderline)]
pub fn is_underline(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = isStrikethrough)]
pub fn is_strikethrough(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = isBlink)]
pub fn is_blink(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = isInverse)]
pub fn is_inverse(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = isInvisible)]
pub fn is_invisible(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = isFaint)]
pub fn is_faint(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = getHyperlinkId)]
pub fn get_hyperlink_id(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = getCodepoint)]
pub fn get_codepoint(this: &IBufferCell) -> u32;
#[wasm_bindgen(method, js_name = isDim)]
pub fn is_dim(this: &IBufferCell) -> bool;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IBufferLine;
#[wasm_bindgen(method, getter)]
pub fn length(this: &IBufferLine) -> u32;
#[wasm_bindgen(method, getter, js_name = isWrapped)]
pub fn is_wrapped(this: &IBufferLine) -> bool;
#[wasm_bindgen(method, js_name = getCell)]
pub fn get_cell(this: &IBufferLine, x: u32) -> Option<IBufferCell>;
#[wasm_bindgen(method, js_name = translateToString)]
pub fn translate_to_string(
this: &IBufferLine,
trim_right: Option<bool>,
start_column: Option<u32>,
end_column: Option<u32>,
) -> JsString;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IBuffer;
#[wasm_bindgen(method, getter, js_name = type)]
pub fn type_(this: &IBuffer) -> JsString;
#[wasm_bindgen(method, getter, js_name = cursorX)]
pub fn cursor_x(this: &IBuffer) -> u32;
#[wasm_bindgen(method, getter, js_name = cursorY)]
pub fn cursor_y(this: &IBuffer) -> u32;
#[wasm_bindgen(method, getter, js_name = viewportY)]
pub fn viewport_y(this: &IBuffer) -> u32;
#[wasm_bindgen(method, getter, js_name = baseY)]
pub fn base_y(this: &IBuffer) -> u32;
#[wasm_bindgen(method, getter)]
pub fn length(this: &IBuffer) -> u32;
#[wasm_bindgen(method, js_name = getLine)]
pub fn get_line(this: &IBuffer, y: u32) -> Option<IBufferLine>;
#[wasm_bindgen(method, js_name = getNullCell)]
pub fn get_null_cell(this: &IBuffer) -> IBufferCell;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IBufferNamespace;
#[wasm_bindgen(method, getter)]
pub fn active(this: &IBufferNamespace) -> IBuffer;
#[wasm_bindgen(method, getter)]
pub fn normal(this: &IBufferNamespace) -> IBuffer;
#[wasm_bindgen(method, getter)]
pub fn alternate(this: &IBufferNamespace) -> IBuffer;
#[wasm_bindgen(method, getter, js_name = onBufferChange)]
pub fn on_buffer_change(this: &IBufferNamespace) -> IEvent<IBuffer>;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IUnicodeVersionProvider;
#[wasm_bindgen(method, getter, js_name = activeVersion)]
pub fn active_version(this: &IUnicodeVersionProvider) -> JsString;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IRenderable;
#[wasm_bindgen(method, js_name = getLine)]
pub fn get_line(this: &IRenderable, y: u32) -> Option<Array<GhosttyCell>>;
#[wasm_bindgen(method, js_name = getCursor)]
pub fn get_cursor(this: &IRenderable) -> Cursor;
#[wasm_bindgen(method, js_name = getDimensions)]
pub fn get_dimensions(this: &IRenderable) -> Dimensions;
#[wasm_bindgen(method, js_name = isRowDirty)]
pub fn is_row_dirty(this: &IRenderable, y: u32) -> bool;
#[wasm_bindgen(method, js_name = needsFullRedraw)]
pub fn needs_full_redraw(this: &IRenderable) -> bool;
#[wasm_bindgen(method, js_name = clearDirty)]
pub fn clear_dirty(this: &IRenderable);
#[wasm_bindgen(method, js_name = getGraphemeString)]
pub fn get_grapheme_string(this: &IRenderable, row: u32, col: u32) -> JsString;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type IScrollbackProvider;
#[wasm_bindgen(method, js_name = getScrollbackLine)]
pub fn get_scrollback_line(
this: &IScrollbackProvider,
offset: u32,
) -> Option<Array<GhosttyCell>>;
#[wasm_bindgen(method, js_name = getScrollbackLength)]
pub fn get_scrollback_length(this: &IScrollbackProvider) -> u32;
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type ITerminalAddon;
#[wasm_bindgen(method)]
pub fn activate(this: &ITerminalAddon, terminal: &ITerminalCore);
#[wasm_bindgen(method)]
pub fn dispose(this: &ITerminalAddon);
}
#[wasm_bindgen]
extern "C" {
#[wasm_bindgen(extends = Object)]
#[derive(Clone, Debug)]
pub type ITerminalCore;
#[wasm_bindgen(method, getter)]
pub fn cols(this: &ITerminalCore) -> u32;
#[wasm_bindgen(method, getter)]
pub fn rows(this: &ITerminalCore) -> u32;
#[wasm_bindgen(method, getter)]
pub fn element(this: &ITerminalCore) -> Option<HtmlElement>;
#[wasm_bindgen(method, getter)]
pub fn textarea(this: &ITerminalCore) -> Option<HtmlTextAreaElement>;
}
#[wasm_bindgen(js_namespace = GhosttyWeb)]
extern "C" {
#[wasm_bindgen]
pub async fn init();
#[wasm_bindgen(js_name = EventEmitter)]
pub type EventEmitter<T>;
#[wasm_bindgen(constructor, js_class = "EventEmitter")]
pub fn new<T: JsGeneric>() -> EventEmitter<T>;
#[wasm_bindgen(method)]
pub fn fire<T: JsGeneric>(this: &EventEmitter<T>, arg: T);
#[wasm_bindgen(method, js_name = event)]
pub fn event<T: JsGeneric>(this: &EventEmitter<T>) -> IEvent<T>;
#[wasm_bindgen(method)]
pub fn dispose<T>(this: &EventEmitter<T>);
#[wasm_bindgen(js_name = Ghostty)]
pub type Ghostty;
#[wasm_bindgen(constructor, js_class = "Ghostty")]
pub fn new(wasm_instance: &WebAssembly::Instance) -> Ghostty;
#[wasm_bindgen(method, js_name = createKeyEncoder)]
pub fn create_key_encoder(this: &Ghostty) -> KeyEncoder;
#[wasm_bindgen(method, js_name = createTerminal)]
pub fn create_terminal(
this: &Ghostty,
cols: Option<u32>,
rows: Option<u32>,
config: Option<&GhosttyTerminalConfig>,
) -> GhosttyTerminal;
#[wasm_bindgen(static_method_of = Ghostty, js_class = "Ghostty")]
pub fn load(wasm_path: Option<&str>) -> Promise<Ghostty>;
#[wasm_bindgen(js_name = GhosttyTerminal)]
pub type GhosttyTerminal;
#[wasm_bindgen(method, getter)]
pub fn cols(this: &GhosttyTerminal) -> u32;
#[wasm_bindgen(method, getter)]
pub fn rows(this: &GhosttyTerminal) -> u32;
#[wasm_bindgen(method, js_name = write)]
pub fn write_str(this: &GhosttyTerminal, data: &str);
#[wasm_bindgen(method, js_name = write)]
pub fn write_u8_array(this: &GhosttyTerminal, data: &Uint8Array);
#[wasm_bindgen(method)]
pub fn resize(this: &GhosttyTerminal, cols: u32, rows: u32);
#[wasm_bindgen(method)]
pub fn free(this: &GhosttyTerminal);
#[wasm_bindgen(method, js_name = update)]
pub fn update_raw(this: &GhosttyTerminal) -> u32;
#[wasm_bindgen(method, js_name = getCursor)]
pub fn get_cursor(this: &GhosttyTerminal) -> RenderStateCursor;
#[wasm_bindgen(method, js_name = getColors)]
pub fn get_colors(this: &GhosttyTerminal) -> RenderStateColors;
#[wasm_bindgen(method, js_name = isRowDirty)]
pub fn is_row_dirty(this: &GhosttyTerminal, y: u32) -> bool;
#[wasm_bindgen(method, js_name = markClean)]
pub fn mark_clean(this: &GhosttyTerminal);
#[wasm_bindgen(method, js_name = getViewport)]
pub fn get_viewport(this: &GhosttyTerminal) -> Array<GhosttyCell>;
#[wasm_bindgen(method, js_name = getLine)]
pub fn get_line(this: &GhosttyTerminal, y: u32) -> Option<Array<GhosttyCell>>;
#[wasm_bindgen(method, js_name = isDirty)]
pub fn is_dirty(this: &GhosttyTerminal) -> bool;
#[wasm_bindgen(method, js_name = needsFullRedraw)]
pub fn needs_full_redraw(this: &GhosttyTerminal) -> bool;
#[wasm_bindgen(method, js_name = clearDirty)]
pub fn clear_dirty(this: &GhosttyTerminal);
#[wasm_bindgen(method, js_name = isAlternateScreen)]
pub fn is_alternate_screen(this: &GhosttyTerminal) -> bool;
#[wasm_bindgen(method, js_name = hasBracketedPaste)]
pub fn has_bracketed_paste(this: &GhosttyTerminal) -> bool;
#[wasm_bindgen(method, js_name = hasFocusEvents)]
pub fn has_focus_events(this: &GhosttyTerminal) -> bool;
#[wasm_bindgen(method, js_name = hasMouseTracking)]
pub fn has_mouse_tracking(this: &GhosttyTerminal) -> bool;
#[wasm_bindgen(method, js_name = getDimensions)]
pub fn get_dimensions(this: &GhosttyTerminal) -> Dimensions;
#[wasm_bindgen(method, js_name = getScrollbackLength)]
pub fn get_scrollback_length(this: &GhosttyTerminal) -> u32;
#[wasm_bindgen(method, js_name = getScrollbackLine)]
pub fn get_scrollback_line(this: &GhosttyTerminal, offset: u32) -> Option<Array<GhosttyCell>>;
#[wasm_bindgen(method, js_name = isRowWrapped)]
pub fn is_row_wrapped(this: &GhosttyTerminal, row: u32) -> bool;
#[wasm_bindgen(method, js_name = getHyperlinkUri)]
pub fn get_hyperlink_uri(this: &GhosttyTerminal, id: u32) -> Option<JsString>;
#[wasm_bindgen(method, js_name = hasResponse)]
pub fn has_response(this: &GhosttyTerminal) -> bool;
#[wasm_bindgen(method, js_name = readResponse)]
pub fn read_response(this: &GhosttyTerminal) -> Option<JsString>;
#[wasm_bindgen(method, js_name = getMode)]
pub fn get_mode(this: &GhosttyTerminal, mode: u32, is_ansi: Option<bool>) -> bool;
#[wasm_bindgen(method, js_name = getGrapheme)]
pub fn get_grapheme(this: &GhosttyTerminal, row: u32, col: u32) -> Option<Array<Number>>;
#[wasm_bindgen(method, js_name = getGraphemeString)]
pub fn get_grapheme_string(this: &GhosttyTerminal, row: u32, col: u32) -> JsString;
#[wasm_bindgen(method, js_name = getScrollbackGrapheme)]
pub fn get_scrollback_grapheme(
this: &GhosttyTerminal,
offset: u32,
col: u32,
) -> Option<Array<Number>>;
#[wasm_bindgen(method, js_name = getScrollbackGraphemeString)]
pub fn get_scrollback_grapheme_string(
this: &GhosttyTerminal,
offset: u32,
col: u32,
) -> JsString;
}
impl GhosttyTerminal
{
pub fn update(&self) -> DirtyState { DirtyState::from_u32(self.update_raw()) }
}
#[wasm_bindgen(js_namespace = GhosttyWeb)]
extern "C" {
#[wasm_bindgen(js_name = KeyEncoder)]
pub type KeyEncoder;
#[wasm_bindgen(method, js_name = setOption)]
pub fn set_option(this: &KeyEncoder, option: u32, value: &JsValue);
#[wasm_bindgen(method, js_name = setKittyFlags)]
pub fn set_kitty_flags(this: &KeyEncoder, flags: u32);
#[wasm_bindgen(method)]
pub fn encode(this: &KeyEncoder, event: &KeyEvent) -> Uint8Array;
#[wasm_bindgen(method)]
pub fn dispose(this: &KeyEncoder);
#[wasm_bindgen(js_name = CanvasRenderer)]
pub type CanvasRenderer;
#[wasm_bindgen(constructor, js_class = "CanvasRenderer")]
pub fn new(canvas: &HtmlCanvasElement, options: Option<&RendererOptions>) -> CanvasRenderer;
#[wasm_bindgen(method, js_name = remeasureFont)]
pub fn remeasure_font(this: &CanvasRenderer);
#[wasm_bindgen(method)]
pub fn resize(this: &CanvasRenderer, cols: u32, rows: u32);
#[wasm_bindgen(method)]
pub fn render(
this: &CanvasRenderer,
buffer: &IRenderable,
force_all: Option<bool>,
viewport_y: Option<f64>,
scrollback_provider: Option<&IScrollbackProvider>,
scrollbar_opacity: Option<f64>,
);
#[wasm_bindgen(method, js_name = setTheme)]
pub fn set_theme(this: &CanvasRenderer, theme: &ITheme);
#[wasm_bindgen(method, js_name = setFontSize)]
pub fn set_font_size(this: &CanvasRenderer, size: f64);
#[wasm_bindgen(method, js_name = setFontFamily)]
pub fn set_font_family(this: &CanvasRenderer, family: &str);
#[wasm_bindgen(method, js_name = setCursorStyle)]
pub fn set_cursor_style(this: &CanvasRenderer, style: &str);
#[wasm_bindgen(method, js_name = setCursorBlink)]
pub fn set_cursor_blink(this: &CanvasRenderer, enabled: bool);
#[wasm_bindgen(method, js_name = getMetrics)]
pub fn get_metrics(this: &CanvasRenderer) -> FontMetrics;
#[wasm_bindgen(method, js_name = getCanvas)]
pub fn get_canvas(this: &CanvasRenderer) -> HtmlCanvasElement;
#[wasm_bindgen(method, js_name = setSelectionManager)]
pub fn set_selection_manager(this: &CanvasRenderer, manager: &SelectionManager);
#[wasm_bindgen(method, js_name = setHoveredHyperlinkId)]
pub fn set_hovered_hyperlink_id(this: &CanvasRenderer, hyperlink_id: u32);
#[wasm_bindgen(method, js_name = setHoveredLinkRange)]
pub fn set_hovered_link_range(this: &CanvasRenderer, range: Option<&HoveredLinkRange>);
#[wasm_bindgen(method, getter, js_name = charWidth)]
pub fn char_width(this: &CanvasRenderer) -> f64;
#[wasm_bindgen(method, getter, js_name = charHeight)]
pub fn char_height(this: &CanvasRenderer) -> f64;
#[wasm_bindgen(method)]
pub fn clear(this: &CanvasRenderer);
#[wasm_bindgen(method)]
pub fn dispose(this: &CanvasRenderer);
#[wasm_bindgen(js_name = FitAddon, extends = ITerminalAddon)]
pub type FitAddon;
#[wasm_bindgen(constructor, js_class = "FitAddon")]
pub fn new() -> FitAddon;
#[wasm_bindgen(method)]
pub fn activate(this: &FitAddon, terminal: &ITerminalCore);
#[wasm_bindgen(method)]
pub fn dispose(this: &FitAddon);
#[wasm_bindgen(method)]
pub fn fit(this: &FitAddon);
#[wasm_bindgen(method, js_name = proposeDimensions)]
pub fn propose_dimensions(this: &FitAddon) -> Option<ITerminalDimensions>;
#[wasm_bindgen(method, js_name = observeResize)]
pub fn observe_resize(this: &FitAddon);
#[wasm_bindgen(js_name = InputHandler)]
pub type InputHandler;
#[wasm_bindgen(constructor, js_class = "InputHandler")]
pub fn new(
ghostty: &Ghostty,
container: &HtmlElement,
on_data: &Function<fn(JsString) -> Undefined>,
on_bell: &Function<fn() -> Undefined>,
on_key: Option<&Function<fn(IKeyEvent) -> Undefined>>,
custom_key_event_handler: Option<&Function<fn(KeyboardEvent) -> Boolean>>,
get_mode: Option<&Function<fn(Number) -> Boolean>>,
) -> InputHandler;
#[wasm_bindgen(method, js_name = setCustomKeyEventHandler)]
pub fn set_custom_key_event_handler(
this: &InputHandler,
handler: &Function<fn(KeyboardEvent) -> Boolean>,
);
#[wasm_bindgen(method)]
pub fn dispose(this: &InputHandler);
#[wasm_bindgen(method, js_name = isActive)]
pub fn is_active(this: &InputHandler) -> bool;
#[wasm_bindgen(js_name = LinkDetector)]
pub type LinkDetector;
#[wasm_bindgen(constructor, js_class = "LinkDetector")]
pub fn new(terminal: &JsValue) -> LinkDetector;
#[wasm_bindgen(method, js_name = registerProvider)]
pub fn register_provider(this: &LinkDetector, provider: &ILinkProvider);
#[wasm_bindgen(method, js_name = getLinkAt)]
pub fn get_link_at(this: &LinkDetector, col: u32, row: u32) -> Promise<JsOption<ILink>>;
#[wasm_bindgen(method, js_name = invalidateCache)]
pub fn invalidate_cache(this: &LinkDetector);
#[wasm_bindgen(method, js_name = invalidateRows)]
pub fn invalidate_rows(this: &LinkDetector, start_row: u32, end_row: u32);
#[wasm_bindgen(method)]
pub fn dispose(this: &LinkDetector);
#[wasm_bindgen(js_name = OSC8LinkProvider)]
pub type Osc8LinkProvider;
#[wasm_bindgen(constructor, js_class = "OSC8LinkProvider")]
pub fn new(terminal: &JsValue) -> Osc8LinkProvider;
#[wasm_bindgen(method, js_name = provideLinks)]
pub fn provide_links(
this: &Osc8LinkProvider,
y: u32,
callback: &Function<fn(JsOption<Array<ILink>>) -> Undefined>,
);
#[wasm_bindgen(method)]
pub fn dispose(this: &Osc8LinkProvider);
#[wasm_bindgen(js_name = UrlRegexProvider)]
pub type UrlRegexProvider;
#[wasm_bindgen(constructor, js_class = "UrlRegexProvider")]
pub fn new(terminal: &JsValue) -> UrlRegexProvider;
#[wasm_bindgen(method, js_name = provideLinks)]
pub fn provide_links(
this: &UrlRegexProvider,
y: u32,
callback: &Function<fn(JsOption<Array<ILink>>) -> Undefined>,
);
#[wasm_bindgen(method)]
pub fn dispose(this: &UrlRegexProvider);
#[wasm_bindgen(js_name = SelectionManager)]
pub type SelectionManager;
#[wasm_bindgen(constructor, js_class = "SelectionManager")]
pub fn new(
terminal: &Terminal,
renderer: &CanvasRenderer,
wasm_term: &GhosttyTerminal,
textarea: &HtmlTextAreaElement,
) -> SelectionManager;
#[wasm_bindgen(method, js_name = getSelection)]
pub fn get_selection(this: &SelectionManager) -> JsString;
#[wasm_bindgen(method, js_name = hasSelection)]
pub fn has_selection(this: &SelectionManager) -> bool;
#[wasm_bindgen(method, js_name = clearSelection)]
pub fn clear_selection(this: &SelectionManager);
#[wasm_bindgen(method, js_name = selectAll)]
pub fn select_all(this: &SelectionManager);
#[wasm_bindgen(method)]
pub fn select(this: &SelectionManager, column: u32, row: u32, length: u32);
#[wasm_bindgen(method, js_name = selectLines)]
pub fn select_lines(this: &SelectionManager, start: u32, end: u32);
#[wasm_bindgen(method, js_name = getSelectionPosition)]
pub fn get_selection_position(this: &SelectionManager) -> Option<IBufferRange>;
#[wasm_bindgen(method)]
pub fn deselect(this: &SelectionManager);
#[wasm_bindgen(method)]
pub fn focus(this: &SelectionManager);
#[wasm_bindgen(method, js_name = getSelectionCoords)]
pub fn get_selection_coords(this: &SelectionManager) -> Option<SelectionCoordinates>;
#[wasm_bindgen(method, js_name = getDirtySelectionRows)]
pub fn get_dirty_selection_rows(this: &SelectionManager) -> Set<Number>;
#[wasm_bindgen(method, js_name = clearDirtySelectionRows)]
pub fn clear_dirty_selection_rows(this: &SelectionManager);
#[wasm_bindgen(method, getter, js_name = onSelectionChange)]
pub fn on_selection_change(this: &SelectionManager) -> IEventVoid;
#[wasm_bindgen(method)]
pub fn dispose(this: &SelectionManager);
#[wasm_bindgen(js_name = Terminal)]
pub type Terminal;
#[wasm_bindgen(constructor, js_class = "Terminal")]
pub fn new(options: Option<&ITerminalOptions>) -> Terminal;
#[wasm_bindgen(method, getter)]
pub fn cols(this: &Terminal) -> u32;
#[wasm_bindgen(method, setter)]
pub fn set_cols(this: &Terminal, value: u32);
#[wasm_bindgen(method, getter)]
pub fn rows(this: &Terminal) -> u32;
#[wasm_bindgen(method, setter)]
pub fn set_rows(this: &Terminal, value: u32);
#[wasm_bindgen(method, getter)]
pub fn element(this: &Terminal) -> Option<HtmlElement>;
#[wasm_bindgen(method, getter)]
pub fn textarea(this: &Terminal) -> Option<HtmlTextAreaElement>;
#[wasm_bindgen(method, getter)]
pub fn buffer(this: &Terminal) -> IBufferNamespace;
#[wasm_bindgen(method, getter)]
pub fn unicode(this: &Terminal) -> IUnicodeVersionProvider;
#[wasm_bindgen(method, getter)]
pub fn options(this: &Terminal) -> ITerminalOptions;
#[wasm_bindgen(method, getter, js_name = wasmTerm)]
pub fn wasm_term(this: &Terminal) -> Option<GhosttyTerminal>;
#[wasm_bindgen(method, getter)]
pub fn renderer(this: &Terminal) -> Option<CanvasRenderer>;
#[wasm_bindgen(method, getter, js_name = viewportY)]
pub fn viewport_y(this: &Terminal) -> f64;
#[wasm_bindgen(method, setter, js_name = viewportY)]
pub fn set_viewport_y(this: &Terminal, value: f64);
#[wasm_bindgen(method, js_name = onData)]
pub fn on_data(this: &Terminal, listener: &Function<fn(JsString) -> Undefined>) -> IDisposable;
#[wasm_bindgen(method, js_name = onResize)]
pub fn on_resize(
this: &Terminal,
listener: &Function<fn(ResizeEvent) -> Undefined>,
) -> IDisposable;
#[wasm_bindgen(method, js_name = onBell)]
pub fn on_bell(this: &Terminal, listener: &Function<fn() -> Undefined>) -> IDisposable;
#[wasm_bindgen(method, js_name = onSelectionChange)]
pub fn on_selection_change(
this: &Terminal,
listener: &Function<fn() -> Undefined>,
) -> IDisposable;
#[wasm_bindgen(method, js_name = onKey)]
pub fn on_key(this: &Terminal, listener: &Function<fn(IKeyEvent) -> Undefined>) -> IDisposable;
#[wasm_bindgen(method, js_name = onTitleChange)]
pub fn on_title_change(
this: &Terminal,
listener: &Function<fn(JsString) -> Undefined>,
) -> IDisposable;
#[wasm_bindgen(method, js_name = onScroll)]
pub fn on_scroll(this: &Terminal, listener: &Function<fn(Number) -> Undefined>) -> IDisposable;
#[wasm_bindgen(method, js_name = onRender)]
pub fn on_render(
this: &Terminal,
listener: &Function<fn(RenderEvent) -> Undefined>,
) -> IDisposable;
#[wasm_bindgen(method, js_name = onCursorMove)]
pub fn on_cursor_move(this: &Terminal, listener: &Function<fn() -> Undefined>) -> IDisposable;
#[wasm_bindgen(method)]
pub fn open(this: &Terminal, parent: &HtmlElement);
#[wasm_bindgen(method, js_name = write)]
pub fn write_str(this: &Terminal, data: &str, callback: Option<&Function<fn() -> Undefined>>);
#[wasm_bindgen(method, js_name = write)]
pub fn write_u8_array(
this: &Terminal,
data: &Uint8Array,
callback: Option<&Function<fn() -> Undefined>>,
);
#[wasm_bindgen(method, js_name = writeln)]
pub fn writeln_str(this: &Terminal, data: &str, callback: Option<&Function<fn() -> Undefined>>);
#[wasm_bindgen(method, js_name = writeln)]
pub fn writeln_u8_array(
this: &Terminal,
data: &Uint8Array,
callback: Option<&Function<fn() -> Undefined>>,
);
#[wasm_bindgen(method)]
pub fn paste(this: &Terminal, data: &str);
#[wasm_bindgen(method)]
pub fn input(this: &Terminal, data: &str, was_user_input: Option<bool>);
#[wasm_bindgen(method)]
pub fn resize(this: &Terminal, cols: u32, rows: u32);
#[wasm_bindgen(method)]
pub fn clear(this: &Terminal);
#[wasm_bindgen(method)]
pub fn reset(this: &Terminal);
#[wasm_bindgen(method)]
pub fn focus(this: &Terminal);
#[wasm_bindgen(method)]
pub fn blur(this: &Terminal);
#[wasm_bindgen(method, js_name = loadAddon)]
pub fn load_addon(this: &Terminal, addon: &ITerminalAddon);
#[wasm_bindgen(method, js_name = getSelection)]
pub fn get_selection(this: &Terminal) -> JsString;
#[wasm_bindgen(method, js_name = hasSelection)]
pub fn has_selection(this: &Terminal) -> bool;
#[wasm_bindgen(method, js_name = clearSelection)]
pub fn clear_selection(this: &Terminal);
#[wasm_bindgen(method, js_name = selectAll)]
pub fn select_all(this: &Terminal);
#[wasm_bindgen(method)]
pub fn select(this: &Terminal, column: u32, row: u32, length: u32);
#[wasm_bindgen(method, js_name = selectLines)]
pub fn select_lines(this: &Terminal, start: u32, end: u32);
#[wasm_bindgen(method, js_name = getViewportY)]
pub fn get_viewport_y(this: &Terminal) -> f64;
#[wasm_bindgen(method, js_name = getSelectionPosition)]
pub fn get_selection_position(this: &Terminal) -> Option<IBufferRange>;
#[wasm_bindgen(method, js_name = attachCustomKeyEventHandler)]
pub fn attach_custom_key_event_handler(
this: &Terminal,
handler: &Function<fn(KeyboardEvent) -> Boolean>,
);
#[wasm_bindgen(method, js_name = attachCustomWheelEventHandler)]
pub fn attach_custom_wheel_event_handler(
this: &Terminal,
handler: Option<&Function<fn(WheelEvent) -> Boolean>>,
);
#[wasm_bindgen(method, js_name = registerLinkProvider)]
pub fn register_link_provider(this: &Terminal, provider: &ILinkProvider);
#[wasm_bindgen(method, js_name = scrollLines)]
pub fn scroll_lines(this: &Terminal, amount: i32);
#[wasm_bindgen(method, js_name = scrollPages)]
pub fn scroll_pages(this: &Terminal, amount: i32);
#[wasm_bindgen(method, js_name = scrollToTop)]
pub fn scroll_to_top(this: &Terminal);
#[wasm_bindgen(method, js_name = scrollToBottom)]
pub fn scroll_to_bottom(this: &Terminal);
#[wasm_bindgen(method, js_name = scrollToLine)]
pub fn scroll_to_line(this: &Terminal, line: u32);
#[wasm_bindgen(method)]
pub fn dispose(this: &Terminal);
#[wasm_bindgen(method, js_name = getScrollbackLine)]
pub fn get_scrollback_line(this: &Terminal, offset: u32) -> Option<Array<GhosttyCell>>;
#[wasm_bindgen(method, js_name = getScrollbackLength)]
pub fn get_scrollback_length(this: &Terminal) -> u32;
#[wasm_bindgen(method, js_name = getMode)]
pub fn get_mode(this: &Terminal, mode: u32, is_ansi: Option<bool>) -> bool;
#[wasm_bindgen(method, js_name = hasBracketedPaste)]
pub fn has_bracketed_paste(this: &Terminal) -> bool;
#[wasm_bindgen(method, js_name = hasFocusEvents)]
pub fn has_focus_events(this: &Terminal) -> bool;
#[wasm_bindgen(method, js_name = hasMouseTracking)]
pub fn has_mouse_tracking(this: &Terminal) -> bool;
}