@nrbx/topbar-components 1.1.0 → 1.1.1
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.
|
@@ -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)
|