Update links

This commit is contained in:
Robert Jelic
2025-02-18 09:49:37 +01:00
parent 3abd20a509
commit 8d9460e22f
17 changed files with 27 additions and 404 deletions

View File

@@ -63,12 +63,11 @@ export default defineConfig({
],
'/references/':[
'/references/':[
{
text: 'Core', link: 'references/main',
collapsed: false,
text: 'Basalt', link: 'references/main',
collapsed: true,
items: [
{text: 'Basalt', link: 'references/main'},
{text: 'PropertySystem', link: 'references/propertySystem'},
{text: 'Render', link: 'references/render'},
{text: 'Log', link: 'references/log'},
@@ -77,10 +76,9 @@ export default defineConfig({
],
},
{
text: 'elements', link: 'references/elements/BaseElement',
text: 'Element', link: 'references/elements/BaseElement',
collapsed: false,
items: [
{text: 'Element', link: 'references/elements/BaseElement', collapsed: false, items: [
{text: 'VisualElement', link: 'references/elements/VisualElement', collapsed: false, items: [
{text: 'Container', link: 'references/elements/Container', collapsed: true, items: [
{text: 'BaseFrame', link: 'references/elements/BaseFrame'},
@@ -90,17 +88,36 @@ export default defineConfig({
{text: 'Label', link: 'references/elements/Label'},
{text: 'Input', link: 'references/elements/Input'},
{text: 'Checkbox', link: 'references/elements/Checkbox'},
{text: 'List', link: 'references/elements/List', collapsed: true},
{text: 'List', link: 'references/elements/List', collapsed: true,
items: [
{text: 'Dropdown', link: 'references/elements/Dropdown'},
{text: 'Menu', link: 'references/elements/Menu'},
{text: 'Table', link: 'references/elements/Table'},
{text: 'Tree', link: 'references/elements/Tree'},
]
},
{text: 'Slider', link: 'references/elements/Slider'},
{text: 'ProgressBar', link: 'references/elements/ProgressBar'},
{text: 'Program', link: 'references/elements/Program'},
]},
]}
]
},
{
text: 'plugins', link: 'references/plugins/animations',
collapsed: false,
items: [
{text: 'Animations', link: 'references/plugins/animation'},
{text: 'Benchmark', link: 'references/plugins/benchmark'},
{text: 'Animations', link: 'references/plugins/Animation', collapsed: true,
items: [
{text: 'Animation Instance', link: 'references/plugins/Animation_AnimationInstance'},
{text: 'VisualElement', link: 'references/plugins/Animation_VisualElement'},
]
},
{text: 'Benchmark', link: 'references/plugins/benchmark', collapsed: true,
items: [
{text: 'BaseElement', link: 'references/plugins/benchmark_BaseElement'},
{text: 'Container', link: 'references/plugins/benchmark_Container'},
]
},
{text: 'Debug', link: 'references/plugins/debug'},
{text: 'Reactive', link: 'references/plugins/reactive'},
{text: 'State', link: 'references/plugins/state'},

View File

@@ -1,112 +0,0 @@
# BaseElement
The base class for all UI elements in Basalt
## Properties
|Property|Type|Default|Description|
|---|---|---|---|
|type|string|BaseElement|The type identifier of the element
|eventCallbacks|table|{}|Table containing all registered event callbacks
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseElement.listenTo](#BaseElement.listenTo)|-|
|[BaseElement.new](#BaseElement.new)|table|
|[BaseElement:fireEvent](#BaseElement:fireEvent)|table|
|[BaseElement:init](#BaseElement:init)|table|
|[BaseElement:listenEvent](#BaseElement:listenEvent)|table|
|[BaseElement:registerCallback](#BaseElement:registerCallback)|table|
|[BaseElement:updateRender](#BaseElement:updateRender)|-|
## BaseElement.listenTo(class, eventName)
Registers an event that this class can listen to
### Parameters
* `class` `table` The class to add the event to
* `eventName` `string` The name of the event to register
### Usage
```lua
BaseElement.listenTo(MyClass, "mouse_click")
```
## BaseElement.new(id, basalt)
Creates a new BaseElement instance
### Parameters
* `id` `string` The unique identifier for this element
* `basalt` `table` The basalt instance
### Returns
* `table` `The` newly created BaseElement instance
### Usage
```lua
local element = BaseElement.new("myId", basalt)
```
## 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
### Usage
```lua
element:fireEvent("mouse_click", 1, 2)
```
## BaseElement:init(id, basalt)
Initializes the BaseElement instance
### Parameters
* `id` `string` The unique identifier for this element
* `basalt` `table` The basalt instance
### Returns
* `table` `self` The initialized instance
## 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
### Usage
```lua
element:listenEvent("mouse_click", true)
```
## 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
### Usage
```lua
element:registerCallback("mouse_click", function(self, ...) end)
```
## BaseElement:updateRender()
Requests a render update for this element
### Usage
```lua
element:updateRender()
```

View File

@@ -1,10 +0,0 @@
## BaseFrame.new()
@diagnostic disable-next-line: duplicate-set-field
## BaseFrame:multiBlit()
## BaseFrame:render()
@diagnostic disable-next-line: duplicate-set-field
## BaseFrame:textFg()

View File

@@ -1,6 +0,0 @@
## Button.new()
@diagnostic disable-next-line: duplicate-set-field
## Button:render()
@diagnostic disable-next-line: duplicate-set-field

View File

@@ -1,28 +0,0 @@
## Container.new()
@diagnostic disable-next-line: duplicate-set-field
## Container:addChild()
## Container:handleEvent()
## Container:multiBlit()
## Container:registerChildEvent()
## Container:registerChildrenEvents()
## Container:removeChild()
## Container:removeChildrenEvents()
## Container:render()
@diagnostic disable-next-line: duplicate-set-field
## Container:sortChildren()
## Container:sortChildrenEvents()
## Container:textFg()
## Container:unregisterChildEvent()

View File

@@ -1,3 +0,0 @@
## Frame.new()
@diagnostic disable-next-line: duplicate-set-field

View File

@@ -1,37 +0,0 @@
## VisualElement.new()
@diagnostic disable-next-line: duplicate-set-field
## 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
## 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
* `nil` `nil` nil
## VisualElement:handleEvent()
## VisualElement:isInBounds()
## VisualElement:mouse_click()
## VisualElement:mouse_release()
## VisualElement:mouse_up()
## VisualElement:multiBlit()
## VisualElement:render()
@diagnostic disable-next-line: duplicate-set-field
## VisualElement:textFg()

View File

@@ -1,14 +0,0 @@
## ElementManager.extendMethod()
## ElementManager.generateId()
## ElementManager.getElement()
## ElementManager.getElementList()
## ElementManager.loadElement()
## ElementManager.loadPlugin()
## ElementManager.registerPlugin()

View File

@@ -1,2 +0,0 @@
## errorHandler.error()

View File

@@ -1 +0,0 @@
Simple type checking without stack traces

View File

@@ -1 +0,0 @@
Use xpcall with error handler

View File

@@ -1,7 +0,0 @@
Log levels
## Log.error()
## Log.setEnabled()
## Log.setLogToFile()

View File

@@ -1,139 +0,0 @@
# Basalt
This is the UI Manager and the starting point for your project. The following functions allow you to influence the default behavior of Basalt.
Before you can access Basalt, you need to add the following code on top of your file:
### Usage
```lua
local basalt = require("basalt")
```
What this code does is it loads basalt into the project, and you can access it by using the variable defined as "basalt".
## Functions
|Method|Returns|Description|
|---|---|---|
|[basalt.create](#basalt.create)|table|Creates a new UI element
|[basalt.createFrame](#basalt.createFrame)|table|
|[basalt.getElementManager](#basalt.getElementManager)|table|
|[basalt.getMainFrame](#basalt.getMainFrame)|BaseFrame|
|[basalt.removeSchedule](#basalt.removeSchedule)|-|
|[basalt.run](#basalt.run)|-|
|[basalt.scheduleUpdate](#basalt.scheduleUpdate)|number|
|[basalt.setActiveFrame](#basalt.setActiveFrame)|-|
|[basalt.stop](#basalt.stop)|-|
|[basalt.update](#basalt.update)|-|
## basalt.create(type, id?)
Creates and returns a new UI element of the specified type.
### Parameters
* `type` `string` The type of element to create (e.g. "Button", "Label", "BaseFrame")
* `id` *(optional)* `string` Optional unique identifier for the element
### Returns
* `table` `element` The created element instance
### Usage
```lua
local button = basalt.create("Button")
```
## basalt.createFrame()
Creates and returns a new frame
### Returns
* `table` `BaseFrame` The created frame instance
### Usage
```lua
local mainFrame = basalt.createFrame()
```
## basalt.getElementManager()
Returns the element manager instance
### Returns
* `table` `ElementManager` The element manager
### Usage
```lua
local manager = basalt.getElementManager()
```
## basalt.getMainFrame()
Gets or creates the main frame
### Returns
* `BaseFrame` `table` The main frame instance
### Usage
```lua
local frame = basalt.getMainFrame()
```
## basalt.removeSchedule(id)
Removes a scheduled update
### Parameters
* `id` `number` The schedule ID to remove
### Usage
```lua
basalt.removeSchedule(scheduleId)
```
## basalt.run(isActive)
Starts the Basalt runtime
### Parameters
* `isActive` `boolean` Whether to start active (default: true)
### Usage
```lua
basalt.run()
basalt.run(false)
```
## basalt.scheduleUpdate(func)
Schedules a function to be updated
### Parameters
* `func` `function` The function to schedule
### Returns
* `number` `Id` The schedule ID
### Usage
```lua
local id = basalt.scheduleUpdate(myFunction)
```
## basalt.setActiveFrame(frame)
Sets the active frame
### Parameters
* `frame` `table` The frame to set as active
### Usage
```lua
basalt.setActiveFrame(myFrame)
```
## basalt.stop()
Stops the Basalt runtime
### Usage
```lua
basalt.stop()
```
## basalt.update()
Updates all scheduled functions
### Usage
```lua
basalt.update()
```

View File

@@ -1,8 +0,0 @@
## PropertySystem.defineProperty()
## PropertySystem:__init()
## PropertySystem:_updateProperty()
## PropertySystem:observe()

View File

@@ -1,22 +0,0 @@
## Render.new()
## Render:bg()
## Render:blit()
## Render:clear()
## Render:clearArea()
## Render:fg()
## Render:getSize()
## Render:multiBlit()
## Render:render()
## Render:text()
## Render:textFg()

View File

@@ -1,4 +0,0 @@
## utils.deepCopy()
## utils.getCenteredPosition()