-
Notifications
You must be signed in to change notification settings - Fork 0
/
meta.lua
180 lines (164 loc) · 6.86 KB
/
meta.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
-- The only purpose of this file is to add types for the sumneko.lua extension
---@meta
---@class CallbackRequest
---@field menu { id: string; resource: string; title: string; subtitle?: string }
---@field selected? string
---@field checked? boolean
---@field current? number
---@alias BadgeName
--- | 'card_suit_clubs'
--- | 'card_suit_diamonds'
--- | 'card_suit_hearts'
--- | 'card_suit_spades'
--- | 'medal_bronze'
--- | 'medal_gold'
--- | 'medal_silver'
--- | 'mp_alerttriangle'
--- | 'mp_hostcrown'
--- | 'mp_medal_bronze'
--- | 'mp_medal_gold'
--- | 'mp_medal_silver'
--- | 'mp_specitem_cash'
--- | 'mp_specitem_coke'
--- | 'mp_specitem_heroin'
--- | 'mp_specitem_meth'
--- | 'mp_specitem_weed'
--- | 'shop_ammo_icon'
--- | 'shop_armour_icon'
--- | 'shop_art_icon'
--- | 'shop_barber_icon'
--- | 'shop_chips'
--- | 'shop_clothing_icon'
--- | 'shop_franklin_icon'
--- | 'shop_garage_bike_icon'
--- | 'shop_garage_icon'
--- | 'shop_gunclub_icon'
--- | 'shop_health_icon'
--- | 'shop_lock'
--- | 'shop_lock_arena'
--- | 'shop_makeup_icon'
--- | 'shop_mask_icon'
--- | 'shop_michael_icon'
--- | 'shop_new_star'
--- | 'shop_tattoos_icon'
--- | 'shop_tick_icon'
--- | 'shop_trevor_icon'
--- | 'arrowright'
--- | 'arrowleft'
--- | 'shop_box_blank'
--- | 'shop_box_tick'
--- | 'shop_box_cross'
---@alias MenuType 'button' | 'checkbox' | 'separator' | 'list' | 'slider'
---@alias MenuPosition
---| 'top-left'
---| 'top-center'
---| 'top-right'
---| 'center-left'
---| 'center'
---| 'center-right'
---| 'bottom-left'
---| 'bottom-center'
---| 'bottom-right'
---@class MenuComponentData
---@field id string
---@field type MenuType
---@field label string
---@field rightLabel? string
---@field description? string
---@field badges? { left?: BadgeName; right?: BadgeName }
---@field disabled? boolean
---@field visible boolean
---@field values? string[]
---@field checked? boolean
---@field current? number
---@field iconStyle? 'cross' | 'tick'
---@field max? number
---@field min? number
---@class MenuComponentBase:MenuComponentData
---@field __events table<string, fun(...: any)[]>
---@field on fun(self: self, event: string, func: fun(...: any)): fun()
---@field trigger fun(self: self, event: string, ...: any)
---@field set fun(self: self, key: string, value: any)
---@field OnSelect fun(self: self, func: fun(component: MenuComponent)): fun()
---@field OnClick fun(self: self, func: fun(component: MenuComponent)): fun()
---@field SetLabel fun(self: self, label: string)
---@field SetRightLabel fun(self: self, rightLabel: string)
---@field SetDescription fun(self: self, description: string)
---@field SetBadges fun(self: self, badges: { left?: BadgeName; right?: BadgeName })
---@field Disable fun(self: self, disable: boolean)
---@field ToggleVisiblity fun(self: self, visible: boolean)
---@field Remove fun(self: self)
---@field toJSON fun(self: self): MenuComponentData
---@class CheckboxComponent:MenuComponentBase
---@field type 'checkbox'
---@field checked boolean
---@field iconStyle? 'cross' | 'tick'
---@field OnClick nil
---@field OnCheck fun(self: self, func: fun(checked: boolean)): fun()
---@field SetChecked fun(self: self, checked: boolean)
---@field SetIconStyle fun(self: self, iconStyle: 'cross' | 'tick')
---@class ListComponent:MenuComponentBase
---@field type 'list'
---@field values string[]
---@field current number
---@field OnChange fun(self: self, func: fun(current: number, currentValue: string)): fun()
---@field SetValues fun(self: self, values: string[])
---@field SetCurrent fun(self: self, current: number)
---@class SliderComponent:MenuComponentBase
---@field type 'slider'
---@field current number
---@field max number
---@field min? number
---@field step? number
---@field OnChange fun(self: self, func: fun(current: number)): fun()
---@field SetCurrent fun(self: self, current: number)
---@field SetMax fun(self: self, max: number)
---@field SetMin fun(self: self, min: number)
---@field SetStep fun(self: self, step: number)
---@class SeparatorComponent:MenuComponentBase
---@field type 'separator'
---@field OnClick nil
---@field OnSelect nil
---@field Disable nil
---@field SetRightLabel nil
---@class MenuComponent:MenuComponentBase, CheckboxComponent, ListComponent, SliderComponent, SeparatorComponent
---@class MenuData
---@field id string
---@field resource string
---@field title string
---@field subtitle? string
---@field position MenuPosition
---@field width? number
---@field maxVisibleItems? number
---@field banner? string
---@class Menu:MenuData
---@field __components MenuComponent[]
---@field set fun(self: self, key: string, value: any)
---@field SetTitle fun(self: self, title: string)
---@field SetSubtitle fun(self: self, subtitle: string)
---@field RemoveComponent fun(self: self, id: string)
---@field addComponent fun(self: self, type: MenuType, label: string, rightLabel?: string, description?: string, badges?: { left?: BadgeName; right?: BadgeName }, disabled?: boolean, values?: string[], checked?: boolean, current?: number, iconStyle?: 'cross' | 'tick', max?: number, min?: number, step?: number): MenuComponent
---@field AddButton fun(self: self, label: string, rightLabel?: string, description?: string, badges?: { left?: BadgeName; right?: BadgeName }, disabled?: boolean): MenuComponentBase
---@field AddSubmenu fun(self: self, submenu: Menu | { id: string } | string, label: string, rightLabel?: string, description?: string, badges?: { left?: BadgeName; right?: BadgeName }, disabled?: boolean): MenuComponentBase
---@field AddSeparator fun(self: self, label: string, badges?: { left?: BadgeName; right?: BadgeName }): SeparatorComponent
---@field AddCheckbox fun(self: self, label: string, description?: string, badges?: { left?: BadgeName; right?: BadgeName }, checked?: boolean, iconStyle?: 'cross' | 'tick', disabled?: boolean): CheckboxComponent
---@field AddList fun(self: self, label: string, description?: string, badges?: { left?: BadgeName; right?: BadgeName }, values: string[], current?: number, disabled?: boolean): ListComponent
---@field AddSlider fun(self: self, label: string, description?: string, badges?: { left?: BadgeName; right?: BadgeName }, max: number, min?: number, step?: number, current?: number, disabled?: boolean): SliderComponent
---@field Open fun(self: self)
---@field Close fun(self: self)
---@field IsOpen fun(self: self): boolean
---@field toJSON fun(self: self): MenuData
---@field getComponentById fun(self: self, id: string): MenuComponent?
---@field componentsToJSON fun(self: self): MenuComponentData[]
---@class MenuClass
---@field __cached Menu[]
---@field current? string
---@field opened string[]
---@field Create fun(self: self, title: string, subtitle?: string, postion?: MenuPosition, width?: number, maxVisibleItems?: number, banner?: string): Menu
---@field GetById fun(self: self, id: string): Menu?
---@field GetOpened fun(self: self): Menu?
---@field Open fun(self: self, menu: Menu)
---@field Close fun(self: self)
---@field CloseAll fun(self: self)
---@class MenuClass
Menu = {};