@quenty/iris 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/LICENSE.md +22 -0
- package/README.md +33 -0
- package/default.project.json +14 -0
- package/package.json +42 -0
- package/src/Shared/Iris.lua +702 -0
- package/src/Shared/iris_API.lua +231 -0
- package/src/Shared/iris_Internal.lua +923 -0
- package/src/Shared/iris_PubTypes.lua +44 -0
- package/src/Shared/iris_Types.lua +674 -0
- package/src/Shared/iris_WidgetTypes.lua +522 -0
- package/src/Shared/iris_config.lua +306 -0
- package/src/Shared/iris_demoWindow.lua +2148 -0
- package/src/Shared/widgets/iris_Button.lua +91 -0
- package/src/Shared/widgets/iris_Checkbox.lua +116 -0
- package/src/Shared/widgets/iris_Combo.lua +498 -0
- package/src/Shared/widgets/iris_Format.lua +141 -0
- package/src/Shared/widgets/iris_Image.lua +156 -0
- package/src/Shared/widgets/iris_Input.lua +1430 -0
- package/src/Shared/widgets/iris_Menu.lua +603 -0
- package/src/Shared/widgets/iris_Plot.lua +642 -0
- package/src/Shared/widgets/iris_RadioButton.lua +127 -0
- package/src/Shared/widgets/iris_Root.lua +148 -0
- package/src/Shared/widgets/iris_Tab.lua +334 -0
- package/src/Shared/widgets/iris_Table.lua +641 -0
- package/src/Shared/widgets/iris_Text.lua +133 -0
- package/src/Shared/widgets/iris_Tree.lua +291 -0
- package/src/Shared/widgets/iris_Window.lua +1158 -0
- package/src/Shared/widgets/iris_widgets.lua +487 -0
- package/src/jest.config.lua +3 -0
- package/src/node_modules.project.json +7 -0
- package/test/default.project.json +25 -0
- package/test/scripts/Server/ServerMain.server.lua +13 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
--!nocheck
|
|
2
|
+
local Types = require(script.Parent.Parent.iris_Types)
|
|
3
|
+
|
|
4
|
+
return function(Iris: Types.Internal, widgets: Types.WidgetUtility)
|
|
5
|
+
local abstractButton = {
|
|
6
|
+
hasState = false,
|
|
7
|
+
hasChildren = false,
|
|
8
|
+
Args = {
|
|
9
|
+
["Text"] = 1,
|
|
10
|
+
["Size"] = 2,
|
|
11
|
+
},
|
|
12
|
+
Events = {
|
|
13
|
+
["clicked"] = widgets.EVENTS.click(function(thisWidget: Types.Widget)
|
|
14
|
+
return thisWidget.Instance
|
|
15
|
+
end),
|
|
16
|
+
["rightClicked"] = widgets.EVENTS.rightClick(function(thisWidget: Types.Widget)
|
|
17
|
+
return thisWidget.Instance
|
|
18
|
+
end),
|
|
19
|
+
["doubleClicked"] = widgets.EVENTS.doubleClick(function(thisWidget: Types.Widget)
|
|
20
|
+
return thisWidget.Instance
|
|
21
|
+
end),
|
|
22
|
+
["ctrlClicked"] = widgets.EVENTS.ctrlClick(function(thisWidget: Types.Widget)
|
|
23
|
+
return thisWidget.Instance
|
|
24
|
+
end),
|
|
25
|
+
["hovered"] = widgets.EVENTS.hover(function(thisWidget: Types.Widget)
|
|
26
|
+
return thisWidget.Instance
|
|
27
|
+
end),
|
|
28
|
+
},
|
|
29
|
+
Generate = function(_thisWidget: Types.Button)
|
|
30
|
+
local Button = Instance.new("TextButton")
|
|
31
|
+
Button.AutomaticSize = Enum.AutomaticSize.XY
|
|
32
|
+
Button.Size = UDim2.fromOffset(0, 0)
|
|
33
|
+
Button.BackgroundColor3 = Iris._config.ButtonColor
|
|
34
|
+
Button.BackgroundTransparency = Iris._config.ButtonTransparency
|
|
35
|
+
Button.AutoButtonColor = false
|
|
36
|
+
|
|
37
|
+
widgets.applyTextStyle(Button)
|
|
38
|
+
Button.TextXAlignment = Enum.TextXAlignment.Center
|
|
39
|
+
|
|
40
|
+
widgets.applyFrameStyle(Button)
|
|
41
|
+
|
|
42
|
+
widgets.applyInteractionHighlights("Background", Button, Button, {
|
|
43
|
+
Color = Iris._config.ButtonColor,
|
|
44
|
+
Transparency = Iris._config.ButtonTransparency,
|
|
45
|
+
HoveredColor = Iris._config.ButtonHoveredColor,
|
|
46
|
+
HoveredTransparency = Iris._config.ButtonHoveredTransparency,
|
|
47
|
+
ActiveColor = Iris._config.ButtonActiveColor,
|
|
48
|
+
ActiveTransparency = Iris._config.ButtonActiveTransparency,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
return Button
|
|
52
|
+
end,
|
|
53
|
+
Update = function(thisWidget: Types.Button)
|
|
54
|
+
local Button = thisWidget.Instance :: TextButton
|
|
55
|
+
Button.Text = thisWidget.arguments.Text or "Button"
|
|
56
|
+
Button.Size = thisWidget.arguments.Size or UDim2.fromOffset(0, 0)
|
|
57
|
+
end,
|
|
58
|
+
Discard = function(thisWidget: Types.Button)
|
|
59
|
+
thisWidget.Instance:Destroy()
|
|
60
|
+
end,
|
|
61
|
+
} :: Types.WidgetClass
|
|
62
|
+
widgets.abstractButton = abstractButton
|
|
63
|
+
|
|
64
|
+
--stylua: ignore
|
|
65
|
+
Iris.WidgetConstructor("Button", widgets.extend(abstractButton, {
|
|
66
|
+
Generate = function(thisWidget: Types.Button)
|
|
67
|
+
local Button = abstractButton.Generate(thisWidget)
|
|
68
|
+
Button.Name = "Iris_Button"
|
|
69
|
+
|
|
70
|
+
return Button
|
|
71
|
+
end,
|
|
72
|
+
} :: Types.WidgetClass)
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
--stylua: ignore
|
|
76
|
+
Iris.WidgetConstructor("SmallButton", widgets.extend(abstractButton, {
|
|
77
|
+
Generate = function(thisWidget: Types.Button)
|
|
78
|
+
local SmallButton = abstractButton.Generate(thisWidget)
|
|
79
|
+
SmallButton.Name = "Iris_SmallButton"
|
|
80
|
+
|
|
81
|
+
local uiPadding: UIPadding = SmallButton.UIPadding
|
|
82
|
+
uiPadding.PaddingLeft = UDim.new(0, 2)
|
|
83
|
+
uiPadding.PaddingRight = UDim.new(0, 2)
|
|
84
|
+
uiPadding.PaddingTop = UDim.new(0, 0)
|
|
85
|
+
uiPadding.PaddingBottom = UDim.new(0, 0)
|
|
86
|
+
|
|
87
|
+
return SmallButton
|
|
88
|
+
end,
|
|
89
|
+
} :: Types.WidgetClass)
|
|
90
|
+
)
|
|
91
|
+
end
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
--!nocheck
|
|
2
|
+
local Types = require(script.Parent.Parent.iris_Types)
|
|
3
|
+
|
|
4
|
+
return function(Iris: Types.Internal, widgets: Types.WidgetUtility)
|
|
5
|
+
--stylua: ignore
|
|
6
|
+
Iris.WidgetConstructor("Checkbox", {
|
|
7
|
+
hasState = true,
|
|
8
|
+
hasChildren = false,
|
|
9
|
+
Args = {
|
|
10
|
+
["Text"] = 1,
|
|
11
|
+
},
|
|
12
|
+
Events = {
|
|
13
|
+
["checked"] = {
|
|
14
|
+
["Init"] = function(_thisWidget: Types.Checkbox) end,
|
|
15
|
+
["Get"] = function(thisWidget: Types.Checkbox)
|
|
16
|
+
return thisWidget.lastCheckedTick == Iris._cycleTick
|
|
17
|
+
end,
|
|
18
|
+
},
|
|
19
|
+
["unchecked"] = {
|
|
20
|
+
["Init"] = function(_thisWidget: Types.Checkbox) end,
|
|
21
|
+
["Get"] = function(thisWidget: Types.Checkbox)
|
|
22
|
+
return thisWidget.lastUncheckedTick == Iris._cycleTick
|
|
23
|
+
end,
|
|
24
|
+
},
|
|
25
|
+
["hovered"] = widgets.EVENTS.hover(function(thisWidget: Types.Widget)
|
|
26
|
+
return thisWidget.Instance
|
|
27
|
+
end),
|
|
28
|
+
},
|
|
29
|
+
Generate = function(thisWidget: Types.Checkbox)
|
|
30
|
+
local Checkbox = Instance.new("TextButton")
|
|
31
|
+
Checkbox.Name = "Iris_Checkbox"
|
|
32
|
+
Checkbox.AutomaticSize = Enum.AutomaticSize.XY
|
|
33
|
+
Checkbox.Size = UDim2.fromOffset(0, 0)
|
|
34
|
+
Checkbox.BackgroundTransparency = 1
|
|
35
|
+
Checkbox.BorderSizePixel = 0
|
|
36
|
+
Checkbox.Text = ""
|
|
37
|
+
Checkbox.AutoButtonColor = false
|
|
38
|
+
|
|
39
|
+
widgets.UIListLayout(Checkbox, Enum.FillDirection.Horizontal, UDim.new(0, Iris._config.ItemInnerSpacing.X)).VerticalAlignment = Enum.VerticalAlignment.Center
|
|
40
|
+
|
|
41
|
+
local checkboxSize = Iris._config.TextSize + 2 * Iris._config.FramePadding.Y
|
|
42
|
+
|
|
43
|
+
local Box = Instance.new("Frame")
|
|
44
|
+
Box.Name = "Box"
|
|
45
|
+
Box.Size = UDim2.fromOffset(checkboxSize, checkboxSize)
|
|
46
|
+
Box.BackgroundColor3 = Iris._config.FrameBgColor
|
|
47
|
+
Box.BackgroundTransparency = Iris._config.FrameBgTransparency
|
|
48
|
+
|
|
49
|
+
widgets.applyFrameStyle(Box, true)
|
|
50
|
+
widgets.UIPadding(Box, Vector2.new(math.floor(checkboxSize / 10), math.floor(checkboxSize / 10)))
|
|
51
|
+
|
|
52
|
+
widgets.applyInteractionHighlights("Background", Checkbox, Box, {
|
|
53
|
+
Color = Iris._config.FrameBgColor,
|
|
54
|
+
Transparency = Iris._config.FrameBgTransparency,
|
|
55
|
+
HoveredColor = Iris._config.FrameBgHoveredColor,
|
|
56
|
+
HoveredTransparency = Iris._config.FrameBgHoveredTransparency,
|
|
57
|
+
ActiveColor = Iris._config.FrameBgActiveColor,
|
|
58
|
+
ActiveTransparency = Iris._config.FrameBgActiveTransparency,
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
Box.Parent = Checkbox
|
|
62
|
+
|
|
63
|
+
local Checkmark = Instance.new("ImageLabel")
|
|
64
|
+
Checkmark.Name = "Checkmark"
|
|
65
|
+
Checkmark.Size = UDim2.fromScale(1, 1)
|
|
66
|
+
Checkmark.BackgroundTransparency = 1
|
|
67
|
+
Checkmark.Image = widgets.ICONS.CHECKMARK
|
|
68
|
+
Checkmark.ImageColor3 = Iris._config.CheckMarkColor
|
|
69
|
+
Checkmark.ImageTransparency = 1
|
|
70
|
+
Checkmark.ScaleType = Enum.ScaleType.Fit
|
|
71
|
+
|
|
72
|
+
Checkmark.Parent = Box
|
|
73
|
+
|
|
74
|
+
widgets.applyButtonClick(Checkbox, function()
|
|
75
|
+
thisWidget.state.isChecked:set(not thisWidget.state.isChecked.value)
|
|
76
|
+
end)
|
|
77
|
+
|
|
78
|
+
local TextLabel = Instance.new("TextLabel")
|
|
79
|
+
TextLabel.Name = "TextLabel"
|
|
80
|
+
TextLabel.AutomaticSize = Enum.AutomaticSize.XY
|
|
81
|
+
TextLabel.BackgroundTransparency = 1
|
|
82
|
+
TextLabel.BorderSizePixel = 0
|
|
83
|
+
TextLabel.LayoutOrder = 1
|
|
84
|
+
|
|
85
|
+
widgets.applyTextStyle(TextLabel)
|
|
86
|
+
TextLabel.Parent = Checkbox
|
|
87
|
+
|
|
88
|
+
return Checkbox
|
|
89
|
+
end,
|
|
90
|
+
GenerateState = function(thisWidget: Types.Checkbox)
|
|
91
|
+
if thisWidget.state.isChecked == nil then
|
|
92
|
+
thisWidget.state.isChecked = Iris._widgetState(thisWidget, "checked", false)
|
|
93
|
+
end
|
|
94
|
+
end,
|
|
95
|
+
Update = function(thisWidget: Types.Checkbox)
|
|
96
|
+
local Checkbox = thisWidget.Instance :: TextButton
|
|
97
|
+
Checkbox.TextLabel.Text = thisWidget.arguments.Text or "Checkbox"
|
|
98
|
+
end,
|
|
99
|
+
UpdateState = function(thisWidget: Types.Checkbox)
|
|
100
|
+
local Checkbox = thisWidget.Instance :: TextButton
|
|
101
|
+
local Box = Checkbox.Box :: Frame
|
|
102
|
+
local Checkmark: ImageLabel = Box.Checkmark
|
|
103
|
+
if thisWidget.state.isChecked.value then
|
|
104
|
+
Checkmark.ImageTransparency = Iris._config.CheckMarkTransparency
|
|
105
|
+
thisWidget.lastCheckedTick = Iris._cycleTick + 1
|
|
106
|
+
else
|
|
107
|
+
Checkmark.ImageTransparency = 1
|
|
108
|
+
thisWidget.lastUncheckedTick = Iris._cycleTick + 1
|
|
109
|
+
end
|
|
110
|
+
end,
|
|
111
|
+
Discard = function(thisWidget: Types.Checkbox)
|
|
112
|
+
thisWidget.Instance:Destroy()
|
|
113
|
+
widgets.discardState(thisWidget)
|
|
114
|
+
end,
|
|
115
|
+
} :: Types.WidgetClass)
|
|
116
|
+
end
|