@rbxts/forge 0.0.5

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.
Files changed (39) hide show
  1. package/LICENSE.md +9 -0
  2. package/README.md +146 -0
  3. package/out/appRegistry.d.ts +21 -0
  4. package/out/appRegistry.luau +97 -0
  5. package/out/context.d.ts +7 -0
  6. package/out/context.luau +12 -0
  7. package/out/forge.d.ts +22 -0
  8. package/out/forge.luau +209 -0
  9. package/out/global.d.ts +8 -0
  10. package/out/helpers/bindAppSource.d.ts +2 -0
  11. package/out/helpers/bindAppSource.luau +22 -0
  12. package/out/helpers/getAppEntry.d.ts +1 -0
  13. package/out/helpers/getAppEntry.luau +21 -0
  14. package/out/helpers/getAppSource.d.ts +1 -0
  15. package/out/helpers/getAppSource.luau +21 -0
  16. package/out/helpers/hasAppSource.d.ts +1 -0
  17. package/out/helpers/hasAppSource.luau +24 -0
  18. package/out/helpers/setAppSource.d.ts +1 -0
  19. package/out/helpers/setAppSource.luau +34 -0
  20. package/out/hooks/useAppContext.d.ts +5 -0
  21. package/out/hooks/useAppContext.luau +14 -0
  22. package/out/hooks/useEventListener.d.ts +22 -0
  23. package/out/hooks/useEventListener.luau +64 -0
  24. package/out/hooks/usePx.d.ts +11 -0
  25. package/out/hooks/usePx.luau +93 -0
  26. package/out/index.d.ts +5 -0
  27. package/out/init.luau +13 -0
  28. package/out/renders.d.ts +18 -0
  29. package/out/renders.luau +310 -0
  30. package/out/ruleEngine/check/exclusiveGroup.d.ts +2 -0
  31. package/out/ruleEngine/check/exclusiveGroup.luau +49 -0
  32. package/out/ruleEngine/check/parent.d.ts +2 -0
  33. package/out/ruleEngine/check/parent.luau +37 -0
  34. package/out/ruleEngine/index.d.ts +7 -0
  35. package/out/ruleEngine/init.luau +73 -0
  36. package/out/ruleEngine/render/anchor.d.ts +2 -0
  37. package/out/ruleEngine/render/anchor.luau +11 -0
  38. package/out/types.d.ts +96 -0
  39. package/package.json +52 -0
