@quenty/iris 1.1.0 → 1.3.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.
@@ -1,156 +0,0 @@
1
- --!nocheck
2
- local Types = require(script.Parent.Parent.iris_Types)
3
-
4
- return function(Iris: Types.Internal, widgets: Types.WidgetUtility)
5
- local abstractImage = {
6
- hasState = false,
7
- hasChildren = false,
8
- Args = {
9
- ["Image"] = 1,
10
- ["Size"] = 2,
11
- ["Rect"] = 3,
12
- ["ScaleType"] = 4,
13
- ["ResampleMode"] = 5,
14
- ["TileSize"] = 6,
15
- ["SliceCenter"] = 7,
16
- ["SliceScale"] = 8,
17
- },
18
- Discard = function(thisWidget: Types.Image)
19
- thisWidget.Instance:Destroy()
20
- end,
21
- } :: Types.WidgetClass
22
-
23
- --stylua: ignore
24
- Iris.WidgetConstructor("Image", widgets.extend(abstractImage, {
25
- Events = {
26
- ["hovered"] = widgets.EVENTS.hover(function(thisWidget: Types.Widget)
27
- return thisWidget.Instance
28
- end),
29
- },
30
- Generate = function(_thisWidget: Types.Image)
31
- local Image = Instance.new("ImageLabel")
32
- Image.Name = "Iris_Image"
33
- Image.BackgroundTransparency = 1
34
- Image.BorderSizePixel = 0
35
- Image.ImageColor3 = Iris._config.ImageColor
36
- Image.ImageTransparency = Iris._config.ImageTransparency
37
-
38
- widgets.applyFrameStyle(Image, true)
39
-
40
- return Image
41
- end,
42
- Update = function(thisWidget: Types.Image)
43
- local Image = thisWidget.Instance :: ImageLabel
44
-
45
- Image.Image = thisWidget.arguments.Image or widgets.ICONS.UNKNOWN_TEXTURE
46
- Image.Size = thisWidget.arguments.Size
47
- if thisWidget.arguments.ScaleType then
48
- Image.ScaleType = thisWidget.arguments.ScaleType
49
- if thisWidget.arguments.ScaleType == Enum.ScaleType.Tile and thisWidget.arguments.TileSize then
50
- Image.TileSize = thisWidget.arguments.TileSize
51
- elseif thisWidget.arguments.ScaleType == Enum.ScaleType.Slice then
52
- if thisWidget.arguments.SliceCenter then
53
- Image.SliceCenter = thisWidget.arguments.SliceCenter
54
- end
55
- if thisWidget.arguments.SliceScale then
56
- Image.SliceScale = thisWidget.arguments.SliceScale
57
- end
58
- end
59
- end
60
-
61
- if thisWidget.arguments.Rect then
62
- Image.ImageRectOffset = thisWidget.arguments.Rect.Min
63
- Image.ImageRectSize = Vector2.new(thisWidget.arguments.Rect.Width, thisWidget.arguments.Rect.Height)
64
- end
65
-
66
- if thisWidget.arguments.ResampleMode then
67
- Image.ResampleMode = thisWidget.arguments.ResampleMode
68
- end
69
- end,
70
- } :: Types.WidgetClass)
71
- )
72
-
73
- --stylua: ignore
74
- Iris.WidgetConstructor("ImageButton", widgets.extend(abstractImage, {
75
- Events = {
76
- ["clicked"] = widgets.EVENTS.click(function(thisWidget: Types.Widget)
77
- return thisWidget.Instance
78
- end),
79
- ["rightClicked"] = widgets.EVENTS.rightClick(function(thisWidget: Types.Widget)
80
- return thisWidget.Instance
81
- end),
82
- ["doubleClicked"] = widgets.EVENTS.doubleClick(function(thisWidget: Types.Widget)
83
- return thisWidget.Instance
84
- end),
85
- ["ctrlClicked"] = widgets.EVENTS.ctrlClick(function(thisWidget: Types.Widget)
86
- return thisWidget.Instance
87
- end),
88
- ["hovered"] = widgets.EVENTS.hover(function(thisWidget: Types.Widget)
89
- return thisWidget.Instance
90
- end),
91
- },
92
- Generate = function(_thisWidget: Types.ImageButton)
93
- local Button = Instance.new("ImageButton")
94
- Button.Name = "Iris_ImageButton"
95
- Button.AutomaticSize = Enum.AutomaticSize.XY
96
- Button.BackgroundColor3 = Iris._config.FrameBgColor
97
- Button.BackgroundTransparency = Iris._config.FrameBgTransparency
98
- Button.BorderSizePixel = 0
99
- Button.Image = ""
100
- Button.ImageTransparency = 1
101
- Button.AutoButtonColor = false
102
-
103
- widgets.applyFrameStyle(Button, true)
104
- widgets.UIPadding(Button, Vector2.new(Iris._config.ImageBorderSize, Iris._config.ImageBorderSize))
105
-
106
- local Image = Instance.new("ImageLabel")
107
- Image.Name = "ImageLabel"
108
- Image.BackgroundTransparency = 1
109
- Image.BorderSizePixel = 0
110
- Image.ImageColor3 = Iris._config.ImageColor
111
- Image.ImageTransparency = Iris._config.ImageTransparency
112
- Image.Parent = Button
113
-
114
- widgets.applyInteractionHighlights("Background", Button, Button, {
115
- Color = Iris._config.FrameBgColor,
116
- Transparency = Iris._config.FrameBgTransparency,
117
- HoveredColor = Iris._config.FrameBgHoveredColor,
118
- HoveredTransparency = Iris._config.FrameBgHoveredTransparency,
119
- ActiveColor = Iris._config.FrameBgActiveColor,
120
- ActiveTransparency = Iris._config.FrameBgActiveTransparency,
121
- })
122
-
123
- return Button
124
- end,
125
- Update = function(thisWidget: Types.ImageButton)
126
- local Button = thisWidget.Instance :: TextButton
127
- local Image: ImageLabel = Button.ImageLabel
128
-
129
- Image.Image = thisWidget.arguments.Image or widgets.ICONS.UNKNOWN_TEXTURE
130
- Image.Size = thisWidget.arguments.Size
131
- if thisWidget.arguments.ScaleType then
132
- Image.ScaleType = thisWidget.arguments.ScaleType
133
- if thisWidget.arguments.ScaleType == Enum.ScaleType.Tile and thisWidget.arguments.TileSize then
134
- Image.TileSize = thisWidget.arguments.TileSize
135
- elseif thisWidget.arguments.ScaleType == Enum.ScaleType.Slice then
136
- if thisWidget.arguments.SliceCenter then
137
- Image.SliceCenter = thisWidget.arguments.SliceCenter
138
- end
139
- if thisWidget.arguments.SliceScale then
140
- Image.SliceScale = thisWidget.arguments.SliceScale
141
- end
142
- end
143
- end
144
-
145
- if thisWidget.arguments.Rect then
146
- Image.ImageRectOffset = thisWidget.arguments.Rect.Min
147
- Image.ImageRectSize = Vector2.new(thisWidget.arguments.Rect.Width, thisWidget.arguments.Rect.Height)
148
- end
149
-
150
- if thisWidget.arguments.ResampleMode then
151
- Image.ResampleMode = thisWidget.arguments.ResampleMode
152
- end
153
- end,
154
- } :: Types.WidgetClass)
155
- )
156
- end