@rbxts/app-forge 0.0.9 → 0.1.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.
- package/out/container.luau +6 -20
- package/out/init.luau +3 -0
- package/package.json +1 -1
package/out/container.luau
CHANGED
|
@@ -3,14 +3,10 @@ local TS = _G[script]
|
|
|
3
3
|
-- Services
|
|
4
4
|
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
5
5
|
-- Packages
|
|
6
|
-
local _loners_pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-react-hooks").out)
|
|
7
|
-
local useBindingListener = _loners_pretty_react_hooks.useBindingListener
|
|
8
|
-
local useSpring = _loners_pretty_react_hooks.useSpring
|
|
9
6
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
10
7
|
local React = _react
|
|
11
8
|
local cloneElement = _react.cloneElement
|
|
12
9
|
local useBinding = _react.useBinding
|
|
13
|
-
local useState = _react.useState
|
|
14
10
|
-- Types
|
|
15
11
|
-- Components
|
|
16
12
|
local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
|
|
@@ -30,24 +26,24 @@ local function createBinding(name, manager)
|
|
|
30
26
|
_binds[_name_1] = binding
|
|
31
27
|
return unpack(binding)
|
|
32
28
|
end
|
|
33
|
-
local function createInstance(props, name,
|
|
29
|
+
local function createInstance(props, name, forge)
|
|
34
30
|
local _name = name
|
|
35
31
|
local appClass = AppRegistry[_name]
|
|
36
32
|
if not appClass then
|
|
37
33
|
error(`App "{name}" not registered`)
|
|
38
34
|
end
|
|
39
|
-
local _loaded =
|
|
35
|
+
local _loaded = forge.loaded
|
|
40
36
|
local _name_1 = name
|
|
41
37
|
if not (_loaded[_name_1] ~= nil) then
|
|
42
|
-
local instance = appClass.constructor.new(props,
|
|
38
|
+
local instance = appClass.constructor.new(props, forge, name)
|
|
43
39
|
local element = cloneElement(instance:render(), {
|
|
44
40
|
key = "Main",
|
|
45
41
|
})
|
|
46
|
-
local _loaded_1 =
|
|
42
|
+
local _loaded_1 = forge.loaded
|
|
47
43
|
local _name_2 = name
|
|
48
44
|
_loaded_1[_name_2] = element
|
|
49
45
|
end
|
|
50
|
-
local _loaded_1 =
|
|
46
|
+
local _loaded_1 = forge.loaded
|
|
51
47
|
local _name_2 = name
|
|
52
48
|
return _loaded_1[_name_2]
|
|
53
49
|
end
|
|
@@ -55,21 +51,11 @@ local function AppContainer(props)
|
|
|
55
51
|
local _binding = props
|
|
56
52
|
local name = _binding.name
|
|
57
53
|
local manager = _binding.manager
|
|
58
|
-
|
|
59
|
-
local spring = useSpring(binding:map(function(v)
|
|
60
|
-
return if v then 0 else 1
|
|
61
|
-
end), {
|
|
62
|
-
frequency = 0.4,
|
|
63
|
-
damping = 0.8,
|
|
64
|
-
})
|
|
65
|
-
local _isVisible, setisVisible = useState(binding:getValue())
|
|
54
|
+
createBinding(name, manager)
|
|
66
55
|
local element = createInstance(props, name, manager)
|
|
67
56
|
if not element then
|
|
68
57
|
error(`Failed to create instance for app "{name}"`)
|
|
69
58
|
end
|
|
70
|
-
useBindingListener(spring, function(v)
|
|
71
|
-
setisVisible(v == 0)
|
|
72
|
-
end)
|
|
73
59
|
if RunService:IsRunning() then
|
|
74
60
|
return React.createElement("screengui", {
|
|
75
61
|
key = name,
|
package/out/init.luau
CHANGED