-module(shore@ui). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -define(FILEPATH, "src/shore/ui.gleam"). -export([align/2, bar/1, bar2/2, box/2, br/0, button/3, button_styled/7, col/1, debug/0, graph/3, hr/0, hr_styled/1, input/4, input_hidden/4, input_submit/6, keybind/2, progress/4, row/1, table/2, table_kv/2, text/1, text_wrapped/1, text_styled/3, text_wrapped_styled/3, image_unstable/1]). -if(?OTP_RELEASE >= 27). -define(MODULEDOC(Str), -moduledoc(Str)). -define(DOC(Str), -doc(Str)). -else. -define(MODULEDOC(Str), -compile([])). -define(DOC(Str), -compile([])). -endif. -file("src/shore/ui.gleam", 7). ?DOC(" Sets alignment of all child nodes\n"). -spec align(shore@style:align(), shore@internal:node_(HCU)) -> shore@internal:node_(HCU). align(Alignment, Node) -> {aligned, Alignment, Node}. -file("src/shore/ui.gleam", 12). ?DOC(" A row with a background color\n"). -spec bar(shore@style:color()) -> shore@internal:node_(any()). bar(Color) -> {bar, Color}. -file("src/shore/ui.gleam", 17). ?DOC(" A row with a background color, containing items\n"). -spec bar2(shore@style:color(), shore@internal:node_(HCZ)) -> shore@internal:node_(HCZ). bar2(Color, Node) -> {bar2, Color, Node}. -file("src/shore/ui.gleam", 22). ?DOC(" A box container element for holding other nodes\n"). -spec box(list(shore@internal:node_(HDC)), gleam@option:option(binary())) -> shore@internal:node_(HDC). box(Children, Title) -> {box, Children, Title}. -file("src/shore/ui.gleam", 27). ?DOC(" An empty line\n"). -spec br() -> shore@internal:node_(any()). br() -> b_r. -file("src/shore/ui.gleam", 32). ?DOC(" A button assigned to a key press to execute an event\n"). -spec button(binary(), shore@key:key(), HDJ) -> shore@internal:node_(HDJ). button(Text, Key, Event) -> {button, Text, Key, Event, {some, black}, {some, blue}, {some, black}, {some, green}}. -file("src/shore/ui.gleam", 55). ?DOC( " A button assigned to a key press to execute an event.\n" " Can be provided with custom colours both for when focused/pressed or not.\n" "\n" " Default colors for buttons are:\n" " ```gleam\n" " fg: Some(style.Black),\n" " bg: Some(style.Blue),\n" " focus_fg: Some(style.Black),\n" " focus_bg: Some(style.Green),\n" " ```\n" ). -spec button_styled( binary(), shore@key:key(), HDL, gleam@option:option(shore@style:color()), gleam@option:option(shore@style:color()), gleam@option:option(shore@style:color()), gleam@option:option(shore@style:color()) ) -> shore@internal:node_(HDL). button_styled(Text, Key, Event, Fg, Bg, Focus_fg, Focus_bg) -> {button, Text, Key, Event, Fg, Bg, Focus_fg, Focus_bg}. -file("src/shore/ui.gleam", 68). ?DOC(" A container element for holding other nodes over multiple lines\n"). -spec col(list(shore@internal:node_(HDR))) -> shore@internal:node_(HDR). col(Children) -> {col, Children}. -file("src/shore/ui.gleam", 73). ?DOC(" Prints some positional information for developer debugging\n"). -spec debug() -> shore@internal:node_(any()). debug() -> debug. -file("src/shore/ui.gleam", 78). ?DOC(" An extremely simple plot\n"). -spec graph(shore@style:size(), shore@style:size(), list(float())) -> shore@internal:node_(any()). graph(Width, Height, Points) -> {graph, Width, Height, Points}. -file("src/shore/ui.gleam", 87). ?DOC(" A horizontal line\n"). -spec hr() -> shore@internal:node_(any()). hr() -> h_r. -file("src/shore/ui.gleam", 92). ?DOC(" A colored horizontal line\n"). -spec hr_styled(shore@style:color()) -> shore@internal:node_(any()). hr_styled(Color) -> {h_r2, Color}. -file("src/shore/ui.gleam", 97). ?DOC(" A field for text input\n"). -spec input(binary(), binary(), shore@style:size(), fun((binary()) -> HEE)) -> shore@internal:node_(HEE). input(Label, Value, Width, Event) -> {input, Label, Value, Width, Event, none, false}. -file("src/shore/ui.gleam", 107). ?DOC(" A field for text input with the content display hidden, useful for password fields\n"). -spec input_hidden( binary(), binary(), shore@style:size(), fun((binary()) -> HEG) ) -> shore@internal:node_(HEG). input_hidden(Label, Value, Width, Event) -> {input, Label, Value, Width, Event, none, true}. -file("src/shore/ui.gleam", 122). ?DOC( " A field for text input. Allows setting a `submit` event which can be\n" " triggered by the submit keybind while the field is currently focused.\n" "\n" " Useful for scenarios where a separate submit button would be inconvenient,\n" " such as a chat box or 2fa prompt.\n" ). -spec input_submit( binary(), binary(), shore@style:size(), fun((binary()) -> HEI), HEI, boolean() ) -> shore@internal:node_(HEI). input_submit(Label, Value, Width, Event, Submit, Hidden) -> {input, Label, Value, Width, Event, {some, Submit}, Hidden}. -file("src/shore/ui.gleam", 134). ?DOC(" A non-visible button assigned to a key press to execute an event\n"). -spec keybind(shore@key:key(), HEK) -> shore@internal:node_(HEK). keybind(Key, Event) -> {key_bind, Key, Event}. -file("src/shore/ui.gleam", 139). ?DOC(" A progress bar, will automatically calculate fill percent based off max and current values\n"). -spec progress(shore@style:size(), integer(), integer(), shore@style:color()) -> shore@internal:node_(any()). progress(Width, Max, Value, Color) -> {progress, Width, Max, Value, Color}. -file("src/shore/ui.gleam", 149). ?DOC(" A container element for holding other nodes in a single line\n"). -spec row(list(shore@internal:node_(HEO))) -> shore@internal:node_(HEO). row(Children) -> {row, Children}. -file("src/shore/ui.gleam", 154). ?DOC(" A table layout\n"). -spec table(shore@style:size(), list(list(binary()))) -> shore@internal:node_(any()). table(Width, Table) -> {table, Width, Table}. -file("src/shore/ui.gleam", 159). ?DOC(" A Key-Value style table layout\n"). -spec table_kv(shore@style:size(), list(list(binary()))) -> shore@internal:node_(any()). table_kv(Width, Table) -> {table_k_v, Width, Table}. -file("src/shore/ui.gleam", 164). ?DOC(" A text string\n"). -spec text(binary()) -> shore@internal:node_(any()). text(Text) -> {text_multi, Text, no_wrap, none, none}. -file("src/shore/ui.gleam", 169). ?DOC(" A text string with automatic line wrapping\n"). -spec text_wrapped(binary()) -> shore@internal:node_(any()). text_wrapped(Text) -> {text_multi, Text, wrap, none, none}. -file("src/shore/ui.gleam", 174). ?DOC(" A text string with colored foreground and/or background\n"). -spec text_styled( binary(), gleam@option:option(shore@style:color()), gleam@option:option(shore@style:color()) ) -> shore@internal:node_(any()). text_styled(Text, Fg, Bg) -> {text_multi, Text, no_wrap, Fg, Bg}. -file("src/shore/ui.gleam", 183). ?DOC(" A text string with automatic line wrapping and colored foreground and/or background\n"). -spec text_wrapped_styled( binary(), gleam@option:option(shore@style:color()), gleam@option:option(shore@style:color()) ) -> shore@internal:node_(any()). text_wrapped_styled(Text, Fg, Bg) -> {text_multi, Text, wrap, Fg, Bg}. -file("src/shore/ui.gleam", 202). ?DOC( " UNSTABLE: A base64 encoded png image drawn using the Kitty Graphics Protocol\n" "\n" " This is currently a unstable implementation/exploration of using the kitty graphics protocol, some general notes are:\n" " - visually large pngs and file sizes over 500kb~ have performance issues\n" " - performance is typically even worse in render on_timer mode as it will redraw the images every frame\n" " - size of image is not detected for purposes of layout, as such, it should probably be in its own grid cell\n" " - only pngs stored as a base64 string are supported\n" " - only some terminals support this protocol\n" " - this function is likely to change significantly as the implementation of image support is refined\n" " - expect bugs\n" ). -spec image_unstable(binary()) -> shore@internal:node_(any()). image_unstable(Base64) -> {graphic, Base64}.