This commit is contained in:
NoryiE
2025-02-24 22:54:38 +00:00
parent c3f9dfa735
commit 47fef51a0c
21 changed files with 188 additions and 1114 deletions

View File

@@ -14,40 +14,23 @@ The base class for all UI elements in Basalt. This class provides basic properti
|Method|Returns|Description|
|---|---|---|
|[BaseElement.defineEvent](#BaseElement.defineEvent)|-|
|[BaseElement.new](#BaseElement.new)|table|Creates a new BaseElement instance
|[BaseElement.registerEventCallback](#BaseElement.registerEventCallback)|-|
|[BaseElement:destroy](#BaseElement:destroy)|-|Destroys the element and cleans up all references
|[BaseElement:dispatchEvent](#BaseElement:dispatchEvent)|boolean?|Handles all events
|[BaseElement:fireEvent](#BaseElement:fireEvent)|table|Triggers an event and calls all registered callbacks
|[BaseElement:getBaseFrame](#BaseElement:getBaseFrame)|table|Returns the base frame of the element
|[BaseElement:handleEvent](#BaseElement:handleEvent)|boolean?|The default event handler for all events
|[BaseElement:init](#BaseElement:init)|table|Initializes the BaseElement instance
|[BaseElement:isType](#BaseElement:isType)|boolean|Checks if the element is a specific type
|[BaseElement:listenEvent](#BaseElement:listenEvent)|table|Enables or disables event listening for a specific event
|[BaseElement:postInit](#BaseElement:postInit)|table|Post initialization
|[BaseElement:registerCallback](#BaseElement:registerCallback)|table|Registers a callback function
|[BaseElement:updateRender](#BaseElement:updateRender)|-|Requests a render update for this element
## BaseElement.defineEvent()
## Protected Functions
## BaseElement.new(props, basalt)
Creates a new BaseElement instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `table` `The` newly created BaseElement instance
### Usage
```lua
local element = BaseElement.new()
```
## BaseElement.registerEventCallback()
|Method|Returns|Description|
|---|---|---|
|[BaseElement:dispatchEvent](#BaseElement:dispatchEvent)|boolean?|Handles all events
|[BaseElement:handleEvent](#BaseElement:handleEvent)|boolean?|The default event handler for all events
|[BaseElement:init](#BaseElement:init)|table|Initializes the BaseElement instance
|[BaseElement:postInit](#BaseElement:postInit)|table|Post initialization
## BaseElement:destroy()
Destroys the element and cleans up all references
@@ -57,16 +40,6 @@ Destroys the element and cleans up all references
element:destroy()
```
## BaseElement:dispatchEvent(event...)
Handles all events
### Parameters
* `event` `string` The event to handle
* `...` *(vararg)* `any` The arguments for the event
### Returns
* `boolean?` `handled` Whether the event was handled
## BaseElement:fireEvent(event, ...)
Triggers an event and calls all registered callbacks
@@ -88,26 +61,6 @@ Returns the base frame of the element
### Returns
* `table` `BaseFrame` The base frame of the element
## BaseElement:handleEvent(event...)
The default event handler for all events
### Parameters
* `event` `string` The event to handle
* `...` *(vararg)* `any` The arguments for the event
### Returns
* `boolean?` `handled` Whether the event was handled
## BaseElement:init(props, basalt)
Initializes the BaseElement instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `table` `self` The initialized instance
## BaseElement:isType(type)
Checks if the element is a specific type
@@ -132,12 +85,6 @@ Enables or disables event listening for a specific event
element:listenEvent("mouse_click", true)
```
## BaseElement:postInit()
Post initialization
### Returns
* `table` `self` The BaseElement instance
## BaseElement:registerCallback(event, callback)
Registers a callback function for an event

View File

@@ -18,62 +18,22 @@ This is the base frame class. It is the root element of all elements and the onl
|Method|Returns|Description|
|---|---|---|
|[BaseFrame.new](#BaseFrame.new)|BaseFrame|Creates a new Frame instance
|[BaseFrame:setCursor](#BaseFrame:setCursor)|-|Sets the cursor position
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[BaseFrame:blit](#BaseFrame:blit)|-|Renders a text with a foreground and background color to the render Object
|[BaseFrame:init](#BaseFrame:init)|table|Initializes the Frame instance
|[BaseFrame:mouse_up](#BaseFrame:mouse_up)|-|Handles mouse up events
|[BaseFrame:multiBlit](#BaseFrame:multiBlit)|-|Renders a multiBlit to the render Object
|[BaseFrame:render](#BaseFrame:render)|-|Renders the Frame
|[BaseFrame:setCursor](#BaseFrame:setCursor)|-|Sets the cursor position
|[BaseFrame:term_resize](#BaseFrame:term_resize)|-|Resizes the Frame
|[BaseFrame:textBg](#BaseFrame:textBg)|-|Renders a text with a background color to the render Object
|[BaseFrame:textFg](#BaseFrame:textFg)|-|Renders a text with a foreground color to the render Object
## BaseFrame.new()
Creates a new Frame instance
### Returns
* `BaseFrame` `object` The newly created Frame instance
### Usage
```lua
local element = BaseFrame.new()
```
## BaseFrame:blit(x, y, text, fg, bg)
Renders a text with a foreground and background color to the render Object
### Parameters
* `x` `number` The x position to render to
* `y` `number` The y position to render to
* `text` `string` The text to render
* `fg` `string` The foreground color
* `bg` `string` The background color
## BaseFrame:init(props, basalt)
Initializes the Frame instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `table` `self` The initialized instance
## BaseFrame:multiBlit(x, y, width, height, text, fg, bg)
Renders a multiBlit to the render Object
### Parameters
* `x` `number` The x position to render to
* `y` `number` The y position to render to
* `width` `number` The width of the text
* `height` `number` The height of the text
* `text` `string` The text to render
* `fg` `string` The foreground color
* `bg` `string` The background color
## BaseFrame:render()
Renders the Frame
## BaseFrame:setCursor(x, y, blink)
Sets the cursor position
@@ -82,22 +42,4 @@ Sets the cursor position
* `y` `number` The y position to set the cursor to
* `blink` `boolean` Whether the cursor should blink
## BaseFrame:textBg(x, y, text, bg)
Renders a text with a background color to the render Object
### Parameters
* `x` `number` The x position to render to
* `y` `number` The y position to render to
* `text` `string` The text to render
* `bg` `colors` The background color
## BaseFrame:textFg(x, y, text, fg)
Renders a text with a foreground color to the render Object
### Parameters
* `x` `number` The x position to render to
* `y` `number` The y position to render to
* `text` `string` The text to render
* `fg` `colors` The foreground color

View File

@@ -8,34 +8,17 @@ The Button is a standard button element with click handling and state management
|---|---|---|---|
|text|string|Button|Button text
## Events
|Event|Parameters|Description|
|---|---|---|
## Functions
|Method|Returns|Description|
|---|---|---|
|[Button.new](#Button.new)|table|Creates a new Button instance
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Button:init](#Button:init)|-|Initializes the Button instance
|[Button:render](#Button:render)|-|Renders the Button
## Button.new()
Creates a new Button instance
### Returns
* `table` `self` The created instance
## Button:init(props, basalt)
Initializes the Button instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
## Button:render()
Renders the Button

View File

@@ -12,6 +12,12 @@ The Checkbox is a visual element that can be checked.
## Functions
|Method|Returns|Description|
|---|---|---|
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Checkbox.new](#Checkbox.new)|Checkbox|Creates a new Checkbox instance
@@ -20,31 +26,3 @@ The Checkbox is a visual element that can be checked.
|[Checkbox:render](#Checkbox:render)|-|Renders the Checkbox
## Checkbox.new()
Creates a new Checkbox instance
### Returns
* `Checkbox` `self` The created instance
## Checkbox:init(props, basalt)
Initializes the Checkbox instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
## Checkbox:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `Clicked` Whether the event was handled
## Checkbox:render()
Renders the Checkbox

View File

@@ -21,17 +21,28 @@ like Frames, BaseFrames, and more.
|Method|Returns|Description|
|---|---|---|
|[Container.new](#Container.new)|Container|Creates a new Container instance
|[Container:addChild](#Container:addChild)|Container|Adds a child to the container
|[Container:blit](#Container:blit)|Container|Draws a line of text and fg and bg as colors
|[Container:callChildrenEvents](#Container:callChildrenEvents)|boolean|Calls a event on all children
|[Container:char](#Container:char)|boolean|Handles char events
|[Container:callChildrenEvent](#Container:callChildrenEvent)|boolean|Calls a event on all children
|[Container:clear](#Container:clear)|Container|Clears the container
|[Container:destroy](#Container:destroy)|Container|Destroys the container and its children
|[Container:getChild](#Container:getChild)|Container?|Removes a child from the container
|[Container:isChildVisible](#Container:isChildVisible)|boolean|Returns whether a child is visible
|[Container:registerChildEvent](#Container:registerChildEvent)|Container|Registers the children events of the container
|[Container:registerChildrenEvents](#Container:registerChildrenEvents)|Container|Registers the children events of the container
|[Container:removeChild](#Container:removeChild)|Container|Removes a child from the container
|[Container:removeChildrenEvents](#Container:removeChildrenEvents)|Container|Unregisters the children events of the container
|[Container:sortChildren](#Container:sortChildren)|Container|Sorts the children of the container
|[Container:sortChildrenEvents](#Container:sortChildrenEvents)|Container|Sorts the children events of the container
|[Container:unregisterChildEvent](#Container:unregisterChildEvent)|Container|Unregisters the children events of the container
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Container:blit](#Container:blit)|Container|Draws a line of text and fg and bg as colors
|[Container:char](#Container:char)|boolean|Handles char events
|[Container:handleEvent](#Container:handleEvent)|boolean|Default handler for events
|[Container:init](#Container:init)|-|Initializes the Container instance
|[Container:isChildVisible](#Container:isChildVisible)|boolean|Returns whether a child is visible
|[Container:key](#Container:key)|boolean|Handles key events
|[Container:key_up](#Container:key_up)|boolean|Handles key up events
|[Container:mouse_click](#Container:mouse_click)|boolean|Handles mouse click events
@@ -41,23 +52,9 @@ like Frames, BaseFrames, and more.
|[Container:mouse_scroll](#Container:mouse_scroll)|boolean|Handles mouse scroll events
|[Container:mouse_up](#Container:mouse_up)|boolean|Handles mouse up events
|[Container:multiBlit](#Container:multiBlit)|Container|Draws multiple lines of text, fg and bg strings
|[Container:registerChildEvent](#Container:registerChildEvent)|Container|Registers the children events of the container
|[Container:registerChildrenEvents](#Container:registerChildrenEvents)|Container|Registers the children events of the container
|[Container:removeChild](#Container:removeChild)|Container|Removes a child from the container
|[Container:removeChildrenEvents](#Container:removeChildrenEvents)|Container|Unregisters the children events of the container
|[Container:render](#Container:render)|-|Renders the container
|[Container:sortChildren](#Container:sortChildren)|Container|Sorts the children of the container
|[Container:sortChildrenEvents](#Container:sortChildrenEvents)|Container|Sorts the children events of the container
|[Container:textBg](#Container:textBg)|Container|Draws a line of text and bg as color
|[Container:textFg](#Container:textFg)|Container|Draws a line of text and fg as color
|[Container:unregisterChildEvent](#Container:unregisterChildEvent)|Container|Unregisters the children events of the container
## Container.new()
Creates a new Container instance
### Returns
* `Container` `self` The new container instance
## Container:addChild(child)
Adds a child to the container
@@ -68,20 +65,7 @@ Adds a child to the container
### Returns
* `Container` `self` The container instance
## Container:blit(x, y, text, fg, bg)
Draws a line of text and fg and bg as colors, it is usually used in the render loop
### Parameters
* `x` `number` The x position to draw the text
* `y` `number` The y position to draw the text
* `text` `string` The text to draw
* `fg` `string` The foreground color of the text
* `bg` `string` The background color of the text
### Returns
* `Container` `self` The container instance
## Container:callChildrenEvents(visibleOnly, event...)
## Container:callChildrenEvent(visibleOnly, event...)
Calls a event on all children
### Parameters
@@ -93,27 +77,12 @@ Calls a event on all children
* `boolean` `handled` Whether the event was handled
* `table` `child?` The child that handled the event
## Container:char(char)
Handles char events
### Parameters
* `char` `string` The character that was pressed
### Returns
* `boolean` `handled` Whether the event was handled
## Container:clear()
Clears the container
### Returns
* `Container` `self` The container instance
## Container:destroy()
Destroys the container and its children
### Returns
* `Container` `self` The container instance
## Container:getChild(path)
Removes a child from the container
@@ -123,23 +92,6 @@ Removes a child from the container
### Returns
* `Container?` `self` The container instance
## Container:handleEvent(event...)
Default handler for events
### Parameters
* `event` `string` The event to handle
* `...` *(vararg)* `any` The event arguments
### Returns
* `boolean` `handled` Whether the event was handled
## Container:init(props, basalt)
Initializes the Container instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
## Container:isChildVisible(child)
Returns whether a child is visible
@@ -149,102 +101,6 @@ Returns whether a child is visible
### Returns
* `boolean` `boolean` the child is visible
## Container:key(key)
Handles key events
### Parameters
* `key` `number` The key that was pressed
### Returns
* `boolean` `handled` Whether the event was handled
## Container:key_up(key)
Handles key up events
### Parameters
* `key` `number` The key that was released
### Returns
* `boolean` `handled` Whether the event was handled
## Container:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Container:mouse_drag(button, x, y)
Handles mouse drag events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Container:mouse_move(_, x, y)
Handles mouse move events
### Parameters
* `_` `number` unknown
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Container:mouse_release(button, x, y)
Handles mouse release events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
## Container:mouse_scroll(direction, x, y)
Handles mouse scroll events
### Parameters
* `direction` `number` The direction of the scroll
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Container:mouse_up(button, x, y)
Handles mouse up events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Container:multiBlit(x, y, width, height, text, fg, bg)
Draws multiple lines of text, fg and bg strings, it is usually used in the render loop
### Parameters
* `x` `number` The x position to draw the text
* `y` `number` The y position to draw the text
* `width` `number` The width of the text
* `height` `number` The height of the text
* `text` `string` The text to draw
* `fg` `string` The foreground color of the text
* `bg` `string` The background color of the text
### Returns
* `Container` `self` The container instance
## Container:registerChildEvent(child, eventName)
Registers the children events of the container
@@ -282,9 +138,6 @@ Unregisters the children events of the container
### Returns
* `Container` `self` The container instance
## Container:render()
Renders the container
## Container:sortChildren()
Sorts the children of the container
@@ -300,30 +153,6 @@ Sorts the children events of the container
### Returns
* `Container` `self` The container instance
## Container:textBg(x, y, text, bg)
Draws a line of text and bg as color, it is usually used in the render loop
### Parameters
* `x` `number` The x position to draw the text
* `y` `number` The y position to draw the text
* `text` `string` The text to draw
* `bg` `color` The background color of the text
### Returns
* `Container` `self` The container instance
## Container:textFg(x, y, text, fg)
Draws a line of text and fg as color, it is usually used in the render loop
### Parameters
* `x` `number` The x position to draw the text
* `y` `number` The y position to draw the text
* `text` `string` The text to draw
* `fg` `color` The foreground color of the text
### Returns
* `Container` `self` The container instance
## Container:unregisterChildEvent(child, eventName)
Unregisters the children events of the container

View File

@@ -14,45 +14,14 @@ This is the dropdown class. It is a visual element that can show a list of selec
|Method|Returns|Description|
|---|---|---|
|[Dropdown.new](#Dropdown.new)|Dropdown|Creates a new Dropdown instance
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Dropdown:init](#Dropdown:init)|Dropdown|Initializes the Dropdown instance
|[Dropdown:mouse_click](#Dropdown:mouse_click)|boolean|Handles mouse click events
|[Dropdown:render](#Dropdown:render)|-|Renders the Dropdown
## Dropdown.new()
Creates a new Dropdown instance
### Returns
* `Dropdown` `self` The newly created Dropdown instance
### Usage
```lua
local dropdown = Dropdown.new()
```
## Dropdown:init(props, basalt)
Initializes the Dropdown instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Dropdown` `self` The initialized instance
## Dropdown:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Dropdown:render()
Renders the Dropdown

View File

@@ -15,25 +15,18 @@ This is the Flexbox class. It is a container that arranges its children in a fle
|Method|Returns|Description|
|---|---|---|
|[Flexbox.new](#Flexbox.new)|Flexbox|Creates a new Flexbox instance
|[Flexbox:addChild](#Flexbox:addChild)|Flexbox|Adds a child element to the flexbox
|[Flexbox:addLineBreak](#Flexbox:addLineBreak)|Flexbox|Adds a new line break to the flexbox.
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Flexbox:init](#Flexbox:init)|Flexbox|Initializes the Flexbox instance
|[Flexbox:removeChild](#Flexbox:removeChild)|Flexbox|Removes a child element from the flexbox
|[Flexbox:render](#Flexbox:render)|Flexbox|Renders the flexbox and its children
## Flexbox.new()
Creates a new Flexbox instance
### Returns
* `Flexbox` `object` The newly created Flexbox instance
### Usage
```lua
local element = Flexbox.new("myId", basalt)
```
## Flexbox:addChild(element)
Adds a child element to the flexbox
@@ -52,29 +45,4 @@ Adds a new line break to the flexbox
### Returns
* `nil` `nil` nil
## Flexbox:init(props, basalt)
Initializes the Flexbox instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Flexbox` `self` The initialized instance
## Flexbox:removeChild(element)
Removes a child element from the flexbox
### Parameters
* `element` `Element` The child element to remove
### Returns
* `Flexbox` `self` The flexbox instance
## Flexbox:render()
Renders the flexbox and its children
### Returns
* `Flexbox` `self` The flexbox instance

View File

@@ -5,29 +5,12 @@ This is the frame class. It serves as a grouping container for other elements.
|Method|Returns|Description|
|---|---|---|
|[Frame.new](#Frame.new)|Frame|Creates a new Frame instance
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Frame:init](#Frame:init)|Frame|Initializes the Frame instance
## Frame.new()
Creates a new Frame instance
### Returns
* `Frame` `self` The newly created Frame instance
### Usage
```lua
local frame = Frame.new()
```
## Frame:init(props, basalt)
Initializes the Frame instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Frame` `self` The initialized instance

View File

@@ -15,19 +15,21 @@ See: https://github.com/SkyTheCodeMaster/bimg
|Method|Returns|Description|
|---|---|---|
|[Image.new](#Image.new)|-|
|[Image:getPixelData](#Image:getPixelData)|number?|
|[Image:init](#Image:init)|-|
|[Image:loadBimg](#Image:loadBimg)|-|
|[Image:nextFrame](#Image:nextFrame)|-|
|[Image:render](#Image:render)|-|
|[Image:setBg](#Image:setBg)|-|
|[Image:setChar](#Image:setChar)|-|
|[Image:setFg](#Image:setFg)|-|
|[Image:setPixel](#Image:setPixel)|-|
|[Image:getPixelData](#Image:getPixelData)|number?|Gets pixel information at position
|[Image:loadBimg](#Image:loadBimg)|Image|Loads a bimg format image
|[Image:nextFrame](#Image:nextFrame)|Image|Advances to the next frame in the animation
|[Image:setBg](#Image:setBg)|-|Sets background color at position
|[Image:setChar](#Image:setChar)|-|Sets character at position
|[Image:setFg](#Image:setFg)|-|Sets foreground color at position
|[Image:setPixel](#Image:setPixel)|-|Sets all properties at position
## Image.new()
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Image:init](#Image:init)|Image|Initializes the Image instance
|[Image:render](#Image:render)|-|Renders the Image
## Image:getPixelData(x, y)
Gets pixel information at position
@@ -41,17 +43,20 @@ Gets pixel information at position
* `number?` `bg` Background color
* `string?` `char` Character at position
## Image:init()
## Image:loadBimg(bimgData)
Loads a bimg format image
### Parameters
* `bimgData` `table` The bimg image data
## Image:nextFrame()
### Returns
* `Image` `self` The Image instance
## Image:render()
## Image:nextFrame()
Advances to the next frame in the animation
### Returns
* `Image` `self` The Image instance
## Image:setBg(x, y, color)
Sets background color at position

View File

@@ -20,7 +20,13 @@ cursor movement, text manipulation, placeholder text, and input validation.
|Method|Returns|Description|
|---|---|---|
|[Input.new](#Input.new)|Input|Creates a new Input instance
|[Input:updateViewport](#Input:updateViewport)|Input|Updates the input's viewport
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Input:blur](#Input:blur)|-|Handles blur events
|[Input:char](#Input:char)|boolean|Handles char events
|[Input:focus](#Input:focus)|-|Handles focus events
@@ -28,69 +34,11 @@ cursor movement, text manipulation, placeholder text, and input validation.
|[Input:key](#Input:key)|boolean|Handles key events
|[Input:mouse_click](#Input:mouse_click)|boolean|Handles mouse click events
|[Input:render](#Input:render)|-|Renders the input element
|[Input:updateViewport](#Input:updateViewport)|-|Updates the input's viewport
## Input.new()
Creates a new Input instance
### Returns
* `Input` `object` The newly created Input instance
### Usage
```lua
local element = Input.new("myId", basalt)
```
## Input:blur()
Handles blur events
## Input:char(char)
Handles char events
### Parameters
* `char` `string` The character that was typed
### Returns
* `boolean` `handled` Whether the event was handled
## Input:focus()
Handles focus events
## Input:init(props, basalt)
Initializes the Input instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Input` `self` The initialized instance
## Input:key(key)
Handles key events
### Parameters
* `key` `number` The key that was pressed
### Returns
* `boolean` `handled` Whether the event was handled
## Input:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Input:render()
Renders the input element
## Input:updateViewport()
Updates the input's viewport
### Returns
* `Input` `self` The updated instance

View File

@@ -13,40 +13,20 @@ resizes its width based on the text content.
|Method|Returns|Description|
|---|---|---|
|[Label.new](#Label.new)|Label|Creates a new Label instance
|[Label:getWrappedText](#Label:getWrappedText)|table|Gets the wrapped lines of the Label
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Label:init](#Label:init)|Label|Initializes the Label instance
|[Label:render](#Label:render)|-|Renders the Label by drawing its text content
## Label.new()
Creates a new Label instance
### Returns
* `Label` `self` The newly created Label instance
### Usage
```lua
local label = Label.new()
```
## Label:getWrappedText()
Gets the wrapped lines of the Label
### Returns
* `table` `wrappedText` The wrapped lines of the Label
## Label:init(props, basalt)
Initializes the Label instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Label` `self` The initialized instance
## Label:render()
Renders the Label

View File

@@ -23,30 +23,23 @@ custom item rendering, separators, and selection handling.
|Method|Returns|Description|
|---|---|---|
|[List.new](#List.new)|List|Creates a new List instance
|[List:addItem](#List:addItem)|List|Adds an item to the list
|[List:clear](#List:clear)|List|Clears all items from the list
|[List:getSelectedItems](#List:getSelectedItems)|table|Gets the currently selected items
|[List:init](#List:init)|List|Initializes the List instance
|[List:mouse_click](#List:mouse_click)|boolean|Handles mouse click events
|[List:mouse_scroll](#List:mouse_scroll)|boolean|Handles mouse scroll events
|[List:onSelect](#List:onSelect)|List|Registers a callback for the select event
|[List:removeItem](#List:removeItem)|List|Removes an item from the list
|[List:render](#List:render)|-|Renders the list
|[List:scrollToBottom](#List:scrollToBottom)|List|Scrolls the list to the bottom
|[List:scrollToTop](#List:scrollToTop)|List|Scrolls the list to the top
## List.new()
Creates a new List instance
## Protected Functions
### Returns
* `List` `self` The newly created List instance
### Usage
```lua
local list = List.new()
```
|Method|Returns|Description|
|---|---|---|
|[List:init](#List:init)|List|Initializes the List instance
|[List:mouse_click](#List:mouse_click)|boolean|Handles mouse click events
|[List:mouse_scroll](#List:mouse_scroll)|boolean|Handles mouse scroll events
|[List:render](#List:render)|-|Renders the list
## List:addItem(text)
Adds an item to the list
@@ -85,38 +78,6 @@ Gets the currently selected items
local selected = list:getSelectedItems()
```
## List:init(props, basalt)
Initializes the List instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `List` `self` The initialized instance
## List:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The mouse button that was clicked
* `x` `number` The x-coordinate of the click
* `y` `number` The y-coordinate of the click
### Returns
* `boolean` `Whether` the event was handled
## List:mouse_scroll(direction, x, y)
Handles mouse scroll events
### Parameters
* `direction` `number` The direction of the scroll (1 for down, -1 for up)
* `x` `number` The x-coordinate of the scroll
* `y` `number` The y-coordinate of the scroll
### Returns
* `boolean` `Whether` the event was handled
## List:onSelect(callback)
Registers a callback for the select event
@@ -145,9 +106,6 @@ Removes an item from the list
list:removeItem(1)
```
## List:render()
Renders the list
## List:scrollToBottom()
Scrolls the list to the bottom

View File

@@ -12,47 +12,16 @@ Menu items are displayed in a single row and can have custom colors and callback
|Method|Returns|Description|
|---|---|---|
|[Menu.new](#Menu.new)|Menu|Creates a new Menu instance
|[Menu:init](#Menu:init)|Menu|Initializes the Menu instance
|[Menu:mouse_click](#Menu:mouse_click)|boolean|Handles mouse click events and item selection
|[Menu:render](#Menu:render)|-|Renders the menu horizontally with proper spacing and colors
|[Menu:setItems](#Menu:setItems)|Menu|Sets the menu items and calculates total width
## Menu.new()
Creates a new Menu instance
## Protected Functions
### Returns
* `Menu` `self` The newly created Menu instance
### Usage
```lua
local menu = Menu.new()
```
## Menu:init(props, basalt)
Initializes the Menu instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Menu` `self` The initialized instance
## Menu:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `Whether` the event was handled
## Menu:render()
Renders the menu
|Method|Returns|Description|
|---|---|---|
|[Menu:init](#Menu:init)|Menu|Initializes the Menu instance
|[Menu:mouse_click](#Menu:mouse_click)|boolean|Handles mouse click events and item selection
|[Menu:render](#Menu:render)|-|Renders the menu horizontally with proper spacing and colors
## Menu:setItems(items)
Sets the menu items

View File

@@ -13,35 +13,18 @@ This is the program class. It provides a program that runs in a window.
|Method|Returns|Description|
|---|---|---|
|[Program.new](#Program.new)|Program|Creates a new Program instance
|[Program:dispatchEvent](#Program:dispatchEvent)|any|Handles all incomming events
|[Program:execute](#Program:execute)|Program|Executes a program
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Program:dispatchEvent](#Program:dispatchEvent)|any|Handles all incomming events
|[Program:focus](#Program:focus)|-|Gets called when the element gets focused
|[Program:init](#Program:init)|Program|Initializes the Program instance
|[Program:render](#Program:render)|-|Renders the program
## Program.new()
Creates a new Program instance
### Returns
* `Program` `object` The newly created Program instance
### Usage
```lua
local element = Program.new("myId", basalt)
```
## Program:dispatchEvent(event, ...)
Handles all incomming events
### Parameters
* `event` `string` The event to handle
* `...` `any` The event arguments
### Returns
* `any` `result` The event result
## Program:execute(path)
Executes a program
@@ -51,20 +34,4 @@ Executes a program
### Returns
* `Program` `self` The Program instance
## Program:focus()
Gets called when the element gets focused
## Program:init(props, basalt)
Initializes the Program instanceProperty
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Program` `self` The initialized instance
## Program:render()
Renders the program

View File

@@ -14,33 +14,13 @@ with optional percentage display and customizable colors.
|Method|Returns|Description|
|---|---|---|
|[ProgressBar.new](#ProgressBar.new)|ProgressBar|Creates a new ProgressBar instance
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[ProgressBar:init](#ProgressBar:init)|ProgressBar|Initializes the ProgressBar instance
|[ProgressBar:render](#ProgressBar:render)|-|Renders the progress bar with filled portion and optional percentage text
## ProgressBar.new()
Creates a new ProgressBar instance
### Returns
* `ProgressBar` `self` The newly created ProgressBar instance
### Usage
```lua
local progressBar = ProgressBar.new()
```
## ProgressBar:init(props, basalt)
Initializes the ProgressBar instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `ProgressBar` `self` The initialized instance
## ProgressBar:render()
Renders the ProgressBar

View File

@@ -25,26 +25,19 @@ A scrollbar element that can be attached to other elements to control their scro
|Method|Returns|Description|
|---|---|---|
|[Scrollbar.new](#Scrollbar.new)|Scrollbar|Creates a new Scrollbar instance
|[Scrollbar:attach](#Scrollbar:attach)|Scrollbar|Attaches the scrollbar to an element's property
|[Scrollbar:updateAttachedElement](#Scrollbar:updateAttachedElement)|Scrollbar|Updates the attached element's property based on the scrollbar value
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Scrollbar:init](#Scrollbar:init)|Scrollbar|Initializes the Scrollbar instance
|[Scrollbar:mouse_click](#Scrollbar:mouse_click)|boolean|Handles mouse click events
|[Scrollbar:mouse_drag](#Scrollbar:mouse_drag)|boolean|Handles mouse drag events
|[Scrollbar:mouse_scroll](#Scrollbar:mouse_scroll)|boolean|Handles mouse scroll events
|[Scrollbar:render](#Scrollbar:render)|-|Renders the scrollbar
|[Scrollbar:updateAttachedElement](#Scrollbar:updateAttachedElement)|Scrollbar|Updates the attached element's property based on the scrollbar value
## Scrollbar.new()
Creates a new Scrollbar instance
### Returns
* `Scrollbar` `self` The newly created Scrollbar instance
### Usage
```lua
local scrollbar = Scrollbar.new()
```
## Scrollbar:attach(element, config)
Attaches the scrollbar to an element's property
@@ -56,52 +49,6 @@ Attaches the scrollbar to an element's property
### Returns
* `Scrollbar` `self` The scrollbar instance
## Scrollbar:init(props, basalt)
Initializes the Scrollbar instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Scrollbar` `self` The initialized instance
## Scrollbar:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The mouse button clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `Whether` the event was handled
## Scrollbar:mouse_drag(button, x, y)
Handles mouse drag events
### Parameters
* `button` `number` The mouse button being dragged
* `x` `number` The x position of the drag
* `y` `number` The y position of the drag
### Returns
* `boolean` `Whether` the event was handled
## Scrollbar:mouse_scroll(direction, x, y)
Handles mouse scroll events
### Parameters
* `direction` `number` The scroll direction (1 for up, -1 for down)
* `x` `number` The x position of the scroll
* `y` `number` The y position of the scroll
### Returns
* `boolean` `Whether` the event was handled
## Scrollbar:render()
Renders the Scrollbar
## Scrollbar:updateAttachedElement()
Updates the attached element's property based on the scrollbar value

View File

@@ -22,25 +22,18 @@ with customizable colors and value ranges.
|Method|Returns|Description|
|---|---|---|
|[Slider.new](#Slider.new)|Slider|Creates a new Slider instance
|[Slider:getValue](#Slider:getValue)|number|Gets the current value mapped to the max range
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Slider:init](#Slider:init)|Slider|Initializes the Slider instance
|[Slider:mouse_click](#Slider:mouse_click)|boolean|Updates slider position on mouse click
|[Slider:mouse_scroll](#Slider:mouse_scroll)|boolean|Handles mouse release events
|[Slider:render](#Slider:render)|-|Renders the slider with track and handle
## Slider.new()
Creates a new Slider instance
### Returns
* `Slider` `self` The newly created Slider instance
### Usage
```lua
local slider = Slider.new()
```
## Slider:getValue()
Gets the current value of the slider
@@ -52,39 +45,4 @@ Gets the current value of the slider
local value = slider:getValue()
```
## Slider:init(props, basalt)
Initializes the Slider instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Slider` `self` The initialized instance
## Slider:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The mouse button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Slider:mouse_scroll(button, x, y)
Handles mouse release events
### Parameters
* `button` `number` The mouse button that was released
* `x` `number` The x position of the release
* `y` `number` The y position of the release
### Returns
* `boolean` `handled` Whether the event was handled
## Slider:render()
Renders the slider

View File

@@ -20,59 +20,17 @@ row selection, and scrolling capabilities.
|Method|Returns|Description|
|---|---|---|
|[Table.new](#Table.new)|Table|Creates a new Table instance
|[Table:sortData](#Table:sortData)|Table|Sorts the table data by the specified column
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[Table:init](#Table:init)|Table|Initializes the Table instance
|[Table:mouse_click](#Table:mouse_click)|boolean|Handles header clicks for sorting and row selection
|[Table:mouse_scroll](#Table:mouse_scroll)|boolean|Handles scrolling through the table data
|[Table:render](#Table:render)|-|Renders the table with headers, data and scrollbar
|[Table:sortData](#Table:sortData)|Table|Sorts the table data by the specified column
## Table.new()
Creates a new Table instance
### Returns
* `Table` `self` The newly created Table instance
### Usage
```lua
local table = Table.new()
```
## Table:init(props, basalt)
Initializes the Table instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Table` `self` The initialized instance
## Table:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Table:mouse_scroll(direction, x, y)
Handles mouse scroll events
### Parameters
* `direction` `number` The scroll direction (-1 up, 1 down)
* `x` `number` The x position of the scroll
* `y` `number` The y position of the scroll
### Returns
* `boolean` `handled` Whether the event was handled
## Table:render()
Renders the table
## Table:sortData(columnIndex)
Sorts the table data by column

View File

@@ -18,24 +18,22 @@ A multi-line text editor component with cursor support and text manipulation fea
|Method|Returns|Description|
|---|---|---|
|[TextBox.new](#TextBox.new)|TextBox|Creates a new TextBox instance
|[TextBox:addSyntaxPattern](#TextBox:addSyntaxPattern)|-|Adds a new syntax highlighting pattern
|[TextBox:char](#TextBox:char)|boolean|Handles character input
|[TextBox:addSyntaxPattern](#TextBox:addSyntaxPattern)|TextBox|Adds a new syntax highlighting pattern
|[TextBox:getText](#TextBox:getText)|string|Gets the text of the TextBox
|[TextBox:setText](#TextBox:setText)|TextBox|Sets the text of the TextBox
|[TextBox:updateViewport](#TextBox:updateViewport)|TextBox|Updates the viewport to keep the cursor in view
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[TextBox:char](#TextBox:char)|boolean|Handles character input
|[TextBox:init](#TextBox:init)|TextBox|Initializes the TextBox instance
|[TextBox:key](#TextBox:key)|boolean|Handles key events
|[TextBox:mouse_click](#TextBox:mouse_click)|boolean|Handles mouse click events
|[TextBox:mouse_scroll](#TextBox:mouse_scroll)|boolean|Handles mouse scroll events
|[TextBox:render](#TextBox:render)|-|Renders the TextBox with syntax highlighting
|[TextBox:setText](#TextBox:setText)|TextBox|Sets the text of the TextBox
|[TextBox:updateViewport](#TextBox:updateViewport)|TextBox|Updates the viewport to keep the cursor in view
## TextBox.new()
Creates a new TextBox instance
### Returns
* `TextBox` `self` The newly created TextBox instance
## TextBox:addSyntaxPattern(pattern, color)
Adds a new syntax highlighting pattern
@@ -44,14 +42,8 @@ Adds a new syntax highlighting pattern
* `pattern` `string` The regex pattern to match
* `color` `colors` The color to apply
## TextBox:char(char)
Handles character input
### Parameters
* `char` `string` The character that was typed
### Returns
* `boolean` `handled` Whether the event was handled
* `TextBox` `self` The TextBox instance
## TextBox:getText()
Gets the text of the TextBox
@@ -59,50 +51,6 @@ Gets the text of the TextBox
### Returns
* `string` `text` The text of the TextBox
## TextBox:init(props, basalt)
Initializes the TextBox instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `TextBox` `self` The initialized instance
## TextBox:key(key)
Handles key events
### Parameters
* `key` `number` The key that was pressed
### Returns
* `boolean` `handled` Whether the event was handled
## TextBox:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## TextBox:mouse_scroll(direction, x, y)
Handles mouse scroll events
### Parameters
* `direction` `number` The scroll direction
* `x` `number` The x position of the scroll
* `y` `number` The y position of the scroll
### Returns
* `boolean` `handled` Whether the event was handled
## TextBox:render()
Renders the TextBox
## TextBox:setText(text)
Sets the text of the TextBox

View File

@@ -18,28 +18,21 @@ with support for selection and scrolling.
|Method|Returns|Description|
|---|---|---|
|[Tree.new](#Tree.new)|Tree|Creates a new Tree instance
|[Tree:collapseNode](#Tree:collapseNode)|Tree|Collapses a node to hide its children
|[Tree:expandNode](#Tree:expandNode)|Tree|Expands a node to show its children
|[Tree:getNodeSize](#Tree:getNodeSize)|number|Gets the size of the tree
|[Tree:init](#Tree:init)|Tree|Initializes the Tree instance
|[Tree:mouse_click](#Tree:mouse_click)|boolean|Handles mouse click events for node selection and expansion
|[Tree:mouse_scroll](#Tree:mouse_scroll)|boolean|Handles mouse scroll events for vertical scrolling
|[Tree:onSelect](#Tree:onSelect)|Tree|Registers a callback for when a node is selected
|[Tree:render](#Tree:render)|-|Renders the tree with nodes, selection and scrolling
|[Tree:toggleNode](#Tree:toggleNode)|Tree|Toggles between expanded and collapsed state
## Tree.new()
Creates a new Tree instance
## Protected Functions
### Returns
* `Tree` `self` The newly created Tree instance
### Usage
```lua
local tree = Tree.new()
```
|Method|Returns|Description|
|---|---|---|
|[Tree:init](#Tree:init)|Tree|Initializes the Tree instance
|[Tree:mouse_click](#Tree:mouse_click)|boolean|Handles mouse click events for node selection and expansion
|[Tree:mouse_scroll](#Tree:mouse_scroll)|boolean|Handles mouse scroll events for vertical scrolling
|[Tree:render](#Tree:render)|-|Renders the tree with nodes, selection and scrolling
## Tree:collapseNode(node)
Collapses a node
@@ -66,38 +59,6 @@ Gets the size of the tree
* `number` `width` The width of the tree
* `number` `height` The height of the tree
## Tree:init(props, basalt)
Initializes the Tree instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
### Returns
* `Tree` `self` The initialized instance
## Tree:mouse_click(button, x, y)
Handles mouse click events
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `handled` Whether the event was handled
## Tree:mouse_scroll(direction, x, y)
Handles mouse scroll events
### Parameters
* `direction` `number` The scroll direction (1 for up, -1 for down)
* `x` `number` The x position of the scroll
* `y` `number` The y position of the scroll
### Returns
* `boolean` `handled` Whether the event was handled
## Tree:onSelect(callback)
Registers a callback for when a node is selected
@@ -107,9 +68,6 @@ Registers a callback for when a node is selected
### Returns
* `Tree` `self` The Tree instance
## Tree:render()
Renders the tree
## Tree:toggleNode(node)
Toggles a node's expanded state

View File

@@ -49,60 +49,38 @@ and provides core functionality for positioning, sizing, colors, and rendering.
|Method|Returns|Description|
|---|---|---|
|[VisualElement.new](#VisualElement.new)|VisualElement|Creates a new visual element
|[VisualElement:calculatePosition](#VisualElement:calculatePosition)|number|Calculates the position of the element
|[VisualElement:getAbsolutePosition](#VisualElement:getAbsolutePosition)|number|Returns the absolute position of the element
|[VisualElement:getRelativePosition](#VisualElement:getRelativePosition)|number|Returns the relative position of the element
|[VisualElement:isInBounds](#VisualElement:isInBounds)|boolean|Checks if point is within bounds
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|[VisualElement:blit](#VisualElement:blit)|-|Draws text with both colors
|[VisualElement:blur](#VisualElement:blur)|-|Handles a blur event
|[VisualElement:calculatePosition](#VisualElement:calculatePosition)|-|
|[VisualElement:focus](#VisualElement:focus)|-|Handles a focus event
|[VisualElement:getAbsolutePosition](#VisualElement:getAbsolutePosition)|-|Returns the absolute position of the element
|[VisualElement:getRelativePosition](#VisualElement:getRelativePosition)|number,|Returns the relative position of the element
|[VisualElement:init](#VisualElement:init)|-|Initializes a new visual element with properties
|[VisualElement:isInBounds](#VisualElement:isInBounds)|boolean|Checks if point is within bounds
|[VisualElement:mouse_click](#VisualElement:mouse_click)|boolean|Handles a mouse click event
|[VisualElement:mouse_drag](#VisualElement:mouse_drag)|-|
|[VisualElement:mouse_move](#VisualElement:mouse_move)|-|
|[VisualElement:mouse_drag](#VisualElement:mouse_drag)|boolean|Handles a mouse drag event
|[VisualElement:mouse_move](#VisualElement:mouse_move)|boolean|Handles a mouse move event
|[VisualElement:mouse_release](#VisualElement:mouse_release)|-|Handles a mouse release event
|[VisualElement:mouse_scroll](#VisualElement:mouse_scroll)|-|
|[VisualElement:mouse_scroll](#VisualElement:mouse_scroll)|boolean|Handles a mouse scroll event
|[VisualElement:mouse_up](#VisualElement:mouse_up)|boolean|Handles a mouse up event
|[VisualElement:multiBlit](#VisualElement:multiBlit)|-|Multi-character drawing with colors
|[VisualElement:render](#VisualElement:render)|-|Renders the element
|[VisualElement:setCursor](#VisualElement:setCursor)|-|Sets the cursor position
|[VisualElement:setCursor](#VisualElement:setCursor)|VisualElement|Sets the cursor position
|[VisualElement:textBg](#VisualElement:textBg)|-|Draws text with background color
|[VisualElement:textFg](#VisualElement:textFg)|-|Draws text with foreground color
## VisualElement.new(props, basalt)
Creates a new VisualElement instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
## VisualElement:calculatePosition()
Calculates the position of the element relative to its parent
### Returns
* `VisualElement` `object` The newly created VisualElement instance
### Usage
```lua
local element = VisualElement.new("myId", basalt)
```
## VisualElement:blit(x, y, text, fg, bg)
Draws text with both foreground and background colors
### Parameters
* `x` `number` The x position to draw
* `y` `number` The y position to draw
* `text` `string` The text char to draw
* `fg` `string` The foreground color
* `bg` `string` The background color
## VisualElement:blur()
Handles a blur event
## VisualElement:calculatePosition()
## VisualElement:focus()
Handles a focus event
* `number` `x` The x position
* `number` `y` The y position
## VisualElement:getAbsolutePosition(x?, y?)
Returns the absolute position of the element or the given coordinates.
@@ -111,6 +89,10 @@ Returns the absolute position of the element or the given coordinates.
* `x` *(optional)* `number` x position
* `y` *(optional)* `number` y position
### Returns
* `number` `x` The absolute x position
* `number` `y` The absolute y position
## VisualElement:getRelativePosition(x?, y?)
Returns the relative position of the element or the given coordinates.
@@ -119,14 +101,8 @@ Returns the relative position of the element or the given coordinates.
* `y` *(optional)* `number` y position
### Returns
* `nil` `nil` nil
## VisualElement:init(props, basalt)
Initializes the VisualElement instance
### Parameters
* `props` `table` The properties to initialize the element with
* `basalt` `table` The basalt instance
* `number` `x` The relative x position
* `number` `y` The relative y position
## VisualElement:isInBounds(x, y)
Checks if the specified coordinates are within the bounds of the element
@@ -138,81 +114,4 @@ Checks if the specified coordinates are within the bounds of the element
### Returns
* `boolean` `isInBounds` Whether the coordinates are within the bounds of the element
## VisualElement:mouse_click(button, x, y)
Handles a mouse click event
### Parameters
* `button` `number` The button that was clicked
* `x` `number` The x position of the click
* `y` `number` The y position of the click
### Returns
* `boolean` `clicked` Whether the element was clicked
## VisualElement:mouse_drag()
## VisualElement:mouse_move()
## VisualElement:mouse_release(button, x, y)
Handles a mouse release event
### Parameters
* `button` `number` The button that was released
* `x` `number` The x position of the release
* `y` `number` The y position of the release
## VisualElement:mouse_scroll()
## VisualElement:mouse_up(button, x, y)
Handles a mouse up event
### Parameters
* `button` `number` The button that was released
* `x` `number` The x position of the release
* `y` `number` The y position of the release
### Returns
* `boolean` `release` Whether the element was released on the element
## VisualElement:multiBlit(x, y, width, height, text, fg, bg)
Draws multiple characters at once with colors
### Parameters
* `x` `number` The x position to draw
* `y` `number` The y position to draw
* `width` `number` The width of the area to draw
* `height` `number` The height of the area to draw
* `text` `string` The text to draw
* `fg` `string` The foreground color
* `bg` `string` The background color
## VisualElement:render()
Renders the element
## VisualElement:setCursor(x, y, blink)
Sets the cursor position
### Parameters
* `x` `number` The x position of the cursor
* `y` `number` The y position of the cursor
* `blink` `boolean` Whether the cursor should blink
## VisualElement:textBg(x, y, text, bg)
Draws text with background color
### Parameters
* `x` `number` The x position to draw
* `y` `number` The y position to draw
* `text` `string` The text char to draw
* `bg` `color` The background color
## VisualElement:textFg(x, y, text, fg)
Draws text with foreground color
### Parameters
* `x` `number` The x position to draw
* `y` `number` The y position to draw
* `text` `string` The text char to draw
* `fg` `color` The foreground color