This commit is contained in:
NoryiE
2025-09-13 10:43:05 +00:00
parent 179949c8b7
commit 8e64ba97bf
46 changed files with 0 additions and 2949 deletions

View File

@@ -1,28 +0,0 @@
# BarChart : Graph
The Bar Chart element is designed for visualizing data series as vertical bars. It displays multiple values as side-by-side bars where each bar's height represents its value.
### Usage
```lua
local chart = main:addBarChart()
:addSeries("input", " ", colors.green, colors.green, 5)
:addSeries("output", " ", colors.red, colors.red, 5)
basalt.schedule(function()
while true do
chart:addPoint("input", math.random(1,100))
chart:addPoint("output", math.random(1,100))
sleep(2)
end
end)
```
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|BarChart:init|BarChart|Initializes the BarChart instance
|BarChart:render|-|Renders the BarChart

View File

@@ -1,118 +0,0 @@
# BaseElement : PropertySystem
The base class for all UI elements in Basalt. This class provides basic properties and event handling functionality.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|type|string|BaseElement|The type identifier of the element
|id|string|BaseElement|The unique identifier for the element
|name|string|BaseElement|The name of the element
|eventCallbacks|table|BaseElement|The event callbacks for the element
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseElement.defineEvent](#baseelement-defineevent)|-|Registers a new event listener for the element (on class level)
|[BaseElement.registerEventCallback](#baseelement-registereventcallback)|-|Registers a new event callback for the element (on class level)
|[BaseElement:destroy](#baseelement-destroy)|-|Destroys the element and cleans up all references
|[BaseElement:fireEvent](#baseelement-fireevent)|table|Triggers an event and calls all registered callbacks
|[BaseElement:getBaseFrame](#baseelement-getbaseframe)|BaseFrame|Returns the base frame of the element
|[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:onChange](#baseelement-onchange)|table|Observes a property and calls a callback when it changes
|[BaseElement:registerCallback](#baseelement-registercallback)|table|Registers a callback function
|[BaseElement:updateRender](#baseelement-updaterender)|table|Requests a render update for this element
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|BaseElement:dispatchEvent|boolean?|Handles all events
|BaseElement:handleEvent|boolean?|The default event handler for all events
|BaseElement:init|table|Initializes the BaseElement instance
|BaseElement:postInit|table|Post initialization
## BaseElement.defineEvent(class, eventName, requiredEvent?)
Registers a new event listener for the element (on class level)
### Parameters
* `class` `table` The class to register
* `eventName` `string` The name of the event to register
* `requiredEvent` *(optional)* `string` The name of the required event (optional)
## BaseElement.registerEventCallback(class, callbackName, ...)
Registers a new event callback for the element (on class level)
### Parameters
* `class` `table` The class to register
* `callbackName` `string` The name of the callback to register
* `...` `string` The names of the events to register the callback for
## BaseElement:destroy()
Destroys the element and cleans up all references
## BaseElement:fireEvent(event, ...)
Triggers an event and calls all registered callbacks
### Parameters
* `event` `string` The event to fire
* `...` `any` Additional arguments to pass to the callbacks
### Returns
* `table` `self` The BaseElement instance
## BaseElement:getBaseFrame()
Returns the base frame of the element
### Returns
* `BaseFrame` `BaseFrame` The base frame of the element
## BaseElement:isType(type)
Checks if the element is a specific type
### Parameters
* `type` `string` The type to check for
### Returns
* `boolean` `isType` Whether the element is of the specified type
## BaseElement:listenEvent(eventName, enable?)
Enables or disables event listening for a specific event
### Parameters
* `eventName` `string` The name of the event to listen for
* `enable` *(optional)* `boolean` Whether to enable or disable the event (default: true)
### Returns
* `table` `self` The BaseElement instance
## BaseElement:onChange(property, callback)
Observes a property and calls a callback when it changes
### Parameters
* `property` `string` The property to observe
* `callback` `function` The callback to call when the property changes
### Returns
* `table` `self` The BaseElement instance
## BaseElement:registerCallback(event, callback)
Registers a callback function for an event
### Parameters
* `event` `string` The event to register the callback for
* `callback` `function` The callback function to register
### Returns
* `table` `self` The BaseElement instance
## BaseElement:updateRender()
Requests a render update for this element
### Returns
* `table` `self` The BaseElement instance

View File

@@ -1,61 +0,0 @@
# BaseFrame : Container
This is the base frame class. It is the root element of all elements and the only element without a parent.
## Fields
|Field|Type|Description|
|---|---|---|
|_render|`Render`|The render object|
|_renderUpdate|`boolean`|Whether the render object needs to be updated|
|_peripheralName|`string`|The name of a peripheral|
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|term|term|peripheral|term.current()|The terminal or (monitor) peripheral object to render to
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseFrame:dispatchEvent](#baseframe-dispatchevent)|-|
|[BaseFrame:drawBg](#baseframe-drawbg)|-|
|[BaseFrame:drawFg](#baseframe-drawfg)|-|
|[BaseFrame:setCursor](#baseframe-setcursor)|-|Sets the cursor position
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|BaseFrame:blit|-|Renders a text with a foreground and background color to the render Object
|BaseFrame:char|-|Handles character events
|BaseFrame:drawText|-|Renders a text with a background color to the render Object
|BaseFrame:init|table|Initializes the Frame instance
|BaseFrame:key|-|Handles key events
|BaseFrame:key_up|-|Handles key up events
|BaseFrame:monitor_touch|-|Handles monitor touch events
|BaseFrame:mouse_click|-|Handles mouse click events
|BaseFrame:mouse_up|-|Handles mouse up events
|BaseFrame:multiBlit|-|Renders a multiBlit to the render Object
|BaseFrame:render|-|Renders the Frame
|BaseFrame:term_resize|-|Resizes the Frame
|BaseFrame:textBg|-|Renders a text with a background color to the render Object
|BaseFrame:textFg|-|Renders a text with a foreground color to the render Object
## BaseFrame:dispatchEvent()
## BaseFrame:drawBg()
## BaseFrame:drawFg()
## BaseFrame:setCursor(x, y, blink)
Sets the cursor position
### Parameters
* `x` `number` The x position to set the cursor to
* `y` `number` The y position to set the cursor to
* `blink` `boolean` Whether the cursor should blink

View File

@@ -1,26 +0,0 @@
# BigFont : VisualElement
The BigFont element is a text element that displays larger text. It uses Wojbie's BigFont API to render the text in a larger font size. Credits to Wojbie for the original API.
### Usage
```lua
local font = main:addBigFont()
font:setText("Hello World!")
```
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|text|string|BigFont|BigFont text
|fontSize|number|1|The font size of the BigFont
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|BigFont:init|-|Initializes the BigFont instance
|BigFont:render|-|Renders the BigFont

View File

@@ -1,18 +0,0 @@
# Button : VisualElement
The Button is a standard button element with click handling and state management.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|text|string|Button|Button text
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Button:init|-|Initializes the Button instance
|Button:render|-|Renders the Button

View File

@@ -1,23 +0,0 @@
# Checkbox : VisualElement
The Checkbox is a visual element that can be checked.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|checked|boolean|Whether|checkbox is checked
|text|string|empty|Text to display
|checkedText|string|Text|when checked
|autoSize|boolean|true|Whether to automatically size the checkbox
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Checkbox.new|Checkbox|Creates a new Checkbox instance
|Checkbox:init|-|Initializes the Checkbox instance
|Checkbox:mouse_click|boolean|Handles mouse click events
|Checkbox:render|-|Renders the Checkbox

View File

View File

@@ -1,187 +0,0 @@
# Container : VisualElement
The Container class serves as a fundamental building block for organizing UI elements. It acts as a parent element that can hold and manage child elements.
### Usage
```lua
local container = basalt.getMainFrame()
container:addButton() -- Add a child element
```
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|children|table|{}|The children of the container
|childrenSorted|boolean|true|Whether the children are sorted
|childrenEventsSorted|boolean|true|Whether the children events are sorted
|childrenEvents|table|{}|The children events of the container
|eventListenerCount|table|{}|The event listener count of the container
|focusedChild|table|nil|The focused child of the container
|visibleChildren|table|{}|The visible children of the container
|visibleChildrenEvents|table|{}|The visible children events of the container
|offsetX|number|0|Horizontal content offset
|offsetY|number|0|Vertical content offset
## Combined Properties
|Name|Properties|Description|
|---|---|---|
|offset|`offsetX number, offsetY number`|Combined property for offsetX and offsetY|
## Functions
|Method|Returns|Description|
|---|---|---|
|[Container:addChild](#container-addchild)|Container|Adds a child to the container
|[Container:callChildrenEvent](#container-callchildrenevent)|boolean|Calls a event on all children
|[Container:clear](#container-clear)|Container|Clears the container
|[Container:drawBg](#container-drawbg)|-|
|[Container:drawFg](#container-drawfg)|-|
|[Container:drawText](#container-drawtext)|-|
|[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|Draws a line of text and fg and bg as colors
|Container:char|boolean|Handles char events
|Container:handleEvent|boolean|Default handler for events
|Container:init|-|Initializes the Container instance
|Container:key|boolean|Handles key events
|Container:key_up|boolean|Handles key up events
|Container:mouse_click|boolean|Handles mouse click events
|Container:mouse_drag|boolean|Handles mouse drag events
|Container:mouse_move|boolean|Handles mouse move events
|Container:mouse_release|-|Handles mouse release events
|Container:mouse_scroll|boolean|Handles mouse scroll events
|Container:mouse_up|boolean|Handles mouse up events
|Container:multiBlit|Container|Draws multiple lines of text, fg and bg strings
|Container:render|-|Renders the container
|Container:textBg|Container|Draws a line of text and bg as color
|Container:textFg|Container|Draws a line of text and fg as color
## Container:addChild(child)
Adds a child to the container
### Parameters
* `child` `table` The child to add
### Returns
* `Container` `self` The container instance
## Container:callChildrenEvent(visibleOnly, event...)
Calls a event on all children
### Parameters
* `visibleOnly` `boolean` Whether to only call the event on visible children
* `event` `string` The event to call
* `...` *(vararg)* `any` The event arguments
### Returns
* `boolean` `handled` Whether the event was handled
* `table?` `child` The child that handled the event
## Container:clear()
Clears the container
### Returns
* `Container` `self` The container instance
## Container:drawBg()
## Container:drawFg()
## Container:drawText()
## Container:getChild(path)
Removes a child from the container
### Parameters
* `path` `string` The path to the child to remove
### Returns
* `Container?` `self` The container instance
## Container:isChildVisible(child)
Returns whether a child is visible
### Parameters
* `child` `table` The child to check
### Returns
* `boolean` `boolean` the child is visible
## Container:registerChildEvent(child, eventName)
Registers the children events of the container
### Parameters
* `child` `table` The child to register events for
* `eventName` `string` The event name to register
### Returns
* `Container` `self` The container instance
## Container:registerChildrenEvents(child)
Registers the children events of the container
### Parameters
* `child` `table` The child to register events for
### Returns
* `Container` `self` The container instance
## Container:removeChild(child)
Removes a child from the container
### Parameters
* `child` `table` The child to remove
### Returns
* `Container` `self` The container instance
## Container:removeChildrenEvents(child)
Unregisters the children events of the container
### Parameters
* `child` `table` The child to unregister events for
### Returns
* `Container` `self` The container instance
## Container:sortChildren()
Sorts the children of the container
### Returns
* `Container` `self` The container instance
## Container:sortChildrenEvents(eventName)
Sorts the children events of the container
### Parameters
* `eventName` `string` The event name to sort
### Returns
* `Container` `self` The container instance
## Container:unregisterChildEvent(child, eventName)
Unregisters the children events of the container
### Parameters
* `child` `table` The child to unregister events for
* `eventName` `string` The event name to unregister
### Returns
* `Container` `self` The container instance

View File

@@ -1,46 +0,0 @@
# Display : VisualElement
The Display is a special element where you can use the window (term) API to draw on the display, useful when you need to use external APIs.
### Usage
```lua
local display = main:addDisplay() -- Create a display element
local displayWindow = display:getWindow() -- Get the window object of the display
displayWindow.write("Hello World!") -- Write "Hello World!" to the display
```
## Functions
|Method|Returns|Description|
|---|---|---|
|[Display:getWindow](#display-getwindow)|table|Returns the current window object
|[Display:write](#display-write)|Display|Writes text to the display
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Display:init|-|Initializes the Display instance
|Display:render|-|Renders the Display
## Display:getWindow()
Returns the current window object
### Returns
* `table` `window` The current window object
## Display:write(x, y, text, fg?, bg?)
Writes text to the display at the given position with the given foreground and background colors
### Parameters
* `x` `number` The x position to write to
* `y` `number` The y position to write to
* `text` `string` The text to write
* `fg` *(optional)* `colors` The foreground color (optional)
* `bg` *(optional)* `colors` The background color (optional)
### Returns
* `Display` `self` The display instance

View File

@@ -1,33 +0,0 @@
# Dropdown : List
This is the dropdown class. It is a visual element that can show a list of selectable items in a dropdown menu.
### Usage
```lua
local dropdown = main:addDropdown()
dropdown:setItems({
{text = "Item 1", callback = function() basalt.LOGGER.debug("Item 1 selected") end},
{text = "Item 2", callback = function() basalt.LOGGER.debug("Item 2 selected") end},
{text = "Item 3", callback = function() basalt.LOGGER.debug("Item 3 selected") end},
})
```
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|isOpen|boolean|false|Whether the dropdown menu is currently open
|dropdownHeight|number|5|Maximum height of the dropdown menu when open
|selectedText|string|""|The text to show when no item is selected
|dropSymbol|string|"\31"|The symbol to show for dropdown indication
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Dropdown:init|Dropdown|Initializes the Dropdown instance
|Dropdown:mouse_click|boolean|Handles mouse click events
|Dropdown:render|-|Renders the Dropdown

View File

@@ -1,67 +0,0 @@
# Flexbox : Container
This is the Flexbox class. It is a container that arranges its children in a flexible layout.
### Usage
```lua
local flex = main:addFlexbox({background=colors.black, width=30, height=10})
flex:addButton():setFlexGrow(1)
flex:addButton():setFlexGrow(1)
flex:addButton():setFlexGrow(1)
```
The flexbox element adds the following properties to its children:
### Usage
```lua
flex:addButton():setFlexGrow(1) -- The flex-grow property defines the ability for a flex item to grow if necessary.
flex:addButton():setFlexShrink(1) -- The flex-shrink property defines the ability for a flex item to shrink if necessary.
flex:addButton():setFlexBasis(1) -- The flex-basis property defines the default size of an element before the remaining space is distributed.
```
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|flexDirection|string|"row"|The direction of the flexbox layout "row" or "column"
|flexSpacing|number|1|The spacing between flex items
|flexJustifyContent|string|"flex-start"|The alignment of flex items along the main axis
|flexWrap|boolean|false|Whether to wrap flex items onto multiple lines
|flexUpdateLayout|boolean|false|Whether to update the layout of the flexbox
## Functions
|Method|Returns|Description|
|---|---|---|
|[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|Initializes the Flexbox instance
|Flexbox:removeChild|Flexbox|Removes a child element from the flexbox
|Flexbox:render|-|Renders the flexbox and its children
## Flexbox:addChild(element)
Adds a child element to the flexbox
### Parameters
* `element` `Element` The child element to add
### Returns
* `Flexbox` `self` The flexbox instance
## Flexbox:addLineBreak(self)
Adds a new line break to the flexbox
### Parameters
* `self` `Flexbox` The element itself
### Returns
* `nil` `nil` nil

View File

@@ -1,21 +0,0 @@
# Frame : Container
This is the frame class. It serves as a grouping container for other elements.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|draggable|boolean|false|Whether the frame is draggable
|draggingMap|table|{}|The map of dragging positions
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Frame:init|Frame|Initializes the Frame instance
|Frame:mouse_click|boolean|Handles mouse click events
|Frame:mouse_drag|boolean|Handles mouse drag events
|Frame:mouse_up|boolean|Handles mouse release events

View File

@@ -1,121 +0,0 @@
# Graph : VisualElement
This is the base class for all graph elements. It is a point based graph.
### Usage
```lua
local graph = main:addGraph()
:addSeries("input", " ", colors.green, colors.green, 10)
:addSeries("output", " ", colors.red, colors.red, 10)
basalt.schedule(function()
while true do
graph:addPoint("input", math.random(1,100))
graph:addPoint("output", math.random(1,100))
sleep(2)
end
end)
```
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|minValue|number|0|The minimum value of the graph
|maxValue|number|100|The maximum value of the graph
|series|table|{}|The series of the graph
## Functions
|Method|Returns|Description|
|---|---|---|
|[Graph:addPoint](#graph-addpoint)|Graph|Adds a point to a series
|[Graph:addSeries](#graph-addseries)|Graph|Adds a series to the graph
|[Graph:changeSeriesVisibility](#graph-changeseriesvisibility)|Graph|Changes the visibility of a series
|[Graph:clear](#graph-clear)|Graph|Clears all points from a series
|[Graph:focusSeries](#graph-focusseries)|Graph|Focuses a series
|[Graph:getSeries](#graph-getseries)|table?|Gets a series from the graph
|[Graph:removeSeries](#graph-removeseries)|Graph|Removes a series from the graph
|[Graph:setSeriesPointCount](#graph-setseriespointcount)|Graph|Sets the point count of a series
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Graph:init|Graph|Initializes the Graph instance
|Graph:render|-|Renders the graph
## Graph:addPoint(name, value)
### Parameters
* `name` `string` The name of the series
* `value` `number` The value of the point
### Returns
* `Graph` `self` The graph instance
## Graph:addSeries(name, symbol, bgCol, fgCol, pointCount)
### Parameters
* `name` `string` The name of the series
* `symbol` `string` The symbol of the series
* `bgCol` `number` The background color of the series
* `fgCol` `number` The foreground color of the series
* `pointCount` `number` The number of points in the series
### Returns
* `Graph` `self` The graph instance
## Graph:changeSeriesVisibility(name, visible)
### Parameters
* `name` `string` The name of the series
* `visible` `boolean` Whether the series should be visible
### Returns
* `Graph` `self` The graph instance
## Graph:clear(name?)
Clears all points from a series
### Parameters
* `name` *(optional)* `string` The name of the series
### Returns
* `Graph` `self` The graph instance
## Graph:focusSeries(name)
### Parameters
* `name` `string` The name of the series
### Returns
* `Graph` `self` The graph instance
## Graph:getSeries(name)
### Parameters
* `name` `string` The name of the series
### Returns
* `table?` `series` The series
## Graph:removeSeries(name)
### Parameters
* `name` `string` The name of the series
### Returns
* `Graph` `self` The graph instance
## Graph:setSeriesPointCount(name, count)
### Parameters
* `name` `string` The name of the series
* `count` `number` The number of points in the series
### Returns
* `Graph` `self` The graph instance

View File

@@ -1,206 +0,0 @@
# Image : VisualElement
This is the Image element class which can be used to display bimg formatted images.
Bimg is a universal ComputerCraft image format.
See: https://github.com/SkyTheCodeMaster/bimg
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|bimg|table|{}|The bimg image data
|currentFrame|number|1|Current animation frame
|autoResize|boolean|false|Whether to automatically resize the image when content exceeds bounds
|offsetX|number|0|Horizontal offset for viewing larger images
|offsetY|number|0|Vertical offset for viewing larger images
## Combined Properties
|Name|Properties|Description|
|---|---|---|
|offset|`offsetX offsetY`|Combined property for offsetX and offsetY|
## Functions
|Method|Returns|Description|
|---|---|---|
|[Image:addFrame](#image-addframe)|Image|Adds a new frame to the image
|[Image:getBg](#image-getbg)|string|Gets the background color at the specified position
|[Image:getFg](#image-getfg)|string|Gets the foreground color at the specified position
|[Image:getFrame](#image-getframe)|table|Gets the specified frame
|[Image:getImageSize](#image-getimagesize)|number|Gets the size of the image
|[Image:getMetadata](#image-getmetadata)|table|Gets the metadata of the image
|[Image:getPixelData](#image-getpixeldata)|number?|Gets pixel information at position
|[Image:getText](#image-gettext)|string|Gets the text at the specified position
|[Image:nextFrame](#image-nextframe)|Image|Advances to the next frame in the animation
|[Image:resizeImage](#image-resizeimage)|Image|Resizes the image to the specified width and height
|[Image:setBg](#image-setbg)|Image|Sets the background color at the specified position
|[Image:setFg](#image-setfg)|Image|Sets the foreground color at the specified position
|[Image:setMetadata](#image-setmetadata)|Image|Sets the metadata of the image
|[Image:setPixel](#image-setpixel)|Image|Sets the pixel at the specified position
|[Image:setText](#image-settext)|Image|Sets the text at the specified position
|[Image:updateFrame](#image-updateframe)|Image|Updates the specified frame with the provided data
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Image:init|Image|Initializes the Image instance
|Image:render|-|Renders the Image
## Image:addFrame()
Adds a new frame to the image
### Returns
* `Image` `self` The Image instance
## Image:getBg(x, y, length)
Gets the background color at the specified position
### Parameters
* `x` `number` The x position
* `y` `number` The y position
* `length` `number` The length of the background color pattern to get
### Returns
* `string` `bg` The background color pattern
## Image:getFg(x, y, length)
Gets the foreground color at the specified position
### Parameters
* `x` `number` The x position
* `y` `number` The y position
* `length` `number` The length of the foreground color pattern to get
### Returns
* `string` `fg` The foreground color pattern
## Image:getFrame(frameIndex)
Gets the specified frame
### Parameters
* `frameIndex` `number` The index of the frame to get
### Returns
* `table` `frame` The frame data
## Image:getImageSize()
Gets the size of the image
### Returns
* `number` `width` The width of the image
* `number` `height` The height of the image
## Image:getMetadata()
Gets the metadata of the image
### Returns
* `table` `metadata` The metadata of the image
## Image:getPixelData(x, y)
Gets pixel information at position
### Parameters
* `x` `number` X position
* `y` `number` Y position
### Returns
* `number?` `fg` Foreground color
* `number?` `bg` Background color
* `string?` `char` Character at position
## Image:getText(x, y, length)
Gets the text at the specified position
### Parameters
* `x` `number` The x position
* `y` `number` The y position
* `length` `number` The length of the text to get
### Returns
* `string` `text` The text at the specified position
## Image:nextFrame()
Advances to the next frame in the animation
### Returns
* `Image` `self` The Image instance
## Image:resizeImage(width, height)
Resizes the image to the specified width and height
### Parameters
* `width` `number` The new width of the image
* `height` `number` The new height of the image
### Returns
* `Image` `self` The Image instance
## Image:setBg(x, y, pattern)
Sets the background color at the specified position
### Parameters
* `x` `number` The x position
* `y` `number` The y position
* `pattern` `string` The background color pattern
### Returns
* `Image` `self` The Image instance
## Image:setFg(x, y, pattern)
Sets the foreground color at the specified position
### Parameters
* `x` `number` The x position
* `y` `number` The y position
* `pattern` `string` The foreground color pattern
### Returns
* `Image` `self` The Image instance
## Image:setMetadata(key, value)
Sets the metadata of the image
### Parameters
* `key` `string` The key of the metadata to set
* `value` `string` The value of the metadata to set
### Returns
* `Image` `self` The Image instance
## Image:setPixel(x, y, char, fg, bg)
Sets the pixel at the specified position
### Parameters
* `x` `number` The x position
* `y` `number` The y position
* `char` `string` The character to set
* `fg` `string` The foreground color pattern
* `bg` `string` The background color pattern
### Returns
* `Image` `self` The Image instance
## Image:setText(x, y, text)
Sets the text at the specified position
### Parameters
* `x` `number` The x position
* `y` `number` The y position
* `text` `string` The text to set
### Returns
* `Image` `self` The Image instance
## Image:updateFrame(frameIndex, frame)
Updates the specified frame with the provided data
### Parameters
* `frameIndex` `number` The index of the frame to update
* `frame` `table` The new frame data
### Returns
* `Image` `self` The Image instance

View File

@@ -1,56 +0,0 @@
# Input : VisualElement
This is the input class. It provides a text input field that can handle user input with various features like
cursor movement, text manipulation, placeholder text, and input validation.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|text|string|-|The current text content of the input
|cursorPos|number|1|The current cursor position in the text
|viewOffset|number|0|The horizontal scroll offset for viewing long text
|maxLength|number?|nil|Maximum length of input text (optional)
|placeholder|string|...|Text to display when input is empty
|placeholderColor|color|gray|Color of the placeholder text
|focusedBackground|color|blue|Background color when input is focused
|focusedForeground|color|white|Foreground color when input is focused
|pattern|string?|nil|Regular expression pattern for input validation
|cursorColor|number|nil|Color of the cursor
|replaceChar|string|nil|Character to replace the input with (for password fields)
## Functions
|Method|Returns|Description|
|---|---|---|
|[Input:setCursor](#input-setcursor)|-|Sets the cursor position and color
|[Input:updateViewport](#input-updateviewport)|Input|Updates the input's viewport
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Input:blur|-|Handles a blur event
|Input:char|boolean|Handles char events
|Input:focus|-|Handles a focus event
|Input:init|Input|Initializes the Input instance
|Input:key|boolean|Handles key events
|Input:mouse_click|boolean|Handles mouse click events
|Input:render|-|Renders the input element
## Input:setCursor(x, y, blink, color)
Sets the cursor position and color
### Parameters
* `x` `number` The x position of the cursor
* `y` `number` The y position of the cursor
* `blink` `boolean` Whether the cursor should blink
* `color` `number` The color of the cursor
## Input:updateViewport()
Updates the input's viewport
### Returns
* `Input` `self` The updated instance

View File

@@ -1,32 +0,0 @@
# Label : VisualElement
This is the label class. It provides a simple text display element that automatically
resizes its width based on the text content.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|text|string|Label|The text content to display. Can be a string or a function that returns a string
|autoSize|boolean|true|Whether the label should automatically resize its width based on the text content
## Functions
|Method|Returns|Description|
|---|---|---|
|[Label:getWrappedText](#label-getwrappedtext)|table|Gets the wrapped lines of the Label
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Label:init|Label|Initializes the Label instance
|Label:render|-|Renders the Label by drawing its text content
## Label:getWrappedText()
Gets the wrapped lines of the Label
### Returns
* `table` `wrappedText` The wrapped lines of the Label

View File

@@ -1,28 +0,0 @@
# LineChart : Graph
The Line Chart element visualizes data series as connected line graphs. It plots points on a coordinate system and connects them with lines.
### Usage
```lua
local chart = main:addLineChart()
:addSeries("input", " ", colors.green, colors.green, 10)
:addSeries("output", " ", colors.red, colors.red, 10)
basalt.schedule(function()
while true do
chart:addPoint("input", math.random(1,100))
chart:addPoint("output", math.random(1,100))
sleep(2)
end
end)
```
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|LineChart:init|LineChart|Initializes the LineChart instance
|LineChart:render|-|Renders the LineChart

View File

@@ -1,128 +0,0 @@
# List : VisualElement
This is the list class. It provides a scrollable list of selectable items with support for
custom item rendering, separators, and selection handling.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|items|table|{}|List of items to display. Items can be tables with properties including selected state
|selectable|boolean|true|Whether items in the list can be selected
|multiSelection|boolean|false|Whether multiple items can be selected at once
|offset|number|0|Current scroll offset for viewing long lists
|selectedBackground|color|blue|Background color for selected items
|selectedForeground|color|white|Text color for selected items
## Events
|Event|Parameters|Description|
|---|---|---|
|onSelect|`index number, item table`|Fired when an item is selected|
## Functions
|Method|Returns|Description|
|---|---|---|
|[List:addItem](#list-additem)|List|Adds an item to the list
|[List:clear](#list-clear)|List|Clears all items from the list
|[List:getSelectedItem](#list-getselecteditem)|table?|Gets first selected item
|[List:getSelectedItems](#list-getselecteditems)|table|Gets the currently selected items
|[List:onSelect](#list-onselect)|List|Registers a callback for the select event
|[List:removeItem](#list-removeitem)|List|Removes an item from the list
|[List:scrollToBottom](#list-scrolltobottom)|List|Scrolls the list to the bottom
|[List:scrollToTop](#list-scrolltotop)|List|Scrolls the list to the top
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|List:init|List|Initializes the List instance
|List:mouse_click|boolean|Handles mouse click events
|List:mouse_scroll|boolean|Handles mouse scroll events
|List:render|-|Renders the list
## List:addItem(text)
Adds an item to the list
### Parameters
* `text` `string|table` The item to add (string or item table)
### Returns
* `List` `self` The List instance
### Usage
```lua
list:addItem("New Item")
list:addItem({text="Item", callback=function() end})
```
## List:clear()
Clears all items from the list
### Returns
* `List` `self` The List instance
### Usage
```lua
list:clear()
```
## List:getSelectedItem()
Gets first selected item
### Returns
* `table?` `selected` The first item
## List:getSelectedItems()
Gets the currently selected items
### Returns
* `table` `selected` List of selected items
### Usage
```lua
local selected = list:getSelectedItems()
```
## List:onSelect(callback)
Registers a callback for the select event
### Parameters
* `callback` `function` The callback function to register
### Returns
* `List` `self` The List instance
### Usage
```lua
list:onSelect(function(index, item) print("Selected item:", index, item) end)
```
## List:removeItem(index)
Removes an item from the list
### Parameters
* `index` `number` The index of the item to remove
### Returns
* `List` `self` The List instance
### Usage
```lua
list:removeItem(1)
```
## List:scrollToBottom()
Scrolls the list to the bottom
### Returns
* `List` `self` The List instance
## List:scrollToTop()
Scrolls the list to the top
### Returns
* `List` `self` The List instance

View File

@@ -1,40 +0,0 @@
# Menu : List
This is the menu class. It provides a horizontal menu bar with selectable items.
Menu items are displayed in a single row and can have custom colors and callbacks.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|separatorColor|color|gray|The color used for separator items in the menu
## Functions
|Method|Returns|Description|
|---|---|---|
|[Menu:setItems](#menu-setitems)|Menu|Sets the menu items and calculates total width
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Menu:init|Menu|Initializes the Menu instance
|Menu:mouse_click|boolean|Handles mouse click events and item selection
|Menu:render|-|Renders the menu horizontally with proper spacing and colors
## Menu:setItems(items)
Sets the menu items
### Parameters
* `items` `table[]` List of items with {text, separator, callback, foreground, background} properties
### Returns
* `Menu` `self` The Menu instance
### Usage
```lua
menu:setItems({{text="File"}, {separator=true}, {text="Edit"}})
```

View File

@@ -1,37 +0,0 @@
# Program : VisualElement
This is the program class. It provides a program that runs in a window.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|program|table|nil|The program instance
|path|string|""|The path to the program
|running|boolean|false|Whether the program is running
## Functions
|Method|Returns|Description|
|---|---|---|
|[Program:execute](#program-execute)|Program|Executes a program
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Program:dispatchEvent|any|Handles all incomming events
|Program:focus|-|Gets called when the element gets focused
|Program:init|Program|Initializes the Program instance
|Program:render|-|Renders the program
## Program:execute(path)
Executes a program
### Parameters
* `path` `string` The path to the program
### Returns
* `Program` `self` The Program instance

View File

@@ -1,30 +0,0 @@
# ProgressBar : VisualElement
This is the progress bar class. It provides a visual representation of progress
with optional percentage display and customizable colors.
### Usage
```lua
local progressBar = main:addProgressBar()
progressBar:setDirection("up")
progressBar:setProgress(50)
```
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|progress|number|0|Current progress value (0-100)
|showPercentage|boolean|false|Whether to show the percentage text in the center
|progressColor|color|lime|The color used for the filled portion of the progress bar
|direction|string|right|The direction of the progress bar ("up", "down", "left", "right")
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|ProgressBar:init|ProgressBar|Initializes the ProgressBar instance
|ProgressBar:render|-|Renders the progress bar with filled portion and optional percentage text

View File

@@ -1,58 +0,0 @@
# Scrollbar : VisualElement
A scrollbar element that can be attached to other elements to control their scroll properties
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|value|number|0|Current scroll value
|min|number|0|Minimum scroll value
|max|number|100|Maximum scroll value
|step|number|1|Step size for scroll operations
|dragMultiplier|number|1|How fast the scrollbar moves when dragging
|symbol|string|"|" Symbol used for the scrollbar handle
|backgroundSymbol|string|"\127"|Symbol used for the scrollbar background
|symbolBackgroundColor|color|black|Background color of the scrollbar handle
|backgroundSymbol|string|"\127"|Symbol used for the scrollbar background
|attachedElement|table?|nil|The element this scrollbar is attached to
|attachedProperty|string?|nil|The property being controlled
|minValue|number|function|0|Minimum value or function that returns it
|maxValue|number|function|100|Maximum value or function that returns it
|orientation|string|vertical|Orientation of the scrollbar ("vertical" or "horizontal")
|handleSize|number|2|Size of the scrollbar handle in characters
## Functions
|Method|Returns|Description|
|---|---|---|
|[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|Initializes the Scrollbar instance
|Scrollbar:mouse_click|boolean|Handles mouse click events
|Scrollbar:mouse_drag|boolean|Handles mouse drag events
|Scrollbar:mouse_scroll|boolean|Handles mouse scroll events
|Scrollbar:render|-|Renders the scrollbar
## Scrollbar:attach(element, config)
Attaches the scrollbar to an element's property
### Parameters
* `element` `BaseElement` The element to attach to
* `config` `table` Configuration {property = "propertyName", min = number|function, max = number|function}
### Returns
* `Scrollbar` `self` The scrollbar instance
## Scrollbar:updateAttachedElement()
Updates the attached element's property based on the scrollbar value
### Returns
* `Scrollbar` `self` The scrollbar instance

View File

@@ -1,48 +0,0 @@
# Slider : VisualElement
This is the slider class. It provides a draggable slider control that can be either horizontal or vertical,
with customizable colors and value ranges.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|step|number|1|Current position of the slider handle (1 to width/height)
|max|number|100|Maximum value for value conversion (maps slider position to this range)
|horizontal|boolean|true|Whether the slider is horizontal (false for vertical)
|barColor|color|gray|Color of the slider track
|sliderColor|color|blue|Color of the slider handle
## Events
|Event|Parameters|Description|
|---|---|---|
|onChange|`value number`|Fired when the slider value changes|
## Functions
|Method|Returns|Description|
|---|---|---|
|[Slider:getValue](#slider-getvalue)|number|Gets the current value mapped to the max range
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Slider:init|Slider|Initializes the Slider instance
|Slider:mouse_click|boolean|Updates slider position on mouse click
|Slider:mouse_scroll|boolean|Handles mouse release events
|Slider:render|-|Renders the slider with track and handle
## Slider:getValue()
Gets the current value of the slider
### Returns
* `number` `value` The current value (0 to max)
### Usage
```lua
local value = slider:getValue()
```

View File

@@ -1,18 +0,0 @@
# Switch : VisualElement
The Switch is a standard Switch element with click handling and state management.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|checked|boolean|Whether|switch is checked
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Switch:init|-|Initializes the Switch instance
|Switch:render|-|Renders the Switch

View File

View File

@@ -1,53 +0,0 @@
# Table : VisualElement
This is the table class. It provides a sortable data grid with customizable columns,
row selection, and scrolling capabilities.
### Usage
```lua
local people = container:addTable():setWidth(40)
people:setColumns({{name="Name",width=12}, {name="Age",width=10}, {name="Country",width=15}})
people:setData({{"Alice", 30, "USA"}, {"Bob", 25, "UK"}})
```
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|columns|table|{}|List of column definitions with {name, width} properties
|data|table|{}|The table data as array of row arrays
|selectedRow|number?|nil|Currently selected row index
|headerColor|color|blue|Color of the column headers
|selectedColor|color|lightBlue|Background color of selected row
|gridColor|color|gray|Color of grid lines
|sortColumn|number?|nil|Currently sorted column index
|sortDirection|string|"asc"|Sort direction ("asc" or "desc")
|scrollOffset|number|0|Current scroll position
## Functions
|Method|Returns|Description|
|---|---|---|
|[Table:sortData](#table-sortdata)|Table|Sorts the table data by the specified column
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Table:init|Table|Initializes the Table instance
|Table:mouse_click|boolean|Handles header clicks for sorting and row selection
|Table:mouse_scroll|boolean|Handles scrolling through the table data
|Table:render|-|Renders the table with headers, data and scrollbar
## Table:sortData(columnIndex, fn)
Sorts the table data by column
### Parameters
* `columnIndex` `number` The index of the column to sort by
* `fn` `function?` Optional custom sorting function
### Returns
* `Table` `self` The Table instance

View File

@@ -1,69 +0,0 @@
# TextBox : VisualElement
A multi-line text editor component with cursor support and text manipulation features
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|lines|table|{}|Array of text lines
|cursorX|number|1|Cursor X position
|cursorY|number|1|Cursor Y position (line number)
|scrollX|number|0|Horizontal scroll offset
|scrollY|number|0|Vertical scroll offset
|editable|boolean|true|Whether text can be edited
|syntaxPatterns|table|{}|Syntax highlighting patterns
|cursorColor|number|nil|Color of the cursor
## Functions
|Method|Returns|Description|
|---|---|---|
|[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|boolean|Handles character input
|TextBox:init|TextBox|Initializes the TextBox instance
|TextBox:key|boolean|Handles key events
|TextBox:mouse_click|boolean|Handles mouse click events
|TextBox:mouse_scroll|boolean|Handles mouse scroll events
|TextBox:render|-|Renders the TextBox with syntax highlighting
## TextBox:addSyntaxPattern(pattern, color)
Adds a new syntax highlighting pattern
### Parameters
* `pattern` `string` The regex pattern to match
* `color` `colors` The color to apply
### Returns
* `TextBox` `self` The TextBox instance
## TextBox:getText()
Gets the text of the TextBox
### Returns
* `string` `text` The text of the TextBox
## TextBox:setText(text)
Sets the text of the TextBox
### Parameters
* `text` `string` The text to set
### Returns
* `TextBox` `self` The TextBox instance
## TextBox:updateViewport()
Updates the viewport to keep the cursor in view
### Returns
* `TextBox` `self` The TextBox instance

View File

View File

@@ -1,80 +0,0 @@
# Tree : VisualElement
This is the tree class. It provides a hierarchical view of nodes that can be expanded and collapsed,
with support for selection and scrolling.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|nodes|table|{}|The tree structure containing node objects with {text, children} properties
|selectedNode|table?|nil|Currently selected node
|expandedNodes|table|{}|Table of nodes that are currently expanded
|scrollOffset|number|0|Current vertical scroll position
|horizontalOffset|number|0|Current horizontal scroll position
|nodeColor|color|white|Color of unselected nodes
|selectedColor|color|lightBlue|Background color of selected node
## Functions
|Method|Returns|Description|
|---|---|---|
|[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:onSelect](#tree-onselect)|Tree|Registers a callback for when a node is selected
|[Tree:toggleNode](#tree-togglenode)|Tree|Toggles between expanded and collapsed state
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|Tree:init|Tree|Initializes the Tree instance
|Tree:mouse_click|boolean|Handles mouse click events for node selection and expansion
|Tree:mouse_scroll|boolean|Handles mouse scroll events for vertical scrolling
|Tree:render|-|Renders the tree with nodes, selection and scrolling
## Tree:collapseNode(node)
Collapses a node
### Parameters
* `node` `table` The node to collapse
### Returns
* `Tree` `self` The Tree instance
## Tree:expandNode(node)
Expands a node
### Parameters
* `node` `table` The node to expand
### Returns
* `Tree` `self` The Tree instance
## Tree:getNodeSize()
Gets the size of the tree
### Returns
* `number` `width` The width of the tree
* `number` `height` The height of the tree
## Tree:onSelect(callback)
Registers a callback for when a node is selected
### Parameters
* `callback` `function` The callback function
### Returns
* `Tree` `self` The Tree instance
## Tree:toggleNode(node)
Toggles a node's expanded state
### Parameters
* `node` `table` The node to toggle
### Returns
* `Tree` `self` The Tree instance

View File

@@ -1,137 +0,0 @@
# VisualElement : BaseElement
This is the visual element class. It serves as the base class for all visual UI elements
and provides core functionality for positioning, sizing, colors, and rendering.
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|x|number|1|The horizontal position relative to parent
|y|number|1|The vertical position relative to parent
|z|number|1|The z-index for layering elements
|width|number|1|The width of the element
|height|number|1|The height of the element
|background|color|black|The background color
|foreground|color|white|The text/foreground color
|clicked|boolean|false|Whether the element is currently clicked
|hover|boolean|false|Whether the mouse is currently hover over the element (Craftos-PC only)
|backgroundEnabled|boolean|true|Whether to render the background
|focused|boolean|false|Whether the element has input focus
|visible|boolean|true|Whether the element is visible
|ignoreOffset|boolean|false|Whether to ignore the parent's offset
## Combined Properties
|Name|Properties|Description|
|---|---|---|
|position|`x number, y number`|Combined x, y position|
|size|`width number, height number`|Combined width, height|
|color|`foreground number, background number`|Combined foreground, background colors|
## Events
|Event|Parameters|Description|
|---|---|---|
|onClick|`button string, x number, y number`|Fired on mouse click|
|onMouseUp|`button, x, y`|Fired on mouse button release|
|onRelease|`button, x, y`|Fired when mouse leaves while clicked|
|onDrag|`button, x, y`|Fired when mouse moves while clicked|
|onScroll|`direction, x, y`|Fired on mouse scroll|
|onEnter|`-`|Fired when mouse enters element|
|onLeave|`-`|Fired when mouse leaves element|
|onFocus|`-`|Fired when element receives focus|
|onBlur|`-`|Fired when element loses focus|
|onKey|`key`|Fired on key press|
|onKeyUp|`key`|Fired on key release|
|onChar|`char`|Fired on character input|
## Functions
|Method|Returns|Description|
|---|---|---|
|[VisualElement:calculatePosition](#visualelement-calculateposition)|number|Calculates the position of the element
|[VisualElement:drawBg](#visualelement-drawbg)|-|
|[VisualElement:drawFg](#visualelement-drawfg)|-|
|[VisualElement:drawText](#visualelement-drawtext)|-|
|[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
|[VisualElement:prioritize](#visualelement-prioritize)|VisualElement|Prioritizes the element by moving it to the top of its parent's children
## Protected Functions
|Method|Returns|Description|
|---|---|---|
|VisualElement:blit|-|Draws text with both colors
|VisualElement:blur|-|Handles a blur event
|VisualElement:char|-|Handles a character event
|VisualElement:focus|-|Handles a focus event
|VisualElement:init|-|Initializes a new visual element with properties
|VisualElement:key|-|Handles a key event
|VisualElement:key_up|-|Handles a key up event
|VisualElement:mouse_click|boolean|Handles a mouse click event
|VisualElement:mouse_drag|boolean|Handles a mouse drag event
|VisualElement:mouse_move|boolean|Handles a mouse move event
|VisualElement:mouse_release|-|Handles a mouse release event
|VisualElement:mouse_scroll|boolean|Handles a mouse scroll event
|VisualElement:mouse_up|boolean|Handles a mouse up event
|VisualElement:multiBlit|-|Multi-character drawing with colors
|VisualElement:postRender|-|Post-rendering function for the element
|VisualElement:render|-|Renders the element
|VisualElement:setCursor|VisualElement|Sets the cursor position
|VisualElement:textBg|-|Draws text with background color
|VisualElement:textFg|-|Draws text with foreground color
## VisualElement:calculatePosition()
Calculates the position of the element relative to its parent
### Returns
* `number` `x` The x position
* `number` `y` The y position
## VisualElement:drawBg()
## VisualElement:drawFg()
## VisualElement:drawText()
## VisualElement:getAbsolutePosition(x?, y?)
Returns the absolute position of the element or the given coordinates.
### Parameters
* `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.
### Parameters
* `x` *(optional)* `number` x position
* `y` *(optional)* `number` y position
### Returns
* `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
### Parameters
* `x` `number` The x position to check
* `y` `number` The y position to check
### Returns
* `boolean` `isInBounds` Whether the coordinates are within the bounds of the element
## VisualElement:prioritize()
This function is used to prioritize the element by moving it to the top of its parent's children. It removes the element from its parent and adds it back, effectively changing its order.
### Returns
* `VisualElement` `self` The VisualElement instance