@rbxts/app-forge 0.6.0-alpha.71 → 0.6.0-alpha.73

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 CHANGED
@@ -9,6 +9,8 @@ AppForge is a UI/app orchestration system for Vide/React in Roblox, enabling:
9
9
 
10
10
  ---
11
11
 
12
+ # REACT is PLANNED to be worked on but is NOT recommended ATM
13
+
12
14
  # 📦 Installation
13
15
 
14
16
  ```bash
package/out/index.d.ts CHANGED
@@ -3,7 +3,6 @@ export { App as VideApp, Args as VideArgs } from "./vide/decorator";
3
3
  export { default as CreateReactForge } from "./react";
4
4
  export { default as CreateVideForge } from "./vide";
5
5
  export { Render as RenderReact } from "./react/helpers";
6
- export { Render as RenderVide } from "./vide/helpers";
7
6
  export type { MainProps as VideProps, ClassProps as VideClassProps, RenderProps as VideRenderProps, } from "./vide/types";
8
7
  export type { MainProps as ReactProps, ClassProps as ReactClassProps, } from "./react/types";
9
8
  export { default as useReactAppContext } from "./react/hooks/useAppContext";
package/out/init.luau CHANGED
@@ -13,7 +13,6 @@ exports.CreateReactForge = TS.import(script, script, "react").default
13
13
  exports.CreateVideForge = TS.import(script, script, "vide").default
14
14
  -- Helpers
15
15
  exports.RenderReact = TS.import(script, script, "react", "helpers").Render
16
- exports.RenderVide = TS.import(script, script, "vide", "helpers").Render
17
16
  -- Types
18
17
  exports.useReactAppContext = TS.import(script, script, "react", "hooks", "useAppContext").default
19
18
  exports.ReactContexts = TS.import(script, script, "react", "context").default
@@ -0,0 +1,15 @@
1
+ import type AppForge from "..";
2
+ import type Types from "../types";
3
+ import Rules from "./rules";
4
+ export default class Renders extends Rules {
5
+ constructor();
6
+ private renderNames;
7
+ private collectByGroup;
8
+ private normalizeGroups;
9
+ protected renderApp(this: AppForge, props: Types.Props.Main): ScreenGui | Frame;
10
+ protected renderApps(this: AppForge, props: Types.Props.Main): (ScreenGui | Frame)[];
11
+ protected renderGroup(this: AppForge, props: Types.Props.Main): (ScreenGui | Frame)[];
12
+ protected renderGroupByName(this: AppForge, props: Types.Props.Main): (ScreenGui | Frame)[];
13
+ protected renderGroupByNames(this: AppForge, props: Types.Props.Main): (ScreenGui | Frame)[];
14
+ protected renderAll(this: AppForge, props: Types.Props.Main): (ScreenGui | Frame)[];
15
+ }
@@ -0,0 +1,193 @@
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 create = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).create
7
+ -- Types
8
+ -- Components
9
+ local AppRegistry = TS.import(script, script.Parent.Parent, "decorator").AppRegistry
10
+ -- Classes
11
+ local Rules = TS.import(script, script.Parent, "rules").default
12
+ local Renders
13
+ do
14
+ local super = Rules
15
+ Renders = setmetatable({}, {
16
+ __tostring = function()
17
+ return "Renders"
18
+ end,
19
+ __index = super,
20
+ })
21
+ Renders.__index = Renders
22
+ function Renders.new(...)
23
+ local self = setmetatable({}, Renders)
24
+ return self:constructor(...) or self
25
+ end
26
+ function Renders:constructor()
27
+ super.constructor(self)
28
+ end
29
+ function Renders:renderNames(props, names, forge)
30
+ if #names == 0 then
31
+ error("No app names provided to renderApps")
32
+ end
33
+ -- ▼ ReadonlyArray.map ▼
34
+ local _newValue = table.create(#names)
35
+ local _callback = function(name)
36
+ local _forge = forge
37
+ local _object = table.clone(props)
38
+ setmetatable(_object, nil)
39
+ _object.render = {
40
+ name = name,
41
+ }
42
+ return _forge:renderApp(_object)
43
+ end
44
+ for _k, _v in names do
45
+ _newValue[_k] = _callback(_v, _k - 1, names)
46
+ end
47
+ -- ▲ ReadonlyArray.map ▲
48
+ return _newValue
49
+ end
50
+ function Renders:collectByGroup(groups, filter)
51
+ local result = {}
52
+ -- ▼ ReadonlyMap.forEach ▼
53
+ local _callback = function(app, name)
54
+ local appGroup = app.renderGroup
55
+ if not (appGroup ~= "" and appGroup) then
56
+ return nil
57
+ end
58
+ if not (table.find(groups, appGroup) ~= nil) then
59
+ return nil
60
+ end
61
+ if filter and not filter(name) then
62
+ return nil
63
+ end
64
+ local _name = name
65
+ table.insert(result, _name)
66
+ end
67
+ for _k, _v in AppRegistry do
68
+ _callback(_v, _k, AppRegistry)
69
+ end
70
+ -- ▲ ReadonlyMap.forEach ▲
71
+ return result
72
+ end
73
+ function Renders:normalizeGroups(group)
74
+ local _group = group
75
+ local _result
76
+ if type(_group) == "table" then
77
+ local _array = {}
78
+ local _length = #_array
79
+ table.move(group, 1, #group, _length + 1, _array)
80
+ _result = _array
81
+ else
82
+ _result = { group }
83
+ end
84
+ return _result
85
+ end
86
+ function Renders:renderApp(props)
87
+ local _binding = props
88
+ local forge = _binding.forge
89
+ local render = _binding.render
90
+ local _name = render
91
+ if _name ~= nil then
92
+ _name = _name.name
93
+ end
94
+ local name = _name
95
+ if not (name ~= "" and name) then
96
+ error("App name is required to create instance")
97
+ end
98
+ local appClass = AppRegistry[name]
99
+ if not appClass then
100
+ error(`App "{name}" not registered`)
101
+ end
102
+ if not (forge.loaded[name] ~= nil) then
103
+ local instance = appClass.constructor.new(props, name)
104
+ local _loaded = forge.loaded
105
+ local _arg1 = instance:render()
106
+ _loaded[name] = _arg1
107
+ end
108
+ local element = forge.loaded[name]
109
+ if not element then
110
+ error(`Failed to create instance for app "{name}"`)
111
+ end
112
+ if RunService:IsRunning() then
113
+ return create("ScreenGui")({
114
+ Name = name,
115
+ ZIndexBehavior = "Sibling",
116
+ ResetOnSpawn = false,
117
+ [0] = element,
118
+ })
119
+ else
120
+ return create("Frame")({
121
+ Name = name,
122
+ BackgroundTransparency = 1,
123
+ Size = UDim2.fromScale(1, 1),
124
+ [0] = element,
125
+ })
126
+ end
127
+ end
128
+ function Renders:renderApps(props)
129
+ local _names = props.render
130
+ if _names ~= nil then
131
+ _names = _names.names
132
+ end
133
+ local names = _names
134
+ if not names then
135
+ error("No app names provided")
136
+ end
137
+ return self:renderNames(props, names, self)
138
+ end
139
+ function Renders:renderGroup(props)
140
+ local _group = props.render
141
+ if _group ~= nil then
142
+ _group = _group.group
143
+ end
144
+ local group = _group
145
+ if not (group ~= "" and group) then
146
+ error("No group provided")
147
+ end
148
+ local groups = self:normalizeGroups(group)
149
+ return self:renderNames(props, self:collectByGroup(groups), self)
150
+ end
151
+ function Renders:renderGroupByName(props)
152
+ local _binding = props.render or {}
153
+ local group = _binding.group
154
+ local name = _binding.name
155
+ if not (group ~= "" and group) or not (name ~= "" and name) then
156
+ error("Invalid renderGroupByName")
157
+ end
158
+ local groups = self:normalizeGroups(group)
159
+ return self:renderNames(props, self:collectByGroup(groups, function(n)
160
+ return n == name
161
+ end), self)
162
+ end
163
+ function Renders:renderGroupByNames(props)
164
+ local _binding = props.render or {}
165
+ local group = _binding.group
166
+ local names = _binding.names
167
+ if not (group ~= "" and group) or not names then
168
+ error("Invalid renderGroupByNames")
169
+ end
170
+ local groups = self:normalizeGroups(group)
171
+ return self:renderNames(props, self:collectByGroup(groups, function(n)
172
+ local _n = n
173
+ return table.find(names, _n) ~= nil
174
+ end), self)
175
+ end
176
+ function Renders:renderAll(props)
177
+ local names = {}
178
+ -- ▼ ReadonlyMap.forEach ▼
179
+ local _callback = function(_, name)
180
+ local _name = name
181
+ table.insert(names, _name)
182
+ return #names
183
+ end
184
+ for _k, _v in AppRegistry do
185
+ _callback(_v, _k, AppRegistry)
186
+ end
187
+ -- ▲ ReadonlyMap.forEach ▲
188
+ return self:renderNames(props, names, self)
189
+ end
190
+ end
191
+ return {
192
+ default = Renders,
193
+ }
@@ -1,2 +1,2 @@
1
- import type AppForge from "..";
1
+ import type AppForge from "../..";
2
2
  export default function ExclusiveGroupRule(entry: AppNames, forge: AppForge): void;
@@ -2,7 +2,7 @@
2
2
  local TS = _G[script]
3
3
  -- Types
4
4
  -- Components
5
- local AppRegistry = TS.import(script, script.Parent.Parent, "decorator").AppRegistry
5
+ local AppRegistry = TS.import(script, script.Parent.Parent.Parent, "decorator").AppRegistry
6
6
  local function ExclusiveGroupRule(entry, forge)
7
7
  local _entry = entry
8
8
  local entryApp = AppRegistry[_entry]
@@ -0,0 +1,5 @@
1
+ import type AppForge from "../..";
2
+ export default class Rules {
3
+ protected processing: Set<string>;
4
+ protected applyRules(this: AppForge, name: AppNames): void;
5
+ }
@@ -4,23 +4,22 @@ local TS = _G[script]
4
4
  -- Rules
5
5
  local ExclusiveGroupRule = TS.import(script, script, "exclusiveGroup").default
6
6
  local ParentRule = TS.import(script, script, "parent").default
7
- local RulesManager
7
+ local Rules
8
8
  do
9
- RulesManager = setmetatable({}, {
9
+ Rules = setmetatable({}, {
10
10
  __tostring = function()
11
- return "RulesManager"
11
+ return "Rules"
12
12
  end,
13
13
  })
14
- RulesManager.__index = RulesManager
15
- function RulesManager.new(...)
16
- local self = setmetatable({}, RulesManager)
14
+ Rules.__index = Rules
15
+ function Rules.new(...)
16
+ local self = setmetatable({}, Rules)
17
17
  return self:constructor(...) or self
18
18
  end
19
- function RulesManager:constructor(forge)
20
- self.forge = forge
19
+ function Rules:constructor()
21
20
  self.processing = {}
22
21
  end
23
- function RulesManager:applyRules(name)
22
+ function Rules:applyRules(name)
24
23
  local _processing = self.processing
25
24
  local _name = name
26
25
  if _processing[_name] ~= nil then
@@ -30,8 +29,8 @@ do
30
29
  local _name_1 = name
31
30
  _processing_1[_name_1] = true
32
31
  TS.try(function()
33
- ParentRule(name, self.forge)
34
- ExclusiveGroupRule(name, self.forge)
32
+ ParentRule(name, self)
33
+ ExclusiveGroupRule(name, self)
35
34
  end, nil, function()
36
35
  local _processing_2 = self.processing
37
36
  local _name_2 = name
@@ -40,5 +39,5 @@ do
40
39
  end
41
40
  end
42
41
  return {
43
- default = RulesManager,
42
+ default = Rules,
44
43
  }
@@ -1,2 +1,2 @@
1
- import type AppForge from "..";
1
+ import type AppForge from "../..";
2
2
  export default function ParentRule(entry: AppNames, forge: AppForge): void;
@@ -2,7 +2,7 @@
2
2
  local TS = _G[script]
3
3
  -- Types
4
4
  -- Components
5
- local AppRegistry = TS.import(script, script.Parent.Parent, "decorator").AppRegistry
5
+ local AppRegistry = TS.import(script, script.Parent.Parent.Parent, "decorator").AppRegistry
6
6
  local function ParentRule(entry, forge)
7
7
  local entrySource = forge:getSource(entry)()
8
8
  -- ▼ ReadonlyMap.forEach ▼
@@ -1,23 +1,20 @@
1
1
  import Vide from "@rbxts/vide";
2
- import type Types from "./types";
3
- import { type RenderAPI } from "./helpers";
4
- export default class AppForge {
5
- sources: Map<string, Vide.Source<boolean>>;
6
- loaded: Map<string, Vide.Node>;
7
- innerMount: () => void;
8
- private rulesManager;
9
- getSource(name: AppNames): Vide.Source<boolean>;
2
+ import Renders from "./classes/renders";
3
+ import Types from "./types";
4
+ export default class AppForge extends Renders {
5
+ protected sources: Map<string, Vide.Source<boolean>>;
6
+ protected loaded: Map<string, Vide.Node>;
7
+ protected innerMount?: () => void;
8
+ protected __px: boolean;
9
+ constructor();
10
+ protected createSource(name: AppNames): typeof Vide.source | undefined;
11
+ isLoaded(name: AppNames): boolean;
10
12
  bind(name: AppNames, value: Vide.Source<boolean>): void;
13
+ getSource(name: AppNames): Vide.Source<boolean>;
11
14
  set(name: AppNames, value: boolean, rules?: boolean): void;
12
15
  open(name: AppNames, rules?: boolean): void;
13
16
  close(name: AppNames, rules?: boolean): void;
14
- mount(callback: (Render: RenderAPI) => Vide.Node, target: Instance): void;
17
+ mount(callback: () => Vide.Node, props: Types.Props.Main, target: Instance): void;
15
18
  unMount(): void;
16
19
  toggle(name: AppNames, rules?: boolean): void;
17
- renderApp(props: Types.Props.Main): ScreenGui | Frame;
18
- renderApps(props: Types.Props.Main): (ScreenGui | Frame)[];
19
- renderGroup(props: Types.Props.Main): (ScreenGui | Frame)[];
20
- renderGroupByName(props: Types.Props.Main): (ScreenGui | Frame)[];
21
- renderGroupByNames(props: Types.Props.Main): (ScreenGui | Frame)[];
22
- renderAll(props: Types.Props.Main): (ScreenGui | Frame)[];
23
20
  }
@@ -4,28 +4,24 @@ local TS = _G[script]
4
4
  local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
5
5
  -- Packages
6
6
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
7
+ local apply = _vide.apply
7
8
  local effect = _vide.effect
8
9
  local mount = _vide.mount
10
+ local source = _vide.source
9
11
  local untrack = _vide.untrack
10
- -- Types
11
- -- Components
12
- local AppContainer = TS.import(script, script, "container").AppContainer
13
- local AppRegistry = TS.import(script, script, "decorator").AppRegistry
12
+ local usePx = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-vide-utils").out).usePx
14
13
  -- Classes
15
- local RulesManager = TS.import(script, script, "rules").default
14
+ local Renders = TS.import(script, script, "classes", "renders").default
16
15
  -- Helpers
17
- local _helpers = TS.import(script, script, "helpers")
18
- local createSource = _helpers.createSource
19
- local renderNames = _helpers.renderNames
20
- local collectByGroup = _helpers.collectByGroup
21
- local normalizeGroups = _helpers.normalizeGroups
22
- local Render = _helpers.Render
16
+ local AppRegistry = TS.import(script, script, "decorator").AppRegistry
23
17
  local AppForge
24
18
  do
19
+ local super = Renders
25
20
  AppForge = setmetatable({}, {
26
21
  __tostring = function()
27
22
  return "AppForge"
28
23
  end,
24
+ __index = super,
29
25
  })
30
26
  AppForge.__index = AppForge
31
27
  function AppForge.new(...)
@@ -33,19 +29,44 @@ do
33
29
  return self:constructor(...) or self
34
30
  end
35
31
  function AppForge:constructor()
32
+ super.constructor(self)
36
33
  self.sources = {}
37
34
  self.loaded = {}
38
- self.rulesManager = RulesManager.new(self)
35
+ self.__px = false
36
+ -- ▼ ReadonlyMap.forEach ▼
37
+ local _callback = function(_, name)
38
+ return self:createSource(name)
39
+ end
40
+ for _k, _v in AppRegistry do
41
+ _callback(_v, _k, AppRegistry)
42
+ end
43
+ -- ▲ ReadonlyMap.forEach ▲
39
44
  end
40
- function AppForge:getSource(name)
41
- local _sources = self.sources
45
+ function AppForge:createSource(name)
42
46
  local _name = name
43
- if not (_sources[_name] ~= nil) then
44
- createSource(name, self)
47
+ local app = AppRegistry[_name]
48
+ if not app then
49
+ error(`App "{name}" not registered`)
45
50
  end
46
- local _sources_1 = self.sources
51
+ local _sources = self.sources
47
52
  local _name_1 = name
48
- return _sources_1[_name_1]
53
+ if _sources[_name_1] ~= nil then
54
+ return nil
55
+ end
56
+ local _sources_1 = self.sources
57
+ local _exp = name
58
+ local _condition = app.visible
59
+ if _condition == nil then
60
+ _condition = false
61
+ end
62
+ local _arg1 = source(_condition)
63
+ _sources_1[_exp] = _arg1
64
+ return source
65
+ end
66
+ function AppForge:isLoaded(name)
67
+ local _loaded = self.loaded
68
+ local _name = name
69
+ return _loaded[_name] ~= nil
49
70
  end
50
71
  function AppForge:bind(name, value)
51
72
  if not RunService:IsRunning() then
@@ -56,25 +77,35 @@ do
56
77
  effect(function()
57
78
  value()
58
79
  untrack(function()
59
- return self.rulesManager:applyRules(name)
80
+ return self:applyRules(name)
60
81
  end)
61
82
  end)
62
83
  else
63
84
  warn("forge.bind is used for studio when game isnt running")
64
85
  end
65
86
  end
87
+ function AppForge:getSource(name)
88
+ local _sources = self.sources
89
+ local _name = name
90
+ if not (_sources[_name] ~= nil) then
91
+ self:createSource(name)
92
+ end
93
+ local _sources_1 = self.sources
94
+ local _name_1 = name
95
+ return _sources_1[_name_1]
96
+ end
66
97
  function AppForge:set(name, value, rules)
67
98
  if rules == nil then
68
99
  rules = true
69
100
  end
70
101
  if rules then
71
- self.rulesManager:applyRules(name)
102
+ self:applyRules(name)
72
103
  end
73
104
  local _sources = self.sources
74
105
  local _name = name
75
106
  local src = _sources[_name]
76
107
  if not src then
77
- createSource(name, self)
108
+ self:createSource(name)
78
109
  local _sources_1 = self.sources
79
110
  local _name_1 = name
80
111
  src = _sources_1[_name_1]
@@ -96,13 +127,72 @@ do
96
127
  end
97
128
  self:set(name, false, rules)
98
129
  end
99
- function AppForge:mount(callback, target)
130
+ function AppForge:mount(callback, props, target)
131
+ local _binding = props
132
+ local config = _binding.config
133
+ local render = _binding.render
134
+ if not self.__px then
135
+ local _result = config
136
+ if _result ~= nil then
137
+ _result = _result.px.target
138
+ end
139
+ local _result_1 = config
140
+ if _result_1 ~= nil then
141
+ _result_1 = _result_1.px.resolution
142
+ end
143
+ local _result_2 = config
144
+ if _result_2 ~= nil then
145
+ _result_2 = _result_2.px.minScale
146
+ end
147
+ usePx(_result, _result_1, _result_2)
148
+ self.__px = true
149
+ else
150
+ warn("Rendering twice making a second px")
151
+ end
152
+ local children
153
+ if render then
154
+ local _condition = render.name
155
+ if _condition ~= "" and _condition then
156
+ _condition = render.group
157
+ end
158
+ if _condition ~= "" and _condition then
159
+ children = self:renderGroupByName(props)
160
+ else
161
+ local _value = render.names and render.group
162
+ if _value ~= "" and _value then
163
+ children = self:renderGroupByNames(props)
164
+ else
165
+ local _result = render
166
+ if _result ~= nil then
167
+ _result = _result.name
168
+ end
169
+ if _result ~= "" and _result then
170
+ children = self:renderApp(props)
171
+ elseif render.names then
172
+ children = self:renderApps(props)
173
+ else
174
+ local _value_1 = render.group
175
+ if _value_1 ~= "" and _value_1 then
176
+ children = self:renderGroup(props)
177
+ end
178
+ end
179
+ end
180
+ end
181
+ end
182
+ children = self:renderAll(props)
183
+ local Container = callback()
184
+ apply(Container)({
185
+ [0] = children,
186
+ })
100
187
  self.innerMount = mount(function()
101
- return callback(Render)
188
+ return Container
102
189
  end, target)
103
190
  end
104
191
  function AppForge:unMount()
105
- self.innerMount()
192
+ local _result = self.innerMount
193
+ if _result ~= nil then
194
+ _result()
195
+ end
106
196
  end
107
197
  function AppForge:toggle(name, rules)
108
198
  if rules == nil then
@@ -110,71 +200,6 @@ do
110
200
  end
111
201
  self:set(name, not self:getSource(name)(), rules)
112
202
  end
113
- function AppForge:renderApp(props)
114
- return AppContainer(props)
115
- end
116
- function AppForge:renderApps(props)
117
- local _names = props.render
118
- if _names ~= nil then
119
- _names = _names.names
120
- end
121
- local names = _names
122
- if not names then
123
- error("No app names provided to renderApps")
124
- end
125
- return renderNames(props, names, self)
126
- end
127
- function AppForge:renderGroup(props)
128
- local _group = props.render
129
- if _group ~= nil then
130
- _group = _group.group
131
- end
132
- local group = _group
133
- if not (group ~= "" and group) then
134
- error("No app names provided to renderApps")
135
- end
136
- local groups = normalizeGroups(group)
137
- return renderNames(props, collectByGroup(groups), self)
138
- end
139
- function AppForge:renderGroupByName(props)
140
- local _binding = props.render or {}
141
- local group = _binding.group
142
- local name = _binding.name
143
- if not (group ~= "" and group) or not (name ~= "" and name) then
144
- error("No app names provided to renderApps")
145
- end
146
- local groups = normalizeGroups(group)
147
- return renderNames(props, collectByGroup(groups, function(n)
148
- return n == name
149
- end), self)
150
- end
151
- function AppForge:renderGroupByNames(props)
152
- local _binding = props.render or {}
153
- local group = _binding.group
154
- local names = _binding.names
155
- if not (group ~= "" and group) or not names then
156
- error("No app names provided to renderApps")
157
- end
158
- local groups = normalizeGroups(group)
159
- return renderNames(props, collectByGroup(groups, function(n)
160
- local _n = n
161
- return table.find(names, _n) ~= nil
162
- end), self)
163
- end
164
- function AppForge:renderAll(props)
165
- local names = {}
166
- -- ▼ ReadonlyMap.forEach ▼
167
- local _callback = function(_, name)
168
- local _name = name
169
- table.insert(names, _name)
170
- return #names
171
- end
172
- for _k, _v in AppRegistry do
173
- _callback(_v, _k, AppRegistry)
174
- end
175
- -- ▲ ReadonlyMap.forEach ▲
176
- return renderNames(props, names, self)
177
- end
178
203
  end
179
204
  return {
180
205
  default = AppForge,
@@ -59,11 +59,13 @@ declare namespace Types {
59
59
  type Static = {
60
60
  parent?: string;
61
61
  exclusiveGroup?: string;
62
+ layer: number;
62
63
  };
63
64
 
64
65
  type Generic<N extends AppNames = AppNames> = {
65
66
  parent?: Exclude<AppNames, N>;
66
67
  exclusiveGroup?: GroupNames;
68
+ layer: number;
67
69
  };
68
70
  }
69
71
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/app-forge",
3
- "version": "0.6.0-alpha.71",
3
+ "version": "0.6.0-alpha.73",
4
4
  "description": "An App Manager for Vide",
5
5
  "main": "out/init.lua",
6
6
  "types": "out/index.d.ts",
@@ -1,2 +0,0 @@
1
- import type Types from "./types";
2
- export declare function AppContainer(props: Types.Props.Main): ScreenGui | Frame;
@@ -1,68 +0,0 @@
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 vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
7
- -- Types
8
- -- Components
9
- local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
10
- local create = vide.create
11
- local function createInstance(props)
12
- local _binding = props
13
- local forge = _binding.forge
14
- local render = _binding.render
15
- local _name = render
16
- if _name ~= nil then
17
- _name = _name.name
18
- end
19
- local name = _name
20
- if not (name ~= "" and name) then
21
- error("App name is required to create instance")
22
- end
23
- local appClass = AppRegistry[name]
24
- if not appClass then
25
- error(`App "{name}" not registered`)
26
- end
27
- if not (forge.loaded[name] ~= nil) then
28
- local instance = appClass.constructor.new(props, name)
29
- local _loaded = forge.loaded
30
- local _arg1 = instance:render()
31
- _loaded[name] = _arg1
32
- end
33
- return forge.loaded[name]
34
- end
35
- local function AppContainer(props)
36
- local _binding = props
37
- local render = _binding.render
38
- local _name = render
39
- if _name ~= nil then
40
- _name = _name.name
41
- end
42
- local name = _name
43
- if not (name ~= "" and name) then
44
- error("App name is required in AppContainer")
45
- end
46
- local element = createInstance(props)
47
- if not element then
48
- error(`Failed to create instance for app "{name}"`)
49
- end
50
- if RunService:IsRunning() then
51
- return create("ScreenGui")({
52
- Name = name,
53
- ZIndexBehavior = "Sibling",
54
- ResetOnSpawn = false,
55
- [0] = element,
56
- })
57
- else
58
- return create("Frame")({
59
- Name = name,
60
- BackgroundTransparency = 1,
61
- Size = UDim2.fromScale(1, 1),
62
- [0] = element,
63
- })
64
- end
65
- end
66
- return {
67
- AppContainer = AppContainer,
68
- }
@@ -1,9 +0,0 @@
1
- import Vide from "@rbxts/vide";
2
- import type Types from "./types";
3
- import type AppForge from ".";
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)[];
8
- export declare function Render(props: Types.Props.Main): Vide.Node;
9
- export type RenderAPI = typeof Render;
@@ -1,156 +0,0 @@
1
- -- Compiled with roblox-ts v3.0.0
2
- local TS = _G[script]
3
- -- Packages
4
- local usePx = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-vide-utils").out).usePx
5
- local source = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).source
6
- -- Types
7
- -- Components
8
- local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
9
- local __px = false
10
- local function createSource(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 _sources = forge.sources
17
- local _name_1 = name
18
- if _sources[_name_1] ~= nil then
19
- return nil
20
- end
21
- local _sources_1 = forge.sources
22
- local _exp = name
23
- local _condition = app.visible
24
- if _condition == nil then
25
- _condition = false
26
- end
27
- local _arg1 = source(_condition)
28
- _sources_1[_exp] = _arg1
29
- return source
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
88
- local function Render(props)
89
- local _binding = props
90
- local config = _binding.config
91
- local render = _binding.render
92
- local forge = _binding.forge
93
- -- ▼ ReadonlyMap.forEach ▼
94
- local _callback = function(_, name)
95
- return createSource(name, forge)
96
- end
97
- for _k, _v in AppRegistry do
98
- _callback(_v, _k, AppRegistry)
99
- end
100
- -- ▲ ReadonlyMap.forEach ▲
101
- if not __px then
102
- local _result = config
103
- if _result ~= nil then
104
- _result = _result.px.target
105
- end
106
- local _result_1 = config
107
- if _result_1 ~= nil then
108
- _result_1 = _result_1.px.resolution
109
- end
110
- local _result_2 = config
111
- if _result_2 ~= nil then
112
- _result_2 = _result_2.px.minScale
113
- end
114
- usePx(_result, _result_1, _result_2)
115
- __px = true
116
- else
117
- warn("Rendering twice making a second px")
118
- end
119
- if render then
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)
126
- else
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
145
- end
146
- end
147
- end
148
- return forge:renderAll(props)
149
- end
150
- return {
151
- createSource = createSource,
152
- normalizeGroups = normalizeGroups,
153
- collectByGroup = collectByGroup,
154
- renderNames = renderNames,
155
- Render = Render,
156
- }
@@ -1,7 +0,0 @@
1
- import type AppForge from "..";
2
- export default class RulesManager {
3
- private forge;
4
- private processing;
5
- constructor(forge: AppForge);
6
- applyRules(name: AppNames): void;
7
- }