@rbxts/app-forge 0.7.2-prototype.3 → 0.7.2-prototype.30
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/renders.d.ts
CHANGED
|
@@ -1,8 +1,19 @@
|
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
1
2
|
import type Types from "./types";
|
|
2
3
|
import Rules from "./ruleEngine";
|
|
4
|
+
type Render = {
|
|
5
|
+
instance: Instance;
|
|
6
|
+
container: Instance;
|
|
7
|
+
entry: Types.AppRegistry.Static;
|
|
8
|
+
};
|
|
3
9
|
export default class Renders extends Rules {
|
|
4
10
|
private __px;
|
|
11
|
+
protected Loaded: Map<string, Map<string, Render>>;
|
|
5
12
|
constructor();
|
|
6
|
-
|
|
7
|
-
|
|
13
|
+
Load: (props: Types.Props.Main) => Instance[];
|
|
14
|
+
private resolveGroupEntries;
|
|
15
|
+
private getGroupEntries;
|
|
16
|
+
private createInstance;
|
|
17
|
+
protected initalize(props: Types.Props.Main, target?: GuiObject | Instance, root?: GuiObject | Instance): Vide.Node;
|
|
8
18
|
}
|
|
19
|
+
export {};
|
package/out/renders.luau
CHANGED
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
-- Packages
|
|
4
|
+
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
5
|
+
local Vide = _vide
|
|
6
|
+
local mount = _vide.mount
|
|
4
7
|
-- Types
|
|
5
8
|
-- Components
|
|
9
|
+
local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
|
|
6
10
|
-- Hooks
|
|
7
11
|
local usePx = TS.import(script, script.Parent, "hooks", "usePx").usePx
|
|
8
12
|
-- Classes
|
|
9
13
|
local Rules = TS.import(script, script.Parent, "ruleEngine").default
|
|
14
|
+
-- Helpers
|
|
15
|
+
local getAppEntry = TS.import(script, script.Parent, "helpers", "getAppEntry").default
|
|
10
16
|
local Renders
|
|
11
17
|
do
|
|
12
18
|
local super = Rules
|
|
@@ -24,41 +30,285 @@ do
|
|
|
24
30
|
function Renders:constructor()
|
|
25
31
|
super.constructor(self)
|
|
26
32
|
self.__px = false
|
|
33
|
+
self.Loaded = {}
|
|
34
|
+
self.Load = function(props)
|
|
35
|
+
local _binding = props
|
|
36
|
+
local renders = _binding.renders
|
|
37
|
+
local toLoad = {}
|
|
38
|
+
if not renders then
|
|
39
|
+
return {}
|
|
40
|
+
end
|
|
41
|
+
if renders.groups then
|
|
42
|
+
local _exp = renders.groups
|
|
43
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
44
|
+
local _callback = function(group)
|
|
45
|
+
local entries = self:resolveGroupEntries(group, renders.names, renders.name)
|
|
46
|
+
for _, entry in entries do
|
|
47
|
+
table.insert(toLoad, entry)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
for _k, _v in _exp do
|
|
51
|
+
_callback(_v, _k - 1, _exp)
|
|
52
|
+
end
|
|
53
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
54
|
+
end
|
|
55
|
+
local _value = renders.group
|
|
56
|
+
if _value ~= "" and _value then
|
|
57
|
+
local entries = self:resolveGroupEntries(renders.group, renders.names, renders.name)
|
|
58
|
+
for _, entry in entries do
|
|
59
|
+
table.insert(toLoad, entry)
|
|
60
|
+
end
|
|
61
|
+
end
|
|
62
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
63
|
+
local _callback = function(entry)
|
|
64
|
+
local name = tostring(entry.constructor)
|
|
65
|
+
local group = entry.group
|
|
66
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
67
|
+
local _callback_1 = function(groupEntries)
|
|
68
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
69
|
+
local _callback_2 = function(childEntry)
|
|
70
|
+
local _result = childEntry.rules
|
|
71
|
+
if _result ~= nil then
|
|
72
|
+
_result = _result.parent
|
|
73
|
+
end
|
|
74
|
+
local _condition = _result ~= name
|
|
75
|
+
if not _condition then
|
|
76
|
+
local _result_1 = childEntry.rules
|
|
77
|
+
if _result_1 ~= nil then
|
|
78
|
+
_result_1 = _result_1.parentGroup
|
|
79
|
+
end
|
|
80
|
+
_condition = _result_1 ~= group
|
|
81
|
+
end
|
|
82
|
+
if _condition then
|
|
83
|
+
return nil
|
|
84
|
+
end
|
|
85
|
+
local _childEntry = childEntry
|
|
86
|
+
table.insert(toLoad, _childEntry)
|
|
87
|
+
end
|
|
88
|
+
for _k, _v in groupEntries do
|
|
89
|
+
_callback_2(_v, _k, groupEntries)
|
|
90
|
+
end
|
|
91
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
92
|
+
end
|
|
93
|
+
for _k, _v in AppRegistry do
|
|
94
|
+
_callback_1(_v, _k, AppRegistry)
|
|
95
|
+
end
|
|
96
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
97
|
+
end
|
|
98
|
+
for _k, _v in toLoad do
|
|
99
|
+
_callback(_v, _k - 1, toLoad)
|
|
100
|
+
end
|
|
101
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
102
|
+
local load = {}
|
|
103
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
104
|
+
local _callback_1 = function(entry)
|
|
105
|
+
local name = tostring(entry.constructor)
|
|
106
|
+
local group = entry.group
|
|
107
|
+
self:createInstance(props, name, group)
|
|
108
|
+
local _exp = self.Loaded
|
|
109
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
110
|
+
local _callback_2 = function(renderGroup, loadedName)
|
|
111
|
+
if name ~= loadedName then
|
|
112
|
+
return nil
|
|
113
|
+
end
|
|
114
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
115
|
+
local _callback_3 = function(render, group)
|
|
116
|
+
if group ~= group then
|
|
117
|
+
return nil
|
|
118
|
+
end
|
|
119
|
+
local _result = render.entry.rules
|
|
120
|
+
if _result ~= nil then
|
|
121
|
+
_result = _result.parent
|
|
122
|
+
end
|
|
123
|
+
if not (_result ~= "" and _result) then
|
|
124
|
+
local _container = render.container
|
|
125
|
+
table.insert(load, _container)
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
for _k, _v in renderGroup do
|
|
129
|
+
_callback_3(_v, _k, renderGroup)
|
|
130
|
+
end
|
|
131
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
132
|
+
end
|
|
133
|
+
for _k, _v in _exp do
|
|
134
|
+
_callback_2(_v, _k, _exp)
|
|
135
|
+
end
|
|
136
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
137
|
+
end
|
|
138
|
+
for _k, _v in toLoad do
|
|
139
|
+
_callback_1(_v, _k - 1, toLoad)
|
|
140
|
+
end
|
|
141
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
142
|
+
print(load)
|
|
143
|
+
return load
|
|
144
|
+
end
|
|
27
145
|
end
|
|
28
|
-
function Renders:
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
local
|
|
34
|
-
if
|
|
35
|
-
|
|
146
|
+
function Renders:resolveGroupEntries(group, names, name)
|
|
147
|
+
local groupEntries = self:getGroupEntries(group)
|
|
148
|
+
local result = {}
|
|
149
|
+
if name ~= "" and name then
|
|
150
|
+
local _name = name
|
|
151
|
+
local _entry = groupEntries[_name]
|
|
152
|
+
if _entry ~= nil then
|
|
153
|
+
local _group = group
|
|
154
|
+
_entry = _entry[_group]
|
|
36
155
|
end
|
|
37
|
-
local
|
|
38
|
-
if
|
|
39
|
-
|
|
156
|
+
local entry = _entry
|
|
157
|
+
if entry then
|
|
158
|
+
table.insert(result, entry)
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
if names then
|
|
162
|
+
-- ▼ ReadonlyArray.forEach ▼
|
|
163
|
+
local _callback = function(n)
|
|
164
|
+
local _n = n
|
|
165
|
+
local _entry = groupEntries[_n]
|
|
166
|
+
if _entry ~= nil then
|
|
167
|
+
local _group = group
|
|
168
|
+
_entry = _entry[_group]
|
|
169
|
+
end
|
|
170
|
+
local entry = _entry
|
|
171
|
+
if entry then
|
|
172
|
+
table.insert(result, entry)
|
|
173
|
+
end
|
|
40
174
|
end
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
_result_2 = _result_2.px.minScale
|
|
175
|
+
for _k, _v in names do
|
|
176
|
+
_callback(_v, _k - 1, names)
|
|
44
177
|
end
|
|
45
|
-
|
|
46
|
-
self.__px = true
|
|
178
|
+
-- ▲ ReadonlyArray.forEach ▲
|
|
47
179
|
end
|
|
48
|
-
|
|
49
|
-
|
|
180
|
+
return result
|
|
181
|
+
end
|
|
182
|
+
function Renders:getGroupEntries(group)
|
|
183
|
+
local entries = {}
|
|
184
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
185
|
+
local _callback = function(regGroupEntries, name)
|
|
186
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
187
|
+
local _callback_1 = function(_, regGroup)
|
|
188
|
+
if group ~= regGroup then
|
|
189
|
+
return nil
|
|
190
|
+
end
|
|
191
|
+
local _entries = entries
|
|
192
|
+
local _name = name
|
|
193
|
+
local _regGroupEntries = regGroupEntries
|
|
194
|
+
_entries[_name] = _regGroupEntries
|
|
195
|
+
end
|
|
196
|
+
for _k, _v in regGroupEntries do
|
|
197
|
+
_callback_1(_v, _k, regGroupEntries)
|
|
198
|
+
end
|
|
199
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
200
|
+
end
|
|
201
|
+
for _k, _v in AppRegistry do
|
|
202
|
+
_callback(_v, _k, AppRegistry)
|
|
203
|
+
end
|
|
204
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
205
|
+
return entries
|
|
206
|
+
end
|
|
207
|
+
function Renders:createInstance(props, name, group)
|
|
208
|
+
local entry = getAppEntry(name, group)
|
|
209
|
+
if not entry then
|
|
210
|
+
return nil
|
|
211
|
+
end
|
|
212
|
+
local parentContainer
|
|
213
|
+
local _result = entry.rules
|
|
50
214
|
if _result ~= nil then
|
|
51
|
-
_result = _result.
|
|
215
|
+
_result = _result.parent
|
|
52
216
|
end
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
217
|
+
if _result ~= "" and _result then
|
|
218
|
+
local _value = entry.rules.parent
|
|
219
|
+
if _value ~= "" and _value then
|
|
220
|
+
local _condition = entry.rules.parentGroup
|
|
221
|
+
if not (_condition ~= "" and _condition) then
|
|
222
|
+
_condition = "None"
|
|
223
|
+
end
|
|
224
|
+
local group = _condition
|
|
225
|
+
local _loaded = self.Loaded
|
|
226
|
+
local _parent = entry.rules.parent
|
|
227
|
+
local parentMap = _loaded[_parent]
|
|
228
|
+
if parentMap then
|
|
229
|
+
local parentEntry = parentMap[group]
|
|
230
|
+
if parentEntry then
|
|
231
|
+
parentContainer = parentEntry.container
|
|
232
|
+
end
|
|
233
|
+
end
|
|
234
|
+
end
|
|
56
235
|
end
|
|
57
|
-
local
|
|
58
|
-
|
|
59
|
-
|
|
236
|
+
local instance = entry.constructor.new(props, name, group):render()
|
|
237
|
+
instance.Name = "Render"
|
|
238
|
+
local container = (Vide.jsx("frame", {
|
|
239
|
+
Name = name,
|
|
240
|
+
BackgroundTransparency = 1,
|
|
241
|
+
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
242
|
+
Position = UDim2.fromScale(0.5, 0.5),
|
|
243
|
+
Size = UDim2.fromScale(1, 1),
|
|
244
|
+
Parent = parentContainer,
|
|
245
|
+
}, instance))
|
|
246
|
+
local newMap = {}
|
|
247
|
+
local _group = group
|
|
248
|
+
local _arg1 = {
|
|
249
|
+
container = container,
|
|
250
|
+
instance = instance,
|
|
251
|
+
entry = entry,
|
|
252
|
+
}
|
|
253
|
+
newMap[_group] = _arg1
|
|
254
|
+
local _loaded = self.Loaded
|
|
255
|
+
local _name = name
|
|
256
|
+
_loaded[_name] = newMap
|
|
257
|
+
end
|
|
258
|
+
function Renders:initalize(props, target, root)
|
|
259
|
+
if target then
|
|
260
|
+
mount(function()
|
|
261
|
+
if not self.__px then
|
|
262
|
+
local _result = props.config
|
|
263
|
+
if _result ~= nil then
|
|
264
|
+
_result = _result.px.target
|
|
265
|
+
end
|
|
266
|
+
local _result_1 = props.config
|
|
267
|
+
if _result_1 ~= nil then
|
|
268
|
+
_result_1 = _result_1.px.resolution
|
|
269
|
+
end
|
|
270
|
+
local _result_2 = props.config
|
|
271
|
+
if _result_2 ~= nil then
|
|
272
|
+
_result_2 = _result_2.px.minScale
|
|
273
|
+
end
|
|
274
|
+
usePx(_result, _result_1, _result_2)
|
|
275
|
+
self.__px = true
|
|
276
|
+
end
|
|
277
|
+
local _result
|
|
278
|
+
if root then
|
|
279
|
+
_result = root
|
|
280
|
+
else
|
|
281
|
+
local _attributes = table.clone(props)
|
|
282
|
+
setmetatable(_attributes, nil)
|
|
283
|
+
_result = (Vide.jsx("screengui", {
|
|
284
|
+
Name = "App Tree",
|
|
285
|
+
ZIndexBehavior = "Sibling",
|
|
286
|
+
ResetOnSpawn = false,
|
|
287
|
+
}, Vide.jsx(self.Load, _attributes)))
|
|
288
|
+
end
|
|
289
|
+
return _result
|
|
290
|
+
end)
|
|
291
|
+
else
|
|
292
|
+
if not self.__px then
|
|
293
|
+
local _result = props.config
|
|
294
|
+
if _result ~= nil then
|
|
295
|
+
_result = _result.px.target
|
|
296
|
+
end
|
|
297
|
+
local _result_1 = props.config
|
|
298
|
+
if _result_1 ~= nil then
|
|
299
|
+
_result_1 = _result_1.px.resolution
|
|
300
|
+
end
|
|
301
|
+
local _result_2 = props.config
|
|
302
|
+
if _result_2 ~= nil then
|
|
303
|
+
_result_2 = _result_2.px.minScale
|
|
304
|
+
end
|
|
305
|
+
usePx(_result, _result_1, _result_2)
|
|
306
|
+
self.__px = true
|
|
307
|
+
end
|
|
308
|
+
local _attributes = table.clone(props)
|
|
309
|
+
setmetatable(_attributes, nil)
|
|
310
|
+
return Vide.jsx(self.Load, _attributes)
|
|
60
311
|
end
|
|
61
|
-
_self:render(_result, _result_1, _result_2)
|
|
62
312
|
end
|
|
63
313
|
end
|
|
64
314
|
return {
|
|
@@ -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,46 +3,41 @@ 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(name, group)
|
|
10
|
+
if not entry then
|
|
11
|
+
error(`Failed to find app entry for "ExclusiveGroupRule" name {name} group {group}`)
|
|
19
12
|
end
|
|
20
|
-
local entryVisible = forge:getSource(name)()
|
|
13
|
+
local entryVisible = forge:getSource(name, group)()
|
|
21
14
|
if not entryVisible then
|
|
22
15
|
return nil
|
|
23
16
|
end
|
|
24
|
-
forge.debug:logTag("rules", name, "Exclusive group activated", group)
|
|
25
17
|
-- ▼ ReadonlyMap.forEach ▼
|
|
26
|
-
local _callback = function(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
_result =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
18
|
+
local _callback = function(entryMap, entryGroup)
|
|
19
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
20
|
+
local _callback_1 = function(entry, entryName)
|
|
21
|
+
if name == entryName then
|
|
22
|
+
return nil
|
|
23
|
+
end
|
|
24
|
+
local _result = entry.rules
|
|
25
|
+
if _result ~= nil then
|
|
26
|
+
_result = _result.exclusiveGroup
|
|
27
|
+
end
|
|
28
|
+
if _result ~= entryGroup then
|
|
29
|
+
return nil
|
|
30
|
+
end
|
|
31
|
+
local visible = forge:getSource(entryName)()
|
|
32
|
+
if not visible then
|
|
33
|
+
return nil
|
|
34
|
+
end
|
|
35
|
+
forge:close(entryName, entryGroup, false)
|
|
36
36
|
end
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
return nil
|
|
37
|
+
for _k, _v in entryMap do
|
|
38
|
+
_callback_1(_v, _k, entryMap)
|
|
40
39
|
end
|
|
41
|
-
|
|
42
|
-
closed = name,
|
|
43
|
-
group = group,
|
|
44
|
-
})
|
|
45
|
-
forge:close(name, false)
|
|
40
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
46
41
|
end
|
|
47
42
|
for _k, _v in AppRegistry do
|
|
48
43
|
_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(name, group)
|
|
9
9
|
local _result = entry
|
|
10
10
|
if _result ~= nil then
|
|
11
11
|
_result = _result.rules
|
|
@@ -16,17 +16,17 @@ 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
|
-
if
|
|
22
|
-
|
|
23
|
-
if _result_1 ~= nil then
|
|
24
|
-
_result_1 = _result_1.parent
|
|
25
|
-
end
|
|
19
|
+
local _exp = entry.rules.parent
|
|
20
|
+
local _condition = entry.rules.parentGroup
|
|
21
|
+
if _condition == nil then
|
|
22
|
+
_condition = "None"
|
|
26
23
|
end
|
|
27
|
-
local parentSource =
|
|
28
|
-
if
|
|
29
|
-
local source = forge:getSource(name)
|
|
24
|
+
local parentSource = getAppSource(_exp, _condition)
|
|
25
|
+
if parentSource and parentSource() == false then
|
|
26
|
+
local source = forge:getSource(name, group)
|
|
27
|
+
if not source then
|
|
28
|
+
warn(`Failed to get Source for name {name} group {group}`)
|
|
29
|
+
end
|
|
30
30
|
if source() then
|
|
31
31
|
source(false)
|
|
32
32
|
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(
|
|
6
|
-
protected checkRules(forge: AppForge, name: AppNames): void;
|
|
5
|
+
protected renderRules(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(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
function Rules:renderRules(name, group, props)
|
|
27
|
+
if group == nil then
|
|
28
|
+
group = "None"
|
|
29
|
+
end
|
|
30
|
+
local entry = getAppEntry(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
|
|
@@ -38,32 +41,26 @@ do
|
|
|
38
41
|
_condition = not rules.anchor
|
|
39
42
|
end
|
|
40
43
|
if _condition ~= "" and _condition then
|
|
41
|
-
|
|
42
|
-
parent = rules.parent,
|
|
43
|
-
})
|
|
44
|
-
AnchorRule(name, props)
|
|
44
|
+
AnchorRule(name, group, props)
|
|
45
45
|
end
|
|
46
46
|
-- Index
|
|
47
47
|
if rules.zIndex ~= nil then
|
|
48
|
-
forge.debug:logTag("rules", name, "Applying ZIndex", rules.zIndex)
|
|
49
48
|
-- TODO: will be a separate file under ruleEngine
|
|
50
49
|
-- forge.index(name, rules.zIndex);
|
|
51
50
|
end
|
|
52
51
|
end
|
|
53
|
-
function Rules:checkRules(forge, name)
|
|
52
|
+
function Rules:checkRules(forge, name, group)
|
|
54
53
|
local _processing = self.processing
|
|
55
54
|
local _name = name
|
|
56
55
|
if _processing[_name] ~= nil then
|
|
57
|
-
forge.debug:logTag("rules", name, "Skipped rule processing (cycle detected)")
|
|
58
56
|
return nil
|
|
59
57
|
end
|
|
60
58
|
local _processing_1 = self.processing
|
|
61
59
|
local _name_1 = name
|
|
62
60
|
_processing_1[_name_1] = true
|
|
63
|
-
forge.debug:logTag("rules", name, "Evaluating rules")
|
|
64
61
|
TS.try(function()
|
|
65
|
-
ParentRule(name,
|
|
66
|
-
ExclusiveGroupRule(name,
|
|
62
|
+
ParentRule(forge, name, group)
|
|
63
|
+
ExclusiveGroupRule(forge, name, group)
|
|
67
64
|
end, nil, function()
|
|
68
65
|
local _processing_2 = self.processing
|
|
69
66
|
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
|
@@ -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,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
|
|