From 86b92f90a795c76845126280954b69ca1d43a0fa Mon Sep 17 00:00:00 2001 From: Insality Date: Tue, 17 Oct 2023 21:09:45 +0300 Subject: [PATCH] Annotations update --- docs/modules/BaseComponent.html | 100 +++---- docs/modules/Blocker.html | 10 +- docs/modules/Button.html | 24 +- docs/modules/Checkbox.html | 12 +- docs/modules/CheckboxGroup.html | 8 +- docs/modules/DataList.html | 6 +- docs/modules/Drag.html | 16 +- docs/modules/DruidEvent.html | 8 +- docs/modules/DruidInstance.html | 36 +-- docs/modules/DynamicGrid.html | 4 +- docs/modules/Helper.html | 36 +-- docs/modules/Hotkey.html | 8 +- docs/modules/Hover.html | 16 +- docs/modules/Input.html | 14 +- docs/modules/Layout.html | 6 +- docs/modules/PinKnob.html | 6 +- docs/modules/Progress.html | 4 +- docs/modules/RadioGroup.html | 4 +- docs/modules/RichInput.html | 4 +- docs/modules/RichText.html | 36 ++- docs/modules/Scroll.html | 54 ++-- docs/modules/Slider.html | 10 +- docs/modules/StaticGrid.html | 10 +- docs/modules/Swipe.html | 6 +- docs/modules/Text.html | 10 +- docs/modules/Timer.html | 6 +- druid/annotations.lua | 358 ++++++++++++------------- druid/base/back_handler.lua | 2 +- druid/base/blocker.lua | 6 +- druid/base/button.lua | 24 +- druid/base/drag.lua | 14 +- druid/base/hover.lua | 14 +- druid/base/scroll.lua | 29 +- druid/base/static_grid.lua | 14 +- druid/base/text.lua | 6 +- druid/component.lua | 33 +-- druid/const.lua | 2 +- druid/custom/pin_knob/pin_knob.lua | 4 +- druid/custom/rich_input/rich_input.lua | 2 +- druid/custom/rich_text/rich_text.lua | 3 +- druid/event.lua | 8 +- druid/extended/checkbox.lua | 10 +- druid/extended/checkbox_group.lua | 6 +- druid/extended/data_list.lua | 4 +- druid/extended/dynamic_grid.lua | 6 +- druid/extended/hotkey.lua | 6 +- druid/extended/input.lua | 12 +- druid/extended/layout.lua | 4 +- druid/extended/progress.lua | 2 +- druid/extended/radio_group.lua | 2 +- druid/extended/slider.lua | 8 +- druid/extended/swipe.lua | 4 +- druid/extended/timer.lua | 4 +- druid/helper.lua | 28 +- druid/system/druid_instance.lua | 28 +- utils/annotations_manual.lua | 17 +- 56 files changed, 540 insertions(+), 574 deletions(-) diff --git a/docs/modules/BaseComponent.html b/docs/modules/BaseComponent.html index 33f3032..b05ce5a 100644 --- a/docs/modules/BaseComponent.html +++ b/docs/modules/BaseComponent.html @@ -98,67 +98,67 @@ return AwesomeComponent

Functions

- + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - +
component:get_childrens(self)get_childrens(self) Return all children components, recursive
component:get_context(self)get_context(self) Context used as first arg in all Druid events
component:get_druid(self)get_druid(self) Get Druid instance for inner component creation.
component:get_input_priority(self)get_input_priority(self) Return component input priority
component:get_name(self)get_name(self) Return component name
component:get_node(self, node_or_name)get_node(self, node_or_name) Get component node by name.
component:get_parent_component(self)get_parent_component(self) Return the parent component if exist
component:get_parent_name(self)get_parent_name(self) Return parent component name
component:get_template(self)get_template(self) Get current component template name.
component:get_uid(self)get_uid(self) Return component UID.
component:reset_input_priority(self)reset_input_priority(self) Reset component input priority to default value
component:set_input_enabled(self, state)set_input_enabled(self, state) Set component input state.
component:set_input_priority(self, value, is_temporary)set_input_priority(self, value, is_temporary) Set component input priority
component:set_nodes(self, nodes)set_nodes(self, nodes) Set current component nodes.
component:set_style(self, druid_style)set_style(self, druid_style) Set current component style table.
component:set_template(self, template)set_template(self, template) Set component template name.
@@ -171,8 +171,8 @@ return AwesomeComponent
- - component:get_childrens(self) + + get_childrens(self)
Return all children components, recursive @@ -198,8 +198,8 @@ return AwesomeComponent
- - component:get_context(self) + + get_context(self)
Context used as first arg in all Druid events Context is usually self of gui_script. @@ -225,8 +225,8 @@ return AwesomeComponent
- - component:get_druid(self) + + get_druid(self)
Get Druid instance for inner component creation. @@ -243,7 +243,7 @@ return AwesomeComponent

Returns:

    - Druid + DruidInstance Druid instance with component context
