This commit is contained in:
NoryiE
2025-02-18 08:47:22 +00:00
parent 6d4db0b931
commit 3abd20a509
35 changed files with 1633 additions and 305 deletions

View File

@@ -1,34 +1,100 @@
## Animation.new()
# Animation
This is the animation plugin. It provides a animation system for visual elements
with support for sequences, easing functions, and multiple animation types.
## Animation.registerAnimation()
## Functions
## Animation.registerEasing()
|Method|Returns|Description|
|---|---|---|
|[Animation.new](#Animation.new)|Animation|Creates a new animation
|[Animation.registerAnimation](#Animation.registerAnimation)|-|Registers a custom animation type
|[Animation.registerEasing](#Animation.registerEasing)|-|Adds a custom easing function
|[Animation:addAnimation](#Animation:addAnimation)|-|Adds a new animation to the sequence
|[Animation:event](#Animation:event)|-|The event handler for the animation
|[Animation:onComplete](#Animation:onComplete)|Animation|Registers a callback for the complete event
|[Animation:onStart](#Animation:onStart)|-|Registers a callback for the start event
|[Animation:onUpdate](#Animation:onUpdate)|Animation|Registers a callback for the update event
|[Animation:sequence](#Animation:sequence)|Animation|Creates a new sequence
|[Animation:start](#Animation:start)|Animation|Starts the animation
## Animation:addAnimation()
## Animation.new(element)
Creates a new Animation
## Animation:event()
### Parameters
* `element` `VisualElement` The element to animate
## Animation:onComplete()
### Returns
* `Animation` `The` new animation
## Animation:onStart()
## Animation.registerAnimation(name, handlers)
Registers a new animation type
## Animation:onUpdate()
### 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: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: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:onComplete(callback)
Registers a callback for the complete event
### Parameters
* `callback` `function` The callback function to register
### 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:sequence()
Creates a new sequence
### Returns
* `Animation` `self` The animation instance
## Animation:start()
Starts the animation
## AnimationInstance.new()
### Returns
* `Animation` `self` The animation instance
## AnimationInstance:complete()
## AnimationInstance:start()
## AnimationInstance:update()
## VisualElement.hooks.dispatchEvent()
## VisualElement.setup()
## VisualElement:animate()

View File

@@ -0,0 +1,57 @@
# AnimationInstance
This is the AnimationInstance class. It represents a single animation instance
## Fields
|Field|Type|Description|
|---|---|---|
|element|`VisualElement`|The element being animated|
|type|`string`|The type of animation|
|args|`table`|The animation arguments|
|duration|`number`|The duration in seconds|
|startTime|`number`|The animation start time|
|isPaused|`boolean`|Whether the animation is paused|
|handlers|`table`|The animation handlers|
|easing|`string`|The easing function name|
## Functions
|Method|Returns|Description|
|---|---|---|
|[AnimationInstance.new](#AnimationInstance.new)|AnimationInstance|Creates a new animation instance
|[AnimationInstance:complete](#AnimationInstance:complete)|-|Called when the animation is completed
|[AnimationInstance:start](#AnimationInstance:start)|AnimationInstance|Starts the animation
|[AnimationInstance:update](#AnimationInstance:update)|boolean|Updates the animation
## 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:complete()
Gets called when the animation is completed
## 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

View File

@@ -0,0 +1,16 @@
# VisualElement
Adds additional methods for VisualElement when adding animation plugin
## Functions
|Method|Returns|Description|
|---|---|---|
|[VisualElement:animate](#VisualElement:animate)|Animation|Creates a new animation
## VisualElement:animate()
Creates a new Animation Object
### Returns
* `Animation` `animation` The new animation

View File

@@ -1,18 +1,45 @@
## BaseElement:benchmark()
# BenchmarkAPI
Benchmark API methods
## BaseElement:endProfile()
## Functions
## BaseElement:getBenchmarkStats()
|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:logBenchmark()
## API.clear(name)
Clears a specific benchmark
## BaseElement:startProfile()
### Parameters
* `name` `string` The name of the benchmark to clear
## BaseElement:stopBenchmark()
## API.clearAll()
Clears all custom benchmarks
## Container:benchmarkContainer()
## API.getStats(name)
Gets statistics for a benchmark
## Container:logContainerBenchmarks()
### Parameters
* `name` `string` The name of the benchmark
### Returns
* `table?` `stats` The benchmark statistics or nil
## API.start(name, options?)
Starts a custom benchmark
### Parameters
* `name` `string` The name of the benchmark
* `options` *(optional)* `table` Optional configuration
## API.stop(name)
Stops a custom benchmark
### Parameters
* `name` `string` The name of the benchmark to stop
## Container:stopContainerBenchmark()

View File

@@ -0,0 +1,76 @@
# BaseElement
This is the benchmark plugin. It provides performance measurement tools for elements and methods,
with support for hierarchical profiling and detailed statistics.
The following methods are available for BaseElement
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseElement:benchmark](#BaseElement:benchmark)|BaseElement|Enables performance measurement for a method
|[BaseElement:endProfile](#BaseElement:endProfile)|BaseElement|Ends timing a method call and records statistics
|[BaseElement:getBenchmarkStats](#BaseElement:getBenchmarkStats)|table?|Retrieves benchmark statistics for a method
|[BaseElement:logBenchmark](#BaseElement:logBenchmark)|BaseElement|Logs benchmark statistics for a method
|[BaseElement:startProfile](#BaseElement:startProfile)|BaseElement|Starts timing a method call
|[BaseElement:stopBenchmark](#BaseElement:stopBenchmark)|BaseElement|Disables performance measurement for a method
## 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:endProfile(methodName)
Ends profiling a method
### Parameters
* `methodName` `string` The name of the method to stop profiling
### 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
* `table?` `stats` The benchmark statistics or nil
## 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:startProfile(methodName)
Starts profiling a method
### Parameters
* `methodName` `string` The name of the method to profile
### 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

View File

@@ -0,0 +1,44 @@
# Container
Container benchmarking methods
## Functions
|Method|Returns|Description|
|---|---|---|
|[Container:benchmarkContainer](#Container:benchmarkContainer)|Container|Recursively enables benchmarking
|[Container:logContainerBenchmarks](#Container:logContainerBenchmarks)|Container|Recursively logs benchmark statistics
|[Container:stopContainerBenchmark](#Container:stopContainerBenchmark)|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

View File

@@ -0,0 +1,75 @@
# BaseElement
No Description
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseElement.debug](#BaseElement.debug)|-|Enables debugging for this element
|[BaseElement.dumpDebug](#BaseElement.dumpDebug)|-|Dumps debug information
## BaseElement.debug(self, level)
Enables debugging for this element
### Parameters
* `self` `BaseElement` The element to debug
* `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.hideDebugLog](#BaseFrame.hideDebugLog)|-|Hides the debug log frame
|[BaseFrame.showDebugLog](#BaseFrame.showDebugLog)|-|Shows the debug log frame
|[BaseFrame.toggleDebugLog](#BaseFrame.toggleDebugLog)|-|Toggles the debug log frame
## BaseFrame.hideDebugLog(self)
Hides the debug log frame
### Parameters
* `self` `BaseFrame` The frame to hide debug log for
## BaseFrame.showDebugLog(self)
Shows the debug log frame
### Parameters
* `self` `BaseFrame` The frame to show debug log in
## BaseFrame.toggleDebugLog(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(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,14 +1,84 @@
## BaseElement.setup()
# 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.
## BaseElement:computed()
## Functions
## BaseElement:getState()
|Method|Returns|Description|
|---|---|---|
|[BaseElement:computed](#BaseElement:computed)|BaseElement|Creates a computed state
|[BaseElement:getState](#BaseElement:getState)|any|Gets a state value
|[BaseElement:initializeState](#BaseElement:initializeState)|BaseElement|Initializes a new state
|[BaseElement:onStateChange](#BaseElement:onStateChange)|BaseElement|Watches for state changes
|[BaseElement:setState](#BaseElement:setState)|BaseElement|Sets a state value
|[BaseElement:shareState](#BaseElement:shareState)|BaseElement|Shares state between elements
## BaseElement:initializeState()
## BaseElement:computed(self, key, computeFn)
Creates a computed state that derives its value from other states
## BaseElement:onStateChange()
### Parameters
* `self` `BaseElement` The element to create computed state for
* `key` `string` The name of the computed state
* `computeFn` `function` Function that computes the state value
## BaseElement:setState()
### 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:initializeState(self, name, default, canTriggerRender?, persist?, path?)
Initializes a new state for this element
### Parameters
* `self` `BaseElement` The element to initialize state for
* `name` `string` The name of the state
* `default` `any` The default value of the state
* `canTriggerRender` *(optional)* `boolean` Whether state changes trigger a render
* `persist` *(optional)* `boolean` Whether to persist the state to disk
* `path` *(optional)* `string` Custom file path for persistence
### Returns
* `BaseElement` `self` The element instance
## 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: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:shareState(self, stateKey...)
Shares a state with other elements, keeping them in sync
### Parameters
* `self` `BaseElement` The source element
* `stateKey` `string` The state to share
* `...` *(vararg)* `BaseElement` The target elements to share with
### Returns
* `BaseElement` `self` The source element
## BaseElement:shareState()

View File

@@ -1,4 +1,63 @@
## BaseElement.____getElementPath()
# 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.
## 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:applyTheme(self)
Applies the current theme to this element
### Parameters
* `self` `BaseElement` The element to apply theme to
### Returns
* `BaseElement` `self` The element instance
## BaseElement:getTheme(self)
Gets the theme properties for this element
### Parameters
* `self` `BaseElement` The element to get theme for
### Returns
* `table` `styles` The theme properties
---
<br>
# ThemeAPI
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.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
## BaseElement:getTheme()

View File

@@ -1,4 +1,54 @@
## BaseElement:fromXML()
# BaseElement
The XML plugin provides XML parsing and UI creation from XML markup
## Functions
|Method|Returns|Description|
|---|---|---|
|[BaseElement:fromXML](#BaseElement:fromXML)|BaseElement|Creates element from XML node
## BaseElement:fromXML(self, node)
Creates an element from an XML node
### Parameters
* `self` `BaseElement` The element instance
* `node` `table` The XML node to create from
### Returns
* `BaseElement` `self` The element instance
---
<br>
# Container
## Functions
|Method|Returns|Description|
|---|---|---|
|[Container:loadXML](#Container:loadXML)|Container|Loads UI from XML string
## Container:loadXML(self, content, scope?)
Loads and creates UI elements from XML content
local xml = [[
<Frame>
<Button name="myButton" x="5" y="5"/>
</Frame>
]]
container:loadXML(xml)
### Parameters
* `self` `Container` The container to load into
* `content` `string` The XML content to parse
* `scope` *(optional)* `table` Optional scope for variable resolution
### Returns
* `Container` `self` The container instance
### Usage
```lua
```
## Container:loadXML()