You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/elements/BarChart.lua
+10-5Lines changed: 10 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -3,13 +3,17 @@ local VisualElement = elementManager.getElement("VisualElement")
3
3
localBaseGraph=elementManager.getElement("Graph")
4
4
localtHex=require("libraries/colorHex")
5
5
--- @configDescription A bar chart element based on the graph element.
6
-
---@configDefault false
6
+
---@configDefault false
7
7
8
-
--- 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.
8
+
--- A data visualization element that represents numeric data through vertical bars. Each bar's height corresponds to its value, making it ideal for comparing quantities across categories or showing data changes over time. Supports multiple data series with customizable colors and styles.
Copy file name to clipboardExpand all lines: src/elements/BaseElement.lua
+25-25Lines changed: 25 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -3,12 +3,12 @@ local uuid = require("libraries/utils").uuid
3
3
localerrorManager=require("errorManager")
4
4
---@configDescription The base class for all UI elements in Basalt.
5
5
6
-
--- The base class for all UI elements in Basalt. This class provides basic properties and event handling functionality.
6
+
--- The fundamental base class for all UI elements in Basalt. It implements core functionality like event handling, property management, lifecycle hooks, and the observer pattern. Every UI component inherits from this class to ensure consistent behavior and interface.
7
7
--- @classBaseElement:PropertySystem
8
8
localBaseElement=setmetatable({}, PropertySystem)
9
9
BaseElement.__index=BaseElement
10
10
11
-
--- @property type string BaseElement The type identifier of the element
11
+
--- @property type string BaseElement A hierarchical identifier of the element's type chain
Copy file name to clipboardExpand all lines: src/elements/BaseFrame.lua
+12-3Lines changed: 12 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ local Render = require("render")
5
5
---@configDescription This is the base frame class. It is the root element of all elements and the only element without a parent.
6
6
7
7
8
-
--- This is the base frame class. It is the root element of all elements and the only element without a parent.
8
+
--- This is the root frame class that serves as the foundation for the UI hierarchy. It manages the rendering context and acts as the top-level container for all other elements. Unlike other elements, it renders directly to a terminal or monitor and does not require a parent element.
9
9
---@classBaseFrame:Container
10
10
---@field_renderRender The render object
11
11
---@field_renderUpdateboolean Whether the render object needs to be updated
@@ -110,22 +110,31 @@ function BaseFrame:textBg(x, y, text, bg)
110
110
self._render:textBg(x, y, text, bg)
111
111
end
112
112
113
-
--- @shortDescription Renders a text with a background color to the render Object
113
+
--- @shortDescription Draws plain text to the render Object
114
114
--- @paramxnumber The x position to render to
115
115
--- @paramynumber The y position to render to
116
116
--- @paramtextstring The text to render
117
-
--- @parambgcolors The background color
118
117
--- @protected
119
118
functionBaseFrame:drawText(x, y, text)
120
119
ifx<1thentext=string.sub(text, 1-x); x=1end
121
120
self._render:text(x, y, text)
122
121
end
123
122
123
+
--- @shortDescription Draws a foreground color to the render Object
124
+
--- @paramxnumber The x position to render to
125
+
--- @paramynumber The y position to render to
126
+
--- @paramfgcolors The foreground color
127
+
--- @protected
124
128
functionBaseFrame:drawFg(x, y, fg)
125
129
ifx<1thenfg=string.sub(fg, 1-x); x=1end
126
130
self._render:fg(x, y, fg)
127
131
end
128
132
133
+
--- @shortDescription Draws a background color to the render Object
Copy file name to clipboardExpand all lines: src/elements/BigFont.lua
+20-8Lines changed: 20 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -145,22 +145,34 @@ local VisualElement = elementManager.getElement("VisualElement")
145
145
---@cofnigDescription The BigFont is a text element that displays large text.
146
146
---@configDefault false
147
147
148
-
--- 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.
149
-
--- @run local basalt = require("basalt")
150
-
--- @run local main = basalt.getMainFrame()
151
-
--- @run local font = main:addBigFont()
152
-
--- @run font:setText("Hello World!")
153
-
--- @run basalt.run()
148
+
--- A specialized text element that renders characters in larger sizes using Wojbie's BigFont API. Supports multiple font sizes and custom colors while maintaining the pixel-art style of ComputerCraft. Ideal for headers, titles, and emphasis text.
149
+
--- @usage -- Create a large welcome message
150
+
--- @usage local main = basalt.getMainFrame()
151
+
--- @usage local title = main:addBigFont()
152
+
--- @usage :setPosition(3, 3)
153
+
--- @usage :setFontSize(2) -- Makes text twice as large
154
+
--- @usage :setText("Welcome!")
155
+
--- @usage :setForeground(colors.yellow) -- Make text yellow
156
+
--- @usage
157
+
--- @usage -- For animated text
158
+
--- @usage basalt.schedule(function()
159
+
--- @usage while true do
160
+
--- @usage title:setForeground(colors.yellow)
161
+
--- @usage sleep(0.5)
162
+
--- @usage title:setForeground(colors.orange)
163
+
--- @usage sleep(0.5)
164
+
--- @usage end
165
+
--- @usage end)
154
166
---@classBigFont:VisualElement
155
167
localBigFont=setmetatable({}, VisualElement)
156
168
BigFont.__index=BigFont
157
169
158
-
---@property text string BigFont BigFont text
170
+
---@property text string BigFont The text string to display in enlarged format
---@cofnigDescription The Button is a standard button element with click handling and state management.
4
+
---@configDescription The Button is a standard button element with click handling and state management.
5
5
6
-
--- The Button is a standard button element with click handling and state management.
6
+
--- A clickable interface element that triggers actions when pressed. Supports text labels, custom styling, and automatic text centering. Commonly used for user interactions and form submissions.
---@cofnigDescription This is a checkbox. It is a visual element that can be checked.
2
+
---@configDescription This is a checkbox. It is a visual element that can be checked.
3
3
4
-
--- The CheckBox is a visual element that can be checked.
5
-
---@classCheckBox:VisualElement
4
+
--- A toggleable UI element that can be checked or unchecked. Displays different text based on its state and supports automatic sizing. Commonly used in forms and settings interfaces for boolean options.
0 commit comments