-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathBasaltLS.lua
More file actions
5872 lines (4748 loc) · 235 KB
/
Copy pathBasaltLS.lua
File metadata and controls
5872 lines (4748 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 Image : VisualElement
---@field bimg table The bimg image data
---@field currentFrame number Current animation frame
---@field autoResize boolean Whether to automatically resize the image when content exceeds bounds
---@field offsetX number Horizontal offset for viewing larger images
---@field offsetY number Vertical offset for viewing larger images
local Image = {}
---Sets the value of the CurrentFrame property.
---@param self Image self
---@param CurrentFrame number Current animation frame
function Image:setCurrentFrame(self, CurrentFrame) 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 Image:render() end
---Sets the text at the specified position
---@param x number The x position
---@param y number The y position
---@param text string The text to set
---@return Image self The Image instance
function Image:setText(x, y, text) end
---Gets the value of the AutoResize property.
---@param self Image self
---@return boolean false Whether to automatically resize the image when content exceeds bounds
function Image:getAutoResize(self) end
---Gets pixel information at position
---@param x number X position
---@param y number Y position
---@return number ? fg Foreground color
---@return number ? bg Background color
---@return string ? char Character at position
function Image:getPixelData(x, y) end
---Sets the metadata of the image
---@param key string The key of the metadata to set
---@param value string The value of the metadata to set
---@return Image self The Image instance
function Image:setMetadata(key, value) end
---Sets the foreground color at the specified position
---@param x number The x position
---@param y number The y position
---@param pattern string The foreground color pattern
---@return Image self The Image instance
function Image:setFg(x, y, pattern) end
---Gets the value of the OffsetX property.
---@param self Image self
---@return number 0 Horizontal offset for viewing larger images
function Image:getOffsetX(self) end
---Gets the specified frame
---@param frameIndex number The index of the frame to get
---@return table frame The frame data
function Image:getFrame(frameIndex) end
---Sets the background color at the specified position
---@param x number The x position
---@param y number The y position
---@param pattern string The background color pattern
---@return Image self The Image instance
function Image:setBg(x, y, pattern) 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 Image self The initialized instance
---@protected
function Image:init(props, basalt) end
---Applies the palette defined in the image to the terminal
---@return Image self The Image instance
function Image:applyPalette() end
---Sets the value of the OffsetX property.
---@param self Image self
---@param OffsetX number Horizontal offset for viewing larger images
function Image:setOffsetX(self, OffsetX) end
---Gets the value of the Bimg property.
---@param self Image self
---@return table {} The bimg image data
function Image:getBimg(self) end
---Updates the specified frame with the provided data
---@param frameIndex number The index of the frame to update
---@param frame table The new frame data
---@return Image self The Image instance
function Image:updateFrame(frameIndex, frame) end
---Restores the previous palette before applyPalette was called
---@return Image self The Image instance
function Image:undoPalette() end
---Advances to the next frame in the animation
---@return Image self The Image instance
function Image:nextFrame() end
---Gets the foreground color at the specified position
---@param x number The x position
---@param y number The y position
---@param length number The length of the foreground color pattern to get
---@return string fg The foreground color pattern
function Image:getFg(x, y, length) end
---Adds a new frame to the image
---@return Image self The Image instance
function Image:addFrame() end
---Gets the value of the CurrentFrame property.
---@param self Image self
---@return number 1 Current animation frame
function Image:getCurrentFrame(self) end
---Gets the size of the image
---@return number width The width of the image
---@return number height The height of the image
function Image:getImageSize() end
---Gets the value of the OffsetY property.
---@param self Image self
---@return number 0 Vertical offset for viewing larger images
function Image:getOffsetY(self) end
---Resizes the image to the specified width and height
---@param width number The new width of the image
---@param height number The new height of the image
---@return Image self The Image instance
function Image:resizeImage(width, height) end
---Sets the pixel at the specified position
---@param x number The x position
---@param y number The y position
---@param char string The character to set
---@param fg string The foreground color pattern
---@param bg string The background color pattern
---@return Image self The Image instance
function Image:setPixel(x, y, char, fg, bg) end
---Gets the text at the specified position
---@param x number The x position
---@param y number The y position
---@param length number The length of the text to get
---@return string text The text at the specified position
function Image:getText(x, y, length) end
---Sets the value of the OffsetY property.
---@param self Image self
---@param OffsetY number Vertical offset for viewing larger images
function Image:setOffsetY(self, OffsetY) end
---Gets the background color at the specified position
---@param x number The x position
---@param y number The y position
---@param length number The length of the background color pattern to get
---@return string bg The background color pattern
function Image:getBg(x, y, length) end
---Sets the value of the Bimg property.
---@param self Image self
---@param Bimg table The bimg image data
function Image:setBimg(self, Bimg) end
---Sets the value of the AutoResize property.
---@param self Image self
---@param AutoResize boolean Whether to automatically resize the image when content exceeds bounds
function Image:setAutoResize(self, AutoResize) end
---Gets the metadata of the image
---@return table metadata The metadata of the image
function Image:getMetadata() end
---@class BigFont : VisualElement
---@field text string The text string to display in enlarged format
---@field fontSize number Scale factor for text size (1-3, where 1 is 3x3 pixels per character)
local BigFont = {}
---Sets the value of the Text property.
---@param self BigFont self
---@param Text string The text string to display in enlarged format
function BigFont:setText(self, Text) 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 BigFont:render() end
---Sets the value of the FontSize property.
---@param self BigFont self
---@param FontSize number Scale factor for text size (1-3, where 1 is 3x3 pixels per character)
function BigFont:setFontSize(self, FontSize) 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 BigFont:init(props, basalt) end
---Gets the value of the Text property.
---@param self BigFont self
---@return string BigFont The text string to display in enlarged format
function BigFont:getText(self) end
---Gets the value of the FontSize property.
---@param self BigFont self
---@return number 1 Scale factor for text size (1-3, where 1 is 3x3 pixels per character)
function BigFont:getFontSize(self) end
---@class Render
local Render = {}
---Sets the size of the render
---@param width number The width of the render
---@param height number The height of the render
---@return Render
function Render:setSize(width, height) end
---Sets the cursor position
---@param x number The x position of the cursor
---@param y number The y position of the cursor
---@param blink boolean Whether the cursor should blink
---@return Render
function Render:setCursor(x, y, blink) end
---Clears an area of the screen
---@param x number The x position of the area
---@param y number The y position of the area
---@param width number The width of the area
---@param height number The height of the area
---@param bg colors The background color to clear the area with
---@return Render
function Render:clearArea(x, y, width, height, bg) end
---Blits a foreground color to the screen
---@param x number The x position
---@param y number The y position
---@param fg string The foreground color to blit
---@return Render
function Render:fg(x, y, fg) end
---Blits text to the screen
---@param x number The x position to blit to
---@param y number The y position to blit to
---@param text string The text to blit
---@param fg string The foreground color of the text
---@param bg string The background color of the text
---@return Render
function Render:blit(x, y, text, fg, bg) end
---Gets the size of the render
---@return number , number
function Render:getSize() end
---Clears the screen
---@param bg colors The background color to clear the screen with
---@return Render
function Render:clear(bg) end
---Adds a dirty rectangle to the buffer
---@param x number The x position of the rectangle
---@param y number The y position of the rectangle
---@param width number The width of the rectangle
---@param height number The height of the rectangle
---@return Render
function Render:addDirtyRect(x, y, width, height) end
---Creates a new Render object
---@param terminal table The terminal object to render to
---@return Render
function Render.new(terminal) end
---Renders the buffer to the screen
---@return Render
function Render:render() end
---Blits text to the screen with a foreground color
---@param x number The x position to blit to
---@param y number The y position to blit to
---@param text string The text to blit
---@param fg colors The foreground color of the text
---@return Render
function Render:textFg(x, y, text, fg) end
---Blits a background color to the screen
---@param x number The x position
---@param y number The y position
---@param bg string The background color to blit
---@return Render
function Render:bg(x, y, bg) end
---Blits text to the screen
---@param x number The x position to blit to
---@param y number The y position to blit to
---@param text string The text to blit
---@return Render
function Render:text(x, y, text) end
---Checks if two rectangles overlap
---@param r1 table The first rectangle
---@param r2 table The second rectangle
---@return boolean
function Render:rectOverlaps(r1, r2) end
---Blits text to the screen with a background color
---@param x number The x position to blit to
---@param y number The y position to blit to
---@param text string The text to blit
---@param bg colors The background color of the text
---@return Render
function Render:textBg(x, y, text, bg) end
---Merges two rectangles
---@param target table The target rectangle
---@param source table The source rectangle
---@return Render
function Render:mergeRects(target, source) end
---Blits text to the screen with multiple lines
---@param x number The x position to blit to
---@param y number The y position to blit to
---@param width number The width of the text
---@param height number The height of the text
---@param text string The text to blit
---@param fg colors The foreground color of the text
---@param bg colors The background color of the text
---@return Render
function Render:multiBlit(x, y, width, height, text, fg, bg) end
---@class SideNav : Container
---@field activeTab number The currently active navigation item ID
---@field activeTabTextColor color Foreground color for the active navigation item text
---@field sidebarScrollOffset number Current scroll offset for navigation items in scrollable mode
---@field sidebarPosition string Position of the sidebar ("left" or "right")
---@field activeTabBackground color Background color for the active navigation item
---@field sidebarWidth number Width of the sidebar navigation area
---@field sidebarBackground color Background color for the sidebar area
---@field tabs table List of navigation item definitions
local SideNav = {}
---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 number xOffset The X offset for content
---@protected
function SideNav:getContentXOffset() end
---Sets the value of the ActiveTabTextColor property.
---@param self SideNav self
---@param ActiveTabTextColor color Foreground color for the active navigation item text
function SideNav:setActiveTabTextColor(self, ActiveTabTextColor) end
---Gets the value of the ActiveTabTextColor property.
---@param self SideNav self
---@return color black Foreground color for the active navigation item text
function SideNav:getActiveTabTextColor(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 props table The properties to initialize the element with
---@param basalt table The basalt instance
---@protected
function SideNav:init(props, basalt) 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 SideNav:sortChildrenEvents() end
---Sets the value of the Tabs property.
---@param self SideNav self
---@param Tabs table List of navigation item definitions
function SideNav:setTabs(self, Tabs) end
function SideNav:drawBg() end
function SideNav:drawFg() end
---Gets the value of the ActiveTabBackground property.
---@param self SideNav self
---@return color white Background color for the active navigation item
function SideNav:getActiveTabBackground(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 child table The child element to check
---@return boolean Whether the child should be visible
---@protected
function SideNav:isChildVisible(child) end
function SideNav:textBg() end
---Scrolls the sidebar up or down
---@param direction number -1 to scroll up, 1 to scroll down
---@return SideNav self For method chaining
function SideNav:scrollSidebar(direction) end
---@param elementType string The type of element to add
---@param tabId number Optional navigation item ID, defaults to active item
---@return table element The created element
function SideNav:addElement(elementType, tabId) 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 SideNav:render() end
function SideNav:setCursor() end
function SideNav:multiBlit() end
---Sets the value of the SidebarScrollOffset property.
---@param self SideNav self
---@param SidebarScrollOffset number Current scroll offset for navigation items in scrollable mode
function SideNav:setSidebarScrollOffset(self, SidebarScrollOffset) end
function SideNav:mouse_drag() end
function SideNav:mouse_move() end
function SideNav:_getSidebarMetrics() end
function SideNav:mouse_up() end
---Gets the value of the SidebarPosition property.
---@param self SideNav self
---@return string left Position of the sidebar ("left" or "right")
function SideNav:getSidebarPosition(self) end
---Sets the value of the SidebarPosition property.
---@param self SideNav self
---@param SidebarPosition string Position of the sidebar ("left" or "right")
function SideNav:setSidebarPosition(self, SidebarPosition) end
---Sets the value of the ActiveTabBackground property.
---@param self SideNav self
---@param ActiveTabBackground color Background color for the active navigation item
function SideNav:setActiveTabBackground(self, ActiveTabBackground) end
function SideNav:blit() end
function SideNav:textFg() end
---Sets the value of the SidebarBackground property.
---@param self SideNav self
---@param SidebarBackground color Background color for the sidebar area
function SideNav:setSidebarBackground(self, SidebarBackground) end
---Gets the value of the SidebarScrollOffset property.
---@param self SideNav self
---@return number 0 Current scroll offset for navigation items in scrollable mode
function SideNav:getSidebarScrollOffset(self) end
---Gets the value of the Tabs property.
---@param self SideNav self
---@return table {} List of navigation item definitions
function SideNav:getTabs(self) end
---Gets the value of the SidebarWidth property.
---@param self SideNav self
---@return number 12 Width of the sidebar navigation area
function SideNav:getSidebarWidth(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 clicked
---@param x number The x position of the click (global)
---@param y number The y position of the click (global)
---@return boolean Whether the event was handled
---@protected
function SideNav: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 child table The child element to add
---@return Container self For method chaining
---@protected
function SideNav:addChild(child) end
---returns a proxy for adding elements to the navigation item
---@param title string The title of the navigation item
---@return table tabHandler The navigation item handler proxy for adding elements
function SideNav:newTab(title) end
function SideNav:mouse_scroll() end
function SideNav:getRelativePosition() end
---@param element table The element to assign to a navigation item
---@param tabId number The ID of the navigation item to assign the element to
---@return SideNav self For method chaining
function SideNav:setTab(element, tabId) end
function SideNav:drawText() end
---Sets the value of the SidebarWidth property.
---@param self SideNav self
---@param SidebarWidth number Width of the sidebar navigation area
function SideNav:setSidebarWidth(self, SidebarWidth) end
---Gets the value of the ActiveTab property.
---@param self SideNav self
---@return number nil The currently active navigation item ID
function SideNav:getActiveTab(self) end
function SideNav:mouse_release() end
---@param tabId number The ID of the navigation item to activate
function SideNav:setActiveTab(tabId) end
---Gets the value of the SidebarBackground property.
---@param self SideNav self
---@return color gray Background color for the sidebar area
function SideNav:getSidebarBackground(self) end
---@class basalt
local basalt = {}
---Returns an element's class without creating a instance
---@param name string The name of the element
---@return table Element The element class
function basalt.getElementClass(name) end
---Creates and returns a new UI element of the specified type.
---@param type string The type of element to create (e.g. "Button", "Label", "BaseFrame")
---@return table element The created element instance
function basalt.create(type) end
---Loads a manifest file that describes element requirements and configuration
---@param path string The path to the manifest file
---@return table manifest The loaded manifest data
function basalt.loadManifest(path) end
---Returns a Plugin API
---@param name string The name of the plugin
---@return table Plugin The plugin API
function basalt.getAPI(name) end
---Returns the focused frame
---@return BaseFrame ? BaseFrame The focused frame
function basalt.getFocus() end
---Returns the active frame
---@return BaseFrame ? BaseFrame The frame to set as active
function basalt.getActiveFrame() end
---Returns the element manager instance
---@return table ElementManager The element manager
function basalt.getElementManager() end
---Sets the active frame
---@param frame BaseFrame The frame to set as active
function basalt.setActiveFrame(frame) end
---Sets a frame as focused
---@param frame BaseFrame The frame to set as focused
function basalt.setFocus(frame) end
---Runs basalt once, can be used to update the UI manually, but you have to feed it the events
function basalt.update() end
---Configures the ElementManager (shortcut to elementManager.configure)
---@param config table Configuration options
function basalt.configure(config) end
---Installs an element interactively or from a specified source
---@param elementName string The name of the element to install
function basalt.install(elementName) end
---Starts the Basalt runtime
function basalt.run() end
---Removes a scheduled update
---@param func thread The scheduled function to remove
---@return boolean success Whether the scheduled function was removed
function basalt.removeSchedule(func) end
---Gets or creates the main frame
---@return BaseFrame BaseFrame The main frame instance
function basalt.getMainFrame() end
---Registers a callback function for a specific event
---@param eventName string The name of the event to listen for (e.g. "mouse_click", "key", "timer")
---@param callback function The callback function to execute when the event occurs
function basalt.onEvent(eventName, callback) end
---Requires specific elements and validates they are available
---@param elements table |string List of element names or single element name
function basalt.requireElements(elements) end
---Creates and returns a new BaseFrame
---@return BaseFrame BaseFrame The created frame instance
function basalt.createFrame() end
---Triggers a custom event and calls all registered callbacks
---@param eventName string The name of the event to trigger
function basalt.triggerEvent(eventName) end
---Removes a callback function for a specific event
---@param eventName string The name of the event
---@param callback function The callback function to remove
---@return boolean success Whether the callback was found and removed
function basalt.removeEvent(eventName, callback) end
---Sets the render throttle time in seconds (default: 0, no throttling)
---@param time number The minimum time in seconds between renders
function basalt.setRenderThrottleTime(time) end
---Returns the error manager instance
---@return table ErrorManager The error manager
function basalt.getErrorManager() end
---Schedules a function to run in a coroutine
---@param func function The function to schedule
---@return thread func The scheduled function
function basalt.schedule(func) end
---Stops the Basalt runtime
function basalt.stop() end
---@class Reactive
local Reactive = {}
---@class AnimationInstance
local AnimationInstance = {}
---Creates a new AnimationInstance
---@param element VisualElement The element to animate
---@param animType string The type of animation
---@param args table The animation arguments
---@param duration number Duration in seconds
---@param easing string The easing function name
---@return AnimationInstance The new animation instance
function AnimationInstance.new(element, animType, args, duration, easing) end
---Updates the animation
---@param elapsed number The elapsed time in seconds
---@return boolean Whether the animation is finished
function AnimationInstance:update(elapsed) end
---Gets called when the animation is completed
function AnimationInstance:complete() end
---Starts the animation
---@return AnimationInstance self The animation instance
function AnimationInstance:start() end
---@class Switch : VisualElement
---@field text string to display next to switch
---@field checked boolean switch is checked
---@field autoSize boolean to automatically size the element to fit switch and text
---@field offBackground number color when OFF
---@field onBackground number color when ON
local Switch = {}
---Sets the value of the Checked property.
---@param self Switch self
---@param Checked boolean switch is checked
function Switch:setChecked(self, Checked) end
---Sets the value of the Text property.
---@param self Switch self
---@param Text string to display next to switch
function Switch:setText(self, Text) end
---Gets the value of the Checked property.
---@param self Switch self
---@return boolean Whether switch is checked
function Switch:getChecked(self) end
---Gets the value of the OnBackground property.
---@param self Switch self
---@return number Background color when ON
function Switch:getOnBackground(self) end
---Sets the value of the AutoSize property.
---@param self Switch self
---@param AutoSize boolean to automatically size the element to fit switch and text
function Switch:setAutoSize(self, AutoSize) end
---Gets the value of the AutoSize property.
---@param self Switch self
---@return boolean Whether to automatically size the element to fit switch and text
function Switch:getAutoSize(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 clicked
---@param x number The x position of the click
---@param y number The y position of the click
---@return boolean Whether the event was handled
---@protected
function Switch:mouse_click(button, x, y) end
---Sets the value of the OffBackground property.
---@param self Switch self
---@param OffBackground number color when OFF
function Switch:setOffBackground(self, OffBackground) end
---Gets the value of the Text property.
---@param self Switch self
---@return string Text to display next to switch
function Switch: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.
---@protected
function Switch: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 props table The properties to initialize the element with
---@param basalt table The basalt instance
---@protected
function Switch:init(props, basalt) end
---Sets the value of the OnBackground property.
---@param self Switch self
---@param OnBackground number color when ON
function Switch:setOnBackground(self, OnBackground) end
---Gets the value of the OffBackground property.
---@param self Switch self
---@return number Background color when OFF
function Switch:getOffBackground(self) end
---@class ElementManager
local ElementManager = {}
---Gets a list of all elements
---@return table ElementList A list of all elements
function ElementManager.getElementList() end
---Tries to load an element from any available source
---@param name string The element name
---@return boolean success Whether the element was loaded
function ElementManager.tryAutoLoad(name) end
---Clears the global cache (_G)
function ElementManager.clearGlobalCache() end
---Gets an Plugin API by name
---@param name string The name of the API to get
---@return table API The API
function ElementManager.getAPI(name) end
---Preloads elements into the global cache
---@param elementNames table List of element names to preload
function ElementManager.preloadElements(elementNames) end
---Gets an element by name. If the element is not loaded, it will try to load it first.
---@param name string The name of the element to get
---@return table Element The element class
function ElementManager.getElement(name) end
---Configures the ElementManager
---@param config table Configuration options
function ElementManager.configure(config) end
---Checks if an element is loaded
---@param name string The element name
---@return boolean loaded Whether the element is loaded
function ElementManager.isElementLoaded(name) end
---Registers a disk mount point for loading elements
---@param mountPath string The path to the disk mount
function ElementManager.registerDiskMount(mountPath) end
---Checks if an element exists (is registered)
---@param name string The element name
---@return boolean exists Whether the element exists
function ElementManager.hasElement(name) end
---Registers a remote source for an element
---@param elementName string The name of the element
---@param url string The URL to load the element from
function ElementManager.registerRemoteSource(elementName, url) end
---Gets cache statistics
---@return table stats Cache statistics with size and element names
function ElementManager.getCacheStats() end
---Loads an element by name. This will load the element and apply any plugins to it.
---@param name string The name of the element to load
function ElementManager.loadElement(name) end
---@class Log
local Log = {}
---Sets if the logger should log
function Log.setEnabled() end
---Sends a warning message to the logger.
function Log.warn() end
---Sends an error message to the logger.
function Log.error() end
---Sets if the logger should log to a file.
function Log.setLogToFile() end
---Sends an info message to the logger.
function Log.info() end
---Sends a debug message to the logger.
function Log.debug() end
---@class BigFontText
local BigFontText = {}
---@class ComboBox : DropDown
---@field text string The current text value of the input field
---@field viewOffset number Horizontal scroll position for viewing long text
---@field autoComplete boolean Enables filtering dropdown items while typing
---@field cursorPos number Current cursor position in the text input
---@field manuallyOpened boolean Indicates if dropdown was opened by user action
---@field editable boolean Enables direct text input in the field
local ComboBox = {}
---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 ComboBox self The initialized instance
---@protected
function ComboBox:init(props, basalt) end
---Handles mouse up events for item selection
---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 handled Whether the event was handled
---@protected
function ComboBox:mouse_up(button, x, y) end
---Gets the value of the Editable property.
---@param self ComboBox self
---@return boolean true Enables direct text input in the field
function ComboBox:getEditable(self) end
---Gets the value of the Text property.
---@param self ComboBox self
---@return string "" The current text value of the input field
function ComboBox:getText(self) end
---Sets the value of the Text property.
---@param self ComboBox self
---@param Text string The current text value of the input field
function ComboBox:setText(self, Text) end
---Sets the value of the Editable property.
---@param self ComboBox self
---@param Editable boolean Enables direct text input in the field
function ComboBox:setEditable(self, Editable) end
---Sets the value of the CursorPos property.
---@param self ComboBox self
---@param CursorPos number Current cursor position in the text input
function ComboBox:setCursorPos(self, CursorPos) end
---Handles character input when editable
---@param char string The character that was typed
function ComboBox:char(char) end
---Sets the value of the ManuallyOpened property.
---@param self ComboBox self
---@param ManuallyOpened boolean Indicates if dropdown was opened by user action
function ComboBox:setManuallyOpened(self, ManuallyOpened) end
---Sets the value of the AutoComplete property.
---@param self ComboBox self
---@param AutoComplete boolean Enables filtering dropdown items while typing
function ComboBox:setAutoComplete(self, AutoComplete) end
---Handles mouse clicks
---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 (1 = left, 2 = right, 3 = middle)
---@param x number The x coordinate of the click
---@param y number The y coordinate of the click
---@return boolean handled Whether the event was handled
---@protected
function ComboBox:mouse_click(button, x, y) end
---Gets the value of the AutoComplete property.
---@param self ComboBox self
---@return boolean false Enables filtering dropdown items while typing
function ComboBox:getAutoComplete(self) end
---Gets the value of the CursorPos property.
---@param self ComboBox self
---@return number 1 Current cursor position in the text input
function ComboBox:getCursorPos(self) end
---Gets the value of the ViewOffset property.
---@param self ComboBox self
---@return number 0 Horizontal scroll position for viewing long text
function ComboBox:getViewOffset(self) end
---Handles key input when editable
---@param key number The key code that was pressed
---@param held boolean Whether the key is being held
function ComboBox:key(key, held) end
---Renders the ComboBox
---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 ComboBox:render() end
---Sets the value of the ViewOffset property.
---@param self ComboBox self
---@param ViewOffset number Horizontal scroll position for viewing long text
function ComboBox:setViewOffset(self, ViewOffset) end
---Gets the value of the ManuallyOpened property.
---@param self ComboBox self
---@return boolean false Indicates if dropdown was opened by user action
function ComboBox:getManuallyOpened(self) end
---Creates a new ComboBox instance
---@return ComboBox self The newly created ComboBox instance
function ComboBox.new() end
---@class Collection : VisualElement
---@field selectable boolean Whether items can be selected
---@field selectedForeground color Text color for selected items
---@field selectedBackground color Background color for selected items
---@field items table Collection of items in the collection.
---@field multiSelection boolean Whether multiple items can be selected at once
local Collection = {}
---Gets the value of the SelectedBackground property.
---@param self Collection self
---@return color blue Background color for selected items
function Collection:getSelectedBackground(self) end
---Gets the value of the Selectable property.
---@param self Collection self
---@return boolean true Whether items can be selected
function Collection:getSelectable(self) end
---Sets the value of the SelectedBackground property.
---@param self Collection self
---@param SelectedBackground color Background color for selected items
function Collection:setSelectedBackground(self, SelectedBackground) end
---Gets the index of the first selected item
---@return number ? index The index of the first selected item, or nil if none selected
function Collection:getSelectedIndex() end
---Gets the value of the SelectedForeground property.
---@param self Collection self
---@return color white Text color for selected items
function Collection:getSelectedForeground(self) end
---Gets the value of the Items property.
---@param self Collection self
---@return table {} Collection of items in the collection.
function Collection:getItems(self) end
---Selects the previous item in the collection
---@return Collection self The Collection instance
function Collection:selectPrevious() end
---Gets the currently selected items
---@return table selected Collection of selected items
function Collection:getSelectedItems() end
---Clears all items from the Collection
---@return Collection self The Collection instance
function Collection:clear() end
function Collection:unselectItem() end
---Sets the value of the SelectedForeground property.
---@param self Collection self
---@param SelectedForeground color Text color for selected items
function Collection:setSelectedForeground(self, SelectedForeground) end
function Collection:clearItemSelection() end
---Gets first selected item
---@return table ? selected The first item
function Collection:getSelectedItem() end
---Sets the value of the Items property.
---@param self Collection self
---@param Items table Collection of items in the collection.
function Collection:setItems(self, Items) end
---Registers a callback for the select event
---@param callback function The callback function to register
---@return Collection self The Collection instance
function Collection:onSelect(callback) end
---Gets the value of the MultiSelection property.
---@param self Collection self
---@return boolean false Whether multiple items can be selected at once
function Collection:getMultiSelection(self) end
---Sets the value of the Selectable property.
---@param self Collection self
---@param Selectable boolean Whether items can be selected
function Collection:setSelectable(self, Selectable) end
---Sets the value of the MultiSelection property.
---@param self Collection self
---@param MultiSelection boolean Whether multiple items can be selected at once