Skip to content

Commit 1f7cc18

Browse files
author
AliksusFootages
committed
1.4.4
1 parent c358608 commit 1f7cc18

File tree

7 files changed

+237
-233
lines changed

7 files changed

+237
-233
lines changed

dist/main.lua

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

main.lua

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,53 @@ local Paragraph1 = MainTab:Paragraph({
114114
local Paragraph = MainTab:Paragraph({
115115
Title = "Paragraph without content",
116116
})
117+
local Paragraph2 = MainTab:Paragraph({
118+
Title = "Paragraph with Lucide icon.",
119+
--Desc = "Paragraph With Lucide icon.",
120+
Image = "frown"
121+
})
122+
local Paragraph3 = MainTab:Paragraph({
123+
Title = "Paragraph with URL image.",
124+
--Desc = "Paragraph With Lucide icon.",
125+
Image = "https://images.opencollective.com/lucide-icons/9fe79a6/logo/256.png"
126+
})
127+
local Paragraph4 = MainTab:Paragraph({
128+
Title = "Paragraph with rbxassetid:// image and ImageSize=20",
129+
Desc = "BHub is my unsuccessful project",
130+
Image = "rbxassetid://13899223441",
131+
ImageSize = 20,
132+
})
133+
local Paragraph5 = MainTab:Paragraph({
134+
Title = "Paragraph with Buttons",
135+
Buttons = {
136+
{
137+
Title = "Button 1",
138+
Callback = function() print("hi") end
139+
},
140+
{
141+
Title = "Button 2",
142+
Callback = function() print("hi 2") end
143+
}
144+
}
145+
})
146+
local Paragraph6 = MainTab:Paragraph({
147+
Title = "Paragraph with Buttons and Image",
148+
Image = "car",
149+
Buttons = {
150+
{
151+
Title = "Button 1",
152+
Callback = function() print("hi") end
153+
},
154+
{
155+
Title = "Button 2",
156+
Callback = function() print("hi 2") end
157+
},
158+
{
159+
Title = "Button 3",
160+
Callback = function() print("hi 2") end
161+
}
162+
}
163+
})
117164

118165
MainTab:Section({ Title = "Code" })
119166

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"docs:dev": "vitepress dev docs",
77
"docs:build": "vitepress build docs",
88
"docs:serve": "vitepress serve docs",
9-
"dev": "darklua process main.lua dist/main.lua --config darklua.dev.config.json && lua build/init.lua",
10-
"build": "darklua process src/init.lua dist/main.lua --config darklua.config.json && lua build/init.lua"
9+
"dev": "npx darklua process main.lua dist/main.lua --config darklua.dev.config.json && lua build/init.lua",
10+
"build": "npx darklua process src/init.lua dist/main.lua --config darklua.config.json && lua build/init.lua"
1111
},
1212
"devDependencies": {
1313
"vue": "3.2.44",

src/Components/Element.lua

Lines changed: 49 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,54 @@ return function(Config)
77
Title = Config.Title,
88
Desc = Config.Desc or nil,
99
Hover = Config.Hover,
10+
Image = Config.Image,
11+
ImageSize = Config.ImageSize or 30,
1012
UIPadding = 12,
1113
UIElements = {}
1214
}
1315

16+
local ImageSize = Element.ImageSize
1417
local CanHover = true
1518

19+
local ImageFrame
20+
if Element.Image then
21+
local ImageLabel = New("ImageLabel", {
22+
Size = UDim2.new(1,0,1,0),
23+
BackgroundTransparency = 1,
24+
ThemeTag = Creator.Icon(Element.Image) and {
25+
ImageColor3 = "Text"
26+
} or nil
27+
}, {
28+
New("UICorner", {
29+
CornerRadius = UDim.new(0,8)
30+
})
31+
})
32+
ImageFrame = New("Frame", {
33+
Size = UDim2.new(0,ImageSize,0,ImageSize),
34+
AutomaticSize = "XY",
35+
BackgroundTransparency = 1,
36+
}, {
37+
ImageLabel
38+
})
39+
if Creator.Icon(Element.Image) then
40+
ImageLabel.Image = Creator.Icon(Element.Image)[1]
41+
ImageLabel.ImageRectOffset = Creator.Icon(Element.Image)[2].ImageRectPosition
42+
ImageLabel.ImageRectSize = Creator.Icon(Element.Image)[2].ImageRectSize
43+
end
44+
if string.find(Element.Image,"http") then
45+
if not isfile("WindUI" .. Config.Window.Folder .. "/Assets/" .. Element.Title .. ".png") then
46+
local response = request({
47+
Url = Element.Image,
48+
Method = "GET",
49+
}).Body
50+
writefile("WindUI" .. Config.Window.Folder .. "/Assets/" .. Element.Title .. ".png", response)
51+
end
52+
ImageLabel.Image = getcustomasset("WindUI" .. Config.Window.Folder .. "/Assets/" .. Element.Title .. ".png")
53+
elseif string.find(Element.Image,"rbxassetid") then
54+
ImageLabel.Image = Element.Image
55+
end
56+
end
57+
1658
Element.UIElements.Main = New("TextButton", {
1759
Size = UDim2.new(1,0,0,0),
1860
AutomaticSize = "Y",
@@ -24,11 +66,12 @@ return function(Config)
2466
New("UICorner", {
2567
CornerRadius = UDim.new(0,8),
2668
}),
69+
ImageFrame,
2770
New("Frame", {
28-
Size = UDim2.new(1,0,0,0),
71+
Size = UDim2.new(1,Element.Image and -(ImageSize+Element.UIPadding),0,0),
2972
AutomaticSize = "Y",
30-
--AnchorPoint = Vector2.new(0,0.5),
31-
--Position = UDim2.new(0,0,0.5,0),
73+
AnchorPoint = Vector2.new(0,0),
74+
Position = UDim2.new(0,Element.Image and ImageSize+Element.UIPadding or 0,0,0),
3275
BackgroundTransparency = 1,
3376
Name = "Title"
3477
}, {
@@ -179,8 +222,9 @@ return function(Config)
179222
-- Desc.Size = UDim2.new(1,-Config.TextOffset,0,Desc.TextBounds.Y)
180223
-- end)
181224
else
182-
Element.UIElements.Main.Title.AnchorPoint = Vector2.new(0,0.5)
183-
Element.UIElements.Main.Title.Position = UDim2.new(0,0,0.5,0)
225+
Element.UIElements.Main.Title.AnchorPoint = Vector2.new(0,Config.IsButtons and 0 or 0.5)
226+
Element.UIElements.Main.Title.Size = UDim2.new(1,Element.Image and -(ImageSize+Element.UIPadding),0,0)
227+
Element.UIElements.Main.Title.Position = UDim2.new(0,Element.Image and ImageSize+Element.UIPadding or 0,Config.IsButtons and 0 or 0.5,0)
184228
end
185229

186230
if Element.Hover then

src/Components/Tab.lua

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,12 +267,59 @@ function TabModule.New(Config)
267267
local Paragraph = require("../Components/Element")({
268268
Title = ElementConfig.Title or "Paragraph",
269269
Desc = ElementConfig.Desc,
270+
Image = ElementConfig.Image,
271+
ImageSize = ElementConfig.ImageSize,
270272
Locked = ElementConfig.Locked,
271273
Parent = Tab.UIElements.ContainerFrame,
274+
IsButtons = ElementConfig.Buttons and #ElementConfig.Buttons > 0 and true or false,
272275
Theme = TabModule.Window.Theme,
273276
TextOffset = 0,
277+
Window = Window,
274278
Hover = false,
275279
})
280+
if ElementConfig.Buttons and #ElementConfig.Buttons > 0 then
281+
local ButtonsContainer = New("Frame", {
282+
Size = UDim2.new(1,0,0,0),
283+
BackgroundTransparency = 1,
284+
Position = UDim2.new(0,0,0,ElementConfig.Image and Paragraph.ImageSize > Paragraph.UIElements.Main.Title.AbsoluteSize.Y and Paragraph.ImageSize+Paragraph.UIPadding or Paragraph.UIElements.Main.Title.AbsoluteSize.Y+Paragraph.UIPadding),
285+
AutomaticSize = "Y",
286+
Parent = Paragraph.UIElements.Main
287+
}, {
288+
New("UIListLayout", {
289+
Padding = UDim.new(0,10),
290+
FillDirection = "Horizontal",
291+
})
292+
})
293+
294+
for _,ButtonData in next, ElementConfig.Buttons do
295+
local Button = New("TextButton", {
296+
Text = ButtonData.Title,
297+
TextSize = 16,
298+
AutomaticSize = "Y",
299+
ThemeTag = {
300+
TextColor3 = "Accent",
301+
BackgroundColor3 = "Text"
302+
},
303+
FontFace = Font.new(Creator.Font, Enum.FontWeight.Medium),
304+
BackgroundTransparency = 0.1,
305+
Size = UDim2.new(1 / #ElementConfig.Buttons, -(((#ElementConfig.Buttons - 1) * 10) / #ElementConfig.Buttons), 0, 32),
306+
Parent = ButtonsContainer,
307+
}, {
308+
New("UICorner", {
309+
CornerRadius = UDim.new(0,8)
310+
})
311+
})
312+
Button.MouseEnter:Connect(function()
313+
Tween(Button, 0.1, {BackgroundTransparency = .3}):Play()
314+
end)
315+
Button.MouseButton1Click:Connect(function()
316+
Tween(Button, 0.1, {BackgroundTransparency = .1}):Play()
317+
end)
318+
Button.MouseButton1Click:Connect(function()
319+
ButtonData.Callback()
320+
end)
321+
end
322+
end
276323
Tab.Elements["Paragraph"] = Paragraph
277324
return Paragraph
278325
end

src/Components/Window.lua

Lines changed: 75 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ return function(Config)
3232
Closed = false,
3333
HasOutline = Config.HasOutline or false,
3434
SuperParent = Config.Parent,
35-
Destroyed = false
35+
Destroyed = false,
36+
IsFullscreen = false
3637
}
3738

3839
if Window.Folder then
@@ -269,6 +270,19 @@ return function(Config)
269270
Position = UDim2.new(0.5,0,0.5,0),
270271
})
271272

273+
local FullscreenButton = New("ImageButton", {
274+
Image = Creator.Icon("square")[1],
275+
ImageRectOffset = Creator.Icon("square")[2].ImageRectPosition,
276+
ImageRectSize = Creator.Icon("square")[2].ImageRectSize,
277+
BackgroundTransparency = 1,
278+
Size = UDim2.new(1,-6,1,-6),
279+
ThemeTag = {
280+
ImageColor3 = "Text"
281+
},
282+
AnchorPoint = Vector2.new(0.5,0.5),
283+
Position = UDim2.new(0.5,0,0.5,0),
284+
})
285+
272286
local MinimizeButton = New("ImageButton", {
273287
Image = Creator.Icon("minus")[1],
274288
ImageRectOffset = Creator.Icon("minus")[2].ImageRectPosition,
@@ -573,14 +587,21 @@ return function(Config)
573587
New("TextButton", {
574588
Size = UDim2.new(0,24,0,24),
575589
BackgroundTransparency = 1,
576-
LayoutOrder = 1,
590+
LayoutOrder = 3,
577591
}, {
578592
CloseButton,
579593
}),
594+
-- New("TextButton", {
595+
-- Size = UDim2.new(0,24,0,24),
596+
-- BackgroundTransparency = 1,
597+
-- LayoutOrder=2,
598+
-- }, {
599+
-- FullscreenButton,
600+
-- }),
580601
New("TextButton", {
581602
Size = UDim2.new(0,24,0,24),
582603
BackgroundTransparency = 1,
583-
604+
LayoutOrder=1,
584605
}, {
585606
MinimizeButton,
586607
})
@@ -642,11 +663,11 @@ return function(Config)
642663
Size = UDim2.new(0,24,0,24),
643664
BackgroundTransparency = 1,
644665
LayoutOrder = 1,
645-
ThemeTag = {
666+
ThemeTag = Creator.Icon(Window.Icon)[2] and {
646667
ImageColor3 = "Text"
647-
}
668+
} or nil
648669
})
649-
if Creator.Icon(Window.Icon) then
670+
if Creator.Icon(Window.Icon)[2] then
650671
ImageLabel.Image = Creator.Icon(Window.Icon)[1]
651672
ImageLabel.ImageRectOffset = Creator.Icon(Window.Icon)[2].ImageRectPosition
652673
ImageLabel.ImageRectSize = Creator.Icon(Window.Icon)[2].ImageRectSize
@@ -714,6 +735,36 @@ return function(Config)
714735
return Close
715736
end
716737

738+
local CurrentPos
739+
local CurrentSize
740+
local iconCopy = Creator.Icon("copy")
741+
local iconSquare = Creator.Icon("square")
742+
743+
FullscreenButton.MouseButton1Click:Connect(function()
744+
local isFullscreen = Window.IsFullscreen
745+
Creator.SetDraggable(isFullscreen)
746+
747+
if not isFullscreen then
748+
CurrentPos = Window.UIElements.Main.Position
749+
CurrentSize = Window.UIElements.Main.Size
750+
FullscreenButton.Image = iconCopy[1]
751+
FullscreenButton.ImageRectOffset = iconCopy[2].ImageRectPosition
752+
FullscreenButton.ImageRectSize = iconCopy[2].ImageRectSize
753+
else
754+
FullscreenButton.Image = iconSquare[1]
755+
FullscreenButton.ImageRectOffset = iconSquare[2].ImageRectPosition
756+
FullscreenButton.ImageRectSize = iconSquare[2].ImageRectSize
757+
end
758+
759+
Tween(Window.UIElements.Main, 0.45, {Size = isFullscreen and CurrentSize or UDim2.new(1,-20,1,-20)}, Enum.EasingStyle.Quint, Enum.EasingDirection.Out):Play()
760+
761+
delay(0.1, function()
762+
Tween(Window.UIElements.Main, 0.45, {Position = isFullscreen and CurrentPos or Window.Position}, Enum.EasingStyle.Quint, Enum.EasingDirection.Out):Play()
763+
end)
764+
765+
Window.IsFullscreen = not isFullscreen
766+
end)
767+
717768
MinimizeButton.MouseButton1Click:Connect(function()
718769
Window:Close()
719770
task.spawn(function()
@@ -883,9 +934,6 @@ return function(Config)
883934
BackgroundTransparency = 1,
884935
Parent = Dialog.UIElements.Main
885936
})
886-
Content:GetPropertyChangedSignal("TextBounds"):Connect(function()
887-
Content.Size = UDim2.new(1,0,0,Content.TextBounds.Y)
888-
end)
889937
end
890938

891939
-- Dialog.UIElements.UIListLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(function()
@@ -931,7 +979,7 @@ return function(Config)
931979
},
932980
BackgroundTransparency = .93,
933981
Parent = ButtonsContent,
934-
Size = UDim2.new(1 / #DialogTable.Buttons, -(((#DialogTable.Buttons - 1) * 10) / #DialogTable.Buttons), 0, 00),
982+
Size = UDim2.new(1 / #DialogTable.Buttons, -(((#DialogTable.Buttons - 1) * 10) / #DialogTable.Buttons), 0, 0),
935983
AutomaticSize = "Y",
936984
}, {
937985
New("UICorner", {
@@ -996,21 +1044,23 @@ return function(Config)
9961044
end)
9971045

9981046
local function startResizing(input)
999-
isResizing = true
1000-
FullScreenIcon.Active = true
1001-
initialSize = Window.UIElements.Main.Size
1002-
initialInputPosition = input.Position
1003-
Tween(FullScreenIcon, 0.2, {BackgroundTransparency = .65}):Play()
1004-
Tween(FullScreenIcon.ImageLabel, 0.2, {ImageTransparency = 0}):Play()
1005-
1006-
input.Changed:Connect(function()
1007-
if input.UserInputState == Enum.UserInputState.End then
1008-
isResizing = false
1009-
FullScreenIcon.Active = false
1010-
Tween(FullScreenIcon, 0.2, {BackgroundTransparency = 1}):Play()
1011-
Tween(FullScreenIcon.ImageLabel, 0.2, {ImageTransparency = 1}):Play()
1012-
end
1013-
end)
1047+
if not isFullscreen then
1048+
isResizing = true
1049+
FullScreenIcon.Active = true
1050+
initialSize = Window.UIElements.Main.Size
1051+
initialInputPosition = input.Position
1052+
Tween(FullScreenIcon, 0.2, {BackgroundTransparency = .65}):Play()
1053+
Tween(FullScreenIcon.ImageLabel, 0.2, {ImageTransparency = 0}):Play()
1054+
1055+
input.Changed:Connect(function()
1056+
if input.UserInputState == Enum.UserInputState.End then
1057+
isResizing = false
1058+
FullScreenIcon.Active = false
1059+
Tween(FullScreenIcon, 0.2, {BackgroundTransparency = 1}):Play()
1060+
Tween(FullScreenIcon.ImageLabel, 0.2, {ImageTransparency = 1}):Play()
1061+
end
1062+
end)
1063+
end
10141064
end
10151065

10161066
ResizeHandle.InputBegan:Connect(function(input)

0 commit comments

Comments
 (0)