@rbxts/app-forge 0.6.0 → 0.7.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/README.md +334 -149
- package/out/global.d.ts +2 -3
- package/out/index.d.ts +11 -19
- package/out/init.luau +16 -115
- package/out/react/container.d.ts +10 -0
- package/out/{container.luau → react/container.luau} +13 -34
- package/out/react/context.d.ts +7 -0
- package/out/react/context.luau +12 -0
- package/out/{decorator.d.ts → react/decorator.d.ts} +5 -4
- package/out/{decorator.luau → react/decorator.luau} +6 -3
- package/out/react/helpers.d.ts +6 -0
- package/out/react/helpers.luau +74 -0
- package/out/react/hooks/useAppContext.d.ts +5 -0
- package/out/react/hooks/useAppContext.luau +16 -0
- package/out/react/index.d.ts +44 -0
- package/out/react/init.luau +123 -0
- package/out/react/rules/index.d.ts +6 -0
- package/out/react/rules/init.luau +27 -0
- package/out/react/rules/parent.d.ts +2 -0
- package/out/react/rules/parent.luau +42 -0
- package/out/react/types.d.ts +44 -0
- package/out/vide/classes/renders.d.ts +21 -0
- package/out/vide/classes/renders.luau +251 -0
- package/out/vide/classes/rules/exclusiveGroup.d.ts +2 -0
- package/out/vide/classes/rules/exclusiveGroup.luau +47 -0
- package/out/vide/classes/rules/index.d.ts +7 -0
- package/out/vide/classes/rules/init.luau +70 -0
- package/out/vide/classes/rules/parent.d.ts +2 -0
- package/out/vide/classes/rules/parent.luau +29 -0
- package/out/vide/context.d.ts +7 -0
- package/out/vide/context.luau +12 -0
- package/out/vide/decorator.d.ts +13 -0
- package/out/vide/decorator.luau +44 -0
- package/out/vide/hooks/useAppContext.d.ts +5 -0
- package/out/vide/hooks/useAppContext.luau +14 -0
- package/out/vide/index.d.ts +30 -0
- package/out/vide/init.luau +223 -0
- package/out/vide/types.d.ts +85 -0
- package/package.json +15 -16
- package/out/container.d.ts +0 -4
- package/out/helpers.d.ts +0 -2
- package/out/helpers.luau +0 -40
- package/out/rules.d.ts +0 -12
- package/out/rules.luau +0 -198
- package/out/types.d.ts +0 -59
package/out/init.luau
CHANGED
|
@@ -1,120 +1,21 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local exports = {}
|
|
4
|
-
--
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
-- Decorators
|
|
5
|
+
local _decorator = TS.import(script, script, "react", "decorator")
|
|
6
|
+
exports.ReactApp = _decorator.App
|
|
7
|
+
exports.ReactArgs = _decorator.Args
|
|
8
|
+
local _decorator_1 = TS.import(script, script, "vide", "decorator")
|
|
9
|
+
exports.VideApp = _decorator_1.App
|
|
10
|
+
exports.VideArgs = _decorator_1.Args
|
|
11
|
+
-- Creators
|
|
12
|
+
exports.CreateReactForge = TS.import(script, script, "react").default
|
|
13
|
+
exports.CreateVideForge = TS.import(script, script, "vide").default
|
|
14
|
+
-- Helpers
|
|
15
|
+
exports.RenderReact = TS.import(script, script, "react", "helpers").Render
|
|
7
16
|
-- Types
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
local App = _decorator.App
|
|
13
|
-
local AppContainer = TS.import(script, script, "container").default
|
|
14
|
-
-- Classes
|
|
15
|
-
local RulesManager = TS.import(script, script, "rules").default
|
|
16
|
-
local AppForge
|
|
17
|
-
do
|
|
18
|
-
AppForge = setmetatable({}, {
|
|
19
|
-
__tostring = function()
|
|
20
|
-
return "AppForge"
|
|
21
|
-
end,
|
|
22
|
-
})
|
|
23
|
-
AppForge.__index = AppForge
|
|
24
|
-
function AppForge.new(...)
|
|
25
|
-
local self = setmetatable({}, AppForge)
|
|
26
|
-
return self:constructor(...) or self
|
|
27
|
-
end
|
|
28
|
-
function AppForge:constructor()
|
|
29
|
-
self.sources = {}
|
|
30
|
-
self.loaded = {}
|
|
31
|
-
self.rulesManager = RulesManager.new(self)
|
|
32
|
-
end
|
|
33
|
-
function AppForge:getSource(name)
|
|
34
|
-
local _sources = self.sources
|
|
35
|
-
local _name = name
|
|
36
|
-
if not (_sources[_name] ~= nil) then
|
|
37
|
-
error(`App "{name}" has no source`)
|
|
38
|
-
end
|
|
39
|
-
local _sources_1 = self.sources
|
|
40
|
-
local _name_1 = name
|
|
41
|
-
return _sources_1[_name_1]
|
|
42
|
-
end
|
|
43
|
-
function AppForge:set(name, value)
|
|
44
|
-
if not self.rulesManager:applyRules(name, value) then
|
|
45
|
-
return nil
|
|
46
|
-
end
|
|
47
|
-
local _value = value
|
|
48
|
-
if type(_value) == "function" then
|
|
49
|
-
local _sources = self.sources
|
|
50
|
-
local _name = name
|
|
51
|
-
local _value_1 = value
|
|
52
|
-
_sources[_name] = _value_1
|
|
53
|
-
else
|
|
54
|
-
local _sources = self.sources
|
|
55
|
-
local _name = name
|
|
56
|
-
local source = _sources[_name]
|
|
57
|
-
if not source then
|
|
58
|
-
error(`App "{name}" has no source`)
|
|
59
|
-
end
|
|
60
|
-
source(value)
|
|
61
|
-
end
|
|
62
|
-
end
|
|
63
|
-
function AppForge:open(name)
|
|
64
|
-
self:set(name, true)
|
|
65
|
-
end
|
|
66
|
-
function AppForge:close(name)
|
|
67
|
-
self:set(name, false)
|
|
68
|
-
end
|
|
69
|
-
function AppForge:toggle(name)
|
|
70
|
-
self:set(name, not self:getSource(name)())
|
|
71
|
-
end
|
|
72
|
-
function AppForge:renderApp(props)
|
|
73
|
-
local _attributes = table.clone(props)
|
|
74
|
-
setmetatable(_attributes, nil)
|
|
75
|
-
return Vide.jsx(AppContainer, _attributes)
|
|
76
|
-
end
|
|
77
|
-
function AppForge:renderApps(props)
|
|
78
|
-
local names = props.names
|
|
79
|
-
if names then
|
|
80
|
-
-- ▼ ReadonlyArray.map ▼
|
|
81
|
-
local _newValue = table.create(#names)
|
|
82
|
-
local _callback = function(name)
|
|
83
|
-
local _self = self
|
|
84
|
-
local _object = table.clone(props)
|
|
85
|
-
setmetatable(_object, nil)
|
|
86
|
-
_object.name = name
|
|
87
|
-
_object.names = nil
|
|
88
|
-
return _self:renderApp(_object)
|
|
89
|
-
end
|
|
90
|
-
for _k, _v in names do
|
|
91
|
-
_newValue[_k] = _callback(_v, _k - 1, names)
|
|
92
|
-
end
|
|
93
|
-
-- ▲ ReadonlyArray.map ▲
|
|
94
|
-
return _newValue
|
|
95
|
-
end
|
|
96
|
-
error("No app names provided to renderApps")
|
|
97
|
-
end
|
|
98
|
-
function AppForge:renderAll(props)
|
|
99
|
-
local names = {}
|
|
100
|
-
-- ▼ ReadonlyMap.forEach ▼
|
|
101
|
-
local _callback = function(_, name)
|
|
102
|
-
local _name = name
|
|
103
|
-
table.insert(names, _name)
|
|
104
|
-
end
|
|
105
|
-
for _k, _v in AppRegistry do
|
|
106
|
-
_callback(_v, _k, AppRegistry)
|
|
107
|
-
end
|
|
108
|
-
-- ▲ ReadonlyMap.forEach ▲
|
|
109
|
-
local _self = self
|
|
110
|
-
local _object = table.clone(props)
|
|
111
|
-
setmetatable(_object, nil)
|
|
112
|
-
_object.names = names
|
|
113
|
-
return _self:renderApps(_object)
|
|
114
|
-
end
|
|
115
|
-
end
|
|
116
|
-
exports.Render = TS.import(script, script, "helpers").Render
|
|
117
|
-
exports.default = AppForge
|
|
118
|
-
exports.App = App
|
|
119
|
-
exports.Args = Args
|
|
17
|
+
exports.useReactAppContext = TS.import(script, script, "react", "hooks", "useAppContext").default
|
|
18
|
+
exports.ReactContexts = TS.import(script, script, "react", "context").default
|
|
19
|
+
exports.useVideAppContext = TS.import(script, script, "vide", "hooks", "useAppContext").default
|
|
20
|
+
exports.VideContexts = TS.import(script, script, "vide", "context").default
|
|
120
21
|
return exports
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type Types from "./types";
|
|
2
|
+
export declare function AppContainer(props: Types.NameProps & Types.MainProps): import("@rbxts/react").ReactElement<{
|
|
3
|
+
key: string;
|
|
4
|
+
ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
|
|
5
|
+
ResetOnSpawn: boolean;
|
|
6
|
+
}, string | import("@rbxts/react").JSXElementConstructor<any>> | import("@rbxts/react").ReactElement<{
|
|
7
|
+
key: string;
|
|
8
|
+
BackgroundTransparency: number;
|
|
9
|
+
Size: UDim2;
|
|
10
|
+
}, string | import("@rbxts/react").JSXElementConstructor<any>>;
|
|
@@ -1,36 +1,12 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
4
3
|
-- Services
|
|
5
4
|
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
6
5
|
-- Packages
|
|
7
|
-
local
|
|
8
|
-
local Vide = _vide
|
|
9
|
-
local source = _vide.source
|
|
6
|
+
local createElement = TS.import(script, TS.getModule(script, "@rbxts", "react")).createElement
|
|
10
7
|
-- Types
|
|
11
8
|
-- Components
|
|
12
9
|
local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
|
|
13
|
-
local function createSource(name, forge)
|
|
14
|
-
local _name = name
|
|
15
|
-
local app = AppRegistry[_name]
|
|
16
|
-
if not app then
|
|
17
|
-
error(`App "{name}" not registered`)
|
|
18
|
-
end
|
|
19
|
-
local _sources = forge.sources
|
|
20
|
-
local _name_1 = name
|
|
21
|
-
if _sources[_name_1] ~= nil then
|
|
22
|
-
return nil
|
|
23
|
-
end
|
|
24
|
-
local _sources_1 = forge.sources
|
|
25
|
-
local _exp = name
|
|
26
|
-
local _condition = app.visible
|
|
27
|
-
if _condition == nil then
|
|
28
|
-
_condition = false
|
|
29
|
-
end
|
|
30
|
-
local _arg1 = source(_condition)
|
|
31
|
-
_sources_1[_exp] = _arg1
|
|
32
|
-
return source
|
|
33
|
-
end
|
|
34
10
|
local function createInstance(props)
|
|
35
11
|
local _binding = props
|
|
36
12
|
local name = _binding.name
|
|
@@ -44,8 +20,13 @@ local function createInstance(props)
|
|
|
44
20
|
end
|
|
45
21
|
if not (forge.loaded[name] ~= nil) then
|
|
46
22
|
local instance = appClass.constructor.new(props)
|
|
23
|
+
local Render = function()
|
|
24
|
+
return instance:render()
|
|
25
|
+
end
|
|
47
26
|
local _loaded = forge.loaded
|
|
48
|
-
local _arg1 =
|
|
27
|
+
local _arg1 = createElement(Render, {
|
|
28
|
+
key = "Main",
|
|
29
|
+
})
|
|
49
30
|
_loaded[name] = _arg1
|
|
50
31
|
end
|
|
51
32
|
return forge.loaded[name]
|
|
@@ -53,29 +34,27 @@ end
|
|
|
53
34
|
local function AppContainer(props)
|
|
54
35
|
local _binding = props
|
|
55
36
|
local name = _binding.name
|
|
56
|
-
local forge = _binding.forge
|
|
57
37
|
if not (name ~= "" and name) then
|
|
58
38
|
error("App name is required in AppContainer")
|
|
59
39
|
end
|
|
60
|
-
createSource(name, forge)
|
|
61
40
|
local element = createInstance(props)
|
|
62
41
|
if not element then
|
|
63
42
|
error(`Failed to create instance for app "{name}"`)
|
|
64
43
|
end
|
|
65
44
|
if RunService:IsRunning() then
|
|
66
|
-
return
|
|
67
|
-
|
|
68
|
-
ZIndexBehavior =
|
|
45
|
+
return createElement("ScreenGui", {
|
|
46
|
+
key = name,
|
|
47
|
+
ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
|
|
69
48
|
ResetOnSpawn = false,
|
|
70
49
|
}, element)
|
|
71
50
|
else
|
|
72
|
-
return
|
|
73
|
-
|
|
51
|
+
return createElement("Frame", {
|
|
52
|
+
key = name,
|
|
74
53
|
BackgroundTransparency = 1,
|
|
75
54
|
Size = UDim2.fromScale(1, 1),
|
|
76
55
|
}, element)
|
|
77
56
|
end
|
|
78
57
|
end
|
|
79
58
|
return {
|
|
80
|
-
|
|
59
|
+
AppContainer = AppContainer,
|
|
81
60
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
local createContext = TS.import(script, TS.getModule(script, "@rbxts", "react")).createContext
|
|
5
|
+
-- Types
|
|
6
|
+
local Contexts = {
|
|
7
|
+
App = createContext(nil),
|
|
8
|
+
}
|
|
9
|
+
local default = Contexts
|
|
10
|
+
return {
|
|
11
|
+
default = default,
|
|
12
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
2
|
import type Types from "./types";
|
|
3
3
|
import type AppForge from ".";
|
|
4
4
|
export declare const AppRegistry: Map<string, Types.AppRegistry>;
|
|
@@ -6,8 +6,9 @@ export declare function App(props: Types.AppRegistryProps): <T extends new (prop
|
|
|
6
6
|
export declare abstract class Args {
|
|
7
7
|
readonly forge: AppForge;
|
|
8
8
|
readonly props: Types.ClassProps;
|
|
9
|
-
readonly name: AppNames
|
|
10
|
-
readonly
|
|
9
|
+
readonly name: AppNames;
|
|
10
|
+
readonly bind: React.Binding<boolean>;
|
|
11
|
+
readonly state: Boolean;
|
|
11
12
|
constructor(props: Types.NameProps & Types.MainProps);
|
|
12
|
-
abstract render():
|
|
13
|
+
abstract render(): React.ReactNode;
|
|
13
14
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
-- Services
|
|
4
4
|
-- Packages
|
|
5
|
-
local
|
|
5
|
+
local usePx = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-react-hooks").out).usePx
|
|
6
6
|
-- Types
|
|
7
7
|
local AppRegistry = {}
|
|
8
8
|
local function App(props)
|
|
@@ -26,19 +26,22 @@ do
|
|
|
26
26
|
Args = {}
|
|
27
27
|
function Args:constructor(props)
|
|
28
28
|
local _binding = props
|
|
29
|
+
local target = _binding.target
|
|
29
30
|
local forge = _binding.forge
|
|
30
31
|
local name = _binding.name
|
|
31
32
|
if not (name ~= "" and name) then
|
|
32
33
|
error("App name is required in Args constructor")
|
|
33
34
|
end
|
|
34
|
-
local px =
|
|
35
|
+
local px = usePx(target)
|
|
35
36
|
self.forge = forge
|
|
36
37
|
local _object = table.clone(props.props)
|
|
37
38
|
setmetatable(_object, nil)
|
|
38
39
|
_object.px = px
|
|
40
|
+
_object.forge = forge
|
|
39
41
|
self.props = _object
|
|
40
42
|
self.name = name
|
|
41
|
-
self.
|
|
43
|
+
self.bind = forge:getBind(name)
|
|
44
|
+
self.state = forge:getState(name)
|
|
42
45
|
end
|
|
43
46
|
end
|
|
44
47
|
return {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
import type AppForge from ".";
|
|
4
|
+
export declare function createBinding(name: AppNames, forge: AppForge): void;
|
|
5
|
+
export declare function createState(name: AppNames, forge: AppForge): void;
|
|
6
|
+
export declare function Render(props: Types.NameProps & Types.MainProps): React.ReactNode;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
5
|
+
local useBinding = _react.useBinding
|
|
6
|
+
local useState = _react.useState
|
|
7
|
+
-- Types
|
|
8
|
+
-- Components
|
|
9
|
+
local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
|
|
10
|
+
local function createBinding(name, forge)
|
|
11
|
+
local _name = name
|
|
12
|
+
local app = AppRegistry[_name]
|
|
13
|
+
if not app then
|
|
14
|
+
error(`App "{name}" not registered`)
|
|
15
|
+
end
|
|
16
|
+
local _binds = forge.binds
|
|
17
|
+
local _name_1 = name
|
|
18
|
+
if _binds[_name_1] ~= nil then
|
|
19
|
+
return nil
|
|
20
|
+
end
|
|
21
|
+
local _condition = app.visible
|
|
22
|
+
if _condition == nil then
|
|
23
|
+
_condition = false
|
|
24
|
+
end
|
|
25
|
+
local binding = { useBinding(_condition) }
|
|
26
|
+
local _binds_1 = forge.binds
|
|
27
|
+
local _name_2 = name
|
|
28
|
+
_binds_1[_name_2] = binding
|
|
29
|
+
end
|
|
30
|
+
local function createState(name, forge)
|
|
31
|
+
local _name = name
|
|
32
|
+
local app = AppRegistry[_name]
|
|
33
|
+
if not app then
|
|
34
|
+
error(`App "{name}" not registered`)
|
|
35
|
+
end
|
|
36
|
+
local _states = forge.states
|
|
37
|
+
local _name_1 = name
|
|
38
|
+
if _states[_name_1] ~= nil then
|
|
39
|
+
return nil
|
|
40
|
+
end
|
|
41
|
+
local _condition = app.visible
|
|
42
|
+
if _condition == nil then
|
|
43
|
+
_condition = false
|
|
44
|
+
end
|
|
45
|
+
local state = { useState(_condition) }
|
|
46
|
+
local _states_1 = forge.states
|
|
47
|
+
local _name_2 = name
|
|
48
|
+
_states_1[_name_2] = state
|
|
49
|
+
end
|
|
50
|
+
local function Render(props)
|
|
51
|
+
local names = props.names
|
|
52
|
+
local name = props.name
|
|
53
|
+
local forge = props.forge
|
|
54
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
55
|
+
local _callback = function(_, name)
|
|
56
|
+
createBinding(name, forge)
|
|
57
|
+
createState(name, forge)
|
|
58
|
+
end
|
|
59
|
+
for _k, _v in AppRegistry do
|
|
60
|
+
_callback(_v, _k, AppRegistry)
|
|
61
|
+
end
|
|
62
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
63
|
+
if name ~= "" and name then
|
|
64
|
+
return forge:renderApp(props)
|
|
65
|
+
elseif names then
|
|
66
|
+
return forge:renderApps(props)
|
|
67
|
+
end
|
|
68
|
+
return forge:renderAll(props)
|
|
69
|
+
end
|
|
70
|
+
return {
|
|
71
|
+
createBinding = createBinding,
|
|
72
|
+
createState = createState,
|
|
73
|
+
Render = Render,
|
|
74
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
local useContext = TS.import(script, TS.getModule(script, "@rbxts", "react")).useContext
|
|
5
|
+
-- Components
|
|
6
|
+
local Contexts = TS.import(script, script.Parent.Parent, "context").default
|
|
7
|
+
local default = function()
|
|
8
|
+
local context = useContext(Contexts.App)
|
|
9
|
+
if not context then
|
|
10
|
+
error(`Failed to retrieve App Props for React {debug.traceback()}`)
|
|
11
|
+
end
|
|
12
|
+
return context
|
|
13
|
+
end
|
|
14
|
+
return {
|
|
15
|
+
default = default,
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
type Binding = [React.Binding<boolean>, (T: boolean) => void];
|
|
4
|
+
type State = [boolean, React.Dispatch<React.SetStateAction<boolean>>];
|
|
5
|
+
export default class AppForge {
|
|
6
|
+
loaded: Map<string, React.Element<any, string | React.JSXElementConstructor<any>>>;
|
|
7
|
+
binds: Map<string, Binding>;
|
|
8
|
+
states: Map<string, State>;
|
|
9
|
+
private rulesManager;
|
|
10
|
+
getBind(name: AppNames): React.Binding<boolean>;
|
|
11
|
+
getState(name: AppNames): boolean;
|
|
12
|
+
set(name: AppNames, value: boolean): void;
|
|
13
|
+
open(name: AppNames): void;
|
|
14
|
+
close(name: AppNames): void;
|
|
15
|
+
toggle(name: AppNames): void;
|
|
16
|
+
renderApp(props: Types.NameProps & Types.MainProps): React.ReactElement<{
|
|
17
|
+
key: string;
|
|
18
|
+
ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
|
|
19
|
+
ResetOnSpawn: boolean;
|
|
20
|
+
}, string | React.JSXElementConstructor<any>> | React.ReactElement<{
|
|
21
|
+
key: string;
|
|
22
|
+
BackgroundTransparency: number;
|
|
23
|
+
Size: UDim2;
|
|
24
|
+
}, string | React.JSXElementConstructor<any>>;
|
|
25
|
+
renderApps(props: Types.NameProps & Types.MainProps): (React.ReactElement<{
|
|
26
|
+
key: string;
|
|
27
|
+
ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
|
|
28
|
+
ResetOnSpawn: boolean;
|
|
29
|
+
}, string | React.JSXElementConstructor<any>> | React.ReactElement<{
|
|
30
|
+
key: string;
|
|
31
|
+
BackgroundTransparency: number;
|
|
32
|
+
Size: UDim2;
|
|
33
|
+
}, string | React.JSXElementConstructor<any>>)[];
|
|
34
|
+
renderAll(props: Types.MainProps): (React.ReactElement<{
|
|
35
|
+
key: string;
|
|
36
|
+
ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
|
|
37
|
+
ResetOnSpawn: boolean;
|
|
38
|
+
}, string | React.JSXElementConstructor<any>> | React.ReactElement<{
|
|
39
|
+
key: string;
|
|
40
|
+
BackgroundTransparency: number;
|
|
41
|
+
Size: UDim2;
|
|
42
|
+
}, string | React.JSXElementConstructor<any>>)[];
|
|
43
|
+
}
|
|
44
|
+
export {};
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
-- Types
|
|
5
|
+
-- Components
|
|
6
|
+
local AppContainer = TS.import(script, script, "container").AppContainer
|
|
7
|
+
local AppRegistry = TS.import(script, script, "decorator").AppRegistry
|
|
8
|
+
-- Classes
|
|
9
|
+
local RulesManager = TS.import(script, script, "rules").default
|
|
10
|
+
-- Helpers
|
|
11
|
+
local _helpers = TS.import(script, script, "helpers")
|
|
12
|
+
local createBinding = _helpers.createBinding
|
|
13
|
+
local createState = _helpers.createState
|
|
14
|
+
local AppForge
|
|
15
|
+
do
|
|
16
|
+
AppForge = setmetatable({}, {
|
|
17
|
+
__tostring = function()
|
|
18
|
+
return "AppForge"
|
|
19
|
+
end,
|
|
20
|
+
})
|
|
21
|
+
AppForge.__index = AppForge
|
|
22
|
+
function AppForge.new(...)
|
|
23
|
+
local self = setmetatable({}, AppForge)
|
|
24
|
+
return self:constructor(...) or self
|
|
25
|
+
end
|
|
26
|
+
function AppForge:constructor()
|
|
27
|
+
self.loaded = {}
|
|
28
|
+
self.binds = {}
|
|
29
|
+
self.states = {}
|
|
30
|
+
self.rulesManager = RulesManager.new(self)
|
|
31
|
+
end
|
|
32
|
+
function AppForge:getBind(name)
|
|
33
|
+
local _binds = self.binds
|
|
34
|
+
local _name = name
|
|
35
|
+
if not (_binds[_name] ~= nil) then
|
|
36
|
+
createBinding(name, self)
|
|
37
|
+
end
|
|
38
|
+
local _binds_1 = self.binds
|
|
39
|
+
local _name_1 = name
|
|
40
|
+
return _binds_1[_name_1][1]
|
|
41
|
+
end
|
|
42
|
+
function AppForge:getState(name)
|
|
43
|
+
local _states = self.states
|
|
44
|
+
local _name = name
|
|
45
|
+
if not (_states[_name] ~= nil) then
|
|
46
|
+
createState(name, self)
|
|
47
|
+
end
|
|
48
|
+
local _states_1 = self.states
|
|
49
|
+
local _name_1 = name
|
|
50
|
+
return _states_1[_name_1][1]
|
|
51
|
+
end
|
|
52
|
+
function AppForge:set(name, value)
|
|
53
|
+
self.rulesManager:applyRules(name)
|
|
54
|
+
local _binds = self.binds
|
|
55
|
+
local _name = name
|
|
56
|
+
local _binding = _binds[_name]
|
|
57
|
+
local _b = _binding[1]
|
|
58
|
+
local setBinding = _binding[2]
|
|
59
|
+
local _states = self.states
|
|
60
|
+
local _name_1 = name
|
|
61
|
+
local _binding_1 = _states[_name_1]
|
|
62
|
+
local _s = _binding_1[1]
|
|
63
|
+
local setState = _binding_1[2]
|
|
64
|
+
if not setBinding then
|
|
65
|
+
createBinding(name, self)
|
|
66
|
+
end
|
|
67
|
+
setBinding(value)
|
|
68
|
+
setState(value)
|
|
69
|
+
end
|
|
70
|
+
function AppForge:open(name)
|
|
71
|
+
self:set(name, true)
|
|
72
|
+
end
|
|
73
|
+
function AppForge:close(name)
|
|
74
|
+
self:set(name, false)
|
|
75
|
+
end
|
|
76
|
+
function AppForge:toggle(name)
|
|
77
|
+
self:set(name, not self:getState(name))
|
|
78
|
+
end
|
|
79
|
+
function AppForge:renderApp(props)
|
|
80
|
+
return AppContainer(props)
|
|
81
|
+
end
|
|
82
|
+
function AppForge:renderApps(props)
|
|
83
|
+
local names = props.names
|
|
84
|
+
if names then
|
|
85
|
+
-- ▼ ReadonlyArray.map ▼
|
|
86
|
+
local _newValue = table.create(#names)
|
|
87
|
+
local _callback = function(name)
|
|
88
|
+
local _self = self
|
|
89
|
+
local _object = table.clone(props)
|
|
90
|
+
setmetatable(_object, nil)
|
|
91
|
+
_object.name = name
|
|
92
|
+
_object.names = nil
|
|
93
|
+
return _self:renderApp(_object)
|
|
94
|
+
end
|
|
95
|
+
for _k, _v in names do
|
|
96
|
+
_newValue[_k] = _callback(_v, _k - 1, names)
|
|
97
|
+
end
|
|
98
|
+
-- ▲ ReadonlyArray.map ▲
|
|
99
|
+
return _newValue
|
|
100
|
+
end
|
|
101
|
+
error("No app names provided to renderApps")
|
|
102
|
+
end
|
|
103
|
+
function AppForge:renderAll(props)
|
|
104
|
+
local names = {}
|
|
105
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
106
|
+
local _callback = function(_, name)
|
|
107
|
+
local _name = name
|
|
108
|
+
table.insert(names, _name)
|
|
109
|
+
end
|
|
110
|
+
for _k, _v in AppRegistry do
|
|
111
|
+
_callback(_v, _k, AppRegistry)
|
|
112
|
+
end
|
|
113
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
114
|
+
local _self = self
|
|
115
|
+
local _object = table.clone(props)
|
|
116
|
+
setmetatable(_object, nil)
|
|
117
|
+
_object.names = names
|
|
118
|
+
return _self:renderApps(_object)
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
return {
|
|
122
|
+
default = AppForge,
|
|
123
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Types
|
|
4
|
+
-- Rules
|
|
5
|
+
local ParentRule = TS.import(script, script, "parent").default
|
|
6
|
+
local RulesManager
|
|
7
|
+
do
|
|
8
|
+
RulesManager = setmetatable({}, {
|
|
9
|
+
__tostring = function()
|
|
10
|
+
return "RulesManager"
|
|
11
|
+
end,
|
|
12
|
+
})
|
|
13
|
+
RulesManager.__index = RulesManager
|
|
14
|
+
function RulesManager.new(...)
|
|
15
|
+
local self = setmetatable({}, RulesManager)
|
|
16
|
+
return self:constructor(...) or self
|
|
17
|
+
end
|
|
18
|
+
function RulesManager:constructor(forge)
|
|
19
|
+
self.forge = forge
|
|
20
|
+
end
|
|
21
|
+
function RulesManager:applyRules(name)
|
|
22
|
+
ParentRule(name, self.forge)
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
return {
|
|
26
|
+
default = RulesManager,
|
|
27
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Types
|
|
4
|
+
-- Components
|
|
5
|
+
local AppRegistry = TS.import(script, script.Parent.Parent, "decorator").AppRegistry
|
|
6
|
+
local function ParentRule(entry, forge)
|
|
7
|
+
local children = {}
|
|
8
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
9
|
+
local _callback = function(app, name)
|
|
10
|
+
local rules = app.rules
|
|
11
|
+
if not rules then
|
|
12
|
+
return nil
|
|
13
|
+
end
|
|
14
|
+
local _condition = rules.parent
|
|
15
|
+
if _condition ~= "" and _condition then
|
|
16
|
+
_condition = rules.parent == entry
|
|
17
|
+
end
|
|
18
|
+
if _condition ~= "" and _condition then
|
|
19
|
+
local _binds = forge.binds
|
|
20
|
+
local _entry = entry
|
|
21
|
+
if not _binds[_entry] then
|
|
22
|
+
local _name = name
|
|
23
|
+
table.insert(children, _name)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
for _k, _v in AppRegistry do
|
|
28
|
+
_callback(_v, _k, AppRegistry)
|
|
29
|
+
end
|
|
30
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
31
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
32
|
+
local _callback_1 = function(name)
|
|
33
|
+
return forge:close(name)
|
|
34
|
+
end
|
|
35
|
+
for _k, _v in children do
|
|
36
|
+
_callback_1(_v, _k - 1, children)
|
|
37
|
+
end
|
|
38
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
39
|
+
end
|
|
40
|
+
return {
|
|
41
|
+
default = ParentRule,
|
|
42
|
+
}
|