Update doc links, update emmylua generator

This commit is contained in:
Insality
2022-03-08 20:21:39 +02:00
parent a846adf97b
commit f801bb6862
27 changed files with 655 additions and 439 deletions

View File

@@ -6,7 +6,7 @@
-- @alias druid.checkbox
--- On change state callback(self, state)
-- @tfield druid_event on_change_state
-- @tfield DruidEvent on_change_state @{DruidEvent}
--- Visual node
-- @tfield node node
@@ -15,7 +15,7 @@
-- @tfield[opt=node] node click_node
--- Button component from click_node
-- @tfield Button button
-- @tfield Button button @{Button}
---
@@ -45,7 +45,7 @@ end
--- Component init function
-- @tparam Checkbox self
-- @tparam Checkbox self @{Checkbox}
-- @tparam node node Gui node
-- @tparam function callback Checkbox callback
-- @tparam[opt=node] node click_node Trigger node, by default equals to node
@@ -68,7 +68,7 @@ end
--- Set checkbox state
-- @tparam Checkbox self
-- @tparam Checkbox self @{Checkbox}
-- @tparam bool state Checkbox state
-- @tparam bool is_silent Don't trigger on_change_state if true
-- @tparam bool is_instant If instant checkbox change
@@ -85,7 +85,7 @@ end
--- Return checkbox state
-- @tparam Checkbox self
-- @tparam Checkbox self @{Checkbox}
-- @treturn bool Checkbox state
function Checkbox.get_state(self)
return self.state

View File

@@ -6,10 +6,10 @@
-- @alias druid.checkbox_group
--- On any checkbox click callback(self, index)
-- @tfield druid_event on_checkbox_click
-- @tfield DruidEvent on_checkbox_click @{DruidEvent}
--- Array of checkbox components
-- @tfield table checkboxes
-- @tfield table checkboxes @{Checkbox}
---
@@ -20,7 +20,7 @@ local CheckboxGroup = component.create("checkbox_group")
--- Component init function
-- @tparam CheckboxGroup self
-- @tparam CheckboxGroup self @{CheckboxGroup}
-- @tparam node[] nodes Array of gui node
-- @tparam function callback Checkbox callback
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
@@ -42,7 +42,7 @@ end
--- Set checkbox group state
-- @tparam CheckboxGroup self
-- @tparam CheckboxGroup self @{CheckboxGroup}
-- @tparam bool[] indexes Array of checkbox state
-- @tparam boolean is_instant If instant state change
function CheckboxGroup.set_state(self, indexes, is_instant)
@@ -55,7 +55,7 @@ end
--- Return checkbox group state
-- @tparam CheckboxGroup self
-- @tparam CheckboxGroup self @{CheckboxGroup}
-- @treturn bool[] Array if checkboxes state
function CheckboxGroup.get_state(self)
local result = {}

View File

