This commit is contained in:
NoryiE
2025-09-13 20:28:52 +00:00
parent 9e1112f3bd
commit 4ccefcac9f
48 changed files with 3036 additions and 1565 deletions

View File

@@ -0,0 +1,185 @@
# AnimationInstance
_This is the AnimationInstance class. It represents a single animation instance_
## Functions
|Method|Returns|Description|
|---|---|---|
|[AnimationInstance.new](#animationinstance-new-element-animtype-args-duration-easing)|AnimationInstance|Creates a new animation instance|
|[AnimationInstance:start](#animationinstance-start)|AnimationInstance|Starts the animation|
|[AnimationInstance:update](#animationinstance-update-elapsed)|boolean|Updates the animation|
|[AnimationInstance:complete](#animationinstance-complete)|-|Called when the animation is completed|
## AnimationInstance.new(element, animType, args, duration, easing)
Creates a new AnimationInstance
### Parameters
* `element` `VisualElement` The element to animate
* `animType` `string` The type of animation
* `args` `table` The animation arguments
* `duration` `number` Duration in seconds
* `easing` `string` The easing function name
### Returns
* `AnimationInstance` `The` new animation instance
## AnimationInstance:start()
Starts the animation
### Returns
* `AnimationInstance` `self` The animation instance
## AnimationInstance:update(elapsed)
Updates the animation
### Parameters
* `elapsed` `number` The elapsed time in seconds
### Returns
* `boolean` `Whether` the animation is finished
## AnimationInstance:complete()
Gets called when the animation is completed
# Animation
_This is the animation plugin. It provides a animation system for visual elements
with support for sequences, easing functions, and multiple animation types._
## Functions
|Method|Returns|Description|
|---|---|---|
|[Animation.registerAnimation](#animation-registeranimation-name-handlers)|-|Registers a custom animation type|
|[Animation.registerEasing](#animation-registereasing-name-func)|-|Adds a custom easing function|
|[Animation.new](#animation-new-element)|Animation|Creates a new animation|
|[Animation:sequence](#animation-sequence)|Animation|Creates a new sequence|
|[Animation:onStart](#animation-onstart-callback)|-|Registers a callback for the start event|
|[Animation:onUpdate](#animation-onupdate-callback)|Animation|Registers a callback for the update event|
|[Animation:onComplete](#animation-oncomplete-callback)|Animation|Registers a callback for the complete event|
|[Animation:addAnimation](#animation-addanimation-type-args-duration-easing)|-|Adds a new animation to the sequence|
|[Animation:start](#animation-start)|Animation|Starts the animation|
|[Animation:event](#animation-event-event-timerid)|-|The event handler for the animation|
|[Animation:stop](#animation-stop)|-|Stops the animation|
## Animation.registerAnimation(name, handlers)
Registers a new animation type
### Parameters
* `name` `string` The name of the animation
* `handlers` `table` Table containing start, update and complete handlers
### Usage
```lua
Animation.registerAnimation("fade", {start=function(anim) end, update=function(anim,progress) end})
```
## Animation.registerEasing(name, func)
Registers a new easing function
### Parameters
* `name` `string` The name of the easing function
* `func` `function` The easing function (takes progress 0-1, returns modified progress)
## Animation.new(element)
Creates a new Animation
### Parameters
* `element` `VisualElement` The element to animate
### Returns
* `Animation` `The` new animation
## Animation:sequence()
Creates a new sequence
### Returns
* `Animation` `self` The animation instance
## Animation:onStart(callback)
Registers a callback for the start event
### Parameters
* `callback` `function` The callback function to register
## Animation:onUpdate(callback)
Registers a callback for the update event
### Parameters
* `callback` `function` The callback function to register
### Returns
* `Animation` `self` The animation instance
## Animation:onComplete(callback)
Registers a callback for the complete event
### Parameters
* `callback` `function` The callback function to register
### Returns
* `Animation` `self` The animation instance
## Animation:addAnimation(type, args, duration, easing)
Adds a new animation to the sequence
### Parameters
* `type` `string` The type of animation
* `args` `table` The animation arguments
* `duration` `number` The duration in seconds
* `easing` `string` The easing function name
## Animation:start()
Starts the animation
### Returns
* `Animation` `self` The animation instance
## Animation:event(event, timerId)
The event handler for the animation (listens to timer events)
### Parameters
* `event` `string` The event type
* `timerId` `number` The timer ID
## Animation:stop()
Stops the animation immediately: cancels timers, completes running anim instances and clears the element property
# VisualElement
_Adds additional methods for VisualElement when adding animation plugin_
## Functions
|Method|Returns|Description|
|---|---|---|
|[VisualElement.hooks](#visualelement-hooks)|-||
|[VisualElement.setup](#visualelement-setup)|-||
|[VisualElement.stopAnimation](#visualelement-stopanimation)|-|Convenience to stop animations from the element|
|[VisualElement:animate](#visualelement-animate)|Animation|Creates a new animation|
## VisualElement.hooks()
## VisualElement.setup()
## VisualElement.stopAnimation()
Convenience to stop animations from the element
## VisualElement:animate()
Creates a new Animation Object
### Returns
* `Animation` `animation` The new animation

View File

@@ -1,48 +1,175 @@
# Benchmark
This is the benchmark plugin. It provides performance measurement tools for elements and methods,
with support for hierarchical profiling and detailed statistics. The plugin is meant to be used for very big projects
where performance is critical. It allows you to measure the time taken by specific methods and log the results.
# BaseElement
## Functions
|Method|Returns|Description|
|---|---|---|
|[API.clear](#api-clear)|-|Removes a benchmark's data
|[API.clearAll](#api-clearall)|-|Removes all custom benchmark data
|[API.getStats](#api-getstats)|table?|Retrieves benchmark statistics
|[API.start](#api-start)|-|Starts timing a custom operation
|[API.stop](#api-stop)|-|Stops timing and logs results
|[BaseElement:startProfile](#baseelement-startprofile-methodname)|BaseElement|Starts timing a method call|
|[BaseElement:endProfile](#baseelement-endprofile-methodname)|BaseElement|Ends timing a method call and records statistics|
|[BaseElement:benchmark](#baseelement-benchmark-methodname)|BaseElement|Enables performance measurement for a method|
|[BaseElement:logBenchmark](#baseelement-logbenchmark-methodname)|BaseElement|Logs benchmark statistics for a method|
|[BaseElement:stopBenchmark](#baseelement-stopbenchmark-methodname)|BaseElement|Disables performance measurement for a method|
|[BaseElement:getBenchmarkStats](#baseelement-getbenchmarkstats-methodname)|stats|Retrieves benchmark statistics for a method|
## BaseElement:startProfile(methodName)
## API.clear(name)
Clears a specific benchmark
Starts profiling a method
### Parameters
* `name` `string` The name of the benchmark to clear
## API.clearAll()
Clears all custom benchmarks
## API.getStats(name)
Gets statistics for a benchmark
### Parameters
* `name` `string` The name of the benchmark
* `methodName` `string` The name of the method to profile
### Returns
* `table?` `stats` The benchmark statistics or nil
* `BaseElement` `self` The element instance
## BaseElement:endProfile(methodName)
Ends profiling a method
### Parameters
* `methodName` `string` The name of the method to stop profiling
### Returns
* `BaseElement` `self` The element instance
## BaseElement:benchmark(methodName)
Enables benchmarking for a method
### Parameters
* `methodName` `string` The name of the method to benchmark
### Returns
* `BaseElement` `self` The element instance
### Usage
```lua
element:benchmark("render")
```
## BaseElement:logBenchmark(methodName)
Logs benchmark statistics for a method
### Parameters
* `methodName` `string` The name of the method to log
### Returns
* `BaseElement` `self` The element instance
## BaseElement:stopBenchmark(methodName)
Stops benchmarking for a method
### Parameters
* `methodName` `string` The name of the method to stop benchmarking
### Returns
* `BaseElement` `self` The element instance
## BaseElement:getBenchmarkStats(methodName)
Gets benchmark statistics for a method
### Parameters
* `methodName` `string` The name of the method to get statistics for
### Returns
* `stats` `The` benchmark statistics or nil
# Container
Extends: `VisualElement`
## Functions
|Method|Returns|Description|
|---|---|---|
|[Container:benchmarkContainer](#container-benchmarkcontainer-methodname)|Container|Recursively enables benchmarking|
|[Container:logContainerBenchmarks](#container-logcontainerbenchmarks-methodname)|Container|Recursively logs benchmark statistics|
|[Container:stopContainerBenchmark](#container-stopcontainerbenchmark-methodname)|Container|Recursively stops benchmarking|
## Container:benchmarkContainer(methodName)
Enables benchmarking for a container and all its children
### Parameters
* `methodName` `string` The method to benchmark
### Returns
* `Container` `self` The container instance
### Usage
```lua
container:benchmarkContainer("render")
```
## Container:logContainerBenchmarks(methodName)
Logs benchmark statistics for a container and all its children
### Parameters
* `methodName` `string` The method to log
### Returns
* `Container` `self` The container instance
## Container:stopContainerBenchmark(methodName)
Stops benchmarking for a container and all its children
### Parameters
* `methodName` `string` The method to stop benchmarking
### Returns
* `Container` `self` The container instance
# Benchmark
_This is the benchmark plugin. It provides performance measurement tools for elements and methods,
with support for hierarchical profiling and detailed statistics. The plugin is meant to be used for very big projects
where performance is critical. It allows you to measure the time taken by specific methods and log the results._
## Functions
|Method|Returns|Description|
|---|---|---|
|[Benchmark.start](#benchmark-start-name-options)|-|Starts timing a custom operation|
|[Benchmark.stop](#benchmark-stop-name)|-|Stops timing and logs results|
|[Benchmark.getStats](#benchmark-getstats-name)|stats|Retrieves benchmark statistics|
|[Benchmark.clear](#benchmark-clear-name)|-|Removes a benchmark's data|
|[Benchmark.clearAll](#benchmark-clearall)|-|Removes all custom benchmark data|
## Benchmark.start(name, options?)
## API.start(name, options?)
Starts a custom benchmark
### Parameters
* `name` `string` The name of the benchmark
* `options` *(optional)* `table` Optional configuration
## API.stop(name)
## Benchmark.stop(name)
Stops a custom benchmark
### Parameters
* `name` `string` The name of the benchmark to stop
## Benchmark.getStats(name)
Gets statistics for a benchmark
### Parameters
* `name` `string` The name of the benchmark
### Returns
* `stats` `The` benchmark statistics or nil
## Benchmark.clear(name)
Clears a specific benchmark
### Parameters
* `name` `string` The name of the benchmark to clear
## Benchmark.clearAll()
Clears all custom benchmarks

View File

@@ -0,0 +1 @@
!! EMPTY MARKDOWN GENERATED !!

View File

@@ -1,15 +1,15 @@
# BaseElement
No Description
_No Description_
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseElement.debug](#baseelement-debug)|-|Enables debugging for this element
|[BaseElement.dumpDebug](#baseelement-dumpdebug)|-|Dumps debug information
|[BaseElement.debug](#baseelement-debug-self-level)|-|Enables debugging for this element|
|[BaseElement.dumpDebug](#baseelement-dumpdebug-self)|-|Dumps debug information|
## BaseElement.debug(self, level)
Enables debugging for this element
### Parameters
@@ -17,62 +17,55 @@ Enables debugging for this element
* `level` `number` The debug level
## BaseElement.dumpDebug(self)
Dumps debug information for this element
### Parameters
* `self` `BaseElement` The element to dump debug info for
---
<br>
# BaseFrame
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseFrame.closeConsole](#baseframe-closeconsole)|-|Hides the debug log frame
|[BaseFrame.openConsole](#baseframe-openconsole)|-|Shows the debug log frame
|[BaseFrame.toggleConsole](#baseframe-toggleconsole)|-|Toggles the debug log frame
## BaseFrame.closeConsole(self)
Hides the debug log frame
### Parameters
* `self` `BaseFrame` The frame to hide debug log for
|[BaseFrame.openConsole](#baseframe-openconsole-self)|-|Shows the debug log frame|
|[BaseFrame.closeConsole](#baseframe-closeconsole-self)|-|Hides the debug log frame|
|[BaseFrame.toggleConsole](#baseframe-toggleconsole-self)|-|Toggles the debug log frame|
## BaseFrame.openConsole(self)
Shows the debug log frame
### Parameters
* `self` `BaseFrame` The frame to show debug log in
## BaseFrame.closeConsole(self)
Hides the debug log frame
### Parameters
* `self` `BaseFrame` The frame to hide debug log for
## BaseFrame.toggleConsole(self)
Toggles the debug log frame
### Parameters
* `self` `BaseFrame` The frame to toggle debug log for
---
<br>
# Container
## Functions
|Method|Returns|Description|
|---|---|---|
|[Container.debugChildren](#container-debugchildren)|-|Debug container and children
|[Container.debugChildren](#container-debugchildren-self-level)|-|Debug container and children|
## Container.debugChildren(self, level)
Enables debugging for this container and all its children
### Parameters
* `self` `Container` The container to debug
* `level` `number` The debug level

View File

@@ -1,15 +1,3 @@
# Reactive
This module provides reactive functionality for elements, it adds no new functionality for elements.
It is used to evaluate expressions in property values and update the element when the expression changes.
### Usage
```lua
local button = main:addButton({text="Exit"})
button:setX("{parent.x - 12}")
button:setBackground("{self.clicked and colors.red or colors.green}")
button:setWidth("{self.text:len() + 2}")
```
_This module provides reactive functionality for elements, it adds no new functionality for elements.
It is used to evaluate expressions in property values and update the element when the expression changes._

View File

@@ -1,92 +1,15 @@
# BaseElement
This is the state plugin. It provides a state management system for UI elements with support for
persistent states, computed states, and state sharing between elements.
# BaseFrame
Extends: `Container`
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseElement:bind](#baseelement-bind)|BaseElement|
|[BaseElement:computed](#baseelement-computed)|-|
|[BaseElement:getState](#baseelement-getstate)|any|Gets a state value
|[BaseElement:onStateChange](#baseelement-onstatechange)|BaseElement|Watches for state changes
|[BaseElement:removeStateChange](#baseelement-removestatechange)|BaseElement|Removes a state change observer
|[BaseElement:setState](#baseelement-setstate)|BaseElement|Sets a state value
## BaseElement:bind(self, propertyName, stateName)
Binds a property to a state
### Parameters
* `self` `BaseElement` The element to bind
* `propertyName` `string` The property to bind
* `stateName` `string` The state to bind to (optional, uses propertyName if not provided)
### Returns
* `BaseElement` `self` The element instance
## BaseElement:computed()
## BaseElement:getState(self, name)
Gets the value of a state
### Parameters
* `self` `BaseElement` The element to get state from
* `name` `string` The name of the state
### Returns
* `any` `value` The current state value
## BaseElement:onStateChange(self, stateName, callback)
Registers a callback for state changes
### Parameters
* `self` `BaseElement` The element to watch
* `stateName` `string` The state to watch
* `callback` `function` Called with (element, newValue, oldValue)
### Returns
* `BaseElement` `self` The element instance
## BaseElement:removeStateChange(self, stateName, callback)
Removes a state change observer
### Parameters
* `self` `BaseElement` The element to remove observer from
* `stateName` `string` The state to remove observer from
* `callback` `function` The callback function to remove
### Returns
* `BaseElement` `self` The element instance
## BaseElement:setState(self, name, value)
Sets the value of a state
### Parameters
* `self` `BaseElement` The element to set state for
* `name` `string` The name of the state
* `value` `any` The new value for the state
### Returns
* `BaseElement` `self` The element instance
---
<br>
# BaseFrame : Container
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseFrame.setup](#baseframe-setup)|-|
|[BaseFrame:initializeState](#baseframe-initializestate)|BaseFrame|Initializes a new state
## BaseFrame.setup()
|[BaseFrame:initializeState](#baseframe-initializestate-self-name-default-persist-path)|BaseFrame|Initializes a new state|
## BaseFrame:initializeState(self, name, default, persist?, path?)
Initializes a new state for this element
### Parameters
@@ -99,4 +22,75 @@ Initializes a new state for this element
### Returns
* `BaseFrame` `self` The element instance
# BaseElement
_This is the state plugin. It provides a state management system for UI elements with support for
persistent states, computed states, and state sharing between elements._
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseElement:setState](#baseelement-setstate-self-name-value)|BaseElement|Sets a state value|
|[BaseElement:getState](#baseelement-getstate-self-name)|any|Gets a state value|
|[BaseElement:onStateChange](#baseelement-onstatechange-self-statename-callback)|BaseElement|Watches for state changes|
|[BaseElement:removeStateChange](#baseelement-removestatechange-self-statename-callback)|BaseElement|Removes a state change observer|
|[BaseElement:bind](#baseelement-bind-self-propertyname-statename)|BaseElement|Binds a property to a state|
## BaseElement:setState(self, name, value)
Sets the value of a state
### Parameters
* `self` `BaseElement` The element to set state for
* `name` `string` The name of the state
* `value` `any` The new value for the state
### Returns
* `BaseElement` `self` The element instance
## BaseElement:getState(self, name)
Gets the value of a state
### Parameters
* `self` `BaseElement` The element to get state from
* `name` `string` The name of the state
### Returns
* `any` `value` The current state value
## BaseElement:onStateChange(self, stateName, callback)
Registers a callback for state changes
### Parameters
* `self` `BaseElement` The element to watch
* `stateName` `string` The state to watch
* `callback` `function` Called with (element, newValue, oldValue)
### Returns
* `BaseElement` `self` The element instance
## BaseElement:removeStateChange(self, stateName, callback)
Removes a state change observer
### Parameters
* `self` `BaseElement` The element to remove observer from
* `stateName` `string` The state to remove observer from
* `callback` `function` The callback function to remove
### Returns
* `BaseElement` `self` The element instance
## BaseElement:bind(self, propertyName, stateName)
Binds a property to a state
### Parameters
* `self` `BaseElement` The element to bind
* `propertyName` `string` The property to bind
* `stateName` `string` The state to bind to (optional, uses propertyName if not provided)
### Returns
* `BaseElement` `self` The element instance

View File

@@ -1,26 +1,29 @@
# BaseElement
This is the theme plugin. It provides a theming system that allows for consistent styling across elements
with support for inheritance, named styles, and dynamic theme switching.
_This is the theme plugin. It provides a theming system that allows for consistent styling across elements
with support for inheritance, named styles, and dynamic theme switching._
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseElement:applyTheme](#baseelement-applytheme)|BaseElement|Applies theme styles to the element
|[BaseElement:getTheme](#baseelement-gettheme)|table|Gets theme properties for the element
|[BaseElement.____getElementPath](#baseelement-----getelementpath)|-||
|[BaseElement:applyTheme](#baseelement-applytheme-self-applytochildren)|BaseElement|Applies theme styles to the element|
|[BaseElement:getTheme](#baseelement-gettheme-self)|table|Gets theme properties for the element|
## BaseElement.____getElementPath()
## BaseElement:applyTheme(self, applyToChildren)
Applies the current theme to this element
### Parameters
* `self` `BaseElement` The element to apply theme to
* `applyToChildren` `boolean?` Whether to apply theme to child elements (default: true)
* `applyToChildren` `boolean` ? Whether to apply theme to child elements (default: true)
### Returns
* `BaseElement` `self` The element instance
## BaseElement:getTheme(self)
Gets the theme properties for this element
### Parameters
@@ -29,38 +32,34 @@ Gets the theme properties for this element
### Returns
* `table` `styles` The theme properties
---
<br>
# ThemeAPI
The Theme API provides methods for managing themes globally
_The Theme API provides methods for managing themes globally_
## Functions
|Method|Returns|Description|
|---|---|---|
|[ThemeAPI.getTheme](#themeapi-gettheme)|table|Gets the current theme
|[ThemeAPI.loadTheme](#themeapi-loadtheme)|-|Loads theme from JSON file
|[ThemeAPI.setTheme](#themeapi-settheme)|-|Sets a new theme
|[ThemeAPI.setTheme](#themeapi-settheme-newtheme)|-|Sets a new theme|
|[ThemeAPI.getTheme](#themeapi-gettheme)|table|Gets the current theme|
|[ThemeAPI.loadTheme](#themeapi-loadtheme-path)|-|Loads theme from JSON file|
## ThemeAPI.setTheme(newTheme)
Sets the current theme
### Parameters
* `newTheme` `table` The theme configuration to set
## ThemeAPI.getTheme()
Gets the current theme configuration
### Returns
* `table` `theme` The current theme configuration
## ThemeAPI.loadTheme(path)
Loads a theme from a JSON file
### Parameters
* `path` `string` Path to the theme JSON file
## ThemeAPI.setTheme(newTheme)
Sets the current theme
### Parameters
* `newTheme` `table` The theme configuration to set

View File

@@ -0,0 +1 @@
!! EMPTY MARKDOWN GENERATED !!