From 5d88e347086e6dac7b9d5d55884d498a4e1590c3 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 26 Feb 2025 23:42:16 +0000 Subject: [PATCH] Update config, LuaLS definitions, bundle and changelog --- config.lua | 636 ++++++++++++++++++++++----------------------- release/basalt.lua | 29 ++- src/LuaLS.lua | 31 ++- 3 files changed, 362 insertions(+), 334 deletions(-) diff --git a/config.lua b/config.lua index a42545f..f8be010 100644 --- a/config.lua +++ b/config.lua @@ -1,361 +1,361 @@ return { - ["metadata"] = { - ["version"] = "2.0", - ["generated"] = "Wed Feb 26 20:03:15 2025", - }, ["categories"] = { - ["plugins"] = { - ["description"] = "Plugins", - ["files"] = { - ["xml"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "plugins/xml.lua", - ["description"] = "", - ["size"] = 6389, - }, - ["reactive"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "plugins/reactive.lua", - ["description"] = "", - ["size"] = 6962, - }, - ["theme"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "plugins/theme.lua", - ["description"] = "", - ["size"] = 5885, - }, - ["animation"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "plugins/animation.lua", - ["description"] = "", - ["size"] = 14116, - }, - ["debug"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "plugins/debug.lua", - ["description"] = "", - ["size"] = 6175, - }, - ["benchmark"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "plugins/benchmark.lua", - ["description"] = "", - ["size"] = 12515, - }, - ["state"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "plugins/state.lua", - ["description"] = "", - ["size"] = 5867, - }, - }, - }, - ["libraries"] = { - ["description"] = "Libraries", - ["files"] = { - ["expect"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "libraries/expect.lua", - ["description"] = "", - ["size"] = 880, - }, - ["colorHex"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "libraries/colorHex.lua", - ["description"] = "", - ["size"] = 132, - }, - ["utils"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "libraries/utils.lua", - ["description"] = "", - ["size"] = 2661, - }, - }, - }, ["elements"] = { - ["description"] = "UI Elements", ["files"] = { - ["Scrollbar"] = { + ["Tree"] = { + ["size"] = 7887, ["default"] = true, + ["path"] = "elements/Tree.lua", + ["description"] = "", ["requires"] = { [1] = "VisualElement", }, + }, + ["Slider"] = { + ["size"] = 4678, + ["default"] = true, + ["path"] = "elements/Slider.lua", + ["description"] = "", + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["Input"] = { + ["size"] = 7851, + ["default"] = true, + ["path"] = "elements/Input.lua", + ["description"] = "A text input field with various features", + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["Scrollbar"] = { + ["size"] = 9166, + ["default"] = true, ["path"] = "elements/Scrollbar.lua", ["description"] = "", - ["size"] = 9166, - }, - ["Program"] = { - ["default"] = true, ["requires"] = { [1] = "VisualElement", }, + }, + ["Dropdown"] = { + ["size"] = 5896, + ["default"] = false, + ["path"] = "elements/Dropdown.lua", + ["description"] = "A dropdown menu that shows a list of selectable items", + ["requires"] = { + [1] = "List", + }, + }, + ["Table"] = { + ["size"] = 7589, + ["default"] = true, + ["path"] = "elements/Table.lua", + ["description"] = "", + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["Image"] = { + ["size"] = 11766, + ["default"] = false, + ["path"] = "elements/Image.lua", + ["description"] = "An element that displays an image in bimg format", + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["BigFont"] = { + ["size"] = 20332, + ["default"] = false, + ["path"] = "elements/BigFont.lua", + ["description"] = "", + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["Button"] = { + ["size"] = 1632, + ["default"] = true, + ["path"] = "elements/Button.lua", + ["description"] = "", + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["TextBox"] = { + ["size"] = 10905, + ["default"] = false, + ["path"] = "elements/TextBox.lua", + ["description"] = "A multi-line text editor component with cursor support and text manipulation features", + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["BaseFrame"] = { + ["size"] = 5868, + ["default"] = true, + ["path"] = "elements/BaseFrame.lua", + ["description"] = "This is the base frame class. It is the root element of all elements and the only element without a parent.", + ["requires"] = { + [1] = "Container", + }, + }, + ["Menu"] = { + ["size"] = 4658, + ["default"] = true, + ["path"] = "elements/Menu.lua", + ["description"] = "A horizontal menu bar with selectable items.", + ["requires"] = { + [1] = "List", + }, + }, + ["Frame"] = { + ["size"] = 4435, + ["default"] = true, + ["path"] = "elements/Frame.lua", + ["description"] = "A frame element that serves as a grouping container for other elements.", + ["requires"] = { + [1] = "Container", + }, + }, + ["Label"] = { + ["size"] = 2948, + ["default"] = true, + ["path"] = "elements/Label.lua", + ["description"] = "A simple text display element that automatically resizes its width based on the text content.", + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["Program"] = { + ["size"] = 6295, + ["default"] = true, ["path"] = "elements/Program.lua", ["description"] = "", - ["size"] = 6295, + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["List"] = { + ["size"] = 8302, + ["default"] = true, + ["path"] = "elements/List.lua", + ["description"] = "A scrollable list of selectable items", + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["Container"] = { + ["size"] = 22866, + ["default"] = true, + ["path"] = "elements/Container.lua", + ["description"] = "The container class. It is a visual element that can contain other elements. It is the base class for all containers", + ["requires"] = { + [1] = "VisualElement", + }, + }, + ["Flexbox"] = { + ["size"] = 11530, + ["default"] = true, + ["path"] = "elements/Flexbox.lua", + ["description"] = "A flexbox container that arranges its children in a flexible layout.", + ["requires"] = { + [1] = "Container", + }, + }, + ["BaseElement"] = { + ["size"] = 8911, + ["default"] = true, + ["path"] = "elements/BaseElement.lua", + ["description"] = "The base class for all UI elements in Basalt.", + ["requires"] = { + }, + }, + ["Checkbox"] = { + ["size"] = 2872, + ["default"] = true, + ["path"] = "elements/Checkbox.lua", + ["description"] = "", + ["requires"] = { + [1] = "VisualElement", + }, }, ["VisualElement"] = { + ["size"] = 16878, ["default"] = true, + ["path"] = "elements/VisualElement.lua", + ["description"] = "The Visual Element class which is the base class for all visual UI elements", ["requires"] = { [1] = "BaseElement", }, - ["path"] = "elements/VisualElement.lua", - ["description"] = "The Visual Element class which is the base class for all visual UI elements", - ["size"] = 16878, - }, - ["Tree"] = { - ["default"] = true, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/Tree.lua", - ["description"] = "", - ["size"] = 7887, - }, - ["Label"] = { - ["default"] = true, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/Label.lua", - ["description"] = "A simple text display element that automatically resizes its width based on the text content.", - ["size"] = 2948, - }, - ["BigFont"] = { - ["default"] = false, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/BigFont.lua", - ["description"] = "", - ["size"] = 20332, - }, - ["Slider"] = { - ["default"] = true, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/Slider.lua", - ["description"] = "", - ["size"] = 4678, - }, - ["Checkbox"] = { - ["default"] = true, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/Checkbox.lua", - ["description"] = "", - ["size"] = 2872, - }, - ["Image"] = { - ["default"] = false, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/Image.lua", - ["description"] = "An element that displays an image in bimg format", - ["size"] = 11767, - }, - ["Menu"] = { - ["default"] = true, - ["requires"] = { - [1] = "List", - }, - ["path"] = "elements/Menu.lua", - ["description"] = "A horizontal menu bar with selectable items.", - ["size"] = 4658, - }, - ["Flexbox"] = { - ["default"] = true, - ["requires"] = { - [1] = "Container", - }, - ["path"] = "elements/Flexbox.lua", - ["description"] = "A flexbox container that arranges its children in a flexible layout.", - ["size"] = 11530, - }, - ["Container"] = { - ["default"] = true, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/Container.lua", - ["description"] = "The container class. It is a visual element that can contain other elements. It is the base class for all containers", - ["size"] = 22866, - }, - ["Dropdown"] = { - ["default"] = false, - ["requires"] = { - [1] = "List", - }, - ["path"] = "elements/Dropdown.lua", - ["description"] = "A dropdown menu that shows a list of selectable items", - ["size"] = 5896, - }, - ["BaseFrame"] = { - ["default"] = true, - ["requires"] = { - [1] = "Container", - }, - ["path"] = "elements/BaseFrame.lua", - ["description"] = "This is the base frame class. It is the root element of all elements and the only element without a parent.", - ["size"] = 5868, - }, - ["Frame"] = { - ["default"] = true, - ["requires"] = { - [1] = "Container", - }, - ["path"] = "elements/Frame.lua", - ["description"] = "A frame element that serves as a grouping container for other elements.", - ["size"] = 4256, - }, - ["TextBox"] = { - ["default"] = false, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/TextBox.lua", - ["description"] = "A multi-line text editor component with cursor support and text manipulation features", - ["size"] = 10905, - }, - ["Table"] = { - ["default"] = true, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/Table.lua", - ["description"] = "", - ["size"] = 7589, - }, - ["Button"] = { - ["default"] = true, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/Button.lua", - ["description"] = "", - ["size"] = 1632, - }, - ["Input"] = { - ["default"] = true, - ["requires"] = { - [1] = "VisualElement", - }, - ["path"] = "elements/Input.lua", - ["description"] = "A text input field with various features", - ["size"] = 7219, - }, - ["BaseElement"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "elements/BaseElement.lua", - ["description"] = "The base class for all UI elements in Basalt.", - ["size"] = 8911, }, ["ProgressBar"] = { + ["size"] = 2273, ["default"] = true, - ["requires"] = { - [1] = "VisualElement", - }, ["path"] = "elements/ProgressBar.lua", ["description"] = "", - ["size"] = 2273, - }, - ["List"] = { - ["default"] = true, ["requires"] = { [1] = "VisualElement", }, - ["path"] = "elements/List.lua", - ["description"] = "A scrollable list of selectable items", - ["size"] = 8302, }, }, + ["description"] = "UI Elements", + }, + ["libraries"] = { + ["files"] = { + ["colorHex"] = { + ["size"] = 132, + ["default"] = true, + ["path"] = "libraries/colorHex.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["expect"] = { + ["size"] = 880, + ["default"] = true, + ["path"] = "libraries/expect.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["utils"] = { + ["size"] = 2661, + ["default"] = true, + ["path"] = "libraries/utils.lua", + ["description"] = "", + ["requires"] = { + }, + }, + }, + ["description"] = "Libraries", }, ["core"] = { - ["description"] = "Core Files", ["files"] = { - ["render"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "render.lua", - ["description"] = "", - ["size"] = 10935, - }, - ["elementManager"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "elementManager.lua", - ["description"] = "", - ["size"] = 6297, - }, - ["propertySystem"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "propertySystem.lua", - ["description"] = "", - ["size"] = 15225, - }, - ["log"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "log.lua", - ["description"] = "", - ["size"] = 3142, - }, - ["errorManager"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "errorManager.lua", - ["description"] = "", - ["size"] = 3789, - }, - ["main"] = { - ["default"] = true, - ["requires"] = { - }, - ["path"] = "main.lua", - ["description"] = "", - ["size"] = 7905, - }, ["init"] = { + ["size"] = 519, ["default"] = true, - ["requires"] = { - }, ["path"] = "init.lua", ["description"] = "", - ["size"] = 519, + ["requires"] = { + }, + }, + ["main"] = { + ["size"] = 7905, + ["default"] = true, + ["path"] = "main.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["log"] = { + ["size"] = 3142, + ["default"] = true, + ["path"] = "log.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["elementManager"] = { + ["size"] = 6297, + ["default"] = true, + ["path"] = "elementManager.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["errorManager"] = { + ["size"] = 3789, + ["default"] = true, + ["path"] = "errorManager.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["propertySystem"] = { + ["size"] = 15225, + ["default"] = true, + ["path"] = "propertySystem.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["render"] = { + ["size"] = 10935, + ["default"] = true, + ["path"] = "render.lua", + ["description"] = "", + ["requires"] = { + }, }, }, + ["description"] = "Core Files", + }, + ["plugins"] = { + ["files"] = { + ["reactive"] = { + ["size"] = 6962, + ["default"] = true, + ["path"] = "plugins/reactive.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["animation"] = { + ["size"] = 14116, + ["default"] = true, + ["path"] = "plugins/animation.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["theme"] = { + ["size"] = 5885, + ["default"] = true, + ["path"] = "plugins/theme.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["benchmark"] = { + ["size"] = 12515, + ["default"] = true, + ["path"] = "plugins/benchmark.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["state"] = { + ["size"] = 5867, + ["default"] = true, + ["path"] = "plugins/state.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["xml"] = { + ["size"] = 6389, + ["default"] = true, + ["path"] = "plugins/xml.lua", + ["description"] = "", + ["requires"] = { + }, + }, + ["debug"] = { + ["size"] = 6175, + ["default"] = true, + ["path"] = "plugins/debug.lua", + ["description"] = "", + ["requires"] = { + }, + }, + }, + ["description"] = "Plugins", }, }, + ["metadata"] = { + ["generated"] = "Wed Feb 26 23:42:11 2025", + ["version"] = "2.0", + }, } \ No newline at end of file diff --git a/release/basalt.lua b/release/basalt.lua index a349bc4..c69d073 100644 --- a/release/basalt.lua +++ b/release/basalt.lua @@ -801,7 +801,7 @@ _b.combineProperties(_b,"size","width","height") _b.combineProperties(_b,"color","foreground","background")_b.defineEvent(_b,"focus") _b.defineEvent(_b,"blur") _b.registerEventCallback(_b,"Click","mouse_click","mouse_up") -_b.registerEventCallback(_b,"MouseUp","mouse_up","mouse_click") +_b.registerEventCallback(_b,"ClickUp","mouse_up","mouse_click") _b.registerEventCallback(_b,"Drag","mouse_drag","mouse_click","mouse_up") _b.registerEventCallback(_b,"Scroll","mouse_scroll") _b.registerEventCallback(_b,"Enter","mouse_enter","mouse_move") @@ -1030,7 +1030,8 @@ aa.defineProperty(aa,"viewOffset",{default=0,type="number",canTriggerRender=true aa.defineProperty(aa,"maxLength",{default=nil,type="number"}) aa.defineProperty(aa,"placeholder",{default="...",type="string"}) aa.defineProperty(aa,"placeholderColor",{default=colors.gray,type="number"}) -aa.defineProperty(aa,"focusedColor",{default=colors.blue,type="number"}) +aa.defineProperty(aa,"focusedBackground",{default=colors.blue,type="number"}) +aa.defineProperty(aa,"focusedForeground",{default=colors.white,type="number"}) aa.defineProperty(aa,"pattern",{default=nil,type="string"}) aa.defineProperty(aa,"cursorColor",{default=nil,type="number"})aa.defineEvent(aa,"mouse_click") aa.defineEvent(aa,"key")aa.defineEvent(aa,"char") @@ -1072,15 +1073,22 @@ local _b=#self.get("text") if ca-da>=ba then self.set("viewOffset",ca-ba+1)elseif ca<=da then self.set("viewOffset", ca-1)end self.set("viewOffset",math.max(0,math.min(self.get("viewOffset"),_b-ba+1)))return self end +function aa:focus()d.focus(self) +self:setCursor(self.get("cursorPos")- +self.get("viewOffset"),1,true,self.get("cursorColor")or self.get("foreground"))self:updateRender()end +function aa:blur()d.blur(self) +self:setCursor(1,1,false,self.get("cursorColor")or +self.get("foreground"))self:updateRender()end function aa:render()local ba=self.get("text")local ca=self.get("viewOffset") local da=self.get("width")local _b=self.get("placeholder") -local ab=self.get("focusedColor")local bb=self.get("focused") -local cb,db=self.get("width"),self.get("height") -self:multiBlit(1,1,cb,db," ",_a[self.get("foreground")],_a[bb and ab or +local ab=self.get("focusedBackground")local bb=self.get("focusedForeground") +local cb=self.get("focused")local db,_c=self.get("width"),self.get("height") +self:multiBlit(1,1,db,_c," ",_a[ +cb and bb or self.get("foreground")],_a[cb and ab or self.get("background")])if #ba==0 and#_b~=0 and self.get("focused")==false then -self:textFg(1,1,_b:sub(1,cb),self.get("placeholderColor"))return end -local _c=ba:sub(ca+1,ca+cb)self:textFg(1,1,_c,self.get("foreground"))end;return aa end +self:textFg(1,1,_b:sub(1,db),self.get("placeholderColor"))return end +local ac=ba:sub(ca+1,ca+db)self:textFg(1,1,ac,self.get("foreground"))end;return aa end project["elements/BaseFrame.lua"] = function(...) local _a=require("elementManager") local aa=_a.getElement("Container")local ba=require("render")local ca=setmetatable({},aa)ca.__index=ca ca.defineProperty(ca,"term",{default= @@ -1177,7 +1185,7 @@ local aa=_a.getElement("VisualElement")local ba=_a.getElement("Container")local ca.__index=ca ca.defineProperty(ca,"draggable",{default=false,type="boolean",setter=function(da,_b) if _b then da:listenEvent("mouse_click",true) -da:listenEvent("mouse_up",true)da:listenEvent("mouse_drag",true)end end}) +da:listenEvent("mouse_up",true)da:listenEvent("mouse_drag",true)end;return _b end}) ca.defineProperty(ca,"draggingMap",{default={{x=1,y=1,width="width",height=1}},type="table"}) function ca.new()local da=setmetatable({},ca):__init() da.set("width",12)da.set("height",6) @@ -1185,7 +1193,8 @@ da.set("background",colors.gray)da.set("z",10)return da end;function ca:init(da, return self end function ca:mouse_click(da,_b,ab) if -(aa.mouse_click(self,da,_b,ab))then local bb,cb=self:getRelativePosition(_b,ab) +aa.mouse_click(self,da,_b,ab)then +if self.get("draggable")then local bb,cb=self:getRelativePosition(_b,ab) local db=self.get("draggingMap") for _c,ac in ipairs(db)do local bc=ac.width or 1;local cc=ac.height or 1;if type(bc)=="string"and bc=="width"then bc=self.get("width")elseif @@ -1196,7 +1205,7 @@ type(cc)=="function"then cc=cc(self)end;local dc=ac.y or 1 if bb>=ac.x and bb<=ac.x+bc-1 and cb>=dc and cb<=dc+cc-1 then self.dragStartX=_b-self.get("x")self.dragStartY=ab-self.get("y")self.dragging=true -return true end end;return ba.mouse_click(self,da,_b,ab)end end +return true end end end;return ba.mouse_click(self,da,_b,ab)end;return false end function ca:mouse_up(da,_b,ab)self.dragging=false;self.dragStartX=nil;self.dragStartY=nil;return ba.mouse_up(self,da,_b,ab)end function ca:mouse_drag(da,_b,ab) diff --git a/src/LuaLS.lua b/src/LuaLS.lua index bb89325..c081234 100644 --- a/src/LuaLS.lua +++ b/src/LuaLS.lua @@ -865,7 +865,8 @@ end ---@field viewOffset number ---@field placeholder string ---@field placeholderColor color ----@field focusedColor color +---@field focusedBackground color +---@field focusedForeground color ---@field cursorColor number local Input = {} @@ -963,17 +964,35 @@ end ---@generic Element: Input ---@param self Element ---@return color -function Input:getFocusedColor() - return self.focusedColor +function Input:getFocusedBackground() + return self.focusedBackground end --- Sets the Background color when input is focused ---@generic Element: Input ---@param self Element ----@param focusedColor color +---@param focusedBackground color ---@return Element -function Input:setFocusedColor(focusedColor) - self.focusedColor = focusedColor +function Input:setFocusedBackground(focusedBackground) + self.focusedBackground = focusedBackground + return self +end + +--- Gets the Foreground color when input is focused +---@generic Element: Input +---@param self Element +---@return color +function Input:getFocusedForeground() + return self.focusedForeground +end + +--- Sets the Foreground color when input is focused +---@generic Element: Input +---@param self Element +---@param focusedForeground color +---@return Element +function Input:setFocusedForeground(focusedForeground) + self.focusedForeground = focusedForeground return self end