@rbxts/app-forge 0.7.2-prototype.6 → 0.7.2-prototype.8
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 -6
- package/out/appRegistry.luau +35 -36
- 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 +7 -8
- package/out/mount.luau +66 -54
- package/out/renders.luau +5 -0
- package/out/ruleEngine/check/exclusiveGroup.d.ts +1 -1
- package/out/ruleEngine/check/exclusiveGroup.luau +31 -31
- package/out/ruleEngine/check/parent.d.ts +1 -1
- package/out/ruleEngine/check/parent.luau +16 -15
- package/out/ruleEngine/index.d.ts +2 -2
- package/out/ruleEngine/init.luau +15 -12
- package/out/ruleEngine/render/anchor.d.ts +1 -1
- package/out/ruleEngine/render/anchor.luau +4 -31
- package/out/types.d.ts +9 -5
- package/package.json +1 -1
package/out/appRegistry.d.ts
CHANGED
|
@@ -1,22 +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
|
|
5
|
-
export declare const
|
|
4
|
+
export declare const AppRegistry: Map<string, Map<string, Types.AppRegistry.Static>>;
|
|
5
|
+
export declare const AppSources: Map<string, Map<string, Vide.Source<boolean>>>;
|
|
6
6
|
/**
|
|
7
7
|
* Registers a Vide App with AppForge.
|
|
8
8
|
*
|
|
9
9
|
* This runs at definition time and validates static configuration.
|
|
10
10
|
*/
|
|
11
|
-
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;
|
|
12
12
|
/**
|
|
13
13
|
* Base class for all AppForge Apps.
|
|
14
14
|
*/
|
|
15
15
|
export declare abstract class Args {
|
|
16
|
-
readonly
|
|
16
|
+
readonly source: Vide.Source<boolean>;
|
|
17
17
|
readonly props: Types.Props.Class;
|
|
18
|
+
readonly forge: AppForge;
|
|
19
|
+
readonly group: AppGroups;
|
|
18
20
|
readonly name: AppNames;
|
|
19
|
-
|
|
20
|
-
constructor(props: Types.Props.Main, name: AppNames);
|
|
21
|
+
constructor(props: Types.Props.Main, name: AppNames, group: AppGroups);
|
|
21
22
|
abstract render(): Vide.Node;
|
|
22
23
|
}
|
package/out/appRegistry.luau
CHANGED
|
@@ -4,11 +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 = {}
|
|
11
|
-
local
|
|
8
|
+
local AppSources = {}
|
|
12
9
|
--[[
|
|
13
10
|
*
|
|
14
11
|
* Registers a Vide App with AppForge.
|
|
@@ -18,34 +15,42 @@ local AppsLoaded = {}
|
|
|
18
15
|
]]
|
|
19
16
|
local function App(props)
|
|
20
17
|
return function(constructor)
|
|
21
|
-
local
|
|
22
|
-
|
|
23
|
-
|
|
18
|
+
local _name = props.name
|
|
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
|
|
24
26
|
end
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
logger:log("ERROR", "Duplicate App name detected", {
|
|
28
|
-
name = props.name,
|
|
29
|
-
})
|
|
30
|
-
error(`Duplicate registered App name "{props.name}". ` .. `App names must be globally unique.`, 2)
|
|
27
|
+
if _result then
|
|
28
|
+
error(`Duplicate registered App name "{props.name} in same Group name {props.group}". ` .. `App names must be globally unique.`, 2)
|
|
31
29
|
end
|
|
32
30
|
local _value = props.name
|
|
33
31
|
if not (_value ~= "" and _value) then
|
|
34
|
-
logger:log("ERROR", "Attempted to register App without a name", props)
|
|
35
32
|
error("App registration failed: missing app name", 2)
|
|
36
33
|
end
|
|
37
|
-
local
|
|
38
|
-
if
|
|
39
|
-
|
|
34
|
+
local _name_1 = props.name
|
|
35
|
+
if not AppRegistry[_name_1] then
|
|
36
|
+
local _name_2 = props.name
|
|
37
|
+
AppRegistry[_name_2] = {}
|
|
38
|
+
end
|
|
39
|
+
local _name_2 = props.name
|
|
40
|
+
local _result_1 = AppRegistry[_name_2]
|
|
41
|
+
if _result_1 ~= nil then
|
|
42
|
+
local _condition = props.group
|
|
43
|
+
if not (_condition ~= "" and _condition) then
|
|
44
|
+
_condition = "None"
|
|
45
|
+
end
|
|
46
|
+
local _arg1 = {
|
|
47
|
+
constructor = constructor,
|
|
48
|
+
renderGroup = props.group,
|
|
49
|
+
visible = props.visible,
|
|
50
|
+
rules = props.rules,
|
|
51
|
+
}
|
|
52
|
+
_result_1[_condition] = _arg1
|
|
40
53
|
end
|
|
41
|
-
local _arg0_1 = `{_condition_1}-{props.name}`
|
|
42
|
-
local _arg1 = {
|
|
43
|
-
constructor = constructor,
|
|
44
|
-
renderGroup = props.renderGroup,
|
|
45
|
-
visible = props.visible,
|
|
46
|
-
rules = props.rules,
|
|
47
|
-
}
|
|
48
|
-
AppRegistry[_arg0_1] = _arg1
|
|
49
54
|
return constructor
|
|
50
55
|
end
|
|
51
56
|
end
|
|
@@ -57,29 +62,23 @@ end
|
|
|
57
62
|
local Args
|
|
58
63
|
do
|
|
59
64
|
Args = {}
|
|
60
|
-
function Args:constructor(props, name)
|
|
65
|
+
function Args:constructor(props, name, group)
|
|
61
66
|
local _binding = props
|
|
62
67
|
local forge = _binding.forge
|
|
63
68
|
self.forge = forge
|
|
69
|
+
self.group = group
|
|
64
70
|
self.name = name
|
|
65
71
|
local _object = table.clone(props.props)
|
|
66
72
|
setmetatable(_object, nil)
|
|
67
|
-
_object.px = px
|
|
68
73
|
_object.forge = forge
|
|
74
|
+
_object.px = px
|
|
69
75
|
self.props = _object
|
|
70
|
-
|
|
71
|
-
if not src then
|
|
72
|
-
logger:log("ERROR", "Missing visibility source for App", {
|
|
73
|
-
name = name,
|
|
74
|
-
})
|
|
75
|
-
error(`Failed to retrieve visibility source for app "{name}"`, 2)
|
|
76
|
-
end
|
|
77
|
-
self.source = src
|
|
76
|
+
self.source = forge:getSource(name, group)
|
|
78
77
|
end
|
|
79
78
|
end
|
|
80
79
|
return {
|
|
81
80
|
App = App,
|
|
82
81
|
AppRegistry = AppRegistry,
|
|
83
|
-
|
|
82
|
+
AppSources = AppSources,
|
|
84
83
|
Args = Args,
|
|
85
84
|
}
|
|
@@ -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,22 +1,21 @@
|
|
|
1
1
|
import Vide from "@rbxts/vide";
|
|
2
|
+
import type Types from "./types";
|
|
2
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
7
|
export default class AppForge extends Renders {
|
|
8
8
|
readonly logger: Logger;
|
|
9
9
|
readonly debug: Debugger;
|
|
10
|
-
private sources;
|
|
11
10
|
private innerMount?;
|
|
12
11
|
constructor();
|
|
13
12
|
private createSource;
|
|
14
|
-
getSource(name: AppNames): Vide.Source<boolean
|
|
15
|
-
bind(name: AppNames, value: Vide.Source<boolean>): void;
|
|
16
|
-
set(name: AppNames, value: boolean, rules?: boolean): void;
|
|
17
|
-
open(name: AppNames, rules?: boolean): void;
|
|
18
|
-
close(name: AppNames, rules?: boolean): void;
|
|
19
|
-
toggle(name: AppNames, rules?: boolean): void;
|
|
13
|
+
getSource(name: AppNames, group?: AppGroups): Vide.Source<boolean> | undefined;
|
|
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;
|
|
20
19
|
story(props: AppProps, target: GuiObject, config?: {
|
|
21
20
|
render?: Types.Props.Render;
|
|
22
21
|
minScale?: number;
|
package/out/mount.luau
CHANGED
|
@@ -8,14 +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 source = _vide.source
|
|
12
11
|
local untrack = _vide.untrack
|
|
12
|
+
-- Types
|
|
13
13
|
-- Classes
|
|
14
14
|
local Renders = TS.import(script, script.Parent, "renders").default
|
|
15
|
-
--
|
|
15
|
+
-- Components
|
|
16
16
|
local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
|
|
17
|
+
-- Classes
|
|
17
18
|
local Debugger = TS.import(script, script.Parent, "debugger").default
|
|
18
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
|
|
19
26
|
local AppForge
|
|
20
27
|
do
|
|
21
28
|
local super = Renders
|
|
@@ -36,70 +43,70 @@ do
|
|
|
36
43
|
self.debug = Debugger.new(function(level, msg, data, trace)
|
|
37
44
|
return self.logger:log(level, msg, data, trace)
|
|
38
45
|
end)
|
|
39
|
-
self.sources = {}
|
|
40
46
|
-- ▼ ReadonlyMap.forEach ▼
|
|
41
|
-
local _callback = function(_,
|
|
42
|
-
|
|
47
|
+
local _callback = function(_, key)
|
|
48
|
+
local _binding = string.split(key, "-")
|
|
49
|
+
local group = _binding[1]
|
|
50
|
+
local name = _binding[2]
|
|
51
|
+
self:createSource(name, group)
|
|
43
52
|
end
|
|
44
53
|
for _k, _v in AppRegistry do
|
|
45
54
|
_callback(_v, _k, AppRegistry)
|
|
46
55
|
end
|
|
47
56
|
-- ▲ ReadonlyMap.forEach ▲
|
|
48
57
|
end
|
|
49
|
-
function AppForge:createSource(name)
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
58
|
+
function AppForge:createSource(name, group)
|
|
59
|
+
if group == nil then
|
|
60
|
+
group = "None"
|
|
61
|
+
end
|
|
62
|
+
local entry = getAppEntry(self, name, group)
|
|
63
|
+
if not entry then
|
|
64
|
+
self.logger:log("ERROR", "App Entry not registered while creating source", {
|
|
54
65
|
name = name,
|
|
55
66
|
})
|
|
56
67
|
return nil
|
|
57
68
|
end
|
|
58
|
-
|
|
59
|
-
local _name = name
|
|
60
|
-
if _sources[_name] ~= nil then
|
|
69
|
+
if hasAppSource(name, group) then
|
|
61
70
|
return nil
|
|
62
71
|
end
|
|
63
72
|
local _debug = self.debug
|
|
64
73
|
local _exp = name
|
|
65
74
|
local _object = {}
|
|
66
75
|
local _left = "default"
|
|
67
|
-
local _condition =
|
|
76
|
+
local _condition = entry.visible
|
|
68
77
|
if _condition == nil then
|
|
69
78
|
_condition = false
|
|
70
79
|
end
|
|
71
80
|
_object[_left] = _condition
|
|
72
81
|
_debug:logTag("state", _exp, "Creating visibility source", _object)
|
|
73
|
-
local _sources_1 = self.sources
|
|
74
82
|
local _exp_1 = name
|
|
75
|
-
local
|
|
83
|
+
local _exp_2 = group
|
|
84
|
+
local _condition_1 = entry.visible
|
|
76
85
|
if _condition_1 == nil then
|
|
77
86
|
_condition_1 = false
|
|
78
87
|
end
|
|
79
|
-
|
|
80
|
-
_sources_1[_exp_1] = _arg1
|
|
88
|
+
setAppSource(_exp_1, _exp_2, _condition_1)
|
|
81
89
|
end
|
|
82
|
-
function AppForge:getSource(name)
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
local
|
|
90
|
-
local src = _sources_1[_name_1]
|
|
90
|
+
function AppForge:getSource(name, group)
|
|
91
|
+
if group == nil then
|
|
92
|
+
group = "None"
|
|
93
|
+
end
|
|
94
|
+
if not hasAppSource(name, group) then
|
|
95
|
+
self:createSource(name, group)
|
|
96
|
+
end
|
|
97
|
+
local src = getAppSource(self, name, group)
|
|
91
98
|
if not src then
|
|
92
|
-
|
|
99
|
+
self.logger:log("WARN", `Failed to get source for name {name} group {group}`)
|
|
93
100
|
end
|
|
94
101
|
return src
|
|
95
102
|
end
|
|
96
|
-
function AppForge:bind(name, value)
|
|
103
|
+
function AppForge:bind(name, group, value)
|
|
104
|
+
if group == nil then
|
|
105
|
+
group = "None"
|
|
106
|
+
end
|
|
97
107
|
if not RunService:IsRunning() then
|
|
98
108
|
self.debug:logTag("state", name, "Binding external visibility source")
|
|
99
|
-
|
|
100
|
-
local _name = name
|
|
101
|
-
local _value = value
|
|
102
|
-
_sources[_name] = _value
|
|
109
|
+
bindAppSource(name, group, value)
|
|
103
110
|
local prev
|
|
104
111
|
local log = function()
|
|
105
112
|
return self.debug:logTag("state", name, "Visibility changed", {
|
|
@@ -112,7 +119,7 @@ do
|
|
|
112
119
|
count += 1
|
|
113
120
|
prev = value()
|
|
114
121
|
untrack(function()
|
|
115
|
-
return self:checkRules(self, name)
|
|
122
|
+
return self:checkRules(self, name, group)
|
|
116
123
|
end)
|
|
117
124
|
if Vide.strict and count == 2 then
|
|
118
125
|
log()
|
|
@@ -128,23 +135,15 @@ do
|
|
|
128
135
|
})
|
|
129
136
|
end
|
|
130
137
|
end
|
|
131
|
-
function AppForge:set(name, value, rules)
|
|
138
|
+
function AppForge:set(name, group, value, rules)
|
|
139
|
+
if group == nil then
|
|
140
|
+
group = "None"
|
|
141
|
+
end
|
|
132
142
|
if rules == nil then
|
|
133
143
|
rules = true
|
|
134
144
|
end
|
|
135
|
-
local
|
|
136
|
-
local _name = name
|
|
137
|
-
local src = _sources[_name]
|
|
145
|
+
local src = getAppSource(self, name, group)
|
|
138
146
|
if not src then
|
|
139
|
-
self:createSource(name)
|
|
140
|
-
local _sources_1 = self.sources
|
|
141
|
-
local _name_1 = name
|
|
142
|
-
src = _sources_1[_name_1]
|
|
143
|
-
end
|
|
144
|
-
if not src then
|
|
145
|
-
self.logger:log("ERROR", "Failed to set visibility (missing source)", {
|
|
146
|
-
name = name,
|
|
147
|
-
})
|
|
148
147
|
return nil
|
|
149
148
|
end
|
|
150
149
|
local prev = src()
|
|
@@ -157,26 +156,39 @@ do
|
|
|
157
156
|
to = value,
|
|
158
157
|
})
|
|
159
158
|
if rules then
|
|
160
|
-
self:checkRules(self, name)
|
|
159
|
+
self:checkRules(self, name, group)
|
|
161
160
|
end
|
|
162
161
|
end
|
|
163
|
-
function AppForge:open(name, rules)
|
|
162
|
+
function AppForge:open(name, group, rules)
|
|
163
|
+
if group == nil then
|
|
164
|
+
group = "None"
|
|
165
|
+
end
|
|
164
166
|
if rules == nil then
|
|
165
167
|
rules = true
|
|
166
168
|
end
|
|
167
|
-
self:set(name, true, rules)
|
|
169
|
+
self:set(name, group, true, rules)
|
|
168
170
|
end
|
|
169
|
-
function AppForge:close(name, rules)
|
|
171
|
+
function AppForge:close(name, group, rules)
|
|
172
|
+
if group == nil then
|
|
173
|
+
group = "None"
|
|
174
|
+
end
|
|
170
175
|
if rules == nil then
|
|
171
176
|
rules = true
|
|
172
177
|
end
|
|
173
|
-
self:set(name, false, rules)
|
|
178
|
+
self:set(name, group, false, rules)
|
|
174
179
|
end
|
|
175
|
-
function AppForge:toggle(name, rules)
|
|
180
|
+
function AppForge:toggle(name, group, rules)
|
|
181
|
+
if group == nil then
|
|
182
|
+
group = "None"
|
|
183
|
+
end
|
|
176
184
|
if rules == nil then
|
|
177
185
|
rules = true
|
|
178
186
|
end
|
|
179
|
-
|
|
187
|
+
local src = self:getSource(name, group)
|
|
188
|
+
if not src then
|
|
189
|
+
return self.logger:log("ERROR", `Failed to get Source for name {name} group {group}`)
|
|
190
|
+
end
|
|
191
|
+
self:set(name, group, not src(), rules)
|
|
180
192
|
end
|
|
181
193
|
function AppForge:story(props, target, config)
|
|
182
194
|
self.debug:logTag("lifecycle", "story", "Creating story mount")
|
package/out/renders.luau
CHANGED
|
@@ -6,6 +6,9 @@ local Vide = _vide
|
|
|
6
6
|
local mount = _vide.mount
|
|
7
7
|
-- Types
|
|
8
8
|
-- Components
|
|
9
|
+
local _appRegistry = TS.import(script, script.Parent, "appRegistry")
|
|
10
|
+
local AppRegistry = _appRegistry.AppRegistry
|
|
11
|
+
local AppSources = _appRegistry.AppSources
|
|
9
12
|
-- Hooks
|
|
10
13
|
local usePx = TS.import(script, script.Parent, "hooks", "usePx").usePx
|
|
11
14
|
-- Classes
|
|
@@ -31,6 +34,8 @@ do
|
|
|
31
34
|
function Renders:Render(_param)
|
|
32
35
|
local props = _param.props
|
|
33
36
|
print(props)
|
|
37
|
+
print(AppRegistry)
|
|
38
|
+
print(AppSources)
|
|
34
39
|
end
|
|
35
40
|
function Renders:initalize(props, target, root)
|
|
36
41
|
if not self.__px then
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type AppForge from "../../mount";
|
|
2
|
-
export default function ExclusiveGroupRule(name: AppNames,
|
|
2
|
+
export default function ExclusiveGroupRule(forge: AppForge, name: AppNames, group: AppGroups): void;
|
|
@@ -3,19 +3,12 @@ local TS = _G[script]
|
|
|
3
3
|
-- Types
|
|
4
4
|
-- Components
|
|
5
5
|
local AppRegistry = TS.import(script, script.Parent.Parent.Parent, "appRegistry").AppRegistry
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
local
|
|
10
|
-
if
|
|
11
|
-
|
|
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
|
|
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} `)
|
|
19
12
|
end
|
|
20
13
|
local entryVisible = forge:getSource(name)()
|
|
21
14
|
if not entryVisible then
|
|
@@ -23,26 +16,33 @@ local function ExclusiveGroupRule(name, forge)
|
|
|
23
16
|
end
|
|
24
17
|
forge.debug:logTag("rules", name, "Exclusive group activated", group)
|
|
25
18
|
-- ▼ ReadonlyMap.forEach ▼
|
|
26
|
-
local _callback = function(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
_result =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
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)
|
|
36
41
|
end
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return nil
|
|
42
|
+
for _k, _v in entryMap do
|
|
43
|
+
_callback_1(_v, _k, entryMap)
|
|
40
44
|
end
|
|
41
|
-
|
|
42
|
-
closed = name,
|
|
43
|
-
group = group,
|
|
44
|
-
})
|
|
45
|
-
forge:close(name, false)
|
|
45
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
46
46
|
end
|
|
47
47
|
for _k, _v in AppRegistry do
|
|
48
48
|
_callback(_v, _k, AppRegistry)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type AppForge from "../../mount";
|
|
2
|
-
export default function ParentRule(name: AppNames,
|
|
2
|
+
export default function ParentRule(forge: AppForge, name: AppNames, group: AppGroups): void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
-- Types
|
|
4
|
-
--
|
|
5
|
-
local
|
|
6
|
-
local
|
|
7
|
-
|
|
8
|
-
local entry =
|
|
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
9
|
local _result = entry
|
|
10
10
|
if _result ~= nil then
|
|
11
11
|
_result = _result.rules
|
|
@@ -16,17 +16,18 @@ local function ParentRule(name, forge)
|
|
|
16
16
|
if not (_result ~= "" and _result) then
|
|
17
17
|
return nil
|
|
18
18
|
end
|
|
19
|
-
local
|
|
20
|
-
local
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
_result_1 = _result_1.parent
|
|
25
|
-
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"
|
|
26
24
|
end
|
|
27
|
-
local parentSource =
|
|
28
|
-
if
|
|
29
|
-
local source = forge:getSource(name)
|
|
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
|
|
30
31
|
if source() then
|
|
31
32
|
source(false)
|
|
32
33
|
end
|
|
@@ -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,11 +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
6
|
local ExclusiveGroupRule = TS.import(script, script, "check", "exclusiveGroup").default
|
|
8
|
-
local ParentRule = TS.import(script, script, "check", "parent").default
|
|
9
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
|
|
10
11
|
local Rules
|
|
11
12
|
do
|
|
12
13
|
Rules = setmetatable({}, {
|
|
@@ -22,13 +23,15 @@ do
|
|
|
22
23
|
function Rules:constructor()
|
|
23
24
|
self.processing = {}
|
|
24
25
|
end
|
|
25
|
-
function Rules:renderRules(forge, name, props)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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)
|
|
30
33
|
end
|
|
31
|
-
local rules =
|
|
34
|
+
local rules = entry.rules
|
|
32
35
|
if not rules then
|
|
33
36
|
return nil
|
|
34
37
|
end
|
|
@@ -41,7 +44,7 @@ do
|
|
|
41
44
|
forge.debug:logTag("rules", name, "Applying parent anchor", {
|
|
42
45
|
parent = rules.parent,
|
|
43
46
|
})
|
|
44
|
-
AnchorRule(name, 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
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type Types from "../../types";
|
|
2
|
-
export default function anchor(name: AppNames, props: Types.Props.Main): void;
|
|
2
|
+
export default function anchor(name: AppNames, group: AppGroups | undefined, props: Types.Props.Main): void;
|
|
@@ -1,37 +1,10 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
2
|
-- Types
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
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
|
|
3
|
+
local function anchor(name, group, props)
|
|
4
|
+
if group == nil then
|
|
5
|
+
group = "None"
|
|
16
6
|
end
|
|
17
|
-
|
|
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}`)
|
|
7
|
+
-- TODO: FIX THIS TO ANCHOR APP TO PARENT IF HAS ONE WARN IF DOESN'T
|
|
35
8
|
end
|
|
36
9
|
return {
|
|
37
10
|
default = anchor,
|
package/out/types.d.ts
CHANGED
|
@@ -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,11 +58,15 @@ declare namespace Types {
|
|
|
58
58
|
namespace Rules {
|
|
59
59
|
type WithParent<P> = {
|
|
60
60
|
parent: P;
|
|
61
|
+
|
|
62
|
+
parentGroup: AppGroups;
|
|
61
63
|
anchor?: boolean;
|
|
62
64
|
};
|
|
63
65
|
|
|
64
66
|
type WithoutParent = {
|
|
65
67
|
parent?: never;
|
|
68
|
+
|
|
69
|
+
parentGroup: never;
|
|
66
70
|
anchor?: never;
|
|
67
71
|
};
|
|
68
72
|
|