@@ -0,0 +1,14 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Components
4
+ local Contexts = TS.import(script, script.Parent.Parent, "context").default
5
+ local default = function()
6
+ local context = Contexts.App()
7
+ if not context then
8
+ error(`Failed to retrieve App Props for Vide\n{debug.traceback()}`, 2)
9
+ end
10
+ return context
11
+ end
12
+ return {
13
+ default = default,
14
+ }
@@ -0,0 +1,22 @@
1
+ type EventLike<T extends Callback = Callback> = {
2
+ Connect(callback: T): ConnectionLike;
3
+ } | {
4
+ connect(callback: T): ConnectionLike;
5
+ } | {
6
+ subscribe(callback: T): ConnectionLike;
7
+ };
8
+ type ConnectionLike = {
9
+ Disconnect(): void;
10
+ } | {
11
+ disconnect(): void;
12
+ } | (() => void);
13
+ /**
14
+ * Subscribes to an event-like object. The subscription is automatically
15
+ * disconnected when the scope cleans up.
16
+ *
17
+ * @param event The event-like object to subscribe to.
18
+ * @param listener The listener to subscribe with.
19
+ * @returns The connection object.
20
+ */
21
+ export default function useEventListener<T extends EventLike>(event: T, listener: T extends EventLike<infer U> ? U : never): ReturnType<T>;
22
+ export {};
@@ -0,0 +1,64 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Packages
4
+ local cleanup = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).cleanup
5
+ local connect = function(event, callback)
6
+ local _event = event
7
+ if typeof(_event) == "RBXScriptSignal" then
8
+ local connection
9
+ connection = event:Connect(function(...)
10
+ local args = { ... }
11
+ if connection.Connected then
12
+ return callback(unpack(args))
13
+ end
14
+ end)
15
+ return connection
16
+ elseif event.Connect ~= nil then
17
+ return event:Connect(callback)
18
+ elseif event.connect ~= nil then
19
+ return event:connect(callback)
20
+ elseif event.subscribe ~= nil then
21
+ return event:subscribe(callback)
22
+ else
23
+ error("Event-like object does not have a supported connect method.")
24
+ end
25
+ end
26
+ local disconnect = function(connection)
27
+ local _connection = connection
28
+ if type(_connection) == "function" then
29
+ connection()
30
+ else
31
+ local _connection_1 = connection
32
+ local _condition = typeof(_connection_1) == "RBXScriptConnection"
33
+ if not _condition then
34
+ _condition = connection.Disconnect ~= nil
35
+ end
36
+ if _condition then
37
+ connection:Disconnect()
38
+ elseif connection.disconnect ~= nil then
39
+ connection:disconnect()
40
+ else
41
+ error("Connection-like object does not have a supported disconnect method.")
42
+ end
43
+ end
44
+ end
45
+ --[[
46
+ *
47
+ * Subscribes to an event-like object. The subscription is automatically
48
+ * disconnected when the scope cleans up.
49
+ *
50
+ * @param event The event-like object to subscribe to.
51
+ * @param listener The listener to subscribe with.
52
+ * @returns The connection object.
53
+
54
+ ]]
55
+ local function useEventListener(event, listener)
56
+ local connection = connect(event, listener)
57
+ cleanup(function()
58
+ return disconnect(connection)
59
+ end)
60
+ return connection
61
+ end
62
+ return {
63
+ default = useEventListener,
64
+ }
@@ -0,0 +1,11 @@
1
+ export declare const px: ((value: number) => number) & {
2
+ scale: (value: number) => number;
3
+ even: (value: number) => number;
4
+ floor: (value: number) => number;
5
+ ceil: (value: number) => number;
6
+ };
7
+ /**
8
+ * Initializes global px scaling.
9
+ * Must be called exactly once.
10
+ */
11
+ export declare function usePx(target?: GuiObject | Camera, baseResolution?: Vector2, minScale?: number): void;
@@ -0,0 +1,93 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Services
4
+ local Workspace = TS.import(script, TS.getModule(script, "@rbxts", "services")).Workspace
5
+ -- Packages
6
+ local source = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).source
7
+ -- Helpers
8
+ local useEventListener = TS.import(script, script.Parent, "useEventListener").default
9
+ --* Default reference resolution for px calculations
10
+ local BASE_RESOLUTION = source(Vector2.new(1920, 1080))
11
+ --* Minimum allowed scale to prevent unreadable UI
12
+ local MIN_SCALE = source(0.5)
13
+ --* 0 = width-based, 1 = height-based
14
+ local DOMINANT_AXIS = 0.5
15
+ local TARGET = source(Workspace.CurrentCamera)
16
+ local SCALE = source(1)
17
+ local INITIALIZED = false
18
+ local function callable(callback, object)
19
+ return setmetatable(object, {
20
+ __call = function(_, ...)
21
+ local args = { ... }
22
+ return callback(unpack(args))
23
+ end,
24
+ })
25
+ end
26
+ local px = callable(function(value)
27
+ return math.round(value * SCALE())
28
+ end, {
29
+ scale = function(value)
30
+ return value * SCALE()
31
+ end,
32
+ even = function(value)
33
+ return math.round(value * SCALE() * 0.5) * 2
34
+ end,
35
+ floor = function(value)
36
+ return math.floor(value * SCALE())
37
+ end,
38
+ ceil = function(value)
39
+ return math.ceil(value * SCALE())
40
+ end,
41
+ })
42
+ local function calculateScale()
43
+ local target = TARGET()
44
+ if not target then
45
+ return nil
46
+ end
47
+ local size = if target:IsA("Camera") then target.ViewportSize elseif target:IsA("GuiObject") then target.AbsoluteSize else nil
48
+ if not size then
49
+ return nil
50
+ end
51
+ local res = BASE_RESOLUTION()
52
+ if res.X <= 0 or res.Y <= 0 then
53
+ return nil
54
+ end
55
+ local min = MIN_SCALE()
56
+ local width = math.log(size.X / res.X, 2)
57
+ local height = math.log(size.Y / res.Y, 2)
58
+ local centered = width + (height - width) * DOMINANT_AXIS
59
+ local scale = 2 ^ centered
60
+ SCALE(math.max(scale, min))
61
+ end
62
+ --[[
63
+ *
64
+ * Initializes global px scaling.
65
+ * Must be called exactly once.
66
+
67
+ ]]
68
+ local function usePx(target, baseResolution, minScale)
69
+ if INITIALIZED then
70
+ return warn("usePx() called more than once")
71
+ end
72
+ INITIALIZED = true
73
+ if baseResolution then
74
+ BASE_RESOLUTION(baseResolution)
75
+ end
76
+ if minScale ~= 0 and minScale == minScale and minScale then
77
+ MIN_SCALE(minScale)
78
+ end
79
+ if target then
80
+ TARGET(target)
81
+ end
82
+ local resolvedTarget = TARGET()
83
+ if not resolvedTarget then
84
+ return warn("usePx(): no valid target to observe")
85
+ end
86
+ local signal = if resolvedTarget:IsA("Camera") then resolvedTarget:GetPropertyChangedSignal("ViewportSize") else resolvedTarget:GetPropertyChangedSignal("AbsoluteSize")
87
+ useEventListener(signal, calculateScale)
88
+ calculateScale()
89
+ end
90
+ return {
91
+ usePx = usePx,
92
+ px = px,
93
+ }
package/out/index.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ export { App, Args } from "./appRegistry";
2
+ export { default as CreateForge } from "./forge";
3
+ export type { ForgeProps, ClassProps, RenderProps, } from "./types";
4
+ export { default as useAppContext } from "./hooks/useAppContext";
5
+ export { default as Contexts } from "./context";
package/out/init.luau ADDED
@@ -0,0 +1,13 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local exports = {}
4
+ -- Decorators
5
+ local _appRegistry = TS.import(script, script, "appRegistry")
6
+ exports.App = _appRegistry.App
7
+ exports.Args = _appRegistry.Args
8
+ -- Creators
9
+ exports.CreateForge = TS.import(script, script, "forge").default
10
+ -- Types
11
+ exports.useAppContext = TS.import(script, script, "hooks", "useAppContext").default
12
+ exports.Contexts = TS.import(script, script, "context").default
13
+ return exports
@@ -0,0 +1,18 @@
1
+ import type Types from "./types";
2
+ import Rules from "./ruleEngine";
3
+ type Render = {
4
+ instance: Instance;
5
+ container: Instance;
6
+ entry: Types.AppRegistry.Static;
7
+ };
8
+ export default class Renders extends Rules {
9
+ private __px;
10
+ protected Loaded: Map<string, Map<string, Render>>;
11
+ constructor();
12
+ private Load;
13
+ protected Initalize(props: Types.Props.Main): Instance[];
14
+ private collectEntries;
15
+ private expandWithChildren;
16
+ private createInstance;
17
+ }
18
+ export {};
@@ -0,0 +1,310 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Services
4
+ -- Packages
5
+ local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
6
+ local Vide = _vide
7
+ local apply = _vide.apply
8
+ -- Types
9
+ -- Components
10
+ local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
11
+ -- Hooks
12
+ local usePx = TS.import(script, script.Parent, "hooks", "usePx").usePx
13
+ -- Classes
14
+ local Rules = TS.import(script, script.Parent, "ruleEngine").default
15
+ -- Helpers
16
+ local getAppEntry = TS.import(script, script.Parent, "helpers", "getAppEntry").default
17
+ local Renders
18
+ do
19
+ local super = Rules
20
+ Renders = setmetatable({}, {
21
+ __tostring = function()
22
+ return "Renders"
23
+ end,
24
+ __index = super,
25
+ })
26
+ Renders.__index = Renders
27
+ function Renders.new(...)
28
+ local self = setmetatable({}, Renders)
29
+ return self:constructor(...) or self
30
+ end
31
+ function Renders:constructor()
32
+ super.constructor(self)
33
+ self.__px = false
34
+ self.Loaded = {}
35
+ end
36
+ function Renders:Load(props)
37
+ local baseEntries = self:collectEntries(props.renders)
38
+ local toLoad = self:expandWithChildren(baseEntries)
39
+ local load = {}
40
+ -- ▼ ReadonlyArray.forEach ▼
41
+ local _callback = function(entry)
42
+ local name = tostring(entry.constructor)
43
+ local group = entry.group
44
+ local render = self:createInstance(props, name, group)
45
+ if not render then
46
+ return nil
47
+ end
48
+ local _result = render.entry.rules
49
+ if _result ~= nil then
50
+ _result = _result.parent
51
+ end
52
+ if not (_result ~= "" and _result) then
53
+ local _container = render.container
54
+ table.insert(load, _container)
55
+ end
56
+ end
57
+ for _k, _v in toLoad do
58
+ _callback(_v, _k - 1, toLoad)
59
+ end
60
+ -- ▲ ReadonlyArray.forEach ▲
61
+ return load
62
+ end
63
+ function Renders:Initalize(props)
64
+ if not self.__px then
65
+ local _result = props.config
66
+ if _result ~= nil then
67
+ _result = _result.px.target
68
+ end
69
+ local _result_1 = props.config
70
+ if _result_1 ~= nil then
71
+ _result_1 = _result_1.px.resolution
72
+ end
73
+ local _result_2 = props.config
74
+ if _result_2 ~= nil then
75
+ _result_2 = _result_2.px.minScale
76
+ end
77
+ usePx(_result, _result_1, _result_2)
78
+ self.__px = true
79
+ end
80
+ return self:Load(props)
81
+ end
82
+ function Renders:collectEntries(renders)
83
+ local result = {}
84
+ local _result = renders
85
+ if _result ~= nil then
86
+ _result = _result.name
87
+ end
88
+ local _result_1
89
+ if _result ~= nil then
90
+ _result_1 = {
91
+ [renders.name] = true,
92
+ }
93
+ else
94
+ local _result_2 = renders
95
+ if _result_2 ~= nil then
96
+ _result_2 = _result_2.names
97
+ end
98
+ local _result_3
99
+ if _result_2 then
100
+ local _set = {}
101
+ for _, _v in renders.names do
102
+ _set[_v] = true
103
+ end
104
+ _result_3 = _set
105
+ else
106
+ _result_3 = nil
107
+ end
108
+ _result_1 = _result_3
109
+ end
110
+ local names = _result_1
111
+ local _result_2 = renders
112
+ if _result_2 ~= nil then
113
+ _result_2 = _result_2.group
114
+ end
115
+ local _result_3
116
+ if _result_2 ~= nil then
117
+ _result_3 = {
118
+ [renders.group] = true,
119
+ }
120
+ else
121
+ local _result_4 = renders
122
+ if _result_4 ~= nil then
123
+ _result_4 = _result_4.groups
124
+ end
125
+ local _result_5
126
+ if _result_4 then
127
+ local _set = {}
128
+ for _, _v in renders.groups do
129
+ _set[_v] = true
130
+ end
131
+ _result_5 = _set
132
+ else
133
+ _result_5 = nil
134
+ end
135
+ _result_3 = _result_5
136
+ end
137
+ local groups = _result_3
138
+ -- ▼ ReadonlyMap.forEach ▼
139
+ local _callback = function(groupEntries, appName)
140
+ local _condition = names
141
+ if _condition then
142
+ local _appName = appName
143
+ _condition = not (names[_appName] ~= nil)
144
+ end
145
+ if _condition then
146
+ return nil
147
+ end
148
+ -- ▼ ReadonlyMap.forEach ▼
149
+ local _callback_1 = function(entry, group)
150
+ local _condition_1 = groups
151
+ if _condition_1 then
152
+ local _group = group
153
+ _condition_1 = not (groups[_group] ~= nil)
154
+ end
155
+ if _condition_1 then
156
+ return nil
157
+ end
158
+ local _entry = entry
159
+ table.insert(result, _entry)
160
+ end
161
+ for _k, _v in groupEntries do
162
+ _callback_1(_v, _k, groupEntries)
163
+ end
164
+ -- ▲ ReadonlyMap.forEach ▲
165
+ end
166
+ for _k, _v in AppRegistry do
167
+ _callback(_v, _k, AppRegistry)
168
+ end
169
+ -- ▲ ReadonlyMap.forEach ▲
170
+ return result
171
+ end
172
+ function Renders:expandWithChildren(entries)
173
+ local _array = {}
174
+ local _length = #_array
175
+ table.move(entries, 1, #entries, _length + 1, _array)
176
+ local result = _array
177
+ local _set = {}
178
+ -- ▼ ReadonlyArray.map ▼
179
+ local _newValue = table.create(#entries)
180
+ local _callback = function(e)
181
+ return tostring(e.constructor)
182
+ end
183
+ for _k, _v in entries do
184
+ _newValue[_k] = _callback(_v, _k - 1, entries)
185
+ end
186
+ -- ▲ ReadonlyArray.map ▲
187
+ for _, _v in _newValue do
188
+ _set[_v] = true
189
+ end
190
+ local selected = _set
191
+ -- ▼ ReadonlyMap.forEach ▼
192
+ local _callback_1 = function(groupEntries)
193
+ -- ▼ ReadonlyMap.forEach ▼
194
+ local _callback_2 = function(entry)
195
+ local _parent = entry.rules
196
+ if _parent ~= nil then
197
+ _parent = _parent.parent
198
+ end
199
+ local parent = _parent
200
+ local _condition = parent
201
+ if _condition ~= "" and _condition then
202
+ _condition = selected[parent] ~= nil
203
+ end
204
+ if _condition ~= "" and _condition then
205
+ local _entry = entry
206
+ table.insert(result, _entry)
207
+ end
208
+ end
209
+ for _k, _v in groupEntries do
210
+ _callback_2(_v, _k, groupEntries)
211
+ end
212
+ -- ▲ ReadonlyMap.forEach ▲
213
+ end
214
+ for _k, _v in AppRegistry do
215
+ _callback_1(_v, _k, AppRegistry)
216
+ end
217
+ -- ▲ ReadonlyMap.forEach ▲
218
+ return result
219
+ end
220
+ function Renders:createInstance(props, name, group)
221
+ local entry = getAppEntry(name, group)
222
+ if not entry then
223
+ return nil
224
+ end
225
+ -- App Entry Instance/Render
226
+ local entryInstance = entry.constructor.new(props, name, group):render()
227
+ entryInstance.Name = "Render"
228
+ -- Parent Container
229
+ local parentContainer
230
+ local _result = entry.rules
231
+ if _result ~= nil then
232
+ _result = _result.parent
233
+ end
234
+ if _result ~= "" and _result then
235
+ local _condition = entry.rules.parentGroup
236
+ if not (_condition ~= "" and _condition) then
237
+ _condition = "None"
238
+ end
239
+ local group = _condition
240
+ local _loaded = self.Loaded
241
+ local _parent = entry.rules.parent
242
+ local parentMap = _loaded[_parent]
243
+ if parentMap then
244
+ local parentEntry = parentMap[group]
245
+ if parentEntry then
246
+ parentContainer = parentEntry.container
247
+ end
248
+ end
249
+ end
250
+ -- Anchor
251
+ local anchor
252
+ local _result_1 = entry.rules
253
+ if _result_1 ~= nil then
254
+ _result_1 = _result_1.anchor
255
+ end
256
+ if _result_1 then
257
+ local parentName = entry.rules.parent
258
+ local _condition = entry.rules.parentGroup
259
+ if not (_condition ~= "" and _condition) then
260
+ _condition = "None"
261
+ end
262
+ local parentGroup = _condition
263
+ if not (parentName ~= "" and parentName) then
264
+ return nil
265
+ end
266
+ local parentEntry = getAppEntry(entry.rules.parent, parentGroup)
267
+ if not parentEntry then
268
+ return nil
269
+ end
270
+ anchor = parentEntry.constructor.new(props, parentName, parentGroup):render()
271
+ local _exp = anchor:GetDescendants()
272
+ -- ▼ ReadonlyArray.forEach ▼
273
+ local _callback = function(instance)
274
+ return instance:Destroy()
275
+ end
276
+ for _k, _v in _exp do
277
+ _callback(_v, _k - 1, _exp)
278
+ end
279
+ -- ▲ ReadonlyArray.forEach ▲
280
+ apply(anchor)({
281
+ Name = "Anchor",
282
+ BackgroundTransparency = 1,
283
+ [0] = entryInstance,
284
+ })
285
+ end
286
+ local container = (Vide.jsx("frame", {
287
+ Name = name,
288
+ BackgroundTransparency = 1,
289
+ AnchorPoint = Vector2.new(0.5, 0.5),
290
+ Position = UDim2.fromScale(0.5, 0.5),
291
+ Size = UDim2.fromScale(1, 1),
292
+ Parent = parentContainer,
293
+ }, if anchor then anchor else entryInstance))
294
+ local newMap = {}
295
+ local render = {
296
+ container = container,
297
+ instance = entryInstance,
298
+ entry = entry,
299
+ }
300
+ local _group = group
301
+ newMap[_group] = render
302
+ local _loaded = self.Loaded
303
+ local _name = name
304
+ _loaded[_name] = newMap
305
+ return render
306
+ end
307
+ end
308
+ return {
309
+ default = Renders,
310
+ }
@@ -0,0 +1,2 @@
1
+ import type AppForge from "../../forge";
2
+ export default function ExclusiveGroupRule(forge: AppForge, name: AppNames, group: AppGroups): void;
@@ -0,0 +1,49 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Types
4
+ -- Components
5
+ local AppRegistry = TS.import(script, script.Parent.Parent.Parent, "appRegistry").AppRegistry
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}`)
12
+ end
13
+ local entryVisible = forge:getSource(name, group)()
14
+ if not entryVisible then
15
+ return nil
16
+ end
17
+ -- ▼ ReadonlyMap.forEach ▼
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
+ end
37
+ for _k, _v in entryMap do
38
+ _callback_1(_v, _k, entryMap)
39
+ end
40
+ -- ▲ ReadonlyMap.forEach ▲
41
+ end
42
+ for _k, _v in AppRegistry do
43
+ _callback(_v, _k, AppRegistry)
44
+ end
45
+ -- ▲ ReadonlyMap.forEach ▲
46
+ end
47
+ return {
48
+ default = ExclusiveGroupRule,
49
+ }
@@ -0,0 +1,2 @@
1
+ import type AppForge from "../../forge";
2
+ export default function ParentRule(forge: AppForge, name: AppNames, group: AppGroups): void;
@@ -0,0 +1,37 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Types
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
+ local _result = entry
10
+ if _result ~= nil then
11
+ _result = _result.rules
12
+ if _result ~= nil then
13
+ _result = _result.parent
14
+ end
15
+ end
16
+ if not (_result ~= "" and _result) then
17
+ return nil
18
+ end
19
+ local _exp = entry.rules.parent
20
+ local _condition = entry.rules.parentGroup
21
+ if _condition == nil then
22
+ _condition = "None"
23
+ end
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
+ if source() then
31
+ source(false)
32
+ end
33
+ end
34
+ end
35
+ return {
36
+ default = ParentRule,
37
+ }
@@ -0,0 +1,7 @@
1
+ import type AppForge from "../forge";
2
+ import type Types from "../types";
3
+ export default class Rules {
4
+ protected processing: Set<string>;
5
+ protected renderRules(name: AppNames, group: AppGroups | undefined, props: Types.Props.Main): void;
6
+ protected checkRules(forge: AppForge, name: AppNames, group: AppGroups): void;
7
+ }