@rbxts/uiblox 0.2.0-alpha.24 → 0.2.0-alpha.26
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/out/hooks/index.d.ts +1 -0
- package/out/hooks/init.luau +3 -0
- package/out/hooks/useBreakpoints.luau +2 -11
- package/out/hooks/viewportObserver.d.ts +10 -0
- package/out/hooks/viewportObserver.luau +75 -0
- package/out/theme/interfaces/theme/Theme.d.ts +15 -0
- package/out/theme/styles/utilities/componentStyles.luau +45 -3
- package/out/theme/styles/utilities/componentTheme.d.ts +15 -0
- package/out/theme/styles/utilities/index.d.ts +2 -0
- package/out/theme/styles/utilities/init.luau +7 -0
- package/out/theme/styles/utilities/resolveStyle.d.ts +10 -2
- package/out/theme/styles/utilities/resolveStyle.luau +7 -3
- package/out/theme/styles/utilities/resolveSx.d.ts +110 -0
- package/out/theme/styles/utilities/resolveSx.luau +479 -0
- package/out/theme/styles/utilities/styleCache.d.ts +2 -0
- package/out/theme/styles/utilities/styleCache.luau +9 -0
- package/out/ui/packages/accordion/components/Accordion.luau +12 -16
- package/out/ui/packages/alert/components/Alert.luau +9 -16
- package/out/ui/packages/appBar/components/AppBar.luau +9 -16
- package/out/ui/packages/assetField/components/AssetField.luau +12 -16
- package/out/ui/packages/avatar/components/Avatar.luau +9 -16
- package/out/ui/packages/backdrop/components/Backdrop.luau +9 -16
- package/out/ui/packages/badge/components/Badge.luau +9 -16
- package/out/ui/packages/bottomNavigation/components/BottomNavigation.luau +12 -16
- package/out/ui/packages/breadcrumbs/components/Breadcrumbs.luau +9 -16
- package/out/ui/packages/brickColorPicker/components/BrickColorPicker.luau +12 -16
- package/out/ui/packages/button/components/Button.luau +20 -18
- package/out/ui/packages/card/components/Card.d.ts +2 -1
- package/out/ui/packages/card/components/Card.luau +8 -0
- package/out/ui/packages/cframeEditor/components/CFrameEditor.luau +12 -16
- package/out/ui/packages/checkbox/components/Checkbox.luau +16 -16
- package/out/ui/packages/chip/components/Chip.luau +13 -16
- package/out/ui/packages/circularProgress/components/CircularProgress.luau +16 -16
- package/out/ui/packages/colorPicker/components/ColorPicker.luau +12 -16
- package/out/ui/packages/colorPicker/components/ColorSequenceEditor.luau +12 -16
- package/out/ui/packages/colorPicker/components/NumberSequenceEditor.luau +12 -16
- package/out/ui/packages/dialog/components/Dialog.d.ts +2 -1
- package/out/ui/packages/dialog/components/Dialog.luau +21 -10
- package/out/ui/packages/divider/components/Divider.luau +20 -33
- package/out/ui/packages/drawer/components/Drawer.d.ts +2 -1
- package/out/ui/packages/drawer/components/Drawer.luau +18 -5
- package/out/ui/packages/fab/components/Fab.luau +15 -16
- package/out/ui/packages/fontEditor/components/FontEditor.luau +12 -16
- package/out/ui/packages/formText/components/FormHelperText.luau +12 -16
- package/out/ui/packages/formText/components/FormLabel.luau +12 -16
- package/out/ui/packages/gradientEditor/components/GradientEditor.luau +12 -16
- package/out/ui/packages/host/components/SxHost.d.ts +18 -0
- package/out/ui/packages/host/components/SxHost.luau +197 -0
- package/out/ui/packages/host/hostPaint.d.ts +11 -0
- package/out/ui/packages/host/hostPaint.luau +33 -0
- package/out/ui/packages/host/hostRules.d.ts +15 -0
- package/out/ui/packages/host/hostRules.luau +92 -0
- package/out/ui/packages/host/index.d.ts +3 -0
- package/out/ui/packages/host/init.luau +13 -0
- package/out/ui/packages/icon/components/Icon.luau +9 -16
- package/out/ui/packages/iconButton/components/IconButton.luau +16 -16
- package/out/ui/packages/imageList/components/ImageList.luau +9 -16
- package/out/ui/packages/imageList/components/ImageList.styles.luau +4 -3
- package/out/ui/packages/input/components/Input.luau +14 -16
- package/out/ui/packages/layout/components/Box.luau +6 -15
- package/out/ui/packages/layout/components/Container.luau +6 -15
- package/out/ui/packages/layout/components/FlexItem.luau +6 -15
- package/out/ui/packages/layout/components/Grid.luau +6 -15
- package/out/ui/packages/layout/components/List.luau +9 -16
- package/out/ui/packages/layout/components/Stack.luau +6 -15
- package/out/ui/packages/link/components/Link.luau +13 -16
- package/out/ui/packages/listItem/components/ListItem.d.ts +2 -1
- package/out/ui/packages/listItem/components/ListItem.luau +23 -4
- package/out/ui/packages/loadingStroke/components/LoadingStroke.d.ts +5 -1
- package/out/ui/packages/loadingStroke/components/loadingStrokeSx.d.ts +11 -0
- package/out/ui/packages/loadingStroke/components/loadingStrokeSx.luau +2 -0
- package/out/ui/packages/markdown/components/Markdown.luau +9 -16
- package/out/ui/packages/markdown/components/MarkdownEditor.luau +9 -16
- package/out/ui/packages/menu/components/Menu.d.ts +2 -1
- package/out/ui/packages/menu/components/Menu.luau +23 -12
- package/out/ui/packages/modal/components/Modal.d.ts +2 -1
- package/out/ui/packages/modal/components/Modal.luau +29 -5
- package/out/ui/packages/numberInput/components/NumberInput.d.ts +1 -0
- package/out/ui/packages/numberInput/components/NumberInput.luau +14 -3
- package/out/ui/packages/numberInput/components/numberValue.d.ts +1 -0
- package/out/ui/packages/numberInput/components/numberValue.luau +45 -0
- package/out/ui/packages/numberRangeEditor/components/NumberRangeEditor.luau +12 -16
- package/out/ui/packages/pagination/components/Pagination.luau +12 -16
- package/out/ui/packages/paper/components/Paper.d.ts +2 -1
- package/out/ui/packages/paper/components/Paper.luau +21 -12
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.luau +63 -38
- package/out/ui/packages/physicalPropertiesEditor/components/PhysicalPropertiesEditor.styles.luau +21 -7
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.d.ts +2 -0
- package/out/ui/packages/physicalPropertiesEditor/components/physicalParts.luau +14 -0
- package/out/ui/packages/popup/components/Popup.d.ts +2 -1
- package/out/ui/packages/popup/components/Popup.luau +35 -18
- package/out/ui/packages/preloader/components/Preloader.luau +9 -16
- package/out/ui/packages/progressBar/components/ProgressBar.luau +12 -16
- package/out/ui/packages/radioGroup/components/RadioGroup.luau +12 -16
- package/out/ui/packages/rating/components/Rating.luau +12 -16
- package/out/ui/packages/rayEditor/components/RayEditor.luau +12 -16
- package/out/ui/packages/rectEditor/components/RectEditor.luau +86 -43
- package/out/ui/packages/rectEditor/components/RectEditor.styles.luau +30 -7
- package/out/ui/packages/select/components/Select.luau +13 -16
- package/out/ui/packages/shadow/components/Shadow.d.ts +2 -1
- package/out/ui/packages/shadow/components/Shadow.luau +17 -5
- package/out/ui/packages/sidebar/components/Sidebar.luau +9 -16
- package/out/ui/packages/skeleton/components/Skeleton.luau +19 -28
- package/out/ui/packages/slider/components/Slider.luau +16 -17
- package/out/ui/packages/speedDial/components/SpeedDial.luau +12 -16
- package/out/ui/packages/splitPane/components/SplitPane.luau +12 -16
- package/out/ui/packages/stateMatrix.luau +1171 -675
- package/out/ui/packages/stepper/components/Stepper.luau +9 -16
- package/out/ui/packages/switch/components/Switch.luau +16 -16
- package/out/ui/packages/table/components/Table.luau +9 -16
- package/out/ui/packages/tabs/components/Tabs.luau +12 -16
- package/out/ui/packages/toast/components/Toast.luau +16 -13
- package/out/ui/packages/toggleButton/components/ToggleButton.luau +24 -32
- package/out/ui/packages/tooltip/components/Tooltip.luau +9 -16
- package/out/ui/packages/treeView/components/TreeView.luau +9 -16
- package/out/ui/packages/typography/components/Typography.luau +13 -14
- package/out/ui/packages/udimEditor/components/UDimEditor.luau +12 -16
- package/out/ui/packages/vectorEditor/components/VectorEditor.luau +12 -16
- package/out/ui/packages/virtualList/components/EmptyListHint.d.ts +2 -1
- package/out/ui/packages/virtualList/components/EmptyListHint.luau +15 -4
- package/out/ui/packages/virtualList/components/VirtualList.luau +9 -16
- package/package.json +2 -2
|
@@ -0,0 +1,479 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
--* Dot-path into `theme.palette` (typed for common roles).
|
|
3
|
+
local function resolvePaletteToken(palette, token)
|
|
4
|
+
local _token = token
|
|
5
|
+
if not (type(_token) == "string") then
|
|
6
|
+
return token
|
|
7
|
+
end
|
|
8
|
+
local parts = string.split(token, ".")
|
|
9
|
+
local cursor = palette
|
|
10
|
+
for _, part in parts do
|
|
11
|
+
local _condition = cursor == nil
|
|
12
|
+
if not _condition then
|
|
13
|
+
local _cursor = cursor
|
|
14
|
+
_condition = typeof(_cursor) ~= "table"
|
|
15
|
+
end
|
|
16
|
+
if _condition then
|
|
17
|
+
return Color3.new(0, 0, 0)
|
|
18
|
+
end
|
|
19
|
+
cursor = cursor[part]
|
|
20
|
+
end
|
|
21
|
+
local _cursor = cursor
|
|
22
|
+
if typeof(_cursor) == "Color3" then
|
|
23
|
+
return cursor
|
|
24
|
+
end
|
|
25
|
+
return Color3.new(0, 0, 0)
|
|
26
|
+
end
|
|
27
|
+
--* Matches `hooks/breakpoints` thresholds. Kept local so Node style checks need no path aliases.
|
|
28
|
+
local function resolveResponsive(value, width)
|
|
29
|
+
local _condition = value == nil
|
|
30
|
+
if not _condition then
|
|
31
|
+
local _value = value
|
|
32
|
+
_condition = typeof(_value) ~= "table"
|
|
33
|
+
end
|
|
34
|
+
if _condition then
|
|
35
|
+
return value
|
|
36
|
+
end
|
|
37
|
+
local record = value
|
|
38
|
+
local size = if width == width and width < math.huge and width > 0 then width else 0
|
|
39
|
+
local name = if size < 600 then "phone" elseif size < 960 then "tablet" else "desktop"
|
|
40
|
+
if name == "desktop" then
|
|
41
|
+
local _condition_1 = record.desktop
|
|
42
|
+
if _condition_1 == nil then
|
|
43
|
+
_condition_1 = record.tablet
|
|
44
|
+
if _condition_1 == nil then
|
|
45
|
+
_condition_1 = record.phone
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
return _condition_1
|
|
49
|
+
end
|
|
50
|
+
if name == "tablet" then
|
|
51
|
+
local _condition_1 = record.tablet
|
|
52
|
+
if _condition_1 == nil then
|
|
53
|
+
_condition_1 = record.phone
|
|
54
|
+
end
|
|
55
|
+
return _condition_1
|
|
56
|
+
end
|
|
57
|
+
return record.phone
|
|
58
|
+
end
|
|
59
|
+
local SELECTORS = {
|
|
60
|
+
_hover = true,
|
|
61
|
+
_pressed = true,
|
|
62
|
+
_focus = true,
|
|
63
|
+
_focusVisible = true,
|
|
64
|
+
_disabled = true,
|
|
65
|
+
_selected = true,
|
|
66
|
+
_checked = true,
|
|
67
|
+
_loading = true,
|
|
68
|
+
_first = true,
|
|
69
|
+
_last = true,
|
|
70
|
+
_odd = true,
|
|
71
|
+
_even = true,
|
|
72
|
+
}
|
|
73
|
+
local SHORTHAND = {
|
|
74
|
+
width = true,
|
|
75
|
+
height = true,
|
|
76
|
+
w = true,
|
|
77
|
+
h = true,
|
|
78
|
+
size = true,
|
|
79
|
+
x = true,
|
|
80
|
+
y = true,
|
|
81
|
+
position = true,
|
|
82
|
+
pos = true,
|
|
83
|
+
anchor = true,
|
|
84
|
+
p = true,
|
|
85
|
+
px = true,
|
|
86
|
+
py = true,
|
|
87
|
+
pt = true,
|
|
88
|
+
pr = true,
|
|
89
|
+
pb = true,
|
|
90
|
+
pl = true,
|
|
91
|
+
padding = true,
|
|
92
|
+
gap = true,
|
|
93
|
+
bgcolor = true,
|
|
94
|
+
bg = true,
|
|
95
|
+
backgroundColor = true,
|
|
96
|
+
color = true,
|
|
97
|
+
borderColor = true,
|
|
98
|
+
opacity = true,
|
|
99
|
+
transparency = true,
|
|
100
|
+
border = true,
|
|
101
|
+
borderWidth = true,
|
|
102
|
+
radius = true,
|
|
103
|
+
typography = true,
|
|
104
|
+
fontSize = true,
|
|
105
|
+
font = true,
|
|
106
|
+
visible = true,
|
|
107
|
+
zIndex = true,
|
|
108
|
+
z = true,
|
|
109
|
+
}
|
|
110
|
+
--* CSS-like shorthands + pass-through Instance props. No CSS string parser.
|
|
111
|
+
local function pick(value, width)
|
|
112
|
+
if value == nil then
|
|
113
|
+
return nil
|
|
114
|
+
end
|
|
115
|
+
if width ~= nil then
|
|
116
|
+
return resolveResponsive(value, width)
|
|
117
|
+
end
|
|
118
|
+
local _value = value
|
|
119
|
+
if typeof(_value) ~= "table" then
|
|
120
|
+
return value
|
|
121
|
+
end
|
|
122
|
+
local record = value
|
|
123
|
+
if record.phone ~= nil or record.tablet ~= nil or record.desktop ~= nil then
|
|
124
|
+
local _condition = record.desktop
|
|
125
|
+
if _condition == nil then
|
|
126
|
+
_condition = record.tablet
|
|
127
|
+
if _condition == nil then
|
|
128
|
+
_condition = record.phone
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
return _condition
|
|
132
|
+
end
|
|
133
|
+
return value
|
|
134
|
+
end
|
|
135
|
+
local function asUDim(value)
|
|
136
|
+
local _value = value
|
|
137
|
+
return if type(_value) == "number" then UDim.new(0, value) else value
|
|
138
|
+
end
|
|
139
|
+
local function sizeAxis(value, axis)
|
|
140
|
+
if value == nil then
|
|
141
|
+
return nil
|
|
142
|
+
end
|
|
143
|
+
local _value = value
|
|
144
|
+
if type(_value) == "number" then
|
|
145
|
+
return UDim.new(0, value)
|
|
146
|
+
end
|
|
147
|
+
local _value_1 = value
|
|
148
|
+
if typeof(_value_1) == "UDim" then
|
|
149
|
+
return value
|
|
150
|
+
end
|
|
151
|
+
return if axis == "X" then value.X else value.Y
|
|
152
|
+
end
|
|
153
|
+
local function padSides(padding)
|
|
154
|
+
if padding == nil then
|
|
155
|
+
return {
|
|
156
|
+
top = 0,
|
|
157
|
+
right = 0,
|
|
158
|
+
bottom = 0,
|
|
159
|
+
left = 0,
|
|
160
|
+
}
|
|
161
|
+
end
|
|
162
|
+
local _padding = padding
|
|
163
|
+
if type(_padding) == "number" then
|
|
164
|
+
return {
|
|
165
|
+
top = padding,
|
|
166
|
+
right = padding,
|
|
167
|
+
bottom = padding,
|
|
168
|
+
left = padding,
|
|
169
|
+
}
|
|
170
|
+
end
|
|
171
|
+
local _condition = padding.x
|
|
172
|
+
if _condition == nil then
|
|
173
|
+
_condition = 0
|
|
174
|
+
end
|
|
175
|
+
local x = _condition
|
|
176
|
+
local _condition_1 = padding.y
|
|
177
|
+
if _condition_1 == nil then
|
|
178
|
+
_condition_1 = 0
|
|
179
|
+
end
|
|
180
|
+
local y = _condition_1
|
|
181
|
+
local _object = {}
|
|
182
|
+
local _left = "top"
|
|
183
|
+
local _condition_2 = padding.top
|
|
184
|
+
if _condition_2 == nil then
|
|
185
|
+
_condition_2 = y
|
|
186
|
+
end
|
|
187
|
+
_object[_left] = _condition_2
|
|
188
|
+
local _left_1 = "right"
|
|
189
|
+
local _condition_3 = padding.right
|
|
190
|
+
if _condition_3 == nil then
|
|
191
|
+
_condition_3 = x
|
|
192
|
+
end
|
|
193
|
+
_object[_left_1] = _condition_3
|
|
194
|
+
local _left_2 = "bottom"
|
|
195
|
+
local _condition_4 = padding.bottom
|
|
196
|
+
if _condition_4 == nil then
|
|
197
|
+
_condition_4 = y
|
|
198
|
+
end
|
|
199
|
+
_object[_left_2] = _condition_4
|
|
200
|
+
local _left_3 = "left"
|
|
201
|
+
local _condition_5 = padding.left
|
|
202
|
+
if _condition_5 == nil then
|
|
203
|
+
_condition_5 = x
|
|
204
|
+
end
|
|
205
|
+
_object[_left_3] = _condition_5
|
|
206
|
+
return _object
|
|
207
|
+
end
|
|
208
|
+
local function colorOf(theme, value)
|
|
209
|
+
if value == nil then
|
|
210
|
+
return nil
|
|
211
|
+
end
|
|
212
|
+
return resolvePaletteToken(theme.palette, value)
|
|
213
|
+
end
|
|
214
|
+
--[[
|
|
215
|
+
*
|
|
216
|
+
* Maps sx shorthands / tokens → Instance props (+ UIPadding / UICorner / gap helpers).
|
|
217
|
+
* Pass-through keys (BackgroundColor3, _hover, …) stay on `root` for `resolveStyle`.
|
|
218
|
+
|
|
219
|
+
]]
|
|
220
|
+
local function resolveSx(theme, sx, width)
|
|
221
|
+
if sx == nil then
|
|
222
|
+
return {
|
|
223
|
+
root = {},
|
|
224
|
+
}
|
|
225
|
+
end
|
|
226
|
+
local root = {}
|
|
227
|
+
local pad
|
|
228
|
+
local radius
|
|
229
|
+
local gap
|
|
230
|
+
local _condition = sx.width
|
|
231
|
+
if _condition == nil then
|
|
232
|
+
_condition = sx.w
|
|
233
|
+
end
|
|
234
|
+
local widthVal = pick(_condition, width)
|
|
235
|
+
local _condition_1 = sx.height
|
|
236
|
+
if _condition_1 == nil then
|
|
237
|
+
_condition_1 = sx.h
|
|
238
|
+
end
|
|
239
|
+
local heightVal = pick(_condition_1, width)
|
|
240
|
+
local sizeVal = pick(sx.size, width)
|
|
241
|
+
local sizeX = sizeAxis(widthVal, "X")
|
|
242
|
+
local sizeY = sizeAxis(heightVal, "Y")
|
|
243
|
+
if sizeVal ~= nil then
|
|
244
|
+
if typeof(sizeVal) == "UDim2" then
|
|
245
|
+
sizeX = sizeX or sizeVal.X
|
|
246
|
+
sizeY = sizeY or sizeVal.Y
|
|
247
|
+
else
|
|
248
|
+
local record = sizeVal
|
|
249
|
+
sizeX = sizeX or sizeAxis(record.width, "X")
|
|
250
|
+
sizeY = sizeY or sizeAxis(record.height, "Y")
|
|
251
|
+
end
|
|
252
|
+
end
|
|
253
|
+
if sizeX ~= nil or sizeY ~= nil then
|
|
254
|
+
local _result = sizeX
|
|
255
|
+
if _result ~= nil then
|
|
256
|
+
_result = _result.Scale
|
|
257
|
+
end
|
|
258
|
+
local _condition_2 = _result
|
|
259
|
+
if _condition_2 == nil then
|
|
260
|
+
_condition_2 = 0
|
|
261
|
+
end
|
|
262
|
+
local _result_1 = sizeX
|
|
263
|
+
if _result_1 ~= nil then
|
|
264
|
+
_result_1 = _result_1.Offset
|
|
265
|
+
end
|
|
266
|
+
local _condition_3 = _result_1
|
|
267
|
+
if _condition_3 == nil then
|
|
268
|
+
_condition_3 = 0
|
|
269
|
+
end
|
|
270
|
+
local _result_2 = sizeY
|
|
271
|
+
if _result_2 ~= nil then
|
|
272
|
+
_result_2 = _result_2.Scale
|
|
273
|
+
end
|
|
274
|
+
local _condition_4 = _result_2
|
|
275
|
+
if _condition_4 == nil then
|
|
276
|
+
_condition_4 = 0
|
|
277
|
+
end
|
|
278
|
+
local _result_3 = sizeY
|
|
279
|
+
if _result_3 ~= nil then
|
|
280
|
+
_result_3 = _result_3.Offset
|
|
281
|
+
end
|
|
282
|
+
local _condition_5 = _result_3
|
|
283
|
+
if _condition_5 == nil then
|
|
284
|
+
_condition_5 = 0
|
|
285
|
+
end
|
|
286
|
+
root.Size = UDim2.new(_condition_2, _condition_3, _condition_4, _condition_5)
|
|
287
|
+
end
|
|
288
|
+
local position = pick(sx.position or sx.pos, width)
|
|
289
|
+
local x = pick(sx.x, width)
|
|
290
|
+
local y = pick(sx.y, width)
|
|
291
|
+
if position ~= nil then
|
|
292
|
+
root.Position = position
|
|
293
|
+
elseif x ~= nil or y ~= nil then
|
|
294
|
+
local xU = if x ~= nil then asUDim(x) else UDim.new(0, 0)
|
|
295
|
+
local yU = if y ~= nil then asUDim(y) else UDim.new(0, 0)
|
|
296
|
+
root.Position = UDim2.new(xU.Scale, xU.Offset, yU.Scale, yU.Offset)
|
|
297
|
+
end
|
|
298
|
+
local anchor = pick(sx.anchor, width)
|
|
299
|
+
if anchor ~= nil then
|
|
300
|
+
if type(anchor) == "number" then
|
|
301
|
+
root.AnchorPoint = Vector2.new(anchor, anchor)
|
|
302
|
+
elseif typeof(anchor) == "Vector2" then
|
|
303
|
+
root.AnchorPoint = anchor
|
|
304
|
+
else
|
|
305
|
+
local pair = anchor
|
|
306
|
+
root.AnchorPoint = Vector2.new(pair[1], pair[2])
|
|
307
|
+
end
|
|
308
|
+
end
|
|
309
|
+
local padding = pick(sx.padding, width)
|
|
310
|
+
if padding ~= nil then
|
|
311
|
+
pad = padSides(padding)
|
|
312
|
+
end
|
|
313
|
+
local p = pick(sx.p, width)
|
|
314
|
+
local px = pick(sx.px, width)
|
|
315
|
+
local py = pick(sx.py, width)
|
|
316
|
+
local pt = pick(sx.pt, width)
|
|
317
|
+
local pr = pick(sx.pr, width)
|
|
318
|
+
local pb = pick(sx.pb, width)
|
|
319
|
+
local pl = pick(sx.pl, width)
|
|
320
|
+
if p ~= nil or px ~= nil or py ~= nil or pt ~= nil or pr ~= nil or pb ~= nil or pl ~= nil then
|
|
321
|
+
local base = pad or {
|
|
322
|
+
top = 0,
|
|
323
|
+
right = 0,
|
|
324
|
+
bottom = 0,
|
|
325
|
+
left = 0,
|
|
326
|
+
}
|
|
327
|
+
local _condition_2 = p
|
|
328
|
+
if _condition_2 == nil then
|
|
329
|
+
_condition_2 = 0
|
|
330
|
+
end
|
|
331
|
+
local uniform = _condition_2
|
|
332
|
+
local _object = {}
|
|
333
|
+
local _left = "top"
|
|
334
|
+
local _condition_3 = pt
|
|
335
|
+
if _condition_3 == nil then
|
|
336
|
+
_condition_3 = py
|
|
337
|
+
if _condition_3 == nil then
|
|
338
|
+
_condition_3 = (if p ~= nil then uniform else base.top)
|
|
339
|
+
end
|
|
340
|
+
end
|
|
341
|
+
_object[_left] = _condition_3
|
|
342
|
+
local _left_1 = "right"
|
|
343
|
+
local _condition_4 = pr
|
|
344
|
+
if _condition_4 == nil then
|
|
345
|
+
_condition_4 = px
|
|
346
|
+
if _condition_4 == nil then
|
|
347
|
+
_condition_4 = (if p ~= nil then uniform else base.right)
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
_object[_left_1] = _condition_4
|
|
351
|
+
local _left_2 = "bottom"
|
|
352
|
+
local _condition_5 = pb
|
|
353
|
+
if _condition_5 == nil then
|
|
354
|
+
_condition_5 = py
|
|
355
|
+
if _condition_5 == nil then
|
|
356
|
+
_condition_5 = (if p ~= nil then uniform else base.bottom)
|
|
357
|
+
end
|
|
358
|
+
end
|
|
359
|
+
_object[_left_2] = _condition_5
|
|
360
|
+
local _left_3 = "left"
|
|
361
|
+
local _condition_6 = pl
|
|
362
|
+
if _condition_6 == nil then
|
|
363
|
+
_condition_6 = px
|
|
364
|
+
if _condition_6 == nil then
|
|
365
|
+
_condition_6 = (if p ~= nil then uniform else base.left)
|
|
366
|
+
end
|
|
367
|
+
end
|
|
368
|
+
_object[_left_3] = _condition_6
|
|
369
|
+
pad = _object
|
|
370
|
+
end
|
|
371
|
+
local gapVal = pick(sx.gap, width)
|
|
372
|
+
if gapVal ~= nil then
|
|
373
|
+
gap = theme.spacing.calc(gapVal)
|
|
374
|
+
end
|
|
375
|
+
local bg = pick(sx.bgcolor or sx.bg or sx.backgroundColor, width)
|
|
376
|
+
local bgColor = colorOf(theme, bg)
|
|
377
|
+
if bgColor ~= nil then
|
|
378
|
+
root.BackgroundColor3 = bgColor
|
|
379
|
+
if root.BackgroundTransparency == nil then
|
|
380
|
+
root.BackgroundTransparency = 0
|
|
381
|
+
end
|
|
382
|
+
end
|
|
383
|
+
local textColor = colorOf(theme, pick(sx.color, width))
|
|
384
|
+
if textColor ~= nil then
|
|
385
|
+
root.TextColor3 = textColor
|
|
386
|
+
end
|
|
387
|
+
local borderColor = colorOf(theme, pick(sx.borderColor, width))
|
|
388
|
+
if borderColor ~= nil then
|
|
389
|
+
root.BorderColor3 = borderColor
|
|
390
|
+
end
|
|
391
|
+
local opacity = pick(sx.opacity, width)
|
|
392
|
+
if opacity ~= nil then
|
|
393
|
+
root.BackgroundTransparency = 1 - opacity
|
|
394
|
+
end
|
|
395
|
+
local transparency = pick(sx.transparency, width)
|
|
396
|
+
if transparency ~= nil then
|
|
397
|
+
root.BackgroundTransparency = transparency
|
|
398
|
+
end
|
|
399
|
+
local _condition_2 = sx.border
|
|
400
|
+
if _condition_2 == nil then
|
|
401
|
+
_condition_2 = sx.borderWidth
|
|
402
|
+
end
|
|
403
|
+
local border = pick(_condition_2, width)
|
|
404
|
+
if border ~= nil then
|
|
405
|
+
root.BorderSizePixel = border
|
|
406
|
+
end
|
|
407
|
+
local radiusVal = pick(sx.radius, width)
|
|
408
|
+
if radiusVal ~= nil then
|
|
409
|
+
radius = radiusVal
|
|
410
|
+
end
|
|
411
|
+
local typography = pick(sx.typography, width)
|
|
412
|
+
if typography ~= nil then
|
|
413
|
+
local variant = theme.typography.variants[typography]
|
|
414
|
+
if variant ~= nil then
|
|
415
|
+
root.TextSize = variant.size
|
|
416
|
+
root.Font = theme.typography.fontFamilies[variant.family]
|
|
417
|
+
end
|
|
418
|
+
end
|
|
419
|
+
local fontSize = pick(sx.fontSize, width)
|
|
420
|
+
if fontSize ~= nil then
|
|
421
|
+
root.TextSize = fontSize
|
|
422
|
+
end
|
|
423
|
+
local font = pick(sx.font, width)
|
|
424
|
+
if font ~= nil then
|
|
425
|
+
if typeof(font) == "EnumItem" then
|
|
426
|
+
root.Font = font
|
|
427
|
+
else
|
|
428
|
+
root.Font = theme.typography.fontFamilies[font]
|
|
429
|
+
end
|
|
430
|
+
end
|
|
431
|
+
local visible = pick(sx.visible, width)
|
|
432
|
+
if visible ~= nil then
|
|
433
|
+
root.Visible = visible
|
|
434
|
+
end
|
|
435
|
+
local _condition_3 = sx.zIndex
|
|
436
|
+
if _condition_3 == nil then
|
|
437
|
+
_condition_3 = sx.z
|
|
438
|
+
end
|
|
439
|
+
local zIndex = pick(_condition_3, width)
|
|
440
|
+
if zIndex ~= nil then
|
|
441
|
+
root.ZIndex = zIndex
|
|
442
|
+
end
|
|
443
|
+
for key, raw in pairs(sx) do
|
|
444
|
+
local name = key
|
|
445
|
+
if SHORTHAND[name] == true then
|
|
446
|
+
continue
|
|
447
|
+
end
|
|
448
|
+
if SELECTORS[name] == true then
|
|
449
|
+
local nested = resolveSx(theme, raw, width)
|
|
450
|
+
root[name] = nested.root
|
|
451
|
+
continue
|
|
452
|
+
end
|
|
453
|
+
root[name] = pick(raw, width)
|
|
454
|
+
end
|
|
455
|
+
local resolved = {
|
|
456
|
+
root = root,
|
|
457
|
+
}
|
|
458
|
+
if pad ~= nil then
|
|
459
|
+
resolved.padding = {
|
|
460
|
+
PaddingTop = UDim.new(0, theme.spacing.calc(pad.top)),
|
|
461
|
+
PaddingRight = UDim.new(0, theme.spacing.calc(pad.right)),
|
|
462
|
+
PaddingBottom = UDim.new(0, theme.spacing.calc(pad.bottom)),
|
|
463
|
+
PaddingLeft = UDim.new(0, theme.spacing.calc(pad.left)),
|
|
464
|
+
}
|
|
465
|
+
end
|
|
466
|
+
if radius ~= nil then
|
|
467
|
+
resolved.corner = {
|
|
468
|
+
CornerRadius = UDim.new(0, radius),
|
|
469
|
+
}
|
|
470
|
+
end
|
|
471
|
+
if gap ~= nil then
|
|
472
|
+
resolved.gap = gap
|
|
473
|
+
end
|
|
474
|
+
return resolved
|
|
475
|
+
end
|
|
476
|
+
return {
|
|
477
|
+
resolvePaletteToken = resolvePaletteToken,
|
|
478
|
+
resolveSx = resolveSx,
|
|
479
|
+
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export declare function styleDepsKey(props: object | undefined): string;
|
|
2
2
|
export declare function createStyleCache<T extends defined>(): (theme: object, key: string, create: () => T) => T;
|
|
3
|
+
/** Drop all makeStyles memo buckets (theme hot-reload / tests). */
|
|
4
|
+
export declare function clearStyleCaches(): void;
|
|
@@ -9,6 +9,7 @@ local KEYED = {
|
|
|
9
9
|
CFrame = true,
|
|
10
10
|
BrickColor = true,
|
|
11
11
|
}
|
|
12
|
+
local caches = {}
|
|
12
13
|
local function styleDepsKey(props)
|
|
13
14
|
if props == nil then
|
|
14
15
|
return ""
|
|
@@ -40,6 +41,7 @@ local function styleDepsKey(props)
|
|
|
40
41
|
end
|
|
41
42
|
local function createStyleCache()
|
|
42
43
|
local byTheme = {}
|
|
44
|
+
table.insert(caches, byTheme)
|
|
43
45
|
return function(theme, key, create)
|
|
44
46
|
local _theme = theme
|
|
45
47
|
local bucket = byTheme[_theme]
|
|
@@ -62,7 +64,14 @@ local function createStyleCache()
|
|
|
62
64
|
return value
|
|
63
65
|
end
|
|
64
66
|
end
|
|
67
|
+
--* Drop all makeStyles memo buckets (theme hot-reload / tests).
|
|
68
|
+
local function clearStyleCaches()
|
|
69
|
+
for _, cache in caches do
|
|
70
|
+
table.clear(cache)
|
|
71
|
+
end
|
|
72
|
+
end
|
|
65
73
|
return {
|
|
66
74
|
styleDepsKey = styleDepsKey,
|
|
67
75
|
createStyleCache = createStyleCache,
|
|
76
|
+
clearStyleCaches = clearStyleCaches,
|
|
68
77
|
}
|
|
@@ -4,6 +4,7 @@ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
|
4
4
|
local React = _react
|
|
5
5
|
local useState = _react.useState
|
|
6
6
|
local Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
|
|
7
|
+
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
7
8
|
local _accordionOpen = TS.import(script, script.Parent, "accordionOpen")
|
|
8
9
|
local accordionGlyph = _accordionOpen.accordionGlyph
|
|
9
10
|
local accordionOpen = _accordionOpen.accordionOpen
|
|
@@ -40,26 +41,21 @@ local function Accordion(props)
|
|
|
40
41
|
_result(nextOpen)
|
|
41
42
|
end
|
|
42
43
|
end
|
|
43
|
-
local _attributes = {
|
|
44
|
+
local _attributes = {
|
|
45
|
+
tag = "frame",
|
|
46
|
+
}
|
|
44
47
|
local _condition = id
|
|
45
48
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
46
49
|
_condition = "Accordion"
|
|
47
50
|
end
|
|
48
51
|
_attributes.key = _condition
|
|
49
|
-
_attributes.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
if sx then
|
|
59
|
-
for _k, _v in sx do
|
|
60
|
-
_attributes[_k] = _v
|
|
61
|
-
end
|
|
62
|
-
end
|
|
52
|
+
_attributes.hostRef = ref
|
|
53
|
+
_attributes.base = styles.root
|
|
54
|
+
_attributes.className = className
|
|
55
|
+
_attributes.sx = sx
|
|
56
|
+
_attributes.state = {
|
|
57
|
+
disabled = disabled,
|
|
58
|
+
}
|
|
63
59
|
local _condition_1 = square ~= true
|
|
64
60
|
if _condition_1 then
|
|
65
61
|
local _attributes_1 = table.clone(styles.corner)
|
|
@@ -105,7 +101,7 @@ local function Accordion(props)
|
|
|
105
101
|
end
|
|
106
102
|
local _attributes_7 = table.clone(styles.padding)
|
|
107
103
|
setmetatable(_attributes_7, nil)
|
|
108
|
-
return React.createElement(
|
|
104
|
+
return React.createElement(SxHost, _attributes, _condition_1, _exp, _exp_3, React.createElement("frame", _attributes_6, React.createElement("uipadding", _attributes_7), children))
|
|
109
105
|
end
|
|
110
106
|
local default = Accordion
|
|
111
107
|
return {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
4
|
local Icons = TS.import(script, script.Parent.Parent.Parent.Parent, "enums").Icons
|
|
5
|
+
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
5
6
|
local useAlertStyles = TS.import(script, script.Parent, "Alert.styles").default
|
|
6
7
|
local function Alert(props)
|
|
7
8
|
local _binding = props
|
|
@@ -21,26 +22,18 @@ local function Alert(props)
|
|
|
21
22
|
dismissible = dismissible,
|
|
22
23
|
filled = filled,
|
|
23
24
|
})
|
|
24
|
-
local _attributes = {
|
|
25
|
+
local _attributes = {
|
|
26
|
+
tag = "frame",
|
|
27
|
+
}
|
|
25
28
|
local _condition = id
|
|
26
29
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
27
30
|
_condition = "Alert"
|
|
28
31
|
end
|
|
29
32
|
_attributes.key = _condition
|
|
30
|
-
_attributes.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
if className then
|
|
35
|
-
for _k, _v in className do
|
|
36
|
-
_attributes[_k] = _v
|
|
37
|
-
end
|
|
38
|
-
end
|
|
39
|
-
if sx then
|
|
40
|
-
for _k, _v in sx do
|
|
41
|
-
_attributes[_k] = _v
|
|
42
|
-
end
|
|
43
|
-
end
|
|
33
|
+
_attributes.hostRef = ref
|
|
34
|
+
_attributes.base = styles.root
|
|
35
|
+
_attributes.className = className
|
|
36
|
+
_attributes.sx = sx
|
|
44
37
|
local _attributes_1 = table.clone(styles.padding)
|
|
45
38
|
setmetatable(_attributes_1, nil)
|
|
46
39
|
local _exp = React.createElement("uipadding", _attributes_1)
|
|
@@ -96,7 +89,7 @@ local function Alert(props)
|
|
|
96
89
|
_attributes_5[_k] = _v
|
|
97
90
|
end
|
|
98
91
|
_attributes_5.Text = message
|
|
99
|
-
return React.createElement(
|
|
92
|
+
return React.createElement(SxHost, _attributes, _exp, _condition_1, _exp_1, _condition_2, React.createElement("frame", _attributes_3, _exp_2, _condition_3, React.createElement("textlabel", _attributes_5)))
|
|
100
93
|
end
|
|
101
94
|
local default = Alert
|
|
102
95
|
return {
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
4
|
local Shadow = TS.import(script, script.Parent.Parent.Parent, "shadow").Shadow
|
|
5
|
+
local SxHost = TS.import(script, script.Parent.Parent.Parent, "host").SxHost
|
|
5
6
|
local useAppBarStyles = TS.import(script, script.Parent, "AppBar.styles").default
|
|
6
7
|
local function AppBar(props)
|
|
7
8
|
local _binding = props
|
|
@@ -27,26 +28,18 @@ local function AppBar(props)
|
|
|
27
28
|
color = color,
|
|
28
29
|
hasActions = children ~= nil,
|
|
29
30
|
})
|
|
30
|
-
local _attributes = {
|
|
31
|
+
local _attributes = {
|
|
32
|
+
tag = "frame",
|
|
33
|
+
}
|
|
31
34
|
local _condition = id
|
|
32
35
|
if not (_condition ~= 0 and _condition == _condition and _condition ~= "" and _condition) then
|
|
33
36
|
_condition = "AppBar"
|
|
34
37
|
end
|
|
35
38
|
_attributes.key = _condition
|
|
36
|
-
_attributes.
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if className then
|
|
41
|
-
for _k, _v in className do
|
|
42
|
-
_attributes[_k] = _v
|
|
43
|
-
end
|
|
44
|
-
end
|
|
45
|
-
if sx then
|
|
46
|
-
for _k, _v in sx do
|
|
47
|
-
_attributes[_k] = _v
|
|
48
|
-
end
|
|
49
|
-
end
|
|
39
|
+
_attributes.hostRef = ref
|
|
40
|
+
_attributes.base = styles.root
|
|
41
|
+
_attributes.className = className
|
|
42
|
+
_attributes.sx = sx
|
|
50
43
|
local _attributes_1 = table.clone(styles.padding)
|
|
51
44
|
setmetatable(_attributes_1, nil)
|
|
52
45
|
local _exp = React.createElement("uipadding", _attributes_1)
|
|
@@ -74,7 +67,7 @@ local function AppBar(props)
|
|
|
74
67
|
setmetatable(_attributes_3, nil)
|
|
75
68
|
_condition_2 = (React.createElement("frame", _attributes_2, React.createElement("uilistlayout", _attributes_3), children))
|
|
76
69
|
end
|
|
77
|
-
return React.createElement(
|
|
70
|
+
return React.createElement(SxHost, _attributes, _exp, _exp_1, _condition_1, _condition_2)
|
|
78
71
|
end
|
|
79
72
|
local default = AppBar
|
|
80
73
|
return {
|