update type defs
This commit is contained in:
@@ -111,6 +111,10 @@
|
|||||||
---@field imageOpacity number? -- Image opacity 0-1 (default: 1, combines with element opacity)
|
---@field imageOpacity number? -- Image opacity 0-1 (default: 1, combines with element opacity)
|
||||||
---@field imageRepeat "no-repeat"|"repeat"|"repeat-x"|"repeat-y"|"space"|"round"? -- Image repeat/tiling mode (default: "no-repeat")
|
---@field imageRepeat "no-repeat"|"repeat"|"repeat-x"|"repeat-y"|"space"|"round"? -- Image repeat/tiling mode (default: "no-repeat")
|
||||||
---@field imageTint Color? -- Color to tint the image (default: nil/white, no tint)
|
---@field imageTint Color? -- Color to tint the image (default: nil/white, no tint)
|
||||||
|
---@field onImageLoad fun(element:Element, image:love.Image)? -- Callback when image loads successfully
|
||||||
|
---@field onImageLoadDeferred boolean? -- Whether onImageLoad callback should be deferred (default: false)
|
||||||
|
---@field onImageError fun(element:Element, error:string)? -- Callback when image fails to load
|
||||||
|
---@field onImageErrorDeferred boolean? -- Whether onImageError callback should be deferred (default: false)
|
||||||
---@field _loadedImage love.Image? -- Internal: cached loaded image
|
---@field _loadedImage love.Image? -- Internal: cached loaded image
|
||||||
---@field hideScrollbars boolean|{vertical:boolean, horizontal:boolean}? -- Hide scrollbars (boolean for both, or table for individual control)
|
---@field hideScrollbars boolean|{vertical:boolean, horizontal:boolean}? -- Hide scrollbars (boolean for both, or table for individual control)
|
||||||
---@field userdata table?
|
---@field userdata table?
|
||||||
@@ -162,14 +166,14 @@ function Element.new(props, deps)
|
|||||||
|
|
||||||
local self = setmetatable({}, Element)
|
local self = setmetatable({}, Element)
|
||||||
self._deps = deps
|
self._deps = deps
|
||||||
|
|
||||||
-- Create dependency subsets for sub-modules (defined once, used throughout)
|
-- Create dependency subsets for sub-modules (defined once, used throughout)
|
||||||
local eventHandlerDeps = {
|
local eventHandlerDeps = {
|
||||||
InputEvent = deps.InputEvent,
|
InputEvent = deps.InputEvent,
|
||||||
Context = deps.Context,
|
Context = deps.Context,
|
||||||
utils = deps.utils,
|
utils = deps.utils,
|
||||||
}
|
}
|
||||||
|
|
||||||
local rendererDeps = {
|
local rendererDeps = {
|
||||||
Color = deps.Color,
|
Color = deps.Color,
|
||||||
RoundedRect = deps.RoundedRect,
|
RoundedRect = deps.RoundedRect,
|
||||||
@@ -181,7 +185,7 @@ function Element.new(props, deps)
|
|||||||
Transform = deps.Transform,
|
Transform = deps.Transform,
|
||||||
utils = deps.utils,
|
utils = deps.utils,
|
||||||
}
|
}
|
||||||
|
|
||||||
local layoutEngineDeps = {
|
local layoutEngineDeps = {
|
||||||
utils = deps.utils,
|
utils = deps.utils,
|
||||||
Grid = deps.Grid,
|
Grid = deps.Grid,
|
||||||
@@ -189,19 +193,19 @@ function Element.new(props, deps)
|
|||||||
Context = deps.Context,
|
Context = deps.Context,
|
||||||
ErrorHandler = deps.ErrorHandler,
|
ErrorHandler = deps.ErrorHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
local textEditorDeps = {
|
local textEditorDeps = {
|
||||||
Context = deps.Context,
|
Context = deps.Context,
|
||||||
StateManager = deps.StateManager,
|
StateManager = deps.StateManager,
|
||||||
Color = deps.Color,
|
Color = deps.Color,
|
||||||
utils = deps.utils,
|
utils = deps.utils,
|
||||||
}
|
}
|
||||||
|
|
||||||
local scrollManagerDeps = {
|
local scrollManagerDeps = {
|
||||||
utils = deps.utils,
|
utils = deps.utils,
|
||||||
Color = deps.Color,
|
Color = deps.Color,
|
||||||
}
|
}
|
||||||
|
|
||||||
self.children = {}
|
self.children = {}
|
||||||
self.onEvent = props.onEvent
|
self.onEvent = props.onEvent
|
||||||
|
|
||||||
@@ -215,18 +219,23 @@ function Element.new(props, deps)
|
|||||||
self.userdata = props.userdata
|
self.userdata = props.userdata
|
||||||
|
|
||||||
self.onFocus = props.onFocus
|
self.onFocus = props.onFocus
|
||||||
|
self.onFocusDeferred = props.onFocusDeferred or false
|
||||||
self.onBlur = props.onBlur
|
self.onBlur = props.onBlur
|
||||||
|
self.onBlurDeferred = props.onBlurDeferred or false
|
||||||
self.onTextInput = props.onTextInput
|
self.onTextInput = props.onTextInput
|
||||||
|
self.onTextInputDeferred = props.onTextInputDeferred or false
|
||||||
self.onTextChange = props.onTextChange
|
self.onTextChange = props.onTextChange
|
||||||
|
self.onTextChangeDeferred = props.onTextChangeDeferred or false
|
||||||
self.onEnter = props.onEnter
|
self.onEnter = props.onEnter
|
||||||
|
self.onEnterDeferred = props.onEnterDeferred or false
|
||||||
|
|
||||||
-- Initialize state manager ID for immediate mode (use self.id which may be auto-generated)
|
-- Initialize state manager ID for immediate mode (use self.id which may be auto-generated)
|
||||||
self._stateId = self.id
|
self._stateId = self.id
|
||||||
|
|
||||||
-- In immediate mode, restore EventHandler state from StateManager
|
-- In immediate mode, restore EventHandler state from StateManager
|
||||||
local eventHandlerConfig = {
|
local eventHandlerConfig = {
|
||||||
onEvent = self.onEvent,
|
onEvent = self.onEvent,
|
||||||
onEventDeferred = props.onEventDeferred
|
onEventDeferred = props.onEventDeferred,
|
||||||
}
|
}
|
||||||
if self._deps.Context._immediateMode and self._stateId and self._stateId ~= "" then
|
if self._deps.Context._immediateMode and self._stateId and self._stateId ~= "" then
|
||||||
local state = self._deps.StateManager.getState(self._stateId)
|
local state = self._deps.StateManager.getState(self._stateId)
|
||||||
@@ -459,13 +468,13 @@ function Element.new(props, deps)
|
|||||||
|
|
||||||
-- Validate and set imageRepeat
|
-- Validate and set imageRepeat
|
||||||
if props.imageRepeat then
|
if props.imageRepeat then
|
||||||
local validImageRepeat = {
|
local validImageRepeat = {
|
||||||
["no-repeat"] = "no-repeat",
|
["no-repeat"] = "no-repeat",
|
||||||
["repeat"] = "repeat",
|
["repeat"] = "repeat",
|
||||||
["repeat-x"] = "repeat-x",
|
["repeat-x"] = "repeat-x",
|
||||||
["repeat-y"] = "repeat-y",
|
["repeat-y"] = "repeat-y",
|
||||||
space = "space",
|
space = "space",
|
||||||
round = "round"
|
round = "round",
|
||||||
}
|
}
|
||||||
self._deps.utils.validateEnum(props.imageRepeat, validImageRepeat, "imageRepeat")
|
self._deps.utils.validateEnum(props.imageRepeat, validImageRepeat, "imageRepeat")
|
||||||
end
|
end
|
||||||
@@ -474,17 +483,71 @@ function Element.new(props, deps)
|
|||||||
-- Set imageTint
|
-- Set imageTint
|
||||||
self.imageTint = props.imageTint
|
self.imageTint = props.imageTint
|
||||||
|
|
||||||
|
-- Image callbacks
|
||||||
|
self.onImageLoad = props.onImageLoad
|
||||||
|
self.onImageLoadDeferred = props.onImageLoadDeferred or false
|
||||||
|
self.onImageError = props.onImageError
|
||||||
|
self.onImageErrorDeferred = props.onImageErrorDeferred or false
|
||||||
|
|
||||||
-- Auto-load image if imagePath is provided
|
-- Auto-load image if imagePath is provided
|
||||||
if self.imagePath and not self.image then
|
if self.imagePath and not self.image then
|
||||||
local loadedImage, err = self._deps.ImageCache.load(self.imagePath)
|
local loadedImage, err = self._deps.ImageCache.load(self.imagePath)
|
||||||
if loadedImage then
|
if loadedImage then
|
||||||
self._loadedImage = loadedImage
|
self._loadedImage = loadedImage
|
||||||
|
-- Call onImageLoad callback if provided
|
||||||
|
if self.onImageLoad and type(self.onImageLoad) == "function" then
|
||||||
|
if self.onImageLoadDeferred then
|
||||||
|
self._deps.Context.deferCallback(function()
|
||||||
|
local success, callbackErr = pcall(self.onImageLoad, self, loadedImage)
|
||||||
|
if not success then
|
||||||
|
print(string.format("[Element] onImageLoad error: %s", tostring(callbackErr)))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
local success, callbackErr = pcall(self.onImageLoad, self, loadedImage)
|
||||||
|
if not success then
|
||||||
|
print(string.format("[Element] onImageLoad error: %s", tostring(callbackErr)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
-- Silently fail - image will just not render
|
-- Image failed to load
|
||||||
self._loadedImage = nil
|
self._loadedImage = nil
|
||||||
|
-- Call onImageError callback if provided
|
||||||
|
if self.onImageError and type(self.onImageError) == "function" then
|
||||||
|
if self.onImageErrorDeferred then
|
||||||
|
self._deps.Context.deferCallback(function()
|
||||||
|
local success, callbackErr = pcall(self.onImageError, self, err or "Unknown error")
|
||||||
|
if not success then
|
||||||
|
print(string.format("[Element] onImageError error: %s", tostring(callbackErr)))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
local success, callbackErr = pcall(self.onImageError, self, err or "Unknown error")
|
||||||
|
if not success then
|
||||||
|
print(string.format("[Element] onImageError error: %s", tostring(callbackErr)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
elseif self.image then
|
elseif self.image then
|
||||||
self._loadedImage = self.image
|
self._loadedImage = self.image
|
||||||
|
-- Call onImageLoad for directly provided images
|
||||||
|
if self.onImageLoad and type(self.onImageLoad) == "function" then
|
||||||
|
if self.onImageLoadDeferred then
|
||||||
|
self._deps.Context.deferCallback(function()
|
||||||
|
local success, callbackErr = pcall(self.onImageLoad, self, self.image)
|
||||||
|
if not success then
|
||||||
|
print(string.format("[Element] onImageLoad error: %s", tostring(callbackErr)))
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
else
|
||||||
|
local success, callbackErr = pcall(self.onImageLoad, self, self.image)
|
||||||
|
if not success then
|
||||||
|
print(string.format("[Element] onImageLoad error: %s", tostring(callbackErr)))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
else
|
else
|
||||||
self._loadedImage = nil
|
self._loadedImage = nil
|
||||||
end
|
end
|
||||||
@@ -1734,7 +1797,7 @@ function Element:removeChild(child)
|
|||||||
if c == child then
|
if c == child then
|
||||||
table.remove(self.children, i)
|
table.remove(self.children, i)
|
||||||
child.parent = nil
|
child.parent = nil
|
||||||
|
|
||||||
-- Recalculate auto-sizing if needed
|
-- Recalculate auto-sizing if needed
|
||||||
if self.autosizing.width or self.autosizing.height then
|
if self.autosizing.width or self.autosizing.height then
|
||||||
if self.autosizing.width then
|
if self.autosizing.width then
|
||||||
@@ -1748,12 +1811,12 @@ function Element:removeChild(child)
|
|||||||
self.height = contentHeight
|
self.height = contentHeight
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Re-layout children after removal
|
-- Re-layout children after removal
|
||||||
if not self._deps.Context._immediateMode then
|
if not self._deps.Context._immediateMode then
|
||||||
self:layoutChildren()
|
self:layoutChildren()
|
||||||
end
|
end
|
||||||
|
|
||||||
break
|
break
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1765,10 +1828,10 @@ function Element:clearChildren()
|
|||||||
for _, child in ipairs(self.children) do
|
for _, child in ipairs(self.children) do
|
||||||
child.parent = nil
|
child.parent = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Clear the children table
|
-- Clear the children table
|
||||||
self.children = {}
|
self.children = {}
|
||||||
|
|
||||||
-- Recalculate auto-sizing if needed
|
-- Recalculate auto-sizing if needed
|
||||||
if self.autosizing.width or self.autosizing.height then
|
if self.autosizing.width or self.autosizing.height then
|
||||||
if self.autosizing.width then
|
if self.autosizing.width then
|
||||||
@@ -1782,7 +1845,7 @@ function Element:clearChildren()
|
|||||||
self.height = contentHeight
|
self.height = contentHeight
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Re-layout (though there are no children now)
|
-- Re-layout (though there are no children now)
|
||||||
if not self._deps.Context._immediateMode then
|
if not self._deps.Context._immediateMode then
|
||||||
self:layoutChildren()
|
self:layoutChildren()
|
||||||
@@ -1807,7 +1870,7 @@ function Element:layoutChildren()
|
|||||||
if not self.parent then
|
if not self.parent then
|
||||||
self:_checkPerformanceWarnings()
|
self:_checkPerformanceWarnings()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Delegate layout to LayoutEngine
|
-- Delegate layout to LayoutEngine
|
||||||
self._layoutEngine:layoutChildren()
|
self._layoutEngine:layoutChildren()
|
||||||
end
|
end
|
||||||
@@ -2019,7 +2082,7 @@ function Element:update(dt)
|
|||||||
if not self.parent then
|
if not self.parent then
|
||||||
self:_trackActiveAnimations()
|
self:_trackActiveAnimations()
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Restore scrollbar state from StateManager in immediate mode
|
-- Restore scrollbar state from StateManager in immediate mode
|
||||||
if self._stateId and self._deps.Context._immediateMode then
|
if self._stateId and self._deps.Context._immediateMode then
|
||||||
local state = self._deps.StateManager.getState(self._stateId)
|
local state = self._deps.StateManager.getState(self._stateId)
|
||||||
@@ -2055,12 +2118,12 @@ function Element:update(dt)
|
|||||||
if not self.animation._Color and self._deps.Color then
|
if not self.animation._Color and self._deps.Color then
|
||||||
self.animation:setColorModule(self._deps.Color)
|
self.animation:setColorModule(self._deps.Color)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Ensure animation has Transform module reference for transform interpolation
|
-- Ensure animation has Transform module reference for transform interpolation
|
||||||
if not self.animation._Transform and self._deps.Transform then
|
if not self.animation._Transform and self._deps.Transform then
|
||||||
self.animation:setTransformModule(self._deps.Transform)
|
self.animation:setTransformModule(self._deps.Transform)
|
||||||
end
|
end
|
||||||
|
|
||||||
local finished = self.animation:update(dt, self)
|
local finished = self.animation:update(dt, self)
|
||||||
if finished then
|
if finished then
|
||||||
-- Animation:update() already called onComplete callback
|
-- Animation:update() already called onComplete callback
|
||||||
@@ -2068,7 +2131,7 @@ function Element:update(dt)
|
|||||||
else
|
else
|
||||||
-- Apply animation interpolation during update
|
-- Apply animation interpolation during update
|
||||||
local anim = self.animation:interpolate()
|
local anim = self.animation:interpolate()
|
||||||
|
|
||||||
-- Apply numeric properties
|
-- Apply numeric properties
|
||||||
self.width = anim.width or self.width
|
self.width = anim.width or self.width
|
||||||
self.height = anim.height or self.height
|
self.height = anim.height or self.height
|
||||||
@@ -2081,7 +2144,7 @@ function Element:update(dt)
|
|||||||
self.borderWidth = anim.borderWidth or self.borderWidth
|
self.borderWidth = anim.borderWidth or self.borderWidth
|
||||||
self.fontSize = anim.fontSize or self.fontSize
|
self.fontSize = anim.fontSize or self.fontSize
|
||||||
self.lineHeight = anim.lineHeight or self.lineHeight
|
self.lineHeight = anim.lineHeight or self.lineHeight
|
||||||
|
|
||||||
-- Apply color properties
|
-- Apply color properties
|
||||||
if anim.backgroundColor then
|
if anim.backgroundColor then
|
||||||
self.backgroundColor = anim.backgroundColor
|
self.backgroundColor = anim.backgroundColor
|
||||||
@@ -2101,7 +2164,7 @@ function Element:update(dt)
|
|||||||
if anim.imageTint then
|
if anim.imageTint then
|
||||||
self.imageTint = anim.imageTint
|
self.imageTint = anim.imageTint
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Apply table properties
|
-- Apply table properties
|
||||||
if anim.padding then
|
if anim.padding then
|
||||||
self.padding = anim.padding
|
self.padding = anim.padding
|
||||||
@@ -2112,12 +2175,12 @@ function Element:update(dt)
|
|||||||
if anim.cornerRadius then
|
if anim.cornerRadius then
|
||||||
self.cornerRadius = anim.cornerRadius
|
self.cornerRadius = anim.cornerRadius
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Apply transform property
|
-- Apply transform property
|
||||||
if anim.transform then
|
if anim.transform then
|
||||||
self.transform = anim.transform
|
self.transform = anim.transform
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Backward compatibility: Update background color with interpolated opacity
|
-- Backward compatibility: Update background color with interpolated opacity
|
||||||
if anim.opacity and not anim.backgroundColor then
|
if anim.opacity and not anim.backgroundColor then
|
||||||
self.backgroundColor.a = anim.opacity
|
self.backgroundColor.a = anim.opacity
|
||||||
@@ -2767,7 +2830,7 @@ function Element:_checkPerformanceWarnings()
|
|||||||
if not Performance or not Performance.areWarningsEnabled() then
|
if not Performance or not Performance.areWarningsEnabled() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check hierarchy depth
|
-- Check hierarchy depth
|
||||||
local depth = self:getHierarchyDepth()
|
local depth = self:getHierarchyDepth()
|
||||||
if depth >= 15 then
|
if depth >= 15 then
|
||||||
@@ -2779,7 +2842,7 @@ function Element:_checkPerformanceWarnings()
|
|||||||
"Deep nesting can impact performance. Consider flattening the structure or using absolute positioning"
|
"Deep nesting can impact performance. Consider flattening the structure or using absolute positioning"
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Check total element count (only for root elements)
|
-- Check total element count (only for root elements)
|
||||||
if not self.parent then
|
if not self.parent then
|
||||||
local totalElements = self:countElements()
|
local totalElements = self:countElements()
|
||||||
@@ -2811,7 +2874,7 @@ function Element:_trackActiveAnimations()
|
|||||||
if not Performance or not Performance.areWarningsEnabled() then
|
if not Performance or not Performance.areWarningsEnabled() then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local animCount = self:_countActiveAnimations()
|
local animCount = self:_countActiveAnimations()
|
||||||
if animCount >= 50 then
|
if animCount >= 50 then
|
||||||
Performance.logWarning(
|
Performance.logWarning(
|
||||||
@@ -2848,13 +2911,13 @@ end
|
|||||||
--- Set image repeat mode
|
--- Set image repeat mode
|
||||||
---@param repeatMode string Repeat mode: "no-repeat", "repeat", "repeat-x", "repeat-y", "space", "round"
|
---@param repeatMode string Repeat mode: "no-repeat", "repeat", "repeat-x", "repeat-y", "space", "round"
|
||||||
function Element:setImageRepeat(repeatMode)
|
function Element:setImageRepeat(repeatMode)
|
||||||
local validImageRepeat = {
|
local validImageRepeat = {
|
||||||
["no-repeat"] = "no-repeat",
|
["no-repeat"] = "no-repeat",
|
||||||
["repeat"] = "repeat",
|
["repeat"] = "repeat",
|
||||||
["repeat-x"] = "repeat-x",
|
["repeat-x"] = "repeat-x",
|
||||||
["repeat-y"] = "repeat-y",
|
["repeat-y"] = "repeat-y",
|
||||||
space = "space",
|
space = "space",
|
||||||
round = "round"
|
round = "round",
|
||||||
}
|
}
|
||||||
self._deps.utils.validateEnum(repeatMode, validImageRepeat, "imageRepeat")
|
self._deps.utils.validateEnum(repeatMode, validImageRepeat, "imageRepeat")
|
||||||
self.imageRepeat = repeatMode
|
self.imageRepeat = repeatMode
|
||||||
|
|||||||
@@ -6,11 +6,16 @@
|
|||||||
-- For Animation.lua
|
-- For Animation.lua
|
||||||
--=====================================--
|
--=====================================--
|
||||||
---@class AnimationProps
|
---@class AnimationProps
|
||||||
---@field duration number
|
---@field duration number -- Duration in seconds
|
||||||
---@field start {width?:number, height?:number, opacity?:number}
|
---@field start table -- Starting values (can contain: width, height, opacity, x, y, gap, imageOpacity, backgroundColor, borderColor, textColor, padding, margin, cornerRadius, transform, etc.)
|
||||||
---@field final {width?:number, height?:number, opacity?:number}
|
---@field final table -- Final values (same properties as start)
|
||||||
---@field transform table?
|
---@field easing string? -- Easing function name: "linear", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeInQuart", "easeOutQuart", "easeInExpo", "easeOutExpo" (default: "linear")
|
||||||
---@field transition table?
|
---@field onStart fun(animation:Animation, element:Element?)? -- Called when animation starts
|
||||||
|
---@field onUpdate fun(animation:Animation, element:Element?, progress:number)? -- Called each frame with progress (0-1)
|
||||||
|
---@field onComplete fun(animation:Animation, element:Element?)? -- Called when animation completes
|
||||||
|
---@field onCancel fun(animation:Animation, element:Element?)? -- Called when animation is cancelled
|
||||||
|
---@field transform table? -- Additional transform properties (legacy support)
|
||||||
|
---@field transition table? -- Transition properties (legacy support)
|
||||||
local AnimationProps = {}
|
local AnimationProps = {}
|
||||||
|
|
||||||
---@class TransformProps
|
---@class TransformProps
|
||||||
@@ -41,6 +46,7 @@ local AnimationProps = {}
|
|||||||
---@field border Border? -- Border configuration for the element
|
---@field border Border? -- Border configuration for the element
|
||||||
---@field borderColor Color? -- Color of the border (default: black)
|
---@field borderColor Color? -- Color of the border (default: black)
|
||||||
---@field opacity number? -- Element opacity 0-1 (default: 1)
|
---@field opacity number? -- Element opacity 0-1 (default: 1)
|
||||||
|
---@field visibility "visible"|"hidden"? -- Element visibility (default: "visible")
|
||||||
---@field backgroundColor Color? -- Background color (default: transparent)
|
---@field backgroundColor Color? -- Background color (default: transparent)
|
||||||
---@field cornerRadius number|{topLeft:number?, topRight:number?, bottomLeft:number?, bottomRight:number?}? -- Corner radius: number (all corners) or table for individual corners (default: 0)
|
---@field cornerRadius number|{topLeft:number?, topRight:number?, bottomLeft:number?, bottomRight:number?}? -- Corner radius: number (all corners) or table for individual corners (default: 0)
|
||||||
---@field gap number|string? -- Space between children elements (default: 0)
|
---@field gap number|string? -- Space between children elements (default: 0)
|
||||||
@@ -63,11 +69,17 @@ local AnimationProps = {}
|
|||||||
---@field justifySelf JustifySelf? -- Alignment of the item itself along main axis (default: AUTO)
|
---@field justifySelf JustifySelf? -- Alignment of the item itself along main axis (default: AUTO)
|
||||||
---@field alignSelf AlignSelf? -- Alignment of the item itself along cross axis (default: AUTO)
|
---@field alignSelf AlignSelf? -- Alignment of the item itself along cross axis (default: AUTO)
|
||||||
---@field onEvent fun(element:Element, event:InputEvent)? -- Callback function for interaction events
|
---@field onEvent fun(element:Element, event:InputEvent)? -- Callback function for interaction events
|
||||||
---@field onFocus fun(element:Element, event:InputEvent)? -- Callback when element receives focus
|
---@field onEventDeferred boolean? -- Whether onEvent callback should be deferred until after canvases are released (default: false)
|
||||||
---@field onBlur fun(element:Element, event:InputEvent)? -- Callback when element loses focus
|
---@field onFocus fun(element:Element)? -- Callback when element receives focus
|
||||||
|
---@field onFocusDeferred boolean? -- Whether onFocus callback should be deferred (default: false)
|
||||||
|
---@field onBlur fun(element:Element)? -- Callback when element loses focus
|
||||||
|
---@field onBlurDeferred boolean? -- Whether onBlur callback should be deferred (default: false)
|
||||||
---@field onTextInput fun(element:Element, text:string)? -- Callback when text is input
|
---@field onTextInput fun(element:Element, text:string)? -- Callback when text is input
|
||||||
|
---@field onTextInputDeferred boolean? -- Whether onTextInput callback should be deferred (default: false)
|
||||||
---@field onTextChange fun(element:Element, text:string)? -- Callback when text content changes
|
---@field onTextChange fun(element:Element, text:string)? -- Callback when text content changes
|
||||||
|
---@field onTextChangeDeferred boolean? -- Whether onTextChange callback should be deferred (default: false)
|
||||||
---@field onEnter fun(element:Element)? -- Callback when Enter key is pressed
|
---@field onEnter fun(element:Element)? -- Callback when Enter key is pressed
|
||||||
|
---@field onEnterDeferred boolean? -- Whether onEnter callback should be deferred (default: false)
|
||||||
---@field transform TransformProps? -- Transform properties for animations and styling
|
---@field transform TransformProps? -- Transform properties for animations and styling
|
||||||
---@field transition TransitionProps? -- Transition settings for animations
|
---@field transition TransitionProps? -- Transition settings for animations
|
||||||
---@field gridRows number? -- Number of rows in the grid (default: 1)
|
---@field gridRows number? -- Number of rows in the grid (default: 1)
|
||||||
@@ -114,6 +126,12 @@ local AnimationProps = {}
|
|||||||
---@field objectFit "fill"|"contain"|"cover"|"scale-down"|"none"? -- Image fit mode (default: "fill")
|
---@field objectFit "fill"|"contain"|"cover"|"scale-down"|"none"? -- Image fit mode (default: "fill")
|
||||||
---@field objectPosition string? -- Image position like "center center", "top left", "50% 50%" (default: "center center")
|
---@field objectPosition string? -- Image position like "center center", "top left", "50% 50%" (default: "center center")
|
||||||
---@field imageOpacity number? -- Image opacity 0-1 (default: 1, combines with element opacity)
|
---@field imageOpacity number? -- Image opacity 0-1 (default: 1, combines with element opacity)
|
||||||
|
---@field imageRepeat "no-repeat"|"repeat"|"repeat-x"|"repeat-y"|"space"|"round"? -- Image repeat/tiling mode (default: "no-repeat")
|
||||||
|
---@field imageTint Color? -- Color to tint the image (default: nil/white, no tint)
|
||||||
|
---@field onImageLoad fun(element:Element, image:love.Image)? -- Callback when image loads successfully
|
||||||
|
---@field onImageLoadDeferred boolean? -- Whether onImageLoad callback should be deferred (default: false)
|
||||||
|
---@field onImageError fun(element:Element, error:string)? -- Callback when image fails to load
|
||||||
|
---@field onImageErrorDeferred boolean? -- Whether onImageError callback should be deferred (default: false)
|
||||||
---@field _scrollX number? -- Internal: scroll X position (restored in immediate mode)
|
---@field _scrollX number? -- Internal: scroll X position (restored in immediate mode)
|
||||||
---@field _scrollY number? -- Internal: scroll Y position (restored in immediate mode)
|
---@field _scrollY number? -- Internal: scroll Y position (restored in immediate mode)
|
||||||
---@field userdata table? -- User-defined data storage for custom properties
|
---@field userdata table? -- User-defined data storage for custom properties
|
||||||
|
|||||||
Reference in New Issue
Block a user