@rbxts/app-forge 0.7.2-prototype.2 → 0.7.2-prototype.21
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 +7 -5
- package/out/appRegistry.luau +49 -26
- package/out/helpers/bindAppSource.d.ts +2 -0
- package/out/helpers/bindAppSource.luau +22 -0
- package/out/helpers/getAppEntry.d.ts +2 -0
- package/out/helpers/getAppEntry.luau +22 -0
- package/out/helpers/getAppSource.d.ts +2 -0
- package/out/helpers/getAppSource.luau +25 -0
- package/out/helpers/hasAppSource.d.ts +1 -0
- package/out/helpers/hasAppSource.luau +24 -0
- package/out/helpers/setAppSource.d.ts +1 -0
- package/out/helpers/setAppSource.luau +34 -0
- package/out/mount.d.ts +11 -19
- package/out/mount.luau +77 -69
- package/out/renders.d.ts +19 -0
- package/out/renders.luau +199 -0
- package/out/ruleEngine/check/exclusiveGroup.d.ts +2 -0
- package/out/ruleEngine/check/exclusiveGroup.luau +54 -0
- package/out/ruleEngine/check/parent.d.ts +2 -0
- package/out/ruleEngine/check/parent.luau +38 -0
- package/out/ruleEngine/index.d.ts +2 -2
- package/out/ruleEngine/init.luau +18 -15
- package/out/ruleEngine/render/anchor.d.ts +2 -0
- package/out/ruleEngine/render/anchor.luau +11 -0
- package/out/types.d.ts +17 -13
- package/package.json +8 -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/exclusiveGroup.luau +0 -54
- package/out/ruleEngine/parent.d.ts +0 -2
- package/out/ruleEngine/parent.luau +0 -34
package/out/appRegistry.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
1
|
import Vide from "@rbxts/vide";
|
|
2
2
|
import type Types from "./types";
|
|
3
3
|
import type AppForge from "./mount";
|
|
4
|
-
export declare const AppRegistry: Map<string, Types.AppRegistry.Static
|
|
4
|
+
export declare const AppRegistry: Map<string, Map<string, Types.AppRegistry.Static>>;
|
|
5
|
+
export declare const AppSources: Map<string, Map<string, Vide.Source<boolean>>>;
|
|
5
6
|
/**
|
|
6
7
|
* Registers a Vide App with AppForge.
|
|
7
8
|
*
|
|
8
9
|
* This runs at definition time and validates static configuration.
|
|
9
10
|
*/
|
|
10
|
-
export declare function App<N extends AppNames>(props: Types.AppRegistry.Props<N>): <T extends new (props: Types.Props.Main, name: AppNames) => Args>(constructor: T) => T;
|
|
11
|
+
export declare function App<N extends AppNames>(props: Types.AppRegistry.Props<N>): <T extends new (props: Types.Props.Main, name: AppNames, group?: AppGroups) => Args>(constructor: T) => T;
|
|
11
12
|
/**
|
|
12
13
|
* Base class for all AppForge Apps.
|
|
13
14
|
*/
|
|
14
15
|
export declare abstract class Args {
|
|
15
|
-
readonly
|
|
16
|
+
readonly source: Vide.Source<boolean>;
|
|
16
17
|
readonly props: Types.Props.Class;
|
|
18
|
+
readonly forge: AppForge;
|
|
19
|
+
readonly group: AppGroups;
|
|
17
20
|
readonly name: AppNames;
|
|
18
|
-
|
|
19
|
-
constructor(props: Types.Props.Main, name: AppNames);
|
|
21
|
+
constructor(props: Types.Props.Main, name: AppNames, group?: AppGroups);
|
|
20
22
|
abstract render(): Vide.Node;
|
|
21
23
|
}
|
package/out/appRegistry.luau
CHANGED
|
@@ -4,10 +4,8 @@ local TS = _G[script]
|
|
|
4
4
|
-- Types
|
|
5
5
|
-- Hooks
|
|
6
6
|
local px = TS.import(script, script.Parent, "hooks", "usePx").px
|
|
7
|
-
-- Debug
|
|
8
|
-
local Logger = TS.import(script, script.Parent, "logger").default
|
|
9
|
-
local logger = Logger.new("AppRegistry")
|
|
10
7
|
local AppRegistry = {}
|
|
8
|
+
local AppSources = {}
|
|
11
9
|
--[[
|
|
12
10
|
*
|
|
13
11
|
* Registers a Vide App with AppForge.
|
|
@@ -18,25 +16,51 @@ local AppRegistry = {}
|
|
|
18
16
|
local function App(props)
|
|
19
17
|
return function(constructor)
|
|
20
18
|
local _name = props.name
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
local _result = AppRegistry[_name]
|
|
20
|
+
if _result ~= nil then
|
|
21
|
+
local _condition = props.group
|
|
22
|
+
if not (_condition ~= "" and _condition) then
|
|
23
|
+
_condition = "None"
|
|
24
|
+
end
|
|
25
|
+
_result = _result[_condition] ~= nil
|
|
26
|
+
end
|
|
27
|
+
if _result then
|
|
28
|
+
local _exp = props.name
|
|
29
|
+
local _condition = props.group
|
|
30
|
+
if not (_condition ~= "" and _condition) then
|
|
31
|
+
_condition = "None"
|
|
32
|
+
end
|
|
33
|
+
error(`Duplicate registered App name "{_exp} in same Group name {_condition}". ` .. `App names must be globally unique.`, 2)
|
|
26
34
|
end
|
|
27
35
|
local _value = props.name
|
|
28
36
|
if not (_value ~= "" and _value) then
|
|
29
|
-
logger:log("ERROR", "Attempted to register App without a name", props)
|
|
30
37
|
error("App registration failed: missing app name", 2)
|
|
31
38
|
end
|
|
32
39
|
local _name_1 = props.name
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
+
if not AppRegistry[_name_1] then
|
|
41
|
+
local _name_2 = props.name
|
|
42
|
+
AppRegistry[_name_2] = {}
|
|
43
|
+
end
|
|
44
|
+
local _name_2 = props.name
|
|
45
|
+
local _result_1 = AppRegistry[_name_2]
|
|
46
|
+
if _result_1 ~= nil then
|
|
47
|
+
local _condition = props.group
|
|
48
|
+
if not (_condition ~= "" and _condition) then
|
|
49
|
+
_condition = "None"
|
|
50
|
+
end
|
|
51
|
+
local _object = {
|
|
52
|
+
constructor = constructor,
|
|
53
|
+
}
|
|
54
|
+
local _left = "renderGroup"
|
|
55
|
+
local _condition_1 = props.group
|
|
56
|
+
if not (_condition_1 ~= "" and _condition_1) then
|
|
57
|
+
_condition_1 = "None"
|
|
58
|
+
end
|
|
59
|
+
_object[_left] = _condition_1
|
|
60
|
+
_object.visible = props.visible
|
|
61
|
+
_object.rules = props.rules
|
|
62
|
+
_result_1[_condition] = _object
|
|
63
|
+
end
|
|
40
64
|
return constructor
|
|
41
65
|
end
|
|
42
66
|
end
|
|
@@ -48,28 +72,27 @@ end
|
|
|
48
72
|
local Args
|
|
49
73
|
do
|
|
50
74
|
Args = {}
|
|
51
|
-
function Args:constructor(props, name)
|
|
75
|
+
function Args:constructor(props, name, group)
|
|
52
76
|
local _binding = props
|
|
53
77
|
local forge = _binding.forge
|
|
54
78
|
self.forge = forge
|
|
79
|
+
local _condition = group
|
|
80
|
+
if not (_condition ~= "" and _condition) then
|
|
81
|
+
_condition = "None"
|
|
82
|
+
end
|
|
83
|
+
self.group = _condition
|
|
55
84
|
self.name = name
|
|
56
85
|
local _object = table.clone(props.props)
|
|
57
86
|
setmetatable(_object, nil)
|
|
58
|
-
_object.px = px
|
|
59
87
|
_object.forge = forge
|
|
88
|
+
_object.px = px
|
|
60
89
|
self.props = _object
|
|
61
|
-
|
|
62
|
-
if not src then
|
|
63
|
-
logger:log("ERROR", "Missing visibility source for App", {
|
|
64
|
-
name = name,
|
|
65
|
-
})
|
|
66
|
-
error(`Failed to retrieve visibility source for app "{name}"`, 2)
|
|
67
|
-
end
|
|
68
|
-
self.source = src
|
|
90
|
+
self.source = forge:getSource(name, group)
|
|
69
91
|
end
|
|
70
92
|
end
|
|
71
93
|
return {
|
|
72
94
|
App = App,
|
|
73
95
|
AppRegistry = AppRegistry,
|
|
96
|
+
AppSources = AppSources,
|
|
74
97
|
Args = Args,
|
|
75
98
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
-- Components
|
|
5
|
+
local AppSources = TS.import(script, script.Parent.Parent, "appRegistry").AppSources
|
|
6
|
+
local function bindAppSource(name, group, value)
|
|
7
|
+
local _name = name
|
|
8
|
+
if not AppSources[_name] then
|
|
9
|
+
local _name_1 = name
|
|
10
|
+
AppSources[_name_1] = {}
|
|
11
|
+
end
|
|
12
|
+
local _name_1 = name
|
|
13
|
+
local _result = AppSources[_name_1]
|
|
14
|
+
if _result ~= nil then
|
|
15
|
+
local _group = group
|
|
16
|
+
local _value = value
|
|
17
|
+
_result[_group] = _value
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
return {
|
|
21
|
+
default = bindAppSource,
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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 getAppEntry(forge, name, group)
|
|
7
|
+
local _name = name
|
|
8
|
+
local entryMap = AppRegistry[_name]
|
|
9
|
+
local _entry = entryMap
|
|
10
|
+
if _entry ~= nil then
|
|
11
|
+
local _group = group
|
|
12
|
+
_entry = _entry[_group]
|
|
13
|
+
end
|
|
14
|
+
local entry = _entry
|
|
15
|
+
if not entry then
|
|
16
|
+
forge.logger:log("WARN", `Failed to get entry for name {name} and group {group}`)
|
|
17
|
+
end
|
|
18
|
+
return entry
|
|
19
|
+
end
|
|
20
|
+
return {
|
|
21
|
+
default = getAppEntry,
|
|
22
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Types
|
|
4
|
+
-- Components
|
|
5
|
+
local AppSources = TS.import(script, script.Parent.Parent, "appRegistry").AppSources
|
|
6
|
+
local function getAppSource(forge, name, group)
|
|
7
|
+
local _name = name
|
|
8
|
+
local sourceMap = AppSources[_name]
|
|
9
|
+
if not sourceMap then
|
|
10
|
+
forge.logger:log("WARN", `Failed to get source map for name {name} and group {group}`)
|
|
11
|
+
end
|
|
12
|
+
local _source = sourceMap
|
|
13
|
+
if _source ~= nil then
|
|
14
|
+
local _group = group
|
|
15
|
+
_source = _source[_group]
|
|
16
|
+
end
|
|
17
|
+
local source = _source
|
|
18
|
+
if not source then
|
|
19
|
+
forge.logger:log("WARN", `Failed to get source for name {name} and group {group}`)
|
|
20
|
+
end
|
|
21
|
+
return source
|
|
22
|
+
end
|
|
23
|
+
return {
|
|
24
|
+
default = getAppSource,
|
|
25
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function hasAppSource(name: AppNames, group: AppGroups): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Components
|
|
4
|
+
local AppSources = TS.import(script, script.Parent.Parent, "appRegistry").AppSources
|
|
5
|
+
local function hasAppSource(name, group)
|
|
6
|
+
local _name = name
|
|
7
|
+
local sourceMap = AppSources[_name]
|
|
8
|
+
if not sourceMap then
|
|
9
|
+
local _ = false
|
|
10
|
+
end
|
|
11
|
+
local _source = sourceMap
|
|
12
|
+
if _source ~= nil then
|
|
13
|
+
local _group = group
|
|
14
|
+
_source = _source[_group]
|
|
15
|
+
end
|
|
16
|
+
local source = _source
|
|
17
|
+
if not source then
|
|
18
|
+
local _ = false
|
|
19
|
+
end
|
|
20
|
+
return true
|
|
21
|
+
end
|
|
22
|
+
return {
|
|
23
|
+
default = hasAppSource,
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function setAppSource(name: AppNames, group: AppGroups, value: boolean): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
local source = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).source
|
|
5
|
+
-- Components
|
|
6
|
+
local AppSources = TS.import(script, script.Parent.Parent, "appRegistry").AppSources
|
|
7
|
+
local function setAppSource(name, group, value)
|
|
8
|
+
local _name = name
|
|
9
|
+
if not AppSources[_name] then
|
|
10
|
+
local _name_1 = name
|
|
11
|
+
AppSources[_name_1] = {}
|
|
12
|
+
end
|
|
13
|
+
local _name_1 = name
|
|
14
|
+
local _src = AppSources[_name_1]
|
|
15
|
+
if _src ~= nil then
|
|
16
|
+
local _group = group
|
|
17
|
+
_src = _src[_group]
|
|
18
|
+
end
|
|
19
|
+
local src = _src
|
|
20
|
+
if not src then
|
|
21
|
+
local newSource = source(value)
|
|
22
|
+
local _name_2 = name
|
|
23
|
+
local _result = AppSources[_name_2]
|
|
24
|
+
if _result ~= nil then
|
|
25
|
+
local _group = group
|
|
26
|
+
_result[_group] = newSource
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
src(false)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
return {
|
|
33
|
+
default = setAppSource,
|
|
34
|
+
}
|
package/out/mount.d.ts
CHANGED
|
@@ -1,33 +1,25 @@
|
|
|
1
1
|
import Vide from "@rbxts/vide";
|
|
2
|
-
import
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
import Renders from "./renders";
|
|
3
4
|
import Debugger from "./debugger";
|
|
4
5
|
import Logger from "./logger";
|
|
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
|
-
protected loaded: Map<string, Loaded>;
|
|
17
|
-
protected innerMount?: Destructor;
|
|
10
|
+
private innerMount?;
|
|
18
11
|
constructor();
|
|
19
|
-
|
|
20
|
-
getSource(name: AppNames): Vide.Source<boolean>;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
toggle(name: AppNames, rules?: boolean): void;
|
|
12
|
+
private createSource;
|
|
13
|
+
getSource(name: AppNames, group?: AppGroups): Vide.Source<boolean>;
|
|
14
|
+
bind(name: AppNames, group: AppGroups | undefined, value: Vide.Source<boolean>): void;
|
|
15
|
+
set(name: AppNames, group: AppGroups | undefined, value: boolean, rules?: boolean): void;
|
|
16
|
+
open(name: AppNames, group?: AppGroups, rules?: boolean): void;
|
|
17
|
+
close(name: AppNames, group?: AppGroups, rules?: boolean): void;
|
|
18
|
+
toggle(name: AppNames, group?: AppGroups, rules?: boolean): void;
|
|
27
19
|
story(props: AppProps, target: GuiObject, config?: {
|
|
28
20
|
render?: Types.Props.Render;
|
|
29
21
|
minScale?: number;
|
|
30
22
|
}): Frame;
|
|
31
|
-
mount(
|
|
23
|
+
mount(props: Omit<Types.Props.Main, "forge">, target: Instance, root?: GuiObject | Instance): Destructor | undefined;
|
|
32
24
|
}
|
|
33
25
|
export {};
|
package/out/mount.luau
CHANGED
|
@@ -8,15 +8,21 @@ 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
|
-
local source = _vide.source
|
|
13
11
|
local untrack = _vide.untrack
|
|
12
|
+
-- Types
|
|
14
13
|
-- Classes
|
|
15
|
-
local Renders = TS.import(script, script.Parent, "
|
|
16
|
-
--
|
|
14
|
+
local Renders = TS.import(script, script.Parent, "renders").default
|
|
15
|
+
-- Components
|
|
17
16
|
local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
|
|
17
|
+
-- Classes
|
|
18
18
|
local Debugger = TS.import(script, script.Parent, "debugger").default
|
|
19
19
|
local Logger = TS.import(script, script.Parent, "logger").default
|
|
20
|
+
-- Helpers
|
|
21
|
+
local bindAppSource = TS.import(script, script.Parent, "helpers", "bindAppSource").default
|
|
22
|
+
local getAppSource = TS.import(script, script.Parent, "helpers", "getAppSource").default
|
|
23
|
+
local hasAppSource = TS.import(script, script.Parent, "helpers", "hasAppSource").default
|
|
24
|
+
local setAppSource = TS.import(script, script.Parent, "helpers", "setAppSource").default
|
|
25
|
+
local getAppEntry = TS.import(script, script.Parent, "helpers", "getAppEntry").default
|
|
20
26
|
local AppForge
|
|
21
27
|
do
|
|
22
28
|
local super = Renders
|
|
@@ -37,76 +43,74 @@ do
|
|
|
37
43
|
self.debug = Debugger.new(function(level, msg, data, trace)
|
|
38
44
|
return self.logger:log(level, msg, data, trace)
|
|
39
45
|
end)
|
|
40
|
-
self.sources = {}
|
|
41
|
-
self.loaded = {}
|
|
42
46
|
-- ▼ ReadonlyMap.forEach ▼
|
|
43
|
-
local _callback = function(
|
|
44
|
-
|
|
47
|
+
local _callback = function(entryMap, name)
|
|
48
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
49
|
+
local _callback_1 = function(_, group)
|
|
50
|
+
self:createSource(name, group)
|
|
51
|
+
end
|
|
52
|
+
for _k, _v in entryMap do
|
|
53
|
+
_callback_1(_v, _k, entryMap)
|
|
54
|
+
end
|
|
55
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
45
56
|
end
|
|
46
57
|
for _k, _v in AppRegistry do
|
|
47
58
|
_callback(_v, _k, AppRegistry)
|
|
48
59
|
end
|
|
49
60
|
-- ▲ ReadonlyMap.forEach ▲
|
|
50
61
|
end
|
|
51
|
-
function AppForge:createSource(name)
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
62
|
+
function AppForge:createSource(name, group)
|
|
63
|
+
if group == nil then
|
|
64
|
+
group = "None"
|
|
65
|
+
end
|
|
66
|
+
local entry = getAppEntry(self, name, group)
|
|
67
|
+
if not entry then
|
|
68
|
+
self.logger:log("ERROR", "App Entry not registered while creating source", {
|
|
56
69
|
name = name,
|
|
57
70
|
})
|
|
58
71
|
return nil
|
|
59
72
|
end
|
|
60
|
-
|
|
61
|
-
local _name_1 = name
|
|
62
|
-
if _sources[_name_1] ~= nil then
|
|
73
|
+
if hasAppSource(name, group) then
|
|
63
74
|
return nil
|
|
64
75
|
end
|
|
65
76
|
local _debug = self.debug
|
|
66
77
|
local _exp = name
|
|
67
78
|
local _object = {}
|
|
68
79
|
local _left = "default"
|
|
69
|
-
local _condition =
|
|
80
|
+
local _condition = entry.visible
|
|
70
81
|
if _condition == nil then
|
|
71
82
|
_condition = false
|
|
72
83
|
end
|
|
73
84
|
_object[_left] = _condition
|
|
74
85
|
_debug:logTag("state", _exp, "Creating visibility source", _object)
|
|
75
|
-
local _sources_1 = self.sources
|
|
76
86
|
local _exp_1 = name
|
|
77
|
-
local
|
|
87
|
+
local _exp_2 = group
|
|
88
|
+
local _condition_1 = entry.visible
|
|
78
89
|
if _condition_1 == nil then
|
|
79
90
|
_condition_1 = false
|
|
80
91
|
end
|
|
81
|
-
|
|
82
|
-
_sources_1[_exp_1] = _arg1
|
|
92
|
+
setAppSource(_exp_1, _exp_2, _condition_1)
|
|
83
93
|
end
|
|
84
|
-
function AppForge:getSource(name)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
local
|
|
92
|
-
local src = _sources_1[_name_1]
|
|
94
|
+
function AppForge:getSource(name, group)
|
|
95
|
+
if group == nil then
|
|
96
|
+
group = "None"
|
|
97
|
+
end
|
|
98
|
+
if not hasAppSource(name, group) then
|
|
99
|
+
self:createSource(name, group)
|
|
100
|
+
end
|
|
101
|
+
local src = getAppSource(self, name, group)
|
|
93
102
|
if not src then
|
|
94
|
-
|
|
103
|
+
self.logger:log("WARN", `Failed to get source for name {name} group {group}`)
|
|
95
104
|
end
|
|
96
105
|
return src
|
|
97
106
|
end
|
|
98
|
-
function AppForge:
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
end
|
|
103
|
-
function AppForge:bind(name, value)
|
|
107
|
+
function AppForge:bind(name, group, value)
|
|
108
|
+
if group == nil then
|
|
109
|
+
group = "None"
|
|
110
|
+
end
|
|
104
111
|
if not RunService:IsRunning() then
|
|
105
112
|
self.debug:logTag("state", name, "Binding external visibility source")
|
|
106
|
-
|
|
107
|
-
local _name = name
|
|
108
|
-
local _value = value
|
|
109
|
-
_sources[_name] = _value
|
|
113
|
+
bindAppSource(name, group, value)
|
|
110
114
|
local prev
|
|
111
115
|
local log = function()
|
|
112
116
|
return self.debug:logTag("state", name, "Visibility changed", {
|
|
@@ -119,7 +123,7 @@ do
|
|
|
119
123
|
count += 1
|
|
120
124
|
prev = value()
|
|
121
125
|
untrack(function()
|
|
122
|
-
return self:checkRules(self, name)
|
|
126
|
+
return self:checkRules(self, name, group)
|
|
123
127
|
end)
|
|
124
128
|
if Vide.strict and count == 2 then
|
|
125
129
|
log()
|
|
@@ -135,23 +139,15 @@ do
|
|
|
135
139
|
})
|
|
136
140
|
end
|
|
137
141
|
end
|
|
138
|
-
function AppForge:set(name, value, rules)
|
|
142
|
+
function AppForge:set(name, group, value, rules)
|
|
143
|
+
if group == nil then
|
|
144
|
+
group = "None"
|
|
145
|
+
end
|
|
139
146
|
if rules == nil then
|
|
140
147
|
rules = true
|
|
141
148
|
end
|
|
142
|
-
local
|
|
143
|
-
local _name = name
|
|
144
|
-
local src = _sources[_name]
|
|
149
|
+
local src = getAppSource(self, name, group)
|
|
145
150
|
if not src then
|
|
146
|
-
self:createSource(name)
|
|
147
|
-
local _sources_1 = self.sources
|
|
148
|
-
local _name_1 = name
|
|
149
|
-
src = _sources_1[_name_1]
|
|
150
|
-
end
|
|
151
|
-
if not src then
|
|
152
|
-
self.logger:log("ERROR", "Failed to set visibility (missing source)", {
|
|
153
|
-
name = name,
|
|
154
|
-
})
|
|
155
151
|
return nil
|
|
156
152
|
end
|
|
157
153
|
local prev = src()
|
|
@@ -164,26 +160,39 @@ do
|
|
|
164
160
|
to = value,
|
|
165
161
|
})
|
|
166
162
|
if rules then
|
|
167
|
-
self:checkRules(self, name)
|
|
163
|
+
self:checkRules(self, name, group)
|
|
168
164
|
end
|
|
169
165
|
end
|
|
170
|
-
function AppForge:open(name, rules)
|
|
166
|
+
function AppForge:open(name, group, rules)
|
|
167
|
+
if group == nil then
|
|
168
|
+
group = "None"
|
|
169
|
+
end
|
|
171
170
|
if rules == nil then
|
|
172
171
|
rules = true
|
|
173
172
|
end
|
|
174
|
-
self:set(name, true, rules)
|
|
173
|
+
self:set(name, group, true, rules)
|
|
175
174
|
end
|
|
176
|
-
function AppForge:close(name, rules)
|
|
175
|
+
function AppForge:close(name, group, rules)
|
|
176
|
+
if group == nil then
|
|
177
|
+
group = "None"
|
|
178
|
+
end
|
|
177
179
|
if rules == nil then
|
|
178
180
|
rules = true
|
|
179
181
|
end
|
|
180
|
-
self:set(name, false, rules)
|
|
182
|
+
self:set(name, group, false, rules)
|
|
181
183
|
end
|
|
182
|
-
function AppForge:toggle(name, rules)
|
|
184
|
+
function AppForge:toggle(name, group, rules)
|
|
185
|
+
if group == nil then
|
|
186
|
+
group = "None"
|
|
187
|
+
end
|
|
183
188
|
if rules == nil then
|
|
184
189
|
rules = true
|
|
185
190
|
end
|
|
186
|
-
|
|
191
|
+
local src = self:getSource(name, group)
|
|
192
|
+
if not src then
|
|
193
|
+
return self.logger:log("ERROR", `Failed to get Source for name {name} group {group}`)
|
|
194
|
+
end
|
|
195
|
+
self:set(name, group, not src(), rules)
|
|
187
196
|
end
|
|
188
197
|
function AppForge:story(props, target, config)
|
|
189
198
|
self.debug:logTag("lifecycle", "story", "Creating story mount")
|
|
@@ -226,14 +235,13 @@ do
|
|
|
226
235
|
_fn(_object)
|
|
227
236
|
return Container
|
|
228
237
|
end
|
|
229
|
-
function AppForge:mount(
|
|
238
|
+
function AppForge:mount(props, target, root)
|
|
230
239
|
self.debug:logTag("lifecycle", "mount", "Mounting AppForge")
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
end, target)
|
|
240
|
+
local _self = self
|
|
241
|
+
local _object = table.clone(props)
|
|
242
|
+
setmetatable(_object, nil)
|
|
243
|
+
_object.forge = self
|
|
244
|
+
_self:initalize(_object, target, root)
|
|
237
245
|
return self.innerMount
|
|
238
246
|
end
|
|
239
247
|
end
|
package/out/renders.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
import Rules from "./ruleEngine";
|
|
4
|
+
type Render = {
|
|
5
|
+
instance: Instance;
|
|
6
|
+
container: Instance;
|
|
7
|
+
};
|
|
8
|
+
export default class Renders extends Rules {
|
|
9
|
+
private __px;
|
|
10
|
+
protected Rendered: Map<string, Map<string, Render>>;
|
|
11
|
+
constructor();
|
|
12
|
+
Render: (props: Types.Props.Main) => Instance[];
|
|
13
|
+
private resolveGroupEntries;
|
|
14
|
+
private getGroupEntries;
|
|
15
|
+
private createRender;
|
|
16
|
+
private getChildren;
|
|
17
|
+
protected initalize(props: Types.Props.Main, target?: GuiObject | Instance, root?: GuiObject | Instance): Vide.Node;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
package/out/renders.luau
ADDED
|
@@ -0,0 +1,199 @@
|
|
|
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
|
+
local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
|
|
10
|
+
-- Hooks
|
|
11
|
+
local usePx = TS.import(script, script.Parent, "hooks", "usePx").usePx
|
|
12
|
+
-- Classes
|
|
13
|
+
local Rules = TS.import(script, script.Parent, "ruleEngine").default
|
|
14
|
+
-- Helpers
|
|
15
|
+
local getAppEntry = TS.import(script, script.Parent, "helpers", "getAppEntry").default
|
|
16
|
+
local Renders
|
|
17
|
+
do
|
|
18
|
+
local super = Rules
|
|
19
|
+
Renders = setmetatable({}, {
|
|
20
|
+
__tostring = function()
|
|
21
|
+
return "Renders"
|
|
22
|
+
end,
|
|
23
|
+
__index = super,
|
|
24
|
+
})
|
|
25
|
+
Renders.__index = Renders
|
|
26
|
+
function Renders.new(...)
|
|
27
|
+
local self = setmetatable({}, Renders)
|
|
28
|
+
return self:constructor(...) or self
|
|
29
|
+
end
|
|
30
|
+
function Renders:constructor()
|
|
31
|
+
super.constructor(self)
|
|
32
|
+
self.__px = false
|
|
33
|
+
self.Rendered = {}
|
|
34
|
+
self.Render = function(props)
|
|
35
|
+
local _binding = props
|
|
36
|
+
local forge = _binding.forge
|
|
37
|
+
local renders = _binding.renders
|
|
38
|
+
local selected = {}
|
|
39
|
+
if not renders then
|
|
40
|
+
return {}
|
|
41
|
+
end
|
|
42
|
+
if renders.groups then
|
|
43
|
+
local _exp = renders.groups
|
|
44
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
45
|
+
local _callback = function(group)
|
|
46
|
+
local entries = self:resolveGroupEntries(forge, group, renders.names, renders.name)
|
|
47
|
+
for _, entry in entries do
|
|
48
|
+
table.insert(selected, entry)
|
|
49
|
+
end
|
|
50
|
+
end
|
|
51
|
+
for _k, _v in _exp do
|
|
52
|
+
_callback(_v, _k - 1, _exp)
|
|
53
|
+
end
|
|
54
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
55
|
+
end
|
|
56
|
+
local _value = renders.group
|
|
57
|
+
if _value ~= "" and _value then
|
|
58
|
+
local entries = self:resolveGroupEntries(forge, renders.group, renders.names, renders.name)
|
|
59
|
+
for _, entry in entries do
|
|
60
|
+
table.insert(selected, entry)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
print(selected)
|
|
64
|
+
local rendered = {}
|
|
65
|
+
local _exp = self.Rendered
|
|
66
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
67
|
+
local _callback = function(entries)
|
|
68
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
69
|
+
local _callback_1 = function(entry)
|
|
70
|
+
local _container = entry.container
|
|
71
|
+
table.insert(rendered, _container)
|
|
72
|
+
end
|
|
73
|
+
for _k, _v in entries do
|
|
74
|
+
_callback_1(_v, _k, entries)
|
|
75
|
+
end
|
|
76
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
77
|
+
end
|
|
78
|
+
for _k, _v in _exp do
|
|
79
|
+
_callback(_v, _k, _exp)
|
|
80
|
+
end
|
|
81
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
82
|
+
return rendered
|
|
83
|
+
end
|
|
84
|
+
end
|
|
85
|
+
function Renders:resolveGroupEntries(forge, group, names, name)
|
|
86
|
+
local groupEntries = self:getGroupEntries(group)
|
|
87
|
+
local result = {}
|
|
88
|
+
if name ~= "" and name then
|
|
89
|
+
local _name = name
|
|
90
|
+
local _entry = groupEntries[_name]
|
|
91
|
+
if _entry ~= nil then
|
|
92
|
+
local _group = group
|
|
93
|
+
_entry = _entry[_group]
|
|
94
|
+
end
|
|
95
|
+
local entry = _entry
|
|
96
|
+
if not entry then
|
|
97
|
+
forge.logger:log("INFO", `Failed to find a Name of {name} in group {group}`)
|
|
98
|
+
else
|
|
99
|
+
table.insert(result, entry)
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
if names then
|
|
103
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
104
|
+
local _callback = function(n)
|
|
105
|
+
local _n = n
|
|
106
|
+
local _entry = groupEntries[_n]
|
|
107
|
+
if _entry ~= nil then
|
|
108
|
+
local _group = group
|
|
109
|
+
_entry = _entry[_group]
|
|
110
|
+
end
|
|
111
|
+
local entry = _entry
|
|
112
|
+
if not entry then
|
|
113
|
+
forge.logger:log("INFO", `Failed to find a Name of {n} in group {group}`)
|
|
114
|
+
else
|
|
115
|
+
table.insert(result, entry)
|
|
116
|
+
end
|
|
117
|
+
end
|
|
118
|
+
for _k, _v in names do
|
|
119
|
+
_callback(_v, _k - 1, names)
|
|
120
|
+
end
|
|
121
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
122
|
+
end
|
|
123
|
+
return result
|
|
124
|
+
end
|
|
125
|
+
function Renders:getGroupEntries(group)
|
|
126
|
+
local entries = {}
|
|
127
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
128
|
+
local _callback = function(regGroupEntries, name)
|
|
129
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
130
|
+
local _callback_1 = function(_, regGroup)
|
|
131
|
+
if group ~= regGroup then
|
|
132
|
+
return nil
|
|
133
|
+
end
|
|
134
|
+
local _entries = entries
|
|
135
|
+
local _name = name
|
|
136
|
+
local _regGroupEntries = regGroupEntries
|
|
137
|
+
_entries[_name] = _regGroupEntries
|
|
138
|
+
end
|
|
139
|
+
for _k, _v in regGroupEntries do
|
|
140
|
+
_callback_1(_v, _k, regGroupEntries)
|
|
141
|
+
end
|
|
142
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
143
|
+
end
|
|
144
|
+
for _k, _v in AppRegistry do
|
|
145
|
+
_callback(_v, _k, AppRegistry)
|
|
146
|
+
end
|
|
147
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
148
|
+
return entries
|
|
149
|
+
end
|
|
150
|
+
function Renders:createRender(forge, name, group)
|
|
151
|
+
local entry = getAppEntry(forge, name, group)
|
|
152
|
+
print(entry)
|
|
153
|
+
return nil
|
|
154
|
+
end
|
|
155
|
+
function Renders:getChildren()
|
|
156
|
+
end
|
|
157
|
+
function Renders:initalize(props, target, root)
|
|
158
|
+
if not self.__px then
|
|
159
|
+
local _result = props.config
|
|
160
|
+
if _result ~= nil then
|
|
161
|
+
_result = _result.px.target
|
|
162
|
+
end
|
|
163
|
+
local _result_1 = props.config
|
|
164
|
+
if _result_1 ~= nil then
|
|
165
|
+
_result_1 = _result_1.px.resolution
|
|
166
|
+
end
|
|
167
|
+
local _result_2 = props.config
|
|
168
|
+
if _result_2 ~= nil then
|
|
169
|
+
_result_2 = _result_2.px.minScale
|
|
170
|
+
end
|
|
171
|
+
usePx(_result, _result_1, _result_2)
|
|
172
|
+
self.__px = true
|
|
173
|
+
end
|
|
174
|
+
if target then
|
|
175
|
+
mount(function()
|
|
176
|
+
local _result
|
|
177
|
+
if root then
|
|
178
|
+
_result = root
|
|
179
|
+
else
|
|
180
|
+
local _attributes = table.clone(props)
|
|
181
|
+
setmetatable(_attributes, nil)
|
|
182
|
+
_result = (Vide.jsx("screengui", {
|
|
183
|
+
Name = "App Tree",
|
|
184
|
+
ZIndexBehavior = "Sibling",
|
|
185
|
+
ResetOnSpawn = false,
|
|
186
|
+
}, Vide.jsx(self.Render, _attributes)))
|
|
187
|
+
end
|
|
188
|
+
return _result
|
|
189
|
+
end)
|
|
190
|
+
else
|
|
191
|
+
local _attributes = table.clone(props)
|
|
192
|
+
setmetatable(_attributes, nil)
|
|
193
|
+
return Vide.jsx(self.Render, _attributes)
|
|
194
|
+
end
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
return {
|
|
198
|
+
default = Renders,
|
|
199
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
-- Helpers
|
|
7
|
+
local getAppEntry = TS.import(script, script.Parent.Parent.Parent, "helpers", "getAppEntry").default
|
|
8
|
+
local function ExclusiveGroupRule(forge, name, group)
|
|
9
|
+
local entry = getAppEntry(forge, name, group)
|
|
10
|
+
if not entry then
|
|
11
|
+
forge.logger:log("ERROR", `Failed to find app entry for "ExclusiveGroupRule" name {name} group {group} `)
|
|
12
|
+
end
|
|
13
|
+
local entryVisible = forge:getSource(name, group)()
|
|
14
|
+
if not entryVisible then
|
|
15
|
+
return nil
|
|
16
|
+
end
|
|
17
|
+
forge.debug:logTag("rules", name, "Exclusive group activated", group)
|
|
18
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
19
|
+
local _callback = function(entryMap, entryGroup)
|
|
20
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
21
|
+
local _callback_1 = function(entry, entryName)
|
|
22
|
+
if name == entryName then
|
|
23
|
+
return nil
|
|
24
|
+
end
|
|
25
|
+
local _result = entry.rules
|
|
26
|
+
if _result ~= nil then
|
|
27
|
+
_result = _result.exclusiveGroup
|
|
28
|
+
end
|
|
29
|
+
if _result ~= entryGroup then
|
|
30
|
+
return nil
|
|
31
|
+
end
|
|
32
|
+
local visible = forge:getSource(entryName)()
|
|
33
|
+
if not visible then
|
|
34
|
+
return nil
|
|
35
|
+
end
|
|
36
|
+
forge.debug:logTag("rules", entryName, "Closing app due to exclusive group", {
|
|
37
|
+
closed = entryName,
|
|
38
|
+
entryGroup = entryGroup,
|
|
39
|
+
})
|
|
40
|
+
forge:close(entryName, entryGroup, false)
|
|
41
|
+
end
|
|
42
|
+
for _k, _v in entryMap do
|
|
43
|
+
_callback_1(_v, _k, entryMap)
|
|
44
|
+
end
|
|
45
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
46
|
+
end
|
|
47
|
+
for _k, _v in AppRegistry do
|
|
48
|
+
_callback(_v, _k, AppRegistry)
|
|
49
|
+
end
|
|
50
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
51
|
+
end
|
|
52
|
+
return {
|
|
53
|
+
default = ExclusiveGroupRule,
|
|
54
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Types
|
|
4
|
+
-- Helpers
|
|
5
|
+
local getAppSource = TS.import(script, script.Parent.Parent.Parent, "helpers", "getAppSource").default
|
|
6
|
+
local getAppEntry = TS.import(script, script.Parent.Parent.Parent, "helpers", "getAppEntry").default
|
|
7
|
+
local function ParentRule(forge, name, group)
|
|
8
|
+
local entry = getAppEntry(forge, name, group)
|
|
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 _exp = forge
|
|
20
|
+
local _exp_1 = entry.rules.parent
|
|
21
|
+
local _condition = entry.rules.parentGroup
|
|
22
|
+
if _condition == nil then
|
|
23
|
+
_condition = "None"
|
|
24
|
+
end
|
|
25
|
+
local parentSource = getAppSource(_exp, _exp_1, _condition)
|
|
26
|
+
if parentSource and parentSource() == false then
|
|
27
|
+
local source = forge:getSource(name, group)
|
|
28
|
+
if not source then
|
|
29
|
+
return forge.logger:log("ERROR", `Failed to get Source for name {name} group {group}`)
|
|
30
|
+
end
|
|
31
|
+
if source() then
|
|
32
|
+
source(false)
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
return {
|
|
37
|
+
default = ParentRule,
|
|
38
|
+
}
|
|
@@ -2,6 +2,6 @@ import type AppForge from "../mount";
|
|
|
2
2
|
import type Types from "../types";
|
|
3
3
|
export default class Rules {
|
|
4
4
|
protected processing: Set<string>;
|
|
5
|
-
protected renderRules(forge: AppForge, name: AppNames, props: Types.Props.Main): void;
|
|
6
|
-
protected checkRules(forge: AppForge, name: AppNames): void;
|
|
5
|
+
protected renderRules(forge: AppForge, name: AppNames, group: AppGroups | undefined, props: Types.Props.Main): void;
|
|
6
|
+
protected checkRules(forge: AppForge, name: AppNames, group: AppGroups): void;
|
|
7
7
|
}
|
package/out/ruleEngine/init.luau
CHANGED
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
-- Types
|
|
4
4
|
-- Components
|
|
5
|
-
local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
|
|
6
5
|
-- Rules
|
|
7
|
-
local ExclusiveGroupRule = TS.import(script, script, "exclusiveGroup").default
|
|
8
|
-
local
|
|
6
|
+
local ExclusiveGroupRule = TS.import(script, script, "check", "exclusiveGroup").default
|
|
7
|
+
local AnchorRule = TS.import(script, script, "render", "anchor").default
|
|
8
|
+
local ParentRule = TS.import(script, script, "check", "parent").default
|
|
9
|
+
-- Helpers
|
|
10
|
+
local getAppEntry = TS.import(script, script.Parent, "helpers", "getAppEntry").default
|
|
9
11
|
local Rules
|
|
10
12
|
do
|
|
11
13
|
Rules = setmetatable({}, {
|
|
@@ -21,27 +23,28 @@ do
|
|
|
21
23
|
function Rules:constructor()
|
|
22
24
|
self.processing = {}
|
|
23
25
|
end
|
|
24
|
-
function Rules:renderRules(forge, name, props)
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
26
|
+
function Rules:renderRules(forge, name, group, props)
|
|
27
|
+
if group == nil then
|
|
28
|
+
group = "None"
|
|
29
|
+
end
|
|
30
|
+
local entry = getAppEntry(forge, name, group)
|
|
31
|
+
if not entry then
|
|
32
|
+
error(`renderRules: App Entry name "{name}" group "{group}" not registered`, 2)
|
|
29
33
|
end
|
|
30
|
-
local rules =
|
|
34
|
+
local rules = entry.rules
|
|
31
35
|
if not rules then
|
|
32
36
|
return nil
|
|
33
37
|
end
|
|
34
38
|
-- Parent Anchor
|
|
35
39
|
local _condition = rules.parent
|
|
36
40
|
if _condition ~= "" and _condition then
|
|
37
|
-
_condition = not rules.
|
|
41
|
+
_condition = not rules.anchor
|
|
38
42
|
end
|
|
39
43
|
if _condition ~= "" and _condition then
|
|
40
44
|
forge.debug:logTag("rules", name, "Applying parent anchor", {
|
|
41
45
|
parent = rules.parent,
|
|
42
46
|
})
|
|
43
|
-
|
|
44
|
-
-- forge.anchor(name, rules.parent, props);
|
|
47
|
+
AnchorRule(name, group, props)
|
|
45
48
|
end
|
|
46
49
|
-- Index
|
|
47
50
|
if rules.zIndex ~= nil then
|
|
@@ -50,7 +53,7 @@ do
|
|
|
50
53
|
-- forge.index(name, rules.zIndex);
|
|
51
54
|
end
|
|
52
55
|
end
|
|
53
|
-
function Rules:checkRules(forge, name)
|
|
56
|
+
function Rules:checkRules(forge, name, group)
|
|
54
57
|
local _processing = self.processing
|
|
55
58
|
local _name = name
|
|
56
59
|
if _processing[_name] ~= nil then
|
|
@@ -62,8 +65,8 @@ do
|
|
|
62
65
|
_processing_1[_name_1] = true
|
|
63
66
|
forge.debug:logTag("rules", name, "Evaluating rules")
|
|
64
67
|
TS.try(function()
|
|
65
|
-
ParentRule(name,
|
|
66
|
-
ExclusiveGroupRule(name,
|
|
68
|
+
ParentRule(forge, name, group)
|
|
69
|
+
ExclusiveGroupRule(forge, name, group)
|
|
67
70
|
end, nil, function()
|
|
68
71
|
local _processing_2 = self.processing
|
|
69
72
|
local _name_2 = name
|
package/out/types.d.ts
CHANGED
|
@@ -4,12 +4,12 @@ import type AppForge from "./mount";
|
|
|
4
4
|
|
|
5
5
|
declare namespace Types {
|
|
6
6
|
namespace Props {
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
| {
|
|
10
|
-
| {
|
|
11
|
-
|
|
12
|
-
|
|
7
|
+
type NameSelector = { name: AppNames; names?: never } | { names: AppNames[]; name?: never };
|
|
8
|
+
type GroupSelector =
|
|
9
|
+
| { group: AppGroups; groups?: never }
|
|
10
|
+
| { groups: AppGroups[]; group?: never };
|
|
11
|
+
|
|
12
|
+
export type Render = NameSelector & GroupSelector;
|
|
13
13
|
|
|
14
14
|
type Main = {
|
|
15
15
|
props: AppProps;
|
|
@@ -34,23 +34,23 @@ declare namespace Types {
|
|
|
34
34
|
type Props<N extends AppNames> = {
|
|
35
35
|
name: N;
|
|
36
36
|
visible?: boolean;
|
|
37
|
-
|
|
37
|
+
group?: AppGroups;
|
|
38
38
|
rules?: Rules.Generic<N>;
|
|
39
39
|
};
|
|
40
40
|
|
|
41
41
|
type Static = {
|
|
42
|
-
constructor: new (props: Types.Props.Main, name: AppNames) => Args;
|
|
42
|
+
constructor: new (props: Types.Props.Main, name: AppNames, group?: AppGroups) => Args;
|
|
43
43
|
|
|
44
44
|
visible?: boolean;
|
|
45
|
-
|
|
45
|
+
group?: AppGroups;
|
|
46
46
|
rules?: Rules.Static;
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
type Generic<N extends AppNames = AppNames> = {
|
|
50
|
-
constructor: new (props: Types.Props.Main, name: AppNames) => Args;
|
|
50
|
+
constructor: new (props: Types.Props.Main, name: AppNames, group?: AppGroups) => Args;
|
|
51
51
|
|
|
52
52
|
visible?: boolean;
|
|
53
|
-
|
|
53
|
+
group?: AppGroups;
|
|
54
54
|
rules?: Rules.Generic<N>;
|
|
55
55
|
};
|
|
56
56
|
}
|
|
@@ -58,12 +58,16 @@ declare namespace Types {
|
|
|
58
58
|
namespace Rules {
|
|
59
59
|
type WithParent<P> = {
|
|
60
60
|
parent: P;
|
|
61
|
-
|
|
61
|
+
|
|
62
|
+
parentGroup?: AppGroups;
|
|
63
|
+
anchor?: boolean;
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
type WithoutParent = {
|
|
65
67
|
parent?: never;
|
|
66
|
-
|
|
68
|
+
|
|
69
|
+
parentGroup?: never;
|
|
70
|
+
anchor?: never;
|
|
67
71
|
};
|
|
68
72
|
|
|
69
73
|
export type Static = {
|
package/package.json
CHANGED
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rbxts/app-forge",
|
|
3
|
-
"version": "0.7.2-prototype.
|
|
3
|
+
"version": "0.7.2-prototype.21",
|
|
4
4
|
"description": "An App Manager for Vide",
|
|
5
5
|
"main": "out/init.lua",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
7
7
|
"packageManager": "bun@1.3.1",
|
|
8
|
+
|
|
8
9
|
"scripts": {
|
|
9
10
|
"build": "rbxtsc",
|
|
10
11
|
"dev": "rbxtsc -w --type game --rojo test.project.json",
|
|
11
12
|
"login": "bunx npm login --auth-type=legacy"
|
|
12
13
|
},
|
|
14
|
+
|
|
13
15
|
"keywords": [
|
|
14
16
|
"roblox-ts",
|
|
15
17
|
"react",
|
|
@@ -17,6 +19,7 @@
|
|
|
17
19
|
],
|
|
18
20
|
"author": "loner1536",
|
|
19
21
|
"license": "MIT",
|
|
22
|
+
|
|
20
23
|
"repository": {
|
|
21
24
|
"type": "git",
|
|
22
25
|
"url": "https://github.com/Loner1536/AppForge"
|
|
@@ -24,15 +27,18 @@
|
|
|
24
27
|
"bugs": {
|
|
25
28
|
"url": "https://github.com/Loner1536/AppForge/issues"
|
|
26
29
|
},
|
|
30
|
+
|
|
27
31
|
"files": [
|
|
28
32
|
"out",
|
|
29
33
|
"!**/*.tsbuildinfo",
|
|
30
34
|
"!**/*.spec.lua",
|
|
31
35
|
"!**/*.spec.d.ts"
|
|
32
36
|
],
|
|
37
|
+
|
|
33
38
|
"publishConfig": {
|
|
34
39
|
"access": "public"
|
|
35
40
|
},
|
|
41
|
+
|
|
36
42
|
"dependencies": {
|
|
37
43
|
"@rbxts/set-timeout": "^1.1.2",
|
|
38
44
|
"@rbxts/services": "^1.6.0",
|
|
@@ -43,6 +49,7 @@
|
|
|
43
49
|
"optional": true
|
|
44
50
|
}
|
|
45
51
|
},
|
|
52
|
+
|
|
46
53
|
"devDependencies": {
|
|
47
54
|
"@rbxts/compiler-types": "3.0.0-types.0",
|
|
48
55
|
"@biomejs/biome": "^2.3.7",
|
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,54 +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 ExclusiveGroupRule(entry, forge)
|
|
7
|
-
local _entry = entry
|
|
8
|
-
local entryApp = AppRegistry[_entry]
|
|
9
|
-
local _group = entryApp
|
|
10
|
-
if _group ~= nil then
|
|
11
|
-
_group = _group.rules
|
|
12
|
-
if _group ~= nil then
|
|
13
|
-
_group = _group.exclusiveGroup
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
local group = _group
|
|
17
|
-
if not (group ~= "" and group) then
|
|
18
|
-
return nil
|
|
19
|
-
end
|
|
20
|
-
local entryVisible = forge:getSource(entry)()
|
|
21
|
-
if not entryVisible then
|
|
22
|
-
return nil
|
|
23
|
-
end
|
|
24
|
-
forge.debug:logTag("rules", entry, "Exclusive group activated", group)
|
|
25
|
-
-- ▼ ReadonlyMap.forEach ▼
|
|
26
|
-
local _callback = function(app, name)
|
|
27
|
-
if name == entry then
|
|
28
|
-
return nil
|
|
29
|
-
end
|
|
30
|
-
local _result = app.rules
|
|
31
|
-
if _result ~= nil then
|
|
32
|
-
_result = _result.exclusiveGroup
|
|
33
|
-
end
|
|
34
|
-
if _result ~= group then
|
|
35
|
-
return nil
|
|
36
|
-
end
|
|
37
|
-
local visible = forge:getSource(name)()
|
|
38
|
-
if not visible then
|
|
39
|
-
return nil
|
|
40
|
-
end
|
|
41
|
-
forge.debug:logTag("rules", entry, "Closing app due to exclusive group", {
|
|
42
|
-
closed = name,
|
|
43
|
-
group = group,
|
|
44
|
-
})
|
|
45
|
-
forge:close(name, false)
|
|
46
|
-
end
|
|
47
|
-
for _k, _v in AppRegistry do
|
|
48
|
-
_callback(_v, _k, AppRegistry)
|
|
49
|
-
end
|
|
50
|
-
-- ▲ ReadonlyMap.forEach ▲
|
|
51
|
-
end
|
|
52
|
-
return {
|
|
53
|
-
default = ExclusiveGroupRule,
|
|
54
|
-
}
|
|
@@ -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
|
-
}
|