@@ -8,10 +8,10 @@
--- The Druid scroll component
-- @tfield druid.scroll scroll
-- @tfield Scroll scroll @{Scroll}
--- The Druid Grid component
-- @tfield druid.static_grid grid
-- @tfield StaticGrid|DynamicGrid grid @{StaticGrid}, @{DynamicGrid}
--- The current visual top data index
-- @tfield number top_index
@@ -23,7 +23,7 @@
-- @tfield number scroll_progress
--- Event triggered when scroll progress is changed; event(self, progress_value)
-- @tfield druid_event on_scroll_progress_change
-- @tfield DruidEvent on_scroll_progress_change @{DruidEvent}
---
@@ -36,9 +36,9 @@ local DataList = component.create("data_list")
--- Data list constructor
-- @tparam DataList self
-- @tparam druid.scroll scroll The Scroll instance for Data List component
-- @tparam druid.grid grid The Grid instance for Data List component
-- @tparam DataList self @{DataList}
-- @tparam Scroll scroll The @{Scroll} instance for Data List component
-- @tparam StaticGrid|DynamicGrid grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component
-- @tparam function create_function The create function callback(self, data, index, data_list). Function should return (node, [component])
function DataList.init(self, scroll, grid, create_function)
self.druid = self:get_druid()
@@ -65,14 +65,14 @@ end
--- Druid System on_remove function
-- @tparam DataList self
-- @tparam DataList self @{DataList}
function DataList.on_remove(self)
self.scroll.on_scroll:unsubscribe(self._check_elements, self)
end
--- Set new data set for DataList component
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam table data The new data array
-- @treturn druid.data_list Current DataList instance
function DataList.set_data(self, data)
@@ -85,7 +85,7 @@ end
--- Add element to DataList. Currenly untested
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam table data
-- @tparam number index
-- @tparam number shift_policy The constant from const.SHIFT.*
@@ -113,7 +113,7 @@ end
--- Remove element from DataList. Currenly untested
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam number index
-- @tparam number shift_policy The constant from const.SHIFT.*
-- @local
@@ -124,7 +124,7 @@ end
--- Remove element from DataList by data value. Currenly untested
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam tabe data
-- @tparam number shift_policy The constant from const.SHIFT.*
-- @local
@@ -138,7 +138,7 @@ end
--- Clear the DataList and refresh visuals
-- @tparam DataList self
-- @tparam DataList self @{DataList}
function DataList.clear(self)
self._data = {}
self:_refresh()
@@ -146,28 +146,28 @@ end
--- Return first index from data. It not always equals to 1
-- @tparam DataList self
-- @tparam DataList self @{DataList}
function DataList.get_first_index(self)
return self._data_first_index
end
--- Return last index from data
-- @tparam DataList self
-- @tparam DataList self @{DataList}
function DataList.get_last_index(self)
return self._data_last_index
end
--- Return amount of data
-- @tparam DataList self
-- @tparam DataList self @{DataList}
function DataList.get_length(self)
return self._data_length
end
--- Return index for data value
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam table data
function DataList.get_index(self, data)
for index, value in pairs(self._data) do
@@ -181,7 +181,7 @@ end
--- Instant scroll to element with passed index
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam number index
function DataList.scroll_to_index(self, index)
local target = helper.clamp(index, self:get_first_index(), self:get_last_index())
@@ -195,7 +195,7 @@ end
--- Add element at passed index
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam number index
-- @local
function DataList._add_at(self, index)
@@ -213,7 +213,7 @@ end
--- Remove element from passed index
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam number index
-- @local
function DataList._remove_at(self, index)
@@ -230,7 +230,7 @@ end
--- Fully refresh all DataList elements
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @local
function DataList._refresh(self)
for index, _ in pairs(self._data_visual) do
@@ -241,7 +241,7 @@ end
--- Check elements which should be created
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @local
function DataList._check_elements(self)
for index, data in pairs(self._data_visual) do
@@ -279,7 +279,7 @@ end
--- Check elements which should be created.
-- Start from index with step until element is outside of scroll view
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @tparam number index
-- @tparam number step
-- @local
@@ -314,7 +314,7 @@ end
--- Update actual data params
-- @tparam DataList self
-- @tparam DataList self @{DataList}
-- @local
function DataList._update_data_info(self)
self._data_first_index = false

View File

