@snailycfx/stylesheet 1.0.10
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/.vscode/settings.json +3 -0
- package/LICENSE +21 -0
- package/out/core/engine/absolute.d.ts +10 -0
- package/out/core/engine/absolute.d.ts.map +1 -0
- package/out/core/engine/absolute.luau +86 -0
- package/out/core/engine/flex.d.ts +14 -0
- package/out/core/engine/flex.d.ts.map +1 -0
- package/out/core/engine/flex.luau +284 -0
- package/out/core/engine/grid.d.ts +9 -0
- package/out/core/engine/grid.d.ts.map +1 -0
- package/out/core/engine/grid.luau +306 -0
- package/out/core/engine/index.d.ts +14 -0
- package/out/core/engine/index.d.ts.map +1 -0
- package/out/core/engine/init.luau +179 -0
- package/out/core/engine/node.d.ts +25 -0
- package/out/core/engine/node.d.ts.map +1 -0
- package/out/core/engine/node.luau +84 -0
- package/out/core/index.d.ts +16 -0
- package/out/core/index.d.ts.map +1 -0
- package/out/core/init.luau +21 -0
- package/out/core/parse/color.d.ts +3 -0
- package/out/core/parse/color.d.ts.map +1 -0
- package/out/core/parse/color.luau +22 -0
- package/out/core/parse/grid.d.ts +18 -0
- package/out/core/parse/grid.d.ts.map +1 -0
- package/out/core/parse/grid.luau +158 -0
- package/out/core/parse/index.d.ts +5 -0
- package/out/core/parse/index.d.ts.map +1 -0
- package/out/core/parse/init.luau +13 -0
- package/out/core/parse/udim.d.ts +5 -0
- package/out/core/parse/udim.d.ts.map +1 -0
- package/out/core/parse/udim.luau +53 -0
- package/out/core/types/RbxStyle.d.ts +17 -0
- package/out/core/types/RbxStyle.d.ts.map +1 -0
- package/out/core/types/RbxStyle.luau +2 -0
- package/out/core/types/index.d.ts +11 -0
- package/out/core/types/index.d.ts.map +1 -0
- package/out/core/types/init.luau +2 -0
- package/out/core/types/primitives.d.ts +7 -0
- package/out/core/types/primitives.d.ts.map +1 -0
- package/out/core/types/primitives.luau +2 -0
- package/out/core/types/style/background.d.ts +10 -0
- package/out/core/types/style/background.d.ts.map +1 -0
- package/out/core/types/style/background.luau +2 -0
- package/out/core/types/style/border.d.ts +8 -0
- package/out/core/types/style/border.d.ts.map +1 -0
- package/out/core/types/style/border.luau +2 -0
- package/out/core/types/style/index.d.ts +9 -0
- package/out/core/types/style/index.d.ts.map +1 -0
- package/out/core/types/style/init.luau +2 -0
- package/out/core/types/style/layout.d.ts +23 -0
- package/out/core/types/style/layout.d.ts.map +1 -0
- package/out/core/types/style/layout.luau +2 -0
- package/out/core/types/style/misc.d.ts +7 -0
- package/out/core/types/style/misc.d.ts.map +1 -0
- package/out/core/types/style/misc.luau +2 -0
- package/out/core/types/style/position.d.ts +11 -0
- package/out/core/types/style/position.d.ts.map +1 -0
- package/out/core/types/style/position.luau +2 -0
- package/out/core/types/style/size.d.ts +11 -0
- package/out/core/types/style/size.d.ts.map +1 -0
- package/out/core/types/style/size.luau +2 -0
- package/out/core/types/style/spacing.d.ts +21 -0
- package/out/core/types/style/spacing.d.ts.map +1 -0
- package/out/core/types/style/spacing.luau +2 -0
- package/out/core/types/style/text.d.ts +14 -0
- package/out/core/types/style/text.d.ts.map +1 -0
- package/out/core/types/style/text.luau +2 -0
- package/out/core/writer/index.d.ts +8 -0
- package/out/core/writer/index.d.ts.map +1 -0
- package/out/core/writer/init.luau +505 -0
- package/out/elements/index.d.ts +44 -0
- package/out/elements/index.d.ts.map +1 -0
- package/out/elements/init.luau +316 -0
- package/out/index.d.ts +11 -0
- package/out/index.d.ts.map +1 -0
- package/out/init.luau +19 -0
- package/out/stylesheet/index.d.ts +25 -0
- package/out/stylesheet/index.d.ts.map +1 -0
- package/out/stylesheet/init.luau +71 -0
- package/package.json +37 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local parseColor = TS.import(script, script.Parent, "parse", "color").parseColor
|
|
4
|
+
local parseUDim = TS.import(script, script.Parent, "parse", "udim").parseUDim
|
|
5
|
+
--[[
|
|
6
|
+
*
|
|
7
|
+
* Escribe propiedades visuales en una instancia.
|
|
8
|
+
* Solo escribe propiedades que hayan cambiado respecto al último estilo aplicado.
|
|
9
|
+
* NO escribe Position ni Size — responsabilidad del engine.
|
|
10
|
+
|
|
11
|
+
]]
|
|
12
|
+
local writeBackground, writeBorder, writeText, writeMisc
|
|
13
|
+
local function writeVisual(instance, style, prev)
|
|
14
|
+
writeBackground(instance, style, prev)
|
|
15
|
+
writeBorder(instance, style, prev)
|
|
16
|
+
writeText(instance, style, prev)
|
|
17
|
+
writeMisc(instance, style, prev)
|
|
18
|
+
end
|
|
19
|
+
-- ── Helpers ───────────────────────────────────────────────────────────────────
|
|
20
|
+
local function getOrCreateUICorner(parent)
|
|
21
|
+
local existing = parent:FindFirstChild("__corner")
|
|
22
|
+
if existing then
|
|
23
|
+
return existing
|
|
24
|
+
end
|
|
25
|
+
local i = Instance.new("UICorner")
|
|
26
|
+
i.Name = "__corner"
|
|
27
|
+
i.Parent = parent
|
|
28
|
+
return i
|
|
29
|
+
end
|
|
30
|
+
local function getOrCreateUIStroke(parent)
|
|
31
|
+
local existing = parent:FindFirstChild("__stroke")
|
|
32
|
+
if existing then
|
|
33
|
+
return existing
|
|
34
|
+
end
|
|
35
|
+
local i = Instance.new("UIStroke")
|
|
36
|
+
i.Name = "__stroke"
|
|
37
|
+
i.Parent = parent
|
|
38
|
+
return i
|
|
39
|
+
end
|
|
40
|
+
local function getOrCreateUIGradient(parent)
|
|
41
|
+
local existing = parent:FindFirstChild("__gradient")
|
|
42
|
+
if existing then
|
|
43
|
+
return existing
|
|
44
|
+
end
|
|
45
|
+
local i = Instance.new("UIGradient")
|
|
46
|
+
i.Name = "__gradient"
|
|
47
|
+
i.Parent = parent
|
|
48
|
+
return i
|
|
49
|
+
end
|
|
50
|
+
local function getOrCreateUIPadding(parent)
|
|
51
|
+
local existing = parent:FindFirstChild("__padding")
|
|
52
|
+
if existing then
|
|
53
|
+
return existing
|
|
54
|
+
end
|
|
55
|
+
local i = Instance.new("UIPadding")
|
|
56
|
+
i.Name = "__padding"
|
|
57
|
+
i.Parent = parent
|
|
58
|
+
return i
|
|
59
|
+
end
|
|
60
|
+
local function removeChild(parent, name)
|
|
61
|
+
local _result = parent:FindFirstChild(name)
|
|
62
|
+
if _result ~= nil then
|
|
63
|
+
_result:Destroy()
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
-- ── Background ────────────────────────────────────────────────────────────────
|
|
67
|
+
function writeBackground(instance, style, prev)
|
|
68
|
+
local _exp = style.backgroundColor
|
|
69
|
+
local _result = prev
|
|
70
|
+
if _result ~= nil then
|
|
71
|
+
_result = _result.backgroundColor
|
|
72
|
+
end
|
|
73
|
+
if _exp ~= _result then
|
|
74
|
+
if style.backgroundColor ~= nil then
|
|
75
|
+
instance.BackgroundColor3 = parseColor(style.backgroundColor)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
local _exp_1 = style.backgroundTransparency
|
|
79
|
+
local _result_1 = prev
|
|
80
|
+
if _result_1 ~= nil then
|
|
81
|
+
_result_1 = _result_1.backgroundTransparency
|
|
82
|
+
end
|
|
83
|
+
if _exp_1 ~= _result_1 then
|
|
84
|
+
if style.backgroundTransparency ~= nil then
|
|
85
|
+
instance.BackgroundTransparency = style.backgroundTransparency
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
local _exp_2 = style.backgroundGradient
|
|
89
|
+
local _result_2 = prev
|
|
90
|
+
if _result_2 ~= nil then
|
|
91
|
+
_result_2 = _result_2.backgroundGradient
|
|
92
|
+
end
|
|
93
|
+
if _exp_2 ~= _result_2 then
|
|
94
|
+
if style.backgroundGradient ~= nil then
|
|
95
|
+
local gradient = getOrCreateUIGradient(instance)
|
|
96
|
+
local _condition = style.backgroundGradient.rotation
|
|
97
|
+
if _condition == nil then
|
|
98
|
+
_condition = 0
|
|
99
|
+
end
|
|
100
|
+
gradient.Rotation = _condition
|
|
101
|
+
local _exp_3 = style.backgroundGradient.stops
|
|
102
|
+
-- ▼ ReadonlyArray.map ▼
|
|
103
|
+
local _newValue = table.create(#_exp_3)
|
|
104
|
+
local _callback = function(s)
|
|
105
|
+
return ColorSequenceKeypoint.new(s.position, parseColor(s.color))
|
|
106
|
+
end
|
|
107
|
+
for _k, _v in _exp_3 do
|
|
108
|
+
_newValue[_k] = _callback(_v, _k - 1, _exp_3)
|
|
109
|
+
end
|
|
110
|
+
-- ▲ ReadonlyArray.map ▲
|
|
111
|
+
gradient.Color = ColorSequence.new(_newValue)
|
|
112
|
+
else
|
|
113
|
+
removeChild(instance, "__gradient")
|
|
114
|
+
end
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
-- ── Border ────────────────────────────────────────────────────────────────────
|
|
118
|
+
function writeBorder(instance, style, prev)
|
|
119
|
+
local _exp = style.borderRadius
|
|
120
|
+
local _result = prev
|
|
121
|
+
if _result ~= nil then
|
|
122
|
+
_result = _result.borderRadius
|
|
123
|
+
end
|
|
124
|
+
if _exp ~= _result then
|
|
125
|
+
if style.borderRadius ~= nil then
|
|
126
|
+
getOrCreateUICorner(instance).CornerRadius = UDim.new(0, style.borderRadius)
|
|
127
|
+
else
|
|
128
|
+
removeChild(instance, "__corner")
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
local _exp_1 = style.borderWidth
|
|
132
|
+
local _result_1 = prev
|
|
133
|
+
if _result_1 ~= nil then
|
|
134
|
+
_result_1 = _result_1.borderWidth
|
|
135
|
+
end
|
|
136
|
+
local _condition = _exp_1 ~= _result_1
|
|
137
|
+
if not _condition then
|
|
138
|
+
local _exp_2 = style.borderColor
|
|
139
|
+
local _result_2 = prev
|
|
140
|
+
if _result_2 ~= nil then
|
|
141
|
+
_result_2 = _result_2.borderColor
|
|
142
|
+
end
|
|
143
|
+
_condition = _exp_2 ~= _result_2
|
|
144
|
+
if not _condition then
|
|
145
|
+
local _exp_3 = style.borderTransparency
|
|
146
|
+
local _result_3 = prev
|
|
147
|
+
if _result_3 ~= nil then
|
|
148
|
+
_result_3 = _result_3.borderTransparency
|
|
149
|
+
end
|
|
150
|
+
_condition = _exp_3 ~= _result_3
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
local borderChanged = _condition
|
|
154
|
+
if borderChanged then
|
|
155
|
+
local hasBorder = style.borderWidth ~= nil or style.borderColor ~= nil or style.borderTransparency ~= nil
|
|
156
|
+
if hasBorder then
|
|
157
|
+
local stroke = getOrCreateUIStroke(instance)
|
|
158
|
+
local _condition_1 = style.borderColor ~= nil
|
|
159
|
+
if _condition_1 then
|
|
160
|
+
local _exp_2 = style.borderColor
|
|
161
|
+
local _result_2 = prev
|
|
162
|
+
if _result_2 ~= nil then
|
|
163
|
+
_result_2 = _result_2.borderColor
|
|
164
|
+
end
|
|
165
|
+
_condition_1 = _exp_2 ~= _result_2
|
|
166
|
+
end
|
|
167
|
+
if _condition_1 then
|
|
168
|
+
stroke.Color = parseColor(style.borderColor)
|
|
169
|
+
end
|
|
170
|
+
local _condition_2 = style.borderWidth ~= nil
|
|
171
|
+
if _condition_2 then
|
|
172
|
+
local _exp_2 = style.borderWidth
|
|
173
|
+
local _result_2 = prev
|
|
174
|
+
if _result_2 ~= nil then
|
|
175
|
+
_result_2 = _result_2.borderWidth
|
|
176
|
+
end
|
|
177
|
+
_condition_2 = _exp_2 ~= _result_2
|
|
178
|
+
end
|
|
179
|
+
if _condition_2 then
|
|
180
|
+
stroke.Thickness = style.borderWidth
|
|
181
|
+
end
|
|
182
|
+
local _condition_3 = style.borderTransparency ~= nil
|
|
183
|
+
if _condition_3 then
|
|
184
|
+
local _exp_2 = style.borderTransparency
|
|
185
|
+
local _result_2 = prev
|
|
186
|
+
if _result_2 ~= nil then
|
|
187
|
+
_result_2 = _result_2.borderTransparency
|
|
188
|
+
end
|
|
189
|
+
_condition_3 = _exp_2 ~= _result_2
|
|
190
|
+
end
|
|
191
|
+
if _condition_3 then
|
|
192
|
+
stroke.Transparency = style.borderTransparency
|
|
193
|
+
end
|
|
194
|
+
else
|
|
195
|
+
removeChild(instance, "__stroke")
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
-- ── Text ──────────────────────────────────────────────────────────────────────
|
|
200
|
+
local TEXT_X = {
|
|
201
|
+
left = Enum.TextXAlignment.Left,
|
|
202
|
+
center = Enum.TextXAlignment.Center,
|
|
203
|
+
right = Enum.TextXAlignment.Right,
|
|
204
|
+
}
|
|
205
|
+
local TEXT_Y = {
|
|
206
|
+
top = Enum.TextYAlignment.Top,
|
|
207
|
+
center = Enum.TextYAlignment.Center,
|
|
208
|
+
bottom = Enum.TextYAlignment.Bottom,
|
|
209
|
+
}
|
|
210
|
+
function writeText(instance, style, prev)
|
|
211
|
+
local isText = instance:IsA("TextLabel") or instance:IsA("TextButton") or instance:IsA("TextBox")
|
|
212
|
+
if not isText then
|
|
213
|
+
return nil
|
|
214
|
+
end
|
|
215
|
+
local text = instance
|
|
216
|
+
local _exp = style.color
|
|
217
|
+
local _result = prev
|
|
218
|
+
if _result ~= nil then
|
|
219
|
+
_result = _result.color
|
|
220
|
+
end
|
|
221
|
+
local _condition = _exp ~= _result
|
|
222
|
+
if _condition then
|
|
223
|
+
_condition = style.color ~= nil
|
|
224
|
+
end
|
|
225
|
+
if _condition then
|
|
226
|
+
text.TextColor3 = parseColor(style.color)
|
|
227
|
+
end
|
|
228
|
+
local _exp_1 = style.fontSize
|
|
229
|
+
local _result_1 = prev
|
|
230
|
+
if _result_1 ~= nil then
|
|
231
|
+
_result_1 = _result_1.fontSize
|
|
232
|
+
end
|
|
233
|
+
local _condition_1 = _exp_1 ~= _result_1
|
|
234
|
+
if _condition_1 then
|
|
235
|
+
_condition_1 = style.fontSize ~= nil
|
|
236
|
+
end
|
|
237
|
+
if _condition_1 then
|
|
238
|
+
text.TextSize = style.fontSize
|
|
239
|
+
end
|
|
240
|
+
local _exp_2 = style.fontFamily
|
|
241
|
+
local _result_2 = prev
|
|
242
|
+
if _result_2 ~= nil then
|
|
243
|
+
_result_2 = _result_2.fontFamily
|
|
244
|
+
end
|
|
245
|
+
local _condition_2 = _exp_2 ~= _result_2
|
|
246
|
+
if _condition_2 then
|
|
247
|
+
_condition_2 = style.fontFamily ~= nil
|
|
248
|
+
end
|
|
249
|
+
if _condition_2 then
|
|
250
|
+
text.Font = style.fontFamily
|
|
251
|
+
end
|
|
252
|
+
local _exp_3 = style.textTransparency
|
|
253
|
+
local _result_3 = prev
|
|
254
|
+
if _result_3 ~= nil then
|
|
255
|
+
_result_3 = _result_3.textTransparency
|
|
256
|
+
end
|
|
257
|
+
local _condition_3 = _exp_3 ~= _result_3
|
|
258
|
+
if _condition_3 then
|
|
259
|
+
_condition_3 = style.textTransparency ~= nil
|
|
260
|
+
end
|
|
261
|
+
if _condition_3 then
|
|
262
|
+
text.TextTransparency = style.textTransparency
|
|
263
|
+
end
|
|
264
|
+
local _exp_4 = style.textScaled
|
|
265
|
+
local _result_4 = prev
|
|
266
|
+
if _result_4 ~= nil then
|
|
267
|
+
_result_4 = _result_4.textScaled
|
|
268
|
+
end
|
|
269
|
+
local _condition_4 = _exp_4 ~= _result_4
|
|
270
|
+
if _condition_4 then
|
|
271
|
+
_condition_4 = style.textScaled ~= nil
|
|
272
|
+
end
|
|
273
|
+
if _condition_4 then
|
|
274
|
+
text.TextScaled = style.textScaled
|
|
275
|
+
end
|
|
276
|
+
local _exp_5 = style.textWrapped
|
|
277
|
+
local _result_5 = prev
|
|
278
|
+
if _result_5 ~= nil then
|
|
279
|
+
_result_5 = _result_5.textWrapped
|
|
280
|
+
end
|
|
281
|
+
local _condition_5 = _exp_5 ~= _result_5
|
|
282
|
+
if _condition_5 then
|
|
283
|
+
_condition_5 = style.textWrapped ~= nil
|
|
284
|
+
end
|
|
285
|
+
if _condition_5 then
|
|
286
|
+
text.TextWrapped = style.textWrapped
|
|
287
|
+
end
|
|
288
|
+
local _exp_6 = style.lineHeight
|
|
289
|
+
local _result_6 = prev
|
|
290
|
+
if _result_6 ~= nil then
|
|
291
|
+
_result_6 = _result_6.lineHeight
|
|
292
|
+
end
|
|
293
|
+
local _condition_6 = _exp_6 ~= _result_6
|
|
294
|
+
if _condition_6 then
|
|
295
|
+
_condition_6 = style.lineHeight ~= nil
|
|
296
|
+
end
|
|
297
|
+
if _condition_6 then
|
|
298
|
+
text.LineHeight = style.lineHeight
|
|
299
|
+
end
|
|
300
|
+
local _exp_7 = style.textAlign
|
|
301
|
+
local _result_7 = prev
|
|
302
|
+
if _result_7 ~= nil then
|
|
303
|
+
_result_7 = _result_7.textAlign
|
|
304
|
+
end
|
|
305
|
+
local _condition_7 = _exp_7 ~= _result_7
|
|
306
|
+
if _condition_7 then
|
|
307
|
+
_condition_7 = style.textAlign ~= nil
|
|
308
|
+
end
|
|
309
|
+
if _condition_7 then
|
|
310
|
+
text.TextXAlignment = TEXT_X[style.textAlign] or Enum.TextXAlignment.Left
|
|
311
|
+
end
|
|
312
|
+
local _exp_8 = style.verticalAlign
|
|
313
|
+
local _result_8 = prev
|
|
314
|
+
if _result_8 ~= nil then
|
|
315
|
+
_result_8 = _result_8.verticalAlign
|
|
316
|
+
end
|
|
317
|
+
local _condition_8 = _exp_8 ~= _result_8
|
|
318
|
+
if _condition_8 then
|
|
319
|
+
_condition_8 = style.verticalAlign ~= nil
|
|
320
|
+
end
|
|
321
|
+
if _condition_8 then
|
|
322
|
+
text.TextYAlignment = TEXT_Y[style.verticalAlign] or Enum.TextYAlignment.Center
|
|
323
|
+
end
|
|
324
|
+
end
|
|
325
|
+
-- ── Misc ──────────────────────────────────────────────────────────────────────
|
|
326
|
+
function writeMisc(instance, style, prev)
|
|
327
|
+
local _exp = style.visible
|
|
328
|
+
local _result = prev
|
|
329
|
+
if _result ~= nil then
|
|
330
|
+
_result = _result.visible
|
|
331
|
+
end
|
|
332
|
+
local _condition = _exp ~= _result
|
|
333
|
+
if _condition then
|
|
334
|
+
_condition = style.visible ~= nil
|
|
335
|
+
end
|
|
336
|
+
if _condition then
|
|
337
|
+
instance.Visible = style.visible
|
|
338
|
+
end
|
|
339
|
+
local _exp_1 = style.zIndex
|
|
340
|
+
local _result_1 = prev
|
|
341
|
+
if _result_1 ~= nil then
|
|
342
|
+
_result_1 = _result_1.zIndex
|
|
343
|
+
end
|
|
344
|
+
local _condition_1 = _exp_1 ~= _result_1
|
|
345
|
+
if _condition_1 then
|
|
346
|
+
_condition_1 = style.zIndex ~= nil
|
|
347
|
+
end
|
|
348
|
+
if _condition_1 then
|
|
349
|
+
instance.ZIndex = style.zIndex
|
|
350
|
+
end
|
|
351
|
+
local _exp_2 = style.pointerEvents
|
|
352
|
+
local _result_2 = prev
|
|
353
|
+
if _result_2 ~= nil then
|
|
354
|
+
_result_2 = _result_2.pointerEvents
|
|
355
|
+
end
|
|
356
|
+
local _condition_2 = _exp_2 ~= _result_2
|
|
357
|
+
if _condition_2 then
|
|
358
|
+
_condition_2 = style.pointerEvents ~= nil
|
|
359
|
+
end
|
|
360
|
+
if _condition_2 then
|
|
361
|
+
instance.Active = style.pointerEvents == "auto"
|
|
362
|
+
end
|
|
363
|
+
local _exp_3 = style.overflow
|
|
364
|
+
local _result_3 = prev
|
|
365
|
+
if _result_3 ~= nil then
|
|
366
|
+
_result_3 = _result_3.overflow
|
|
367
|
+
end
|
|
368
|
+
local _condition_3 = _exp_3 ~= _result_3
|
|
369
|
+
if _condition_3 then
|
|
370
|
+
_condition_3 = style.overflow ~= nil
|
|
371
|
+
end
|
|
372
|
+
if _condition_3 then
|
|
373
|
+
instance.ClipsDescendants = style.overflow == "hidden"
|
|
374
|
+
end
|
|
375
|
+
local _exp_4 = style.opacity
|
|
376
|
+
local _result_4 = prev
|
|
377
|
+
if _result_4 ~= nil then
|
|
378
|
+
_result_4 = _result_4.opacity
|
|
379
|
+
end
|
|
380
|
+
local _condition_4 = _exp_4 ~= _result_4
|
|
381
|
+
if _condition_4 then
|
|
382
|
+
_condition_4 = style.opacity ~= nil
|
|
383
|
+
end
|
|
384
|
+
if _condition_4 then
|
|
385
|
+
local t = 1 - style.opacity
|
|
386
|
+
instance.BackgroundTransparency = t
|
|
387
|
+
if instance:IsA("TextLabel") or instance:IsA("TextButton") or instance:IsA("TextBox") then
|
|
388
|
+
instance.TextTransparency = t
|
|
389
|
+
end
|
|
390
|
+
if instance:IsA("ImageLabel") or instance:IsA("ImageButton") then
|
|
391
|
+
instance.ImageTransparency = t
|
|
392
|
+
end
|
|
393
|
+
end
|
|
394
|
+
-- Padding — solo si algo cambió
|
|
395
|
+
local _exp_5 = style.padding
|
|
396
|
+
local _result_5 = prev
|
|
397
|
+
if _result_5 ~= nil then
|
|
398
|
+
_result_5 = _result_5.padding
|
|
399
|
+
end
|
|
400
|
+
local _condition_5 = _exp_5 ~= _result_5
|
|
401
|
+
if not _condition_5 then
|
|
402
|
+
local _exp_6 = style.paddingX
|
|
403
|
+
local _result_6 = prev
|
|
404
|
+
if _result_6 ~= nil then
|
|
405
|
+
_result_6 = _result_6.paddingX
|
|
406
|
+
end
|
|
407
|
+
_condition_5 = _exp_6 ~= _result_6
|
|
408
|
+
if not _condition_5 then
|
|
409
|
+
local _exp_7 = style.paddingY
|
|
410
|
+
local _result_7 = prev
|
|
411
|
+
if _result_7 ~= nil then
|
|
412
|
+
_result_7 = _result_7.paddingY
|
|
413
|
+
end
|
|
414
|
+
_condition_5 = _exp_7 ~= _result_7
|
|
415
|
+
if not _condition_5 then
|
|
416
|
+
local _exp_8 = style.paddingTop
|
|
417
|
+
local _result_8 = prev
|
|
418
|
+
if _result_8 ~= nil then
|
|
419
|
+
_result_8 = _result_8.paddingTop
|
|
420
|
+
end
|
|
421
|
+
_condition_5 = _exp_8 ~= _result_8
|
|
422
|
+
if not _condition_5 then
|
|
423
|
+
local _exp_9 = style.paddingBottom
|
|
424
|
+
local _result_9 = prev
|
|
425
|
+
if _result_9 ~= nil then
|
|
426
|
+
_result_9 = _result_9.paddingBottom
|
|
427
|
+
end
|
|
428
|
+
_condition_5 = _exp_9 ~= _result_9
|
|
429
|
+
if not _condition_5 then
|
|
430
|
+
local _exp_10 = style.paddingLeft
|
|
431
|
+
local _result_10 = prev
|
|
432
|
+
if _result_10 ~= nil then
|
|
433
|
+
_result_10 = _result_10.paddingLeft
|
|
434
|
+
end
|
|
435
|
+
_condition_5 = _exp_10 ~= _result_10
|
|
436
|
+
if not _condition_5 then
|
|
437
|
+
local _exp_11 = style.paddingRight
|
|
438
|
+
local _result_11 = prev
|
|
439
|
+
if _result_11 ~= nil then
|
|
440
|
+
_result_11 = _result_11.paddingRight
|
|
441
|
+
end
|
|
442
|
+
_condition_5 = _exp_11 ~= _result_11
|
|
443
|
+
end
|
|
444
|
+
end
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
end
|
|
448
|
+
end
|
|
449
|
+
local paddingChanged = _condition_5
|
|
450
|
+
if paddingChanged then
|
|
451
|
+
local hasPadding = style.padding ~= nil or style.paddingX ~= nil or style.paddingY ~= nil or style.paddingTop ~= nil or style.paddingBottom ~= nil or style.paddingLeft ~= nil or style.paddingRight ~= nil
|
|
452
|
+
if hasPadding then
|
|
453
|
+
local pad = getOrCreateUIPadding(instance)
|
|
454
|
+
local _condition_6 = style.paddingTop
|
|
455
|
+
if _condition_6 == nil then
|
|
456
|
+
_condition_6 = style.paddingY
|
|
457
|
+
if _condition_6 == nil then
|
|
458
|
+
_condition_6 = style.padding
|
|
459
|
+
if _condition_6 == nil then
|
|
460
|
+
_condition_6 = 0
|
|
461
|
+
end
|
|
462
|
+
end
|
|
463
|
+
end
|
|
464
|
+
pad.PaddingTop = parseUDim(_condition_6)
|
|
465
|
+
local _condition_7 = style.paddingBottom
|
|
466
|
+
if _condition_7 == nil then
|
|
467
|
+
_condition_7 = style.paddingY
|
|
468
|
+
if _condition_7 == nil then
|
|
469
|
+
_condition_7 = style.padding
|
|
470
|
+
if _condition_7 == nil then
|
|
471
|
+
_condition_7 = 0
|
|
472
|
+
end
|
|
473
|
+
end
|
|
474
|
+
end
|
|
475
|
+
pad.PaddingBottom = parseUDim(_condition_7)
|
|
476
|
+
local _condition_8 = style.paddingLeft
|
|
477
|
+
if _condition_8 == nil then
|
|
478
|
+
_condition_8 = style.paddingX
|
|
479
|
+
if _condition_8 == nil then
|
|
480
|
+
_condition_8 = style.padding
|
|
481
|
+
if _condition_8 == nil then
|
|
482
|
+
_condition_8 = 0
|
|
483
|
+
end
|
|
484
|
+
end
|
|
485
|
+
end
|
|
486
|
+
pad.PaddingLeft = parseUDim(_condition_8)
|
|
487
|
+
local _condition_9 = style.paddingRight
|
|
488
|
+
if _condition_9 == nil then
|
|
489
|
+
_condition_9 = style.paddingX
|
|
490
|
+
if _condition_9 == nil then
|
|
491
|
+
_condition_9 = style.padding
|
|
492
|
+
if _condition_9 == nil then
|
|
493
|
+
_condition_9 = 0
|
|
494
|
+
end
|
|
495
|
+
end
|
|
496
|
+
end
|
|
497
|
+
pad.PaddingRight = parseUDim(_condition_9)
|
|
498
|
+
else
|
|
499
|
+
removeChild(instance, "__padding")
|
|
500
|
+
end
|
|
501
|
+
end
|
|
502
|
+
end
|
|
503
|
+
return {
|
|
504
|
+
writeVisual = writeVisual,
|
|
505
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import type { RbxStyle } from "../core";
|
|
3
|
+
interface BaseProps {
|
|
4
|
+
style?: RbxStyle;
|
|
5
|
+
className?: RbxStyle;
|
|
6
|
+
children?: React.ReactNode;
|
|
7
|
+
layoutOrder?: number;
|
|
8
|
+
}
|
|
9
|
+
interface InteractiveProps extends BaseProps {
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
onMouseEnter?: () => void;
|
|
12
|
+
onMouseLeave?: () => void;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
}
|
|
15
|
+
export declare function div(props: BaseProps): React.ReactElement;
|
|
16
|
+
export declare function span(props: BaseProps & {
|
|
17
|
+
text?: string;
|
|
18
|
+
richText?: boolean;
|
|
19
|
+
}): React.ReactElement;
|
|
20
|
+
export declare function button(props: InteractiveProps & {
|
|
21
|
+
text?: string;
|
|
22
|
+
}): React.ReactElement;
|
|
23
|
+
export declare function img(props: BaseProps & {
|
|
24
|
+
src: string;
|
|
25
|
+
scaleType?: "fit" | "crop" | "stretch" | "tile";
|
|
26
|
+
}): React.ReactElement;
|
|
27
|
+
export declare function input(props: BaseProps & {
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
value?: string;
|
|
30
|
+
onChanged?: (text: string) => void;
|
|
31
|
+
clearOnFocus?: boolean;
|
|
32
|
+
}): React.ReactElement;
|
|
33
|
+
export declare function ul(props: BaseProps & {
|
|
34
|
+
scrollDirection?: "vertical" | "horizontal";
|
|
35
|
+
scrollBarThickness?: number;
|
|
36
|
+
}): React.ReactElement;
|
|
37
|
+
export declare function canvas(props: BaseProps): React.ReactElement;
|
|
38
|
+
export declare function video(props: BaseProps & {
|
|
39
|
+
src: string;
|
|
40
|
+
looped?: boolean;
|
|
41
|
+
playing?: boolean;
|
|
42
|
+
}): React.ReactElement;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/elements/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAwC,MAAM,cAAc,CAAA;AACnE,OAAO,KAAK,EAAE,QAAQ,EAAc,MAAM,SAAS,CAAA;AAUnD,UAAU,SAAS;IAClB,KAAK,CAAC,EAAE,QAAQ,CAAA;IAChB,SAAS,CAAC,EAAE,QAAQ,CAAA;IACpB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,UAAU,gBAAiB,SAAQ,SAAS;IAC3C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;CAClB;AAgGD,wBAAgB,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC,YAAY,CAUxD;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,CAkBjG;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,gBAAgB,GAAG;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,CAuBtF;AAED,wBAAgB,GAAG,CAAC,KAAK,EAAE,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,KAAK,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,CAuB3H;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,GAAG;IACxC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,YAAY,CAAC,EAAE,OAAO,CAAA;CACtB,GAAG,KAAK,CAAC,YAAY,CAmBrB;AAED,wBAAgB,EAAE,CAAC,KAAK,EAAE,SAAS,GAAG;IACrC,eAAe,CAAC,EAAE,UAAU,GAAG,YAAY,CAAA;IAC3C,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC3B,GAAG,KAAK,CAAC,YAAY,CA2BrB;AAED,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC,YAAY,CAU3D;AAED,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,GAAG;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,KAAK,CAAC,YAAY,CAkBjH"}
|