Update annotations: dynamic_grid, input, lang_text, progress, radio_roup, slider, timer

This commit is contained in:
Insality
2020-10-12 00:18:37 +03:00
parent bea8e3b329
commit 56d42d6949
9 changed files with 348 additions and 332 deletions

View File

@@ -1,12 +1,5 @@
---@class druid
---@field dynamic_grid druid.dynamic_grid Submodule
---@field helper druid.helper Submodule
---@field input druid.input Submodule
---@field lang_text druid.lang_text Submodule
---@field progress druid.progress Submodule
---@field radio_group druid.radio_group Submodule
---@field slider druid.slider Submodule
---@field timer druid.timer Submodule
---@field new fun(context:table, style:table):druid_instance Create Druid instance.
---@field on_language_change fun() Druid on language change.
---@field on_language_change fun() Callback on global language change event.
@@ -111,33 +104,26 @@
---@field DRAG_DEADZONE field Distance in pixels to start dragging
---@class druid.dynamic_grid : druid.base_component
---@field Events druid.dynamic_grid.Events Component events
---@field Fields druid.dynamic_grid.Fields Component fields
---@field DynamicGrid:_get_side_vector fun(side:unknown, is_forward:unknown) Return side vector to correct node shifting
---@field add fun(node:node, index:number, is_shift_left:bool) Add new node to the grid
---@field clear fun():druid.dynamic_grid Clear grid nodes array.
---@field get_all_pos fun():vector3[] Return array of all node positions
---@field get_index_by_node fun(node:node):number Return grid index by node
---@field get_pos fun(index:number, node:node):vector3 Return pos for grid node index
---@field get_size fun():vector3 Return grid content size
---@field init fun(parent:node) Component init function
---@field remove fun(index:number, is_shift_left:bool) Remove the item from the grid.
---@field set_position_function fun(callback:function):druid.dynamic_grid Change set position function for grid nodes.
---@class druid.dynamic_grid.Events
---@field on_add_item field On item add callback
---@field on_change_items field On item add or remove callback
---@field on_clear field On grid clear callback
---@field on_remove_item field On item remove callback
---@field on_update_positions field On update item positions callback
---@class druid.dynamic_grid.Fields
---@field border field The size of item content
---@field first_index field The first index of node in grid
---@field last_index field The last index of node in grid
---@field node_size field Item size
---@field nodes field List of all grid nodes
---@field parent field Parent gui node
---@field first_index number The first index of node in grid
---@field last_index number The last index of node in grid
---@field node_size vector3 Item size
---@field nodes node[] List of all grid nodes
---@field on_add_item druid_event On item add callback(self, node, index)
---@field on_change_items druid_event On item add or remove callback(self, index)
---@field on_clear druid_event On grid clear callback(self)
---@field on_remove_item druid_event On item remove callback(self, index)
---@field on_update_positions druid_event On update item positions callback(self)
---@field parent node Parent gui node
---@field _get_side_vector fun(self:unknown, side:unknown, is_forward:unknown) Return side vector to correct node shifting
---@field add fun(self:druid.dynamic_grid, node:node, index:number, is_shift_left:bool) Add new node to the grid
---@field clear fun(self:druid.dynamic_grid):druid.dynamic_grid Clear grid nodes array.
---@field get_all_pos fun(self:druid.dynamic_grid):vector3[] Return array of all node positions
---@field get_index_by_node fun(self:druid.dynamic_grid, node:node):number Return grid index by node
---@field get_pos fun(self:druid.dynamic_grid, index:number, node:node, origin_index:number):vector3 Return pos for grid node index
---@field get_size fun(self:druid.dynamic_grid, border:vector3):vector3 Return grid content size
---@field init fun(self:druid.dynamic_grid, parent:node) Component init function
---@field remove fun(self:druid.dynamic_grid, index:number, is_shift_left:bool) Remove the item from the grid.
---@field set_position_function fun(self:druid.dynamic_grid, callback:function):druid.dynamic_grid Change set position function for grid nodes.
---@class druid.helper
---@field centrate_icon_with_text fun(icon_node:box, text_node:text, margin:number) Center two nodes.
@@ -158,33 +144,26 @@
---@field set_mouse_hover fun(self:druid.hover, state:bool) Set mouse hover state
---@class druid.input : druid.base_component
---@field Events druid.input.Events Component events
---@field Fields druid.input.Fields Component fields
---@field Style druid.input.Style Component style params.
---@field get_text fun():string Return current input field text
---@field reset_changes fun() Reset current input selection and return previous value
---@field set_allowerd_characters fun(characters:string):druid.input Set allowed charaters for input field.
---@field set_max_length fun(max_length:number):druid.input Set maximum length for input field.
---@field set_text fun(input_text:string) Set text for input field
---@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 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)
---@field on_input_full druid_event On input field text change to max length string callback(self, input_text)
---@field on_input_select druid_event On input field select callback(self, button_node)
---@field on_input_text druid_event On input field text change callback(self, input_text)
---@field on_input_unselect druid_event On input field unselect callback(self, button_node)
---@field on_input_wrong druid_event On trying user input with not allowed character callback(self, params, button_instance)
---@field style druid.input.style Component style params.
---@field text druid.text Text component
---@field get_text fun(self:druid.input):string Return current input field text
---@field reset_changes fun(self:druid.input) Reset current input selection and return previous value
---@field set_allowed_characters fun(self:druid.input, characters:string):druid.input Set allowed charaters for input field.
---@field set_max_length fun(self:druid.input, max_length:number):druid.input Set maximum length for input field.
---@field set_text fun(self:druid.input, input_text:string) Set text for input field
---@class druid.input.Events
---@field on_input_empty field (self, input_text) On input field text change to empty string callback
---@field on_input_full field (self, input_text) On input field text change to max length string callback
---@field on_input_select field (self, button_node) On input field select callback
---@field on_input_text field (self, input_text) On input field text change callback
---@field on_input_unselect field (self, button_node) On input field unselect callback
---@field on_input_wrong field (self, params, button_instance) On trying user input with not allowed character callback
---@class druid.input.Fields
---@field allowerd_characters field Pattern matching for user input
---@field button field Button component
---@field is_empty field Is current input is empty now
---@field is_selected field Is current input selected now
---@field keyboard_type field Gui keyboard type for input field
---@field max_length field Max length for input text
---@field text field Text component
---@class druid.input.Style
---@class druid.input.style
---@field IS_LONGTAP_ERASE field Is long tap will erase current input data
---@field MASK_DEFAULT_CHAR field Default character mask for password input
---@field button_style field Custom button style for input node
@@ -193,57 +172,36 @@
---@field on_unselect field (self, button_node) Callback on input field unselecting
---@class druid.lang_text : druid.base_component
---@field Events druid.lang_text.Events Component events
---@field Fields druid.lang_text.Fields Component fields
---@field init fun(node:node, locale_id:string, no_adjust:bool) Component init function
---@field set_to fun(text:string) Setup raw text to lang_text component
---@field translate fun(locale_id:string) Translate the text by locale_id
---@class druid.lang_text.Events
---@field on_change field On change text callback
---@class druid.lang_text.Fields
---@field text field The text component
---@field on_change druid_event On change text callback
---@field init fun(self:druid.lang_text, node:node, locale_id:string, no_adjust:bool) Component init function
---@field set_to fun(self:druid.lang_text, text:string) Setup raw text to lang_text component
---@field translate fun(self:druid.lang_text, locale_id:string) Translate the text by locale_id
---@class druid.progress : druid.base_component
---@field Events druid.progress.Events Component events
---@field Fields druid.progress.Fields Component fields
---@field Style druid.progress.Style Component style params.
---@field empty fun() Empty a progress bar
---@field fill fun() Fill a progress bar and stop progress animation
---@field get fun() Return current progress bar value
---@field init fun(node:string|node, key:string, init_value:number) Component init function
---@field set_steps fun(steps:number[], callback:function) Set points on progress bar to fire the callback
---@field set_to fun(to:number) Instant fill progress bar to value
---@field to fun(to:number, callback:function) Start animation of a progress bar
---@field key string The progress bar direction
---@field max_size number Maximum size of progress bar
---@field node node Progress bar fill node
---@field on_change druid_event On progress bar change callback(self, new_value)
---@field scale vector3 Current progress bar scale
---@field size vector3 Current progress bar size
---@field style druid.progress.style Component style params.
---@field empty fun(self:druid.progress) Empty a progress bar
---@field fill fun(self:druid.progress) Fill a progress bar and stop progress animation
---@field get fun(self:druid.progress) Return current progress bar value
---@field init fun(self:druid.progress, node:string|node, key:string, init_value:number) Component init function
---@field set_steps fun(self:druid.progress, steps:number[], callback:function) Set points on progress bar to fire the callback
---@field set_to fun(self:druid.progress, to:number) Instant fill progress bar to value
---@field to fun(self:druid.progress, to:number, callback:function) Start animation of a progress bar
---@class druid.progress.Events
---@field on_change field On progress bar change callback
---@class druid.progress.Fields
---@field key field The progress bar direction
---@field max_size field Maximum size of progress bar
---@field node field Progress bar fill node
---@field scale field Current progress bar scale
---@field size field Current progress bar size
---@field slice field Progress bar slice9 settings
---@class druid.progress.Style
---@class druid.progress.style
---@field MIN_DELTA field Minimum step to fill progress bar
---@field SPEED field Progress bas fill rate. More -> faster
---@class druid.radio_group : druid.base_component
---@field Events druid.radio_group.Events Component events
---@field Fields druid.radio_group.Fields Component fields
---@field get_state fun():number Return radio group state
---@field init fun(node:node[], callback:function, click:node[]) Component init function
---@field set_state fun(index:number) Set radio group state
---@class druid.radio_group.Events
---@field on_radio_click field On any checkbox click
---@class druid.radio_group.Fields
---@field checkboxes field Array of checkbox components
---@field on_radio_click druid_event On any checkbox click
---@field get_state fun(self:druid.radio_group):number Return radio group state
---@field init fun(self:druid.radio_group, nodes:node[], callback:function, click_nodes:node[]) Component init function
---@field set_state fun(self:druid.radio_group, index:number) Set radio group state
---@class druid.scroll : druid.base_component
---@field available_pos vector4 Available position for content node: (min_x, max_y, max_x, min_y)
@@ -288,24 +246,17 @@
---@field SMALL_CONTENT_SCROLL field If true, content node with size less than view node size can be scrolled
---@class druid.slider : druid.base_component
---@field Events druid.slider.Events Component events
---@field Fields druid.slider.Fields Component fields
---@field init fun(node:node, end_pos:vector3, callback:function) Component init function
---@field set fun(value:number, is_silent:bool) Set value for slider
---@field set_steps fun(steps:number[]) Set slider steps.
---@class druid.slider.Events
---@field on_change_value field On change value callback
---@class druid.slider.Fields
---@field dist field Length between start and end position
---@field end_pos field End pin node position
---@field is_drag field Current drag state
---@field node field Slider pin node
---@field pos field Current pin node position
---@field start_pos field Start pin node position
---@field target_pos field Targer pin node position
---@field value field Current slider value
---@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 node node Slider pin node
---@field on_change_value druid_event On change value callback(self, value)
---@field pos vector3 Current pin node position
---@field start_pos vector3 Start pin node position
---@field target_pos vector3 Targer pin node position
---@field init fun(self:druid.slider, node:node, end_pos:vector3, callback:function) Component init function
---@field set fun(self:druid.slider, value:number, is_silent:bool) Set value for slider
---@field set_steps fun(self:druid.slider, steps:number[]) Set slider steps.
---@class druid.static_grid : druid.base_component
---@field anchor vector3 Item anchor
@@ -364,23 +315,16 @@
---@field set_to fun(self:druid.text, set_to:string) Set text to text field
---@class druid.timer : druid.base_component
---@field Events druid.timer.Events Component events
---@field Fields druid.timer.Fields Component fields
---@field init fun(node:node, seconds_from:number, seconds_to:number, callback:function) Component init function
---@field set_interval fun(from:number, to:number) Set time interval
---@field set_state fun(is_on:bool) Called when update
---@field set_to fun(set_to:number) Set text to text field
---@class druid.timer.Events
---@field on_set_enabled field On timer change enabled state callback
---@field on_tick field On timer tick callback. Fire every second
---@field on_timer_end field On timer end callback
---@class druid.timer.Fields
---@field from field Initial timer value
---@field node field Trigger node
---@field target field Target timer value
---@field value field Current timer value
---@field from number Initial timer value
---@field node node Trigger node
---@field on_set_enabled druid_event On timer change enabled state callback(self, is_enabled)
---@field on_tick druid_event On timer tick.
---@field on_timer_end druid_event On timer end callback
---@field target number Target timer value
---@field init fun(self:druid.timer, node:node, seconds_from:number, seconds_to:number, callback:function) Component init function
---@field set_interval fun(self:druid.timer, from:number, to:number) Set time interval
---@field set_state fun(self:druid.timer, is_on:bool) Called when update
---@field set_to fun(self:druid.timer, set_to:number) Set text to text field
---@class druid_event
---@field clear fun(self:druid_event) Clear the all event handlers