@@ -6,19 +6,19 @@
-- @alias druid.dynamic_grid
--- On item add callback(self, node, index)
-- @tfield druid_event on_add_item
-- @tfield DruidEvent on_add_item @{DruidEvent}
--- On item remove callback(self, index)
-- @tfield druid_event on_remove_item
-- @tfield DruidEvent on_remove_item @{DruidEvent}
--- On item add or remove callback(self, index)
-- @tfield druid_event on_change_items
-- @tfield DruidEvent on_change_items @{DruidEvent}
--- On grid clear callback(self)
-- @tfield druid_event on_clear
-- @tfield DruidEvent on_clear @{DruidEvent}
--- On update item positions callback(self)
-- @tfield druid_event on_update_positions
-- @tfield DruidEvent on_update_positions @{DruidEvent}
--- Parent gui node
-- @tfield node parent
@@ -64,7 +64,7 @@ local AVAILABLE_PIVOTS = {
--- Component init function
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam node parent The gui node parent, where items will be placed
function DynamicGrid.init(self, parent)
self.parent = self:get_node(parent)
@@ -95,7 +95,7 @@ end
--- Return pos for grid node index
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam number index The grid element index
-- @tparam node node The node to be placed
-- @tparam[opt] number origin_index Index of nearby node
@@ -136,7 +136,7 @@ end
--- Add new node to the grid
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam node node Gui node
-- @tparam[opt] number index The node position. By default add as last node
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
@@ -179,11 +179,11 @@ end
--- Remove the item from the grid. Note that gui node will be not deleted
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam number index The grid node index to remove
-- @tparam[opt=SHIFT.RIGHT] number shift_policy How shift nodes, if required. See const.SHIFT
-- @tparam[opt=false] boolean is_instant If true, update node positions instantly
-- @treturn Node The deleted gui node from grid
-- @treturn node The deleted gui node from grid
function DynamicGrid.remove(self, index, shift_policy, is_instant)
shift_policy = shift_policy or const.SHIFT.RIGHT
local delta = shift_policy -- -1 or 1 or 0
@@ -216,7 +216,7 @@ end
--- Return grid content size
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam vector3 border
-- @treturn vector3 The grid content size
function DynamicGrid.get_size(self, border)
@@ -229,7 +229,7 @@ end
--- Return DynamicGrid offset, where DynamicGrid content starts.
-- @tparam DynamicGrid self The DynamicGrid instance
-- @tparam DynamicGrid self @{DynamicGrid} The DynamicGrid instance
-- @treturn vector3 The DynamicGrid offset
function DynamicGrid.get_offset(self)
local size = self:get_size()
@@ -244,7 +244,7 @@ end
--- Return grid content borders
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @treturn vector3 The grid content borders
function DynamicGrid.get_borders(self)
return self.border
@@ -252,7 +252,7 @@ end
--- Return grid index by node
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam node node The gui node in the grid
-- @treturn number The node index
function DynamicGrid.get_index_by_node(self, node)
@@ -267,7 +267,7 @@ end
--- Return array of all node positions
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @treturn vector3[] All grid node positions
function DynamicGrid.get_all_pos(self)
local result = {}
@@ -281,7 +281,7 @@ end
--- Change set position function for grid nodes. It will call on
-- update poses on grid elements. Default: gui.set_position
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam function callback Function on node set position
-- @treturn druid.dynamic_grid Current grid instance
function DynamicGrid.set_position_function(self, callback)
@@ -292,7 +292,7 @@ end
--- Clear grid nodes array. GUI nodes will be not deleted!
-- If you want to delete GUI nodes, use dynamic_grid.nodes array before grid:clear
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @treturn druid.dynamic_grid Current grid instance
function DynamicGrid.clear(self)
self.nodes = {}
@@ -319,7 +319,7 @@ end
--- Update grid inner state
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local
function DynamicGrid._update(self, is_instant)
@@ -330,7 +330,7 @@ end
--- Update first and last indexes of grid nodes
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @local
function DynamicGrid._update_indexes(self)
self.first_index = nil
@@ -346,7 +346,7 @@ end
--- Update grid content borders, recalculate min and max values
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @local
function DynamicGrid._update_borders(self)
if not self.first_index then
@@ -375,7 +375,7 @@ end
--- Update grid nodes position
-- @tparam DynamicGrid self
-- @tparam DynamicGrid self @{DynamicGrid}
-- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback
-- @local
function DynamicGrid._update_pos(self, is_instant)

View File

@@ -8,28 +8,28 @@
-- @alias druid.input
--- On input field select callback(self, button_node)
-- @tfield druid_event on_input_select
-- @tfield DruidEvent on_input_select @{DruidEvent}
--- On input field unselect callback(self, input_text)
-- @tfield druid_event on_input_unselect
-- @tfield DruidEvent on_input_unselect @{DruidEvent}
--- On input field text change callback(self, input_text)
-- @tfield druid_event on_input_text
-- @tfield DruidEvent on_input_text @{DruidEvent}
--- On input field text change to empty string callback(self, input_text)
-- @tfield druid_event on_input_empty
-- @tfield DruidEvent on_input_empty @{DruidEvent}
--- On input field text change to max length string callback(self, input_text)
-- @tfield druid_event on_input_full
-- @tfield DruidEvent on_input_full @{DruidEvent}
--- On trying user input with not allowed character callback(self, params, button_instance)
-- @tfield druid_event on_input_wrong
-- @tfield DruidEvent on_input_wrong @{DruidEvent}
--- Text component
-- @tfield druid.text text
-- @tfield Text text @{Text}
--- Button component
-- @tfield druid.button button
-- @tfield Button button @{Button}
--- Is current input selected now
-- @tfield bool is_selected
@@ -110,8 +110,10 @@ function Input.on_style_change(self, style)
end
--- Component init function
-- @tparam Input self @{Input}
-- @tparam node click_node Button node to enabled input component
-- @tparam node|druid.text text_node Text node what will be changed on user input. You can pass text component instead of text node name
-- @tparam node|Text text_node Text node what will be changed on user input. You can pass text component instead of text node name @{Text}
-- @tparam[opt] number keyboard_type Gui keyboard type for input field
function Input.init(self, click_node, text_node, keyboard_type)
self.druid = self:get_druid(self)
@@ -227,7 +229,7 @@ end
--- Set text for input field
-- @tparam Input self
-- @tparam Input self @{Input}
-- @tparam string input_text The string to apply for input field
function Input.set_text(self, input_text)
-- Case when update with marked text
@@ -274,7 +276,7 @@ end
--- Select input field. It will show the keyboard and trigger on_select events
-- @tparam Input self
-- @tparam Input self @{Input}
function Input.select(self)
gui.reset_keyboard()
self.marked_value = ""
@@ -297,7 +299,7 @@ end
--- Remove selection from input. It will hide the keyboard and trigger on_unselect events
-- @tparam Input self
-- @tparam Input self @{Input}
function Input.unselect(self)
gui.reset_keyboard()
self.marked_value = ""
@@ -315,7 +317,7 @@ end
--- Return current input field text
-- @tparam Input self
-- @tparam Input self @{Input}
-- @treturn string The current input field text
function Input.get_text(self)
return self.value .. self.marked_value
@@ -324,7 +326,7 @@ end
--- Set maximum length for input field.
-- Pass nil to make input field unliminted (by default)
-- @tparam Input self
-- @tparam Input self @{Input}
-- @tparam number max_length Maximum length for input text field
-- @treturn druid.input Current input instance
function Input.set_max_length(self, max_length)
@@ -336,7 +338,7 @@ end
--- Set allowed charaters for input field.
-- See: https://defold.com/ref/stable/string/
-- ex: [%a%d] for alpha and numeric
-- @tparam Input self
-- @tparam Input self @{Input}
-- @tparam string characters Regulax exp. for validate user input
-- @treturn druid.input Current input instance
function Input.set_allowed_characters(self, characters)
@@ -346,7 +348,7 @@ end
--- Reset current input selection and return previous value
-- @tparam Input self
-- @tparam Input self @{Input}
function Input.reset_changes(self)
self:set_text(self.previous_value)
self:unselect()

View File

@@ -7,10 +7,10 @@
-- @alias druid.lang_text
--- On change text callback
-- @tfield druid_event on_change
-- @tfield DruidEvent on_change @{DruidEvent}
--- The text component
-- @tfield Text text
-- @tfield Text text @{Text}
---
@@ -22,7 +22,7 @@ local LangText = component.create("lang_text")
--- Component init function
-- @tparam LangText self
-- @tparam LangText self @{LangText}
-- @tparam node node The text node
-- @tparam string locale_id Default locale id or text from node as default
-- @tparam bool no_adjust If true, will not correct text size
@@ -48,7 +48,7 @@ end
--- Setup raw text to lang_text component
-- @tparam LangText self
-- @tparam LangText self @{LangText}
-- @tparam string text Text for text node
-- @treturn LangText Current instance
function LangText.set_to(self, text)
@@ -61,7 +61,7 @@ end
--- Translate the text by locale_id
-- @tparam LangText self
-- @tparam LangText self @{LangText}
-- @tparam string locale_id Locale id
-- @tparam[opt] string a Optional param to string.format
-- @tparam[opt] string b Optional param to string.format
@@ -81,7 +81,7 @@ end
--- Format string with new text params on localized text
-- @tparam LangText self
-- @tparam LangText self @{LangText}
-- @tparam[opt] string a Optional param to string.format
-- @tparam[opt] string b Optional param to string.format
-- @tparam[opt] string c Optional param to string.format

View File

@@ -7,7 +7,7 @@
-- @alias druid.progress
--- On progress bar change callback(self, new_value)
-- @tfield druid_event on_change
-- @tfield DruidEvent on_change @{DruidEvent}
--- Progress bar fill node
-- @tfield node node
@@ -93,7 +93,7 @@ end
--- Component init function
-- @tparam Progress self
-- @tparam Progress self @{Progress}
-- @tparam string|node node Progress bar fill node or node name
-- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y
-- @tparam[opt=1] number init_value Initial value of progress bar
@@ -146,21 +146,21 @@ end
--- Fill a progress bar and stop progress animation
-- @tparam Progress self
-- @tparam Progress self @{Progress}
function Progress.fill(self)
set_bar_to(self, 1, true)
end
--- Empty a progress bar
-- @tparam Progress self
-- @tparam Progress self @{Progress}
function Progress.empty(self)
set_bar_to(self, 0, true)
end
--- Instant fill progress bar to value
-- @tparam Progress self
-- @tparam Progress self @{Progress}
-- @tparam number to Progress bar value, from 0 to 1
function Progress.set_to(self, to)
set_bar_to(self, to)
@@ -168,14 +168,14 @@ end
--- Return current progress bar value
-- @tparam Progress self
-- @tparam Progress self @{Progress}
function Progress.get(self)
return self.last_value
end
--- Set points on progress bar to fire the callback
-- @tparam Progress self
-- @tparam Progress self @{Progress}
-- @tparam number[] steps Array of progress bar values
-- @tparam function callback Callback on intersect step value
-- @usage progress:set_steps({0, 0.3, 0.6, 1}, function(self, step) end)
@@ -186,7 +186,7 @@ end
--- Start animation of a progress bar
-- @tparam Progress self
-- @tparam Progress self @{Progress}
-- @tparam number to value between 0..1
-- @tparam[opt] function callback Callback on animation ends
function Progress.to(self, to, callback)

View File

@@ -6,7 +6,7 @@
-- @alias druid.radio_group
--- On any checkbox click
-- @tfield druid_event on_radio_click
-- @tfield DruidEvent on_radio_click @{DruidEvent}
--- Array of checkbox components
-- @tfield Checkbox[] checkboxes
@@ -29,7 +29,7 @@ end
--- Component init function
-- @tparam RadioGroup self
-- @tparam RadioGroup self @{RadioGroup}
-- @tparam node[] nodes Array of gui node
-- @tparam function callback Radio callback
-- @tparam[opt=node] node[] click_nodes Array of trigger nodes, by default equals to nodes
@@ -51,7 +51,7 @@ end
--- Set radio group state
-- @tparam RadioGroup self
-- @tparam RadioGroup self @{RadioGroup}
-- @tparam number index Index in radio group
-- @tparam boolean is_instant If is instant state change
function RadioGroup.set_state(self, index, is_instant)
@@ -60,7 +60,7 @@ end
--- Return radio group state
-- @tparam RadioGroup self
-- @tparam RadioGroup self @{RadioGroup}
-- @treturn number Index in radio group
function RadioGroup.get_state(self)
local result = -1

View File

@@ -6,7 +6,7 @@
-- @alias druid.slider
--- On change value callback(self, value)
-- @tfield druid_event on_change_value
-- @tfield DruidEvent on_change_value @{DruidEvent}
--- Slider pin node
-- @tfield node node
@@ -55,7 +55,7 @@ end
--- Component init function
-- @tparam Slider self
-- @tparam Slider self @{Slider}
-- @tparam node node Gui pin node
-- @tparam vector3 end_pos The end position of slider
-- @tparam[opt] function callback On slider change callback
@@ -148,7 +148,7 @@ end
--- Set value for slider
-- @tparam Slider self
-- @tparam Slider self @{Slider}
-- @tparam number value Value from 0 to 1
-- @tparam[opt] bool is_silent Don't trigger event if true
function Slider.set(self, value, is_silent)
@@ -163,7 +163,7 @@ end
--- Set slider steps. Pin node will
-- apply closest step position
-- @tparam Slider self
-- @tparam Slider self @{Slider}
-- @tparam number[] steps Array of steps
-- @usage slider:set_steps({0, 0.2, 0.6, 1})
function Slider.set_steps(self, steps)

View File

@@ -8,13 +8,13 @@
-- @alias druid.timer
--- On timer tick. Fire every second callback(self, value)
-- @tfield druid_event on_tick
-- @tfield DruidEvent on_tick @{DruidEvent}
--- On timer change enabled state callback(self, is_enabled)
-- @tfield druid_event on_set_enabled
-- @tfield DruidEvent on_set_enabled @{DruidEvent}
--- On timer end callback
-- @tfield druid_event on_timer_end(self, Timer)
-- @tfield DruidEvent on_timer_end(self, Timer) @{DruidEvent}
--- Trigger node
-- @tfield node node
@@ -39,7 +39,7 @@ local Timer = component.create("timer")
--- Component init function
-- @tparam Timer self
-- @tparam Timer self @{Timer}
-- @tparam node node Gui text node
-- @tparam number seconds_from Start timer value in seconds
-- @tparam[opt=0] number seconds_to End timer value in seconds
@@ -94,7 +94,7 @@ end
--- Set text to text field
-- @tparam Timer self
-- @tparam Timer self @{Timer}
-- @tparam number set_to Value in seconds
function Timer.set_to(self, set_to)
self.last_value = set_to
@@ -103,7 +103,7 @@ end
--- Called when update
-- @tparam Timer self
-- @tparam Timer self @{Timer}
-- @tparam bool is_on Timer enable state
function Timer.set_state(self, is_on)
self.is_on = is_on
@@ -113,7 +113,7 @@ end
--- Set time interval
-- @tparam Timer self
-- @tparam Timer self @{Timer}
-- @tparam number from Start time in seconds
-- @tparam number to Target time in seconds
function Timer.set_interval(self, from, to)