azul-sync 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.
Files changed (133) hide show
  1. package/.gitattributes +1 -0
  2. package/.github/ISSUE_TEMPLATE/bug_report.md +31 -0
  3. package/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  4. package/README.md +142 -0
  5. package/dist/build.d.ts +19 -0
  6. package/dist/build.d.ts.map +1 -0
  7. package/dist/build.js +92 -0
  8. package/dist/build.js.map +1 -0
  9. package/dist/cli.d.ts +3 -0
  10. package/dist/cli.d.ts.map +1 -0
  11. package/dist/cli.js +397 -0
  12. package/dist/cli.js.map +1 -0
  13. package/dist/config.d.ts +26 -0
  14. package/dist/config.d.ts.map +1 -0
  15. package/dist/config.js +105 -0
  16. package/dist/config.js.map +1 -0
  17. package/dist/fs/fileWriter.d.ts +100 -0
  18. package/dist/fs/fileWriter.d.ts.map +1 -0
  19. package/dist/fs/fileWriter.js +342 -0
  20. package/dist/fs/fileWriter.js.map +1 -0
  21. package/dist/fs/treeManager.d.ts +84 -0
  22. package/dist/fs/treeManager.d.ts.map +1 -0
  23. package/dist/fs/treeManager.js +365 -0
  24. package/dist/fs/treeManager.js.map +1 -0
  25. package/dist/fs/watcher.d.ts +39 -0
  26. package/dist/fs/watcher.d.ts.map +1 -0
  27. package/dist/fs/watcher.js +120 -0
  28. package/dist/fs/watcher.js.map +1 -0
  29. package/dist/index.d.ts +61 -0
  30. package/dist/index.d.ts.map +1 -0
  31. package/dist/index.js +349 -0
  32. package/dist/index.js.map +1 -0
  33. package/dist/ipc/httpPolling.d.ts +56 -0
  34. package/dist/ipc/httpPolling.d.ts.map +1 -0
  35. package/dist/ipc/httpPolling.js +171 -0
  36. package/dist/ipc/httpPolling.js.map +1 -0
  37. package/dist/ipc/messages.d.ts +112 -0
  38. package/dist/ipc/messages.d.ts.map +1 -0
  39. package/dist/ipc/messages.js +5 -0
  40. package/dist/ipc/messages.js.map +1 -0
  41. package/dist/ipc/server.d.ts +50 -0
  42. package/dist/ipc/server.d.ts.map +1 -0
  43. package/dist/ipc/server.js +168 -0
  44. package/dist/ipc/server.js.map +1 -0
  45. package/dist/pack.d.ts +19 -0
  46. package/dist/pack.d.ts.map +1 -0
  47. package/dist/pack.js +225 -0
  48. package/dist/pack.js.map +1 -0
  49. package/dist/push.d.ts +43 -0
  50. package/dist/push.d.ts.map +1 -0
  51. package/dist/push.js +532 -0
  52. package/dist/push.js.map +1 -0
  53. package/dist/rojo.d.ts +9 -0
  54. package/dist/rojo.d.ts.map +1 -0
  55. package/dist/rojo.js +114 -0
  56. package/dist/rojo.js.map +1 -0
  57. package/dist/snapshot/rojo.d.ts +39 -0
  58. package/dist/snapshot/rojo.d.ts.map +1 -0
  59. package/dist/snapshot/rojo.js +364 -0
  60. package/dist/snapshot/rojo.js.map +1 -0
  61. package/dist/snapshot.d.ts +23 -0
  62. package/dist/snapshot.d.ts.map +1 -0
  63. package/dist/snapshot.js +132 -0
  64. package/dist/snapshot.js.map +1 -0
  65. package/dist/sourcemap/generator.d.ts +78 -0
  66. package/dist/sourcemap/generator.d.ts.map +1 -0
  67. package/dist/sourcemap/generator.js +351 -0
  68. package/dist/sourcemap/generator.js.map +1 -0
  69. package/dist/sourcemap/propertyLoader.d.ts +19 -0
  70. package/dist/sourcemap/propertyLoader.d.ts.map +1 -0
  71. package/dist/sourcemap/propertyLoader.js +131 -0
  72. package/dist/sourcemap/propertyLoader.js.map +1 -0
  73. package/dist/util/id.d.ts +9 -0
  74. package/dist/util/id.d.ts.map +1 -0
  75. package/dist/util/id.js +14 -0
  76. package/dist/util/id.js.map +1 -0
  77. package/dist/util/log.d.ts +13 -0
  78. package/dist/util/log.d.ts.map +1 -0
  79. package/dist/util/log.js +51 -0
  80. package/dist/util/log.js.map +1 -0
  81. package/docs/assets/azul-logo.pdn +0 -0
  82. package/docs/assets/logo-200px.png +0 -0
  83. package/docs/assets/logo.png +0 -0
  84. package/docs/assets/plugin/toolbox.png +0 -0
  85. package/docs/assets/synced.png +0 -0
  86. package/package.json +41 -0
  87. package/plugin/README.md +54 -0
  88. package/plugin/sourcemap.json +264 -0
  89. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/Actor/AzulSync.server.luau +905 -0
  90. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/AzulService.luau +1010 -0
  91. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/Config.luau +29 -0
  92. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/Enums.luau +11 -0
  93. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/CollapsibleTitledSection.luau +214 -0
  94. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/ColorPicker.luau +360 -0
  95. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/CustomTextButton.luau +170 -0
  96. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/DropdownMenu.luau +363 -0
  97. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/HorizontalLine.luau +43 -0
  98. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/ImageButtonWithText.luau +181 -0
  99. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledCheckbox.luau +295 -0
  100. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledColorInputPicker.luau +294 -0
  101. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledMultiChoice.luau +163 -0
  102. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledNumberInput.luau +312 -0
  103. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledRadioButton.luau +55 -0
  104. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledSlider.luau +151 -0
  105. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledTextInput.luau +222 -0
  106. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/LabeledToggleButton.luau +73 -0
  107. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/StatefulImageButton.luau +125 -0
  108. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/VerticalScrollingFrame.luau +100 -0
  109. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/VerticalSpacer.luau +35 -0
  110. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/Components/VerticallyScalingListFrame.luau +107 -0
  111. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/GuiUtilities.luau +429 -0
  112. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/StudioWidgets/RbxGui.luau +4363 -0
  113. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/UI.luau +425 -0
  114. package/plugin/sync/ReplicatedFirst/AzulCompanionPlugin/WebSocketClient.luau +161 -0
  115. package/src/build.ts +120 -0
  116. package/src/cli.ts +496 -0
  117. package/src/config.ts +170 -0
  118. package/src/fs/fileWriter.ts +414 -0
  119. package/src/fs/treeManager.ts +458 -0
  120. package/src/fs/watcher.ts +142 -0
  121. package/src/index.ts +450 -0
  122. package/src/ipc/httpPolling.ts +214 -0
  123. package/src/ipc/messages.ts +159 -0
  124. package/src/ipc/server.ts +196 -0
  125. package/src/pack.ts +309 -0
  126. package/src/push.ts +726 -0
  127. package/src/snapshot/rojo.ts +467 -0
  128. package/src/snapshot.ts +161 -0
  129. package/src/sourcemap/generator.ts +504 -0
  130. package/src/sourcemap/propertyLoader.ts +195 -0
  131. package/src/util/id.ts +15 -0
  132. package/src/util/log.ts +94 -0
  133. package/tsconfig.json +24 -0
