@rbxts/app-forge 0.6.0 → 0.7.0
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/README.md +334 -149
- package/out/global.d.ts +2 -3
- package/out/index.d.ts +11 -19
- package/out/init.luau +16 -115
- package/out/react/container.d.ts +10 -0
- package/out/{container.luau → react/container.luau} +13 -34
- package/out/react/context.d.ts +7 -0
- package/out/react/context.luau +12 -0
- package/out/{decorator.d.ts → react/decorator.d.ts} +5 -4
- package/out/{decorator.luau → react/decorator.luau} +6 -3
- package/out/react/helpers.d.ts +6 -0
- package/out/react/helpers.luau +74 -0
- package/out/react/hooks/useAppContext.d.ts +5 -0
- package/out/react/hooks/useAppContext.luau +16 -0
- package/out/react/index.d.ts +44 -0
- package/out/react/init.luau +123 -0
- package/out/react/rules/index.d.ts +6 -0
- package/out/react/rules/init.luau +27 -0
- package/out/react/rules/parent.d.ts +2 -0
- package/out/react/rules/parent.luau +42 -0
- package/out/react/types.d.ts +44 -0
- package/out/vide/classes/renders.d.ts +21 -0
- package/out/vide/classes/renders.luau +251 -0
- package/out/vide/classes/rules/exclusiveGroup.d.ts +2 -0
- package/out/vide/classes/rules/exclusiveGroup.luau +47 -0
- package/out/vide/classes/rules/index.d.ts +7 -0
- package/out/vide/classes/rules/init.luau +70 -0
- package/out/vide/classes/rules/parent.d.ts +2 -0
- package/out/vide/classes/rules/parent.luau +29 -0
- package/out/vide/context.d.ts +7 -0
- package/out/vide/context.luau +12 -0
- package/out/vide/decorator.d.ts +13 -0
- package/out/vide/decorator.luau +44 -0
- package/out/vide/hooks/useAppContext.d.ts +5 -0
- package/out/vide/hooks/useAppContext.luau +14 -0
- package/out/vide/index.d.ts +30 -0
- package/out/vide/init.luau +223 -0
- package/out/vide/types.d.ts +85 -0
- package/package.json +15 -16
- package/out/container.d.ts +0 -4
- package/out/helpers.d.ts +0 -2
- package/out/helpers.luau +0 -40
- package/out/rules.d.ts +0 -12
- package/out/rules.luau +0 -198
- package/out/types.d.ts +0 -59
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// Types
|
|
2
|
+
import type { Args } from "./decorator";
|
|
3
|
+
import type AppForge from ".";
|
|
4
|
+
|
|
5
|
+
declare namespace Types {
|
|
6
|
+
type AppRegistryProps = {
|
|
7
|
+
name: AppNames;
|
|
8
|
+
visible?: boolean;
|
|
9
|
+
rules?: Rules.All;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
type NameProps =
|
|
13
|
+
| { name?: AppNames; names?: undefined }
|
|
14
|
+
| { names?: AppNames[]; name?: undefined };
|
|
15
|
+
|
|
16
|
+
type MainProps = {
|
|
17
|
+
props: AppProps;
|
|
18
|
+
forge: AppForge;
|
|
19
|
+
target?: GuiObject | Camera;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
type ClassProps = AppProps & {
|
|
23
|
+
forge: AppForge;
|
|
24
|
+
px: ReturnType<typeof import("@rbxts/loners-pretty-react-hooks").usePx>;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
type AppRegistry = {
|
|
28
|
+
constructor: new (props: MainProps) => Args;
|
|
29
|
+
visible?: boolean;
|
|
30
|
+
rules?: Rules.All;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
namespace Rules {
|
|
34
|
+
type All = {
|
|
35
|
+
parent?: AppNames;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export type MainProps = Types.MainProps;
|
|
41
|
+
export type NameProps = Types.NameProps;
|
|
42
|
+
export type ClassProps = Types.ClassProps;
|
|
43
|
+
|
|
44
|
+
export default Types;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
2
|
+
import type Types from "../types";
|
|
3
|
+
import type AppForge from "..";
|
|
4
|
+
import Rules from "./rules";
|
|
5
|
+
export default class Renders extends Rules {
|
|
6
|
+
protected anchored: Map<string, {
|
|
7
|
+
id: AppNames;
|
|
8
|
+
render: Vide.Node;
|
|
9
|
+
}>;
|
|
10
|
+
constructor();
|
|
11
|
+
protected renderMount(this: AppForge, props: Types.Props.Main): Vide.Node;
|
|
12
|
+
private renderNames;
|
|
13
|
+
private collectByGroup;
|
|
14
|
+
private normalizeGroups;
|
|
15
|
+
protected renderApp(this: AppForge, props: Types.Props.Main): Vide.Node;
|
|
16
|
+
protected renderApps(this: AppForge, props: Types.Props.Main): Vide.Node[];
|
|
17
|
+
protected renderGroup(this: AppForge, props: Types.Props.Main): Vide.Node[];
|
|
18
|
+
protected renderGroupByName(this: AppForge, props: Types.Props.Main): Vide.Node[];
|
|
19
|
+
protected renderGroupByNames(this: AppForge, props: Types.Props.Main): Vide.Node[];
|
|
20
|
+
protected renderAll(this: AppForge, props: Types.Props.Main): Vide.Node[];
|
|
21
|
+
}
|
|
@@ -0,0 +1,251 @@
|
|
|
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-vide-utils").out).usePx
|
|
6
|
+
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
7
|
+
local apply = _vide.apply
|
|
8
|
+
local create = _vide.create
|
|
9
|
+
-- Types
|
|
10
|
+
-- Components
|
|
11
|
+
local AppRegistry = TS.import(script, script.Parent.Parent, "decorator").AppRegistry
|
|
12
|
+
-- Classes
|
|
13
|
+
local Rules = TS.import(script, script.Parent, "rules").default
|
|
14
|
+
local Renders
|
|
15
|
+
do
|
|
16
|
+
local super = Rules
|
|
17
|
+
Renders = setmetatable({}, {
|
|
18
|
+
__tostring = function()
|
|
19
|
+
return "Renders"
|
|
20
|
+
end,
|
|
21
|
+
__index = super,
|
|
22
|
+
})
|
|
23
|
+
Renders.__index = Renders
|
|
24
|
+
function Renders.new(...)
|
|
25
|
+
local self = setmetatable({}, Renders)
|
|
26
|
+
return self:constructor(...) or self
|
|
27
|
+
end
|
|
28
|
+
function Renders:constructor()
|
|
29
|
+
super.constructor(self)
|
|
30
|
+
self.anchored = {}
|
|
31
|
+
end
|
|
32
|
+
function Renders:renderMount(props)
|
|
33
|
+
local _binding = props
|
|
34
|
+
local config = _binding.config
|
|
35
|
+
local render = _binding.render
|
|
36
|
+
local forge = _binding.forge
|
|
37
|
+
if not forge.__px then
|
|
38
|
+
local _result = config
|
|
39
|
+
if _result ~= nil then
|
|
40
|
+
_result = _result.px.target
|
|
41
|
+
end
|
|
42
|
+
local _result_1 = config
|
|
43
|
+
if _result_1 ~= nil then
|
|
44
|
+
_result_1 = _result_1.px.resolution
|
|
45
|
+
end
|
|
46
|
+
local _result_2 = config
|
|
47
|
+
if _result_2 ~= nil then
|
|
48
|
+
_result_2 = _result_2.px.minScale
|
|
49
|
+
end
|
|
50
|
+
usePx(_result, _result_1, _result_2)
|
|
51
|
+
forge.__px = true
|
|
52
|
+
else
|
|
53
|
+
warn("Rendering twice making a second px")
|
|
54
|
+
end
|
|
55
|
+
if render then
|
|
56
|
+
local _condition = render.name
|
|
57
|
+
if _condition ~= "" and _condition then
|
|
58
|
+
_condition = render.group
|
|
59
|
+
end
|
|
60
|
+
if _condition ~= "" and _condition then
|
|
61
|
+
return forge:renderGroupByName(props)
|
|
62
|
+
else
|
|
63
|
+
local _value = render.names and render.group
|
|
64
|
+
if _value ~= "" and _value then
|
|
65
|
+
return forge:renderGroupByNames(props)
|
|
66
|
+
else
|
|
67
|
+
local _result = render
|
|
68
|
+
if _result ~= nil then
|
|
69
|
+
_result = _result.name
|
|
70
|
+
end
|
|
71
|
+
if _result ~= "" and _result then
|
|
72
|
+
return forge:renderApp(props)
|
|
73
|
+
elseif render.names then
|
|
74
|
+
return forge:renderApps(props)
|
|
75
|
+
else
|
|
76
|
+
local _value_1 = render.group
|
|
77
|
+
if _value_1 ~= "" and _value_1 then
|
|
78
|
+
return forge:renderGroup(props)
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
return self:renderAll(props)
|
|
85
|
+
end
|
|
86
|
+
function Renders:renderNames(props, names, forge)
|
|
87
|
+
if #names == 0 then
|
|
88
|
+
error("No app names provided to renderApps")
|
|
89
|
+
end
|
|
90
|
+
-- ▼ ReadonlyArray.map ▼
|
|
91
|
+
local _newValue = table.create(#names)
|
|
92
|
+
local _callback = function(name)
|
|
93
|
+
local _forge = forge
|
|
94
|
+
local _object = table.clone(props)
|
|
95
|
+
setmetatable(_object, nil)
|
|
96
|
+
_object.render = {
|
|
97
|
+
name = name,
|
|
98
|
+
}
|
|
99
|
+
return _forge:renderApp(_object)
|
|
100
|
+
end
|
|
101
|
+
for _k, _v in names do
|
|
102
|
+
_newValue[_k] = _callback(_v, _k - 1, names)
|
|
103
|
+
end
|
|
104
|
+
-- ▲ ReadonlyArray.map ▲
|
|
105
|
+
return _newValue
|
|
106
|
+
end
|
|
107
|
+
function Renders:collectByGroup(groups, filter)
|
|
108
|
+
local result = {}
|
|
109
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
110
|
+
local _callback = function(app, name)
|
|
111
|
+
local appGroup = app.renderGroup
|
|
112
|
+
if not (appGroup ~= "" and appGroup) then
|
|
113
|
+
return nil
|
|
114
|
+
end
|
|
115
|
+
if not (table.find(groups, appGroup) ~= nil) then
|
|
116
|
+
return nil
|
|
117
|
+
end
|
|
118
|
+
if filter and not filter(name) then
|
|
119
|
+
return nil
|
|
120
|
+
end
|
|
121
|
+
local _name = name
|
|
122
|
+
table.insert(result, _name)
|
|
123
|
+
end
|
|
124
|
+
for _k, _v in AppRegistry do
|
|
125
|
+
_callback(_v, _k, AppRegistry)
|
|
126
|
+
end
|
|
127
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
128
|
+
return result
|
|
129
|
+
end
|
|
130
|
+
function Renders:normalizeGroups(group)
|
|
131
|
+
local _group = group
|
|
132
|
+
local _result
|
|
133
|
+
if type(_group) == "table" then
|
|
134
|
+
local _array = {}
|
|
135
|
+
local _length = #_array
|
|
136
|
+
table.move(group, 1, #group, _length + 1, _array)
|
|
137
|
+
_result = _array
|
|
138
|
+
else
|
|
139
|
+
_result = { group }
|
|
140
|
+
end
|
|
141
|
+
return _result
|
|
142
|
+
end
|
|
143
|
+
function Renders:renderApp(props)
|
|
144
|
+
local _binding = props
|
|
145
|
+
local forge = _binding.forge
|
|
146
|
+
local render = _binding.render
|
|
147
|
+
local _name = render
|
|
148
|
+
if _name ~= nil then
|
|
149
|
+
_name = _name.name
|
|
150
|
+
end
|
|
151
|
+
local name = _name
|
|
152
|
+
if not (name ~= "" and name) then
|
|
153
|
+
error("App name is required to create instance")
|
|
154
|
+
end
|
|
155
|
+
local appClass = AppRegistry[name]
|
|
156
|
+
if not appClass then
|
|
157
|
+
error(`App "{name}" not registered`)
|
|
158
|
+
end
|
|
159
|
+
if not (forge.loaded[name] ~= nil) then
|
|
160
|
+
local render = appClass.constructor.new(props, name):render()
|
|
161
|
+
apply(render)({
|
|
162
|
+
Name = "Render",
|
|
163
|
+
})
|
|
164
|
+
local container = create("Frame")({
|
|
165
|
+
Name = name,
|
|
166
|
+
BackgroundTransparency = 1,
|
|
167
|
+
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
168
|
+
Position = UDim2.fromScale(0.5, 0.5),
|
|
169
|
+
Size = UDim2.fromScale(1, 1),
|
|
170
|
+
[0] = render,
|
|
171
|
+
})
|
|
172
|
+
local _loaded = forge.loaded
|
|
173
|
+
local _arg1 = {
|
|
174
|
+
container = container,
|
|
175
|
+
render = render,
|
|
176
|
+
}
|
|
177
|
+
_loaded[name] = _arg1
|
|
178
|
+
end
|
|
179
|
+
local element = forge.loaded[name]
|
|
180
|
+
if not element then
|
|
181
|
+
error(`Failed to create instance for app "{name}"`)
|
|
182
|
+
end
|
|
183
|
+
self:renderRules(name, props)
|
|
184
|
+
return element.container
|
|
185
|
+
end
|
|
186
|
+
function Renders:renderApps(props)
|
|
187
|
+
local _names = props.render
|
|
188
|
+
if _names ~= nil then
|
|
189
|
+
_names = _names.names
|
|
190
|
+
end
|
|
191
|
+
local names = _names
|
|
192
|
+
if not names then
|
|
193
|
+
error("No app names provided")
|
|
194
|
+
end
|
|
195
|
+
return self:renderNames(props, names, self)
|
|
196
|
+
end
|
|
197
|
+
function Renders:renderGroup(props)
|
|
198
|
+
local _group = props.render
|
|
199
|
+
if _group ~= nil then
|
|
200
|
+
_group = _group.group
|
|
201
|
+
end
|
|
202
|
+
local group = _group
|
|
203
|
+
if not (group ~= "" and group) then
|
|
204
|
+
error("No group provided")
|
|
205
|
+
end
|
|
206
|
+
local groups = self:normalizeGroups(group)
|
|
207
|
+
return self:renderNames(props, self:collectByGroup(groups), self)
|
|
208
|
+
end
|
|
209
|
+
function Renders:renderGroupByName(props)
|
|
210
|
+
local _binding = props.render or {}
|
|
211
|
+
local group = _binding.group
|
|
212
|
+
local name = _binding.name
|
|
213
|
+
if not (group ~= "" and group) or not (name ~= "" and name) then
|
|
214
|
+
error("Invalid renderGroupByName")
|
|
215
|
+
end
|
|
216
|
+
local groups = self:normalizeGroups(group)
|
|
217
|
+
return self:renderNames(props, self:collectByGroup(groups, function(n)
|
|
218
|
+
return n == name
|
|
219
|
+
end), self)
|
|
220
|
+
end
|
|
221
|
+
function Renders:renderGroupByNames(props)
|
|
222
|
+
local _binding = props.render or {}
|
|
223
|
+
local group = _binding.group
|
|
224
|
+
local names = _binding.names
|
|
225
|
+
if not (group ~= "" and group) or not names then
|
|
226
|
+
error("Invalid renderGroupByNames")
|
|
227
|
+
end
|
|
228
|
+
local groups = self:normalizeGroups(group)
|
|
229
|
+
return self:renderNames(props, self:collectByGroup(groups, function(n)
|
|
230
|
+
local _n = n
|
|
231
|
+
return table.find(names, _n) ~= nil
|
|
232
|
+
end), self)
|
|
233
|
+
end
|
|
234
|
+
function Renders:renderAll(props)
|
|
235
|
+
local names = {}
|
|
236
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
237
|
+
local _callback = function(_, name)
|
|
238
|
+
local _name = name
|
|
239
|
+
table.insert(names, _name)
|
|
240
|
+
return #names
|
|
241
|
+
end
|
|
242
|
+
for _k, _v in AppRegistry do
|
|
243
|
+
_callback(_v, _k, AppRegistry)
|
|
244
|
+
end
|
|
245
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
246
|
+
return self:renderNames(props, names, self)
|
|
247
|
+
end
|
|
248
|
+
end
|
|
249
|
+
return {
|
|
250
|
+
default = Renders,
|
|
251
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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, "decorator").AppRegistry
|
|
6
|
+
local function ExclusiveGroupRule(entry, forge)
|
|
7
|
+
local _entry = entry
|
|
8
|
+
local entryApp = AppRegistry[_entry]
|
|
9
|
+
local _result = entryApp
|
|
10
|
+
if _result ~= nil then
|
|
11
|
+
_result = _result.rules
|
|
12
|
+
if _result ~= nil then
|
|
13
|
+
_result = _result.exclusiveGroup
|
|
14
|
+
end
|
|
15
|
+
end
|
|
16
|
+
if not (_result ~= "" and _result) then
|
|
17
|
+
return nil
|
|
18
|
+
end
|
|
19
|
+
local group = entryApp.rules.exclusiveGroup
|
|
20
|
+
local entrySource = forge:getSource(entry)()
|
|
21
|
+
if not entrySource then
|
|
22
|
+
return nil
|
|
23
|
+
end
|
|
24
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
25
|
+
local _callback = function(app, name)
|
|
26
|
+
if name == entry then
|
|
27
|
+
return nil
|
|
28
|
+
end
|
|
29
|
+
local _result_1 = app.rules
|
|
30
|
+
if _result_1 ~= nil then
|
|
31
|
+
_result_1 = _result_1.exclusiveGroup
|
|
32
|
+
end
|
|
33
|
+
if _result_1 ~= group then
|
|
34
|
+
return nil
|
|
35
|
+
end
|
|
36
|
+
if forge:getSource(name)() then
|
|
37
|
+
forge:close(name, false)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
for _k, _v in AppRegistry do
|
|
41
|
+
_callback(_v, _k, AppRegistry)
|
|
42
|
+
end
|
|
43
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
44
|
+
end
|
|
45
|
+
return {
|
|
46
|
+
default = ExclusiveGroupRule,
|
|
47
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type Types from "../../types";
|
|
2
|
+
import type AppForge from "../..";
|
|
3
|
+
export default class Rules {
|
|
4
|
+
protected processing: Set<string>;
|
|
5
|
+
protected renderRules(this: AppForge, name: AppNames, props: Types.Props.Main): void;
|
|
6
|
+
protected checkRules(this: AppForge, name: AppNames): void;
|
|
7
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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, "decorator").AppRegistry
|
|
6
|
+
-- Rules
|
|
7
|
+
local ExclusiveGroupRule = TS.import(script, script, "exclusiveGroup").default
|
|
8
|
+
local ParentRule = TS.import(script, script, "parent").default
|
|
9
|
+
local Rules
|
|
10
|
+
do
|
|
11
|
+
Rules = setmetatable({}, {
|
|
12
|
+
__tostring = function()
|
|
13
|
+
return "Rules"
|
|
14
|
+
end,
|
|
15
|
+
})
|
|
16
|
+
Rules.__index = Rules
|
|
17
|
+
function Rules.new(...)
|
|
18
|
+
local self = setmetatable({}, Rules)
|
|
19
|
+
return self:constructor(...) or self
|
|
20
|
+
end
|
|
21
|
+
function Rules:constructor()
|
|
22
|
+
self.processing = {}
|
|
23
|
+
end
|
|
24
|
+
function Rules:renderRules(name, props)
|
|
25
|
+
local _name = name
|
|
26
|
+
local appClass = AppRegistry[_name]
|
|
27
|
+
if not appClass then
|
|
28
|
+
error(`Failed to get class for app: {name} for renderRules`)
|
|
29
|
+
end
|
|
30
|
+
local _result = appClass.rules
|
|
31
|
+
if _result ~= nil then
|
|
32
|
+
_result = _result.parent
|
|
33
|
+
end
|
|
34
|
+
local _condition = _result
|
|
35
|
+
if _condition ~= "" and _condition then
|
|
36
|
+
_condition = not appClass.rules.detach
|
|
37
|
+
end
|
|
38
|
+
if _condition ~= "" and _condition then
|
|
39
|
+
self:anchor(name, appClass.rules.parent, props)
|
|
40
|
+
end
|
|
41
|
+
local _result_1 = appClass.rules
|
|
42
|
+
if _result_1 ~= nil then
|
|
43
|
+
_result_1 = _result_1.index
|
|
44
|
+
end
|
|
45
|
+
if _result_1 ~= 0 and _result_1 == _result_1 and _result_1 then
|
|
46
|
+
self:index(name, appClass.rules.index)
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
function Rules:checkRules(name)
|
|
50
|
+
local _processing = self.processing
|
|
51
|
+
local _name = name
|
|
52
|
+
if _processing[_name] ~= nil then
|
|
53
|
+
return nil
|
|
54
|
+
end
|
|
55
|
+
local _processing_1 = self.processing
|
|
56
|
+
local _name_1 = name
|
|
57
|
+
_processing_1[_name_1] = true
|
|
58
|
+
TS.try(function()
|
|
59
|
+
ParentRule(name, self)
|
|
60
|
+
ExclusiveGroupRule(name, self)
|
|
61
|
+
end, nil, function()
|
|
62
|
+
local _processing_2 = self.processing
|
|
63
|
+
local _name_2 = name
|
|
64
|
+
_processing_2[_name_2] = nil
|
|
65
|
+
end)
|
|
66
|
+
end
|
|
67
|
+
end
|
|
68
|
+
return {
|
|
69
|
+
default = Rules,
|
|
70
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
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, "decorator").AppRegistry
|
|
6
|
+
local function ParentRule(entry, forge)
|
|
7
|
+
local entrySource = forge:getSource(entry)()
|
|
8
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
9
|
+
local _callback = function(app, name)
|
|
10
|
+
local rules = app.rules
|
|
11
|
+
if not rules or rules.parent ~= entry then
|
|
12
|
+
return nil
|
|
13
|
+
end
|
|
14
|
+
if name == entry then
|
|
15
|
+
return nil
|
|
16
|
+
end
|
|
17
|
+
local childSource = forge:getSource(name)()
|
|
18
|
+
if not entrySource and childSource then
|
|
19
|
+
forge:close(name, false)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
for _k, _v in AppRegistry do
|
|
23
|
+
_callback(_v, _k, AppRegistry)
|
|
24
|
+
end
|
|
25
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
26
|
+
end
|
|
27
|
+
return {
|
|
28
|
+
default = ParentRule,
|
|
29
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
local context = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).context
|
|
5
|
+
-- Types
|
|
6
|
+
local Contexts = {
|
|
7
|
+
App = context(nil),
|
|
8
|
+
}
|
|
9
|
+
local default = Contexts
|
|
10
|
+
return {
|
|
11
|
+
default = default,
|
|
12
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
import type AppForge from ".";
|
|
4
|
+
export declare const AppRegistry: Map<string, Types.AppRegistry.Static>;
|
|
5
|
+
export declare function App<N extends AppNames>(props: Types.AppRegistry.Props<N>): <T extends new (props: Types.Props.Main, name: AppNames) => Args>(constructor: T) => T;
|
|
6
|
+
export declare abstract class Args {
|
|
7
|
+
readonly forge: AppForge;
|
|
8
|
+
readonly props: Types.Props.Class;
|
|
9
|
+
readonly name: AppNames;
|
|
10
|
+
readonly source: Vide.Source<boolean>;
|
|
11
|
+
constructor(props: Types.Props.Main, name: AppNames);
|
|
12
|
+
abstract render(): Vide.Node;
|
|
13
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
local px = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-vide-utils").out).px
|
|
5
|
+
-- Types
|
|
6
|
+
local AppRegistry = {}
|
|
7
|
+
local function App(props)
|
|
8
|
+
return function(constructor)
|
|
9
|
+
local _name = props.name
|
|
10
|
+
if AppRegistry[_name] ~= nil then
|
|
11
|
+
error(`Duplicate registered App name "{props.name}"`)
|
|
12
|
+
end
|
|
13
|
+
local _name_1 = props.name
|
|
14
|
+
local _arg1 = {
|
|
15
|
+
constructor = constructor,
|
|
16
|
+
renderGroup = props.renderGroup,
|
|
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, name)
|
|
28
|
+
local _binding = props
|
|
29
|
+
local forge = _binding.forge
|
|
30
|
+
self.forge = forge
|
|
31
|
+
local _object = table.clone(props.props)
|
|
32
|
+
setmetatable(_object, nil)
|
|
33
|
+
_object.px = px
|
|
34
|
+
_object.forge = forge
|
|
35
|
+
self.props = _object
|
|
36
|
+
self.name = name
|
|
37
|
+
self.source = forge:getSource(name)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
return {
|
|
41
|
+
App = App,
|
|
42
|
+
AppRegistry = AppRegistry,
|
|
43
|
+
Args = Args,
|
|
44
|
+
}
|
|
@@ -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 {debug.traceback()}`)
|
|
9
|
+
end
|
|
10
|
+
return context
|
|
11
|
+
end
|
|
12
|
+
return {
|
|
13
|
+
default = default,
|
|
14
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
2
|
+
import Renders from "./classes/renders";
|
|
3
|
+
import Types from "./types";
|
|
4
|
+
type Destructor = () => void;
|
|
5
|
+
type Loaded = {
|
|
6
|
+
container: Vide.Node;
|
|
7
|
+
render: Vide.Node;
|
|
8
|
+
anchor?: Vide.Node;
|
|
9
|
+
};
|
|
10
|
+
export default class AppForge extends Renders {
|
|
11
|
+
protected sources: Map<string, Vide.Source<boolean>>;
|
|
12
|
+
protected loaded: Map<string, Loaded>;
|
|
13
|
+
protected innerMount?: Destructor;
|
|
14
|
+
protected __px: boolean;
|
|
15
|
+
constructor();
|
|
16
|
+
protected createSource(name: AppNames): typeof Vide.source | undefined;
|
|
17
|
+
isLoaded(name: AppNames): boolean;
|
|
18
|
+
bind(name: AppNames, value: Vide.Source<boolean>): void;
|
|
19
|
+
anchor(name: AppNames, anchorName: AppNames, props: Types.Props.Main): void;
|
|
20
|
+
index(name: AppNames, index: number): void;
|
|
21
|
+
getSource(name: AppNames): Vide.Source<boolean>;
|
|
22
|
+
set(name: AppNames, value: boolean, rules?: boolean): void;
|
|
23
|
+
open(name: AppNames, rules?: boolean): void;
|
|
24
|
+
close(name: AppNames, rules?: boolean): void;
|
|
25
|
+
toggle(name: AppNames, rules?: boolean): void;
|
|
26
|
+
story(props: Types.Props.Main): Frame;
|
|
27
|
+
mount(callback: () => Vide.Node, props: Types.Props.Main, target: Instance): Destructor;
|
|
28
|
+
unMount(): void;
|
|
29
|
+
}
|
|
30
|
+
export {};
|