@rbxts/app-forge 0.6.0-alpha.26 → 0.6.0-alpha.27

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.
@@ -0,0 +1,9 @@
1
+ declare global {
2
+ // These will be overridden by the user
3
+ // They are only placeholders for your build
4
+
5
+ type AppGroups = readonly string[];
6
+ type AppNames = readonly string[];
7
+ type AppProps = {};
8
+ }
9
+ export {};
package/out/index.d.ts ADDED
@@ -0,0 +1,12 @@
1
+ export { App as ReactApp, Args as ReactArgs } from "./react/decorator";
2
+ export { App as VideApp, Args as VideArgs } from "./vide/decorator";
3
+ export { default as CreateReactForge } from "./react";
4
+ export { default as CreateVideForge } from "./vide";
5
+ export { Render as RenderReact } from "./react/helpers";
6
+ export { Render as RenderVide } from "./vide/helpers";
7
+ export type { MainProps as VideProps, ClassProps as VideClassProps } from "./vide/types";
8
+ export type { MainProps as ReactProps, ClassProps as ReactClassProps, NameProps, } from "./react/types";
9
+ export { default as useReactAppContext } from "./react/hooks/useAppContext";
10
+ export { default as ReactContexts } from "./react/context";
11
+ export { default as useVideAppContext } from "./vide/hooks/useAppContext";
12
+ export { default as VideContexts } from "./vide/context";
package/out/init.luau ADDED
@@ -0,0 +1,22 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ local exports = {}
4
+ -- Decorators
5
+ local _decorator = TS.import(script, script, "react", "decorator")
6
+ exports.ReactApp = _decorator.App
7
+ exports.ReactArgs = _decorator.Args
8
+ local _decorator_1 = TS.import(script, script, "vide", "decorator")
9
+ exports.VideApp = _decorator_1.App
10
+ exports.VideArgs = _decorator_1.Args
11
+ -- Creators
12
+ exports.CreateReactForge = TS.import(script, script, "react").default
13
+ exports.CreateVideForge = TS.import(script, script, "vide").default
14
+ -- Helpers
15
+ exports.RenderReact = TS.import(script, script, "react", "helpers").Render
16
+ exports.RenderVide = TS.import(script, script, "vide", "helpers").Render
17
+ -- Types
18
+ exports.useReactAppContext = TS.import(script, script, "react", "hooks", "useAppContext").default
19
+ exports.ReactContexts = TS.import(script, script, "react", "context").default
20
+ exports.useVideAppContext = TS.import(script, script, "vide", "hooks", "useAppContext").default
21
+ exports.VideContexts = TS.import(script, script, "vide", "context").default
22
+ return exports
@@ -0,0 +1,10 @@
1
+ import type Types from "./types";
2
+ export declare function AppContainer(props: Types.NameProps & Types.MainProps): import("@rbxts/react").ReactElement<{
3
+ key: string;
4
+ ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
5
+ ResetOnSpawn: boolean;
6
+ }, string | import("@rbxts/react").JSXElementConstructor<any>> | import("@rbxts/react").ReactElement<{
7
+ key: string;
8
+ BackgroundTransparency: number;
9
+ Size: UDim2;
10
+ }, string | import("@rbxts/react").JSXElementConstructor<any>>;
@@ -0,0 +1,60 @@
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
+ -- Packages
6
+ local createElement = TS.import(script, TS.getModule(script, "@rbxts", "react")).createElement
7
+ -- Types
8
+ -- Components
9
+ local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
10
+ local function createInstance(props)
11
+ local _binding = props
12
+ local name = _binding.name
13
+ local forge = _binding.forge
14
+ if not (name ~= "" and name) then
15
+ error("App name is required to create instance")
16
+ end
17
+ local appClass = AppRegistry[name]
18
+ if not appClass then
19
+ error(`App "{name}" not registered`)
20
+ end
21
+ if not (forge.loaded[name] ~= nil) then
22
+ local instance = appClass.constructor.new(props)
23
+ local Render = function()
24
+ return instance:render()
25
+ end
26
+ local _loaded = forge.loaded
27
+ local _arg1 = createElement(Render, {
28
+ key = "Main",
29
+ })
30
+ _loaded[name] = _arg1
31
+ end
32
+ return forge.loaded[name]
33
+ end
34
+ local function AppContainer(props)
35
+ local _binding = props
36
+ local name = _binding.name
37
+ if not (name ~= "" and name) then
38
+ error("App name is required in AppContainer")
39
+ end
40
+ local element = createInstance(props)
41
+ if not element then
42
+ error(`Failed to create instance for app "{name}"`)
43
+ end
44
+ if RunService:IsRunning() then
45
+ return createElement("ScreenGui", {
46
+ key = name,
47
+ ZIndexBehavior = Enum.ZIndexBehavior.Sibling,
48
+ ResetOnSpawn = false,
49
+ }, element)
50
+ else
51
+ return createElement("Frame", {
52
+ key = name,
53
+ BackgroundTransparency = 1,
54
+ Size = UDim2.fromScale(1, 1),
55
+ }, element)
56
+ end
57
+ end
58
+ return {
59
+ AppContainer = AppContainer,
60
+ }
@@ -0,0 +1,7 @@
1
+ declare const Contexts: {
2
+ readonly App: import("@rbxts/react").Context<{
3
+ forge: import(".").default;
4
+ px: ReturnType<typeof import("@rbxts/loners-pretty-react-hooks").usePx>;
5
+ } | undefined>;
6
+ };
7
+ export default Contexts;
@@ -0,0 +1,12 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Packages
4
+ local createContext = TS.import(script, TS.getModule(script, "@rbxts", "react")).createContext
5
+ -- Types
6
+ local Contexts = {
7
+ App = createContext(nil),
8
+ }
9
+ local default = Contexts
10
+ return {
11
+ default = default,
12
+ }
@@ -0,0 +1,14 @@
1
+ import React from "@rbxts/react";
2
+ import type Types from "./types";
3
+ import type AppForge from ".";
4
+ export declare const AppRegistry: Map<string, Types.AppRegistry>;
5
+ export declare function App(props: Types.AppRegistryProps): <T extends new (props: Types.MainProps) => Args>(constructor: T) => T;
6
+ export declare abstract class Args {
7
+ readonly forge: AppForge;
8
+ readonly props: Types.ClassProps;
9
+ readonly name: AppNames[number];
10
+ readonly bind: React.Binding<boolean>;
11
+ readonly state: Boolean;
12
+ constructor(props: Types.NameProps & Types.MainProps);
13
+ abstract render(): React.ReactNode;
14
+ }
@@ -0,0 +1,51 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Services
4
+ -- Packages
5
+ local usePx = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-react-hooks").out).usePx
6
+ -- Types
7
+ local AppRegistry = {}
8
+ local function App(props)
9
+ return function(constructor)
10
+ local _name = props.name
11
+ if AppRegistry[_name] ~= nil then
12
+ error(`Duplicate registered App name "{props.name}"`)
13
+ end
14
+ local _name_1 = props.name
15
+ local _arg1 = {
16
+ constructor = constructor,
17
+ visible = props.visible,
18
+ rules = props.rules,
19
+ }
20
+ AppRegistry[_name_1] = _arg1
21
+ return constructor
22
+ end
23
+ end
24
+ local Args
25
+ do
26
+ Args = {}
27
+ function Args:constructor(props)
28
+ local _binding = props
29
+ local target = _binding.target
30
+ local forge = _binding.forge
31
+ local name = _binding.name
32
+ if not (name ~= "" and name) then
33
+ error("App name is required in Args constructor")
34
+ end
35
+ local px = usePx(target)
36
+ self.forge = forge
37
+ local _object = table.clone(props.props)
38
+ setmetatable(_object, nil)
39
+ _object.px = px
40
+ _object.forge = forge
41
+ self.props = _object
42
+ self.name = name
43
+ self.bind = forge:getBind(name)
44
+ self.state = forge:getState(name)
45
+ end
46
+ end
47
+ return {
48
+ App = App,
49
+ AppRegistry = AppRegistry,
50
+ Args = Args,
51
+ }
@@ -0,0 +1,6 @@
1
+ import React from "@rbxts/react";
2
+ import type Types from "./types";
3
+ import type AppForge from ".";
4
+ export declare function createBinding(name: AppNames[number], forge: AppForge): void;
5
+ export declare function createState(name: AppNames[number], forge: AppForge): void;
6
+ export declare function Render(props: Types.NameProps & Types.MainProps): React.ReactNode;
@@ -0,0 +1,74 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Packages
4
+ local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
5
+ local useBinding = _react.useBinding
6
+ local useState = _react.useState
7
+ -- Types
8
+ -- Components
9
+ local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
10
+ local function createBinding(name, forge)
11
+ local _name = name
12
+ local app = AppRegistry[_name]
13
+ if not app then
14
+ error(`App "{name}" not registered`)
15
+ end
16
+ local _binds = forge.binds
17
+ local _name_1 = name
18
+ if _binds[_name_1] ~= nil then
19
+ return nil
20
+ end
21
+ local _condition = app.visible
22
+ if _condition == nil then
23
+ _condition = false
24
+ end
25
+ local binding = { useBinding(_condition) }
26
+ local _binds_1 = forge.binds
27
+ local _name_2 = name
28
+ _binds_1[_name_2] = binding
29
+ end
30
+ local function createState(name, forge)
31
+ local _name = name
32
+ local app = AppRegistry[_name]
33
+ if not app then
34
+ error(`App "{name}" not registered`)
35
+ end
36
+ local _states = forge.states
37
+ local _name_1 = name
38
+ if _states[_name_1] ~= nil then
39
+ return nil
40
+ end
41
+ local _condition = app.visible
42
+ if _condition == nil then
43
+ _condition = false
44
+ end
45
+ local state = { useState(_condition) }
46
+ local _states_1 = forge.states
47
+ local _name_2 = name
48
+ _states_1[_name_2] = state
49
+ end
50
+ local function Render(props)
51
+ local names = props.names
52
+ local name = props.name
53
+ local forge = props.forge
54
+ -- ▼ ReadonlyMap.forEach ▼
55
+ local _callback = function(_, name)
56
+ createBinding(name, forge)
57
+ createState(name, forge)
58
+ end
59
+ for _k, _v in AppRegistry do
60
+ _callback(_v, _k, AppRegistry)
61
+ end
62
+ -- ▲ ReadonlyMap.forEach ▲
63
+ if name ~= "" and name then
64
+ return forge:renderApp(props)
65
+ elseif names then
66
+ return forge:renderApps(props)
67
+ end
68
+ return forge:renderAll(props)
69
+ end
70
+ return {
71
+ createBinding = createBinding,
72
+ createState = createState,
73
+ Render = Render,
74
+ }
@@ -0,0 +1,5 @@
1
+ declare const _default: () => {
2
+ forge: import("..").default;
3
+ px: ReturnType<typeof import("@rbxts/loners-pretty-react-hooks").usePx>;
4
+ };
5
+ export default _default;
@@ -0,0 +1,16 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Packages
4
+ local useContext = TS.import(script, TS.getModule(script, "@rbxts", "react")).useContext
5
+ -- Components
6
+ local Contexts = TS.import(script, script.Parent.Parent, "context").default
7
+ local default = function()
8
+ local context = useContext(Contexts.App)
9
+ if not context then
10
+ error(`Failed to retrieve App Props for React {debug.traceback()}`)
11
+ end
12
+ return context
13
+ end
14
+ return {
15
+ default = default,
16
+ }
@@ -0,0 +1,44 @@
1
+ import React from "@rbxts/react";
2
+ import type Types from "./types";
3
+ type Binding = [React.Binding<boolean>, (T: boolean) => void];
4
+ type State = [boolean, React.Dispatch<React.SetStateAction<boolean>>];
5
+ export default class AppForge {
6
+ loaded: Map<string, React.Element<any, string | React.JSXElementConstructor<any>>>;
7
+ binds: Map<string, Binding>;
8
+ states: Map<string, State>;
9
+ private rulesManager;
10
+ getBind(name: AppNames[number]): React.Binding<boolean>;
11
+ getState(name: AppNames[number]): boolean;
12
+ set(name: AppNames[number], value: boolean): void;
13
+ open(name: AppNames[number]): void;
14
+ close(name: AppNames[number]): void;
15
+ toggle(name: AppNames[number]): void;
16
+ renderApp(props: Types.NameProps & Types.MainProps): React.ReactElement<{
17
+ key: string;
18
+ ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
19
+ ResetOnSpawn: boolean;
20
+ }, string | React.JSXElementConstructor<any>> | React.ReactElement<{
21
+ key: string;
22
+ BackgroundTransparency: number;
23
+ Size: UDim2;
24
+ }, string | React.JSXElementConstructor<any>>;
25
+ renderApps(props: Types.NameProps & Types.MainProps): (React.ReactElement<{
26
+ key: string;
27
+ ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
28
+ ResetOnSpawn: boolean;
29
+ }, string | React.JSXElementConstructor<any>> | React.ReactElement<{
30
+ key: string;
31
+ BackgroundTransparency: number;
32
+ Size: UDim2;
33
+ }, string | React.JSXElementConstructor<any>>)[];
34
+ renderAll(props: Types.MainProps): (React.ReactElement<{
35
+ key: string;
36
+ ZIndexBehavior: Enum.ZIndexBehavior.Sibling;
37
+ ResetOnSpawn: boolean;
38
+ }, string | React.JSXElementConstructor<any>> | React.ReactElement<{
39
+ key: string;
40
+ BackgroundTransparency: number;
41
+ Size: UDim2;
42
+ }, string | React.JSXElementConstructor<any>>)[];
43
+ }
44
+ export {};
@@ -0,0 +1,125 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Packages
4
+ -- Types
5
+ -- Components
6
+ local AppContainer = TS.import(script, script, "container").AppContainer
7
+ local AppRegistry = TS.import(script, script, "decorator").AppRegistry
8
+ -- Classes
9
+ local RulesManager = TS.import(script, script, "rules").default
10
+ -- Helpers
11
+ local _helpers = TS.import(script, script, "helpers")
12
+ local createBinding = _helpers.createBinding
13
+ local createState = _helpers.createState
14
+ local AppForge
15
+ do
16
+ AppForge = setmetatable({}, {
17
+ __tostring = function()
18
+ return "AppForge"
19
+ end,
20
+ })
21
+ AppForge.__index = AppForge
22
+ function AppForge.new(...)
23
+ local self = setmetatable({}, AppForge)
24
+ return self:constructor(...) or self
25
+ end
26
+ function AppForge:constructor()
27
+ self.loaded = {}
28
+ self.binds = {}
29
+ self.states = {}
30
+ self.rulesManager = RulesManager.new(self)
31
+ end
32
+ function AppForge:getBind(name)
33
+ local _binds = self.binds
34
+ local _name = name
35
+ if not (_binds[_name] ~= nil) then
36
+ createBinding(name, self)
37
+ end
38
+ local _binds_1 = self.binds
39
+ local _name_1 = name
40
+ return _binds_1[_name_1][1]
41
+ end
42
+ function AppForge:getState(name)
43
+ local _states = self.states
44
+ local _name = name
45
+ if not (_states[_name] ~= nil) then
46
+ createState(name, self)
47
+ end
48
+ local _states_1 = self.states
49
+ local _name_1 = name
50
+ return _states_1[_name_1][1]
51
+ end
52
+ function AppForge:set(name, value)
53
+ if not self.rulesManager:applyRules(name, value) then
54
+ return nil
55
+ end
56
+ local _binds = self.binds
57
+ local _name = name
58
+ local _binding = _binds[_name]
59
+ local _b = _binding[1]
60
+ local setBinding = _binding[2]
61
+ local _states = self.states
62
+ local _name_1 = name
63
+ local _binding_1 = _states[_name_1]
64
+ local _s = _binding_1[1]
65
+ local setState = _binding_1[2]
66
+ if not setBinding then
67
+ createBinding(name, self)
68
+ end
69
+ setBinding(value)
70
+ setState(value)
71
+ end
72
+ function AppForge:open(name)
73
+ self:set(name, true)
74
+ end
75
+ function AppForge:close(name)
76
+ self:set(name, false)
77
+ end
78
+ function AppForge:toggle(name)
79
+ self:set(name, not self:getState(name))
80
+ end
81
+ function AppForge:renderApp(props)
82
+ return AppContainer(props)
83
+ end
84
+ function AppForge:renderApps(props)
85
+ local names = props.names
86
+ if names then
87
+ -- ▼ ReadonlyArray.map ▼
88
+ local _newValue = table.create(#names)
89
+ local _callback = function(name)
90
+ local _self = self
91
+ local _object = table.clone(props)
92
+ setmetatable(_object, nil)
93
+ _object.name = name
94
+ _object.names = nil
95
+ return _self:renderApp(_object)
96
+ end
97
+ for _k, _v in names do
98
+ _newValue[_k] = _callback(_v, _k - 1, names)
99
+ end
100
+ -- ▲ ReadonlyArray.map ▲
101
+ return _newValue
102
+ end
103
+ error("No app names provided to renderApps")
104
+ end
105
+ function AppForge:renderAll(props)
106
+ local names = {}
107
+ -- ▼ ReadonlyMap.forEach ▼
108
+ local _callback = function(_, name)
109
+ local _name = name
110
+ table.insert(names, _name)
111
+ end
112
+ for _k, _v in AppRegistry do
113
+ _callback(_v, _k, AppRegistry)
114
+ end
115
+ -- ▲ ReadonlyMap.forEach ▲
116
+ local _self = self
117
+ local _object = table.clone(props)
118
+ setmetatable(_object, nil)
119
+ _object.names = names
120
+ return _self:renderApps(_object)
121
+ end
122
+ end
123
+ return {
124
+ default = AppForge,
125
+ }
@@ -0,0 +1,11 @@
1
+ import AppManager from ".";
2
+ export default class RulesManager {
3
+ private appManager;
4
+ constructor(appManager: AppManager);
5
+ applyRules(name: AppNames[number], value: boolean): boolean;
6
+ private inSameGroup;
7
+ private blockedBy;
8
+ private blocks;
9
+ private exclusive;
10
+ private layer;
11
+ }
@@ -0,0 +1,195 @@
1
+ -- Compiled with roblox-ts v3.0.0
2
+ local TS = _G[script]
3
+ -- Packages
4
+ local Object = TS.import(script, TS.getModule(script, "@rbxts", "object-utils"))
5
+ -- Components
6
+ local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
7
+ -- Types
8
+ local function asTable(value)
9
+ local _value = value
10
+ if type(_value) == "table" then
11
+ return value
12
+ else
13
+ local t = {}
14
+ t[2] = value
15
+ return t
16
+ end
17
+ end
18
+ local RulesManager
19
+ do
20
+ RulesManager = setmetatable({}, {
21
+ __tostring = function()
22
+ return "RulesManager"
23
+ end,
24
+ })
25
+ RulesManager.__index = RulesManager
26
+ function RulesManager.new(...)
27
+ local self = setmetatable({}, RulesManager)
28
+ return self:constructor(...) or self
29
+ end
30
+ function RulesManager:constructor(appManager)
31
+ self.appManager = appManager
32
+ end
33
+ function RulesManager:applyRules(name, value)
34
+ local _name = name
35
+ local appData = AppRegistry[_name]
36
+ local _rules = appData
37
+ if _rules ~= nil then
38
+ _rules = _rules.rules
39
+ end
40
+ local rules = _rules
41
+ local _result = rules
42
+ if _result ~= nil then
43
+ _result = _result.groups
44
+ end
45
+ if _result == "Core" then
46
+ return true
47
+ end
48
+ if value then
49
+ local allNames = Object.keys(AppRegistry)
50
+ -- ▼ ReadonlyArray.forEach ▼
51
+ local _callback = function(n)
52
+ if not (n ~= "" and n) or n == name then
53
+ return nil
54
+ end
55
+ local _n = n
56
+ local otherApp = AppRegistry[_n]
57
+ local _result_1 = otherApp
58
+ if _result_1 ~= nil then
59
+ _result_1 = _result_1.rules
60
+ if _result_1 ~= nil then
61
+ _result_1 = _result_1.groups
62
+ end
63
+ end
64
+ local groups = if _result_1 ~= "" and _result_1 then asTable(otherApp.rules.groups) else {}
65
+ -- ▼ ReadonlyArray.find ▼
66
+ local _callback_1 = function(g)
67
+ return g == "Core"
68
+ end
69
+ local _result_2
70
+ for _i, _v in groups do
71
+ if _callback_1(_v, _i - 1, groups) == true then
72
+ _result_2 = _v
73
+ break
74
+ end
75
+ end
76
+ -- ▲ ReadonlyArray.find ▲
77
+ if _result_2 then
78
+ return nil
79
+ end
80
+ if self.appManager:getState(n) then
81
+ self.appManager:set(n, false)
82
+ end
83
+ end
84
+ for _k, _v in allNames do
85
+ _callback(_v, _k - 1, allNames)
86
+ end
87
+ -- ▲ ReadonlyArray.forEach ▲
88
+ end
89
+ if not rules then
90
+ return true
91
+ end
92
+ local _condition = value
93
+ if _condition then
94
+ _condition = rules.blockedBy
95
+ if _condition ~= "" and _condition then
96
+ _condition = not self:blockedBy(name, rules.blockedBy)
97
+ end
98
+ end
99
+ if _condition ~= "" and _condition then
100
+ return false
101
+ end
102
+ local _value = value and rules.blocks
103
+ if _value ~= "" and _value then
104
+ self:blocks(name, rules.blocks)
105
+ end
106
+ if value and rules.layer ~= nil then
107
+ self:layer(name, rules.layer)
108
+ end
109
+ if value and rules.exclusive then
110
+ self:exclusive(name)
111
+ end
112
+ return true
113
+ end
114
+ function RulesManager:inSameGroup(a, b)
115
+ local _a = a
116
+ local appA = AppRegistry[_a]
117
+ local _b = b
118
+ local appB = AppRegistry[_b]
119
+ if not appA or not appB then
120
+ return false
121
+ end
122
+ local _result = appA.rules
123
+ if _result ~= nil then
124
+ _result = _result.groups
125
+ end
126
+ local _condition = _result
127
+ if _condition == nil then
128
+ _condition = {}
129
+ end
130
+ local groupsA = asTable(_condition)
131
+ local _result_1 = appB.rules
132
+ if _result_1 ~= nil then
133
+ _result_1 = _result_1.groups
134
+ end
135
+ local _condition_1 = _result_1
136
+ if _condition_1 == nil then
137
+ _condition_1 = {}
138
+ end
139
+ local groupsB = asTable(_condition_1)
140
+ for i = 1, #groupsA do
141
+ for j = 1, #groupsB do
142
+ if groupsA[i + 1] == groupsB[j + 1] then
143
+ return true
144
+ end
145
+ end
146
+ end
147
+ return false
148
+ end
149
+ function RulesManager:blockedBy(name, rule)
150
+ local blockers = asTable(rule)
151
+ for i = 1, #blockers do
152
+ local blocker = blockers[i + 1]
153
+ if self:inSameGroup(name, blocker) or not (blocker ~= "" and blocker) then
154
+ continue
155
+ end
156
+ if self.appManager:getState(blocker) then
157
+ return false
158
+ end
159
+ end
160
+ return true
161
+ end
162
+ function RulesManager:blocks(name, rule)
163
+ local blocked = asTable(rule)
164
+ for i = 1, #blocked do
165
+ local b = blocked[i + 1]
166
+ if self:inSameGroup(name, b) or not (b ~= "" and b) then
167
+ continue
168
+ end
169
+ if self.appManager:getState(b) then
170
+ self.appManager:set(b, false)
171
+ end
172
+ end
173
+ end
174
+ function RulesManager:exclusive(name)
175
+ local names = Object.keys(AppRegistry)
176
+ for i = 1, #names do
177
+ local other = names[i + 1]
178
+ if other == name or not (other ~= "" and other) then
179
+ continue
180
+ end
181
+ if self:inSameGroup(name, other) then
182
+ continue
183
+ end
184
+ if self.appManager:getState(other) then
185
+ self.appManager:set(other, false)
186
+ end
187
+ end
188
+ end
189
+ function RulesManager:layer(_name, _layer)
190
+ -- TODO: implement priority / layering
191
+ end
192
+ end
193
+ return {
194
+ default = RulesManager,
195
+ }