@rbxts/app-forge 0.7.2-prototype.1 → 0.7.2-prototype.2
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/mount.d.ts +1 -5
- package/out/mount.luau +6 -89
- package/out/renderManager.d.ts +2 -27
- package/out/renderManager.luau +5 -295
- package/out/ruleEngine/init.luau +4 -2
- package/out/types.d.ts +1 -1
- package/package.json +1 -1
package/out/mount.d.ts
CHANGED
|
@@ -15,23 +15,19 @@ export default class AppForge extends Renders {
|
|
|
15
15
|
protected sources: Map<string, Vide.Source<boolean>>;
|
|
16
16
|
protected loaded: Map<string, Loaded>;
|
|
17
17
|
protected innerMount?: Destructor;
|
|
18
|
-
protected __px: boolean;
|
|
19
18
|
constructor();
|
|
20
19
|
protected createSource(name: AppNames): void;
|
|
21
20
|
getSource(name: AppNames): Vide.Source<boolean>;
|
|
22
21
|
isLoaded(name: AppNames): boolean;
|
|
23
22
|
bind(name: AppNames, value: Vide.Source<boolean>): void;
|
|
24
|
-
anchor(name: AppNames, anchorName: AppNames, props: Types.Props.Main): void;
|
|
25
|
-
index(name: AppNames, index: number): void;
|
|
26
23
|
set(name: AppNames, value: boolean, rules?: boolean): void;
|
|
27
24
|
open(name: AppNames, rules?: boolean): void;
|
|
28
25
|
close(name: AppNames, rules?: boolean): void;
|
|
29
26
|
toggle(name: AppNames, rules?: boolean): void;
|
|
30
|
-
story(props: AppProps, target: GuiObject,
|
|
27
|
+
story(props: AppProps, target: GuiObject, config?: {
|
|
31
28
|
render?: Types.Props.Render;
|
|
32
29
|
minScale?: number;
|
|
33
30
|
}): Frame;
|
|
34
31
|
mount(node: Vide.Node, props: Types.Props.Main, target: Instance): Destructor;
|
|
35
|
-
unMount(): void;
|
|
36
32
|
}
|
|
37
33
|
export {};
|
package/out/mount.luau
CHANGED
|
@@ -39,7 +39,6 @@ do
|
|
|
39
39
|
end)
|
|
40
40
|
self.sources = {}
|
|
41
41
|
self.loaded = {}
|
|
42
|
-
self.__px = false
|
|
43
42
|
-- ▼ ReadonlyMap.forEach ▼
|
|
44
43
|
local _callback = function(_, name)
|
|
45
44
|
return self:createSource(name)
|
|
@@ -136,81 +135,6 @@ do
|
|
|
136
135
|
})
|
|
137
136
|
end
|
|
138
137
|
end
|
|
139
|
-
function AppForge:anchor(name, anchorName, props)
|
|
140
|
-
if name == anchorName then
|
|
141
|
-
self.logger:log("ERROR", "Attempted to anchor app to itself", {
|
|
142
|
-
name = name,
|
|
143
|
-
})
|
|
144
|
-
return nil
|
|
145
|
-
end
|
|
146
|
-
local _anchorName = anchorName
|
|
147
|
-
local anchorApp = AppRegistry[_anchorName]
|
|
148
|
-
if not anchorApp then
|
|
149
|
-
self.logger:log("ERROR", "Anchor parent not registered", {
|
|
150
|
-
child = name,
|
|
151
|
-
parent = anchorName,
|
|
152
|
-
})
|
|
153
|
-
return nil
|
|
154
|
-
end
|
|
155
|
-
local _loaded = self.loaded
|
|
156
|
-
local _name = name
|
|
157
|
-
local _render = _loaded[_name]
|
|
158
|
-
if _render ~= nil then
|
|
159
|
-
_render = _render.render
|
|
160
|
-
end
|
|
161
|
-
local render = _render
|
|
162
|
-
if not render then
|
|
163
|
-
self.debug:logTag("rules", name, "Anchor skipped (child not rendered yet)", {
|
|
164
|
-
parent = anchorName,
|
|
165
|
-
})
|
|
166
|
-
return nil
|
|
167
|
-
end
|
|
168
|
-
self.debug:logTag("rules", name, "Anchoring to parent", {
|
|
169
|
-
parent = anchorName,
|
|
170
|
-
})
|
|
171
|
-
local anchor = anchorApp.constructor.new(props, anchorName):render()
|
|
172
|
-
for _, child in anchor:GetDescendants() do
|
|
173
|
-
child:Destroy()
|
|
174
|
-
end
|
|
175
|
-
apply(anchor)({
|
|
176
|
-
Name = "Anchor",
|
|
177
|
-
BackgroundTransparency = 1,
|
|
178
|
-
[0] = render,
|
|
179
|
-
})
|
|
180
|
-
local _loaded_1 = self.loaded
|
|
181
|
-
local _name_1 = name
|
|
182
|
-
local prev = _loaded_1[_name_1]
|
|
183
|
-
if not prev then
|
|
184
|
-
error(`AppForge invariant broken: missing loaded app for {name}`, 2)
|
|
185
|
-
end
|
|
186
|
-
apply(prev.container)({
|
|
187
|
-
[0] = anchor,
|
|
188
|
-
})
|
|
189
|
-
local _loaded_2 = self.loaded
|
|
190
|
-
local _exp = name
|
|
191
|
-
local _object = table.clone(prev)
|
|
192
|
-
setmetatable(_object, nil)
|
|
193
|
-
_object.anchor = anchor
|
|
194
|
-
_loaded_2[_exp] = _object
|
|
195
|
-
end
|
|
196
|
-
function AppForge:index(name, index)
|
|
197
|
-
local _loaded = self.loaded
|
|
198
|
-
local _name = name
|
|
199
|
-
local loaded = _loaded[_name]
|
|
200
|
-
if not loaded then
|
|
201
|
-
self.logger:log("WARN", "ZIndex skipped (app not loaded)", {
|
|
202
|
-
name = name,
|
|
203
|
-
index = index,
|
|
204
|
-
})
|
|
205
|
-
return nil
|
|
206
|
-
end
|
|
207
|
-
self.debug:logTag("rules", name, "Applying ZIndex", {
|
|
208
|
-
index = index,
|
|
209
|
-
})
|
|
210
|
-
apply(loaded.container)({
|
|
211
|
-
ZIndex = index,
|
|
212
|
-
})
|
|
213
|
-
end
|
|
214
138
|
function AppForge:set(name, value, rules)
|
|
215
139
|
if rules == nil then
|
|
216
140
|
rules = true
|
|
@@ -261,7 +185,7 @@ do
|
|
|
261
185
|
end
|
|
262
186
|
self:set(name, not self:getSource(name)(), rules)
|
|
263
187
|
end
|
|
264
|
-
function AppForge:story(props, target,
|
|
188
|
+
function AppForge:story(props, target, config)
|
|
265
189
|
self.debug:logTag("lifecycle", "story", "Creating story mount")
|
|
266
190
|
local Container = create("Frame")({
|
|
267
191
|
Name = "Story Container",
|
|
@@ -278,8 +202,8 @@ do
|
|
|
278
202
|
props = props,
|
|
279
203
|
forge = self,
|
|
280
204
|
}
|
|
281
|
-
local _left_1 = "
|
|
282
|
-
local _result =
|
|
205
|
+
local _left_1 = "renders"
|
|
206
|
+
local _result = config
|
|
283
207
|
if _result ~= nil then
|
|
284
208
|
_result = _result.render
|
|
285
209
|
end
|
|
@@ -291,14 +215,14 @@ do
|
|
|
291
215
|
target = target,
|
|
292
216
|
}
|
|
293
217
|
local _left_4 = "minScale"
|
|
294
|
-
local _result_1 =
|
|
218
|
+
local _result_1 = config
|
|
295
219
|
if _result_1 ~= nil then
|
|
296
220
|
_result_1 = _result_1.minScale
|
|
297
221
|
end
|
|
298
222
|
_object_3[_left_4] = _result_1
|
|
299
223
|
_object_2[_left_3] = _object_3
|
|
300
224
|
_object_1[_left_2] = _object_2
|
|
301
|
-
_object[_left] = _self:
|
|
225
|
+
_object[_left] = _self:initalize(_object_1)
|
|
302
226
|
_fn(_object)
|
|
303
227
|
return Container
|
|
304
228
|
end
|
|
@@ -306,19 +230,12 @@ do
|
|
|
306
230
|
self.debug:logTag("lifecycle", "mount", "Mounting AppForge")
|
|
307
231
|
self.innerMount = mount(function()
|
|
308
232
|
apply(node)({
|
|
309
|
-
[0] = self:
|
|
233
|
+
[0] = self:initalize(props),
|
|
310
234
|
})
|
|
311
235
|
return node
|
|
312
236
|
end, target)
|
|
313
237
|
return self.innerMount
|
|
314
238
|
end
|
|
315
|
-
function AppForge:unMount()
|
|
316
|
-
self.debug:logTag("lifecycle", "unmount", "Unmounting AppForge")
|
|
317
|
-
local _result = self.innerMount
|
|
318
|
-
if _result ~= nil then
|
|
319
|
-
_result()
|
|
320
|
-
end
|
|
321
|
-
end
|
|
322
239
|
end
|
|
323
240
|
return {
|
|
324
241
|
default = AppForge,
|
package/out/renderManager.d.ts
CHANGED
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
import Vide from "@rbxts/vide";
|
|
2
1
|
import type Types from "./types";
|
|
3
|
-
import type AppForge from "./mount";
|
|
4
2
|
import Rules from "./ruleEngine";
|
|
5
3
|
export default class Renders extends Rules {
|
|
6
|
-
|
|
7
|
-
id: AppNames;
|
|
8
|
-
render: Vide.Node;
|
|
9
|
-
}>;
|
|
4
|
+
private __px;
|
|
10
5
|
constructor();
|
|
11
|
-
|
|
12
|
-
* Entry point for mounting renders.
|
|
13
|
-
* Decides render strategy based on props.
|
|
14
|
-
*/
|
|
15
|
-
protected renderMount(this: AppForge, props: Types.Props.Main): Vide.Node;
|
|
16
|
-
/**
|
|
17
|
-
* Render multiple apps by name, avoiding duplicates.
|
|
18
|
-
*/
|
|
19
|
-
private renderNames;
|
|
20
|
-
/**
|
|
21
|
-
* Render children of a parent app recursively inside parent container
|
|
22
|
-
*/
|
|
23
|
-
private renderChildren;
|
|
24
|
-
private collectByGroup;
|
|
25
|
-
private normalizeGroups;
|
|
26
|
-
protected renderApp(this: AppForge, props: Types.Props.Main, renderedSet?: Set<AppNames>, parentContainer?: Instance): Vide.Node;
|
|
27
|
-
protected renderApps(this: AppForge, props: Types.Props.Main, renderedSet?: Set<AppNames>): Instance[];
|
|
28
|
-
protected renderGroup(this: AppForge, props: Types.Props.Main, renderedSet?: Set<AppNames>): Instance[];
|
|
29
|
-
protected renderGroupByName(this: AppForge, props: Types.Props.Main, renderedSet?: Set<AppNames>): Instance[];
|
|
30
|
-
protected renderGroupByNames(this: AppForge, props: Types.Props.Main, renderedSet?: Set<AppNames>): Instance[];
|
|
31
|
-
protected renderAll(this: AppForge, props: Types.Props.Main, renderedSet?: Set<AppNames>): Instance[];
|
|
6
|
+
protected initalize(props: Types.Props.Main): void;
|
|
32
7
|
}
|
package/out/renderManager.luau
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
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 apply = _vide.apply
|
|
6
|
-
local create = _vide.create
|
|
7
|
-
local mount = _vide.mount
|
|
8
4
|
-- Types
|
|
9
5
|
-- Components
|
|
10
|
-
local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
|
|
11
6
|
-- Hooks
|
|
12
|
-
local usePx = TS.import(script, script.Parent, "hooks", "usePx").usePx
|
|
13
7
|
-- Classes
|
|
14
8
|
local Rules = TS.import(script, script.Parent, "ruleEngine").default
|
|
15
9
|
local Renders
|
|
@@ -28,297 +22,13 @@ do
|
|
|
28
22
|
end
|
|
29
23
|
function Renders:constructor()
|
|
30
24
|
super.constructor(self)
|
|
31
|
-
self.
|
|
25
|
+
self.__px = false
|
|
32
26
|
end
|
|
33
|
-
function Renders:
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
local render = _binding.render
|
|
37
|
-
local forge = _binding.forge
|
|
38
|
-
if not forge.__px then
|
|
39
|
-
local _debug = forge.debug
|
|
40
|
-
local _result = config
|
|
41
|
-
if _result ~= nil then
|
|
42
|
-
_result = _result.px
|
|
43
|
-
end
|
|
44
|
-
_debug:logTag("px", "global", "Initializing px scaling", _result)
|
|
45
|
-
local _result_1 = config
|
|
46
|
-
if _result_1 ~= nil then
|
|
47
|
-
_result_1 = _result_1.px.target
|
|
48
|
-
end
|
|
49
|
-
local _result_2 = config
|
|
50
|
-
if _result_2 ~= nil then
|
|
51
|
-
_result_2 = _result_2.px.resolution
|
|
52
|
-
end
|
|
53
|
-
local _result_3 = config
|
|
54
|
-
if _result_3 ~= nil then
|
|
55
|
-
_result_3 = _result_3.px.minScale
|
|
56
|
-
end
|
|
57
|
-
usePx(_result_1, _result_2, _result_3)
|
|
58
|
-
forge.__px = true
|
|
59
|
-
else
|
|
60
|
-
forge.debug:logTag("px", "global", "Skipped duplicate px initialization")
|
|
27
|
+
function Renders:initalize(props)
|
|
28
|
+
if not self.__px then
|
|
29
|
+
self.__px = true
|
|
61
30
|
end
|
|
62
|
-
|
|
63
|
-
if render then
|
|
64
|
-
local _condition = render.name
|
|
65
|
-
if _condition ~= "" and _condition then
|
|
66
|
-
_condition = render.group
|
|
67
|
-
end
|
|
68
|
-
if _condition ~= "" and _condition then
|
|
69
|
-
return self:renderGroupByName(props, renderedSet)
|
|
70
|
-
end
|
|
71
|
-
local _value = render.names and render.group
|
|
72
|
-
if _value ~= "" and _value then
|
|
73
|
-
return self:renderGroupByNames(props, renderedSet)
|
|
74
|
-
end
|
|
75
|
-
local _value_1 = render.name
|
|
76
|
-
if _value_1 ~= "" and _value_1 then
|
|
77
|
-
return self:renderApp(props, renderedSet)
|
|
78
|
-
end
|
|
79
|
-
if render.names then
|
|
80
|
-
return self:renderApps(props, renderedSet)
|
|
81
|
-
end
|
|
82
|
-
local _value_2 = render.group
|
|
83
|
-
if _value_2 ~= "" and _value_2 then
|
|
84
|
-
return self:renderGroup(props, renderedSet)
|
|
85
|
-
end
|
|
86
|
-
end
|
|
87
|
-
return self:renderAll(props, renderedSet)
|
|
88
|
-
end
|
|
89
|
-
function Renders:renderNames(props, names, forge, context, renderedSet, details, parentContainer)
|
|
90
|
-
if not names then
|
|
91
|
-
local _logger = forge.logger
|
|
92
|
-
local _exp = `Renderer resolved 0 apps ({context})`
|
|
93
|
-
local _condition = details
|
|
94
|
-
if _condition == nil then
|
|
95
|
-
_condition = props.render
|
|
96
|
-
end
|
|
97
|
-
_logger:log("WARN", _exp, _condition)
|
|
98
|
-
return {}
|
|
99
|
-
end
|
|
100
|
-
local rendered = {}
|
|
101
|
-
for _, name in names do
|
|
102
|
-
if renderedSet[name] ~= nil then
|
|
103
|
-
continue
|
|
104
|
-
end
|
|
105
|
-
renderedSet[name] = true
|
|
106
|
-
local _forge = forge
|
|
107
|
-
local _object = table.clone(props)
|
|
108
|
-
setmetatable(_object, nil)
|
|
109
|
-
_object.render = {
|
|
110
|
-
name = name,
|
|
111
|
-
}
|
|
112
|
-
local appRender = _forge:renderApp(_object, renderedSet, parentContainer)
|
|
113
|
-
table.insert(rendered, appRender)
|
|
114
|
-
self:renderChildren(props, name, forge, renderedSet, rendered, appRender)
|
|
115
|
-
end
|
|
116
|
-
return rendered
|
|
117
|
-
end
|
|
118
|
-
function Renders:renderChildren(props, parentName, forge, renderedSet, accumulated, parentContainer)
|
|
119
|
-
-- ▼ ReadonlyMap.forEach ▼
|
|
120
|
-
local _callback = function(app, childName)
|
|
121
|
-
local _result = app.rules
|
|
122
|
-
if _result ~= nil then
|
|
123
|
-
_result = _result.parent
|
|
124
|
-
end
|
|
125
|
-
local _condition = _result == parentName
|
|
126
|
-
if _condition then
|
|
127
|
-
local _renderedSet = renderedSet
|
|
128
|
-
local _childName = childName
|
|
129
|
-
_condition = not (_renderedSet[_childName] ~= nil)
|
|
130
|
-
end
|
|
131
|
-
if _condition then
|
|
132
|
-
local _renderedSet = renderedSet
|
|
133
|
-
local _childName = childName
|
|
134
|
-
_renderedSet[_childName] = true
|
|
135
|
-
local _forge = forge
|
|
136
|
-
local _object = table.clone(props)
|
|
137
|
-
setmetatable(_object, nil)
|
|
138
|
-
_object.render = {
|
|
139
|
-
name = childName,
|
|
140
|
-
}
|
|
141
|
-
local childRender = _forge:renderApp(_object, renderedSet, parentContainer)
|
|
142
|
-
table.insert(accumulated, childRender)
|
|
143
|
-
mount(function()
|
|
144
|
-
return childRender
|
|
145
|
-
end, parentContainer)
|
|
146
|
-
self:renderChildren(props, childName, forge, renderedSet, accumulated, childRender)
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
for _k, _v in AppRegistry do
|
|
150
|
-
_callback(_v, _k, AppRegistry)
|
|
151
|
-
end
|
|
152
|
-
-- ▲ ReadonlyMap.forEach ▲
|
|
153
|
-
end
|
|
154
|
-
function Renders:collectByGroup(groups, filter)
|
|
155
|
-
local result = {}
|
|
156
|
-
-- ▼ ReadonlyMap.forEach ▼
|
|
157
|
-
local _callback = function(app, name)
|
|
158
|
-
local appGroup = app.renderGroup
|
|
159
|
-
if not (appGroup ~= "" and appGroup) then
|
|
160
|
-
return nil
|
|
161
|
-
end
|
|
162
|
-
if not (table.find(groups, appGroup) ~= nil) then
|
|
163
|
-
return nil
|
|
164
|
-
end
|
|
165
|
-
if filter and not filter(name) then
|
|
166
|
-
return nil
|
|
167
|
-
end
|
|
168
|
-
local _name = name
|
|
169
|
-
table.insert(result, _name)
|
|
170
|
-
end
|
|
171
|
-
for _k, _v in AppRegistry do
|
|
172
|
-
_callback(_v, _k, AppRegistry)
|
|
173
|
-
end
|
|
174
|
-
-- ▲ ReadonlyMap.forEach ▲
|
|
175
|
-
return result
|
|
176
|
-
end
|
|
177
|
-
function Renders:normalizeGroups(group)
|
|
178
|
-
local _group = group
|
|
179
|
-
local _result
|
|
180
|
-
if type(_group) == "table" then
|
|
181
|
-
local _array = {}
|
|
182
|
-
local _length = #_array
|
|
183
|
-
table.move(group, 1, #group, _length + 1, _array)
|
|
184
|
-
_result = _array
|
|
185
|
-
else
|
|
186
|
-
_result = { group }
|
|
187
|
-
end
|
|
188
|
-
return _result
|
|
189
|
-
end
|
|
190
|
-
function Renders:renderApp(props, renderedSet, parentContainer)
|
|
191
|
-
local _name = props.render
|
|
192
|
-
if _name ~= nil then
|
|
193
|
-
_name = _name.name
|
|
194
|
-
end
|
|
195
|
-
local name = _name
|
|
196
|
-
if not (name ~= "" and name) then
|
|
197
|
-
error("renderApp requires an app name", 2)
|
|
198
|
-
end
|
|
199
|
-
local appClass = AppRegistry[name]
|
|
200
|
-
if not appClass then
|
|
201
|
-
error(`App "{name}" not registered`, 2)
|
|
202
|
-
end
|
|
203
|
-
self.debug:time("render", name)
|
|
204
|
-
if not (self.loaded[name] ~= nil) then
|
|
205
|
-
local render = appClass.constructor.new(props, name):render()
|
|
206
|
-
if not render then
|
|
207
|
-
error(`App "{name}" returned undefined from render()`, 2)
|
|
208
|
-
end
|
|
209
|
-
apply(render)({
|
|
210
|
-
Name = "Render",
|
|
211
|
-
})
|
|
212
|
-
local container = create("Frame")({
|
|
213
|
-
Name = name,
|
|
214
|
-
BackgroundTransparency = 1,
|
|
215
|
-
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
216
|
-
Position = UDim2.fromScale(0.5, 0.5),
|
|
217
|
-
Size = UDim2.fromScale(1, 1),
|
|
218
|
-
[0] = render,
|
|
219
|
-
})
|
|
220
|
-
if parentContainer then
|
|
221
|
-
container.Parent = parentContainer
|
|
222
|
-
end
|
|
223
|
-
local _loaded = self.loaded
|
|
224
|
-
local _arg1 = {
|
|
225
|
-
container = container,
|
|
226
|
-
render = render,
|
|
227
|
-
}
|
|
228
|
-
_loaded[name] = _arg1
|
|
229
|
-
else
|
|
230
|
-
self.debug:logTag("render", name, "Reusing existing render instance")
|
|
231
|
-
end
|
|
232
|
-
local _result = renderedSet
|
|
233
|
-
if _result ~= nil then
|
|
234
|
-
_result[name] = true
|
|
235
|
-
end
|
|
236
|
-
self:renderRules(self, name, props)
|
|
237
|
-
self.debug:timeEnd("render", name)
|
|
238
|
-
return self.loaded[name].container
|
|
239
|
-
end
|
|
240
|
-
function Renders:renderApps(props, renderedSet)
|
|
241
|
-
if renderedSet == nil then
|
|
242
|
-
renderedSet = {}
|
|
243
|
-
end
|
|
244
|
-
local _names = props.render
|
|
245
|
-
if _names ~= nil then
|
|
246
|
-
_names = _names.names
|
|
247
|
-
end
|
|
248
|
-
local names = _names
|
|
249
|
-
if not names then
|
|
250
|
-
error("renderApps requires app names", 2)
|
|
251
|
-
end
|
|
252
|
-
return self:renderNames(props, names, self, "renderApps", renderedSet, names)
|
|
253
|
-
end
|
|
254
|
-
function Renders:renderGroup(props, renderedSet)
|
|
255
|
-
if renderedSet == nil then
|
|
256
|
-
renderedSet = {}
|
|
257
|
-
end
|
|
258
|
-
local _group = props.render
|
|
259
|
-
if _group ~= nil then
|
|
260
|
-
_group = _group.group
|
|
261
|
-
end
|
|
262
|
-
local group = _group
|
|
263
|
-
if not (group ~= "" and group) then
|
|
264
|
-
error("renderGroup requires a group", 2)
|
|
265
|
-
end
|
|
266
|
-
local groups = self:normalizeGroups(group)
|
|
267
|
-
return self:renderNames(props, self:collectByGroup(groups), self, "renderGroup", renderedSet, group)
|
|
268
|
-
end
|
|
269
|
-
function Renders:renderGroupByName(props, renderedSet)
|
|
270
|
-
if renderedSet == nil then
|
|
271
|
-
renderedSet = {}
|
|
272
|
-
end
|
|
273
|
-
local _binding = props.render or {}
|
|
274
|
-
local group = _binding.group
|
|
275
|
-
local name = _binding.name
|
|
276
|
-
if not (group ~= "" and group) or not (name ~= "" and name) then
|
|
277
|
-
error("Invalid renderGroupByName call", 2)
|
|
278
|
-
end
|
|
279
|
-
local groups = self:normalizeGroups(group)
|
|
280
|
-
return self:renderNames(props, self:collectByGroup(groups, function(n)
|
|
281
|
-
return n == name
|
|
282
|
-
end), self, "renderGroupByName", renderedSet, {
|
|
283
|
-
group = group,
|
|
284
|
-
name = name,
|
|
285
|
-
})
|
|
286
|
-
end
|
|
287
|
-
function Renders:renderGroupByNames(props, renderedSet)
|
|
288
|
-
if renderedSet == nil then
|
|
289
|
-
renderedSet = {}
|
|
290
|
-
end
|
|
291
|
-
local _binding = props.render or {}
|
|
292
|
-
local group = _binding.group
|
|
293
|
-
local names = _binding.names
|
|
294
|
-
if not (group ~= "" and group) or not names then
|
|
295
|
-
error("Invalid renderGroupByNames call", 2)
|
|
296
|
-
end
|
|
297
|
-
local groups = self:normalizeGroups(group)
|
|
298
|
-
return self:renderNames(props, self:collectByGroup(groups, function(n)
|
|
299
|
-
local _n = n
|
|
300
|
-
return table.find(names, _n) ~= nil
|
|
301
|
-
end), self, "renderGroupByNames", renderedSet, {
|
|
302
|
-
group = group,
|
|
303
|
-
names = names,
|
|
304
|
-
})
|
|
305
|
-
end
|
|
306
|
-
function Renders:renderAll(props, renderedSet)
|
|
307
|
-
if renderedSet == nil then
|
|
308
|
-
renderedSet = {}
|
|
309
|
-
end
|
|
310
|
-
local names = {}
|
|
311
|
-
-- ▼ ReadonlyMap.forEach ▼
|
|
312
|
-
local _callback = function(_, name)
|
|
313
|
-
local _name = name
|
|
314
|
-
table.insert(names, _name)
|
|
315
|
-
return #names
|
|
316
|
-
end
|
|
317
|
-
for _k, _v in AppRegistry do
|
|
318
|
-
_callback(_v, _k, AppRegistry)
|
|
319
|
-
end
|
|
320
|
-
-- ▲ ReadonlyMap.forEach ▲
|
|
321
|
-
return self:renderNames(props, names, self, "renderAll", renderedSet)
|
|
31
|
+
props.forge.logger:log("INFO", "Initalized Renders", props.renders)
|
|
322
32
|
end
|
|
323
33
|
end
|
|
324
34
|
return {
|
package/out/ruleEngine/init.luau
CHANGED
|
@@ -40,12 +40,14 @@ do
|
|
|
40
40
|
forge.debug:logTag("rules", name, "Applying parent anchor", {
|
|
41
41
|
parent = rules.parent,
|
|
42
42
|
})
|
|
43
|
-
|
|
43
|
+
-- TODO: will be a separate file under ruleEngine
|
|
44
|
+
-- forge.anchor(name, rules.parent, props);
|
|
44
45
|
end
|
|
45
46
|
-- Index
|
|
46
47
|
if rules.zIndex ~= nil then
|
|
47
48
|
forge.debug:logTag("rules", name, "Applying ZIndex", rules.zIndex)
|
|
48
|
-
|
|
49
|
+
-- TODO: will be a separate file under ruleEngine
|
|
50
|
+
-- forge.index(name, rules.zIndex);
|
|
49
51
|
end
|
|
50
52
|
end
|
|
51
53
|
function Rules:checkRules(forge, name)
|
package/out/types.d.ts
CHANGED