@rbxts/app-forge 0.5.9 → 0.6.0-alpha.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/index.d.ts +2 -19
- package/out/init.luau +2 -116
- package/out/react/container.d.ts +11 -0
- package/out/react/container.luau +80 -0
- package/out/react/decorator.d.ts +14 -0
- package/out/react/decorator.luau +55 -0
- package/out/react/helpers.d.ts +18 -0
- package/out/react/helpers.luau +16 -0
- package/out/react/index.d.ts +44 -0
- package/out/react/init.luau +127 -0
- package/out/react/rules.d.ts +11 -0
- package/out/react/rules.luau +196 -0
- package/out/react/types.d.ts +53 -0
- package/out/vide/container.d.ts +2 -0
- package/out/{container.luau → vide/container.luau} +19 -12
- package/out/{decorator.luau → vide/decorator.luau} +0 -1
- package/out/{helpers.d.ts → vide/helpers.d.ts} +1 -1
- package/out/vide/index.d.ts +19 -0
- package/out/vide/init.luau +116 -0
- package/package.json +6 -6
- package/out/container.d.ts +0 -4
- /package/out/{decorator.d.ts → vide/decorator.d.ts} +0 -0
- /package/out/{helpers.luau → vide/helpers.luau} +0 -0
- /package/out/{rules.d.ts → vide/rules.d.ts} +0 -0
- /package/out/{rules.luau → vide/rules.luau} +0 -0
- /package/out/{types.d.ts → vide/types.d.ts} +0 -0
package/out/index.d.ts
CHANGED
|
@@ -1,19 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import { Args, App } from "./decorator";
|
|
4
|
-
export default class AppForge {
|
|
5
|
-
sources: Map<string, Vide.Source<boolean>>;
|
|
6
|
-
loaded: Map<string, Vide.Node>;
|
|
7
|
-
private rulesManager;
|
|
8
|
-
getSource(name: AppNames[number]): Vide.Source<boolean>;
|
|
9
|
-
set(name: AppNames[number], value: Vide.Source<boolean> | boolean): void;
|
|
10
|
-
open(name: AppNames[number]): void;
|
|
11
|
-
close(name: AppNames[number]): void;
|
|
12
|
-
toggle(name: AppNames[number]): void;
|
|
13
|
-
renderApp(props: Types.NameProps & Types.MainProps): Vide.Node;
|
|
14
|
-
renderApps(props: Types.NameProps & Types.MainProps): Vide.Node[];
|
|
15
|
-
renderAll(props: Types.MainProps): Vide.Node[];
|
|
16
|
-
}
|
|
17
|
-
export { App, Args };
|
|
18
|
-
export { Render } from "./helpers";
|
|
19
|
-
export type { NameProps, MainProps, ClassProps } from "./types";
|
|
1
|
+
export * as ReactForge from "./react";
|
|
2
|
+
export * as VideForge from "./vide";
|
package/out/init.luau
CHANGED
|
@@ -1,120 +1,6 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local exports = {}
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
local Vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
7
|
-
-- Types
|
|
8
|
-
-- Components
|
|
9
|
-
local _decorator = TS.import(script, script, "decorator")
|
|
10
|
-
local AppRegistry = _decorator.AppRegistry
|
|
11
|
-
local Args = _decorator.Args
|
|
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
|
|
4
|
+
exports.ReactForge = TS.import(script, script, "react")
|
|
5
|
+
exports.VideForge = TS.import(script, script, "vide")
|
|
120
6
|
return exports
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
export declare function AppContainer(props: Types.NameProps & Types.MainProps): React.ReactElement<{
|
|
4
|
+
key: string;
|
|
5
|
+
ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
|
|
6
|
+
ResetOnSpawn: boolean;
|
|
7
|
+
}, string | React.JSXElementConstructor<any>> | React.ReactElement<{
|
|
8
|
+
key: string;
|
|
9
|
+
BackgroundTransparency: number;
|
|
10
|
+
Size: UDim2;
|
|
11
|
+
}, string | React.JSXElementConstructor<any>>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Services
|
|
4
|
+
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
5
|
+
-- Packages
|
|
6
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
|
+
local useBinding = _react.useBinding
|
|
8
|
+
local createElement = _react.createElement
|
|
9
|
+
-- Types
|
|
10
|
+
-- Components
|
|
11
|
+
local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
|
|
12
|
+
local function createBinding(name, manager)
|
|
13
|
+
local _name = name
|
|
14
|
+
local app = AppRegistry[_name]
|
|
15
|
+
if not app then
|
|
16
|
+
error(`App "{name}" not registered`)
|
|
17
|
+
end
|
|
18
|
+
local _condition = app.visible
|
|
19
|
+
if _condition == nil then
|
|
20
|
+
_condition = false
|
|
21
|
+
end
|
|
22
|
+
local binding = { useBinding(_condition) }
|
|
23
|
+
local _binds = manager.binds
|
|
24
|
+
local _name_1 = name
|
|
25
|
+
_binds[_name_1] = binding
|
|
26
|
+
return unpack(binding)
|
|
27
|
+
end
|
|
28
|
+
local function createInstance(props)
|
|
29
|
+
local _binding = props
|
|
30
|
+
local name = _binding.name
|
|
31
|
+
local forge = _binding.forge
|
|
32
|
+
if not (name ~= "" and name) then
|
|
33
|
+
error("App name is required to create instance")
|
|
34
|
+
end
|
|
35
|
+
local appClass = AppRegistry[name]
|
|
36
|
+
if not appClass then
|
|
37
|
+
error(`App "{name}" not registered`)
|
|
38
|
+
end
|
|
39
|
+
if not (forge.loaded[name] ~= nil) then
|
|
40
|
+
local instance = appClass.constructor.new(props)
|
|
41
|
+
local Render = function()
|
|
42
|
+
return instance:render()
|
|
43
|
+
end
|
|
44
|
+
local _loaded = forge.loaded
|
|
45
|
+
local _arg1 = createElement(Render, {
|
|
46
|
+
key = "Main",
|
|
47
|
+
})
|
|
48
|
+
_loaded[name] = _arg1
|
|
49
|
+
end
|
|
50
|
+
return forge.loaded[name]
|
|
51
|
+
end
|
|
52
|
+
local function AppContainer(props)
|
|
53
|
+
local _binding = props
|
|
54
|
+
local name = _binding.name
|
|
55
|
+
local forge = _binding.forge
|
|
56
|
+
if not (name ~= "" and name) then
|
|
57
|
+
error("App name is required in AppContainer")
|
|
58
|
+
end
|
|
59
|
+
createBinding(name, forge)
|
|
60
|
+
local element = createInstance(props)
|
|
61
|
+
if not element then
|
|
62
|
+
error(`Failed to create instance for app "{name}"`)
|
|
63
|
+
end
|
|
64
|
+
if RunService:IsRunning() then
|
|
65
|
+
return createElement("ScreenGui", {
|
|
66
|
+
key = name,
|
|
67
|
+
ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
|
|
68
|
+
ResetOnSpawn = false,
|
|
69
|
+
}, element)
|
|
70
|
+
else
|
|
71
|
+
return createElement("Frame", {
|
|
72
|
+
key = name,
|
|
73
|
+
BackgroundTransparency = 1,
|
|
74
|
+
Size = UDim2.fromScale(1, 1),
|
|
75
|
+
}, element)
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
return {
|
|
79
|
+
AppContainer = AppContainer,
|
|
80
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
import type AppForge from ".";
|
|
4
|
+
export declare const AppRegistry: Map<string, Types.AppRegistry>;
|
|
5
|
+
export declare function App(props: Types.AppRegistryProps): <T extends new (props: Types.MainProps) => Args>(constructor: T) => T;
|
|
6
|
+
export declare abstract class Args {
|
|
7
|
+
readonly forge: AppForge;
|
|
8
|
+
readonly props: Types.ClassProps;
|
|
9
|
+
readonly name: AppNames[number];
|
|
10
|
+
readonly bind: React.Binding<boolean>;
|
|
11
|
+
readonly state: Boolean;
|
|
12
|
+
constructor(props: Types.NameProps & Types.MainProps);
|
|
13
|
+
abstract render(): JSX.Element;
|
|
14
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Services
|
|
4
|
+
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
5
|
+
-- Packages
|
|
6
|
+
local usePx = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-react-hooks").out).usePx
|
|
7
|
+
-- Types
|
|
8
|
+
local AppRegistry = {}
|
|
9
|
+
local function App(props)
|
|
10
|
+
return function(constructor)
|
|
11
|
+
local _name = props.name
|
|
12
|
+
if AppRegistry[_name] ~= nil then
|
|
13
|
+
error(`Duplicate registered App name "{props.name}"`)
|
|
14
|
+
end
|
|
15
|
+
local _name_1 = props.name
|
|
16
|
+
local _arg1 = {
|
|
17
|
+
constructor = constructor,
|
|
18
|
+
visible = props.visible,
|
|
19
|
+
rules = props.rules,
|
|
20
|
+
}
|
|
21
|
+
AppRegistry[_name_1] = _arg1
|
|
22
|
+
return constructor
|
|
23
|
+
end
|
|
24
|
+
end
|
|
25
|
+
local Args
|
|
26
|
+
do
|
|
27
|
+
Args = {}
|
|
28
|
+
function Args:constructor(props)
|
|
29
|
+
local _binding = props
|
|
30
|
+
local target = _binding.target
|
|
31
|
+
local forge = _binding.forge
|
|
32
|
+
local name = _binding.name
|
|
33
|
+
if not (name ~= "" and name) then
|
|
34
|
+
error("App name is required in Args constructor")
|
|
35
|
+
end
|
|
36
|
+
local bind = forge:getBind(name)
|
|
37
|
+
if not bind and RunService:IsRunning() then
|
|
38
|
+
error("FAILED TO GET BIND FOR APP!")
|
|
39
|
+
end
|
|
40
|
+
local px = usePx(target)
|
|
41
|
+
self.forge = forge
|
|
42
|
+
local _object = table.clone(props.props)
|
|
43
|
+
setmetatable(_object, nil)
|
|
44
|
+
_object.px = px
|
|
45
|
+
self.props = _object
|
|
46
|
+
self.name = name
|
|
47
|
+
self.bind = bind
|
|
48
|
+
self.state = if self.bind then self.bind:getValue() else nil
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
return {
|
|
52
|
+
App = App,
|
|
53
|
+
AppRegistry = AppRegistry,
|
|
54
|
+
Args = Args,
|
|
55
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Types from "./types";
|
|
2
|
+
export declare function Render(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>> | (import("@rbxts/react").ReactElement<{
|
|
11
|
+
key: string;
|
|
12
|
+
ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
|
|
13
|
+
ResetOnSpawn: boolean;
|
|
14
|
+
}, string | import("@rbxts/react").JSXElementConstructor<any>> | import("@rbxts/react").ReactElement<{
|
|
15
|
+
key: string;
|
|
16
|
+
BackgroundTransparency: number;
|
|
17
|
+
Size: UDim2;
|
|
18
|
+
}, string | import("@rbxts/react").JSXElementConstructor<any>>)[];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
-- Types
|
|
3
|
+
local function Render(props)
|
|
4
|
+
local names = props.names
|
|
5
|
+
local name = props.name
|
|
6
|
+
local forge = props.forge
|
|
7
|
+
if name ~= "" and name then
|
|
8
|
+
return forge:renderApp(props)
|
|
9
|
+
elseif names then
|
|
10
|
+
return forge:renderApps(props)
|
|
11
|
+
end
|
|
12
|
+
return forge:renderAll(props)
|
|
13
|
+
end
|
|
14
|
+
return {
|
|
15
|
+
Render = Render,
|
|
16
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
import { Args, App } from "./decorator";
|
|
4
|
+
export default class AppForge {
|
|
5
|
+
binds: Map<string, [React.Binding<boolean>, (T: boolean) => void]>;
|
|
6
|
+
loaded: Map<string, React.Element<any, string | React.JSXElementConstructor<any>>>;
|
|
7
|
+
private rulesManager;
|
|
8
|
+
getBind(name: AppNames[number]): React.Binding<boolean> | undefined;
|
|
9
|
+
getState(name: AppNames[number]): boolean | undefined;
|
|
10
|
+
set(name: AppNames[number], value: boolean): void;
|
|
11
|
+
open(name: AppNames[number]): void;
|
|
12
|
+
close(name: AppNames[number]): void;
|
|
13
|
+
toggle(name: AppNames[number]): void;
|
|
14
|
+
renderApp(props: Types.NameProps & Types.MainProps): React.ReactElement<{
|
|
15
|
+
key: string;
|
|
16
|
+
ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
|
|
17
|
+
ResetOnSpawn: boolean;
|
|
18
|
+
}, string | React.JSXElementConstructor<any>> | React.ReactElement<{
|
|
19
|
+
key: string;
|
|
20
|
+
BackgroundTransparency: number;
|
|
21
|
+
Size: UDim2;
|
|
22
|
+
}, string | React.JSXElementConstructor<any>>;
|
|
23
|
+
renderApps(props: Types.NameProps & Types.MainProps): (React.ReactElement<{
|
|
24
|
+
key: string;
|
|
25
|
+
ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
|
|
26
|
+
ResetOnSpawn: boolean;
|
|
27
|
+
}, string | React.JSXElementConstructor<any>> | React.ReactElement<{
|
|
28
|
+
key: string;
|
|
29
|
+
BackgroundTransparency: number;
|
|
30
|
+
Size: UDim2;
|
|
31
|
+
}, string | React.JSXElementConstructor<any>>)[];
|
|
32
|
+
renderAll(props: Types.MainProps): (React.ReactElement<{
|
|
33
|
+
key: string;
|
|
34
|
+
ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
|
|
35
|
+
ResetOnSpawn: boolean;
|
|
36
|
+
}, string | React.JSXElementConstructor<any>> | React.ReactElement<{
|
|
37
|
+
key: string;
|
|
38
|
+
BackgroundTransparency: number;
|
|
39
|
+
Size: UDim2;
|
|
40
|
+
}, string | React.JSXElementConstructor<any>>)[];
|
|
41
|
+
}
|
|
42
|
+
export { App, Args };
|
|
43
|
+
export { Render } from "./helpers";
|
|
44
|
+
export type { MainProps, NameProps, Props } from "./types";
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
-- Packages
|
|
5
|
+
-- Types
|
|
6
|
+
-- Components
|
|
7
|
+
local _decorator = TS.import(script, script, "decorator")
|
|
8
|
+
local AppRegistry = _decorator.AppRegistry
|
|
9
|
+
local Args = _decorator.Args
|
|
10
|
+
local App = _decorator.App
|
|
11
|
+
local AppContainer = TS.import(script, script, "container").AppContainer
|
|
12
|
+
-- Classes
|
|
13
|
+
local RulesManager = TS.import(script, script, "rules").default
|
|
14
|
+
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
15
|
+
local AppForge
|
|
16
|
+
do
|
|
17
|
+
AppForge = setmetatable({}, {
|
|
18
|
+
__tostring = function()
|
|
19
|
+
return "AppForge"
|
|
20
|
+
end,
|
|
21
|
+
})
|
|
22
|
+
AppForge.__index = AppForge
|
|
23
|
+
function AppForge.new(...)
|
|
24
|
+
local self = setmetatable({}, AppForge)
|
|
25
|
+
return self:constructor(...) or self
|
|
26
|
+
end
|
|
27
|
+
function AppForge:constructor()
|
|
28
|
+
self.binds = {}
|
|
29
|
+
self.loaded = {}
|
|
30
|
+
self.rulesManager = RulesManager.new(self)
|
|
31
|
+
end
|
|
32
|
+
function AppForge:getBind(name)
|
|
33
|
+
local _condition = not RunService:IsRunning()
|
|
34
|
+
if _condition then
|
|
35
|
+
local _binds = self.binds
|
|
36
|
+
local _name = name
|
|
37
|
+
_condition = not (_binds[_name] ~= nil)
|
|
38
|
+
end
|
|
39
|
+
if _condition then
|
|
40
|
+
return nil
|
|
41
|
+
end
|
|
42
|
+
local _binds = self.binds
|
|
43
|
+
local _name = name
|
|
44
|
+
if not (_binds[_name] ~= nil) then
|
|
45
|
+
error(`App "{name}" has no binding`)
|
|
46
|
+
end
|
|
47
|
+
local _binds_1 = self.binds
|
|
48
|
+
local _name_1 = name
|
|
49
|
+
return _binds_1[_name_1][1]
|
|
50
|
+
end
|
|
51
|
+
function AppForge:getState(name)
|
|
52
|
+
local _result = self:getBind(name)
|
|
53
|
+
if _result ~= nil then
|
|
54
|
+
_result = _result:getValue()
|
|
55
|
+
end
|
|
56
|
+
return _result
|
|
57
|
+
end
|
|
58
|
+
function AppForge:set(name, value)
|
|
59
|
+
if not self.rulesManager:applyRules(name, value) then
|
|
60
|
+
return nil
|
|
61
|
+
end
|
|
62
|
+
local _binds = self.binds
|
|
63
|
+
local _name = name
|
|
64
|
+
local _binding = _binds[_name]
|
|
65
|
+
local _ = _binding[1]
|
|
66
|
+
local setBinding = _binding[2]
|
|
67
|
+
if not setBinding then
|
|
68
|
+
error(`App "{name}" has no binding setter`)
|
|
69
|
+
end
|
|
70
|
+
setBinding(value)
|
|
71
|
+
end
|
|
72
|
+
function AppForge:open(name)
|
|
73
|
+
self:set(name, true)
|
|
74
|
+
end
|
|
75
|
+
function AppForge:close(name)
|
|
76
|
+
self:set(name, false)
|
|
77
|
+
end
|
|
78
|
+
function AppForge:toggle(name)
|
|
79
|
+
self:set(name, not self:getState(name))
|
|
80
|
+
end
|
|
81
|
+
function AppForge:renderApp(props)
|
|
82
|
+
return AppContainer(props)
|
|
83
|
+
end
|
|
84
|
+
function AppForge:renderApps(props)
|
|
85
|
+
local names = props.names
|
|
86
|
+
if names then
|
|
87
|
+
-- ▼ ReadonlyArray.map ▼
|
|
88
|
+
local _newValue = table.create(#names)
|
|
89
|
+
local _callback = function(name)
|
|
90
|
+
local _self = self
|
|
91
|
+
local _object = table.clone(props)
|
|
92
|
+
setmetatable(_object, nil)
|
|
93
|
+
_object.name = name
|
|
94
|
+
_object.names = nil
|
|
95
|
+
return _self:renderApp(_object)
|
|
96
|
+
end
|
|
97
|
+
for _k, _v in names do
|
|
98
|
+
_newValue[_k] = _callback(_v, _k - 1, names)
|
|
99
|
+
end
|
|
100
|
+
-- ▲ ReadonlyArray.map ▲
|
|
101
|
+
return _newValue
|
|
102
|
+
end
|
|
103
|
+
error("No app names provided to renderApps")
|
|
104
|
+
end
|
|
105
|
+
function AppForge:renderAll(props)
|
|
106
|
+
local names = {}
|
|
107
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
108
|
+
local _callback = function(_, name)
|
|
109
|
+
local _name = name
|
|
110
|
+
table.insert(names, _name)
|
|
111
|
+
end
|
|
112
|
+
for _k, _v in AppRegistry do
|
|
113
|
+
_callback(_v, _k, AppRegistry)
|
|
114
|
+
end
|
|
115
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
116
|
+
local _self = self
|
|
117
|
+
local _object = table.clone(props)
|
|
118
|
+
setmetatable(_object, nil)
|
|
119
|
+
_object.names = names
|
|
120
|
+
return _self:renderApps(_object)
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
exports.Render = TS.import(script, script, "helpers").Render
|
|
124
|
+
exports.default = AppForge
|
|
125
|
+
exports.App = App
|
|
126
|
+
exports.Args = Args
|
|
127
|
+
return exports
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import AppManager from ".";
|
|
2
|
+
export default class RulesManager {
|
|
3
|
+
private appManager;
|
|
4
|
+
constructor(appManager: AppManager);
|
|
5
|
+
applyRules(name: AppNames[number], value: boolean): boolean;
|
|
6
|
+
private inSameGroup;
|
|
7
|
+
private blockedBy;
|
|
8
|
+
private blocks;
|
|
9
|
+
private exclusive;
|
|
10
|
+
private layer;
|
|
11
|
+
}
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
local Object = TS.import(script, TS.getModule(script, "@rbxts", "object-utils"))
|
|
5
|
+
-- Components
|
|
6
|
+
local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
|
|
7
|
+
-- Types
|
|
8
|
+
local function asTable(value)
|
|
9
|
+
local _value = value
|
|
10
|
+
if type(_value) == "table" then
|
|
11
|
+
return value
|
|
12
|
+
else
|
|
13
|
+
local t = {}
|
|
14
|
+
t[2] = value
|
|
15
|
+
return t
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
local RulesManager
|
|
19
|
+
do
|
|
20
|
+
RulesManager = setmetatable({}, {
|
|
21
|
+
__tostring = function()
|
|
22
|
+
return "RulesManager"
|
|
23
|
+
end,
|
|
24
|
+
})
|
|
25
|
+
RulesManager.__index = RulesManager
|
|
26
|
+
function RulesManager.new(...)
|
|
27
|
+
local self = setmetatable({}, RulesManager)
|
|
28
|
+
return self:constructor(...) or self
|
|
29
|
+
end
|
|
30
|
+
function RulesManager:constructor(appManager)
|
|
31
|
+
self.appManager = appManager
|
|
32
|
+
end
|
|
33
|
+
function RulesManager:applyRules(name, value)
|
|
34
|
+
local _name = name
|
|
35
|
+
local appData = AppRegistry[_name]
|
|
36
|
+
local _rules = appData
|
|
37
|
+
if _rules ~= nil then
|
|
38
|
+
_rules = _rules.rules
|
|
39
|
+
end
|
|
40
|
+
local rules = _rules
|
|
41
|
+
local _result = rules
|
|
42
|
+
if _result ~= nil then
|
|
43
|
+
_result = _result.groups
|
|
44
|
+
end
|
|
45
|
+
if _result == "Core" then
|
|
46
|
+
return true
|
|
47
|
+
end
|
|
48
|
+
if value then
|
|
49
|
+
local allNames = Object.keys(AppRegistry)
|
|
50
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
51
|
+
local _callback = function(n)
|
|
52
|
+
if not (n ~= "" and n) or n == name then
|
|
53
|
+
return nil
|
|
54
|
+
end
|
|
55
|
+
print(self.appManager.loaded)
|
|
56
|
+
local _n = n
|
|
57
|
+
local otherApp = AppRegistry[_n]
|
|
58
|
+
local _result_1 = otherApp
|
|
59
|
+
if _result_1 ~= nil then
|
|
60
|
+
_result_1 = _result_1.rules
|
|
61
|
+
if _result_1 ~= nil then
|
|
62
|
+
_result_1 = _result_1.groups
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
local groups = if _result_1 ~= "" and _result_1 then asTable(otherApp.rules.groups) else {}
|
|
66
|
+
-- ▼ ReadonlyArray.find ▼
|
|
67
|
+
local _callback_1 = function(g)
|
|
68
|
+
return g == "Core"
|
|
69
|
+
end
|
|
70
|
+
local _result_2
|
|
71
|
+
for _i, _v in groups do
|
|
72
|
+
if _callback_1(_v, _i - 1, groups) == true then
|
|
73
|
+
_result_2 = _v
|
|
74
|
+
break
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
-- ▲ ReadonlyArray.find ▲
|
|
78
|
+
if _result_2 then
|
|
79
|
+
return nil
|
|
80
|
+
end
|
|
81
|
+
if self.appManager:getState(n) then
|
|
82
|
+
self.appManager:set(n, false)
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
for _k, _v in allNames do
|
|
86
|
+
_callback(_v, _k - 1, allNames)
|
|
87
|
+
end
|
|
88
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
89
|
+
end
|
|
90
|
+
if not rules then
|
|
91
|
+
return true
|
|
92
|
+
end
|
|
93
|
+
local _condition = value
|
|
94
|
+
if _condition then
|
|
95
|
+
_condition = rules.blockedBy
|
|
96
|
+
if _condition ~= "" and _condition then
|
|
97
|
+
_condition = not self:blockedBy(name, rules.blockedBy)
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
if _condition ~= "" and _condition then
|
|
101
|
+
return false
|
|
102
|
+
end
|
|
103
|
+
local _value = value and rules.blocks
|
|
104
|
+
if _value ~= "" and _value then
|
|
105
|
+
self:blocks(name, rules.blocks)
|
|
106
|
+
end
|
|
107
|
+
if value and rules.layer ~= nil then
|
|
108
|
+
self:layer(name, rules.layer)
|
|
109
|
+
end
|
|
110
|
+
if value and rules.exclusive then
|
|
111
|
+
self:exclusive(name)
|
|
112
|
+
end
|
|
113
|
+
return true
|
|
114
|
+
end
|
|
115
|
+
function RulesManager:inSameGroup(a, b)
|
|
116
|
+
local _a = a
|
|
117
|
+
local appA = AppRegistry[_a]
|
|
118
|
+
local _b = b
|
|
119
|
+
local appB = AppRegistry[_b]
|
|
120
|
+
if not appA or not appB then
|
|
121
|
+
return false
|
|
122
|
+
end
|
|
123
|
+
local _result = appA.rules
|
|
124
|
+
if _result ~= nil then
|
|
125
|
+
_result = _result.groups
|
|
126
|
+
end
|
|
127
|
+
local _condition = _result
|
|
128
|
+
if _condition == nil then
|
|
129
|
+
_condition = {}
|
|
130
|
+
end
|
|
131
|
+
local groupsA = asTable(_condition)
|
|
132
|
+
local _result_1 = appB.rules
|
|
133
|
+
if _result_1 ~= nil then
|
|
134
|
+
_result_1 = _result_1.groups
|
|
135
|
+
end
|
|
136
|
+
local _condition_1 = _result_1
|
|
137
|
+
if _condition_1 == nil then
|
|
138
|
+
_condition_1 = {}
|
|
139
|
+
end
|
|
140
|
+
local groupsB = asTable(_condition_1)
|
|
141
|
+
for i = 1, #groupsA do
|
|
142
|
+
for j = 1, #groupsB do
|
|
143
|
+
if groupsA[i + 1] == groupsB[j + 1] then
|
|
144
|
+
return true
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
end
|
|
148
|
+
return false
|
|
149
|
+
end
|
|
150
|
+
function RulesManager:blockedBy(name, rule)
|
|
151
|
+
local blockers = asTable(rule)
|
|
152
|
+
for i = 1, #blockers do
|
|
153
|
+
local blocker = blockers[i + 1]
|
|
154
|
+
if self:inSameGroup(name, blocker) or not (blocker ~= "" and blocker) then
|
|
155
|
+
continue
|
|
156
|
+
end
|
|
157
|
+
if self.appManager:getState(blocker) then
|
|
158
|
+
return false
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
return true
|
|
162
|
+
end
|
|
163
|
+
function RulesManager:blocks(name, rule)
|
|
164
|
+
local blocked = asTable(rule)
|
|
165
|
+
for i = 1, #blocked do
|
|
166
|
+
local b = blocked[i + 1]
|
|
167
|
+
if self:inSameGroup(name, b) or not (b ~= "" and b) then
|
|
168
|
+
continue
|
|
169
|
+
end
|
|
170
|
+
if self.appManager:getState(b) then
|
|
171
|
+
self.appManager:set(b, false)
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
function RulesManager:exclusive(name)
|
|
176
|
+
local names = Object.keys(AppRegistry)
|
|
177
|
+
for i = 1, #names do
|
|
178
|
+
local other = names[i + 1]
|
|
179
|
+
if other == name or not (other ~= "" and other) then
|
|
180
|
+
continue
|
|
181
|
+
end
|
|
182
|
+
if self:inSameGroup(name, other) then
|
|
183
|
+
continue
|
|
184
|
+
end
|
|
185
|
+
if self.appManager:getState(other) then
|
|
186
|
+
self.appManager:set(other, false)
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
end
|
|
190
|
+
function RulesManager:layer(_name, _layer)
|
|
191
|
+
-- TODO: implement priority / layering
|
|
192
|
+
end
|
|
193
|
+
end
|
|
194
|
+
return {
|
|
195
|
+
default = RulesManager,
|
|
196
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
// Types
|
|
2
|
+
import type { Args } from "./decorator";
|
|
3
|
+
import type AppForge from ".";
|
|
4
|
+
|
|
5
|
+
declare namespace Types {
|
|
6
|
+
type AppRegistryProps = {
|
|
7
|
+
name: AppNames[number];
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
rules?: Rules.All;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type NameProps =
|
|
13
|
+
| { name?: AppNames[number]; names?: undefined }
|
|
14
|
+
| { names?: AppNames[number][]; name?: undefined };
|
|
15
|
+
|
|
16
|
+
type MainProps = {
|
|
17
|
+
props: AppProps;
|
|
18
|
+
forge: AppForge;
|
|
19
|
+
target?: GuiObject | Camera;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type ClassProps = AppProps & {
|
|
23
|
+
px: ReturnType<typeof import("@rbxts/loners-pretty-react-hooks").usePx>;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type AppRegistry = {
|
|
27
|
+
constructor: new (props: MainProps) => Args;
|
|
28
|
+
visible?: boolean;
|
|
29
|
+
rules?: Rules.All;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
namespace Rules {
|
|
33
|
+
type Groups = AppGroups[number] | "Core" | "Core"[] | AppGroups[number][];
|
|
34
|
+
type BlockedBy = AppNames[number] | AppNames[number][];
|
|
35
|
+
type Blocks = AppNames[number] | AppNames[number][];
|
|
36
|
+
type Exclusive = boolean;
|
|
37
|
+
type Layer = number;
|
|
38
|
+
|
|
39
|
+
type All = {
|
|
40
|
+
blockedBy?: BlockedBy;
|
|
41
|
+
exclusive?: Exclusive;
|
|
42
|
+
groups?: Groups;
|
|
43
|
+
blocks?: Blocks;
|
|
44
|
+
layer?: Layer;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type MainProps = Types.MainProps;
|
|
50
|
+
export type NameProps = Types.NameProps;
|
|
51
|
+
export type Props = Types.ClassProps;
|
|
52
|
+
|
|
53
|
+
export default Types;
|
|
@@ -1,29 +1,34 @@
|
|
|
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
6
|
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
8
|
-
local
|
|
7
|
+
local vide = _vide
|
|
9
8
|
local source = _vide.source
|
|
10
9
|
-- Types
|
|
11
10
|
-- Components
|
|
12
11
|
local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
|
|
13
|
-
local
|
|
12
|
+
local create = vide.create
|
|
13
|
+
local function createSource(name, forge)
|
|
14
14
|
local _name = name
|
|
15
15
|
local app = AppRegistry[_name]
|
|
16
16
|
if not app then
|
|
17
17
|
error(`App "{name}" not registered`)
|
|
18
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
|
|
19
26
|
local _condition = app.visible
|
|
20
27
|
if _condition == nil then
|
|
21
28
|
_condition = false
|
|
22
29
|
end
|
|
23
|
-
local
|
|
24
|
-
|
|
25
|
-
local _name_1 = name
|
|
26
|
-
_sources[_name_1] = appSource
|
|
30
|
+
local _arg1 = source(_condition)
|
|
31
|
+
_sources_1[_exp] = _arg1
|
|
27
32
|
return source
|
|
28
33
|
end
|
|
29
34
|
local function createInstance(props)
|
|
@@ -58,19 +63,21 @@ local function AppContainer(props)
|
|
|
58
63
|
error(`Failed to create instance for app "{name}"`)
|
|
59
64
|
end
|
|
60
65
|
if RunService:IsRunning() then
|
|
61
|
-
return
|
|
66
|
+
return create("ScreenGui")({
|
|
62
67
|
Name = name,
|
|
63
68
|
ZIndexBehavior = "Sibling",
|
|
64
69
|
ResetOnSpawn = false,
|
|
65
|
-
|
|
70
|
+
[0] = element,
|
|
71
|
+
})
|
|
66
72
|
else
|
|
67
|
-
return
|
|
73
|
+
return create("Frame")({
|
|
68
74
|
Name = name,
|
|
69
75
|
BackgroundTransparency = 1,
|
|
70
76
|
Size = UDim2.fromScale(1, 1),
|
|
71
|
-
|
|
77
|
+
[0] = element,
|
|
78
|
+
})
|
|
72
79
|
end
|
|
73
80
|
end
|
|
74
81
|
return {
|
|
75
|
-
|
|
82
|
+
AppContainer = AppContainer,
|
|
76
83
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import Types from "./types";
|
|
2
|
-
export declare function Render(props: Types.NameProps & Types.MainProps):
|
|
2
|
+
export declare function Render(props: Types.NameProps & Types.MainProps): ScreenGui | Frame | (ScreenGui | Frame)[];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
import { Args, App } from "./decorator";
|
|
4
|
+
export default class AppForge {
|
|
5
|
+
sources: Map<string, Vide.Source<boolean>>;
|
|
6
|
+
loaded: Map<string, Vide.Node>;
|
|
7
|
+
private rulesManager;
|
|
8
|
+
getSource(name: AppNames[number]): Vide.Source<boolean>;
|
|
9
|
+
set(name: AppNames[number], value: Vide.Source<boolean> | boolean): void;
|
|
10
|
+
open(name: AppNames[number]): void;
|
|
11
|
+
close(name: AppNames[number]): void;
|
|
12
|
+
toggle(name: AppNames[number]): void;
|
|
13
|
+
renderApp(props: Types.NameProps & Types.MainProps): ScreenGui | Frame;
|
|
14
|
+
renderApps(props: Types.NameProps & Types.MainProps): (ScreenGui | Frame)[];
|
|
15
|
+
renderAll(props: Types.MainProps): (ScreenGui | Frame)[];
|
|
16
|
+
}
|
|
17
|
+
export { App, Args };
|
|
18
|
+
export { Render } from "./helpers";
|
|
19
|
+
export type { NameProps, MainProps, ClassProps } from "./types";
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
-- Packages
|
|
5
|
+
-- Types
|
|
6
|
+
-- Components
|
|
7
|
+
local _decorator = TS.import(script, script, "decorator")
|
|
8
|
+
local AppRegistry = _decorator.AppRegistry
|
|
9
|
+
local Args = _decorator.Args
|
|
10
|
+
local App = _decorator.App
|
|
11
|
+
local AppContainer = TS.import(script, script, "container").AppContainer
|
|
12
|
+
-- Classes
|
|
13
|
+
local RulesManager = TS.import(script, script, "rules").default
|
|
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.sources = {}
|
|
28
|
+
self.loaded = {}
|
|
29
|
+
self.rulesManager = RulesManager.new(self)
|
|
30
|
+
end
|
|
31
|
+
function AppForge:getSource(name)
|
|
32
|
+
local _sources = self.sources
|
|
33
|
+
local _name = name
|
|
34
|
+
if not (_sources[_name] ~= nil) then
|
|
35
|
+
error(`App "{name}" has no source`)
|
|
36
|
+
end
|
|
37
|
+
local _sources_1 = self.sources
|
|
38
|
+
local _name_1 = name
|
|
39
|
+
return _sources_1[_name_1]
|
|
40
|
+
end
|
|
41
|
+
function AppForge:set(name, value)
|
|
42
|
+
if not self.rulesManager:applyRules(name, value) then
|
|
43
|
+
return nil
|
|
44
|
+
end
|
|
45
|
+
local _value = value
|
|
46
|
+
if type(_value) == "function" then
|
|
47
|
+
local _sources = self.sources
|
|
48
|
+
local _name = name
|
|
49
|
+
local _value_1 = value
|
|
50
|
+
_sources[_name] = _value_1
|
|
51
|
+
else
|
|
52
|
+
local _sources = self.sources
|
|
53
|
+
local _name = name
|
|
54
|
+
local source = _sources[_name]
|
|
55
|
+
if not source then
|
|
56
|
+
error(`App "{name}" has no source`)
|
|
57
|
+
end
|
|
58
|
+
source(value)
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
function AppForge:open(name)
|
|
62
|
+
self:set(name, true)
|
|
63
|
+
end
|
|
64
|
+
function AppForge:close(name)
|
|
65
|
+
self:set(name, false)
|
|
66
|
+
end
|
|
67
|
+
function AppForge:toggle(name)
|
|
68
|
+
self:set(name, not self:getSource(name)())
|
|
69
|
+
end
|
|
70
|
+
function AppForge:renderApp(props)
|
|
71
|
+
return AppContainer(props)
|
|
72
|
+
end
|
|
73
|
+
function AppForge:renderApps(props)
|
|
74
|
+
local names = props.names
|
|
75
|
+
if names then
|
|
76
|
+
-- ▼ ReadonlyArray.map ▼
|
|
77
|
+
local _newValue = table.create(#names)
|
|
78
|
+
local _callback = function(name)
|
|
79
|
+
local _self = self
|
|
80
|
+
local _object = table.clone(props)
|
|
81
|
+
setmetatable(_object, nil)
|
|
82
|
+
_object.name = name
|
|
83
|
+
_object.names = nil
|
|
84
|
+
return _self:renderApp(_object)
|
|
85
|
+
end
|
|
86
|
+
for _k, _v in names do
|
|
87
|
+
_newValue[_k] = _callback(_v, _k - 1, names)
|
|
88
|
+
end
|
|
89
|
+
-- ▲ ReadonlyArray.map ▲
|
|
90
|
+
return _newValue
|
|
91
|
+
end
|
|
92
|
+
error("No app names provided to renderApps")
|
|
93
|
+
end
|
|
94
|
+
function AppForge:renderAll(props)
|
|
95
|
+
local names = {}
|
|
96
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
97
|
+
local _callback = function(_, name)
|
|
98
|
+
local _name = name
|
|
99
|
+
table.insert(names, _name)
|
|
100
|
+
end
|
|
101
|
+
for _k, _v in AppRegistry do
|
|
102
|
+
_callback(_v, _k, AppRegistry)
|
|
103
|
+
end
|
|
104
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
105
|
+
local _self = self
|
|
106
|
+
local _object = table.clone(props)
|
|
107
|
+
setmetatable(_object, nil)
|
|
108
|
+
_object.names = names
|
|
109
|
+
return _self:renderApps(_object)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
exports.Render = TS.import(script, script, "helpers").Render
|
|
113
|
+
exports.default = AppForge
|
|
114
|
+
exports.App = App
|
|
115
|
+
exports.Args = Args
|
|
116
|
+
return exports
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rbxts/app-forge",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-alpha.0",
|
|
4
4
|
"description": "An App Manager for react",
|
|
5
5
|
"main": "out/init.lua",
|
|
6
6
|
"packageManager": "bun@1.3.1",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
},
|
|
12
12
|
"keywords": [
|
|
13
13
|
"roblox-ts",
|
|
14
|
-
"react"
|
|
14
|
+
"react",
|
|
15
|
+
"vide"
|
|
15
16
|
],
|
|
16
17
|
"author": "loner1536",
|
|
17
18
|
"license": "MIT",
|
|
@@ -40,15 +41,14 @@
|
|
|
40
41
|
"typescript": "^5.9.3"
|
|
41
42
|
},
|
|
42
43
|
"dependencies": {
|
|
43
|
-
"@rbxts/vide": "^0.5.7",
|
|
44
|
-
"@rbxts/ripple": "^0.9.3",
|
|
45
|
-
"@rbxts/services": "^1.6.0",
|
|
46
44
|
"@rbxts/set-timeout": "^1.1.2",
|
|
47
|
-
"@rbxts/
|
|
45
|
+
"@rbxts/services": "^1.6.0"
|
|
48
46
|
},
|
|
49
47
|
"peerDependencies": {
|
|
48
|
+
"@rbxts/loners-pretty-react-hooks": "*",
|
|
50
49
|
"@rbxts/loners-pretty-vide-utils": "*",
|
|
51
50
|
"@rbxts/object-utils": "*",
|
|
51
|
+
"@rbxts/react": "*",
|
|
52
52
|
"@rbxts/vide": "*"
|
|
53
53
|
}
|
|
54
54
|
}
|
package/out/container.d.ts
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|