defprotocol ElementTui.Component do @moduledoc """ Protocol that needs to be implemented to support a component Designing a component is as simple as implementing the protocol for your type. For an example see the `ElementTui.Component.Margin` module. """ @doc """ Returns the _minimal_ width and height requested by the Element and additional keywords The return value is a tuple with `{width, height, keywords}` ## Keywords [vflex: weight] Can grow vertically to take up more space relative to its weight (and other vflex elements) [hflex: weight] Can grow horizontally to take up more space relative to its weight (and other vflex elements) """ @spec calculate_dim(any(), integer(), integer()) :: {integer(), integer(), Keyword.t()} def calculate_dim(data, width, height) @doc """ Returns the data needed to render your screen """ @spec parse(any(), integer(), integer(), integer(), integer()) :: ElementTui.Parser.ParseResult.t() def parse(data, x, y, width, height) end