-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathBasaltLS.lua
More file actions
5854 lines (4735 loc) · 235 KB
/
BasaltLS.lua
File metadata and controls
5854 lines (4735 loc) · 235 KB
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
---@meta
---@class BaseElement : PropertySystem
---@field states table Table of currently active states with their priorities
---@field id string Auto-generated unique identifier for element lookup
---@field eventCallbacks table Collection of registered event handler functions
---@field type string A hierarchical identifier of the element's type chain
---@field enabled boolean Controls event processing for this element
---@field name string User-defined name for the element
local BaseElement = {}
---Sets the value of the EventCallbacks property.
---@param self BaseElement self
---@param EventCallbacks table Collection of registered event handler functions
function BaseElement:setEventCallbacks(self, EventCallbacks) end
---Gets all currently active states sorted by priority
---@return table states Array of {name, priority} sorted by priority
function BaseElement:getActiveStates() end
---Stops benchmarking for a method
---@param methodName string The name of the method to stop benchmarking
---@return BaseElement self The element instance
function BaseElement:stopBenchmark(methodName) end
---Sets the value of the Name property.
---@param self BaseElement self
---@param Name string User-defined name for the element
function BaseElement:setName(self, Name) end
---Logs benchmark statistics for a method
---@param methodName string The name of the method to log
---@return BaseElement self The element instance
function BaseElement:logBenchmark(methodName) end
---Registers a class-level event listener with optional dependency
---@param class table The class to register
---@param eventName string The name of the event to register
function BaseElement.defineEvent(class, eventName) end
---Executes all registered callbacks for the specified event
---@param event string The event to fire
---@return table self The BaseElement instance
function BaseElement:fireEvent(event) end
---Gets the value of the Id property.
---@param self BaseElement self
---@return string BaseElement Auto-generated unique identifier for element lookup
function BaseElement:getId(self) end
---Ends profiling a method
---@param methodName string The name of the method to stop profiling
---@return BaseElement self The element instance
function BaseElement:endProfile(methodName) end
---Gets the value of the Name property.
---@param self BaseElement self
---@return string BaseElement User-defined name for the element
function BaseElement:getName(self) end
---Configures event listening behavior with automatic parent notification
---@param eventName string The name of the event to listen for
---@return table self The BaseElement instance
function BaseElement:listenEvent(eventName) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param event string The event to handle
---@return boolean ? handled Whether the event was handled
---@protected
function BaseElement:dispatchEvent(event) end
---Gets the highest priority active state
---@return string |nil currentState The state with highest priority
function BaseElement:getCurrentState() end
---Registers a callback for store changes
---@param self BaseElement The element to watch
---@param storeName string The store to watch
---@param callback function Called with (element, newValue, oldValue)
---@return BaseElement self The element instance
function BaseElement:onStoreChange(self, storeName, callback) end
---Traverses parent chain to locate the root frame element
---@return BaseFrame BaseFrame The base frame of the element
function BaseElement:getBaseFrame() end
---Gets the value of the EventCallbacks property.
---@param self BaseElement self
---@return table BaseElement Collection of registered event handler functions
function BaseElement:getEventCallbacks(self) end
---Removes a state from the registry
---@param stateName string The state to remove
---@return BaseElement self
function BaseElement:unregisterState(stateName) end
---Gets the value of the Enabled property.
---@param self BaseElement self
---@return boolean BaseElement Controls event processing for this element
function BaseElement:getEnabled(self) end
---Sets the value of the Id property.
---@param self BaseElement self
---@param Id string Auto-generated unique identifier for element lookup
function BaseElement:setId(self, Id) end
---Checks if the element matches or inherits from the specified type
---@param type string The type to check for
---@return boolean isType Whether the element is of the specified type
function BaseElement:isType(type) end
---Checks if a state is currently active
---@param stateName string The state to check
---@return boolean isActive
function BaseElement:hasState(stateName) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param event string The event to handle
---@return boolean ? handled Whether the event was handled
---@protected
function BaseElement:handleEvent(event) end
---Sets the value of the Type property.
---@param self BaseElement self
---@param Type string A hierarchical identifier of the element's type chain
function BaseElement:setType(self, Type) end
---Gets the value of the States property.
---@param self BaseElement self
---@return table {} Table of currently active states with their priorities
function BaseElement:getStates(self) end
---Applies the current theme to this element
---@param self BaseElement The element to apply theme to
---@param applyToChildren boolean ? Whether to apply theme to child elements (default: true)
---@return BaseElement self The element instance
function BaseElement:applyTheme(self, applyToChildren) end
---Gets the theme properties for this element
---@param self BaseElement The element to get theme for
---@return table styles The theme properties
function BaseElement:getTheme(self) end
---Adds an event handler function with automatic event registration
---@param event string The event to register the callback for
---@param callback function The callback function to register
---@return table self The BaseElement instance
function BaseElement:registerCallback(event, callback) end
---Dumps debug information for this element
---@param self BaseElement The element to dump debug info for
function BaseElement.dumpDebug(self) end
---Starts profiling a method
---@param methodName string The name of the method to profile
---@return BaseElement self The element instance
function BaseElement:startProfile(methodName) end
---Manually activates a state
---@param stateName string The state to activate
---@return BaseElement self
function BaseElement:setState(stateName) end
---Creates a responsive builder for defining responsive states
---@param self BaseElement The element to create the builder for
---@return ResponsiveBuilder builder The responsive builder instance
function BaseElement:responsive(self) end
---Binds a property to a store
---@param self BaseElement The element to bind
---@param propertyName string The property to bind
---@param storeName string The store to bind to (optional, uses propertyName if not provided)
---@return BaseElement self The element instance
function BaseElement:bind(self, propertyName, storeName) end
---Sets the value of the States property.
---@param self BaseElement self
---@param States table Table of currently active states with their priorities
function BaseElement:setStates(self, States) end
---Enables benchmarking for a method
---@param methodName string The name of the method to benchmark
---@return BaseElement self The element instance
function BaseElement:benchmark(methodName) end
---Removes a store change observer
---@param self BaseElement The element to remove observer from
---@param storeName string The store to remove observer from
---@param callback function The callback function to remove
---@return BaseElement self The element instance
function BaseElement:removeStoreChange(self, storeName, callback) end
---Enables debugging for this element
---@param self BaseElement The element to debug
---@param level number The debug level
function BaseElement.debug(self, level) end
---Sets the value of a store
---@param self BaseElement The element to set store for
---@param name string The name of the store
---@param value any The new value for the store
---@return BaseElement self The element instance
function BaseElement:setStore(self, name, value) end
---Gets the value of the Type property.
---@param self BaseElement self
---@return string BaseElement A hierarchical identifier of the element's type chain
function BaseElement:getType(self) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@return table self The BaseElement instance
---@protected
function BaseElement:postInit() end
---Manually deactivates a state
---@param stateName string The state to deactivate
---@return BaseElement self
function BaseElement:unsetState(stateName) end
---Registers a new state with optional auto-condition
---@param stateName string The name of the state
---@return BaseElement self The BaseElement instance
function BaseElement:registerState(stateName) end
---Registers a responsive state that reacts to parent size changes
---@param stateName string The name of the state
---@param condition string |function Condition as string expression or function: function(element) return boolean end
---@return BaseElement self
function BaseElement:registerResponsiveState(stateName, condition) end
---Sets up a property change observer with immediate callback registration
---@param property string The property to observe
---@param callback function The callback to call when the property changes
---@return table self The BaseElement instance
function BaseElement:onChange(property, callback) end
---Sets the value of the Enabled property.
---@param self BaseElement self
---@param Enabled boolean Controls event processing for this element
function BaseElement:setEnabled(self, Enabled) end
---Propagates render request up the element tree
---@return table self The BaseElement instance
function BaseElement:updateRender() end
---Gets the value of a store
---@param self BaseElement The element to get store from
---@param name string The name of the store
---@return any value The current store value
function BaseElement:getStore(self, name) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param props table The properties to initialize the element with
---@param basalt table The basalt instance
---@return table self The initialized instance
---@protected
function BaseElement:init(props, basalt) end
---Updates all states that have auto-conditions
---@return BaseElement self
function BaseElement:updateConditionalStates() end
---Gets benchmark statistics for a method
---@param methodName string The name of the method to get statistics for
---@return table ? stats The benchmark statistics or nil
function BaseElement:getBenchmarkStats(methodName) end
---Defines a class-level event callback method with automatic event registration
---@param class table The class to register
---@param callbackName string The name of the callback to register
function BaseElement.registerEventCallback(class, callbackName) end
function BaseElement:computed() end
---Removes the element from UI tree and cleans up resources
function BaseElement:destroy() end
---@class BaseFrame : Container
---@field term term term.current() The terminal or (monitor) peripheral object to render to
local BaseFrame = {}
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@protected
function BaseFrame:term_resize() end
---Hides the debug log frame
---@param self BaseFrame The frame to hide debug log for
function BaseFrame.closeConsole(self) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param x number The x position to render to
---@param y number The y position to render to
---@param bg colors The background color
---@protected
function BaseFrame:drawBg(x, y, bg) end
function BaseFrame:dispatchEvent() end
---Shows the debug log frame
---@param self BaseFrame The frame to show debug log in
function BaseFrame.openConsole(self) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param button number The button that was released
---@param x number The x position of the mouse
---@param y number The y position of the mouse
---@protected
function BaseFrame:mouse_up(button, x, y) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param button number The button that was clicked
---@param x number The x position of the mouse
---@param y number The y position of the mouse
---@protected
function BaseFrame:mouse_click(button, x, y) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param key number The key that was pressed
---@protected
function BaseFrame:key(key) end
---Sets the cursor position
---@param x number The x position to set the cursor to
---@param y number The y position to set the cursor to
---@param blink boolean Whether the cursor should blink
function BaseFrame:setCursor(x, y, blink) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param x number The x position to render to
---@param y number The y position to render to
---@param text string The text to render
---@protected
function BaseFrame:drawText(x, y, text) end
---Initializes a new store for this element
---@param self BaseFrame The element to initialize store for
---@param name string The name of the store
---@param default any The default value of the store
---@return BaseFrame self The element instance
function BaseFrame:initializeStore(self, name, default) end
---Sets the value of the Term property.
---@param self BaseFrame self
---@param Term term term.current() The terminal or (monitor) peripheral object to render to
function BaseFrame:setTerm(self, Term) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param x number The x position to render to
---@param y number The y position to render to
---@param text string The text to render
---@param fg string The foreground color
---@param bg string The background color
---@protected
function BaseFrame:blit(x, y, text, fg, bg) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@protected
function BaseFrame:render() end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param x number The x position to render to
---@param y number The y position to render to
---@param text string The text to render
---@param bg colors The background color
---@protected
function BaseFrame:textBg(x, y, text, bg) end
function BaseFrame.setup() end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param x number The x position to render to
---@param y number The y position to render to
---@param text string The text to render
---@param fg colors The foreground color
---@protected
function BaseFrame:textFg(x, y, text, fg) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param key number The key that was released
---@protected
function BaseFrame:key_up(key) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param char string The character that was pressed
---@protected
function BaseFrame:char(char) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param name string The name of the monitor that was touched
---@param x number The x position of the mouse
---@param y number The y position of the mouse
---@protected
function BaseFrame:monitor_touch(name, x, y) end
---Toggles the debug log frame
---@param self BaseFrame The frame to toggle debug log for
function BaseFrame.toggleConsole(self) end
---Gets the value of the Term property.
---@param self BaseFrame self
---@return term |peripheral term.current() The terminal or (monitor) peripheral object to render to
function BaseFrame:getTerm(self) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param x number The x position to render to
---@param y number The y position to render to
---@param width number The width of the text
---@param height number The height of the text
---@param text string The text to render
---@param fg string The foreground color
---@param bg string The background color
---@protected
function BaseFrame:multiBlit(x, y, width, height, text, fg, bg) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param x number The x position to render to
---@param y number The y position to render to
---@param fg colors The foreground color
---@protected
function BaseFrame:drawFg(x, y, fg) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param props table The properties to initialize the element with
---@param basalt table The basalt instance
---@return table self The initialized instance
---@protected
function BaseFrame:init(props, basalt) end
---@class CheckBox : VisualElement
---@field text string Text shown when the checkbox is unchecked
---@field checkedText string Text shown when the checkbox is checked
---@field autoSize boolean Automatically adjusts width based on text length
---@field checked boolean The current state of the checkbox (true=checked, false=unchecked)
local CheckBox = {}
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@protected
function CheckBox:render() end
---Gets the value of the AutoSize property.
---@param self CheckBox self
---@return boolean true Automatically adjusts width based on text length
function CheckBox:getAutoSize(self) end
---Sets the value of the Text property.
---@param self CheckBox self
---@param Text string Text shown when the checkbox is unchecked
function CheckBox:setText(self, Text) end
---Sets the value of the AutoSize property.
---@param self CheckBox self
---@param AutoSize boolean Automatically adjusts width based on text length
function CheckBox:setAutoSize(self, AutoSize) end
---Gets the value of the Text property.
---@param self CheckBox self
---@return string empty Text shown when the checkbox is unchecked
function CheckBox:getText(self) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@return CheckBox self The created instance
---@protected
function CheckBox.new() end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param props table The properties to initialize the element with
---@param basalt table The basalt instance
---@protected
function CheckBox:init(props, basalt) end
---Sets the value of the CheckedText property.
---@param self CheckBox self
---@param CheckedText string Text shown when the checkbox is checked
function CheckBox:setCheckedText(self, CheckedText) end
---Handles mouse interactions to toggle the checkbox state
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param button number The button that was clicked
---@param x number The x position of the click
---@param y number The y position of the click
---@return boolean Clicked Whether the event was handled
---@protected
function CheckBox:mouse_click(button, x, y) end
---Gets the value of the Checked property.
---@param self CheckBox self
---@return boolean false The current state of the checkbox (true=checked, false=unchecked)
function CheckBox:getChecked(self) end
---Sets the value of the Checked property.
---@param self CheckBox self
---@param Checked boolean The current state of the checkbox (true=checked, false=unchecked)
function CheckBox:setChecked(self, Checked) end
---Gets the value of the CheckedText property.
---@param self CheckBox self
---@return string x Text shown when the checkbox is checked
function CheckBox:getCheckedText(self) end
---@class Tree : VisualElement
---@field selectedNode table nil Currently selected node
---@field selectedForegroundColor color foreground color of selected node
---@field nodes table The tree structure containing node objects with {text, children} properties
---@field scrollBarBackgroundColor color Background color of the scrollbar
---@field horizontalOffset number Current horizontal scroll position
---@field scrollBarSymbol string " Symbol used for the scrollbar handle
---@field expandedNodes table Table of nodes that are currently expanded
---@field scrollBarColor color Color of the scrollbar handle
---@field offset number Current vertical scroll position
---@field scrollBarBackground string Symbol used for the scrollbar background
---@field showScrollBar boolean Whether to show the scrollbar when nodes exceed height
---@field selectedBackgroundColor color background color of selected node
local Tree = {}
---Sets the value of the ScrollBarBackground property.
---@param self Tree self
---@param ScrollBarBackground string Symbol used for the scrollbar background
function Tree:setScrollBarBackground(self, ScrollBarBackground) end
---Gets the value of the ExpandedNodes property.
---@param self Tree self
---@return table {} Table of nodes that are currently expanded
function Tree:getExpandedNodes(self) end
---Gets the value of the SelectedBackgroundColor property.
---@param self Tree self
---@return color lightBlue background color of selected node
function Tree:getSelectedBackgroundColor(self) end
---Gets the value of the SelectedForegroundColor property.
---@param self Tree self
---@return color white foreground color of selected node
function Tree:getSelectedForegroundColor(self) end
---Gets the value of the ScrollBarBackgroundColor property.
---@param self Tree self
---@return color gray Background color of the scrollbar
function Tree:getScrollBarBackgroundColor(self) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param button number The mouse button being dragged
---@param x number The x-coordinate of the drag
---@param y number The y-coordinate of the drag
---@return boolean Whether the event was handled
---@protected
function Tree:mouse_drag(button, x, y) end
---Expands a node
---@param node table The node to expand
---@return Tree self The Tree instance
function Tree:expandNode(node) end
---Sets the value of the ScrollBarSymbol property.
---@param self Tree self
---@param ScrollBarSymbol string " Symbol used for the scrollbar handle
function Tree:setScrollBarSymbol(self, ScrollBarSymbol) end
---Gets the value of the Nodes property.
---@param self Tree self
---@return table {} The tree structure containing node objects with {text, children} properties
function Tree:getNodes(self) end
---Gets the value of the ShowScrollBar property.
---@param self Tree self
---@return boolean true Whether to show the scrollbar when nodes exceed height
function Tree:getShowScrollBar(self) end
---Gets the value of the ScrollBarColor property.
---@param self Tree self
---@return color lightGray Color of the scrollbar handle
function Tree:getScrollBarColor(self) end
---Toggles a node's expanded state
---@param node table The node to toggle
---@return Tree self The Tree instance
function Tree:toggleNode(node) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param button number The mouse button that was released
---@param x number The x-coordinate of the release
---@param y number The y-coordinate of the release
---@return boolean Whether the event was handled
---@protected
function Tree:mouse_up(button, x, y) end
---Sets the value of the ExpandedNodes property.
---@param self Tree self
---@param ExpandedNodes table Table of nodes that are currently expanded
function Tree:setExpandedNodes(self, ExpandedNodes) end
---Gets the value of the HorizontalOffset property.
---@param self Tree self
---@return number 0 Current horizontal scroll position
function Tree:getHorizontalOffset(self) end
---Gets the size of the tree
---@return number width The width of the tree
---@return number height The height of the tree
function Tree:getNodeSize() end
---Gets the value of the ScrollBarSymbol property.
---@param self Tree self
---@return string " " Symbol used for the scrollbar handle
function Tree:getScrollBarSymbol(self) end
---Registers a callback for when a node is selected
---@param callback function The callback function
---@return Tree self The Tree instance
function Tree:onSelect(callback) end
---Sets the value of the SelectedBackgroundColor property.
---@param self Tree self
---@param SelectedBackgroundColor color background color of selected node
function Tree:setSelectedBackgroundColor(self, SelectedBackgroundColor) end
---Initializes the Tree instance
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param props table The properties to initialize the element with
---@param basalt table The basalt instance
---@return Tree self The initialized instance
---@protected
function Tree:init(props, basalt) end
---Gets the value of the SelectedNode property.
---@param self Tree self
---@return table ? nil Currently selected node
function Tree:getSelectedNode(self) end
---Sets the value of the HorizontalOffset property.
---@param self Tree self
---@param HorizontalOffset number Current horizontal scroll position
function Tree:setHorizontalOffset(self, HorizontalOffset) end
---Sets the value of the ScrollBarBackgroundColor property.
---@param self Tree self
---@param ScrollBarBackgroundColor color Background color of the scrollbar
function Tree:setScrollBarBackgroundColor(self, ScrollBarBackgroundColor) end
---Sets the value of the ScrollBarColor property.
---@param self Tree self
---@param ScrollBarColor color Color of the scrollbar handle
function Tree:setScrollBarColor(self, ScrollBarColor) end
---Collapses a node
---@param node table The node to collapse
---@return Tree self The Tree instance
function Tree:collapseNode(node) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@protected
function Tree:render() end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param direction number The scroll direction (1 for up, -1 for down)
---@param x number The x position of the scroll
---@param y number The y position of the scroll
---@return boolean handled Whether the event was handled
---@protected
function Tree:mouse_scroll(direction, x, y) end
---Gets the value of the Offset property.
---@param self Tree self
---@return number 0 Current vertical scroll position
function Tree:getOffset(self) end
---Handles mouse click events
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param button number The button that was clicked
---@param x number The x position of the click
---@param y number The y position of the click
---@return boolean handled Whether the event was handled
---@protected
function Tree:mouse_click(button, x, y) end
---Sets the value of the SelectedForegroundColor property.
---@param self Tree self
---@param SelectedForegroundColor color foreground color of selected node
function Tree:setSelectedForegroundColor(self, SelectedForegroundColor) end
---Sets the value of the Nodes property.
---@param self Tree self
---@param Nodes table The tree structure containing node objects with {text, children} properties
function Tree:setNodes(self, Nodes) end
---Sets the value of the SelectedNode property.
---@param self Tree self
---@param SelectedNode table nil Currently selected node
function Tree:setSelectedNode(self, SelectedNode) end
---Gets the value of the ScrollBarBackground property.
---@param self Tree self
---@return string "\127" Symbol used for the scrollbar background
function Tree:getScrollBarBackground(self) end
---Sets the value of the ShowScrollBar property.
---@param self Tree self
---@param ShowScrollBar boolean Whether to show the scrollbar when nodes exceed height
function Tree:setShowScrollBar(self, ShowScrollBar) end
---Sets the value of the Offset property.
---@param self Tree self
---@param Offset number Current vertical scroll position
function Tree:setOffset(self, Offset) end
---@class Label : VisualElement
---@field text string The text content to display. Can be a string or a function that returns a string
---@field autoSize boolean Whether the label should automatically resize its width based on the text content
local Label = {}
---Sets the value of the AutoSize property.
---@param self Label self
---@param AutoSize boolean Whether the label should automatically resize its width based on the text content
function Label:setAutoSize(self, AutoSize) end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@protected
function Label:render() end
---Gets the value of the Text property.
---@param self Label self
---@return string Label The text content to display. Can be a string or a function that returns a string
function Label:getText(self) end
---Gets the wrapped lines of the Label
---@return table wrappedText The wrapped lines of the Label
function Label:getWrappedText() end
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@param props table The properties to initialize the element with
---@param basalt table The basalt instance
---@return Label self The initialized instance
---@protected
function Label:init(props, basalt) end
---Sets the value of the Text property.
---@param self Label self
---@param Text string The text content to display. Can be a string or a function that returns a string
function Label:setText(self, Text) end
---Gets the value of the AutoSize property.
---@param self Label self
---@return boolean true Whether the label should automatically resize its width based on the text content
function Label:getAutoSize(self) end
---@class Dialog : Frame
---@field title string The dialog title
---@field buttonForeground color Foreground color for buttons
---@field modal boolean If true, blocks all events outside the dialog
---@field primaryColor color Primary button color (OK, confirm actions)
---@field secondaryColor color Secondary button color (Cancel, dismiss actions)
local Dialog = {}
---Creates a confirm dialog
---@param title string The dialog title
---@param message string The confirmation message
---@param callback function Callback (receives boolean result)
---@return Dialog self The Dialog instance
function Dialog:confirm(title, message, callback) end
---Gets the value of the Title property.
---@param self Dialog self
---@return string "" The dialog title
function Dialog:getTitle(self) end
---Closes the dialog
---@return Dialog self The Dialog instance
function Dialog:close() end
---Handles mouse up events
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@protected
function Dialog:mouse_up() end
---Creates a simple alert dialog
---@param title string The alert title
---@param message string The alert message
---@return Dialog self The Dialog instance
function Dialog:alert(title, message) end
---Shows the dialog
---@return Dialog self The Dialog instance
function Dialog:show() end
---Sets the value of the Modal property.
---@param self Dialog self
---@param Modal boolean If true, blocks all events outside the dialog
function Dialog:setModal(self, Modal) end
---Handles mouse drag events
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@protected
function Dialog:mouse_drag() end
---Gets the value of the Modal property.
---@param self Dialog self
---@return boolean true If true, blocks all events outside the dialog
function Dialog:getModal(self) end
---Renders the dialog
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@protected
function Dialog:render() end
---Handles mouse scroll events
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@protected
function Dialog:mouse_scroll() end
---Sets the value of the ButtonForeground property.
---@param self Dialog self
---@param ButtonForeground color Foreground color for buttons
function Dialog:setButtonForeground(self, ButtonForeground) end
---Handles mouse click events
---This function is protected and should not be called outside of basalt, however you can overwrite it if you know what you're doing.
---@protected
function Dialog:mouse_click() end
---Gets the value of the PrimaryColor property.
---@param self Dialog self
---@return color lime Primary button color (OK, confirm actions)
function Dialog:getPrimaryColor(self) end
---Sets the value of the SecondaryColor property.
---@param self Dialog self
---@param SecondaryColor color Secondary button color (Cancel, dismiss actions)
function Dialog:setSecondaryColor(self, SecondaryColor) end
---Sets the value of the Title property.
---@param self Dialog self
---@param Title string The dialog title
function Dialog:setTitle(self, Title) end
---Gets the value of the SecondaryColor property.
---@param self Dialog self
---@return color lightGray Secondary button color (Cancel, dismiss actions)
function Dialog:getSecondaryColor(self) end
---Creates a prompt dialog with input
---@param title string The dialog title
---@param message string The prompt message
---@return Dialog self The Dialog instance
function Dialog:prompt(title, message) end
---Gets the value of the ButtonForeground property.
---@param self Dialog self
---@return color black Foreground color for buttons
function Dialog:getButtonForeground(self) end
---Sets the value of the PrimaryColor property.
---@param self Dialog self
---@param PrimaryColor color Primary button color (OK, confirm actions)
function Dialog:setPrimaryColor(self, PrimaryColor) end
---@class Benchmark
local Benchmark = {}
---Clears a specific benchmark
---@param name string The name of the benchmark to clear
function API.clear(name) end
---Stops a custom benchmark
---@param name string The name of the benchmark to stop
function API.stop(name) end
---Starts a custom benchmark
---@param name string The name of the benchmark
function API.start(name) end
---Clears all custom benchmarks
function API.clearAll() end
---Gets statistics for a benchmark
---@param name string The name of the benchmark
---@return table ? stats The benchmark statistics or nil
function API.getStats(name) end
---@class ScrollBar : VisualElement
---@field value number Current scroll value
---@field dragMultiplier number How fast the ScrollBar moves when dragging
---@field symbol string " Symbol used for the ScrollBar handle
---@field orientation string Orientation of the ScrollBar ("vertical" or "horizontal")
---@field max number Maximum scroll value
---@field minValue number 0 Minimum value or function that returns it
---@field attachedProperty string nil The property being controlled
---@field step number Step size for scroll operations
---@field backgroundSymbol string Symbol used for the ScrollBar background
---@field symbolBackgroundColor color Background color of the ScrollBar handle
---@field attachedElement table nil The element this ScrollBar is attached to
---@field maxValue number 100 Maximum value or function that returns it
---@field min number Minimum scroll value
---@field handleSize number Size of the ScrollBar handle in characters
local ScrollBar = {}
---Gets the value of the DragMultiplier property.
---@param self ScrollBar self
---@return number 1 How fast the ScrollBar moves when dragging
function ScrollBar:getDragMultiplier(self) end
---Sets the value of the HandleSize property.
---@param self ScrollBar self
---@param HandleSize number Size of the ScrollBar handle in characters
function ScrollBar:setHandleSize(self, HandleSize) end
---Gets the value of the SymbolBackgroundColor property.
---@param self ScrollBar self
---@return color black Background color of the ScrollBar handle
function ScrollBar:getSymbolBackgroundColor(self) end
---Sets the value of the AttachedProperty property.
---@param self ScrollBar self
---@param AttachedProperty string nil The property being controlled
function ScrollBar:setAttachedProperty(self, AttachedProperty) end
---Gets the value of the Orientation property.
---@param self ScrollBar self
---@return string vertical Orientation of the ScrollBar ("vertical" or "horizontal")
function ScrollBar:getOrientation(self) end
---Gets the value of the MaxValue property.
---@param self ScrollBar self
---@return number |function 100 Maximum value or function that returns it
function ScrollBar:getMaxValue(self) end
---Gets the value of the Symbol property.
---@param self ScrollBar self
---@return string " " Symbol used for the ScrollBar handle
function ScrollBar:getSymbol(self) end
---Sets the value of the Value property.
---@param self ScrollBar self
---@param Value number Current scroll value
function ScrollBar:setValue(self, Value) end
---Sets the value of the Min property.
---@param self ScrollBar self
---@param Min number Minimum scroll value
function ScrollBar:setMin(self, Min) end
---Sets the value of the Step property.
---@param self ScrollBar self
---@param Step number Step size for scroll operations
function ScrollBar:setStep(self, Step) end
---Gets the value of the AttachedProperty property.
---@param self ScrollBar self
---@return string ? nil The property being controlled
function ScrollBar:getAttachedProperty(self) end
---Sets the value of the SymbolBackgroundColor property.
---@param self ScrollBar self
---@param SymbolBackgroundColor color Background color of the ScrollBar handle
function ScrollBar:setSymbolBackgroundColor(self, SymbolBackgroundColor) end
---Sets the value of the MaxValue property.
---@param self ScrollBar self
---@param MaxValue number 100 Maximum value or function that returns it
function ScrollBar:setMaxValue(self, MaxValue) end
---Gets the value of the MinValue property.
---@param self ScrollBar self
---@return number |function 0 Minimum value or function that returns it
function ScrollBar:getMinValue(self) end
---Sets the value of the Max property.
---@param self ScrollBar self
---@param Max number Maximum scroll value
function ScrollBar:setMax(self, Max) end
---Gets the value of the Value property.
---@param self ScrollBar self
---@return number 0 Current scroll value
function ScrollBar:getValue(self) end
---Gets the value of the Min property.
---@param self ScrollBar self
---@return number 0 Minimum scroll value
function ScrollBar:getMin(self) end
---Gets the value of the HandleSize property.
---@param self ScrollBar self
---@return number 2 Size of the ScrollBar handle in characters
function ScrollBar:getHandleSize(self) end
---Gets the value of the BackgroundSymbol property.
---@param self ScrollBar self
---@return string "\127" Symbol used for the ScrollBar background
function ScrollBar:getBackgroundSymbol(self) end
---Sets the value of the AttachedElement property.
---@param self ScrollBar self
---@param AttachedElement table nil The element this ScrollBar is attached to
function ScrollBar:setAttachedElement(self, AttachedElement) end
---Updates the attached element's property based on the ScrollBar value
---@return ScrollBar self The ScrollBar instance
function ScrollBar:updateAttachedElement() end
---Sets the value of the BackgroundSymbol property.
---@param self ScrollBar self