@rbxts/app-forge 0.6.0-alpha.63 → 0.6.0-alpha.65
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/vide/decorator.luau +1 -0
- package/out/vide/helpers.d.ts +3 -0
- package/out/vide/helpers.luau +84 -8
- package/out/vide/index.d.ts +2 -0
- package/out/vide/init.luau +48 -88
- package/out/vide/types.d.ts +8 -3
- package/package.json +1 -1
package/out/vide/decorator.luau
CHANGED
package/out/vide/helpers.d.ts
CHANGED
|
@@ -2,4 +2,7 @@ import Vide from "@rbxts/vide";
|
|
|
2
2
|
import type Types from "./types";
|
|
3
3
|
import type AppForge from ".";
|
|
4
4
|
export declare function createSource(name: AppNames, forge: AppForge): typeof Vide.source | undefined;
|
|
5
|
+
export declare function normalizeGroups(group: GroupNames | GroupNames[]): GroupNames[];
|
|
6
|
+
export declare function collectByGroup(groups: GroupNames[], filter?: (name: AppNames) => boolean): AppNames[];
|
|
7
|
+
export declare function renderNames(props: Types.Props.Main, names: AppNames[], forge: AppForge): (ScreenGui | Frame)[];
|
|
5
8
|
export declare function Render(props: Types.Props.Main): Vide.Node;
|
package/out/vide/helpers.luau
CHANGED
|
@@ -28,6 +28,63 @@ local function createSource(name, forge)
|
|
|
28
28
|
_sources_1[_exp] = _arg1
|
|
29
29
|
return source
|
|
30
30
|
end
|
|
31
|
+
local function normalizeGroups(group)
|
|
32
|
+
local _group = group
|
|
33
|
+
local _result
|
|
34
|
+
if type(_group) == "table" then
|
|
35
|
+
local _array = {}
|
|
36
|
+
local _length = #_array
|
|
37
|
+
table.move(group, 1, #group, _length + 1, _array)
|
|
38
|
+
_result = _array
|
|
39
|
+
else
|
|
40
|
+
_result = { group }
|
|
41
|
+
end
|
|
42
|
+
return _result
|
|
43
|
+
end
|
|
44
|
+
local function collectByGroup(groups, filter)
|
|
45
|
+
local result = {}
|
|
46
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
47
|
+
local _callback = function(app, name)
|
|
48
|
+
local appGroup = app.renderGroup
|
|
49
|
+
if not (appGroup ~= "" and appGroup) then
|
|
50
|
+
return nil
|
|
51
|
+
end
|
|
52
|
+
if not (table.find(groups, appGroup) ~= nil) then
|
|
53
|
+
return nil
|
|
54
|
+
end
|
|
55
|
+
if filter and not filter(name) then
|
|
56
|
+
return nil
|
|
57
|
+
end
|
|
58
|
+
local _name = name
|
|
59
|
+
table.insert(result, _name)
|
|
60
|
+
end
|
|
61
|
+
for _k, _v in AppRegistry do
|
|
62
|
+
_callback(_v, _k, AppRegistry)
|
|
63
|
+
end
|
|
64
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
65
|
+
return result
|
|
66
|
+
end
|
|
67
|
+
local function renderNames(props, names, forge)
|
|
68
|
+
if #names == 0 then
|
|
69
|
+
error("No app names provided to renderApps")
|
|
70
|
+
end
|
|
71
|
+
-- ▼ ReadonlyArray.map ▼
|
|
72
|
+
local _newValue = table.create(#names)
|
|
73
|
+
local _callback = function(name)
|
|
74
|
+
local _forge = forge
|
|
75
|
+
local _object = table.clone(props)
|
|
76
|
+
setmetatable(_object, nil)
|
|
77
|
+
_object.render = {
|
|
78
|
+
name = name,
|
|
79
|
+
}
|
|
80
|
+
return _forge:renderApp(_object)
|
|
81
|
+
end
|
|
82
|
+
for _k, _v in names do
|
|
83
|
+
_newValue[_k] = _callback(_v, _k - 1, names)
|
|
84
|
+
end
|
|
85
|
+
-- ▲ ReadonlyArray.map ▲
|
|
86
|
+
return _newValue
|
|
87
|
+
end
|
|
31
88
|
local function Render(props)
|
|
32
89
|
local _binding = props
|
|
33
90
|
local config = _binding.config
|
|
@@ -60,15 +117,31 @@ local function Render(props)
|
|
|
60
117
|
warn("Rendering twice making a second px")
|
|
61
118
|
end
|
|
62
119
|
if render then
|
|
63
|
-
local
|
|
64
|
-
if
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
120
|
+
local _condition = render.name
|
|
121
|
+
if _condition ~= "" and _condition then
|
|
122
|
+
_condition = render.group
|
|
123
|
+
end
|
|
124
|
+
if _condition ~= "" and _condition then
|
|
125
|
+
return forge:renderGroupByName(props)
|
|
68
126
|
else
|
|
69
|
-
local
|
|
70
|
-
if
|
|
71
|
-
return forge:
|
|
127
|
+
local _value = render.names and render.group
|
|
128
|
+
if _value ~= "" and _value then
|
|
129
|
+
return forge:renderGroupByNames(props)
|
|
130
|
+
else
|
|
131
|
+
local _result = render
|
|
132
|
+
if _result ~= nil then
|
|
133
|
+
_result = _result.name
|
|
134
|
+
end
|
|
135
|
+
if _result ~= "" and _result then
|
|
136
|
+
return forge:renderApp(props)
|
|
137
|
+
elseif render.names then
|
|
138
|
+
return forge:renderApps(props)
|
|
139
|
+
else
|
|
140
|
+
local _value_1 = render.group
|
|
141
|
+
if _value_1 ~= "" and _value_1 then
|
|
142
|
+
return forge:renderGroup(props)
|
|
143
|
+
end
|
|
144
|
+
end
|
|
72
145
|
end
|
|
73
146
|
end
|
|
74
147
|
end
|
|
@@ -76,5 +149,8 @@ local function Render(props)
|
|
|
76
149
|
end
|
|
77
150
|
return {
|
|
78
151
|
createSource = createSource,
|
|
152
|
+
normalizeGroups = normalizeGroups,
|
|
153
|
+
collectByGroup = collectByGroup,
|
|
154
|
+
renderNames = renderNames,
|
|
79
155
|
Render = Render,
|
|
80
156
|
}
|
package/out/vide/index.d.ts
CHANGED
|
@@ -13,5 +13,7 @@ export default class AppForge {
|
|
|
13
13
|
renderApp(props: Types.Props.Main): ScreenGui | Frame;
|
|
14
14
|
renderApps(props: Types.Props.Main): (ScreenGui | Frame)[];
|
|
15
15
|
renderGroup(props: Types.Props.Main): (ScreenGui | Frame)[];
|
|
16
|
+
renderGroupByName(props: Types.Props.Main): (ScreenGui | Frame)[];
|
|
17
|
+
renderGroupByNames(props: Types.Props.Main): (ScreenGui | Frame)[];
|
|
16
18
|
renderAll(props: Types.Props.Main): (ScreenGui | Frame)[];
|
|
17
19
|
}
|
package/out/vide/init.luau
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
+
-- Services
|
|
4
|
+
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
3
5
|
-- Packages
|
|
4
6
|
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
5
7
|
local effect = _vide.effect
|
|
@@ -11,8 +13,11 @@ local AppRegistry = TS.import(script, script, "decorator").AppRegistry
|
|
|
11
13
|
-- Classes
|
|
12
14
|
local RulesManager = TS.import(script, script, "rules").default
|
|
13
15
|
-- Helpers
|
|
14
|
-
local
|
|
15
|
-
local
|
|
16
|
+
local _helpers = TS.import(script, script, "helpers")
|
|
17
|
+
local createSource = _helpers.createSource
|
|
18
|
+
local renderNames = _helpers.renderNames
|
|
19
|
+
local collectByGroup = _helpers.collectByGroup
|
|
20
|
+
local normalizeGroups = _helpers.normalizeGroups
|
|
16
21
|
local AppForge
|
|
17
22
|
do
|
|
18
23
|
AppForge = setmetatable({}, {
|
|
@@ -104,86 +109,47 @@ do
|
|
|
104
109
|
_names = _names.names
|
|
105
110
|
end
|
|
106
111
|
local names = _names
|
|
107
|
-
if names then
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
local render = {
|
|
112
|
-
name = name,
|
|
113
|
-
}
|
|
114
|
-
local _self = self
|
|
115
|
-
local _object = table.clone(props)
|
|
116
|
-
setmetatable(_object, nil)
|
|
117
|
-
_object.render = render
|
|
118
|
-
return _self:renderApp(_object)
|
|
119
|
-
end
|
|
120
|
-
for _k, _v in names do
|
|
121
|
-
_newValue[_k] = _callback(_v, _k - 1, names)
|
|
122
|
-
end
|
|
123
|
-
-- ▲ ReadonlyArray.map ▲
|
|
124
|
-
return _newValue
|
|
125
|
-
end
|
|
126
|
-
error("No app names provided to renderApps")
|
|
112
|
+
if not names then
|
|
113
|
+
error("No app names provided to renderApps")
|
|
114
|
+
end
|
|
115
|
+
return renderNames(props, names, self)
|
|
127
116
|
end
|
|
128
117
|
function AppForge:renderGroup(props)
|
|
129
|
-
local
|
|
130
|
-
if
|
|
131
|
-
|
|
132
|
-
end
|
|
133
|
-
local
|
|
134
|
-
if
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
end
|
|
165
|
-
-- ▲ ReadonlyMap.forEach ▲
|
|
166
|
-
if names then
|
|
167
|
-
-- ▼ ReadonlyArray.map ▼
|
|
168
|
-
local _newValue = table.create(#names)
|
|
169
|
-
local _callback_1 = function(name)
|
|
170
|
-
local render = {
|
|
171
|
-
name = name,
|
|
172
|
-
}
|
|
173
|
-
local _self = self
|
|
174
|
-
local _object = table.clone(props)
|
|
175
|
-
setmetatable(_object, nil)
|
|
176
|
-
_object.render = render
|
|
177
|
-
return _self:renderApp(_object)
|
|
178
|
-
end
|
|
179
|
-
for _k, _v in names do
|
|
180
|
-
_newValue[_k] = _callback_1(_v, _k - 1, names)
|
|
181
|
-
end
|
|
182
|
-
-- ▲ ReadonlyArray.map ▲
|
|
183
|
-
return _newValue
|
|
184
|
-
end
|
|
185
|
-
end
|
|
186
|
-
error("No app names provided to renderApps")
|
|
118
|
+
local _group = props.render
|
|
119
|
+
if _group ~= nil then
|
|
120
|
+
_group = _group.group
|
|
121
|
+
end
|
|
122
|
+
local group = _group
|
|
123
|
+
if not (group ~= "" and group) then
|
|
124
|
+
error("No app names provided to renderApps")
|
|
125
|
+
end
|
|
126
|
+
local groups = normalizeGroups(group)
|
|
127
|
+
return renderNames(props, collectByGroup(groups), self)
|
|
128
|
+
end
|
|
129
|
+
function AppForge:renderGroupByName(props)
|
|
130
|
+
local _binding = props.render or {}
|
|
131
|
+
local group = _binding.group
|
|
132
|
+
local name = _binding.name
|
|
133
|
+
if not (group ~= "" and group) or not (name ~= "" and name) then
|
|
134
|
+
error("No app names provided to renderApps")
|
|
135
|
+
end
|
|
136
|
+
local groups = normalizeGroups(group)
|
|
137
|
+
return renderNames(props, collectByGroup(groups, function(n)
|
|
138
|
+
return n == name
|
|
139
|
+
end), self)
|
|
140
|
+
end
|
|
141
|
+
function AppForge:renderGroupByNames(props)
|
|
142
|
+
local _binding = props.render or {}
|
|
143
|
+
local group = _binding.group
|
|
144
|
+
local names = _binding.names
|
|
145
|
+
if not (group ~= "" and group) or not names then
|
|
146
|
+
error("No app names provided to renderApps")
|
|
147
|
+
end
|
|
148
|
+
local groups = normalizeGroups(group)
|
|
149
|
+
return renderNames(props, collectByGroup(groups, function(n)
|
|
150
|
+
local _n = n
|
|
151
|
+
return table.find(names, _n) ~= nil
|
|
152
|
+
end), self)
|
|
187
153
|
end
|
|
188
154
|
function AppForge:renderAll(props)
|
|
189
155
|
local names = {}
|
|
@@ -191,19 +157,13 @@ do
|
|
|
191
157
|
local _callback = function(_, name)
|
|
192
158
|
local _name = name
|
|
193
159
|
table.insert(names, _name)
|
|
160
|
+
return #names
|
|
194
161
|
end
|
|
195
162
|
for _k, _v in AppRegistry do
|
|
196
163
|
_callback(_v, _k, AppRegistry)
|
|
197
164
|
end
|
|
198
165
|
-- ▲ ReadonlyMap.forEach ▲
|
|
199
|
-
|
|
200
|
-
names = names,
|
|
201
|
-
}
|
|
202
|
-
local _self = self
|
|
203
|
-
local _object = table.clone(props)
|
|
204
|
-
setmetatable(_object, nil)
|
|
205
|
-
_object.render = render
|
|
206
|
-
return _self:renderApps(_object)
|
|
166
|
+
return renderNames(props, names, self)
|
|
207
167
|
end
|
|
208
168
|
end
|
|
209
169
|
return {
|
package/out/vide/types.d.ts
CHANGED
|
@@ -7,7 +7,9 @@ declare namespace Types {
|
|
|
7
7
|
type Render =
|
|
8
8
|
| { name?: AppNames; names?: never; group?: never }
|
|
9
9
|
| { names?: AppNames[]; name?: never; group?: never }
|
|
10
|
-
| {
|
|
10
|
+
| { group?: GroupNames[] | GroupNames; names?: AppNames[]; name?: never }
|
|
11
|
+
| { group?: GroupNames[] | GroupNames; name?: AppNames; names?: never }
|
|
12
|
+
| { group?: GroupNames[] | GroupNames; names?: never; name?: never };
|
|
11
13
|
|
|
12
14
|
type Main = {
|
|
13
15
|
props: AppProps;
|
|
@@ -32,18 +34,23 @@ declare namespace Types {
|
|
|
32
34
|
type Props<N extends AppNames> = {
|
|
33
35
|
name: N;
|
|
34
36
|
visible?: boolean;
|
|
37
|
+
renderGroup?: GroupNames;
|
|
35
38
|
rules?: Rules.Generic<N>;
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
type Static = {
|
|
39
42
|
constructor: new (props: Types.Props.Main, name: AppNames) => Args;
|
|
43
|
+
|
|
40
44
|
visible?: boolean;
|
|
45
|
+
renderGroup?: GroupNames;
|
|
41
46
|
rules?: Rules.Static;
|
|
42
47
|
};
|
|
43
48
|
|
|
44
49
|
type Generic<N extends AppNames = AppNames> = {
|
|
45
50
|
constructor: new (props: Types.Props.Main, name: AppNames) => Args;
|
|
51
|
+
|
|
46
52
|
visible?: boolean;
|
|
53
|
+
renderGroup?: GroupNames;
|
|
47
54
|
rules?: Rules.Generic<N>;
|
|
48
55
|
};
|
|
49
56
|
}
|
|
@@ -52,13 +59,11 @@ declare namespace Types {
|
|
|
52
59
|
type Static = {
|
|
53
60
|
parent?: string;
|
|
54
61
|
exclusiveGroup?: string;
|
|
55
|
-
renderGroup?: string;
|
|
56
62
|
};
|
|
57
63
|
|
|
58
64
|
type Generic<N extends AppNames = AppNames> = {
|
|
59
65
|
parent?: Exclude<AppNames, N>;
|
|
60
66
|
exclusiveGroup?: GroupNames;
|
|
61
|
-
renderGroup?: GroupNames;
|
|
62
67
|
};
|
|
63
68
|
}
|
|
64
69
|
}
|