@rbxts/app-forge 0.7.2-prototype.2 → 0.7.2-prototype.4
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/appRegistry.d.ts +1 -0
- package/out/appRegistry.luau +14 -4
- package/out/mount.d.ts +5 -12
- package/out/mount.luau +11 -19
- package/out/renders.d.ts +9 -0
- package/out/renders.luau +70 -0
- package/out/ruleEngine/check/exclusiveGroup.d.ts +2 -0
- package/out/ruleEngine/{exclusiveGroup.luau → check/exclusiveGroup.luau} +8 -8
- package/out/ruleEngine/check/parent.d.ts +2 -0
- package/out/ruleEngine/check/parent.luau +37 -0
- package/out/ruleEngine/init.luau +5 -5
- package/out/ruleEngine/render/anchor.d.ts +2 -0
- package/out/ruleEngine/render/anchor.luau +38 -0
- package/out/types.d.ts +2 -2
- package/package.json +1 -1
- package/out/renderManager.d.ts +0 -7
- package/out/renderManager.luau +0 -36
- package/out/ruleEngine/exclusiveGroup.d.ts +0 -2
- package/out/ruleEngine/parent.d.ts +0 -2
- package/out/ruleEngine/parent.luau +0 -34
package/out/appRegistry.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import Vide from "@rbxts/vide";
|
|
|
2
2
|
import type Types from "./types";
|
|
3
3
|
import type AppForge from "./mount";
|
|
4
4
|
export declare const AppRegistry: Map<string, Types.AppRegistry.Static>;
|
|
5
|
+
export declare const AppsLoaded: Map<`${string}-${string}`, boolean>;
|
|
5
6
|
/**
|
|
6
7
|
* Registers a Vide App with AppForge.
|
|
7
8
|
*
|
package/out/appRegistry.luau
CHANGED
|
@@ -8,6 +8,7 @@ local px = TS.import(script, script.Parent, "hooks", "usePx").px
|
|
|
8
8
|
local Logger = TS.import(script, script.Parent, "logger").default
|
|
9
9
|
local logger = Logger.new("AppRegistry")
|
|
10
10
|
local AppRegistry = {}
|
|
11
|
+
local AppsLoaded = {}
|
|
11
12
|
--[[
|
|
12
13
|
*
|
|
13
14
|
* Registers a Vide App with AppForge.
|
|
@@ -17,8 +18,12 @@ local AppRegistry = {}
|
|
|
17
18
|
]]
|
|
18
19
|
local function App(props)
|
|
19
20
|
return function(constructor)
|
|
20
|
-
local
|
|
21
|
-
if
|
|
21
|
+
local _condition = props.renderGroup
|
|
22
|
+
if _condition == nil then
|
|
23
|
+
_condition = "None"
|
|
24
|
+
end
|
|
25
|
+
local _arg0 = `{_condition}-{props.name}`
|
|
26
|
+
if AppRegistry[_arg0] ~= nil then
|
|
22
27
|
logger:log("ERROR", "Duplicate App name detected", {
|
|
23
28
|
name = props.name,
|
|
24
29
|
})
|
|
@@ -29,14 +34,18 @@ local function App(props)
|
|
|
29
34
|
logger:log("ERROR", "Attempted to register App without a name", props)
|
|
30
35
|
error("App registration failed: missing app name", 2)
|
|
31
36
|
end
|
|
32
|
-
local
|
|
37
|
+
local _condition_1 = props.renderGroup
|
|
38
|
+
if _condition_1 == nil then
|
|
39
|
+
_condition_1 = "None"
|
|
40
|
+
end
|
|
41
|
+
local _arg0_1 = `{_condition_1}-{props.name}`
|
|
33
42
|
local _arg1 = {
|
|
34
43
|
constructor = constructor,
|
|
35
44
|
renderGroup = props.renderGroup,
|
|
36
45
|
visible = props.visible,
|
|
37
46
|
rules = props.rules,
|
|
38
47
|
}
|
|
39
|
-
AppRegistry[
|
|
48
|
+
AppRegistry[_arg0_1] = _arg1
|
|
40
49
|
return constructor
|
|
41
50
|
end
|
|
42
51
|
end
|
|
@@ -71,5 +80,6 @@ end
|
|
|
71
80
|
return {
|
|
72
81
|
App = App,
|
|
73
82
|
AppRegistry = AppRegistry,
|
|
83
|
+
AppsLoaded = AppsLoaded,
|
|
74
84
|
Args = Args,
|
|
75
85
|
}
|
package/out/mount.d.ts
CHANGED
|
@@ -1,24 +1,17 @@
|
|
|
1
1
|
import Vide from "@rbxts/vide";
|
|
2
|
-
import Renders from "./
|
|
2
|
+
import Renders from "./renders";
|
|
3
3
|
import Debugger from "./debugger";
|
|
4
4
|
import Logger from "./logger";
|
|
5
5
|
import Types from "./types";
|
|
6
6
|
type Destructor = () => void;
|
|
7
|
-
type Loaded = {
|
|
8
|
-
container: Vide.Node;
|
|
9
|
-
render: Vide.Node;
|
|
10
|
-
anchor?: Vide.Node;
|
|
11
|
-
};
|
|
12
7
|
export default class AppForge extends Renders {
|
|
13
8
|
readonly logger: Logger;
|
|
14
9
|
readonly debug: Debugger;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
protected innerMount?: Destructor;
|
|
10
|
+
private sources;
|
|
11
|
+
private innerMount?;
|
|
18
12
|
constructor();
|
|
19
|
-
|
|
13
|
+
private createSource;
|
|
20
14
|
getSource(name: AppNames): Vide.Source<boolean>;
|
|
21
|
-
isLoaded(name: AppNames): boolean;
|
|
22
15
|
bind(name: AppNames, value: Vide.Source<boolean>): void;
|
|
23
16
|
set(name: AppNames, value: boolean, rules?: boolean): void;
|
|
24
17
|
open(name: AppNames, rules?: boolean): void;
|
|
@@ -28,6 +21,6 @@ export default class AppForge extends Renders {
|
|
|
28
21
|
render?: Types.Props.Render;
|
|
29
22
|
minScale?: number;
|
|
30
23
|
}): Frame;
|
|
31
|
-
mount(
|
|
24
|
+
mount(props: Exclude<Types.Props.Main, "forge">, target: Instance, root?: () => GuiObject | Instance): Destructor | undefined;
|
|
32
25
|
}
|
|
33
26
|
export {};
|
package/out/mount.luau
CHANGED
|
@@ -8,11 +8,10 @@ local Vide = _vide
|
|
|
8
8
|
local apply = _vide.apply
|
|
9
9
|
local create = _vide.create
|
|
10
10
|
local effect = _vide.effect
|
|
11
|
-
local mount = _vide.mount
|
|
12
11
|
local source = _vide.source
|
|
13
12
|
local untrack = _vide.untrack
|
|
14
13
|
-- Classes
|
|
15
|
-
local Renders = TS.import(script, script.Parent, "
|
|
14
|
+
local Renders = TS.import(script, script.Parent, "renders").default
|
|
16
15
|
-- Helpers
|
|
17
16
|
local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
|
|
18
17
|
local Debugger = TS.import(script, script.Parent, "debugger").default
|
|
@@ -38,7 +37,6 @@ do
|
|
|
38
37
|
return self.logger:log(level, msg, data, trace)
|
|
39
38
|
end)
|
|
40
39
|
self.sources = {}
|
|
41
|
-
self.loaded = {}
|
|
42
40
|
-- ▼ ReadonlyMap.forEach ▼
|
|
43
41
|
local _callback = function(_, name)
|
|
44
42
|
return self:createSource(name)
|
|
@@ -49,8 +47,8 @@ do
|
|
|
49
47
|
-- ▲ ReadonlyMap.forEach ▲
|
|
50
48
|
end
|
|
51
49
|
function AppForge:createSource(name)
|
|
52
|
-
local
|
|
53
|
-
local app = AppRegistry[
|
|
50
|
+
local _arg0 = `-{name}`
|
|
51
|
+
local app = AppRegistry[_arg0]
|
|
54
52
|
if not app then
|
|
55
53
|
self.logger:log("ERROR", "App not registered while creating source", {
|
|
56
54
|
name = name,
|
|
@@ -58,8 +56,8 @@ do
|
|
|
58
56
|
return nil
|
|
59
57
|
end
|
|
60
58
|
local _sources = self.sources
|
|
61
|
-
local
|
|
62
|
-
if _sources[
|
|
59
|
+
local _name = name
|
|
60
|
+
if _sources[_name] ~= nil then
|
|
63
61
|
return nil
|
|
64
62
|
end
|
|
65
63
|
local _debug = self.debug
|
|
@@ -95,11 +93,6 @@ do
|
|
|
95
93
|
end
|
|
96
94
|
return src
|
|
97
95
|
end
|
|
98
|
-
function AppForge:isLoaded(name)
|
|
99
|
-
local _loaded = self.loaded
|
|
100
|
-
local _name = name
|
|
101
|
-
return _loaded[_name] ~= nil
|
|
102
|
-
end
|
|
103
96
|
function AppForge:bind(name, value)
|
|
104
97
|
if not RunService:IsRunning() then
|
|
105
98
|
self.debug:logTag("state", name, "Binding external visibility source")
|
|
@@ -226,14 +219,13 @@ do
|
|
|
226
219
|
_fn(_object)
|
|
227
220
|
return Container
|
|
228
221
|
end
|
|
229
|
-
function AppForge:mount(
|
|
222
|
+
function AppForge:mount(props, target, root)
|
|
230
223
|
self.debug:logTag("lifecycle", "mount", "Mounting AppForge")
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
end, target)
|
|
224
|
+
local _self = self
|
|
225
|
+
local _object = table.clone(props)
|
|
226
|
+
setmetatable(_object, nil)
|
|
227
|
+
_object.forge = self
|
|
228
|
+
_self:initalize(_object, target, root)
|
|
237
229
|
return self.innerMount
|
|
238
230
|
end
|
|
239
231
|
end
|
package/out/renders.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
import Rules from "./ruleEngine";
|
|
4
|
+
export default class Renders extends Rules {
|
|
5
|
+
private __px;
|
|
6
|
+
constructor();
|
|
7
|
+
private Render;
|
|
8
|
+
protected initalize(props: Types.Props.Main, target?: GuiObject | Instance, root?: () => GuiObject | Instance): Vide.Node;
|
|
9
|
+
}
|
package/out/renders.luau
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
5
|
+
local Vide = _vide
|
|
6
|
+
local mount = _vide.mount
|
|
7
|
+
-- Types
|
|
8
|
+
-- Components
|
|
9
|
+
-- Hooks
|
|
10
|
+
local usePx = TS.import(script, script.Parent, "hooks", "usePx").usePx
|
|
11
|
+
-- Classes
|
|
12
|
+
local Rules = TS.import(script, script.Parent, "ruleEngine").default
|
|
13
|
+
local Renders
|
|
14
|
+
do
|
|
15
|
+
local super = Rules
|
|
16
|
+
Renders = setmetatable({}, {
|
|
17
|
+
__tostring = function()
|
|
18
|
+
return "Renders"
|
|
19
|
+
end,
|
|
20
|
+
__index = super,
|
|
21
|
+
})
|
|
22
|
+
Renders.__index = Renders
|
|
23
|
+
function Renders.new(...)
|
|
24
|
+
local self = setmetatable({}, Renders)
|
|
25
|
+
return self:constructor(...) or self
|
|
26
|
+
end
|
|
27
|
+
function Renders:constructor()
|
|
28
|
+
super.constructor(self)
|
|
29
|
+
self.__px = false
|
|
30
|
+
end
|
|
31
|
+
function Renders:Render(props)
|
|
32
|
+
print(props)
|
|
33
|
+
end
|
|
34
|
+
function Renders:initalize(props, target, root)
|
|
35
|
+
if not self.__px then
|
|
36
|
+
local _result = props.config
|
|
37
|
+
if _result ~= nil then
|
|
38
|
+
_result = _result.px.target
|
|
39
|
+
end
|
|
40
|
+
local _result_1 = props.config
|
|
41
|
+
if _result_1 ~= nil then
|
|
42
|
+
_result_1 = _result_1.px.resolution
|
|
43
|
+
end
|
|
44
|
+
local _result_2 = props.config
|
|
45
|
+
if _result_2 ~= nil then
|
|
46
|
+
_result_2 = _result_2.px.minScale
|
|
47
|
+
end
|
|
48
|
+
usePx(_result, _result_1, _result_2)
|
|
49
|
+
self.__px = true
|
|
50
|
+
end
|
|
51
|
+
if target then
|
|
52
|
+
mount(if root then root else function()
|
|
53
|
+
local _attributes = table.clone(props)
|
|
54
|
+
setmetatable(_attributes, nil)
|
|
55
|
+
return Vide.jsx("screengui", {
|
|
56
|
+
Name = "App Tree",
|
|
57
|
+
ZIndexBehavior = "Sibling",
|
|
58
|
+
ResetOnSpawn = false,
|
|
59
|
+
}, Vide.jsx(self.Render, _attributes))
|
|
60
|
+
end, target)
|
|
61
|
+
else
|
|
62
|
+
local _attributes = table.clone(props)
|
|
63
|
+
setmetatable(_attributes, nil)
|
|
64
|
+
return Vide.jsx(self.Render, _attributes)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
return {
|
|
69
|
+
default = Renders,
|
|
70
|
+
}
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
-- Types
|
|
4
4
|
-- Components
|
|
5
|
-
local AppRegistry = TS.import(script, script.Parent.Parent, "appRegistry").AppRegistry
|
|
6
|
-
local function ExclusiveGroupRule(
|
|
7
|
-
local
|
|
8
|
-
local entryApp = AppRegistry[
|
|
5
|
+
local AppRegistry = TS.import(script, script.Parent.Parent.Parent, "appRegistry").AppRegistry
|
|
6
|
+
local function ExclusiveGroupRule(name, forge)
|
|
7
|
+
local _name = name
|
|
8
|
+
local entryApp = AppRegistry[_name]
|
|
9
9
|
local _group = entryApp
|
|
10
10
|
if _group ~= nil then
|
|
11
11
|
_group = _group.rules
|
|
@@ -17,14 +17,14 @@ local function ExclusiveGroupRule(entry, forge)
|
|
|
17
17
|
if not (group ~= "" and group) then
|
|
18
18
|
return nil
|
|
19
19
|
end
|
|
20
|
-
local entryVisible = forge:getSource(
|
|
20
|
+
local entryVisible = forge:getSource(name)()
|
|
21
21
|
if not entryVisible then
|
|
22
22
|
return nil
|
|
23
23
|
end
|
|
24
|
-
forge.debug:logTag("rules",
|
|
24
|
+
forge.debug:logTag("rules", name, "Exclusive group activated", group)
|
|
25
25
|
-- ▼ ReadonlyMap.forEach ▼
|
|
26
26
|
local _callback = function(app, name)
|
|
27
|
-
if name ==
|
|
27
|
+
if name == name then
|
|
28
28
|
return nil
|
|
29
29
|
end
|
|
30
30
|
local _result = app.rules
|
|
@@ -38,7 +38,7 @@ local function ExclusiveGroupRule(entry, forge)
|
|
|
38
38
|
if not visible then
|
|
39
39
|
return nil
|
|
40
40
|
end
|
|
41
|
-
forge.debug:logTag("rules",
|
|
41
|
+
forge.debug:logTag("rules", name, "Closing app due to exclusive group", {
|
|
42
42
|
closed = name,
|
|
43
43
|
group = group,
|
|
44
44
|
})
|
|
@@ -0,0 +1,37 @@
|
|
|
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.Parent, "appRegistry").AppRegistry
|
|
6
|
+
local function ParentRule(name, forge)
|
|
7
|
+
local _name = name
|
|
8
|
+
local entry = AppRegistry[_name]
|
|
9
|
+
local _result = entry
|
|
10
|
+
if _result ~= nil then
|
|
11
|
+
_result = _result.rules
|
|
12
|
+
if _result ~= nil then
|
|
13
|
+
_result = _result.parent
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
if not (_result ~= "" and _result) then
|
|
17
|
+
return nil
|
|
18
|
+
end
|
|
19
|
+
local _forge = forge
|
|
20
|
+
local _result_1 = entry
|
|
21
|
+
if _result_1 ~= nil then
|
|
22
|
+
_result_1 = _result_1.rules
|
|
23
|
+
if _result_1 ~= nil then
|
|
24
|
+
_result_1 = _result_1.parent
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
local parentSource = _forge:getSource(_result_1)
|
|
28
|
+
if not parentSource() then
|
|
29
|
+
local source = forge:getSource(name)
|
|
30
|
+
if source() then
|
|
31
|
+
source(false)
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
return {
|
|
36
|
+
default = ParentRule,
|
|
37
|
+
}
|
package/out/ruleEngine/init.luau
CHANGED
|
@@ -4,8 +4,9 @@ local TS = _G[script]
|
|
|
4
4
|
-- Components
|
|
5
5
|
local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
|
|
6
6
|
-- Rules
|
|
7
|
-
local ExclusiveGroupRule = TS.import(script, script, "exclusiveGroup").default
|
|
8
|
-
local ParentRule = TS.import(script, script, "parent").default
|
|
7
|
+
local ExclusiveGroupRule = TS.import(script, script, "check", "exclusiveGroup").default
|
|
8
|
+
local ParentRule = TS.import(script, script, "check", "parent").default
|
|
9
|
+
local AnchorRule = TS.import(script, script, "render", "anchor").default
|
|
9
10
|
local Rules
|
|
10
11
|
do
|
|
11
12
|
Rules = setmetatable({}, {
|
|
@@ -34,14 +35,13 @@ do
|
|
|
34
35
|
-- Parent Anchor
|
|
35
36
|
local _condition = rules.parent
|
|
36
37
|
if _condition ~= "" and _condition then
|
|
37
|
-
_condition = not rules.
|
|
38
|
+
_condition = not rules.anchor
|
|
38
39
|
end
|
|
39
40
|
if _condition ~= "" and _condition then
|
|
40
41
|
forge.debug:logTag("rules", name, "Applying parent anchor", {
|
|
41
42
|
parent = rules.parent,
|
|
42
43
|
})
|
|
43
|
-
|
|
44
|
-
-- forge.anchor(name, rules.parent, props);
|
|
44
|
+
AnchorRule(name, props)
|
|
45
45
|
end
|
|
46
46
|
-- Index
|
|
47
47
|
if rules.zIndex ~= nil then
|
|
@@ -0,0 +1,38 @@
|
|
|
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.Parent, "appRegistry")
|
|
6
|
+
local AppRegistry = _appRegistry.AppRegistry
|
|
7
|
+
local AppsLoaded = _appRegistry.AppsLoaded
|
|
8
|
+
local function anchor(name, props)
|
|
9
|
+
local _binding = props
|
|
10
|
+
local forge = _binding.forge
|
|
11
|
+
local _name = name
|
|
12
|
+
local app = AppRegistry[_name]
|
|
13
|
+
local _result = app
|
|
14
|
+
if _result ~= nil then
|
|
15
|
+
_result = _result.renderGroup
|
|
16
|
+
end
|
|
17
|
+
local _condition = _result
|
|
18
|
+
if _condition == nil then
|
|
19
|
+
_condition = "None"
|
|
20
|
+
end
|
|
21
|
+
local _arg0 = `{_condition}-{name}`
|
|
22
|
+
local loaded = AppsLoaded[_arg0]
|
|
23
|
+
local _result_1 = app
|
|
24
|
+
if _result_1 ~= nil then
|
|
25
|
+
_result_1 = _result_1.rules
|
|
26
|
+
if _result_1 ~= nil then
|
|
27
|
+
_result_1 = _result_1.parent
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
local parentApp = AppRegistry[_result_1]
|
|
31
|
+
if not parentApp then
|
|
32
|
+
forge.debug:logTag("rules", name, `Has no Parent to Anchor to, Remove the Anchor For {name}`)
|
|
33
|
+
end
|
|
34
|
+
print(`App: {app} \n Loaded: {loaded} \n parentApp: {parentApp}`)
|
|
35
|
+
end
|
|
36
|
+
return {
|
|
37
|
+
default = anchor,
|
|
38
|
+
}
|
package/out/types.d.ts
CHANGED
|
@@ -58,12 +58,12 @@ declare namespace Types {
|
|
|
58
58
|
namespace Rules {
|
|
59
59
|
type WithParent<P> = {
|
|
60
60
|
parent: P;
|
|
61
|
-
|
|
61
|
+
anchor?: boolean;
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
type WithoutParent = {
|
|
65
65
|
parent?: never;
|
|
66
|
-
|
|
66
|
+
anchor?: never;
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
export type Static = {
|
package/package.json
CHANGED
package/out/renderManager.d.ts
DELETED
package/out/renderManager.luau
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
-- Packages
|
|
4
|
-
-- Types
|
|
5
|
-
-- Components
|
|
6
|
-
-- Hooks
|
|
7
|
-
-- Classes
|
|
8
|
-
local Rules = TS.import(script, script.Parent, "ruleEngine").default
|
|
9
|
-
local Renders
|
|
10
|
-
do
|
|
11
|
-
local super = Rules
|
|
12
|
-
Renders = setmetatable({}, {
|
|
13
|
-
__tostring = function()
|
|
14
|
-
return "Renders"
|
|
15
|
-
end,
|
|
16
|
-
__index = super,
|
|
17
|
-
})
|
|
18
|
-
Renders.__index = Renders
|
|
19
|
-
function Renders.new(...)
|
|
20
|
-
local self = setmetatable({}, Renders)
|
|
21
|
-
return self:constructor(...) or self
|
|
22
|
-
end
|
|
23
|
-
function Renders:constructor()
|
|
24
|
-
super.constructor(self)
|
|
25
|
-
self.__px = false
|
|
26
|
-
end
|
|
27
|
-
function Renders:initalize(props)
|
|
28
|
-
if not self.__px then
|
|
29
|
-
self.__px = true
|
|
30
|
-
end
|
|
31
|
-
props.forge.logger:log("INFO", "Initalized Renders", props.renders)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
return {
|
|
35
|
-
default = Renders,
|
|
36
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
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, "appRegistry").AppRegistry
|
|
6
|
-
local function ParentRule(entry, forge)
|
|
7
|
-
local entryVisible = forge:getSource(entry)()
|
|
8
|
-
-- ▼ ReadonlyMap.forEach ▼
|
|
9
|
-
local _callback = function(app, name)
|
|
10
|
-
local rules = app.rules
|
|
11
|
-
if not rules or rules.parent ~= entry then
|
|
12
|
-
return nil
|
|
13
|
-
end
|
|
14
|
-
if name == entry then
|
|
15
|
-
return nil
|
|
16
|
-
end
|
|
17
|
-
local childVisible = forge:getSource(name)()
|
|
18
|
-
if entryVisible or not childVisible then
|
|
19
|
-
return nil
|
|
20
|
-
end
|
|
21
|
-
forge.debug:logTag("rules", entry, "Closing child app (parent closed)", {
|
|
22
|
-
parent = entry,
|
|
23
|
-
child = name,
|
|
24
|
-
})
|
|
25
|
-
forge:close(name, false)
|
|
26
|
-
end
|
|
27
|
-
for _k, _v in AppRegistry do
|
|
28
|
-
_callback(_v, _k, AppRegistry)
|
|
29
|
-
end
|
|
30
|
-
-- ▲ ReadonlyMap.forEach ▲
|
|
31
|
-
end
|
|
32
|
-
return {
|
|
33
|
-
default = ParentRule,
|
|
34
|
-
}
|