@@ -0,0 +1,429 @@
1
+ local module = {}
2
+
3
+ module.kTitleBarHeight = 27
4
+ module.kInlineTitleBarHeight = 24
5
+
6
+ module.kStandardContentAreaWidth = 180
7
+
8
+ module.kStandardPropertyHeight = 30
9
+ module.kSubSectionLabelHeight = 30
10
+
11
+ module.kStandardVMargin = 7
12
+ module.kStandardHMargin = 16
13
+
14
+ module.kCheckboxMinLabelWidth = 52
15
+ module.kCheckboxMinMargin = 12
16
+ module.kCheckboxWidth = 12
17
+
18
+ module.kRadioButtonsHPadding = 24
19
+
20
+ module.StandardLineLabelLeftMargin = module.kTitleBarHeight
21
+ module.StandardLineElementLeftMargin = (
22
+ module.StandardLineLabelLeftMargin
23
+ + module.kCheckboxMinLabelWidth
24
+ + module.kCheckboxMinMargin
25
+ + module.kCheckboxWidth
26
+ + module.kRadioButtonsHPadding
27
+ ) + 20
28
+ module.StandardLineLabelWidth = (module.StandardLineElementLeftMargin - module.StandardLineLabelLeftMargin - 10)
29
+
30
+ module.kDropDownHeight = 55
31
+
32
+ module.kBottomButtonsFrameHeight = 50
33
+ module.kBottomButtonsHeight = 28
34
+
35
+ module.kShapeButtonSize = 32
36
+ module.kTextVerticalFudge = -3
37
+ module.kButtonVerticalFudge = -5
38
+
39
+ module.kBottomButtonsWidth = 100
40
+
41
+ module.kDisabledTextColor = Color3.new(0.4, 0.4, 0.4) --todo: input spec disabled text color
42
+ module.kStandardButtonTextColor = Color3.new(0, 0, 0) --todo: input spec disabled text color
43
+ module.kPressedButtonTextColor = Color3.new(1, 1, 1) --todo: input spec disabled text color
44
+
45
+ module.kButtonStandardBackgroundColor = Color3.new(1, 1, 1) --todo: sync with spec
46
+ module.kButtonStandardBorderColor = Color3.new(0.4, 0.4, 0.4) --todo: sync with spec
47
+ module.kButtonDisabledBackgroundColor = Color3.new(0.7, 0.7, 0.7) --todo: sync with spec
48
+ module.kButtonDisabledBorderColor = Color3.new(0.6, 0.6, 0.6) --todo: sync with spec
49
+
50
+ module.kButtonBackgroundTransparency = 0.5
51
+ module.kButtonBackgroundIntenseTransparency = 0.4
52
+
53
+ module.kMainFrame = nil
54
+
55
+ --- Determines if icons should use a lighter style based on the studio theme's background brightness.
56
+ --- @return boolean Returns true if the average RGB value of the main background is below 0.5 (darker theme).
57
+ function module.ShouldUseIconsForDarkerBackgrounds()
58
+ local mainColor = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainBackground)
59
+ return (mainColor.R + mainColor.G + mainColor.B) / 3 < 0.5
60
+ end
61
+
62
+ --- Calculates the average brightness of a given Color3.
63
+ --- @param color Color3 -- The color to evaluate.
64
+ --- @return number -- The average brightness (0 to 1).
65
+ function module.GetColorOverallBrightness(color: Color3): number
66
+ return (color.R + color.G + color.B) / 3
67
+ end
68
+
69
+ --- Stores a reference to the given frame to be used as the main UI container.
70
+ --- @param frame Frame -- The Frame to be set as the main UI reference.
71
+ function module.SetMainFrame(frame: Frame)
72
+ module.kMainFrame = frame
73
+ end
74
+
75
+ --- Synchronizes the GUI element's background color with the theme's title bar color.
76
+ --- Updates automatically when the Studio theme changes.
77
+ --- @param guiElement GuiObject -- The GUI element to sync.
78
+ function module.syncGuiElementTitleColor(guiElement: GuiObject)
79
+ local function setColors()
80
+ guiElement.BackgroundColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Titlebar)
81
+ end
82
+ settings().Studio.ThemeChanged:Connect(setColors)
83
+ setColors()
84
+ end
85
+
86
+ --- Synchronizes the GUI element's background color with the theme's input field background color.
87
+ --- Updates automatically when the Studio theme changes.
88
+ --- @param guiElement GuiObject -- The GUI element to sync.
89
+ function module.syncGuiElementInputFieldColor(guiElement: GuiObject)
90
+ local function setColors()
91
+ guiElement.BackgroundColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.InputFieldBackground)
92
+ end
93
+ settings().Studio.ThemeChanged:Connect(setColors)
94
+ setColors()
95
+ end
96
+
97
+ --- Synchronizes the GUI element's background color with the theme's main background color.
98
+ --- Updates automatically when the Studio theme changes.
99
+ --- @param guiElement GuiObject -- The GUI element to sync.
100
+ function module.syncGuiElementBackgroundColor(guiElement: GuiObject)
101
+ local function setColors()
102
+ guiElement.BackgroundColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainBackground)
103
+ end
104
+ settings().Studio.ThemeChanged:Connect(setColors)
105
+ setColors()
106
+ end
107
+
108
+ --- Alternates the GUI element's background color based on its LayoutOrder to create a striped effect.
109
+ --- Uses MainBackground for even rows and CategoryItem for odd rows.
110
+ --- Updates automatically when the Studio theme changes.
111
+ --- @param guiElement GuiObject -- The GUI element to sync.
112
+ function module.syncGuiElementStripeColor(guiElement: GuiObject)
113
+ local function setColors()
114
+ if (guiElement.LayoutOrder + 1) % 2 == 0 then
115
+ guiElement.BackgroundColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainBackground)
116
+ else
117
+ guiElement.BackgroundColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.CategoryItem)
118
+ end
119
+ end
120
+ settings().Studio.ThemeChanged:Connect(setColors)
121
+ setColors()
122
+ end
123
+
124
+ --- Synchronizes the GUI element's border color with the theme's border color.
125
+ --- Updates automatically when the Studio theme changes.
126
+ --- @param guiElement GuiObject -- The GUI element to sync.
127
+ function module.syncGuiElementBorderColor(guiElement: GuiObject)
128
+ local function setColors()
129
+ guiElement.BorderColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Border)
130
+ end
131
+ settings().Studio.ThemeChanged:Connect(setColors)
132
+ setColors()
133
+ end
134
+
135
+ --- Synchronizes the GUI element's font color with the theme's main text color.
136
+ --- Updates automatically when the Studio theme changes.
137
+ --- @param guiElement GuiObject -- A GUI element that has a TextColor3 property.
138
+ function module.syncGuiElementFontColor(guiElement: { TextColor3: Color3 })
139
+ local function setColors()
140
+ guiElement.TextColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainText)
141
+ end
142
+ settings().Studio.ThemeChanged:Connect(setColors)
143
+ setColors()
144
+ end
145
+
146
+ --- Synchronizes the GUI element's scrollbar image color with the theme's scrollbar color.
147
+ --- Updates automatically when the Studio theme changes.
148
+ --- @param guiElement GuiObject -- A GUI element that has a ScrollBarImageColor3 property.
149
+ function module.syncGuiElementScrollColor(guiElement: { ScrollBarImageColor3: Color3 })
150
+ local function setColors()
151
+ guiElement.ScrollBarImageColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.ScrollBar)
152
+ end
153
+ settings().Studio.ThemeChanged:Connect(setColors)
154
+ setColors()
155
+ end
156
+
157
+ --- Synchronizes the GUI element's image color with the theme's main background color.
158
+ --- Updates automatically when the Studio theme changes.
159
+ --- @param guiElement GuiObject -- A GUI element that has an ImageColor3 property.
160
+ function module.syncGuiElementImageColor(guiElement: { ImageColor3: Color3 })
161
+ local function setColors()
162
+ guiElement.ImageColor3 = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.MainBackground)
163
+ end
164
+ settings().Studio.ThemeChanged:Connect(setColors)
165
+ setColors()
166
+ end
167
+
168
+ --- Synchronizes the GUI element's background color with the theme's default button color.
169
+ --- Updates automatically when the Studio theme changes.
170
+ --- @param guiElement GuiObject -- The GUI element to sync.
171
+ function module.syncGuiElementButtonColor(guiElement: GuiObject)
172
+ local function setColors()
173
+ guiElement.BackgroundColor3 =
174
+ settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Default)
175
+ end
176
+ settings().Studio.ThemeChanged:Connect(setColors)
177
+ setColors()
178
+ end
179
+
180
+ --- Synchronizes the GUI element's image color with the theme's default button color.
181
+ --- Updates automatically when the Studio theme changes.
182
+ --- @param guiElement GuiObject -- A GUI element that has an ImageColor3 property.
183
+ function module.syncGuiElementButtonImageColor(guiElement: { ImageColor3: Color3 })
184
+ local function setColors()
185
+ guiElement.ImageColor3 =
186
+ settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Button, Enum.StudioStyleGuideModifier.Default)
187
+ end
188
+ settings().Studio.ThemeChanged:Connect(setColors)
189
+ setColors()
190
+ end
191
+
192
+ --- Synchronizes the UIStroke's color with the theme's border color.
193
+ --- Updates automatically when the Studio theme changes.
194
+ --- @param guiElement UIStroke -- The UIStroke to sync.
195
+ function module.syncGuiElementUIStrokeColor(guiElement: UIStroke)
196
+ local function setColors()
197
+ guiElement.Color = settings().Studio.Theme:GetColor(Enum.StudioStyleGuideColor.Border)
198
+ end
199
+ settings().Studio.ThemeChanged:Connect(setColors)
200
+ setColors()
201
+ end
202
+
203
+ --- Syncs the the gui specific property to the specific style and modifier color of the Studio Theme.
204
+ --- This also returns the connection so you have more flexibility to disconnect it when you need.
205
+ --- @param guiElement GuiObject -- Any Gui Object
206
+ --- @param property string -- The property to sync the color like BackgroundColor3, ImageColor3, TextColor3, etc.
207
+ --- @param style Enum.StudioStyleGuideColor -- The style guide color.
208
+ --- @param modifier Enum.StudioStyleGuideModifier? -- The optional style guide modifier.
209
+ --- @return RBXScriptConnection -- The connection of the event. Can be disconnected by doing conn:Disconnect().
210
+ function module.syncGuiElementColorCustom(
211
+ guiElement: GuiObject,
212
+ property: string,
213
+ style: Enum.StudioStyleGuideColor,
214
+ modifier: Enum.StudioStyleGuideModifier?
215
+ ): RBXScriptConnection
216
+ local function setColors()
217
+ guiElement[property] = settings().Studio.Theme:GetColor(style, modifier)
218
+ end
219
+ local connection = settings().Studio.ThemeChanged:Connect(setColors)
220
+ setColors()
221
+ return connection
222
+ end
223
+
224
+ --- Gets the specific color of the currently selected Studio Theme.
225
+ --- @param style Enum.StudioStyleGuideColor -- The style guide color.
226
+ --- @param modifier Enum.StudioStyleGuideModifier? -- The optional style guide modifier.
227
+ --- @return Color3 -- The color if found.
228
+ function module.GetThemeColor(style: Enum.StudioStyleGuideColor, modifier: Enum.StudioStyleGuideModifier?): Color3
229
+ return settings().Studio.Theme:GetColor(style, modifier)
230
+ end
231
+
232
+ --- Gets current Roblox Studio Theme name.
233
+ --- @return string -- The color name.
234
+ function module.GetThemeName(): string
235
+ return settings().Studio.Theme.Name
236
+ end
237
+
238
+ --- Binds a callback to the theme changed event
239
+ --- @param callback () -> () -- The callback function to Connect
240
+ --- @return RBXScriptConnection -- The connection of the event. Can be disconnected by doing conn:Disconnect().
241
+ function module.BindThemeChanged(callback: () -> ()): RBXScriptConnection
242
+ local connection = settings().Studio.ThemeChanged:Connect(callback)
243
+ return connection
244
+ end
245
+
246
+ --- Calculates the relative position of a click within a GUI element.
247
+ --- Returns the normalized (0 to 1) X and Y offsets based on the input object's position
248
+ --- relative to the specified GUI element's absolute position.
249
+ --- ```luau
250
+ --- frame.InputBegan:Connect(function (inputObject: InputObject)
251
+ --- local relX, relY = GuiUtilities.GetClickOffsetFromObject(inputObject, frame)
252
+ --- end)
253
+ --- ```
254
+ --- @param inputObject InputObject -- The object containing the input data.
255
+ --- @param guiObject GuiObject -- The GUI element to get the relative position within.
256
+ --- @return number, number -- Two numbers representing the relative X and Y position.
257
+ function module.GetClickOffsetFromObject(inputObject: InputObject, guiElement: GuiObject): (number, number)
258
+ local clickPos = inputObject.Position
259
+ local relX = (clickPos.X - guiElement.AbsolutePosition.X) / guiElement.AbsoluteSize.X
260
+ local relY = (clickPos.Y - guiElement.AbsolutePosition.Y) / guiElement.AbsoluteSize.Y
261
+ return relX, relY
262
+ end
263
+
264
+ --- Creates and returns a Frame with default background and border settings.
265
+ --- Automatically synchronizes its background color with the Studio theme's main background.
266
+ --- @param name string -- The name to assign to the created Frame.
267
+ --- @return Frame -- The styled Frame instance.
268
+ function module.MakeFrame(name: string)
269
+ local frame = Instance.new("Frame")
270
+ frame.Name = name
271
+ frame.BackgroundTransparency = 0
272
+ frame.BorderSizePixel = 0
273
+
274
+ module.syncGuiElementBackgroundColor(frame)
275
+
276
+ return frame
277
+ end
278
+
279
+ --- Creates and returns a Frame that spans the full horizontal width and has a fixed vertical height.
280
+ --- Useful for creating rows or lines containing widgets of arbitrary size.
281
+ --- @param name string -- The name to assign to the created Frame.
282
+ --- @param height number -- The fixed height in pixels for the Frame.
283
+ --- @return Frame -- The fixed-height Frame instance.
284
+ function module.MakeFixedHeightFrame(name: string, height: number)
285
+ local frame = module.MakeFrame(name)
286
+ frame.Size = UDim2.new(1, 0, 0, height)
287
+
288
+ return frame
289
+ end
290
+
291
+ --- Creates and returns a Frame with a standard fixed height used for typical UI elements
292
+ --- like labels, input fields, dropdowns, and checkboxes.
293
+ --- Uses `module.kStandardPropertyHeight` as the standard height value.
294
+ --- @param name string -- The name to assign to the created Frame.
295
+ --- @return Frame -- The standard-height Frame instance.
296
+ function module.MakeStandardFixedHeightFrame(name: string)
297
+ return module.MakeFixedHeightFrame(name, module.kStandardPropertyHeight)
298
+ end
299
+
300
+ --- Dynamically adjusts the height of a frame to match the total height of its children,
301
+ --- based on a UIListLayout's AbsoluteContentSize. Optional padding can be added.
302
+ --- Automatically updates the frame's height when the layout's size changes.
303
+ ---
304
+ --- @param frame GuiObject -- The frame whose height will be dynamically adjusted.
305
+ --- @param uiLayout UIListLayout -- The layout used to determine the total content height.
306
+ --- @param optPadding number? -- Optional additional padding added to the total height.
307
+ function module.AdjustHeightDynamicallyToLayout(frame: GuiObject, uiLayout: UIListLayout, optPadding: number?)
308
+ local function updateSizes()
309
+ frame.Size = UDim2.new(1, 0, 0, uiLayout.AbsoluteContentSize.Y + (optPadding or 0))
310
+ end
311
+ uiLayout:GetPropertyChangedSignal("AbsoluteContentSize"):Connect(updateSizes)
312
+ updateSizes()
313
+ end
314
+
315
+ --- Adds a list of frames as children to a given frame that uses a UIListLayout with `LayoutOrder`-based sorting.
316
+ --- Each child frame is assigned an increasing `LayoutOrder` to maintain order.
317
+ --- Also applies striped background colors and border colors to each frame for visual clarity.
318
+ ---
319
+ --- @param listFrame GuiObject -- The parent frame that contains a UIListLayout.
320
+ --- @param frames {GuiObject} -- A list of frames to add as children, in order.
321
+ function module.AddStripedChildrenToListFrame(listFrame: GuiObject, frames: { GuiObject })
322
+ for index, frame in ipairs(frames) do
323
+ frame.Parent = listFrame
324
+ frame.LayoutOrder = index
325
+ frame.BackgroundTransparency = 0
326
+ frame.BorderSizePixel = 1
327
+ module.syncGuiElementStripeColor(frame)
328
+ module.syncGuiElementBorderColor(frame)
329
+ end
330
+ end
331
+
332
+ --- Creates a section frame inside a given parent GUI element, optionally including a title bar and fixed content height.
333
+ --- If a title is provided, a title bar is created and positioned at the top.
334
+ --- The frame's total height is adjusted to include the title bar and the optional content height.
335
+ ---
336
+ --- @param parentGui GuiObject -- The GUI object that will serve as the parent for the new section frame.
337
+ --- @param name string -- The name assigned to the new frame.
338
+ --- @param title string? -- Optional title text; if provided, a title bar will be added.
339
+ --- @param contentHeight number? -- Optional fixed height for the content area of the section.
340
+ --- @return Frame -- The constructed section frame.
341
+ local function MakeSectionInternal(parentGui: GuiObject, name: string, title: string?, contentHeight: number?)
342
+ local frame = Instance.new("Frame")
343
+ frame.Name = name
344
+ frame.BackgroundTransparency = 1
345
+ frame.Parent = parentGui
346
+ frame.BackgroundTransparency = 1
347
+ frame.BorderSizePixel = 0
348
+
349
+ -- If title is "nil', no title bar.
350
+ local contentYOffset = 0
351
+ if title then
352
+ local titleBarFrame = Instance.new("Frame")
353
+ titleBarFrame.Name = "TitleBarFrame"
354
+ titleBarFrame.Parent = frame
355
+ titleBarFrame.Position = UDim2.new(0, 0, 0, 0)
356
+ titleBarFrame.LayoutOrder = 0
357
+
358
+ local titleBar = Instance.new("TextLabel")
359
+ titleBar.Name = "TitleBarLabel"
360
+ titleBar.Text = title
361
+ titleBar.Parent = titleBarFrame
362
+ titleBar.BackgroundTransparency = 1
363
+ titleBar.Position = UDim2.new(0, module.kStandardHMargin, 0, 0)
364
+
365
+ module.syncGuiElementFontColor(titleBar)
366
+
367
+ contentYOffset = contentYOffset + module.kTitleBarHeight
368
+ end
369
+
370
+ frame.Size = UDim2.new(1, 0, 0, contentYOffset + (contentHeight or 0))
371
+
372
+ return frame
373
+ end
374
+
375
+ --- Creates a standard property label `TextLabel` with left alignment and predefined styling for use in property UIs.
376
+ --- Optionally syncs the label's font color with the current Studio theme unless `opt_ignoreThemeUpdates` is true.
377
+ ---
378
+ --- @param text string -- The text to display in the label.
379
+ --- @param opt_ignoreThemeUpdates boolean? -- If true, skips syncing the font color with the Studio theme.
380
+ --- @return TextLabel -- The constructed label instance.
381
+ function module.MakeStandardPropertyLabel(text: string, opt_ignoreThemeUpdates: boolean?)
382
+ local label = Instance.new("TextLabel")
383
+ label.Name = "Label"
384
+ label.BackgroundTransparency = 1
385
+ label.Font = Enum.Font.SourceSans --todo: input spec font
386
+ label.TextSize = 15 --todo: input spec font size
387
+ label.TextXAlignment = Enum.TextXAlignment.Left
388
+ label.Text = text
389
+ label.AnchorPoint = Vector2.new(0, 0.5)
390
+ label.Position = UDim2.new(0, module.StandardLineLabelLeftMargin, 0.5, module.kTextVerticalFudge)
391
+ label.Size = UDim2.new(0, module.StandardLineLabelWidth, 1, 0)
392
+
393
+ if not opt_ignoreThemeUpdates then
394
+ module.syncGuiElementFontColor(label)
395
+ end
396
+
397
+ return label
398
+ end
399
+
400
+ --- Creates a frame with a subsection label. The frame has a fixed height and transparent background,
401
+ --- and contains a left-aligned label styled for subsection headers.
402
+ ---
403
+ --- @param name string -- The name to assign to the frame.
404
+ --- @param text string -- The text to display in the label.
405
+ --- @return Frame -- The constructed frame containing the subsection label.
406
+ function module.MakeFrameWithSubSectionLabel(name: string, text: string)
407
+ local row = module.MakeFixedHeightFrame(name, module.kSubSectionLabelHeight)
408
+ row.BackgroundTransparency = 1
409
+
410
+ local label = module.MakeStandardPropertyLabel(text)
411
+ label.BackgroundTransparency = 1
412
+ label.Parent = row
413
+
414
+ return row
415
+ end
416
+
417
+ --- Adds a `UIListLayout` to the given frame and sets up dynamic height adjustment so that the frame
418
+ --- automatically resizes based on its children’s total height.
419
+ ---
420
+ --- @param frame GuiObject -- The frame to attach the auto-scaling list layout to.
421
+ function module.MakeFrameAutoScalingList(frame: GuiObject)
422
+ local uiListLayout = Instance.new("UIListLayout")
423
+ uiListLayout.Parent = frame
424
+ uiListLayout.SortOrder = Enum.SortOrder.LayoutOrder
425
+
426
+ module.AdjustHeightDynamicallyToLayout(frame, uiListLayout)
427
+ end
428
+
429
+ return module