@@ -252,8 +252,8 @@ return AwesomeComponent
- - component:get_input_priority(self) + + get_input_priority(self)
Return component input priority @@ -279,8 +279,8 @@ return AwesomeComponent
- - component:get_name(self) + + get_name(self)
Return component name @@ -306,8 +306,8 @@ return AwesomeComponent
- - component:get_node(self, node_or_name) + + get_node(self, node_or_name)
Get component node by name. @@ -341,8 +341,8 @@ return AwesomeComponent
- - component:get_parent_component(self) + + get_parent_component(self)
Return the parent component if exist @@ -368,8 +368,8 @@ return AwesomeComponent
- - component:get_parent_name(self) + + get_parent_name(self)
Return parent component name @@ -395,8 +395,8 @@ return AwesomeComponent
- - component:get_template(self) + + get_template(self)
Get current component template name. @@ -422,8 +422,8 @@ return AwesomeComponent
- - component:get_uid(self) + + get_uid(self)
Return component UID. @@ -450,8 +450,8 @@ return AwesomeComponent
- - component:reset_input_priority(self) + + reset_input_priority(self)
Reset component input priority to default value @@ -477,8 +477,8 @@ return AwesomeComponent
- - component:set_input_enabled(self, state) + + set_input_enabled(self, state)
Set component input state. By default it enabled @@ -492,7 +492,7 @@ return AwesomeComponent BaseComponent
  • state - bool + boolean The component input state
  • @@ -509,8 +509,8 @@ return AwesomeComponent
    - - component:set_input_priority(self, value, is_temporary) + + set_input_priority(self, value, is_temporary)
    Set component input priority Default value: 10 @@ -544,8 +544,8 @@ return AwesomeComponent
    - - component:set_nodes(self, nodes) + + set_nodes(self, nodes)
    Set current component nodes. @@ -582,8 +582,8 @@ self:set_nodes(nodes)
    - - component:set_style(self, druid_style) + + set_style(self, druid_style)
    Set current component style table. @@ -615,8 +615,8 @@ self:set_nodes(nodes)
    - - component:set_template(self, template) + + set_template(self, template)
    Set component template name. diff --git a/docs/modules/Blocker.html b/docs/modules/Blocker.html index a27a4fc..de139c1 100644 --- a/docs/modules/Blocker.html +++ b/docs/modules/Blocker.html @@ -95,7 +95,7 @@ local blocker = self.druid:new_blocker(node) - + @@ -126,7 +126,7 @@ local blocker = self.druid:new_blocker(node) init(self, node)
    - Blocker constructor + The Blocker constructor

    Parameters:

    @@ -165,8 +165,8 @@ local blocker = self.druid:new_blocker(node)

    Returns:

      - bool - True, if blocker is enabled + boolean + @True, if blocker is enabled
    @@ -189,7 +189,7 @@ local blocker = self.druid:new_blocker(node) Blocker
  • state - bool + boolean Enabled state
  • diff --git a/docs/modules/Button.html b/docs/modules/Button.html index f4d6b1b..72b228b 100644 --- a/docs/modules/Button.html +++ b/docs/modules/Button.html @@ -97,7 +97,7 @@ print("Also the button component is passed in callback params") end -local custom_args = "Any variable to pass inside callback" +local custom_args = "any variable to pass inside callback" local button = self.druid:new_button("button_name", on_button_click, custom_args) @@ -254,7 +254,7 @@ local button = self.druid:new_button("button_name", on_button_click, c Button
  • node - string or Node + string or node Node name or GUI Node itself
  • callback @@ -267,7 +267,7 @@ local button = self.druid:new_button("button_name", on_button_click, c (optional)
  • anim_node - string or Node + string or node Node to animate instead of trigger node. (optional)
  • @@ -298,8 +298,8 @@ local button = self.druid:new_button("button_name", on_button_click, c

    Returns:

      - bool - True, if button is enabled now, False overwise + boolean + @True, if button is enabled now, False overwise
    @@ -401,7 +401,7 @@ local button = self.druid:new_button("button_name", on_button_click, c Button
  • state - bool + boolean Enabled state
  • @@ -529,23 +529,23 @@ button:set_enabled(true)
  • on_click function - (self, node) + function(self, node)
  • on_click_disabled function - (self, node) + function(self, node)
  • on_hover function - (self, node, hover_state) + function(self, node, hover_state)
  • on_mouse_hover function - (self, node, hover_state) + function(self, node, hover_state)
  • on_set_enabled function - (self, node, enabled_state) + function(self, node, enabled_state)
  • @@ -632,7 +632,7 @@ button:set_enabled(true)
    • node - Node + node
    diff --git a/docs/modules/Checkbox.html b/docs/modules/Checkbox.html index f58de1e..ba5f545 100644 --- a/docs/modules/Checkbox.html +++ b/docs/modules/Checkbox.html @@ -88,7 +88,7 @@
    - + @@ -148,7 +148,7 @@

    Returns:

      - bool + boolean Checkbox state
    @@ -161,7 +161,7 @@ init(self, node, callback[, click_node=node[, initial_state=false]])
    - Component init function + The Checkbox constructor

    Parameters:

    @@ -210,15 +210,15 @@ Checkbox
  • state - bool + boolean Checkbox state
  • is_silent - bool + boolean Don't trigger on_change_state if true
  • is_instant - bool + boolean If instant checkbox change
  • diff --git a/docs/modules/CheckboxGroup.html b/docs/modules/CheckboxGroup.html index ad693a4..726759c 100644 --- a/docs/modules/CheckboxGroup.html +++ b/docs/modules/CheckboxGroup.html @@ -87,7 +87,7 @@
    - + @@ -132,7 +132,7 @@

    Returns:

      - bool[] + boolean[] Array if checkboxes state
    @@ -145,7 +145,7 @@ init(self, nodes, callback[, click_nodes=node])
    - Component init function + The CheckboxGroup constructor

    Parameters:

    @@ -189,7 +189,7 @@ CheckboxGroup
  • indexes - bool[] + boolean[] Array of checkbox state
  • is_instant diff --git a/docs/modules/DataList.html b/docs/modules/DataList.html index 5fe3996..8003f36 100644 --- a/docs/modules/DataList.html +++ b/docs/modules/DataList.html @@ -117,7 +117,7 @@
  • - + @@ -242,7 +242,7 @@

    Returns:

      - Node[] + node[] List of created nodes
    @@ -370,7 +370,7 @@ init(self, scroll, grid, create_function)
    - Data list constructor + The DataList constructor

    Parameters:

    diff --git a/docs/modules/Drag.html b/docs/modules/Drag.html index b6868c1..7cec624 100644 --- a/docs/modules/Drag.html +++ b/docs/modules/Drag.html @@ -88,7 +88,7 @@
    init(self, node)Blocker constructorThe Blocker constructor
    is_enabled(self)
    init(self, node, callback[, click_node=node[, initial_state=false]])Component init functionThe Checkbox constructor
    set_state(self, state, is_silent, is_instant)
    init(self, nodes, callback[, click_nodes=node])Component init functionThe CheckboxGroup constructor
    set_state(self, indexes, is_instant)
    init(self, scroll, grid, create_function)Data list constructorThe DataList constructor
    on_remove(self)
    - + @@ -174,7 +174,7 @@ init(self, node, on_drag_callback)
    - Drag component constructor + The Drag constructor

    Parameters:

    @@ -217,7 +217,7 @@

    Returns:

      - bool + boolean
    @@ -266,7 +266,7 @@ Drag
  • is_enabled - bool + boolean
  • @@ -323,7 +323,7 @@
    • can_x - bool + boolean
    @@ -343,7 +343,7 @@
    • can_y - bool + boolean
    @@ -363,7 +363,7 @@
    • is_drag - bool + boolean
    @@ -383,7 +383,7 @@
    • is_touch - bool + boolean
    diff --git a/docs/modules/DruidEvent.html b/docs/modules/DruidEvent.html index d707bfe..bd16b36 100644 --- a/docs/modules/DruidEvent.html +++ b/docs/modules/DruidEvent.html @@ -191,7 +191,7 @@

    Returns:

      - bool + boolean True if event have handlers
    @@ -222,7 +222,7 @@ Callback itself
  • context - Any + any Additional context as first param to callback call, usually it's self (optional)
  • @@ -257,7 +257,7 @@ button.on_long_click:subscribe(on_long_callback, self) DruidEvent
  • ... - Any + any All event params
  • @@ -293,7 +293,7 @@ event:trigger("Param1", "Param2 Callback itself
  • context - Any + any Additional context as first param to callback call (optional)
  • diff --git a/docs/modules/DruidInstance.html b/docs/modules/DruidInstance.html index 6c36ecc..b50afa3 100644 --- a/docs/modules/DruidInstance.html +++ b/docs/modules/DruidInstance.html @@ -178,7 +178,7 @@ end
    - + @@ -302,11 +302,11 @@ end
  • component - Component + BaseComponent Component module
  • ... - args + any Other component params to pass it to component:init function
  • @@ -331,8 +331,8 @@ end
  • callback - callback - On back button + function + @The callback(self, custom_args) to call on back event
  • params any @@ -532,8 +532,8 @@ end The Scroll instance for Data List component
  • druid_grid - Grid - The Grid instance for Data List component + StaticGrid or DynamicGrid + The StaticGrid or DynamicGrid instance for Data List component
  • create_function function @@ -620,7 +620,7 @@ end
    - new_hotkey(self, keys_array, callback[, params]) + new_hotkey(self, keys_array, callback[, callback_argument])
    Create Hotkey component @@ -638,11 +638,11 @@ end
  • callback function - Button callback + The callback function
  • -
  • params - value - Button callback params +
  • callback_argument + any + The argument to pass into the callback function (optional)
  • @@ -756,7 +756,7 @@ end Default locale id
  • no_adjust - bool + boolean If true, will not correct text size
  • @@ -1099,7 +1099,7 @@ end (optional)
  • no_adjust - bool + boolean If true, text will be not auto-adjust size (optional)
  • @@ -1189,7 +1189,7 @@ end

    Returns:

      - bool + boolean The boolean value is input was consumed
    @@ -1247,7 +1247,7 @@ end
  • component - Component + BaseComponent Component instance
  • @@ -1274,7 +1274,7 @@ end DruidInstance
  • blacklist_components - table or Component + table or BaseComponent The array of component to blacklist (default nil)
  • @@ -1308,7 +1308,7 @@ end
  • whitelist_components - table or Component + table or BaseComponent The array of component to whitelist (default nil)
  • diff --git a/docs/modules/DynamicGrid.html b/docs/modules/DynamicGrid.html index 67583d1..748e674 100644 --- a/docs/modules/DynamicGrid.html +++ b/docs/modules/DynamicGrid.html @@ -119,7 +119,7 @@ - + @@ -467,7 +467,7 @@ init(self, parent)
    - Component init function + The DynamicGrid constructor

    Parameters:

    diff --git a/docs/modules/Helper.html b/docs/modules/Helper.html index 5887232..8999078 100644 --- a/docs/modules/Helper.html +++ b/docs/modules/Helper.html @@ -143,7 +143,7 @@ helper.centrate_nodes(0, node_1, node_2)
    - + @@ -198,11 +198,11 @@ helper.centrate_nodes(0, node_1, node_2)

    Parameters:

    • target - table + any[] Array to put elements from source
    • source - table + any[] The source array to get elements from (optional)
    • @@ -211,7 +211,7 @@ helper.centrate_nodes(0, node_1, node_2)

      Returns:

        - array + any[] The target array
      @@ -471,8 +471,8 @@ helper.centrate_nodes(0, node_1, node_2)

      Parameters:

      • pivot - gui.pivot - The node pivot + number + The gui.PIVOT_* constant
      @@ -529,7 +529,7 @@ helper.centrate_nodes(0, node_1, node_2) Gui node
    • include_passed_node_scale - bool + boolean True if add current node scale to result
    @@ -579,7 +579,7 @@ helper.centrate_nodes(0, node_1, node_2)

    Parameters:

    • text_node - Node + node
    @@ -606,7 +606,7 @@ helper.centrate_nodes(0, node_1, node_2)
    - helper.insert_with_shift(array, item[, index[, shift_policy]]) + helper.insert_with_shift(array, any[, index[, shift_policy]])
    Add value to array with shift policy Shift policy can be: left, right, no_shift @@ -618,7 +618,7 @@ helper.centrate_nodes(0, node_1, node_2) table Array -
  • item +
  • any Item to insert
  • index @@ -627,8 +627,8 @@ helper.centrate_nodes(0, node_1, node_2) (optional)
  • shift_policy - const.SHIFT - Shift policy + number + The druid_const.SHIFT.* constant (optional)
  • @@ -636,7 +636,7 @@ helper.centrate_nodes(0, node_1, node_2)

    Returns:

      - item + any Inserted item
    @@ -656,7 +656,7 @@ helper.centrate_nodes(0, node_1, node_2)

    Returns:

      - bool + boolean Is mobile
    @@ -676,7 +676,7 @@ helper.centrate_nodes(0, node_1, node_2)

    Returns:

      - bool + boolean Is web
    @@ -739,8 +739,8 @@ helper.centrate_nodes(0, node_1, node_2) (optional)
  • shift_policy - const.SHIFT - Shift policy + number + The druid_const.SHIFT.* constant (optional)
  • @@ -748,7 +748,7 @@ helper.centrate_nodes(0, node_1, node_2)

    Returns:

      - item + any Removed item
    diff --git a/docs/modules/Hotkey.html b/docs/modules/Hotkey.html index f8a1611..3621846 100644 --- a/docs/modules/Hotkey.html +++ b/docs/modules/Hotkey.html @@ -88,7 +88,7 @@
    - +
    init(self, node, on_drag_callback)Drag component constructorThe Drag constructor
    is_enabled(self) Create DynamicGrid component
    new_hotkey(self, keys_array, callback[, params])new_hotkey(self, keys_array, callback[, callback_argument]) Create Hotkey component
    init(self, parent)Component init functionThe DynamicGrid constructor
    remove(self, index[, shift_policy=SHIFT.RIGHT[, is_instant=false]]) Get text metric from GUI node.
    helper.insert_with_shift(array, item[, index[, shift_policy]])helper.insert_with_shift(array, any[, index[, shift_policy]]) Add value to array with shift policy
    init(self, keys, callback[, callback_argument])Component init functionThe Hotkey constructor

    Tables

    @@ -144,7 +144,7 @@ that have to be pressed before key pressed to activate
  • callback_argument - value + any The argument to pass into the callback function (optional)
  • @@ -160,7 +160,7 @@ init(self, keys, callback[, callback_argument])
    - Component init function + The Hotkey constructor

    Parameters:

    @@ -178,7 +178,7 @@ The callback function
  • callback_argument - value + any The argument to pass into the callback function (optional)
  • diff --git a/docs/modules/Hover.html b/docs/modules/Hover.html index b4306b8..ef2d206 100644 --- a/docs/modules/Hover.html +++ b/docs/modules/Hover.html @@ -83,7 +83,7 @@ - + @@ -138,7 +138,7 @@ init(self, node, on_hover_callback)
    - Component init function + The Hover constructor

    Parameters:

    @@ -181,7 +181,7 @@

    Returns:

      - bool + boolean The hover enabled state
    @@ -208,7 +208,7 @@

    Returns:

      - bool + boolean The current hovered state
    @@ -235,7 +235,7 @@

    Returns:

      - bool + boolean The current hovered state
    @@ -286,7 +286,7 @@ Hover
  • state - bool + boolean The hover enabled state
  • @@ -311,7 +311,7 @@ Hover
  • state - bool + boolean The hover state
  • @@ -336,7 +336,7 @@ Hover
  • state - bool + boolean The mouse hover state
  • diff --git a/docs/modules/Input.html b/docs/modules/Input.html index a213dc2..092cd07 100644 --- a/docs/modules/Input.html +++ b/docs/modules/Input.html @@ -94,7 +94,7 @@
    - + @@ -223,7 +223,7 @@ init(self, click_node, text_node[, keyboard_type])
    - Component init function + The Input constructor

    Parameters:

    @@ -422,7 +422,7 @@

    Fields:

    • IS_LONGTAP_ERASE - bool + boolean Is long tap will erase current input data (default false)
    • @@ -432,12 +432,12 @@ (default *)
    • IS_UNSELECT_ON_RESELECT - bool + boolean If true, call unselect on select selected input (default false)
    • NO_CONSUME_INPUT_WHILE_SELECTED - bool + boolean If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured) (default false)
    • @@ -519,7 +519,7 @@
      • is_empty - bool + boolean
      @@ -539,7 +539,7 @@
      • is_selected - bool + boolean
      diff --git a/docs/modules/Layout.html b/docs/modules/Layout.html index e154aa3..a19a24e 100644 --- a/docs/modules/Layout.html +++ b/docs/modules/Layout.html @@ -95,7 +95,7 @@
    - + @@ -156,7 +156,7 @@ Layout
  • node - Node + node (optional)
  • @@ -236,7 +236,7 @@ init(self, node, mode[, on_size_changed_callback])
    - Component init function + The Layout constructor

    Parameters:

    diff --git a/docs/modules/PinKnob.html b/docs/modules/PinKnob.html index 9b4a757..6e58444 100644 --- a/docs/modules/PinKnob.html +++ b/docs/modules/PinKnob.html @@ -84,7 +84,7 @@
    init(self, node, on_hover_callback)Component init functionThe Hover constructor
    is_enabled(self)
    init(self, click_node, text_node[, keyboard_type])Component init functionThe Input constructor
    reset_changes(self)
    init(self, node, mode[, on_size_changed_callback])Component init functionThe Layout constructor
    set_max_gui_upscale(self, max_gui_upscale)
    - + @@ -123,7 +123,7 @@ init(self, callback, template, nodes)
    - Component init function + The PinKnob constructor

    Parameters:

    @@ -256,7 +256,7 @@
    • is_drag - bool + boolean
    diff --git a/docs/modules/Progress.html b/docs/modules/Progress.html index 089717c..0f490b7 100644 --- a/docs/modules/Progress.html +++ b/docs/modules/Progress.html @@ -104,7 +104,7 @@
    - + @@ -237,7 +237,7 @@ init(self, node, key[, init_value=1])
    - Progress constructor + The Progress constructor

    Parameters:

    diff --git a/docs/modules/RadioGroup.html b/docs/modules/RadioGroup.html index 741e33f..c08c25c 100644 --- a/docs/modules/RadioGroup.html +++ b/docs/modules/RadioGroup.html @@ -87,7 +87,7 @@
    - + @@ -145,7 +145,7 @@ init(self, nodes, callback[, click_nodes=node])
    - Component init function + The RadioGroup constructor

    Parameters:

    diff --git a/docs/modules/RichInput.html b/docs/modules/RichInput.html index 797c9d0..c9d71b2 100644 --- a/docs/modules/RichInput.html +++ b/docs/modules/RichInput.html @@ -84,7 +84,7 @@
    init(self, callback, template, nodes)Component init functionThe PinKnob constructor
    set_angle(self, cur_value, min, max)
    init(self, node, key[, init_value=1])Progress constructorThe Progress constructor
    set_max_size(self, max_size)
    init(self, nodes, callback[, click_nodes=node])Component init functionThe RadioGroup constructor
    set_state(self, index, is_instant)
    - + @@ -123,7 +123,7 @@ init(self, template, nodes)
    - Component init function + The RichInput constructor

    Parameters:

    diff --git a/docs/modules/RichText.html b/docs/modules/RichText.html index f53e531..372c37e 100644 --- a/docs/modules/RichText.html +++ b/docs/modules/RichText.html @@ -34,6 +34,7 @@ @@ -163,7 +164,7 @@ type druid.rich_text.metrics = {
    - + @@ -181,6 +182,13 @@ type druid.rich_text.metrics = {
    init(self, template, nodes)Component init functionThe RichInput constructor
    set_placeholder(self, placeholder_text)
    init(self, template, nodes)Rich Text component constructorThe RichText constructor
    set_text(self, text)Component style params.
    +

    Fields

    + + + + + +
    druidThe component druid instance


    @@ -248,7 +256,7 @@ type druid.rich_text.metrics = { init(self, template, nodes)
    - Rich Text component constructor + The RichText constructor

    Parameters:

    @@ -415,6 +423,30 @@ Words <nobr>inside tag</nobr> won't break +
    +

    Fields

    + +
    +
    + + druid +
    +
    + The component druid instance + + + + + + + +
    diff --git a/docs/modules/Scroll.html b/docs/modules/Scroll.html index bcf92e0..2ab3fb0 100644 --- a/docs/modules/Scroll.html +++ b/docs/modules/Scroll.html @@ -117,7 +117,7 @@ init(self, view_node, content_node) - Scroll constructor + The Scroll constructor is_inert(self) @@ -202,10 +202,6 @@ Flag, if scroll now animating by gui.animate - is_inert - Flag, if scroll now moving by inertion - - on_point_scroll On scroll_to_index function callback(self, index, point) @@ -334,7 +330,7 @@ init(self, view_node, content_node)
    - Scroll constructor + The Scroll constructor

    Parameters:

    @@ -377,8 +373,8 @@

    Returns:

      - bool - If scroll have inertion + boolean + @If scroll have inertion
    @@ -436,7 +432,7 @@ Target point
  • is_instant - bool + boolean Instant scroll flag (optional)
  • @@ -471,7 +467,7 @@ Point index
  • skip_cb - bool + boolean If true, skip the point callback (optional)
  • @@ -501,7 +497,7 @@ target percent
  • is_instant - bool + boolean instant scroll flag (optional)
  • @@ -590,7 +586,7 @@ Scroll
  • state - bool + boolean True, if horizontal scroll is enabled
  • @@ -623,7 +619,7 @@ Scroll
  • state - bool + boolean Inert scroll state
  • @@ -722,7 +718,7 @@ Scroll
  • state - bool + boolean True, if vertical scroll is enabled
  • @@ -795,22 +791,22 @@ (default 0)
  • SMALL_CONTENT_SCROLL - bool + boolean If true, content node with size less than view node size can be scrolled (default false)
  • WHEEL_SCROLL_SPEED - bool + boolean The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling (default 0)
  • WHEEL_SCROLL_INVERTED - bool + boolean If true, invert direction for touchpad and mouse wheel scroll (default false)
  • WHEEL_SCROLL_BY_INERTION - bool + boolean If true, wheel will add inertion to scroll. Direct set position otherwise. (default false)
  • @@ -935,27 +931,7 @@ - - - - - -
    -
    - - is_inert -
    -
    - Flag, if scroll now moving by inertion - - - diff --git a/docs/modules/Slider.html b/docs/modules/Slider.html index 1da2b7a..b30fe11 100644 --- a/docs/modules/Slider.html +++ b/docs/modules/Slider.html @@ -83,7 +83,7 @@ - + @@ -150,7 +150,7 @@ init(self, node, end_pos[, callback])
    - Component init function + The Slider constructor

    Parameters:

    @@ -198,7 +198,7 @@ Value from 0 to 1
  • is_silent - bool + boolean Don't trigger event if true (optional)
  • @@ -227,7 +227,7 @@ Slider
  • input_node - Node + node
  • @@ -333,7 +333,7 @@
    • is_drag - bool + boolean
    diff --git a/docs/modules/StaticGrid.html b/docs/modules/StaticGrid.html index be25781..986f9ca 100644 --- a/docs/modules/StaticGrid.html +++ b/docs/modules/StaticGrid.html @@ -463,7 +463,7 @@
      vector3 - Node position + @Node position
    @@ -512,7 +512,7 @@ StaticGrid
  • parent - string or Node + string or node The GUI Node container, where grid's items will be placed
  • element @@ -564,7 +564,7 @@

    Returns:

      - Node + node The deleted gui node from grid
    @@ -677,12 +677,12 @@

    Fields:

    • IS_DYNAMIC_NODE_POSES - bool + boolean If true, always center grid content as grid pivot sets (default false)
    • IS_ALIGN_LAST_ROW - bool + boolean If true, always align last row of the grid as grid pivot sets (default false)
    • diff --git a/docs/modules/Swipe.html b/docs/modules/Swipe.html index aba9737..7dc7d10 100644 --- a/docs/modules/Swipe.html +++ b/docs/modules/Swipe.html @@ -87,7 +87,7 @@
  • init(self, node, end_pos[, callback])Component init functionThe Slider constructor
    set(self, value[, is_silent])
    - + @@ -129,7 +129,7 @@ init(self, node, on_swipe_callback)
    - Component init function + The Swipe constructor

    Parameters:

    @@ -206,7 +206,7 @@ (default 50)
  • SWIPE_TRIGGER_ON_MOVE - bool + boolean If true, trigger on swipe moving, not only release action (default false)
  • diff --git a/docs/modules/Text.html b/docs/modules/Text.html index 6d1295f..d14822a 100644 --- a/docs/modules/Text.html +++ b/docs/modules/Text.html @@ -110,7 +110,7 @@
    - + @@ -280,7 +280,7 @@ init(self, node[, value[, adjust_type=downscale]])
    - Text constructor + The Text constructor

    Parameters:

    @@ -329,7 +329,7 @@

    Returns:

      - bool + boolean Is text node with line break
    @@ -445,8 +445,8 @@ Text
  • pivot - gui.pivot - Gui pivot constant + number + The gui.PIVOT_* constant
  • diff --git a/docs/modules/Timer.html b/docs/modules/Timer.html index 7193ae1..958899f 100644 --- a/docs/modules/Timer.html +++ b/docs/modules/Timer.html @@ -85,7 +85,7 @@
    init(self, node, on_swipe_callback)Component init functionThe Swipe constructor
    set_click_zone(self, zone)
    init(self, node[, value[, adjust_type=downscale]])Text constructorThe Text constructor
    is_multiline(self)
    - + @@ -144,7 +144,7 @@ init(self, node, seconds_from[, seconds_to=0[, callback]])
    - Component init function + The Timer constructor

    Parameters:

    @@ -222,7 +222,7 @@ Timer
  • is_on - bool + boolean Timer enable state
  • diff --git a/druid/annotations.lua b/druid/annotations.lua index 2d4d340..f053e8a 100644 --- a/druid/annotations.lua +++ b/druid/annotations.lua @@ -1,5 +1,8 @@ -- luacheck: ignore - +---@diagnostic disable: lowercase-global +---@diagnostic disable: missing-return +---@diagnostic disable: duplicate-doc-param +---@diagnostic disable: duplicate-set-field ---@class druid local druid = {} @@ -53,68 +56,68 @@ local druid__base_component = {} --- Return all children components, recursive ---@param self druid.base_component @{BaseComponent} ---@return table Array of childrens if the Druid component instance -function druid__base_component.component:get_childrens(self) end +function druid__base_component.get_childrens(self) end --- Context used as first arg in all Druid events --- Context is usually self of gui_script. ---@param self druid.base_component @{BaseComponent} ---@return table BaseComponent context -function druid__base_component.component:get_context(self) end +function druid__base_component.get_context(self) end --- Get Druid instance for inner component creation. ---@param self druid.base_component @{BaseComponent} ----@return Druid Druid instance with component context -function druid__base_component.component:get_druid(self) end +---@return druid_instance Druid instance with component context +function druid__base_component.get_druid(self) end --- Return component input priority ---@param self druid.base_component @{BaseComponent} ---@return number The component input priority -function druid__base_component.component:get_input_priority(self) end +function druid__base_component.get_input_priority(self) end --- Return component name ---@param self druid.base_component @{BaseComponent} ---@return string The component name -function druid__base_component.component:get_name(self) end +function druid__base_component.get_name(self) end --- Get component node by name. --- If component has nodes, node_or_name should be string It autopick node by template name or from nodes by gui.clone_tree if they was setup via component:set_nodes, component:set_template. If node is not found, the exception will fired ---@param self druid.base_component @{BaseComponent} ---@param node_or_name string|node Node name or node itself ---@return node Gui node -function druid__base_component.component:get_node(self, node_or_name) end +function druid__base_component.get_node(self, node_or_name) end --- Return the parent component if exist ---@param self druid.base_component @{BaseComponent} ----@return BaseComponent|nil The druid component instance or nil -function druid__base_component.component:get_parent_component(self) end +---@return druid.base_component|nil The druid component instance or nil +function druid__base_component.get_parent_component(self) end --- Return parent component name ---@param self druid.base_component @{BaseComponent} ---@return string|nil The parent component name if exist or bil -function druid__base_component.component:get_parent_name(self) end +function druid__base_component.get_parent_name(self) end --- Get current component template name. ---@param self druid.base_component @{BaseComponent} ---@return string Component full template name -function druid__base_component.component:get_template(self) end +function druid__base_component.get_template(self) end --- Return component UID. --- UID generated in component creation order. ---@param self druid.base_component @{BaseComponent} ---@return number The component uid -function druid__base_component.component:get_uid(self) end +function druid__base_component.get_uid(self) end --- Reset component input priority to default value ---@param self druid.base_component @{BaseComponent} ---@return number The component input priority -function druid__base_component.component:reset_input_priority(self) end +function druid__base_component.reset_input_priority(self) end --- Set component input state. --- By default it enabled If input is disabled, the component will not receive input events ---@param self druid.base_component @{BaseComponent} ----@param state bool The component input state +---@param state boolean The component input state ---@return druid.base_component BaseComponent itself -function druid__base_component.component:set_input_enabled(self, state) end +function druid__base_component.set_input_enabled(self, state) end --- Set component input priority --- Default value: 10 @@ -122,48 +125,48 @@ function druid__base_component.component:set_input_enabled(self, state) end ---@param value number The new input priority value ---@param is_temporary boolean If true, the reset input priority will return to previous value ---@return number The component input priority -function druid__base_component.component:set_input_priority(self, value, is_temporary) end +function druid__base_component.set_input_priority(self, value, is_temporary) end --- Set current component nodes. --- Use if your component nodes was cloned with `gui.clone_tree` and you got the node tree. ---@param self druid.base_component @{BaseComponent} ---@param nodes table BaseComponent nodes table ---@return druid.base_component @{BaseComponent} -function druid__base_component.component:set_nodes(self, nodes) end +function druid__base_component.set_nodes(self, nodes) 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 ---@param self druid.base_component @{BaseComponent} ---@param druid_style table Druid style module ---@return druid.base_component @{BaseComponent} -function druid__base_component.component:set_style(self, druid_style) end +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() ---@param self druid.base_component @{BaseComponent} ---@param template string BaseComponent template name ---@return druid.base_component @{BaseComponent} -function druid__base_component.component:set_template(self, template) end +function druid__base_component.set_template(self, template) end ---@class druid.blocker : druid.base_component ---@field node node Blocker node local druid__blocker = {} ---- @{Blocker} constructor +--- The @{Blocker} constructor ---@param self druid.blocker @{Blocker} ---@param node node Gui node function druid__blocker.init(self, node) end --- Return blocker enabled state ---@param self druid.blocker @{Blocker} ----@return bool True, if blocker is enabled +---@return boolean @True, if blocker is enabled function druid__blocker.is_enabled(self) end --- Set enabled blocker component state. --- Don't change node enabled state itself. ---@param self druid.blocker @{Blocker} ----@param state bool Enabled state +---@param state boolean Enabled state function druid__blocker.set_enabled(self, state) end @@ -171,7 +174,7 @@ function druid__blocker.set_enabled(self, state) end ---@field anim_node node Button animation node. ---@field click_zone node Additional button click area, defined by another GUI Node ---@field hover druid.hover The @{Hover}: Button Hover component ----@field node Node Button trigger node +---@field node node Button trigger node ---@field node_id hash The GUI node id from button node ---@field on_click druid.event The @{DruidEvent}: Event on successful release action over button. ---@field on_click_outside druid.event The @{DruidEvent}: Event calls if click event was outside of button. @@ -191,16 +194,16 @@ function druid__button.get_key_trigger(self) end --- The @{Button} constructor ---@param self druid.button @{Button} ----@param node string|Node Node name or GUI Node itself +---@param node string|node Node name or GUI Node itself ---@param callback function On click button callback ---@param custom_args any Button events custom arguments ----@param anim_node string|Node Node to animate instead of trigger node. +---@param anim_node string|node Node to animate instead of trigger node. function druid__button.init(self, node, callback, custom_args, anim_node) end --- Get button enabled state. --- By default all Buttons is enabled on creating. ---@param self druid.button @{Button} ----@return bool True, if button is enabled now, False overwise +---@return boolean @True, if button is enabled now, False overwise function druid__button.is_enabled(self) end --- Set function for additional check for button click availability @@ -220,7 +223,7 @@ function druid__button.set_click_zone(self, zone) end --- Set button enabled state. --- The style.on_set_enabled will be triggered. Disabled button is not clickable. ---@param self druid.button @{Button} ----@param state bool Enabled state +---@param state boolean Enabled state ---@return druid.button Current button instance function druid__button.set_enabled(self, state) end @@ -239,14 +242,14 @@ function druid__button.set_web_user_interaction(self, is_web_mode) end ---@class druid.button.style ----@field AUTOHOLD_TRIGGER field Maximum hold time to trigger button release while holding ----@field DOUBLETAP_TIME field Time between double taps ----@field LONGTAP_TIME field Minimum time to trigger on_hold_callback ----@field on_click field (self, node) ----@field on_click_disabled field (self, node) ----@field on_hover field (self, node, hover_state) ----@field on_mouse_hover field (self, node, hover_state) ----@field on_set_enabled field (self, node, enabled_state) +---@field AUTOHOLD_TRIGGER number Maximum hold time to trigger button release while holding +---@field DOUBLETAP_TIME number Time between double taps +---@field LONGTAP_TIME number Minimum time to trigger on_hold_callback +---@field on_click function function(self, node) +---@field on_click_disabled function function(self, node) +---@field on_hover function function(self, node, hover_state) +---@field on_mouse_hover function function(self, node, hover_state) +---@field on_set_enabled function function(self, node, enabled_state) local druid__button__style = {} @@ -260,10 +263,10 @@ local druid__checkbox = {} --- Return checkbox state ---@param self druid.checkbox @{Checkbox} ----@return bool Checkbox state +---@return boolean Checkbox state function druid__checkbox.get_state(self) end ---- Component init function +--- The @{Checkbox} constructor ---@param self druid.checkbox @{Checkbox} ---@param node node Gui node ---@param callback function Checkbox callback @@ -273,14 +276,14 @@ function druid__checkbox.init(self, node, callback, click_node, initial_state) e --- Set checkbox state ---@param self druid.checkbox @{Checkbox} ----@param state bool Checkbox state ----@param is_silent bool Don't trigger on_change_state if true ----@param is_instant bool If instant checkbox change +---@param state boolean Checkbox state +---@param is_silent boolean Don't trigger on_change_state if true +---@param is_instant boolean If instant checkbox change function druid__checkbox.set_state(self, state, is_silent, is_instant) end ---@class druid.checkbox.style ----@field on_change_state field (self, node, state) +---@field on_change_state function (self, node, state) local druid__checkbox__style = {} @@ -291,10 +294,10 @@ local druid__checkbox_group = {} --- Return checkbox group state ---@param self druid.checkbox_group @{CheckboxGroup} ----@return bool[] Array if checkboxes state +---@return boolean[] Array if checkboxes state function druid__checkbox_group.get_state(self) end ---- Component init function +--- The @{CheckboxGroup} constructor ---@param self druid.checkbox_group @{CheckboxGroup} ---@param nodes node[] Array of gui node ---@param callback function Checkbox callback @@ -303,7 +306,7 @@ function druid__checkbox_group.init(self, nodes, callback, click_nodes) end --- Set checkbox group state ---@param self druid.checkbox_group @{CheckboxGroup} ----@param indexes bool[] Array of checkbox state +---@param indexes boolean[] Array of checkbox state ---@param is_instant boolean If instant state change function druid__checkbox_group.set_state(self, indexes, is_instant) end @@ -330,7 +333,7 @@ function druid__data_list.get_created_components(self) end --- Return all currenly created nodes in DataList ---@param self druid.data_list @{DataList} ----@return Node[] List of created nodes +---@return node[] List of created nodes function druid__data_list.get_created_nodes(self) end --- Return current data from DataList component @@ -356,7 +359,7 @@ function druid__data_list.get_last_index(self) end ---@param self druid.data_list @{DataList} function druid__data_list.get_length(self) end ---- Data list constructor +--- The @{DataList} constructor ---@param self druid.data_list @{DataList} ---@param scroll druid.scroll The @{Scroll} instance for Data List component ---@param grid druid.static_grid|druid.dynamic_grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component @@ -380,10 +383,10 @@ function druid__data_list.set_data(self, data) end ---@class druid.drag : druid.base_component ----@field can_x bool Is drag component process vertical dragging. ----@field can_y bool Is drag component process horizontal. ----@field is_drag bool Is component now dragging ----@field is_touch bool Is component now touching +---@field can_x boolean Is drag component process vertical dragging. +---@field can_y boolean Is drag component process horizontal. +---@field is_drag boolean Is component now dragging +---@field is_touch boolean Is component now touching ---@field on_drag druid.event on drag progress callback(self, dx, dy, total_x, total_y) ---@field on_drag_end druid.event Event on drag end callback(self, total_x, total_y) ---@field on_drag_start druid.event Event on drag start callback(self) @@ -395,7 +398,7 @@ function druid__data_list.set_data(self, data) end ---@field y number Current touch y position local druid__drag = {} ---- Drag component constructor +--- The @{Drag} constructor ---@param self druid.drag @{Drag} ---@param node node GUI node to detect dragging ---@param on_drag_callback function Callback for on_drag_event(self, dx, dy) @@ -403,7 +406,7 @@ function druid__drag.init(self, node, on_drag_callback) end --- Check if Drag component is enabled ---@param self druid.drag @{Drag} ----@return bool +---@return boolean function druid__drag.is_enabled(self) end --- Strict drag click area. @@ -414,13 +417,13 @@ function druid__drag.set_click_zone(self, node) end --- Set Drag input enabled or disabled ---@param self druid.drag @{Drag} ----@param is_enabled bool +---@param is_enabled boolean function druid__drag.set_enabled(self, is_enabled) end ---@class druid.drag.style ----@field DRAG_DEADZONE field Distance in pixels to start dragging ----@field NO_USE_SCREEN_KOEF field If screen aspect ratio affects on drag values +---@field DRAG_DEADZONE number Distance in pixels to start dragging +---@field NO_USE_SCREEN_KOEF boolean If screen aspect ratio affects on drag values local druid__drag__style = {} @@ -493,7 +496,7 @@ function druid__dynamic_grid.get_pos(self, index, node, origin_index) end ---@return vector3 The grid content size function druid__dynamic_grid.get_size(self, border) end ---- Component init function +--- The @{DynamicGrid} constructor ---@param self druid.dynamic_grid @{DynamicGrid} ---@param parent node The gui node parent, where items will be placed function druid__dynamic_grid.init(self, parent) end @@ -529,24 +532,24 @@ function druid__event.initialize(self, initial_callback) end --- Return true, if event have at lease one handler ---@param self druid.event @{DruidEvent} ----@return bool True if event have handlers +---@return boolean True if event have handlers function druid__event.is_exist(self) end --- Subscribe callback on event ---@param self druid.event @{DruidEvent} ---@param callback function Callback itself ----@param context Any Additional context as first param to callback call, usually it's self +---@param context any Additional context as first param to callback call, usually it's self function druid__event.subscribe(self, callback, context) end --- Trigger the event and call all subscribed callbacks ---@param self druid.event @{DruidEvent} ----@param ... Any All event params +---@param ... any All event params function druid__event.trigger(self, ...) end --- Unsubscribe callback on event ---@param self druid.event @{DruidEvent} ---@param callback function Callback itself ----@param context Any Additional context as first param to callback call +---@param context any Additional context as first param to callback call function druid__event.unsubscribe(self, callback, context) end @@ -561,19 +564,19 @@ local druid__hotkey = {} --- Add hotkey for component callback ---@param self druid.hotkey @{Hotkey} ---@param keys string[]|hash[]|string|hash that have to be pressed before key pressed to activate ----@param callback_argument value The argument to pass into the callback function +---@param callback_argument any The argument to pass into the callback function function druid__hotkey.add_hotkey(self, keys, callback_argument) end ---- Component init function +--- The @{Hotkey} constructor ---@param self druid.hotkey @{Hotkey} ---@param keys string[]|string The keys to be pressed for trigger callback. Should contains one key and any modificator keys ---@param callback function The callback function ----@param callback_argument value The argument to pass into the callback function +---@param callback_argument any The argument to pass into the callback function function druid__hotkey.init(self, keys, callback, callback_argument) end ---@class druid.hotkey.style ----@field MODIFICATORS field The list of action_id as hotkey modificators +---@field MODIFICATORS string[] The list of action_id as hotkey modificators local druid__hotkey__style = {} @@ -582,7 +585,7 @@ local druid__hotkey__style = {} ---@field on_mouse_hover druid.event On mouse hover callback(self, state, hover_instance) local druid__hover = {} ---- Component init function +--- The @{Hover} constructor ---@param self druid.hover @{Hover} ---@param node node Gui node ---@param on_hover_callback function Hover callback @@ -590,19 +593,19 @@ function druid__hover.init(self, node, on_hover_callback) end --- Return current hover enabled state ---@param self druid.hover @{Hover} ----@return bool The hover enabled state +---@return boolean The hover enabled state function druid__hover.is_enabled(self) end --- Return current hover state. --- True if touch action was on the node at current time ---@param self druid.hover @{Hover} ----@return bool The current hovered state +---@return boolean The current hovered state function druid__hover.is_hovered(self) end --- Return current hover state. --- True if nil action_id (usually desktop mouse) was on the node at current time ---@param self druid.hover @{Hover} ----@return bool The current hovered state +---@return boolean The current hovered state function druid__hover.is_mouse_hovered(self) end --- Strict hover click area. @@ -614,25 +617,25 @@ function druid__hover.set_click_zone(self, zone) end --- Set enable state of hover component. --- If hover is not enabled, it will not generate any hover events ---@param self druid.hover @{Hover} ----@param state bool The hover enabled state +---@param state boolean The hover enabled state function druid__hover.set_enabled(self, state) end --- Set hover state ---@param self druid.hover @{Hover} ----@param state bool The hover state +---@param state boolean The hover state function druid__hover.set_hover(self, state) end --- Set mouse hover state ---@param self druid.hover @{Hover} ----@param state bool The mouse hover state +---@param state boolean The mouse hover state function druid__hover.set_mouse_hover(self, state) end ---@class druid.input : druid.base_component ---@field allowerd_characters string Pattern matching for user input ---@field button druid.button Button component ----@field is_empty bool Is current input is empty now ----@field is_selected bool Is current input selected now +---@field is_empty boolean Is current input is empty now +---@field is_selected boolean Is current input selected now ---@field keyboard_type number Gui keyboard type for input field ---@field max_length number Max length for input text ---@field on_input_empty druid.event On input field text change to empty string callback(self, input_text) @@ -650,7 +653,7 @@ local druid__input = {} ---@return string The current input field text function druid__input.get_text(self) end ---- Component init function +--- The @{Input} constructor ---@param self druid.input @{Input} ---@param click_node node Node to enabled input component ---@param text_node node|druid.text Text node what will be changed on user input. You can pass text component instead of text node name @{Text} @@ -692,14 +695,14 @@ function druid__input.unselect(self) end ---@class druid.input.style ----@field IS_LONGTAP_ERASE field Is long tap will erase current input data ----@field IS_UNSELECT_ON_RESELECT field If true, call unselect on select selected input ----@field MASK_DEFAULT_CHAR field Default character mask for password input ----@field NO_CONSUME_INPUT_WHILE_SELECTED field If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured) ----@field button_style field Custom button style for input node ----@field on_input_wrong field (self, button_node) Callback on wrong user input ----@field on_select field (self, button_node) Callback on input field selecting ----@field on_unselect field (self, button_node) Callback on input field unselecting +---@field IS_LONGTAP_ERASE boolean Is long tap will erase current input data +---@field IS_UNSELECT_ON_RESELECT boolean If true, call unselect on select selected input +---@field MASK_DEFAULT_CHAR string Default character mask for password input +---@field NO_CONSUME_INPUT_WHILE_SELECTED boolean If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured) +---@field button_style table Custom button style for input node +---@field on_input_wrong function (self, button_node) Callback on wrong user input +---@field on_select function (self, button_node) Callback on input field selecting +---@field on_unselect function (self, button_node) Callback on input field unselecting local druid__input__style = {} @@ -756,7 +759,7 @@ local druid__layout = {} --- Set node for layout node to fit inside it. --- Pass nil to reset ---@param self druid.layout @{Layout} ----@param node Node +---@param node node ---@return druid.layout @{Layout} function druid__layout.fit_into_node(self, node) end @@ -771,7 +774,7 @@ function druid__layout.fit_into_size(self, target_size) end ---@return druid.layout @{Layout} function druid__layout.fit_into_window(self) end ---- Component init function +--- The @{Layout} constructor ---@param self druid.layout @{Layout} ---@param node node Gui node ---@param mode string The layout mode (from const.LAYOUT_MODE) @@ -814,11 +817,11 @@ function druid__layout.set_origin_size(self, new_origin_size) end ---@class druid.pin_knob : druid.base_component ---@field druid druid_instance The component druid instance ----@field is_drag bool Is currently under user control +---@field is_drag boolean Is currently under user control ---@field node node The pin node local druid__pin_knob = {} ---- Component init function +--- The @{PinKnob} constructor ---@param self druid.pin_knob @{PinKnob} ---@param callback function Callback(self, value) on value changed ---@param template string The template string name @@ -863,7 +866,7 @@ function druid__progress.fill(self) end ---@param self druid.progress @{Progress} function druid__progress.get(self) end ---- @{Progress} constructor +--- The @{Progress} constructor ---@param self druid.progress @{Progress} ---@param node string|node Node name or GUI Node itself. ---@param key string Progress bar direction: const.SIDE.X or const.SIDE.Y @@ -895,13 +898,13 @@ function druid__progress.to(self, to, callback) end ---@class druid.progress.style ----@field MIN_DELTA field Minimum step to fill progress bar ----@field SPEED field Progress bas fill rate. More -> faster +---@field MIN_DELTA number Minimum step to fill progress bar +---@field SPEED number Progress bas fill rate. More -> faster local druid__progress__style = {} ---@class druid.radio_group : druid.base_component ----@field checkboxes Checkbox[] Array of checkbox components +---@field checkboxes druid.checkbox[] Array of checkbox components ---@field on_radio_click druid.event On any checkbox click local druid__radio_group = {} @@ -910,7 +913,7 @@ local druid__radio_group = {} ---@return number Index in radio group function druid__radio_group.get_state(self) end ---- Component init function +--- The @{RadioGroup} constructor ---@param self druid.radio_group @{RadioGroup} ---@param nodes node[] Array of gui node ---@param callback function Radio callback @@ -931,7 +934,7 @@ function druid__radio_group.set_state(self, index, is_instant) end ---@field placeholder druid.text On input field text change to max length string callback(self, input_text) local druid__rich_input = {} ---- Component init function +--- The @{RichInput} constructor ---@param self druid.rich_input @{RichInput} ---@param template string The template string name ---@param nodes table Nodes table from gui.clone_tree @@ -944,7 +947,7 @@ function druid__rich_input.set_placeholder(self, placeholder_text) end ---@class druid.rich_text : druid.base_component ----@field component field The component druid instance +---@field druid druid_instance The component druid instance ---@field style druid.rich_text.style Component style params. local druid__rich_text = {} @@ -959,7 +962,7 @@ function druid__rich_text.get_line_metric() end ---@return table druid.rich_text.word[] function druid__rich_text.get_words() end ---- Rich Text component constructor +--- The @{RichText} constructor ---@param self druid.rich_text @{RichText} ---@param template string The Rich Text template name ---@param nodes table The node table, if prefab was copied by gui.clone_tree() @@ -979,9 +982,9 @@ function druid__rich_text.tagged(tag) end ---@class druid.rich_text.style ----@field ADJUST_SCALE_DELTA field Scale step on each height adjust step ----@field ADJUST_STEPS field Amount steps of attemps text adjust by height ----@field COLORS field Rich Text color aliases +---@field ADJUST_SCALE_DELTA number Scale step on each height adjust step +---@field ADJUST_STEPS number Amount steps of attemps text adjust by height +---@field COLORS table Rich Text color aliases local druid__rich_text__style = {} @@ -991,8 +994,7 @@ local druid__rich_text__style = {} ---@field content_node node Scroll content node ---@field drag druid.drag Drag Druid component ---@field inertion vector3 Current inert speed ----@field is_animate bool Flag, if scroll now animating by gui.animate ----@field is_inert bool Flag, if scroll now moving by inertion +---@field is_animate boolean Flag, if scroll now animating by gui.animate ---@field on_point_scroll druid.event On scroll_to_index function callback(self, index, point) ---@field on_scroll druid.event On scroll move callback(self, position) ---@field on_scroll_to druid.event On scroll_to function callback(self, target, is_instant) @@ -1020,7 +1022,7 @@ function druid__scroll.get_percent(self) end ---@return vector3 Available scroll size function druid__scroll.get_scroll_size(self) end ---- @{Scroll} constructor +--- The @{Scroll} constructor ---@param self druid.scroll @{Scroll} ---@param view_node string|node GUI view scroll node ---@param content_node string|node GUI content scroll node @@ -1028,7 +1030,7 @@ function druid__scroll.init(self, view_node, content_node) end --- Return if scroll have inertion. ---@param self druid.scroll @{Scroll} ----@return bool If scroll have inertion +---@return boolean @If scroll have inertion function druid__scroll.is_inert(self) end --- Check node if it visible now on scroll. @@ -1041,19 +1043,19 @@ function druid__scroll.is_node_in_view(self, node) end --- Start scroll to target point. ---@param self druid.scroll @{Scroll} ---@param point vector3 Target point ----@param is_instant bool Instant scroll flag +---@param is_instant boolean Instant scroll flag function druid__scroll.scroll_to(self, point, is_instant) end --- Scroll to item in scroll by point index. ---@param self druid.scroll @{Scroll} ---@param index number Point index ----@param skip_cb bool If true, skip the point callback +---@param skip_cb boolean If true, skip the point callback function druid__scroll.scroll_to_index(self, index, skip_cb) end --- Start scroll to target scroll percent ---@param self druid.scroll @{Scroll} ---@param percent vector3 target percent ----@param is_instant bool instant scroll flag +---@param is_instant boolean instant scroll flag function druid__scroll.scroll_to_percent(self, percent, is_instant) end --- Strict drag scroll area. @@ -1071,14 +1073,14 @@ function druid__scroll.set_extra_stretch_size(self, stretch_size) end --- Lock or unlock horizontal scroll ---@param self druid.scroll @{Scroll} ----@param state bool True, if horizontal scroll is enabled +---@param state boolean True, if horizontal scroll is enabled ---@return druid.scroll Current scroll instance function druid__scroll.set_horizontal_scroll(self, state) end --- Enable or disable scroll inert. --- If disabled, scroll through points (if exist) If no points, just simple drag without inertion ---@param self druid.scroll @{Scroll} ----@param state bool Inert scroll state +---@param state boolean Inert scroll state ---@return druid.scroll Current scroll instance function druid__scroll.set_inert(self, state) end @@ -1099,31 +1101,31 @@ function druid__scroll.set_size(self, size, offset) end --- Lock or unlock vertical scroll ---@param self druid.scroll @{Scroll} ----@param state bool True, if vertical scroll is enabled +---@param state boolean True, if vertical scroll is enabled ---@return druid.scroll Current scroll instance function druid__scroll.set_vertical_scroll(self, state) end ---@class druid.scroll.style ----@field ANIM_SPEED field Scroll gui.animation speed for scroll_to function ----@field BACK_SPEED field Scroll back returning lerp speed ----@field EXTRA_STRETCH_SIZE field extra size in pixels outside of scroll (stretch effect) ----@field FRICT field Multiplier for free inertion ----@field FRICT_HOLD field Multiplier for inertion, while touching ----@field INERT_SPEED field Multiplier for inertion speed ----@field INERT_THRESHOLD field Scroll speed to stop inertion ----@field POINTS_DEADZONE field Speed to check points of interests in no_inertion mode ----@field SMALL_CONTENT_SCROLL field If true, content node with size less than view node size can be scrolled ----@field WHEEL_SCROLL_BY_INERTION field If true, wheel will add inertion to scroll. Direct set position otherwise. ----@field WHEEL_SCROLL_INVERTED field If true, invert direction for touchpad and mouse wheel scroll ----@field WHEEL_SCROLL_SPEED field The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling +---@field ANIM_SPEED number Scroll gui.animation speed for scroll_to function +---@field BACK_SPEED number Scroll back returning lerp speed +---@field EXTRA_STRETCH_SIZE number extra size in pixels outside of scroll (stretch effect) +---@field FRICT number Multiplier for free inertion +---@field FRICT_HOLD number Multiplier for inertion, while touching +---@field INERT_SPEED number Multiplier for inertion speed +---@field INERT_THRESHOLD number Scroll speed to stop inertion +---@field POINTS_DEADZONE number Speed to check points of interests in no_inertion mode +---@field SMALL_CONTENT_SCROLL boolean If true, content node with size less than view node size can be scrolled +---@field WHEEL_SCROLL_BY_INERTION boolean If true, wheel will add inertion to scroll. Direct set position otherwise. +---@field WHEEL_SCROLL_INVERTED boolean If true, invert direction for touchpad and mouse wheel scroll +---@field WHEEL_SCROLL_SPEED boolean The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling local druid__scroll__style = {} ---@class druid.slider : druid.base_component ---@field dist number Length between start and end position ---@field end_pos vector3 End pin node position ----@field is_drag bool Current drag state +---@field is_drag boolean Current drag state ---@field node node Slider pin node ---@field on_change_value druid.event On change value callback(self, value) ---@field pos vector3 Current pin node position @@ -1132,7 +1134,7 @@ local druid__scroll__style = {} ---@field value number Current slider value local druid__slider = {} ---- Component init function +--- The @{Slider} constructor ---@param self druid.slider @{Slider} ---@param node node Gui pin node ---@param end_pos vector3 The end position of slider @@ -1142,13 +1144,13 @@ function druid__slider.init(self, node, end_pos, callback) end --- Set value for slider ---@param self druid.slider @{Slider} ---@param value number Value from 0 to 1 ----@param is_silent bool Don't trigger event if true +---@param is_silent boolean Don't trigger event if true function druid__slider.set(self, value, is_silent) end --- Set input zone for slider. --- User can touch any place of node, pin instantly will move at this position and node drag will start. This function require the Defold version 1.3.0+ ---@param self druid.slider @{Slider} ----@param input_node Node +---@param input_node node ---@return druid.slider @{Slider} function druid__slider.set_input_node(self, input_node) end @@ -1221,7 +1223,7 @@ function druid__static_grid.get_offset(self) end --- Return pos for grid node index ---@param self druid.static_grid @{StaticGrid} ---@param index number The grid element index ----@return vector3 Node position +---@return vector3 @Node position function druid__static_grid.get_pos(self, index) end --- Return grid content size @@ -1231,7 +1233,7 @@ function druid__static_grid.get_size(self) end --- The @{StaticGrid} constructor ---@param self druid.static_grid @{StaticGrid} ----@param parent string|Node The GUI Node container, where grid's items will be placed +---@param parent string|node The GUI Node container, where grid's items will be placed ---@param element node Element prefab. Need to get it size ---@param in_row number How many nodes in row can be placed function druid__static_grid.init(self, parent, element, in_row) end @@ -1242,7 +1244,7 @@ function druid__static_grid.init(self, parent, element, in_row) end ---@param index number The grid node index to remove ---@param shift_policy number How shift nodes, if required. See const.SHIFT ---@param is_instant boolean If true, update node positions instantly ----@return Node The deleted gui node from grid +---@return node The deleted gui node from grid function druid__static_grid.remove(self, index, shift_policy, is_instant) end --- Set grid anchor. @@ -1266,8 +1268,8 @@ function druid__static_grid.set_position_function(self, callback) end ---@class druid.static_grid.style ----@field IS_ALIGN_LAST_ROW field If true, always align last row of the grid as grid pivot sets ----@field IS_DYNAMIC_NODE_POSES field If true, always center grid content as grid pivot sets +---@field IS_ALIGN_LAST_ROW boolean If true, always align last row of the grid as grid pivot sets +---@field IS_DYNAMIC_NODE_POSES boolean If true, always center grid content as grid pivot sets local druid__static_grid__style = {} @@ -1278,7 +1280,7 @@ local druid__static_grid__style = {} ---@field style druid.swipe.style Component style params. local druid__swipe = {} ---- Component init function +--- The @{Swipe} constructor ---@param self druid.swipe @{Swipe} ---@param node node Gui node ---@param on_swipe_callback function Swipe callback for on_swipe_end event @@ -1292,9 +1294,9 @@ function druid__swipe.set_click_zone(self, zone) end ---@class druid.swipe.style ----@field SWIPE_THRESHOLD field Minimum distance for swipe trigger ----@field SWIPE_TIME field Maximum time for swipe trigger ----@field SWIPE_TRIGGER_ON_MOVE field If true, trigger on swipe moving, not only release action +---@field SWIPE_THRESHOLD number Minimum distance for swipe trigger +---@field SWIPE_TIME number Maximum time for swipe trigger +---@field SWIPE_TRIGGER_ON_MOVE boolean If true, trigger on swipe moving, not only release action local druid__swipe__style = {} @@ -1327,7 +1329,7 @@ function druid__text.get_text_adjust(self, adjust_type) end ---@return number Height function druid__text.get_text_size(self, text) end ---- @{Text} constructor +--- The @{Text} constructor ---@param self druid.text @{Text} ---@param node string|node Node name or GUI Text Node itself ---@param value string Initial text. Default value is node text from GUI scene. @@ -1336,7 +1338,7 @@ function druid__text.init(self, node, value, adjust_type) end --- Return true, if text with line break ---@param self druid.text @{Text} ----@return bool Is text node with line break +---@return boolean Is text node with line break function druid__text.is_multiline(self) end --- Set alpha @@ -1360,7 +1362,7 @@ function druid__text.set_minimal_scale(self, minimal_scale) end --- Set text pivot. --- Text will re-anchor inside text area ---@param self druid.text @{Text} ----@param pivot gui.pivot Gui pivot constant +---@param pivot number The gui.PIVOT_* constant ---@return druid.text Current text instance function druid__text.set_pivot(self, pivot) end @@ -1385,8 +1387,8 @@ function druid__text.set_to(self, set_to) end ---@class druid.text.style ----@field DEFAULT_ADJUST field The default adjust type for any text component ----@field TRIM_POSTFIX field The postfix for TRIM adjust type +---@field DEFAULT_ADJUST string The default adjust type for any text component +---@field TRIM_POSTFIX string The postfix for TRIM adjust type local druid__text__style = {} @@ -1400,7 +1402,7 @@ local druid__text__style = {} ---@field value number Current timer value local druid__timer = {} ---- Component init function +--- The @{Timer} constructor ---@param self druid.timer @{Timer} ---@param node node Gui text node ---@param seconds_from number Start timer value in seconds @@ -1416,7 +1418,7 @@ function druid__timer.set_interval(self, from, to) end --- Called when update ---@param self druid.timer @{Timer} ----@param is_on bool Timer enable state +---@param is_on boolean Timer enable state function druid__timer.set_state(self, is_on) end --- Set text to text field @@ -1425,11 +1427,6 @@ function druid__timer.set_state(self, is_on) end function druid__timer.set_to(self, set_to) end ----@class druid_const ----@field ON_INPUT field Component Interests -local druid_const = {} - - ---@class druid_instance local druid_instance = {} @@ -1439,13 +1436,13 @@ function druid_instance.final(self) end --- Create new component. ---@param self druid_instance ----@param component Component Component module ----@param ... args Other component params to pass it to component:init function +---@param component druid.base_component Component module +---@param ... any Other component params to pass it to component:init function function druid_instance.new(self, component, ...) end --- Create @{BackHandler} component ---@param self druid_instance ----@param callback callback On back button +---@param callback function @The callback(self, custom_args) to call on back event ---@param params any Callback argument ---@return druid.back_handler @{BackHandler} component function druid_instance.new_back_handler(self, callback, params) end @@ -1485,7 +1482,7 @@ function druid_instance.new_checkbox_group(self, nodes, callback, click_nodes) e --- Create @{DataList} component ---@param self druid_instance ---@param druid_scroll druid.scroll The Scroll instance for Data List component ----@param druid_grid Grid The Grid instance for Data List component +---@param druid_grid druid.static_grid|druid.dynamic_grid The @{StaticGrid} or @{DynamicGrid} instance for Data List component ---@param create_function function The create function callback(self, data, index, data_list). Function should return (node, [component]) ---@return druid.data_list @{DataList} component function druid_instance.new_data_list(self, druid_scroll, druid_grid, create_function) end @@ -1506,10 +1503,10 @@ function druid_instance.new_dynamic_grid(self, parent) end --- Create @{Hotkey} component ---@param self druid_instance ---@param keys_array string|string[] Keys for trigger action. Should contains one action key and any amount of modificator keys ----@param callback function Button callback ----@param params value Button callback params +---@param callback function The callback function +---@param callback_argument any The argument to pass into the callback function ---@return druid.hotkey @{Hotkey} component -function druid_instance.new_hotkey(self, keys_array, callback, params) end +function druid_instance.new_hotkey(self, keys_array, callback, callback_argument) end --- Create @{Hover} component ---@param self druid_instance @@ -1530,7 +1527,7 @@ function druid_instance.new_input(self, click_node, text_node, keyboard_type) en ---@param self druid_instance ---@param node node The text node ---@param locale_id string Default locale id ----@param no_adjust bool If true, will not correct text size +---@param no_adjust boolean If true, will not correct text size ---@return druid.lang_text @{LangText} component function druid_instance.new_lang_text(self, node, locale_id, no_adjust) end @@ -1599,7 +1596,7 @@ function druid_instance.new_swipe(self, node, on_swipe_callback) end ---@param self druid_instance ---@param node node Gui text node ---@param value string Initial text. Default value is node text from GUI scene. ----@param no_adjust bool If true, text will be not auto-adjust size +---@param no_adjust boolean If true, text will be not auto-adjust size ---@return druid.text @{Text} component function druid_instance.new_text(self, node, value, no_adjust) end @@ -1617,7 +1614,7 @@ function druid_instance.new_timer(self, node, seconds_from, seconds_to, callback ---@param self druid_instance ---@param action_id hash Action_id from on_input ---@param action table Action from on_input ----@return bool The boolean value is input was consumed +---@return boolean The boolean value is input was consumed function druid_instance.on_input(self, action_id, action) end --- Call this in gui_script on_message function. @@ -1631,20 +1628,20 @@ function druid_instance.on_message(self, message_id, message, sender) end --- Remove created component from Druid instance. --- Component `on_remove` function will be invoked, if exist. ---@param self druid_instance ----@param component Component Component instance +---@param component druid.base_component Component instance function druid_instance.remove(self, component) end --- Set blacklist components for input processing. --- If blacklist is not empty and component contains in this list, component will be not processed on input step ---@param self druid_instance @{DruidInstance} ----@param blacklist_components table|Component The array of component to blacklist +---@param blacklist_components table|druid.base_component The array of component to blacklist ---@return self @{DruidInstance} function druid_instance.set_blacklist(self, blacklist_components) end --- Set whitelist components for input processing. --- If whitelist is not empty and component not contains in this list, component will be not processed on input step ---@param self druid_instance ----@param whitelist_components table|Component The array of component to whitelist +---@param whitelist_components table|druid.base_component The array of component to whitelist ---@return self @{DruidInstance} function druid_instance.set_whitelist(self, whitelist_components) end @@ -1659,9 +1656,9 @@ function druid_instance.update(self, dt) end local helper = {} --- Add all elements from source array to the target array ----@param target table Array to put elements from source ----@param source table The source array to get elements from ----@return array The target array +---@param target any[] Array to put elements from source +---@param source any[] The source array to get elements from +---@return any[] The target array function helper.add_array(target, source) end --- Centerate nodes by x position with margin. @@ -1714,7 +1711,7 @@ function helper.get_gui_scale() end --- Get node offset for given GUI pivot. --- Offset shown in [-0.5 .. 0.5] range, where -0.5 is left or bottom, 0.5 is right or top. ----@param pivot gui.pivot The node pivot +---@param pivot number The gui.PIVOT_* constant ---@return vector3 Vector offset with [-0.5..0.5] values function helper.get_pivot_offset(pivot) end @@ -1725,7 +1722,7 @@ function helper.get_scaled_size(node) end --- Get cumulative parent's node scale ---@param node node Gui node ----@param include_passed_node_scale bool True if add current node scale to result +---@param include_passed_node_scale boolean True if add current node scale to result ---@return vector3 The scene node scale function helper.get_scene_scale(node, include_passed_node_scale) end @@ -1735,25 +1732,25 @@ function helper.get_scene_scale(node, include_passed_node_scale) end function helper.get_screen_aspect_koef() end --- Get text metric from GUI node. ----@param text_node Node +---@param text_node node ---@return GUITextMetrics function helper.get_text_metrics_from_node(text_node) end --- Add value to array with shift policy --- Shift policy can be: left, right, no_shift ---@param array table Array ----@param item unknown Item to insert +---@param any unknown Item to insert ---@param index number Index to insert. If nil, item will be inserted at the end of array ----@param shift_policy const.SHIFT Shift policy ----@return item Inserted item -function helper.insert_with_shift(array, item, index, shift_policy) end +---@param shift_policy number The druid_const.SHIFT.* constant +---@return any Inserted item +function helper.insert_with_shift(array, any, index, shift_policy) end --- Check if device is native mobile (Android or iOS) ----@return bool Is mobile +---@return boolean Is mobile function helper.is_mobile() end --- Check if device is HTML5 ----@return bool Is web +---@return boolean Is web function helper.is_web() end --- Lerp between two values @@ -1767,8 +1764,8 @@ function helper.lerp(a, b, t) end --- Shift policy can be: left, right, no_shift ---@param array table Array ---@param index number Index to remove. If nil, item will be removed from the end of array ----@param shift_policy const.SHIFT Shift policy ----@return item Removed item +---@param shift_policy number The druid_const.SHIFT.* constant +---@return any Removed item function helper.remove_with_shift(array, index, shift_policy) end --- Round number to specified decimal places @@ -1797,11 +1794,6 @@ function helper.table_to_string(t) end -- Manual Annotations -- ----@class druid.rich_text.style ----@field COLORS table ----@field ADJUST_STEPS number ----@field ADJUST_SCALE_DELTA number - ---@class druid.rich_text.metrics ---@field width number ---@field height number @@ -1815,7 +1807,7 @@ function helper.table_to_string(t) end ---@field lines table ---@class druid.rich_text.word ----@field node Node +---@field node node ---@field relative_scale number ---@field color vector4 ---@field position vector3 @@ -1823,7 +1815,7 @@ function helper.table_to_string(t) end ---@field scale vector3 ---@field size vector3 ---@field metrics druid.rich_text.metrics ----@field pivot Pivot +---@field pivot number @ The gui.PIVOT_* constant ---@field text string ---@field shadow vector4 ---@field outline vector4 @@ -1834,14 +1826,14 @@ function helper.table_to_string(t) end ---@field br boolean ---@field nobr boolean ----@class druid.rich_text.word.image +---@class druid.rich_text.image ---@field texture string ---@field anim string ---@field width number ---@field height number ---@class druid.rich_text.settings ----@field parent Node +---@field parent node ---@field size number ---@field fonts table ---@field color vector4 @@ -1851,8 +1843,8 @@ function helper.table_to_string(t) end ---@field image_pixel_grid_snap boolean ---@field combine_words boolean ---@field default_animation string ----@field node_prefab Node ----@field text_prefab Node +---@field node_prefab node +---@field text_prefab node ---@class GUITextMetrics ---@field width number diff --git a/druid/base/back_handler.lua b/druid/base/back_handler.lua index 2498665..cb9a7af 100644 --- a/druid/base/back_handler.lua +++ b/druid/base/back_handler.lua @@ -45,7 +45,7 @@ local BackHandler = component.create("back_handler") --- The @{BackHandler} constructor -- @tparam BackHandler self @{BackHandler} --- @tparam callback callback On back button +-- @tparam function callback @The callback(self, custom_args) to call on back event -- @tparam[opt] any custom_args Button events custom arguments -- @local function BackHandler.init(self, callback, custom_args) diff --git a/druid/base/blocker.lua b/druid/base/blocker.lua index 6ee9b26..6645913 100644 --- a/druid/base/blocker.lua +++ b/druid/base/blocker.lua @@ -30,7 +30,7 @@ local component = require("druid.component") local Blocker = component.create("blocker") ---- @{Blocker} constructor +--- The @{Blocker} constructor -- @tparam Blocker self @{Blocker} -- @tparam node node Gui node function Blocker.init(self, node) @@ -71,7 +71,7 @@ end -- -- Don't change node enabled state itself. -- @tparam Blocker self @{Blocker} --- @tparam bool state Enabled state +-- @tparam boolean state Enabled state function Blocker.set_enabled(self, state) self._is_enabled = state end @@ -79,7 +79,7 @@ end --- Return blocker enabled state -- @tparam Blocker self @{Blocker} --- @treturn bool True, if blocker is enabled +-- @treturn boolean @True, if blocker is enabled function Blocker.is_enabled(self) return self._is_enabled end diff --git a/druid/base/button.lua b/druid/base/button.lua index d7113cd..024a1b8 100755 --- a/druid/base/button.lua +++ b/druid/base/button.lua @@ -27,7 +27,7 @@ -- print("Also the button component is passed in callback params") -- end -- --- local custom_args = "Any variable to pass inside callback" +-- local custom_args = "any variable to pass inside callback" -- local button = self.druid:new_button("button_name", on_button_click, custom_args) -- -- @module Button @@ -114,7 +114,7 @@ -- @tfield DruidEvent on_pressed @{DruidEvent} --- Button trigger node --- @tfield Node node +-- @tfield node node ---The GUI node id from button node -- @tfield hash node_id @@ -257,15 +257,15 @@ end --- Component style params. -- You can override this component styles params in Druid styles table -- or create your own style --- @table style -- @tfield[opt=0.4] number LONGTAP_TIME Minimum time to trigger on_hold_callback -- @tfield[opt=0.8] number AUTOHOLD_TRIGGER Maximum hold time to trigger button release while holding -- @tfield[opt=0.4] number DOUBLETAP_TIME Time between double taps --- @tfield function on_click (self, node) --- @tfield function on_click_disabled (self, node) --- @tfield function on_hover (self, node, hover_state) --- @tfield function on_mouse_hover (self, node, hover_state) --- @tfield function on_set_enabled (self, node, enabled_state) +-- @tfield function on_click function(self, node) +-- @tfield function on_click_disabled function(self, node) +-- @tfield function on_hover function(self, node, hover_state) +-- @tfield function on_mouse_hover function(self, node, hover_state) +-- @tfield function on_set_enabled function(self, node, enabled_state) +-- @table style function Button.on_style_change(self, style) self.style = {} self.style.LONGTAP_TIME = style.LONGTAP_TIME or 0.4 @@ -282,10 +282,10 @@ end --- The @{Button} constructor -- @tparam Button self @{Button} --- @tparam string|Node node Node name or GUI Node itself +-- @tparam string|node node Node name or GUI Node itself -- @tparam function callback On click button callback -- @tparam[opt] any custom_args Button events custom arguments --- @tparam[opt] string|Node anim_node Node to animate instead of trigger node. +-- @tparam[opt] string|node anim_node Node to animate instead of trigger node. function Button.init(self, node, callback, custom_args, anim_node) self.druid = self:get_druid() self.node = self:get_node(node) @@ -447,7 +447,7 @@ end -- The style.on_set_enabled will be triggered. -- Disabled button is not clickable. -- @tparam Button self @{Button} --- @tparam bool state Enabled state +-- @tparam boolean state Enabled state -- @treturn Button Current button instance -- @usage -- button:set_enabled(false) @@ -465,7 +465,7 @@ end -- -- By default all Buttons is enabled on creating. -- @tparam Button self @{Button} --- @treturn bool True, if button is enabled now, False overwise +-- @treturn boolean @True, if button is enabled now, False overwise -- @usage -- local is_enabled = button:is_enabled() function Button.is_enabled(self) diff --git a/druid/base/drag.lua b/druid/base/drag.lua index 22034f6..2b12a16 100644 --- a/druid/base/drag.lua +++ b/druid/base/drag.lua @@ -26,16 +26,16 @@ -- @tfield DruidEvent on_drag_end @{DruidEvent} --- Is component now touching --- @tfield bool is_touch +-- @tfield boolean is_touch --- Is component now dragging --- @tfield bool is_drag +-- @tfield boolean is_drag --- Is drag component process vertical dragging. Default - true --- @tfield bool can_x +-- @tfield boolean can_x --- Is drag component process horizontal. Default - true --- @tfield bool can_y +-- @tfield boolean can_y --- Current touch x position -- @tfield number x @@ -170,7 +170,7 @@ function Drag.on_style_change(self, style) end ---- Drag component constructor +--- The @{Drag} constructor -- @tparam Drag self @{Drag} -- @tparam node node GUI node to detect dragging -- @tparam function on_drag_callback Callback for on_drag_event(self, dx, dy) @@ -313,7 +313,7 @@ end --- Set Drag input enabled or disabled -- @tparam Drag self @{Drag} --- @tparam bool is_enabled +-- @tparam boolean is_enabled function Drag.set_enabled(self, is_enabled) self._is_enabled = is_enabled end @@ -321,7 +321,7 @@ end --- Check if Drag component is enabled -- @tparam Drag self @{Drag} --- @treturn bool +-- @treturn boolean function Drag.is_enabled(self) return self._is_enabled end diff --git a/druid/base/hover.lua b/druid/base/hover.lua index fd4fe93..90bf904 100644 --- a/druid/base/hover.lua +++ b/druid/base/hover.lua @@ -21,7 +21,7 @@ local component = require("druid.component") local Hover = component.create("hover") ---- Component init function +--- The @{Hover} constructor -- @tparam Hover self @{Hover} -- @tparam node node Gui node -- @tparam function on_hover_callback Hover callback @@ -89,7 +89,7 @@ end --- Set hover state -- @tparam Hover self @{Hover} --- @tparam bool state The hover state +-- @tparam boolean state The hover state function Hover.set_hover(self, state) if self._is_hovered ~= state then self._is_hovered = state @@ -100,7 +100,7 @@ end --- Return current hover state. True if touch action was on the node at current time -- @tparam Hover self @{Hover} --- @treturn bool The current hovered state +-- @treturn boolean The current hovered state function Hover.is_hovered(self) return self._is_hovered end @@ -108,7 +108,7 @@ end --- Set mouse hover state -- @tparam Hover self @{Hover} --- @tparam bool state The mouse hover state +-- @tparam boolean state The mouse hover state function Hover.set_mouse_hover(self, state) if self._is_mouse_hovered ~= state then self._is_mouse_hovered = state @@ -119,7 +119,7 @@ end --- Return current hover state. True if nil action_id (usually desktop mouse) was on the node at current time -- @tparam Hover self @{Hover} --- @treturn bool The current hovered state +-- @treturn boolean The current hovered state function Hover.is_mouse_hovered(self) return self._is_mouse_hovered end @@ -138,7 +138,7 @@ end -- If hover is not enabled, it will not generate -- any hover events -- @tparam Hover self @{Hover} --- @tparam bool state The hover enabled state +-- @tparam boolean state The hover enabled state function Hover.set_enabled(self, state) self._is_enabled = state @@ -155,7 +155,7 @@ end --- Return current hover enabled state -- @tparam Hover self @{Hover} --- @treturn bool The hover enabled state +-- @treturn boolean The hover enabled state function Hover.is_enabled(self) return self._is_enabled end diff --git a/druid/base/scroll.lua b/druid/base/scroll.lua index a7b510a..0aaeabd 100755 --- a/druid/base/scroll.lua +++ b/druid/base/scroll.lua @@ -53,9 +53,6 @@ --- Scroll content node -- @tfield node content_node ---- Flag, if scroll now moving by inertion --- @tfield bool is_inert - --- Current inert speed -- @tfield vector3 inertion @@ -78,7 +75,7 @@ -- @tfield[opt] number selected --- Flag, if scroll now animating by gui.animate --- @tfield bool is_animate +-- @tfield boolean is_animate --- @@ -131,10 +128,10 @@ end -- @tfield[opt=0.35] number BACK_SPEED Scroll back returning lerp speed -- @tfield[opt=0.2] number ANIM_SPEED Scroll gui.animation speed for scroll_to function -- @tfield[opt=0] number EXTRA_STRETCH_SIZE extra size in pixels outside of scroll (stretch effect) --- @tfield[opt=false] bool SMALL_CONTENT_SCROLL If true, content node with size less than view node size can be scrolled --- @tfield[opt=0] bool WHEEL_SCROLL_SPEED The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling --- @tfield[opt=false] bool WHEEL_SCROLL_INVERTED If true, invert direction for touchpad and mouse wheel scroll --- @tfield[opt=false] bool WHEEL_SCROLL_BY_INERTION If true, wheel will add inertion to scroll. Direct set position otherwise. +-- @tfield[opt=false] boolean SMALL_CONTENT_SCROLL If true, content node with size less than view node size can be scrolled +-- @tfield[opt=0] boolean WHEEL_SCROLL_SPEED The scroll speed via mouse wheel scroll or touchpad. Set to 0 to disable wheel scrolling +-- @tfield[opt=false] boolean WHEEL_SCROLL_INVERTED If true, invert direction for touchpad and mouse wheel scroll +-- @tfield[opt=false] boolean WHEEL_SCROLL_BY_INERTION If true, wheel will add inertion to scroll. Direct set position otherwise. function Scroll.on_style_change(self, style) self.style = {} self.style.EXTRA_STRETCH_SIZE = style.EXTRA_STRETCH_SIZE or 0 @@ -158,7 +155,7 @@ function Scroll.on_style_change(self, style) end ---- @{Scroll} constructor +--- The @{Scroll} constructor -- @tparam Scroll self @{Scroll} -- @tparam string|node view_node GUI view scroll node -- @tparam string|node content_node GUI content scroll node @@ -237,7 +234,7 @@ end --- Start scroll to target point. -- @tparam Scroll self @{Scroll} -- @tparam vector3 point Target point --- @tparam[opt] bool is_instant Instant scroll flag +-- @tparam[opt] boolean is_instant Instant scroll flag -- @usage scroll:scroll_to(vmath.vector3(0, 50, 0)) -- @usage scroll:scroll_to(vmath.vector3(0), true) function Scroll.scroll_to(self, point, is_instant) @@ -271,7 +268,7 @@ end --- Scroll to item in scroll by point index. -- @tparam Scroll self @{Scroll} -- @tparam number index Point index --- @tparam[opt] bool skip_cb If true, skip the point callback +-- @tparam[opt] boolean skip_cb If true, skip the point callback function Scroll.scroll_to_index(self, index, skip_cb) if not self.points then return @@ -294,7 +291,7 @@ end --- Start scroll to target scroll percent -- @tparam Scroll self @{Scroll} -- @tparam vector3 percent target percent --- @tparam[opt] bool is_instant instant scroll flag +-- @tparam[opt] boolean is_instant instant scroll flag -- @usage scroll:scroll_to_percent(vmath.vector3(0.5, 0, 0)) function Scroll.scroll_to_percent(self, percent, is_instant) local border = self.available_pos @@ -342,7 +339,7 @@ end -- If disabled, scroll through points (if exist) -- If no points, just simple drag without inertion -- @tparam Scroll self @{Scroll} --- @tparam bool state Inert scroll state +-- @tparam boolean state Inert scroll state -- @treturn druid.scroll Current scroll instance function Scroll.set_inert(self, state) self._is_inert = state @@ -353,7 +350,7 @@ end --- Return if scroll have inertion. -- @tparam Scroll self @{Scroll} --- @treturn bool If scroll have inertion +-- @treturn boolean @If scroll have inertion function Scroll.is_inert(self) return self._is_inert end @@ -400,7 +397,7 @@ end --- Lock or unlock horizontal scroll -- @tparam Scroll self @{Scroll} --- @tparam bool state True, if horizontal scroll is enabled +-- @tparam boolean state True, if horizontal scroll is enabled -- @treturn druid.scroll Current scroll instance function Scroll.set_horizontal_scroll(self, state) self._is_horizontal_scroll = state @@ -411,7 +408,7 @@ end --- Lock or unlock vertical scroll -- @tparam Scroll self @{Scroll} --- @tparam bool state True, if vertical scroll is enabled +-- @tparam boolean state True, if vertical scroll is enabled -- @treturn druid.scroll Current scroll instance function Scroll.set_vertical_scroll(self, state) self._is_vertical_scroll = state diff --git a/druid/base/static_grid.lua b/druid/base/static_grid.lua index 879bb42..c25a4a3 100644 --- a/druid/base/static_grid.lua +++ b/druid/base/static_grid.lua @@ -102,8 +102,8 @@ end -- You can override this component styles params in druid styles table -- or create your own style -- @table style --- @tfield[opt=false] bool IS_DYNAMIC_NODE_POSES If true, always center grid content as grid pivot sets --- @tfield[opt=false] bool IS_ALIGN_LAST_ROW If true, always align last row of the grid as grid pivot sets +-- @tfield[opt=false] boolean IS_DYNAMIC_NODE_POSES If true, always center grid content as grid pivot sets +-- @tfield[opt=false] boolean IS_ALIGN_LAST_ROW If true, always align last row of the grid as grid pivot sets function StaticGrid.on_style_change(self, style) self.style = {} self.style.IS_DYNAMIC_NODE_POSES = style.IS_DYNAMIC_NODE_POSES or false @@ -113,7 +113,7 @@ end --- The @{StaticGrid} constructor -- @tparam StaticGrid self @{StaticGrid} --- @tparam string|Node parent The GUI Node container, where grid's items will be placed +-- @tparam string|node parent The GUI Node container, where grid's items will be placed -- @tparam node element Element prefab. Need to get it size -- @tparam[opt=1] number in_row How many nodes in row can be placed function StaticGrid.init(self, parent, element, in_row) @@ -151,7 +151,7 @@ local _temp_pos = vmath.vector3(0) --- Return pos for grid node index -- @tparam StaticGrid self @{StaticGrid} -- @tparam number index The grid element index --- @treturn vector3 Node position +-- @treturn vector3 @Node position function StaticGrid.get_pos(self, index) local row = math.ceil(index / self.in_row) - 1 local col = (index - row * self.in_row) - 1 @@ -241,7 +241,7 @@ end -- @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 StaticGrid.remove(self, index, shift_policy, is_instant) assert(self.nodes[index], "No grid item at given index " .. index) @@ -379,7 +379,7 @@ end --- Update grid inner state -- @tparam StaticGrid self @{StaticGrid} --- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback +-- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback -- @local function StaticGrid._update(self, is_instant) self:_update_indexes() @@ -425,7 +425,7 @@ end --- Update grid nodes position -- @tparam StaticGrid self @{StaticGrid} --- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback +-- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback -- @local function StaticGrid._update_pos(self, is_instant) local zero_offset = self:_get_zero_offset() diff --git a/druid/base/text.lua b/druid/base/text.lua index 2551f2b..73dd5f8 100755 --- a/druid/base/text.lua +++ b/druid/base/text.lua @@ -222,7 +222,7 @@ function Text.on_style_change(self, style) end ---- @{Text} constructor +--- The @{Text} constructor -- @tparam Text self @{Text} -- @tparam string|node node Node name or GUI Text Node itself -- @tparam[opt] string value Initial text. Default value is node text from GUI scene. @@ -358,7 +358,7 @@ end --- Set text pivot. Text will re-anchor inside text area -- @tparam Text self @{Text} --- @tparam gui.pivot pivot Gui pivot constant +-- @tparam number pivot The gui.PIVOT_* constant -- @treturn Text Current text instance function Text.set_pivot(self, pivot) local prev_pivot = gui.get_pivot(self.node) @@ -384,7 +384,7 @@ end --- Return true, if text with line break -- @tparam Text self @{Text} --- @treturn bool Is text node with line break +-- @treturn boolean Is text node with line break function Text.is_multiline(self) return gui.get_line_break(self.node) end diff --git a/druid/component.lua b/druid/component.lua index 56d12e3..91964ed 100644 --- a/druid/component.lua +++ b/druid/component.lua @@ -74,7 +74,6 @@ end -- -- Invoke `on_style_change` on component, if exist. Component should handle -- their style changing and store all style params --- @function component:set_style -- @tparam BaseComponent self @{BaseComponent} -- @tparam table druid_style Druid style module -- @treturn BaseComponent @{BaseComponent} @@ -94,7 +93,6 @@ end -- -- 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() --- @function component:set_template -- @tparam BaseComponent self @{BaseComponent} -- @tparam string template BaseComponent template name -- @treturn BaseComponent @{BaseComponent} @@ -118,7 +116,6 @@ end --- Get current component template name. --- @function component:get_template -- @tparam BaseComponent self @{BaseComponent} -- @treturn string Component full template name function BaseComponent.get_template(self) @@ -128,7 +125,6 @@ end --- Set current component nodes. -- Use if your component nodes was cloned with `gui.clone_tree` and you got the node tree. --- @function component:set_nodes -- @tparam BaseComponent self @{BaseComponent} -- @tparam table nodes BaseComponent nodes table -- @treturn BaseComponent @{BaseComponent} @@ -155,7 +151,6 @@ end --- Context used as first arg in all Druid events -- -- Context is usually self of gui_script. --- @function component:get_context -- @tparam BaseComponent self @{BaseComponent} -- @treturn table BaseComponent context function BaseComponent.get_context(self) @@ -164,7 +159,6 @@ end --- Increase input priority in input stack --- @function component:increase_input_priority -- @tparam BaseComponent self @{BaseComponent} -- @local function BaseComponent.increase_input_priority(self) @@ -178,7 +172,6 @@ end -- It autopick node by template name or from nodes by gui.clone_tree -- if they was setup via component:set_nodes, component:set_template. -- If node is not found, the exception will fired --- @function component:get_node -- @tparam BaseComponent self @{BaseComponent} -- @tparam string|node node_or_name Node name or node itself -- @treturn node Gui node @@ -211,9 +204,8 @@ end --- Get Druid instance for inner component creation. --- @function component:get_druid -- @tparam BaseComponent self @{BaseComponent} --- @treturn Druid Druid instance with component context +-- @treturn DruidInstance Druid instance with component context function BaseComponent.get_druid(self) local context = { _context = self } return setmetatable(context, { __index = self._meta.druid }) @@ -221,7 +213,6 @@ end --- Return component name --- @function component:get_name -- @tparam BaseComponent self @{BaseComponent} -- @treturn string The component name function BaseComponent.get_name(self) @@ -230,7 +221,6 @@ end --- Return parent component name --- @function component:get_parent_name -- @tparam BaseComponent self @{BaseComponent} -- @treturn string|nil The parent component name if exist or bil function BaseComponent.get_parent_name(self) @@ -240,7 +230,6 @@ end --- Return component input priority --- @function component:get_input_priority -- @tparam BaseComponent self @{BaseComponent} -- @treturn number The component input priority function BaseComponent.get_input_priority(self) @@ -251,7 +240,6 @@ end --- Set component input priority -- -- Default value: 10 --- @function component:set_input_priority -- @tparam BaseComponent self @{BaseComponent} -- @tparam number value The new input priority value -- @tparam boolean is_temporary If true, the reset input priority will return to previous value @@ -280,7 +268,6 @@ end --- Reset component input priority to default value --- @function component:reset_input_priority -- @tparam BaseComponent self @{BaseComponent} -- @treturn number The component input priority function BaseComponent.reset_input_priority(self) @@ -292,7 +279,6 @@ end --- Return component UID. -- -- UID generated in component creation order. --- @function component:get_uid -- @tparam BaseComponent self @{BaseComponent} -- @treturn number The component uid function BaseComponent.get_uid(self) @@ -303,9 +289,8 @@ end --- Set component input state. By default it enabled -- -- If input is disabled, the component will not receive input events --- @function component:set_input_enabled -- @tparam BaseComponent self @{BaseComponent} --- @tparam bool state The component input state +-- @tparam boolean state The component input state -- @treturn BaseComponent BaseComponent itself function BaseComponent.set_input_enabled(self, state) self._meta.input_enabled = state @@ -319,7 +304,6 @@ end --- Return the parent component if exist --- @function component:get_parent_component -- @tparam BaseComponent self @{BaseComponent} -- @treturn BaseComponent|nil The druid component instance or nil function BaseComponent.get_parent_component(self) @@ -328,7 +312,6 @@ end --- Setup component context and his style table --- @function component:setup_component -- @tparam BaseComponent self @{BaseComponent} -- @tparam table druid_instance The parent druid instance -- @tparam table context Druid context. Usually it is self of script @@ -362,7 +345,6 @@ end --- Basic constructor of component. It will call automaticaly -- by `BaseComponent.create` --- @function component:initialize -- @tparam BaseComponent self @{BaseComponent} -- @tparam string name BaseComponent name -- @tparam[opt=DEFAULT] number input_priority The input priority. The bigger number processed first @@ -380,7 +362,6 @@ end --- Print log information if debug mode is enabled --- @function component:log_message -- @tparam BaseComponent self @{BaseComponent} -- @tparam string message -- @tparam table context @@ -394,9 +375,8 @@ end --- Set debug logs for component enabled or disabled --- @function component:set_debug -- @tparam BaseComponent self @{BaseComponent} --- @tparam bool is_debug +-- @tparam boolean is_debug -- @local function BaseComponent.set_debug(self, is_debug) self._component.is_debug = is_debug @@ -404,7 +384,6 @@ end --- Return true, if input priority was changed --- @function component:_is_input_priority_changed -- @tparam BaseComponent self @{BaseComponent} -- @local function BaseComponent._is_input_priority_changed(self) @@ -413,7 +392,6 @@ end --- Reset is_input_priority_changed field --- @function component:_reset_input_priority_changed -- @tparam BaseComponent self @{BaseComponent} -- @local function BaseComponent._reset_input_priority_changed(self) @@ -427,7 +405,6 @@ end --- Get current component interests --- @function component:__get_interests -- @tparam BaseComponent self @{BaseComponent} -- @treturn table List of component interests -- @local @@ -451,7 +428,6 @@ end --- Get current component nodes --- @function component:__get_nodes -- @tparam BaseComponent self @{BaseComponent} -- @treturn table BaseComponent nodes table -- @local @@ -466,7 +442,6 @@ end --- Add child to component children list --- @function component:__add_children -- @tparam BaseComponent self @{BaseComponent} -- @tparam component children The druid component instance -- @local @@ -476,7 +451,6 @@ end --- Remove child from component children list --- @function component:__remove_children -- @tparam BaseComponent self @{BaseComponent} -- @tparam component children The druid component instance -- @local @@ -490,7 +464,6 @@ end --- Return all children components, recursive --- @function component:get_childrens -- @tparam BaseComponent self @{BaseComponent} -- @treturn table Array of childrens if the Druid component instance function BaseComponent.get_childrens(self) diff --git a/druid/const.lua b/druid/const.lua index 86f674e..30182c6 100755 --- a/druid/const.lua +++ b/druid/const.lua @@ -20,7 +20,7 @@ M.ACTION_SCROLL_DOWN = hash(sys.get_config("druid.input_scroll_down", "mouse_whe M.IS_STENCIL_CHECK = not (sys.get_config("druid.no_stencil_check") == "1") ---- Component Interests + M.ON_INPUT = "on_input" M.ON_UPDATE = "update" M.ON_MESSAGE = "on_message" diff --git a/druid/custom/pin_knob/pin_knob.lua b/druid/custom/pin_knob/pin_knob.lua index 7cb5858..418f6be 100644 --- a/druid/custom/pin_knob/pin_knob.lua +++ b/druid/custom/pin_knob/pin_knob.lua @@ -10,7 +10,7 @@ -- @tfield DruidInstance druid @{DruidInstance} --- Is currently under user control --- @tfield bool is_drag +-- @tfield boolean is_drag --- The pin node -- @tfield node node @@ -52,7 +52,7 @@ local function set_angle(self, value) end ---- Component init function +--- The @{PinKnob} constructor -- @tparam PinKnob self @{PinKnob} -- @tparam function callback Callback(self, value) on value changed -- @tparam string template The template string name diff --git a/druid/custom/rich_input/rich_input.lua b/druid/custom/rich_input/rich_input.lua index feae392..e932d7a 100644 --- a/druid/custom/rich_input/rich_input.lua +++ b/druid/custom/rich_input/rich_input.lua @@ -61,7 +61,7 @@ local function on_unselect(self) end ---- Component init function +--- The @{RichInput} constructor -- @tparam RichInput self @{RichInput} -- @tparam string template The template string name -- @tparam table nodes Nodes table from gui.clone_tree diff --git a/druid/custom/rich_text/rich_text.lua b/druid/custom/rich_text/rich_text.lua index 53cfa91..6f0b0cd 100644 --- a/druid/custom/rich_text/rich_text.lua +++ b/druid/custom/rich_text/rich_text.lua @@ -90,6 +90,7 @@ --- The component druid instance -- @tfield DruidInstance druid @{DruidInstance} +-- local component = require("druid.component") local rich_text = require("druid.custom.rich_text.module.rt") @@ -103,7 +104,7 @@ local SCHEME = { } ---- Rich Text component constructor +--- The @{RichText} constructor -- @tparam RichText self @{RichText} -- @tparam string template The Rich Text template name -- @tparam table nodes The node table, if prefab was copied by gui.clone_tree() diff --git a/druid/event.lua b/druid/event.lua index 6a61594..fdddbf8 100644 --- a/druid/event.lua +++ b/druid/event.lua @@ -32,7 +32,7 @@ end --- Subscribe callback on event -- @tparam DruidEvent self @{DruidEvent} -- @tparam function callback Callback itself --- @tparam[opt] Any context Additional context as first param to callback call, usually it's self +-- @tparam[opt] any context Additional context as first param to callback call, usually it's self -- @usage -- local function on_long_callback(self) -- print("Long click!") @@ -57,7 +57,7 @@ end --- Unsubscribe callback on event -- @tparam DruidEvent self @{DruidEvent} -- @tparam function callback Callback itself --- @tparam[opt] Any context Additional context as first param to callback call +-- @tparam[opt] any context Additional context as first param to callback call -- @usage -- local function on_long_callback(self) -- print("Long click!") @@ -80,7 +80,7 @@ end --- Return true, if event have at lease one handler -- @tparam DruidEvent self @{DruidEvent} --- @treturn bool True if event have handlers +-- @treturn boolean True if event have handlers -- @usage -- local is_long_click_handler_exists = button.on_long_click:is_exist() function DruidEvent.is_exist(self) @@ -102,7 +102,7 @@ end --- Trigger the event and call all subscribed callbacks -- @tparam DruidEvent self @{DruidEvent} --- @tparam Any ... All event params +-- @tparam any ... All event params -- @usage -- local Event = require("druid.event") -- ... diff --git a/druid/extended/checkbox.lua b/druid/extended/checkbox.lua index f3ee5fa..29dfd8b 100755 --- a/druid/extended/checkbox.lua +++ b/druid/extended/checkbox.lua @@ -46,7 +46,7 @@ function Checkbox.on_style_change(self, style) end ---- Component init function +--- The @{Checkbox} constructor -- @tparam Checkbox self @{Checkbox} -- @tparam node node Gui node -- @tparam function callback Checkbox callback @@ -71,9 +71,9 @@ end --- Set checkbox state -- @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 +-- @tparam boolean state Checkbox state +-- @tparam boolean is_silent Don't trigger on_change_state if true +-- @tparam boolean is_instant If instant checkbox change function Checkbox.set_state(self, state, is_silent, is_instant) self.state = state self.style.on_change_state(self, self.node, state, is_instant) @@ -88,7 +88,7 @@ end --- Return checkbox state -- @tparam Checkbox self @{Checkbox} --- @treturn bool Checkbox state +-- @treturn boolean Checkbox state function Checkbox.get_state(self) return self.state end diff --git a/druid/extended/checkbox_group.lua b/druid/extended/checkbox_group.lua index 046bbfa..841fd29 100644 --- a/druid/extended/checkbox_group.lua +++ b/druid/extended/checkbox_group.lua @@ -21,7 +21,7 @@ local component = require("druid.component") local CheckboxGroup = component.create("checkbox_group") ---- Component init function +--- The @{CheckboxGroup} constructor -- @tparam CheckboxGroup self @{CheckboxGroup} -- @tparam node[] nodes Array of gui node -- @tparam function callback Checkbox callback @@ -45,7 +45,7 @@ end --- Set checkbox group state -- @tparam CheckboxGroup self @{CheckboxGroup} --- @tparam bool[] indexes Array of checkbox state +-- @tparam boolean[] indexes Array of checkbox state -- @tparam boolean is_instant If instant state change function CheckboxGroup.set_state(self, indexes, is_instant) for i = 1, #indexes do @@ -58,7 +58,7 @@ end --- Return checkbox group state -- @tparam CheckboxGroup self @{CheckboxGroup} --- @treturn bool[] Array if checkboxes state +-- @treturn boolean[] Array if checkboxes state function CheckboxGroup.get_state(self) local result = {} diff --git a/druid/extended/data_list.lua b/druid/extended/data_list.lua index f7187b7..f3e5be1 100644 --- a/druid/extended/data_list.lua +++ b/druid/extended/data_list.lua @@ -43,7 +43,7 @@ local Event = require("druid.event") local DataList = component.create("data_list") ---- Data list constructor +--- The @{DataList} constructor -- @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 @@ -197,7 +197,7 @@ end --- Return all currenly created nodes in DataList -- @tparam DataList self @{DataList} --- @treturn Node[] List of created nodes +-- @treturn node[] List of created nodes function DataList.get_created_nodes(self) local nodes = {} diff --git a/druid/extended/dynamic_grid.lua b/druid/extended/dynamic_grid.lua index 1fec83f..db58f4c 100644 --- a/druid/extended/dynamic_grid.lua +++ b/druid/extended/dynamic_grid.lua @@ -65,7 +65,7 @@ local AVAILABLE_PIVOTS = { } ---- Component init function +--- The @{DynamicGrid} constructor -- @tparam DynamicGrid self @{DynamicGrid} -- @tparam node parent The gui node parent, where items will be placed function DynamicGrid.init(self, parent) @@ -322,7 +322,7 @@ end --- Update grid inner state -- @tparam DynamicGrid self @{DynamicGrid} --- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback +-- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback -- @local function DynamicGrid._update(self, is_instant) self:_update_indexes() @@ -378,7 +378,7 @@ end --- Update grid nodes position -- @tparam DynamicGrid self @{DynamicGrid} --- @tparam bool is_instant If true, node position update instantly, otherwise with set_position_function callback +-- @tparam boolean is_instant If true, node position update instantly, otherwise with set_position_function callback -- @local function DynamicGrid._update_pos(self, is_instant) for index, node in pairs(self.nodes) do diff --git a/druid/extended/hotkey.lua b/druid/extended/hotkey.lua index 6985f15..d1900e4 100644 --- a/druid/extended/hotkey.lua +++ b/druid/extended/hotkey.lua @@ -27,11 +27,11 @@ local component = require("druid.component") local Hotkey = component.create("hotkey") ---- Component init function +--- The @{Hotkey} constructor -- @tparam Hotkey self @{Hotkey} -- @tparam string[]|string keys The keys to be pressed for trigger callback. Should contains one key and any modificator keys -- @tparam function callback The callback function --- @tparam[opt] value callback_argument The argument to pass into the callback function +-- @tparam[opt] any callback_argument The argument to pass into the callback function function Hotkey.init(self, keys, callback, callback_argument) self.druid = self:get_druid() @@ -63,7 +63,7 @@ end --- Add hotkey for component callback -- @tparam Hotkey self @{Hotkey} -- @tparam string[]|hash[]|string|hash keys that have to be pressed before key pressed to activate --- @tparam[opt] value callback_argument The argument to pass into the callback function +-- @tparam[opt] any callback_argument The argument to pass into the callback function function Hotkey.add_hotkey(self, keys, callback_argument) keys = keys or {} if type(keys) == "string" then diff --git a/druid/extended/input.lua b/druid/extended/input.lua index f08ac6b..0496d18 100755 --- a/druid/extended/input.lua +++ b/druid/extended/input.lua @@ -34,10 +34,10 @@ -- @tfield Button button @{Button} --- Is current input selected now --- @tfield bool is_selected +-- @tfield boolean is_selected --- Is current input is empty now --- @tfield bool is_empty +-- @tfield boolean is_empty --- Max length for input text -- @tfield[opt] number max_length @@ -87,10 +87,10 @@ end -- You can override this component styles params in druid styles table -- or create your own style -- @table style --- @tfield[opt=false] bool IS_LONGTAP_ERASE Is long tap will erase current input data +-- @tfield[opt=false] boolean IS_LONGTAP_ERASE Is long tap will erase current input data -- @tfield[opt=*] string MASK_DEFAULT_CHAR Default character mask for password input --- @tfield[opt=false] bool IS_UNSELECT_ON_RESELECT If true, call unselect on select selected input --- @tfield[opt=false] bool NO_CONSUME_INPUT_WHILE_SELECTED If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured) +-- @tfield[opt=false] boolean IS_UNSELECT_ON_RESELECT If true, call unselect on select selected input +-- @tfield[opt=false] boolean NO_CONSUME_INPUT_WHILE_SELECTED If true, will not consume input while input is selected. It's allow to interact with other components while input is selected (text input still captured) -- @tfield function on_select (self, button_node) Callback on input field selecting -- @tfield function on_unselect (self, button_node) Callback on input field unselecting -- @tfield function on_input_wrong (self, button_node) Callback on wrong user input @@ -115,7 +115,7 @@ function Input.on_style_change(self, style) end ---- Component init function +--- The @{Input} constructor -- @tparam Input self @{Input} -- @tparam node click_node Node to enabled input component -- @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} diff --git a/druid/extended/layout.lua b/druid/extended/layout.lua index 7bcd8f0..8508790 100644 --- a/druid/extended/layout.lua +++ b/druid/extended/layout.lua @@ -28,7 +28,7 @@ local Event = require("druid.event") local Layout = component.create("layout") ---- Component init function +--- The @{Layout} constructor -- @tparam Layout self @{Layout} -- @tparam node node Gui node -- @tparam string mode The layout mode (from const.LAYOUT_MODE) @@ -194,7 +194,7 @@ end --- Set node for layout node to fit inside it. Pass nil to reset -- @tparam Layout self @{Layout} --- @tparam[opt] Node node +-- @tparam[opt] node node -- @treturn Layout @{Layout} function Layout.fit_into_node(self, node) self._fit_node = node diff --git a/druid/extended/progress.lua b/druid/extended/progress.lua index ac24bba..7b3e057 100644 --- a/druid/extended/progress.lua +++ b/druid/extended/progress.lua @@ -110,7 +110,7 @@ function Progress.on_style_change(self, style) end ---- @{Progress} constructor +--- The @{Progress} constructor -- @tparam Progress self @{Progress} -- @tparam string|node node Node name or GUI Node itself. -- @tparam string key Progress bar direction: const.SIDE.X or const.SIDE.Y diff --git a/druid/extended/radio_group.lua b/druid/extended/radio_group.lua index 96aa334..9f0ad06 100644 --- a/druid/extended/radio_group.lua +++ b/druid/extended/radio_group.lua @@ -30,7 +30,7 @@ local function on_checkbox_click(self, index, is_instant) end ---- Component init function +--- The @{RadioGroup} constructor -- @tparam RadioGroup self @{RadioGroup} -- @tparam node[] nodes Array of gui node -- @tparam function callback Radio callback diff --git a/druid/extended/slider.lua b/druid/extended/slider.lua index 8907a8b..d74c12a 100644 --- a/druid/extended/slider.lua +++ b/druid/extended/slider.lua @@ -29,7 +29,7 @@ -- @tfield number dist --- Current drag state --- @tfield bool is_drag +-- @tfield boolean is_drag --- Current slider value -- @tfield number value @@ -56,7 +56,7 @@ local function set_position(self, value) end ---- Component init function +--- The @{Slider} constructor -- @tparam Slider self @{Slider} -- @tparam node node Gui pin node -- @tparam vector3 end_pos The end position of slider @@ -174,7 +174,7 @@ end --- Set value for slider -- @tparam Slider self @{Slider} -- @tparam number value Value from 0 to 1 --- @tparam[opt] bool is_silent Don't trigger event if true +-- @tparam[opt] boolean is_silent Don't trigger event if true function Slider.set(self, value, is_silent) value = helper.clamp(value, 0, 1) set_position(self, value) @@ -202,7 +202,7 @@ end -- move at this position and node drag will start. -- This function require the Defold version 1.3.0+ -- @tparam Slider self @{Slider} --- @tparam Node input_node +-- @tparam node input_node -- @treturn Slider @{Slider} function Slider.set_input_node(self, input_node) self._input_node = self:get_node(input_node) diff --git a/druid/extended/swipe.lua b/druid/extended/swipe.lua index 5b43112..f04c733 100644 --- a/druid/extended/swipe.lua +++ b/druid/extended/swipe.lua @@ -76,7 +76,7 @@ end -- @table style -- @tfield[opt=0.4] number SWIPE_TIME Maximum time for swipe trigger -- @tfield[opt=50] number SWIPE_THRESHOLD Minimum distance for swipe trigger --- @tfield[opt=false] bool SWIPE_TRIGGER_ON_MOVE If true, trigger on swipe moving, not only release action +-- @tfield[opt=false] boolean SWIPE_TRIGGER_ON_MOVE If true, trigger on swipe moving, not only release action function Swipe.on_style_change(self, style) self.style = {} self.style.SWIPE_TIME = style.SWIPE_TIME or 0.4 @@ -85,7 +85,7 @@ function Swipe.on_style_change(self, style) end ---- Component init function +--- The @{Swipe} constructor -- @tparam Swipe self @{Swipe} -- @tparam node node Gui node -- @tparam function on_swipe_callback Swipe callback for on_swipe_end event diff --git a/druid/extended/timer.lua b/druid/extended/timer.lua index 17311e1..299c057 100644 --- a/druid/extended/timer.lua +++ b/druid/extended/timer.lua @@ -44,7 +44,7 @@ local function second_string_min(sec) end ---- Component init function +--- The @{Timer} constructor -- @tparam Timer self @{Timer} -- @tparam node node Gui text node -- @tparam number seconds_from Start timer value in seconds @@ -110,7 +110,7 @@ end --- Called when update -- @tparam Timer self @{Timer} --- @tparam bool is_on Timer enable state +-- @tparam boolean is_on Timer enable state function Timer.set_state(self, is_on) self.is_on = is_on diff --git a/druid/helper.lua b/druid/helper.lua index 64309d0..71afe65 100644 --- a/druid/helper.lua +++ b/druid/helper.lua @@ -255,9 +255,9 @@ end --- Add all elements from source array to the target array -- @function helper.add_array --- @tparam table target Array to put elements from source --- @tparam[opt] table source The source array to get elements from --- @treturn array The target array +-- @tparam any[] target Array to put elements from source +-- @tparam[opt] any[] source The source array to get elements from +-- @treturn any[] The target array function M.add_array(target, source) assert(target) @@ -275,7 +275,7 @@ end --- Make a check with gui.pick_node, but with additional node_click_area check. -- @function helper.pick_node --- @tparam Node node +-- @tparam node node -- @tparam number x -- @tparam number y -- @tparam[opt] Node node_click_area @@ -302,7 +302,7 @@ end --- Get cumulative parent's node scale -- @function helper.get_scene_scale -- @tparam node node Gui node --- @tparam bool include_passed_node_scale True if add current node scale to result +-- @tparam boolean include_passed_node_scale True if add current node scale to result -- @treturn vector3 The scene node scale function M.get_scene_scale(node, include_passed_node_scale) local scale = include_passed_node_scale and gui.get_scale(node) or vmath.vector3(1) @@ -345,7 +345,7 @@ end -- -- Offset shown in [-0.5 .. 0.5] range, where -0.5 is left or bottom, 0.5 is right or top. -- @function helper.get_pivot_offset --- @tparam gui.pivot pivot The node pivot +-- @tparam number pivot The gui.PIVOT_* constant -- @treturn vector3 Vector offset with [-0.5..0.5] values function M.get_pivot_offset(pivot) return const.PIVOTS[pivot] @@ -354,7 +354,7 @@ end --- Check if device is native mobile (Android or iOS) -- @function helper.is_mobile --- @treturn bool Is mobile +-- @treturn boolean Is mobile function M.is_mobile() return const.CURRENT_SYSTEM_NAME == const.OS.IOS or const.CURRENT_SYSTEM_NAME == const.OS.ANDROID @@ -363,7 +363,7 @@ end --- Check if device is HTML5 -- @function helper.is_web --- @treturn bool Is web +-- @treturn boolean Is web function M.is_web() return const.CURRENT_SYSTEM_NAME == const.OS.BROWSER end @@ -420,7 +420,7 @@ end --- Get text metric from GUI node. -- @function helper.get_text_metrics_from_node --- @tparam Node text_node +-- @tparam node text_node -- @treturn GUITextMetrics -- @usage -- type GUITextMetrics = { @@ -451,10 +451,10 @@ end -- Shift policy can be: left, right, no_shift -- @function helper.insert_with_shift -- @tparam table array Array --- @param item Item to insert +-- @param any Item to insert -- @tparam[opt] number index Index to insert. If nil, item will be inserted at the end of array --- @tparam[opt] const.SHIFT shift_policy Shift policy --- @treturn item Inserted item +-- @tparam[opt] number shift_policy The druid_const.SHIFT.* constant +-- @treturn any Inserted item function M.insert_with_shift(array, item, index, shift_policy) shift_policy = shift_policy or const.SHIFT.RIGHT @@ -484,8 +484,8 @@ end -- @function helper.remove_with_shift -- @tparam table array Array -- @tparam[opt] number index Index to remove. If nil, item will be removed from the end of array --- @tparam[opt] const.SHIFT shift_policy Shift policy --- @treturn item Removed item +-- @tparam[opt] number shift_policy The druid_const.SHIFT.* constant +-- @treturn any Removed item function M.remove_with_shift(array, index, shift_policy) shift_policy = shift_policy or const.SHIFT.RIGHT diff --git a/druid/system/druid_instance.lua b/druid/system/druid_instance.lua index b125bb9..688edaf 100755 --- a/druid/system/druid_instance.lua +++ b/druid/system/druid_instance.lua @@ -259,8 +259,8 @@ end --- Create new component. -- @tparam DruidInstance self --- @tparam Component component Component module --- @tparam args ... Other component params to pass it to component:init function +-- @tparam BaseComponent component Component module +-- @tparam any ... Other component params to pass it to component:init function function DruidInstance.new(self, component, ...) local instance = create(self, component) @@ -296,7 +296,7 @@ end -- -- Component `on_remove` function will be invoked, if exist. -- @tparam DruidInstance self --- @tparam Component component Component instance +-- @tparam BaseComponent component Component instance function DruidInstance.remove(self, component) if self._is_late_remove_enabled then table.insert(self._late_remove, component) @@ -380,7 +380,7 @@ end -- @tparam DruidInstance self -- @tparam hash action_id Action_id from on_input -- @tparam table action Action from on_input --- @treturn bool The boolean value is input was consumed +-- @treturn boolean The boolean value is input was consumed function DruidInstance.on_input(self, action_id, action) self._is_late_remove_enabled = true @@ -477,7 +477,7 @@ end -- If whitelist is not empty and component not contains in this list, -- component will be not processed on input step -- @tparam DruidInstance self --- @tparam[opt=nil] table|Component whitelist_components The array of component to whitelist +-- @tparam[opt=nil] table|BaseComponent whitelist_components The array of component to whitelist -- @treturn self @{DruidInstance} function DruidInstance.set_whitelist(self, whitelist_components) if whitelist_components and whitelist_components.isInstanceOf then @@ -499,7 +499,7 @@ end -- If blacklist is not empty and component contains in this list, -- component will be not processed on input step -- @tparam DruidInstance self @{DruidInstance} --- @tparam[opt=nil] table|Component blacklist_components The array of component to blacklist +-- @tparam[opt=nil] table|BaseComponent blacklist_components The array of component to blacklist -- @treturn self @{DruidInstance} function DruidInstance.set_blacklist(self, blacklist_components) if blacklist_components and blacklist_components.isInstanceOf then @@ -518,7 +518,7 @@ end --- Set debug mode for current Druid instance. It's enable debug log messages -- @tparam DruidInstance self @{DruidInstance} --- @tparam bool is_debug +-- @tparam boolean is_debug -- @treturn self @{DruidInstance} -- @local function DruidInstance.set_debug(self, is_debug) @@ -579,7 +579,7 @@ end --- Create @{BackHandler} component -- @tparam DruidInstance self --- @tparam callback callback On back button +-- @tparam function callback @The callback(self, custom_args) to call on back event -- @tparam[opt] any params Callback argument -- @treturn BackHandler @{BackHandler} component function DruidInstance.new_back_handler(self, callback, params) @@ -601,7 +601,7 @@ end -- @tparam DruidInstance self -- @tparam node node Gui text node -- @tparam[opt] string value Initial text. Default value is node text from GUI scene. --- @tparam[opt] bool no_adjust If true, text will be not auto-adjust size +-- @tparam[opt] boolean no_adjust If true, text will be not auto-adjust size -- @treturn Text @{Text} component function DruidInstance.new_text(self, node, value, no_adjust) return DruidInstance.new(self, text, node, value, no_adjust) @@ -676,7 +676,7 @@ end -- @tparam DruidInstance self -- @tparam node node The text node -- @tparam string locale_id Default locale id --- @tparam bool no_adjust If true, will not correct text size +-- @tparam boolean no_adjust If true, will not correct text size -- @treturn LangText @{LangText} component function DruidInstance.new_lang_text(self, node, locale_id, no_adjust) return helper.require_component_message("lang_text") @@ -731,7 +731,7 @@ end --- Create @{DataList} component -- @tparam DruidInstance self -- @tparam Scroll druid_scroll The Scroll instance for Data List component --- @tparam Grid druid_grid The Grid instance for Data List component +-- @tparam StaticGrid|DynamicGrid druid_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]) -- @treturn DataList @{DataList} component function DruidInstance.new_data_list(self, druid_scroll, druid_grid, create_function) @@ -786,10 +786,10 @@ end --- Create @{Hotkey} component -- @tparam DruidInstance self -- @tparam string|string[] keys_array Keys for trigger action. Should contains one action key and any amount of modificator keys --- @tparam function callback Button callback --- @tparam[opt] value params Button callback params +-- @tparam function callback The callback function +-- @tparam[opt] any callback_argument The argument to pass into the callback function -- @treturn Hotkey @{Hotkey} component -function DruidInstance.new_hotkey(self, keys_array, callback, params) +function DruidInstance.new_hotkey(self, keys_array, callback, callback_argument) return helper.require_component_message("hotkey") end diff --git a/utils/annotations_manual.lua b/utils/annotations_manual.lua index 7fb8d1c..d87b665 100644 --- a/utils/annotations_manual.lua +++ b/utils/annotations_manual.lua @@ -1,10 +1,5 @@ -- Manual Annotations -- ----@class druid.rich_text.style ----@field COLORS table ----@field ADJUST_STEPS number ----@field ADJUST_SCALE_DELTA number - ---@class druid.rich_text.metrics ---@field width number ---@field height number @@ -18,7 +13,7 @@ ---@field lines table ---@class druid.rich_text.word ----@field node Node +---@field node node ---@field relative_scale number ---@field color vector4 ---@field position vector3 @@ -26,7 +21,7 @@ ---@field scale vector3 ---@field size vector3 ---@field metrics druid.rich_text.metrics ----@field pivot Pivot +---@field pivot number @ The gui.PIVOT_* constant ---@field text string ---@field shadow vector4 ---@field outline vector4 @@ -37,14 +32,14 @@ ---@field br boolean ---@field nobr boolean ----@class druid.rich_text.word.image +---@class druid.rich_text.image ---@field texture string ---@field anim string ---@field width number ---@field height number ---@class druid.rich_text.settings ----@field parent Node +---@field parent node ---@field size number ---@field fonts table ---@field color vector4 @@ -54,8 +49,8 @@ ---@field image_pixel_grid_snap boolean ---@field combine_words boolean ---@field default_animation string ----@field node_prefab Node ----@field text_prefab Node +---@field node_prefab node +---@field text_prefab node ---@class GUITextMetrics ---@field width number
    init(self, node, seconds_from[, seconds_to=0[, callback]])Component init functionThe Timer constructor
    set_interval(self, from, to)