@rbxts/app-forge 0.7.2-prototype.24 → 0.7.2-prototype.26
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/helpers/getAppEntry.d.ts +1 -2
- package/out/helpers/getAppEntry.luau +2 -3
- package/out/helpers/getAppSource.d.ts +1 -2
- package/out/helpers/getAppSource.luau +2 -6
- 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 +0 -4
- package/out/mount.luau +8 -50
- package/out/renders.d.ts +2 -3
- package/out/renders.luau +58 -30
- package/out/ruleEngine/check/exclusiveGroup.luau +2 -7
- package/out/ruleEngine/check/parent.luau +4 -5
- package/out/ruleEngine/index.d.ts +1 -1
- package/out/ruleEngine/init.luau +2 -8
- package/package.json +1 -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
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getAppEntry(forge: CreateForge, name: AppNames, group: AppGroups): import("../types").default.AppRegistry.Static | undefined;
|
|
1
|
+
export default function getAppEntry(name: AppNames, group: AppGroups): import("../types").default.AppRegistry.Static | undefined;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
-- Types
|
|
4
3
|
-- Components
|
|
5
4
|
local AppRegistry = TS.import(script, script.Parent.Parent, "appRegistry").AppRegistry
|
|
6
|
-
local function getAppEntry(
|
|
5
|
+
local function getAppEntry(name, group)
|
|
7
6
|
local _name = name
|
|
8
7
|
local entryMap = AppRegistry[_name]
|
|
9
8
|
local _entry = entryMap
|
|
@@ -13,7 +12,7 @@ local function getAppEntry(forge, name, group)
|
|
|
13
12
|
end
|
|
14
13
|
local entry = _entry
|
|
15
14
|
if not entry then
|
|
16
|
-
|
|
15
|
+
warn(`Failed to get entry for name {name} and group {group}`)
|
|
17
16
|
end
|
|
18
17
|
return entry
|
|
19
18
|
end
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export default function getAppSource(forge: CreateForge, name: AppNames, group: AppGroups): import("@rbxts/vide").Source<boolean> | undefined;
|
|
1
|
+
export default function getAppSource(name: AppNames, group: AppGroups): import("@rbxts/vide").Source<boolean> | undefined;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
-- Types
|
|
4
3
|
-- Components
|
|
5
4
|
local AppSources = TS.import(script, script.Parent.Parent, "appRegistry").AppSources
|
|
6
|
-
local function getAppSource(
|
|
5
|
+
local function getAppSource(name, group)
|
|
7
6
|
local _name = name
|
|
8
7
|
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
8
|
local _source = sourceMap
|
|
13
9
|
if _source ~= nil then
|
|
14
10
|
local _group = group
|
|
@@ -16,7 +12,7 @@ local function getAppSource(forge, name, group)
|
|
|
16
12
|
end
|
|
17
13
|
local source = _source
|
|
18
14
|
if not source then
|
|
19
|
-
|
|
15
|
+
warn(`Failed to find source for name: {name} group: {group} \n {debug.traceback()}`)
|
|
20
16
|
end
|
|
21
17
|
return source
|
|
22
18
|
end
|
|
@@ -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,12 +1,8 @@
|
|
|
1
1
|
import Vide from "@rbxts/vide";
|
|
2
2
|
import type Types from "./types";
|
|
3
3
|
import Renders from "./renders";
|
|
4
|
-
import Debugger from "./debugger";
|
|
5
|
-
import Logger from "./logger";
|
|
6
4
|
type Destructor = () => void;
|
|
7
5
|
export default class AppForge extends Renders {
|
|
8
|
-
readonly logger: Logger;
|
|
9
|
-
readonly debug: Debugger;
|
|
10
6
|
private innerMount?;
|
|
11
7
|
constructor();
|
|
12
8
|
private createSource;
|
package/out/mount.luau
CHANGED
|
@@ -14,9 +14,6 @@ local untrack = _vide.untrack
|
|
|
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
|
|
18
|
-
local Debugger = TS.import(script, script.Parent, "debugger").default
|
|
19
|
-
local Logger = TS.import(script, script.Parent, "logger").default
|
|
20
17
|
-- Helpers
|
|
21
18
|
local bindAppSource = TS.import(script, script.Parent, "helpers", "bindAppSource").default
|
|
22
19
|
local getAppSource = TS.import(script, script.Parent, "helpers", "getAppSource").default
|
|
@@ -39,10 +36,6 @@ do
|
|
|
39
36
|
end
|
|
40
37
|
function AppForge:constructor()
|
|
41
38
|
super.constructor(self)
|
|
42
|
-
self.logger = Logger.new("AppForge")
|
|
43
|
-
self.debug = Debugger.new(function(level, msg, data, trace)
|
|
44
|
-
return self.logger:log(level, msg, data, trace)
|
|
45
|
-
end)
|
|
46
39
|
-- ▼ ReadonlyMap.forEach ▼
|
|
47
40
|
local _callback = function(entryMap, name)
|
|
48
41
|
-- ▼ ReadonlyMap.forEach ▼
|
|
@@ -63,33 +56,20 @@ do
|
|
|
63
56
|
if group == nil then
|
|
64
57
|
group = "None"
|
|
65
58
|
end
|
|
66
|
-
local entry = getAppEntry(
|
|
59
|
+
local entry = getAppEntry(name, group)
|
|
67
60
|
if not entry then
|
|
68
|
-
self.logger:log("ERROR", "App Entry not registered while creating source", {
|
|
69
|
-
name = name,
|
|
70
|
-
})
|
|
71
61
|
return nil
|
|
72
62
|
end
|
|
73
63
|
if hasAppSource(name, group) then
|
|
74
64
|
return nil
|
|
75
65
|
end
|
|
76
|
-
local _debug = self.debug
|
|
77
66
|
local _exp = name
|
|
78
|
-
local
|
|
79
|
-
local _left = "default"
|
|
67
|
+
local _exp_1 = group
|
|
80
68
|
local _condition = entry.visible
|
|
81
69
|
if _condition == nil then
|
|
82
70
|
_condition = false
|
|
83
71
|
end
|
|
84
|
-
|
|
85
|
-
_debug:logTag("state", _exp, "Creating visibility source", _object)
|
|
86
|
-
local _exp_1 = name
|
|
87
|
-
local _exp_2 = group
|
|
88
|
-
local _condition_1 = entry.visible
|
|
89
|
-
if _condition_1 == nil then
|
|
90
|
-
_condition_1 = false
|
|
91
|
-
end
|
|
92
|
-
setAppSource(_exp_1, _exp_2, _condition_1)
|
|
72
|
+
setAppSource(_exp, _exp_1, _condition)
|
|
93
73
|
end
|
|
94
74
|
function AppForge:getSource(name, group)
|
|
95
75
|
if group == nil then
|
|
@@ -98,10 +78,7 @@ do
|
|
|
98
78
|
if not hasAppSource(name, group) then
|
|
99
79
|
self:createSource(name, group)
|
|
100
80
|
end
|
|
101
|
-
local src = getAppSource(
|
|
102
|
-
if not src then
|
|
103
|
-
self.logger:log("WARN", `Failed to get source for name {name} group {group}`)
|
|
104
|
-
end
|
|
81
|
+
local src = getAppSource(name, group)
|
|
105
82
|
return src
|
|
106
83
|
end
|
|
107
84
|
function AppForge:bind(name, group, value)
|
|
@@ -109,34 +86,21 @@ do
|
|
|
109
86
|
group = "None"
|
|
110
87
|
end
|
|
111
88
|
if not RunService:IsRunning() then
|
|
112
|
-
self.debug:logTag("state", name, "Binding external visibility source")
|
|
113
89
|
bindAppSource(name, group, value)
|
|
114
|
-
local prev
|
|
115
|
-
local log = function()
|
|
116
|
-
return self.debug:logTag("state", name, "Visibility changed", {
|
|
117
|
-
from = prev,
|
|
118
|
-
to = value,
|
|
119
|
-
})
|
|
120
|
-
end
|
|
121
90
|
local count = 0
|
|
91
|
+
local _prev
|
|
122
92
|
effect(function()
|
|
123
93
|
count += 1
|
|
124
|
-
|
|
94
|
+
_prev = value()
|
|
125
95
|
untrack(function()
|
|
126
96
|
return self:checkRules(self, name, group)
|
|
127
97
|
end)
|
|
128
98
|
if Vide.strict and count == 2 then
|
|
129
|
-
log()
|
|
130
99
|
count = 0
|
|
131
100
|
elseif not Vide.strict and count == 1 then
|
|
132
|
-
log()
|
|
133
101
|
count = 0
|
|
134
102
|
end
|
|
135
103
|
end)
|
|
136
|
-
else
|
|
137
|
-
self.logger:log("WARN", "forge.bind called while game is running", {
|
|
138
|
-
name = name,
|
|
139
|
-
})
|
|
140
104
|
end
|
|
141
105
|
end
|
|
142
106
|
function AppForge:set(name, group, value, rules)
|
|
@@ -146,7 +110,7 @@ do
|
|
|
146
110
|
if rules == nil then
|
|
147
111
|
rules = true
|
|
148
112
|
end
|
|
149
|
-
local src = getAppSource(
|
|
113
|
+
local src = getAppSource(name, group)
|
|
150
114
|
if not src then
|
|
151
115
|
return nil
|
|
152
116
|
end
|
|
@@ -155,10 +119,6 @@ do
|
|
|
155
119
|
return nil
|
|
156
120
|
end
|
|
157
121
|
src(value)
|
|
158
|
-
self.debug:logTag("state", name, "Visibility changed", {
|
|
159
|
-
from = prev,
|
|
160
|
-
to = value,
|
|
161
|
-
})
|
|
162
122
|
if rules then
|
|
163
123
|
self:checkRules(self, name, group)
|
|
164
124
|
end
|
|
@@ -190,12 +150,11 @@ do
|
|
|
190
150
|
end
|
|
191
151
|
local src = self:getSource(name, group)
|
|
192
152
|
if not src then
|
|
193
|
-
return
|
|
153
|
+
return nil
|
|
194
154
|
end
|
|
195
155
|
self:set(name, group, not src(), rules)
|
|
196
156
|
end
|
|
197
157
|
function AppForge:story(props, target, config)
|
|
198
|
-
self.debug:logTag("lifecycle", "story", "Creating story mount")
|
|
199
158
|
local Container = create("Frame")({
|
|
200
159
|
Name = "Story Container",
|
|
201
160
|
BackgroundTransparency = 1,
|
|
@@ -236,7 +195,6 @@ do
|
|
|
236
195
|
return Container
|
|
237
196
|
end
|
|
238
197
|
function AppForge:mount(props, target, root)
|
|
239
|
-
self.debug:logTag("lifecycle", "mount", "Mounting AppForge")
|
|
240
198
|
local _self = self
|
|
241
199
|
local _object = table.clone(props)
|
|
242
200
|
setmetatable(_object, nil)
|
package/out/renders.d.ts
CHANGED
|
@@ -7,13 +7,12 @@ type Render = {
|
|
|
7
7
|
};
|
|
8
8
|
export default class Renders extends Rules {
|
|
9
9
|
private __px;
|
|
10
|
-
protected
|
|
10
|
+
protected Loaded: Map<string, Map<string, Render>>;
|
|
11
11
|
constructor();
|
|
12
12
|
Render: (props: Types.Props.Main) => Instance[];
|
|
13
13
|
private resolveGroupEntries;
|
|
14
14
|
private getGroupEntries;
|
|
15
|
-
private
|
|
16
|
-
private getChildren;
|
|
15
|
+
private createInstance;
|
|
17
16
|
protected initalize(props: Types.Props.Main, target?: GuiObject | Instance, root?: GuiObject | Instance): Vide.Node;
|
|
18
17
|
}
|
|
19
18
|
export {};
|
package/out/renders.luau
CHANGED
|
@@ -30,7 +30,7 @@ do
|
|
|
30
30
|
function Renders:constructor()
|
|
31
31
|
super.constructor(self)
|
|
32
32
|
self.__px = false
|
|
33
|
-
self.
|
|
33
|
+
self.Loaded = {}
|
|
34
34
|
self.Render = function(props)
|
|
35
35
|
local _binding = props
|
|
36
36
|
local forge = _binding.forge
|
|
@@ -43,7 +43,7 @@ do
|
|
|
43
43
|
local _exp = renders.groups
|
|
44
44
|
-- ▼ ReadonlyArray.forEach ▼
|
|
45
45
|
local _callback = function(group)
|
|
46
|
-
local entries = self:resolveGroupEntries(
|
|
46
|
+
local entries = self:resolveGroupEntries(group, renders.names, renders.name)
|
|
47
47
|
for _, entry in entries do
|
|
48
48
|
table.insert(toRender, entry)
|
|
49
49
|
end
|
|
@@ -55,7 +55,7 @@ do
|
|
|
55
55
|
end
|
|
56
56
|
local _value = renders.group
|
|
57
57
|
if _value ~= "" and _value then
|
|
58
|
-
local entries = self:resolveGroupEntries(
|
|
58
|
+
local entries = self:resolveGroupEntries(renders.group, renders.names, renders.name)
|
|
59
59
|
for _, entry in entries do
|
|
60
60
|
table.insert(toRender, entry)
|
|
61
61
|
end
|
|
@@ -100,29 +100,43 @@ do
|
|
|
100
100
|
_callback(_v, _k - 1, toRender)
|
|
101
101
|
end
|
|
102
102
|
-- ▲ ReadonlyArray.forEach ▲
|
|
103
|
-
print(toRender)
|
|
104
103
|
local rendered = {}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
local
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
105
|
+
local _callback_1 = function(entry)
|
|
106
|
+
local name = tostring(entry.constructor)
|
|
107
|
+
local group = entry.group
|
|
108
|
+
local parent
|
|
109
|
+
local _result = entry.rules
|
|
110
|
+
if _result ~= nil then
|
|
111
|
+
_result = _result.parent
|
|
112
112
|
end
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
if _result ~= "" and _result then
|
|
114
|
+
local _condition = entry.rules.parentGroup
|
|
115
|
+
if not (_condition ~= "" and _condition) then
|
|
116
|
+
_condition = "None"
|
|
117
|
+
end
|
|
118
|
+
local group = _condition
|
|
119
|
+
local _loaded = self.Loaded
|
|
120
|
+
local _parent = entry.rules.parent
|
|
121
|
+
local parentMap = _loaded[_parent]
|
|
122
|
+
if parentMap then
|
|
123
|
+
local parentEntry = parentMap[group]
|
|
124
|
+
if parentEntry then
|
|
125
|
+
parent = parentEntry.container
|
|
126
|
+
end
|
|
127
|
+
end
|
|
115
128
|
end
|
|
116
|
-
|
|
129
|
+
self:createInstance(props, name, group, parent)
|
|
117
130
|
end
|
|
118
|
-
for _k, _v in
|
|
119
|
-
_callback_1(_v, _k,
|
|
131
|
+
for _k, _v in toRender do
|
|
132
|
+
_callback_1(_v, _k - 1, toRender)
|
|
120
133
|
end
|
|
121
|
-
-- ▲
|
|
134
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
135
|
+
print(self.Loaded)
|
|
122
136
|
return rendered
|
|
123
137
|
end
|
|
124
138
|
end
|
|
125
|
-
function Renders:resolveGroupEntries(
|
|
139
|
+
function Renders:resolveGroupEntries(group, names, name)
|
|
126
140
|
local groupEntries = self:getGroupEntries(group)
|
|
127
141
|
local result = {}
|
|
128
142
|
if name ~= "" and name then
|
|
@@ -133,9 +147,7 @@ do
|
|
|
133
147
|
_entry = _entry[_group]
|
|
134
148
|
end
|
|
135
149
|
local entry = _entry
|
|
136
|
-
if
|
|
137
|
-
forge.logger:log("INFO", `Failed to find a Name of {name} in group {group}`)
|
|
138
|
-
else
|
|
150
|
+
if entry then
|
|
139
151
|
table.insert(result, entry)
|
|
140
152
|
end
|
|
141
153
|
end
|
|
@@ -149,9 +161,7 @@ do
|
|
|
149
161
|
_entry = _entry[_group]
|
|
150
162
|
end
|
|
151
163
|
local entry = _entry
|
|
152
|
-
if
|
|
153
|
-
forge.logger:log("INFO", `Failed to find a Name of {n} in group {group}`)
|
|
154
|
-
else
|
|
164
|
+
if entry then
|
|
155
165
|
table.insert(result, entry)
|
|
156
166
|
end
|
|
157
167
|
end
|
|
@@ -187,12 +197,30 @@ do
|
|
|
187
197
|
-- ▲ ReadonlyMap.forEach ▲
|
|
188
198
|
return entries
|
|
189
199
|
end
|
|
190
|
-
function Renders:
|
|
191
|
-
local entry = getAppEntry(
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
200
|
+
function Renders:createInstance(props, name, group, parent)
|
|
201
|
+
local entry = getAppEntry(name, group)
|
|
202
|
+
if not entry then
|
|
203
|
+
return nil
|
|
204
|
+
end
|
|
205
|
+
local instance = entry.constructor.new(props, name, group):render()
|
|
206
|
+
local container = (Vide.jsx("frame", {
|
|
207
|
+
Name = name,
|
|
208
|
+
BackgroundTransparency = 1,
|
|
209
|
+
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
210
|
+
Position = UDim2.fromScale(0.5, 0.5),
|
|
211
|
+
Size = UDim2.fromScale(1, 1),
|
|
212
|
+
Parent = parent,
|
|
213
|
+
}, instance))
|
|
214
|
+
local newMap = {}
|
|
215
|
+
local _group = group
|
|
216
|
+
local _arg1 = {
|
|
217
|
+
container = container,
|
|
218
|
+
instance = instance,
|
|
219
|
+
}
|
|
220
|
+
newMap[_group] = _arg1
|
|
221
|
+
local _loaded = self.Loaded
|
|
222
|
+
local _name = name
|
|
223
|
+
_loaded[_name] = newMap
|
|
196
224
|
end
|
|
197
225
|
function Renders:initalize(props, target, root)
|
|
198
226
|
if not self.__px then
|
|
@@ -6,15 +6,14 @@ local AppRegistry = TS.import(script, script.Parent.Parent.Parent, "appRegistry"
|
|
|
6
6
|
-- Helpers
|
|
7
7
|
local getAppEntry = TS.import(script, script.Parent.Parent.Parent, "helpers", "getAppEntry").default
|
|
8
8
|
local function ExclusiveGroupRule(forge, name, group)
|
|
9
|
-
local entry = getAppEntry(
|
|
9
|
+
local entry = getAppEntry(name, group)
|
|
10
10
|
if not entry then
|
|
11
|
-
|
|
11
|
+
error(`Failed to find app entry for "ExclusiveGroupRule" name {name} group {group}`)
|
|
12
12
|
end
|
|
13
13
|
local entryVisible = forge:getSource(name, group)()
|
|
14
14
|
if not entryVisible then
|
|
15
15
|
return nil
|
|
16
16
|
end
|
|
17
|
-
forge.debug:logTag("rules", name, "Exclusive group activated", group)
|
|
18
17
|
-- ▼ ReadonlyMap.forEach ▼
|
|
19
18
|
local _callback = function(entryMap, entryGroup)
|
|
20
19
|
-- ▼ ReadonlyMap.forEach ▼
|
|
@@ -33,10 +32,6 @@ local function ExclusiveGroupRule(forge, name, group)
|
|
|
33
32
|
if not visible then
|
|
34
33
|
return nil
|
|
35
34
|
end
|
|
36
|
-
forge.debug:logTag("rules", entryName, "Closing app due to exclusive group", {
|
|
37
|
-
closed = entryName,
|
|
38
|
-
entryGroup = entryGroup,
|
|
39
|
-
})
|
|
40
35
|
forge:close(entryName, entryGroup, false)
|
|
41
36
|
end
|
|
42
37
|
for _k, _v in entryMap do
|
|
@@ -5,7 +5,7 @@ local TS = _G[script]
|
|
|
5
5
|
local getAppSource = TS.import(script, script.Parent.Parent.Parent, "helpers", "getAppSource").default
|
|
6
6
|
local getAppEntry = TS.import(script, script.Parent.Parent.Parent, "helpers", "getAppEntry").default
|
|
7
7
|
local function ParentRule(forge, name, group)
|
|
8
|
-
local entry = getAppEntry(
|
|
8
|
+
local entry = getAppEntry(name, group)
|
|
9
9
|
local _result = entry
|
|
10
10
|
if _result ~= nil then
|
|
11
11
|
_result = _result.rules
|
|
@@ -16,17 +16,16 @@ local function ParentRule(forge, name, group)
|
|
|
16
16
|
if not (_result ~= "" and _result) then
|
|
17
17
|
return nil
|
|
18
18
|
end
|
|
19
|
-
local _exp =
|
|
20
|
-
local _exp_1 = entry.rules.parent
|
|
19
|
+
local _exp = entry.rules.parent
|
|
21
20
|
local _condition = entry.rules.parentGroup
|
|
22
21
|
if _condition == nil then
|
|
23
22
|
_condition = "None"
|
|
24
23
|
end
|
|
25
|
-
local parentSource = getAppSource(_exp,
|
|
24
|
+
local parentSource = getAppSource(_exp, _condition)
|
|
26
25
|
if parentSource and parentSource() == false then
|
|
27
26
|
local source = forge:getSource(name, group)
|
|
28
27
|
if not source then
|
|
29
|
-
|
|
28
|
+
warn(`Failed to get Source for name {name} group {group}`)
|
|
30
29
|
end
|
|
31
30
|
if source() then
|
|
32
31
|
source(false)
|
|
@@ -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(
|
|
5
|
+
protected renderRules(name: AppNames, group: AppGroups | undefined, props: Types.Props.Main): void;
|
|
6
6
|
protected checkRules(forge: AppForge, name: AppNames, group: AppGroups): void;
|
|
7
7
|
}
|
package/out/ruleEngine/init.luau
CHANGED
|
@@ -23,11 +23,11 @@ do
|
|
|
23
23
|
function Rules:constructor()
|
|
24
24
|
self.processing = {}
|
|
25
25
|
end
|
|
26
|
-
function Rules:renderRules(
|
|
26
|
+
function Rules:renderRules(name, group, props)
|
|
27
27
|
if group == nil then
|
|
28
28
|
group = "None"
|
|
29
29
|
end
|
|
30
|
-
local entry = getAppEntry(
|
|
30
|
+
local entry = getAppEntry(name, group)
|
|
31
31
|
if not entry then
|
|
32
32
|
error(`renderRules: App Entry name "{name}" group "{group}" not registered`, 2)
|
|
33
33
|
end
|
|
@@ -41,14 +41,10 @@ do
|
|
|
41
41
|
_condition = not rules.anchor
|
|
42
42
|
end
|
|
43
43
|
if _condition ~= "" and _condition then
|
|
44
|
-
forge.debug:logTag("rules", name, "Applying parent anchor", {
|
|
45
|
-
parent = rules.parent,
|
|
46
|
-
})
|
|
47
44
|
AnchorRule(name, group, props)
|
|
48
45
|
end
|
|
49
46
|
-- Index
|
|
50
47
|
if rules.zIndex ~= nil then
|
|
51
|
-
forge.debug:logTag("rules", name, "Applying ZIndex", rules.zIndex)
|
|
52
48
|
-- TODO: will be a separate file under ruleEngine
|
|
53
49
|
-- forge.index(name, rules.zIndex);
|
|
54
50
|
end
|
|
@@ -57,13 +53,11 @@ do
|
|
|
57
53
|
local _processing = self.processing
|
|
58
54
|
local _name = name
|
|
59
55
|
if _processing[_name] ~= nil then
|
|
60
|
-
forge.debug:logTag("rules", name, "Skipped rule processing (cycle detected)")
|
|
61
56
|
return nil
|
|
62
57
|
end
|
|
63
58
|
local _processing_1 = self.processing
|
|
64
59
|
local _name_1 = name
|
|
65
60
|
_processing_1[_name_1] = true
|
|
66
|
-
forge.debug:logTag("rules", name, "Evaluating rules")
|
|
67
61
|
TS.try(function()
|
|
68
62
|
ParentRule(forge, name, group)
|
|
69
63
|
ExclusiveGroupRule(forge, name, group)
|
package/package.json
CHANGED
package/out/debugger.d.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export type DebugTag = "render" | "rules" | "state" | "px" | "lifecycle";
|
|
2
|
-
type LogFn = (level: "DEBUG" | "PERF", message: string, data?: unknown, traceback?: string) => void;
|
|
3
|
-
export default class Debugger {
|
|
4
|
-
private readonly log;
|
|
5
|
-
private timers;
|
|
6
|
-
private enabled;
|
|
7
|
-
private allEnabled;
|
|
8
|
-
constructor(log: LogFn);
|
|
9
|
-
enable(tag: DebugTag): void;
|
|
10
|
-
disable(tag: DebugTag): void;
|
|
11
|
-
enableAll(): void;
|
|
12
|
-
disableAll(): void;
|
|
13
|
-
isEnabled(tag: DebugTag): boolean;
|
|
14
|
-
logTag(tag: DebugTag, app: AppNames, message: string, data?: unknown): void;
|
|
15
|
-
time(tag: DebugTag, app: AppNames): void;
|
|
16
|
-
timeEnd(tag: DebugTag, app: AppNames): void;
|
|
17
|
-
}
|
|
18
|
-
export {};
|
package/out/debugger.luau
DELETED
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
-- Services
|
|
4
|
-
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
5
|
-
local Debugger
|
|
6
|
-
do
|
|
7
|
-
Debugger = setmetatable({}, {
|
|
8
|
-
__tostring = function()
|
|
9
|
-
return "Debugger"
|
|
10
|
-
end,
|
|
11
|
-
})
|
|
12
|
-
Debugger.__index = Debugger
|
|
13
|
-
function Debugger.new(...)
|
|
14
|
-
local self = setmetatable({}, Debugger)
|
|
15
|
-
return self:constructor(...) or self
|
|
16
|
-
end
|
|
17
|
-
function Debugger:constructor(log)
|
|
18
|
-
self.log = log
|
|
19
|
-
self.timers = {}
|
|
20
|
-
self.enabled = {}
|
|
21
|
-
self.allEnabled = false
|
|
22
|
-
end
|
|
23
|
-
function Debugger:enable(tag)
|
|
24
|
-
local _enabled = self.enabled
|
|
25
|
-
local _tag = tag
|
|
26
|
-
_enabled[_tag] = true
|
|
27
|
-
end
|
|
28
|
-
function Debugger:disable(tag)
|
|
29
|
-
local _enabled = self.enabled
|
|
30
|
-
local _tag = tag
|
|
31
|
-
_enabled[_tag] = nil
|
|
32
|
-
end
|
|
33
|
-
function Debugger:enableAll()
|
|
34
|
-
self.allEnabled = true
|
|
35
|
-
end
|
|
36
|
-
function Debugger:disableAll()
|
|
37
|
-
self.allEnabled = false
|
|
38
|
-
table.clear(self.enabled)
|
|
39
|
-
end
|
|
40
|
-
function Debugger:isEnabled(tag)
|
|
41
|
-
local _condition = self.allEnabled
|
|
42
|
-
if not _condition then
|
|
43
|
-
local _enabled = self.enabled
|
|
44
|
-
local _tag = tag
|
|
45
|
-
_condition = _enabled[_tag] ~= nil
|
|
46
|
-
end
|
|
47
|
-
return _condition
|
|
48
|
-
end
|
|
49
|
-
function Debugger:logTag(tag, app, message, data)
|
|
50
|
-
if not RunService:IsStudio() then
|
|
51
|
-
return nil
|
|
52
|
-
end
|
|
53
|
-
if not self:isEnabled(tag) then
|
|
54
|
-
return nil
|
|
55
|
-
end
|
|
56
|
-
self.log("DEBUG", `[{tag}][{app}] {message}`, data)
|
|
57
|
-
end
|
|
58
|
-
function Debugger:time(tag, app)
|
|
59
|
-
if not RunService:IsStudio() then
|
|
60
|
-
return nil
|
|
61
|
-
end
|
|
62
|
-
if not self:isEnabled(tag) then
|
|
63
|
-
return nil
|
|
64
|
-
end
|
|
65
|
-
local _timers = self.timers
|
|
66
|
-
local _arg0 = `{tag}:{app}`
|
|
67
|
-
local _arg1 = os.clock()
|
|
68
|
-
_timers[_arg0] = _arg1
|
|
69
|
-
end
|
|
70
|
-
function Debugger:timeEnd(tag, app)
|
|
71
|
-
if not RunService:IsStudio() then
|
|
72
|
-
return nil
|
|
73
|
-
end
|
|
74
|
-
if not self:isEnabled(tag) then
|
|
75
|
-
return nil
|
|
76
|
-
end
|
|
77
|
-
local key = `{tag}:{app}`
|
|
78
|
-
local start = self.timers[key]
|
|
79
|
-
if start == nil then
|
|
80
|
-
return nil
|
|
81
|
-
end
|
|
82
|
-
self.timers[key] = nil
|
|
83
|
-
local elapsed = os.clock() - start
|
|
84
|
-
self.log("PERF", `[{tag}][{app}] {string.format("%.3fms", elapsed * 1000)}`)
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
return {
|
|
88
|
-
default = Debugger,
|
|
89
|
-
}
|
package/out/logger.d.ts
DELETED
package/out/logger.luau
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
-- debug/logger.ts
|
|
4
|
-
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
5
|
-
local Logger
|
|
6
|
-
do
|
|
7
|
-
Logger = setmetatable({}, {
|
|
8
|
-
__tostring = function()
|
|
9
|
-
return "Logger"
|
|
10
|
-
end,
|
|
11
|
-
})
|
|
12
|
-
Logger.__index = Logger
|
|
13
|
-
function Logger.new(...)
|
|
14
|
-
local self = setmetatable({}, Logger)
|
|
15
|
-
return self:constructor(...) or self
|
|
16
|
-
end
|
|
17
|
-
function Logger:constructor(scope)
|
|
18
|
-
self.scope = scope
|
|
19
|
-
end
|
|
20
|
-
function Logger:log(level, message, data, traceback)
|
|
21
|
-
if not RunService:IsStudio() then
|
|
22
|
-
return nil
|
|
23
|
-
end
|
|
24
|
-
local prefix = `[{self.scope}][{level}]`
|
|
25
|
-
if data ~= nil then
|
|
26
|
-
print(prefix, message, data)
|
|
27
|
-
else
|
|
28
|
-
print(prefix, message)
|
|
29
|
-
end
|
|
30
|
-
if traceback ~= "" and traceback then
|
|
31
|
-
print(traceback)
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
end
|
|
35
|
-
return {
|
|
36
|
-
default = Logger,
|
|
37
|
-
}
|