@rbxts/app-forge 0.7.2-prototype.3 → 0.7.2-prototype.31
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 +49 -36
- package/out/helpers/bindAppSource.d.ts +2 -0
- package/out/helpers/bindAppSource.luau +22 -0
- package/out/helpers/getAppEntry.d.ts +1 -0
- package/out/helpers/getAppEntry.luau +21 -0
- package/out/helpers/getAppSource.d.ts +1 -0
- package/out/helpers/getAppSource.luau +21 -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/hooks/useAppContext.luau +0 -4
- package/out/hooks/useEventListener.luau +1 -5
- package/out/hooks/usePx.luau +2 -7
- package/out/mount.d.ts +8 -13
- package/out/mount.luau +73 -107
- package/out/renders.d.ts +13 -2
- package/out/renders.luau +276 -26
- package/out/ruleEngine/check/exclusiveGroup.d.ts +1 -1
- package/out/ruleEngine/check/exclusiveGroup.luau +28 -33
- package/out/ruleEngine/check/parent.d.ts +1 -1
- package/out/ruleEngine/check/parent.luau +15 -15
- package/out/ruleEngine/index.d.ts +2 -2
- package/out/ruleEngine/init.luau +15 -18
- package/out/ruleEngine/render/anchor.d.ts +1 -1
- package/out/ruleEngine/render/anchor.luau +4 -31
- package/out/types.d.ts +15 -11
- package/package.json +8 -1
- package/out/debugger.d.ts +0 -18
- package/out/debugger.luau +0 -89
- package/out/logger.d.ts +0 -5
- package/out/logger.luau +0 -37
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,52 @@ 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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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)
|
|
31
34
|
end
|
|
32
35
|
local _value = props.name
|
|
33
36
|
if not (_value ~= "" and _value) then
|
|
34
|
-
logger:log("ERROR", "Attempted to register App without a name", props)
|
|
35
37
|
error("App registration failed: missing app name", 2)
|
|
36
38
|
end
|
|
37
|
-
local
|
|
38
|
-
if
|
|
39
|
-
|
|
39
|
+
local _name_1 = props.name
|
|
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 = "group"
|
|
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
|
|
40
63
|
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
64
|
return constructor
|
|
50
65
|
end
|
|
51
66
|
end
|
|
@@ -57,29 +72,27 @@ end
|
|
|
57
72
|
local Args
|
|
58
73
|
do
|
|
59
74
|
Args = {}
|
|
60
|
-
function Args:constructor(props, name)
|
|
75
|
+
function Args:constructor(props, name, group)
|
|
61
76
|
local _binding = props
|
|
62
77
|
local forge = _binding.forge
|
|
63
78
|
self.forge = forge
|
|
79
|
+
local _condition = group
|
|
80
|
+
if not (_condition ~= "" and _condition) then
|
|
81
|
+
_condition = "None"
|
|
82
|
+
end
|
|
83
|
+
self.group = _condition
|
|
64
84
|
self.name = name
|
|
65
85
|
local _object = table.clone(props.props)
|
|
66
86
|
setmetatable(_object, nil)
|
|
67
|
-
_object.px = px
|
|
68
87
|
_object.forge = forge
|
|
88
|
+
_object.px = px
|
|
69
89
|
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
|
|
90
|
+
self.source = forge:getSource(name, group)
|
|
78
91
|
end
|
|
79
92
|
end
|
|
80
93
|
return {
|
|
81
94
|
App = App,
|
|
82
95
|
AppRegistry = AppRegistry,
|
|
83
|
-
|
|
96
|
+
AppSources = AppSources,
|
|
84
97
|
Args = Args,
|
|
85
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 @@
|
|
|
1
|
+
export default function getAppEntry(name: AppNames, group: AppGroups): import("../types").default.AppRegistry.Static | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Components
|
|
4
|
+
local AppRegistry = TS.import(script, script.Parent.Parent, "appRegistry").AppRegistry
|
|
5
|
+
local function getAppEntry(name, group)
|
|
6
|
+
local _name = name
|
|
7
|
+
local entryMap = AppRegistry[_name]
|
|
8
|
+
local _entry = entryMap
|
|
9
|
+
if _entry ~= nil then
|
|
10
|
+
local _group = group
|
|
11
|
+
_entry = _entry[_group]
|
|
12
|
+
end
|
|
13
|
+
local entry = _entry
|
|
14
|
+
if not entry then
|
|
15
|
+
warn(`Failed to get entry for name {name} and group {group}`)
|
|
16
|
+
end
|
|
17
|
+
return entry
|
|
18
|
+
end
|
|
19
|
+
return {
|
|
20
|
+
default = getAppEntry,
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getAppSource(name: AppNames, group: AppGroups): import("@rbxts/vide").Source<boolean> | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
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 getAppSource(name, group)
|
|
6
|
+
local _name = name
|
|
7
|
+
local sourceMap = AppSources[_name]
|
|
8
|
+
local _source = sourceMap
|
|
9
|
+
if _source ~= nil then
|
|
10
|
+
local _group = group
|
|
11
|
+
_source = _source[_group]
|
|
12
|
+
end
|
|
13
|
+
local source = _source
|
|
14
|
+
if not source then
|
|
15
|
+
warn(`Failed to find source for name: {name} group: {group} \n {debug.traceback()}`)
|
|
16
|
+
end
|
|
17
|
+
return source
|
|
18
|
+
end
|
|
19
|
+
return {
|
|
20
|
+
default = getAppSource,
|
|
21
|
+
}
|
|
@@ -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
|
+
return 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
|
+
return 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
|
+
}
|
|
@@ -2,13 +2,9 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
-- Components
|
|
4
4
|
local Contexts = TS.import(script, script.Parent.Parent, "context").default
|
|
5
|
-
-- Debug
|
|
6
|
-
local Logger = TS.import(script, script.Parent.Parent, "logger").default
|
|
7
|
-
local logger = Logger.new("useAppContext")
|
|
8
5
|
local default = function()
|
|
9
6
|
local context = Contexts.App()
|
|
10
7
|
if not context then
|
|
11
|
-
logger:log("ERROR", "Failed to retrieve App context")
|
|
12
8
|
error(`Failed to retrieve App Props for Vide\n{debug.traceback()}`, 2)
|
|
13
9
|
end
|
|
14
10
|
return context
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local cleanup = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).cleanup
|
|
4
|
-
-- Debug
|
|
5
|
-
local Logger = TS.import(script, script.Parent.Parent, "logger").default
|
|
6
|
-
local logger = Logger.new("useEventListener")
|
|
7
4
|
local connect = function(event, callback)
|
|
8
5
|
local _event = event
|
|
9
6
|
if typeof(_event) == "RBXScriptSignal" then
|
|
@@ -22,7 +19,6 @@ local connect = function(event, callback)
|
|
|
22
19
|
elseif event.subscribe ~= nil then
|
|
23
20
|
return event:subscribe(callback)
|
|
24
21
|
end
|
|
25
|
-
logger:log("ERROR", "Unsupported event-like object", event)
|
|
26
22
|
error("Event-like object does not have a supported connect method.", 2)
|
|
27
23
|
end
|
|
28
24
|
local disconnect = function(connection)
|
|
@@ -40,7 +36,7 @@ local disconnect = function(connection)
|
|
|
40
36
|
elseif connection.disconnect ~= nil then
|
|
41
37
|
connection:disconnect()
|
|
42
38
|
else
|
|
43
|
-
|
|
39
|
+
warn("Unsupported connection-like object during cleanup", connection)
|
|
44
40
|
end
|
|
45
41
|
end
|
|
46
42
|
end
|
package/out/hooks/usePx.luau
CHANGED
|
@@ -6,9 +6,6 @@ local Workspace = TS.import(script, TS.getModule(script, "@rbxts", "services")).
|
|
|
6
6
|
local source = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).source
|
|
7
7
|
-- Helpers
|
|
8
8
|
local useEventListener = TS.import(script, script.Parent, "useEventListener").useEventListener
|
|
9
|
-
-- Debug
|
|
10
|
-
local Logger = TS.import(script, script.Parent.Parent, "logger").default
|
|
11
|
-
local logger = Logger.new("usePx")
|
|
12
9
|
--* Default reference resolution for px calculations
|
|
13
10
|
local BASE_RESOLUTION = source(Vector2.new(1920, 1080))
|
|
14
11
|
--* Minimum allowed scale to prevent unreadable UI
|
|
@@ -70,8 +67,7 @@ end
|
|
|
70
67
|
]]
|
|
71
68
|
local function usePx(target, baseResolution, minScale)
|
|
72
69
|
if INITIALIZED then
|
|
73
|
-
|
|
74
|
-
return nil
|
|
70
|
+
return warn("usePx() called more than once")
|
|
75
71
|
end
|
|
76
72
|
INITIALIZED = true
|
|
77
73
|
if baseResolution then
|
|
@@ -85,8 +81,7 @@ local function usePx(target, baseResolution, minScale)
|
|
|
85
81
|
end
|
|
86
82
|
local resolvedTarget = TARGET()
|
|
87
83
|
if not resolvedTarget then
|
|
88
|
-
|
|
89
|
-
return nil
|
|
84
|
+
return warn("usePx(): no valid target to observe")
|
|
90
85
|
end
|
|
91
86
|
local signal = if resolvedTarget:IsA("Camera") then resolvedTarget:GetPropertyChangedSignal("ViewportSize") else resolvedTarget:GetPropertyChangedSignal("AbsoluteSize")
|
|
92
87
|
useEventListener(signal, calculateScale)
|
package/out/mount.d.ts
CHANGED
|
@@ -1,26 +1,21 @@
|
|
|
1
1
|
import Vide from "@rbxts/vide";
|
|
2
|
+
import type Types from "./types";
|
|
2
3
|
import Renders from "./renders";
|
|
3
|
-
import Debugger from "./debugger";
|
|
4
|
-
import Logger from "./logger";
|
|
5
|
-
import Types from "./types";
|
|
6
4
|
type Destructor = () => void;
|
|
7
5
|
export default class AppForge extends Renders {
|
|
8
|
-
readonly logger: Logger;
|
|
9
|
-
readonly debug: Debugger;
|
|
10
|
-
private sources;
|
|
11
6
|
private innerMount?;
|
|
12
7
|
constructor();
|
|
13
8
|
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;
|
|
9
|
+
getSource(name: AppNames, group?: AppGroups): Vide.Source<boolean>;
|
|
10
|
+
bind(name: AppNames, group: AppGroups | undefined, value: Vide.Source<boolean>): void;
|
|
11
|
+
set(name: AppNames, group: AppGroups | undefined, value: boolean, rules?: boolean): void;
|
|
12
|
+
open(name: AppNames, group?: AppGroups, rules?: boolean): void;
|
|
13
|
+
close(name: AppNames, group?: AppGroups, rules?: boolean): void;
|
|
14
|
+
toggle(name: AppNames, group?: AppGroups, rules?: boolean): void;
|
|
20
15
|
story(props: AppProps, target: GuiObject, config?: {
|
|
21
16
|
render?: Types.Props.Render;
|
|
22
17
|
minScale?: number;
|
|
23
18
|
}): Frame;
|
|
24
|
-
mount(
|
|
19
|
+
mount(props: Omit<Types.Props.Main, "forge">, target: Instance, root?: GuiObject | Instance): Destructor | undefined;
|
|
25
20
|
}
|
|
26
21
|
export {};
|
package/out/mount.luau
CHANGED
|
@@ -8,15 +8,18 @@ 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
14
|
local Renders = TS.import(script, script.Parent, "renders").default
|
|
16
|
-
--
|
|
15
|
+
-- Components
|
|
17
16
|
local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
|
|
18
|
-
|
|
19
|
-
local
|
|
17
|
+
-- Helpers
|
|
18
|
+
local bindAppSource = TS.import(script, script.Parent, "helpers", "bindAppSource").default
|
|
19
|
+
local getAppSource = TS.import(script, script.Parent, "helpers", "getAppSource").default
|
|
20
|
+
local hasAppSource = TS.import(script, script.Parent, "helpers", "hasAppSource").default
|
|
21
|
+
local setAppSource = TS.import(script, script.Parent, "helpers", "setAppSource").default
|
|
22
|
+
local getAppEntry = TS.import(script, script.Parent, "helpers", "getAppEntry").default
|
|
20
23
|
local AppForge
|
|
21
24
|
do
|
|
22
25
|
local super = Renders
|
|
@@ -33,119 +36,82 @@ do
|
|
|
33
36
|
end
|
|
34
37
|
function AppForge:constructor()
|
|
35
38
|
super.constructor(self)
|
|
36
|
-
self.logger = Logger.new("AppForge")
|
|
37
|
-
self.debug = Debugger.new(function(level, msg, data, trace)
|
|
38
|
-
return self.logger:log(level, msg, data, trace)
|
|
39
|
-
end)
|
|
40
|
-
self.sources = {}
|
|
41
39
|
-- ▼ ReadonlyMap.forEach ▼
|
|
42
|
-
local _callback = function(
|
|
43
|
-
|
|
40
|
+
local _callback = function(entryMap, name)
|
|
41
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
42
|
+
local _callback_1 = function(_, group)
|
|
43
|
+
self:createSource(name, group)
|
|
44
|
+
end
|
|
45
|
+
for _k, _v in entryMap do
|
|
46
|
+
_callback_1(_v, _k, entryMap)
|
|
47
|
+
end
|
|
48
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
44
49
|
end
|
|
45
50
|
for _k, _v in AppRegistry do
|
|
46
51
|
_callback(_v, _k, AppRegistry)
|
|
47
52
|
end
|
|
48
53
|
-- ▲ ReadonlyMap.forEach ▲
|
|
49
54
|
end
|
|
50
|
-
function AppForge:createSource(name)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
})
|
|
55
|
+
function AppForge:createSource(name, group)
|
|
56
|
+
if group == nil then
|
|
57
|
+
group = "None"
|
|
58
|
+
end
|
|
59
|
+
local entry = getAppEntry(name, group)
|
|
60
|
+
if not entry then
|
|
57
61
|
return nil
|
|
58
62
|
end
|
|
59
|
-
|
|
60
|
-
local _name = name
|
|
61
|
-
if _sources[_name] ~= nil then
|
|
63
|
+
if hasAppSource(name, group) then
|
|
62
64
|
return nil
|
|
63
65
|
end
|
|
64
|
-
local _debug = self.debug
|
|
65
66
|
local _exp = name
|
|
66
|
-
local
|
|
67
|
-
local
|
|
68
|
-
local _condition = app.visible
|
|
67
|
+
local _exp_1 = group
|
|
68
|
+
local _condition = entry.visible
|
|
69
69
|
if _condition == nil then
|
|
70
70
|
_condition = false
|
|
71
71
|
end
|
|
72
|
-
|
|
73
|
-
_debug:logTag("state", _exp, "Creating visibility source", _object)
|
|
74
|
-
local _sources_1 = self.sources
|
|
75
|
-
local _exp_1 = name
|
|
76
|
-
local _condition_1 = app.visible
|
|
77
|
-
if _condition_1 == nil then
|
|
78
|
-
_condition_1 = false
|
|
79
|
-
end
|
|
80
|
-
local _arg1 = source(_condition_1)
|
|
81
|
-
_sources_1[_exp_1] = _arg1
|
|
72
|
+
setAppSource(_exp, _exp_1, _condition)
|
|
82
73
|
end
|
|
83
|
-
function AppForge:getSource(name)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
local _sources_1 = self.sources
|
|
90
|
-
local _name_1 = name
|
|
91
|
-
local src = _sources_1[_name_1]
|
|
92
|
-
if not src then
|
|
93
|
-
error(`AppForge invariant broken: missing visibility source for {name}`, 2)
|
|
74
|
+
function AppForge:getSource(name, group)
|
|
75
|
+
if group == nil then
|
|
76
|
+
group = "None"
|
|
77
|
+
end
|
|
78
|
+
if not hasAppSource(name, group) then
|
|
79
|
+
self:createSource(name, group)
|
|
94
80
|
end
|
|
81
|
+
local src = getAppSource(name, group)
|
|
95
82
|
return src
|
|
96
83
|
end
|
|
97
|
-
function AppForge:bind(name, value)
|
|
84
|
+
function AppForge:bind(name, group, value)
|
|
85
|
+
if group == nil then
|
|
86
|
+
group = "None"
|
|
87
|
+
end
|
|
98
88
|
if not RunService:IsRunning() then
|
|
99
|
-
|
|
100
|
-
local _sources = self.sources
|
|
101
|
-
local _name = name
|
|
102
|
-
local _value = value
|
|
103
|
-
_sources[_name] = _value
|
|
104
|
-
local prev
|
|
105
|
-
local log = function()
|
|
106
|
-
return self.debug:logTag("state", name, "Visibility changed", {
|
|
107
|
-
from = prev,
|
|
108
|
-
to = value,
|
|
109
|
-
})
|
|
110
|
-
end
|
|
89
|
+
bindAppSource(name, group, value)
|
|
111
90
|
local count = 0
|
|
91
|
+
local _prev
|
|
112
92
|
effect(function()
|
|
113
93
|
count += 1
|
|
114
|
-
|
|
94
|
+
_prev = value()
|
|
115
95
|
untrack(function()
|
|
116
|
-
return self:checkRules(self, name)
|
|
96
|
+
return self:checkRules(self, name, group)
|
|
117
97
|
end)
|
|
118
98
|
if Vide.strict and count == 2 then
|
|
119
|
-
log()
|
|
120
99
|
count = 0
|
|
121
100
|
elseif not Vide.strict and count == 1 then
|
|
122
|
-
log()
|
|
123
101
|
count = 0
|
|
124
102
|
end
|
|
125
103
|
end)
|
|
126
|
-
else
|
|
127
|
-
self.logger:log("WARN", "forge.bind called while game is running", {
|
|
128
|
-
name = name,
|
|
129
|
-
})
|
|
130
104
|
end
|
|
131
105
|
end
|
|
132
|
-
function AppForge:set(name, value, rules)
|
|
106
|
+
function AppForge:set(name, group, value, rules)
|
|
107
|
+
if group == nil then
|
|
108
|
+
group = "None"
|
|
109
|
+
end
|
|
133
110
|
if rules == nil then
|
|
134
111
|
rules = true
|
|
135
112
|
end
|
|
136
|
-
local
|
|
137
|
-
local _name = name
|
|
138
|
-
local src = _sources[_name]
|
|
139
|
-
if not src then
|
|
140
|
-
self:createSource(name)
|
|
141
|
-
local _sources_1 = self.sources
|
|
142
|
-
local _name_1 = name
|
|
143
|
-
src = _sources_1[_name_1]
|
|
144
|
-
end
|
|
113
|
+
local src = getAppSource(name, group)
|
|
145
114
|
if not src then
|
|
146
|
-
self.logger:log("ERROR", "Failed to set visibility (missing source)", {
|
|
147
|
-
name = name,
|
|
148
|
-
})
|
|
149
115
|
return nil
|
|
150
116
|
end
|
|
151
117
|
local prev = src()
|
|
@@ -153,34 +119,42 @@ do
|
|
|
153
119
|
return nil
|
|
154
120
|
end
|
|
155
121
|
src(value)
|
|
156
|
-
self.debug:logTag("state", name, "Visibility changed", {
|
|
157
|
-
from = prev,
|
|
158
|
-
to = value,
|
|
159
|
-
})
|
|
160
122
|
if rules then
|
|
161
|
-
self:checkRules(self, name)
|
|
123
|
+
self:checkRules(self, name, group)
|
|
162
124
|
end
|
|
163
125
|
end
|
|
164
|
-
function AppForge:open(name, rules)
|
|
126
|
+
function AppForge:open(name, group, rules)
|
|
127
|
+
if group == nil then
|
|
128
|
+
group = "None"
|
|
129
|
+
end
|
|
165
130
|
if rules == nil then
|
|
166
131
|
rules = true
|
|
167
132
|
end
|
|
168
|
-
self:set(name, true, rules)
|
|
133
|
+
self:set(name, group, true, rules)
|
|
169
134
|
end
|
|
170
|
-
function AppForge:close(name, rules)
|
|
135
|
+
function AppForge:close(name, group, rules)
|
|
136
|
+
if group == nil then
|
|
137
|
+
group = "None"
|
|
138
|
+
end
|
|
171
139
|
if rules == nil then
|
|
172
140
|
rules = true
|
|
173
141
|
end
|
|
174
|
-
self:set(name, false, rules)
|
|
142
|
+
self:set(name, group, false, rules)
|
|
175
143
|
end
|
|
176
|
-
function AppForge:toggle(name, rules)
|
|
144
|
+
function AppForge:toggle(name, group, rules)
|
|
145
|
+
if group == nil then
|
|
146
|
+
group = "None"
|
|
147
|
+
end
|
|
177
148
|
if rules == nil then
|
|
178
149
|
rules = true
|
|
179
150
|
end
|
|
180
|
-
|
|
151
|
+
local src = self:getSource(name, group)
|
|
152
|
+
if not src then
|
|
153
|
+
return nil
|
|
154
|
+
end
|
|
155
|
+
self:set(name, group, not src(), rules)
|
|
181
156
|
end
|
|
182
157
|
function AppForge:story(props, target, config)
|
|
183
|
-
self.debug:logTag("lifecycle", "story", "Creating story mount")
|
|
184
158
|
local Container = create("Frame")({
|
|
185
159
|
Name = "Story Container",
|
|
186
160
|
BackgroundTransparency = 1,
|
|
@@ -220,20 +194,12 @@ do
|
|
|
220
194
|
_fn(_object)
|
|
221
195
|
return Container
|
|
222
196
|
end
|
|
223
|
-
function AppForge:mount(
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
local _self = self
|
|
230
|
-
local _object_1 = table.clone(props)
|
|
231
|
-
setmetatable(_object_1, nil)
|
|
232
|
-
_object_1.forge = self
|
|
233
|
-
_object[_left] = _self:initalize(_object_1)
|
|
234
|
-
_fn(_object)
|
|
235
|
-
return node
|
|
236
|
-
end, target)
|
|
197
|
+
function AppForge:mount(props, target, root)
|
|
198
|
+
local _self = self
|
|
199
|
+
local _object = table.clone(props)
|
|
200
|
+
setmetatable(_object, nil)
|
|
201
|
+
_object.forge = self
|
|
202
|
+
_self:initalize(_object, target, root)
|
|
237
203
|
return self.innerMount
|
|
238
204
|
end
|
|
239
205
|
end
|