typings
This commit is contained in:
@@ -111,9 +111,15 @@ Public API methods to access internal state:
|
||||
---@field transform TransformProps -- Transform properties for animations and styling
|
||||
---@field transition TransitionProps -- Transition settings for animations
|
||||
---@field onEvent fun(element:Element, event:InputEvent)? -- Callback function for interaction events
|
||||
---@field onFocus fun(element:Element)? -- Callback function when element receives focus
|
||||
---@field onBlur fun(element:Element)? -- Callback function when element loses focus
|
||||
---@field onTextInput fun(element:Element, text:string)? -- Callback function for text input
|
||||
---@field onTextChange fun(element:Element, text:string)? -- Callback function when text changes
|
||||
---@field onEnter fun(element:Element)? -- Callback function when Enter key is pressed
|
||||
---@field units table -- Original unit specifications for responsive behavior
|
||||
---@field _eventHandler EventHandler -- Event handler instance for input processing
|
||||
---@field _explicitlyAbsolute boolean?
|
||||
---@field _originalPositioning Positioning? -- Original positioning value set by user
|
||||
---@field gridRows number? -- Number of rows in the grid
|
||||
---@field gridColumns number? -- Number of columns in the grid
|
||||
---@field columnGap number|string? -- Gap between grid columns
|
||||
@@ -121,6 +127,7 @@ Public API methods to access internal state:
|
||||
---@field theme string? -- Theme component to use for rendering
|
||||
---@field themeComponent string?
|
||||
---@field _themeState string? -- Current theme state (normal, hover, pressed, active, disabled)
|
||||
---@field _themeManager ThemeManager -- Internal: theme manager instance
|
||||
---@field _stateId string? -- State manager ID for this element
|
||||
---@field disabled boolean? -- Whether the element is disabled (default: false)
|
||||
---@field active boolean? -- Whether the element is active/focused (for inputs, default: false)
|
||||
@@ -161,6 +168,7 @@ Public API methods to access internal state:
|
||||
---@field _lines table? -- Internal: split lines for multi-line text
|
||||
---@field _wrappedLines table? -- Internal: wrapped line data
|
||||
---@field _textDirty boolean? -- Internal: flag to recalculate lines/wrapping
|
||||
---@field _textEditor TextEditor? -- Internal: TextEditor instance for editable elements
|
||||
---@field imagePath string? -- Path to image file (auto-loads via ImageCache)
|
||||
---@field image love.Image? -- Image object to display
|
||||
---@field objectFit "fill"|"contain"|"cover"|"scale-down"|"none"? -- Image fit mode (default: "fill")
|
||||
@@ -169,6 +177,38 @@ Public API methods to access internal state:
|
||||
---@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 userdata table?
|
||||
---@field _renderer Renderer -- Internal: Renderer instance for visual rendering
|
||||
---@field _layoutEngine LayoutEngine -- Internal: LayoutEngine instance for layout calculations
|
||||
---@field _scrollManager ScrollManager? -- Internal: ScrollManager instance for scroll handling
|
||||
---@field _borderBoxWidth number? -- Internal: cached border-box width
|
||||
---@field _borderBoxHeight number? -- Internal: cached border-box height
|
||||
---@field overflow string? -- Overflow behavior for both axes
|
||||
---@field overflowX string? -- Overflow behavior for horizontal axis
|
||||
---@field overflowY string? -- Overflow behavior for vertical axis
|
||||
---@field scrollbarWidth number? -- Scrollbar width in pixels
|
||||
---@field scrollbarColor Color? -- Scrollbar thumb color
|
||||
---@field scrollbarTrackColor Color? -- Scrollbar track color
|
||||
---@field scrollbarRadius number? -- Scrollbar corner radius
|
||||
---@field scrollbarPadding number? -- Scrollbar padding from edges
|
||||
---@field scrollSpeed number? -- Scroll speed multiplier
|
||||
---@field _overflowX boolean? -- Internal: whether content overflows horizontally
|
||||
---@field _overflowY boolean? -- Internal: whether content overflows vertically
|
||||
---@field _contentWidth number? -- Internal: total content width
|
||||
---@field _contentHeight number? -- Internal: total content height
|
||||
---@field _scrollX number? -- Internal: horizontal scroll position
|
||||
---@field _scrollY number? -- Internal: vertical scroll position
|
||||
---@field _maxScrollX number? -- Internal: maximum horizontal scroll
|
||||
---@field _maxScrollY number? -- Internal: maximum vertical scroll
|
||||
---@field _scrollbarHoveredVertical boolean? -- Internal: vertical scrollbar hover state
|
||||
---@field _scrollbarHoveredHorizontal boolean? -- Internal: horizontal scrollbar hover state
|
||||
---@field _scrollbarDragging boolean? -- Internal: scrollbar dragging state
|
||||
---@field _hoveredScrollbar table? -- Internal: currently hovered scrollbar info
|
||||
---@field _scrollbarDragOffset number? -- Internal: scrollbar drag offset
|
||||
---@field _scrollbarPressHandled boolean? -- Internal: scrollbar press handled flag
|
||||
---@field _pressed table? -- Internal: button press state tracking
|
||||
---@field _mouseDownPosition number? -- Internal: mouse down position for drag tracking
|
||||
---@field _textDragOccurred boolean? -- Internal: whether text drag occurred
|
||||
---@field animation table? -- Animation instance for this element
|
||||
local Element = {}
|
||||
Element.__index = Element
|
||||
|
||||
|
||||
@@ -8,6 +8,21 @@ local function getModifiers()
|
||||
end
|
||||
|
||||
---@class EventHandler
|
||||
---@field onEvent fun(element:Element, event:InputEvent)?
|
||||
---@field _pressed table<number, boolean>
|
||||
---@field _lastClickTime number?
|
||||
---@field _lastClickButton number?
|
||||
---@field _clickCount number
|
||||
---@field _dragStartX table<number, number>
|
||||
---@field _dragStartY table<number, number>
|
||||
---@field _lastMouseX table<number, number>
|
||||
---@field _lastMouseY table<number, number>
|
||||
---@field _touchPressed table<number, boolean>
|
||||
---@field _hovered boolean
|
||||
---@field _element Element?
|
||||
---@field _scrollbarPressHandled boolean
|
||||
---@field _InputEvent table
|
||||
---@field _GuiState table
|
||||
local EventHandler = {}
|
||||
EventHandler.__index = EventHandler
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---@class LayoutEngine
|
||||
---@field element Element Reference to the parent element
|
||||
---@field element Element? Reference to the parent element
|
||||
---@field positioning Positioning Layout positioning mode
|
||||
---@field flexDirection FlexDirection Direction of flex layout
|
||||
---@field justifyContent JustifyContent Alignment of items along main axis
|
||||
@@ -11,6 +11,16 @@
|
||||
---@field gridColumns number? Number of columns in the grid
|
||||
---@field columnGap number? Gap between grid columns
|
||||
---@field rowGap number? Gap between grid rows
|
||||
---@field _Grid table
|
||||
---@field _Units table
|
||||
---@field _Gui table
|
||||
---@field _Positioning table
|
||||
---@field _FlexDirection table
|
||||
---@field _JustifyContent table
|
||||
---@field _AlignContent table
|
||||
---@field _AlignItems table
|
||||
---@field _AlignSelf table
|
||||
---@field _FlexWrap table
|
||||
local LayoutEngine = {}
|
||||
LayoutEngine.__index = LayoutEngine
|
||||
|
||||
|
||||
@@ -1,10 +1,38 @@
|
||||
---@class Renderer
|
||||
---@field backgroundColor Color
|
||||
---@field borderColor Color
|
||||
---@field opacity number
|
||||
---@field border {top:boolean, right:boolean, bottom:boolean, left:boolean}
|
||||
---@field cornerRadius {topLeft:number, topRight:number, bottomLeft:number, bottomRight:number}
|
||||
---@field theme string?
|
||||
---@field themeComponent string?
|
||||
---@field _themeState string
|
||||
---@field imagePath string?
|
||||
---@field image love.Image?
|
||||
---@field _loadedImage love.Image?
|
||||
---@field objectFit string
|
||||
---@field objectPosition string
|
||||
---@field imageOpacity number
|
||||
---@field contentBlur {intensity:number, quality:number}?
|
||||
---@field backdropBlur {intensity:number, quality:number}?
|
||||
---@field _blurInstance table?
|
||||
---@field _element Element?
|
||||
---@field _Color table
|
||||
---@field _RoundedRect table
|
||||
---@field _NinePatch table
|
||||
---@field _ImageRenderer table
|
||||
---@field _ImageCache table
|
||||
---@field _Theme table
|
||||
---@field _Blur table
|
||||
---@field _utils table
|
||||
---@field _FONT_CACHE table
|
||||
---@field _TextAlign table
|
||||
local Renderer = {}
|
||||
Renderer.__index = Renderer
|
||||
|
||||
--- Create a new Renderer instance
|
||||
---@param config table Configuration table with rendering properties
|
||||
---@param deps table Dependencies {Color, RoundedRect, NinePatch, ImageRenderer, ImageCache, Theme, Blur, utils}
|
||||
---@return table Renderer instance
|
||||
function Renderer.new(config, deps)
|
||||
local Color = deps.Color
|
||||
local ImageCache = deps.ImageCache
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
---@field scrollbarPadding number -- Padding around scrollbar
|
||||
---@field scrollSpeed number -- Scroll speed for wheel events (pixels per wheel unit)
|
||||
---@field hideScrollbars table -- {vertical: boolean, horizontal: boolean}
|
||||
---@field _element table? -- Reference to parent Element (set via initialize)
|
||||
---@field _element Element? -- Reference to parent Element (set via initialize)
|
||||
---@field _overflowX boolean -- True if content overflows horizontally
|
||||
---@field _overflowY boolean -- True if content overflows vertically
|
||||
---@field _contentWidth number -- Total content width (including overflow)
|
||||
@@ -24,6 +24,7 @@
|
||||
---@field _hoveredScrollbar string? -- "vertical" or "horizontal" when dragging
|
||||
---@field _scrollbarDragOffset number -- Offset from thumb top when drag started
|
||||
---@field _scrollbarPressHandled boolean -- Track if scrollbar press was handled this frame
|
||||
---@field _Color table
|
||||
local ScrollManager = {}
|
||||
ScrollManager.__index = ScrollManager
|
||||
|
||||
|
||||
@@ -1,5 +1,49 @@
|
||||
local utf8 = utf8 or require("utf8")
|
||||
|
||||
---@class TextEditor
|
||||
---@field editable boolean
|
||||
---@field multiline boolean
|
||||
---@field passwordMode boolean
|
||||
---@field textWrap boolean|"word"|"char"
|
||||
---@field maxLines number?
|
||||
---@field maxLength number?
|
||||
---@field placeholder string?
|
||||
---@field inputType "text"|"number"|"email"|"url"
|
||||
---@field textOverflow "clip"|"ellipsis"|"scroll"
|
||||
---@field scrollable boolean
|
||||
---@field autoGrow boolean
|
||||
---@field selectOnFocus boolean
|
||||
---@field cursorColor Color?
|
||||
---@field selectionColor Color?
|
||||
---@field cursorBlinkRate number
|
||||
---@field _textBuffer string
|
||||
---@field _lines table?
|
||||
---@field _wrappedLines table?
|
||||
---@field _textDirty boolean
|
||||
---@field _cursorPosition number
|
||||
---@field _cursorLine number
|
||||
---@field _cursorColumn number
|
||||
---@field _cursorBlinkTimer number
|
||||
---@field _cursorVisible boolean
|
||||
---@field _cursorBlinkPaused boolean
|
||||
---@field _cursorBlinkPauseTimer number
|
||||
---@field _selectionStart number?
|
||||
---@field _selectionEnd number?
|
||||
---@field _selectionAnchor number?
|
||||
---@field _focused boolean
|
||||
---@field _textScrollX number
|
||||
---@field onFocus fun(element:Element)?
|
||||
---@field onBlur fun(element:Element)?
|
||||
---@field onTextInput fun(element:Element, text:string)?
|
||||
---@field onTextChange fun(element:Element, text:string)?
|
||||
---@field onEnter fun(element:Element)?
|
||||
---@field _element Element?
|
||||
---@field _GuiState table
|
||||
---@field _StateManager table
|
||||
---@field _Color table
|
||||
---@field _FONT_CACHE table
|
||||
---@field _getModifiers function
|
||||
---@field _textDragOccurred boolean?
|
||||
local TextEditor = {}
|
||||
TextEditor.__index = TextEditor
|
||||
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
---@field disableHighlight boolean -- If true, disable pressed highlight overlay
|
||||
---@field scaleCorners number? -- Scale multiplier for 9-patch corners/edges
|
||||
---@field scalingAlgorithm string? -- "nearest" or "bilinear" scaling for 9-patch
|
||||
---@field _element table? -- Reference to parent Element
|
||||
---@field _element Element? -- Reference to parent Element
|
||||
---@field _Theme table
|
||||
local ThemeManager = {}
|
||||
ThemeManager.__index = ThemeManager
|
||||
|
||||
|
||||
Reference in New Issue
Block a user