Add generics annotations to component set_style/nodes/template

This commit is contained in:
Insality
2024-10-23 00:43:03 +03:00
parent aff4412677
commit 62384f36b3
4 changed files with 53 additions and 139 deletions

View File

@@ -99,4 +99,28 @@
---@param component T Component module
---@param ... any Other component params to pass it to component:init function
---@return T Component instance
function druid_instance.new(self, component, ...) end
function druid_instance.new(self, component, ...) end
--- Set current component style table.
--- Invoke `on_style_change` on component, if exist. Component should handle their style changing and store all style params
---@generic T: druid.base_component
---@param self T @{BaseComponent}
---@param druid_style table|nil Druid style module
---@return T @{BaseComponent}
function druid__base_component.set_style(self, druid_style) end
--- Set component template name.
--- Use on all your custom components with GUI layouts used as templates. It will check parent template name to build full template name in self:get_node()
---@generic T: druid.base_component
---@param self T @{BaseComponent}
---@param template string BaseComponent template name
---@return T @{BaseComponent}
function druid__base_component.set_template(self, template) end
--- Set current component nodes.
--- Use if your component nodes was cloned with `gui.clone_tree` and you got the node tree.
---@generic T: druid.base_component
---@param self T @{BaseComponent}
---@param nodes table BaseComponent nodes table
---@return T @{BaseComponent}
function druid__base_component.set_nodes(self, nodes) end