@nrbx/topbar-components 1.1.0 → 1.1.2
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/components/icon.luau
CHANGED
|
@@ -34,7 +34,7 @@ local Notification = TS.import(script, script.Parent, "notification").Notificati
|
|
|
34
34
|
* both states, or `{ deselected: T; selected: T }` to animate between them.
|
|
35
35
|
|
|
36
36
|
]]
|
|
37
|
-
local ANIMATEABLE = { "
|
|
37
|
+
local ANIMATEABLE = { "backgroundTransparency", "imageTransparency" }
|
|
38
38
|
--* Icon select/deselect state.
|
|
39
39
|
--[[
|
|
40
40
|
*
|
|
@@ -170,7 +170,7 @@ local function Icon(componentProps)
|
|
|
170
170
|
params.Font = stateful(props.fontFace, currentState)
|
|
171
171
|
params.Size = stateful(props.textSize, currentState)
|
|
172
172
|
params.Width = sizing.textMeasurementWidth
|
|
173
|
-
setTextBounds(TextService:GetTextBoundsAsync(params))
|
|
173
|
+
setTextBounds(TS.await(TextService:GetTextBoundsAsync(params)))
|
|
174
174
|
previousQueryRef.current = currentQuery
|
|
175
175
|
end), { currentText, props.fontFace, props.textSize, currentState })
|
|
176
176
|
local imageSizeOff = stateful(props.imageSizeOffset, currentState)
|
|
@@ -10,29 +10,28 @@ local springs = TS.import(script, script.Parent.Parent, "utilities", "springs").
|
|
|
10
10
|
local function useAnimateableProps(state, props, ...)
|
|
11
11
|
local keys = { ... }
|
|
12
12
|
local previousProps = usePrevious(props)
|
|
13
|
-
local
|
|
13
|
+
local motionBindings = {}
|
|
14
|
+
local motionControls = {}
|
|
14
15
|
for _, key in keys do
|
|
15
|
-
local
|
|
16
|
-
table.insert(
|
|
16
|
+
local binding, motion = useMotion(stateful(props[key], state))
|
|
17
|
+
table.insert(motionBindings, binding)
|
|
18
|
+
table.insert(motionControls, motion)
|
|
17
19
|
end
|
|
18
20
|
useEffect(function()
|
|
19
|
-
for
|
|
21
|
+
for i = 0, #keys - 1 do
|
|
22
|
+
local key = keys[i + 1]
|
|
20
23
|
local value = stateful(props[key], state)
|
|
21
24
|
local previousValue = stateful(previousProps, state)
|
|
22
25
|
if value == previousValue then
|
|
23
26
|
continue
|
|
24
27
|
end
|
|
25
|
-
|
|
28
|
+
motionControls[i + 1].spring(value, springs.responsive)
|
|
26
29
|
end
|
|
27
30
|
end, { props })
|
|
28
31
|
-- ▼ ReadonlyArray.map ▼
|
|
29
32
|
local _newValue = table.create(#keys)
|
|
30
|
-
local _callback = function(key)
|
|
31
|
-
|
|
32
|
-
local _exp_1 = motions
|
|
33
|
-
local _keys = keys
|
|
34
|
-
local _key = key
|
|
35
|
-
return { _exp, _exp_1[table.find(_keys, _key) or 0][1] }
|
|
33
|
+
local _callback = function(key, i)
|
|
34
|
+
return { key, motionBindings[i + 1] }
|
|
36
35
|
end
|
|
37
36
|
for _k, _v in keys do
|
|
38
37
|
_newValue[_k] = _callback(_v, _k - 1, keys)
|