@rbxts/app-forge 0.6.0-alpha.82 → 0.6.0-alpha.84

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
+ # THESE ARE OUTDATED | MOUNTING IS WRONG | MISSING FEATURES
13
+
12
14
  # VIDE is working and functional in the latest build
13
15
 
14
16
  # REACT is PLANNED to be worked on but is NOT recommended ATM
@@ -1,19 +1,21 @@
1
+ import Vide from "@rbxts/vide";
1
2
  import type Types from "../types";
2
3
  import type AppForge from "..";
3
4
  import Rules from "./rules";
4
5
  export default class Renders extends Rules {
6
+ protected anchored: Map<string, {
7
+ id: AppNames;
8
+ render: Vide.Node;
9
+ }>;
5
10
  constructor();
6
- protected renderMount(this: AppForge, props: Types.Props.Main): Instance | import("@rbxts/vide").InstanceAttributes<Instance> | import("@rbxts/vide").VideAction<any> | ReadonlyMap<number, import("@rbxts/vide").Node> | {
7
- readonly [key: number]: import("@rbxts/vide").Node;
8
- } | import("@rbxts/vide").FunctionNode;
11
+ protected renderMount(this: AppForge, props: Types.Props.Main): Vide.Node;
9
12
  private renderNames;
10
13
  private collectByGroup;
11
14
  private normalizeGroups;
12
- protected afterRender(this: AppForge, props: Types.Props.Main): void;
13
- protected renderApp(this: AppForge, props: Types.Props.Main): Instance | import("@rbxts/vide").InstanceAttributes<Instance> | import("@rbxts/vide").VideAction<any> | import("@rbxts/vide").FragmentNode | import("@rbxts/vide").FunctionNode;
14
- protected renderApps(this: AppForge, props: Types.Props.Main): (Instance | import("@rbxts/vide").InstanceAttributes<Instance> | import("@rbxts/vide").VideAction<any> | import("@rbxts/vide").FragmentNode | import("@rbxts/vide").FunctionNode)[];
15
- protected renderGroup(this: AppForge, props: Types.Props.Main): (Instance | import("@rbxts/vide").InstanceAttributes<Instance> | import("@rbxts/vide").VideAction<any> | import("@rbxts/vide").FragmentNode | import("@rbxts/vide").FunctionNode)[];
16
- protected renderGroupByName(this: AppForge, props: Types.Props.Main): (Instance | import("@rbxts/vide").InstanceAttributes<Instance> | import("@rbxts/vide").VideAction<any> | import("@rbxts/vide").FragmentNode | import("@rbxts/vide").FunctionNode)[];
17
- protected renderGroupByNames(this: AppForge, props: Types.Props.Main): (Instance | import("@rbxts/vide").InstanceAttributes<Instance> | import("@rbxts/vide").VideAction<any> | import("@rbxts/vide").FragmentNode | import("@rbxts/vide").FunctionNode)[];
18
- protected renderAll(this: AppForge, props: Types.Props.Main): (Instance | import("@rbxts/vide").InstanceAttributes<Instance> | import("@rbxts/vide").VideAction<any> | import("@rbxts/vide").FragmentNode | import("@rbxts/vide").FunctionNode)[];
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[];
19
21
  }
@@ -3,6 +3,9 @@ local TS = _G[script]
3
3
  -- Services
4
4
  -- Packages
5
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
6
9
  -- Types
7
10
  -- Components
8
11
  local AppRegistry = TS.import(script, script.Parent.Parent, "decorator").AppRegistry
@@ -24,6 +27,7 @@ do
24
27
  end
25
28
  function Renders:constructor()
26
29
  super.constructor(self)
30
+ self.anchored = {}
27
31
  end
28
32
  function Renders:renderMount(props)
29
33
  local _binding = props
@@ -136,30 +140,6 @@ do
136
140
  end
137
141
  return _result
138
142
  end
139
- function Renders:afterRender(props)
140
- local _binding = props
141
- local forge = _binding.forge
142
- -- ▼ ReadonlyMap.forEach ▼
143
- local _callback = function(app, name)
144
- local rules = app.rules
145
- local _condition = not rules
146
- if not _condition then
147
- local _value = rules.parent
148
- _condition = not (_value ~= "" and _value)
149
- if not _condition then
150
- _condition = rules.detach
151
- end
152
- end
153
- if _condition then
154
- return nil
155
- end
156
- forge:attach(name, rules.parent)
157
- end
158
- for _k, _v in AppRegistry do
159
- _callback(_v, _k, AppRegistry)
160
- end
161
- -- ▲ ReadonlyMap.forEach ▲
162
- end
163
143
  function Renders:renderApp(props)
164
144
  local _binding = props
165
145
  local forge = _binding.forge
@@ -177,16 +157,41 @@ do
177
157
  error(`App "{name}" not registered`)
178
158
  end
179
159
  if not (forge.loaded[name] ~= nil) then
180
- local instance = appClass.constructor.new(props, name)
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
+ })
181
172
  local _loaded = forge.loaded
182
- local _arg1 = instance:render()
173
+ local _arg1 = {
174
+ container = container,
175
+ render = render,
176
+ }
183
177
  _loaded[name] = _arg1
178
+ local _result = appClass.rules
179
+ if _result ~= nil then
180
+ _result = _result.parent
181
+ end
182
+ local _condition = _result
183
+ if _condition ~= "" and _condition then
184
+ _condition = not not appClass.rules.detach
185
+ end
186
+ if _condition ~= "" and _condition then
187
+ self:anchor(name, appClass.rules.parent, props)
188
+ end
184
189
  end
185
190
  local element = forge.loaded[name]
186
191
  if not element then
187
192
  error(`Failed to create instance for app "{name}"`)
188
193
  end
189
- return element
194
+ return element.container
190
195
  end
191
196
  function Renders:renderApps(props)
192
197
  local _names = props.render
@@ -2,24 +2,28 @@ import Vide from "@rbxts/vide";
2
2
  import Renders from "./classes/renders";
3
3
  import Types from "./types";
4
4
  type Destructor = () => void;
5
+ type Loaded = {
6
+ container: Vide.Node;
7
+ render: Vide.Node;
8
+ anchor?: Vide.Node;
9
+ };
5
10
  export default class AppForge extends Renders {
6
11
  protected sources: Map<string, Vide.Source<boolean>>;
7
- protected attached: Map<string, string>;
8
- protected loaded: Map<string, Vide.Node>;
12
+ protected loaded: Map<string, Loaded>;
9
13
  protected innerMount?: Destructor;
10
14
  protected __px: boolean;
11
15
  constructor();
12
16
  protected createSource(name: AppNames): typeof Vide.source | undefined;
13
17
  isLoaded(name: AppNames): boolean;
14
18
  bind(name: AppNames, value: Vide.Source<boolean>): void;
15
- attach(child: AppNames, parent: AppNames): void;
19
+ anchor(name: AppNames, anchor: AppNames, props: Types.Props.Main): void;
16
20
  getSource(name: AppNames): Vide.Source<boolean>;
17
21
  set(name: AppNames, value: boolean, rules?: boolean): void;
18
22
  open(name: AppNames, rules?: boolean): void;
19
23
  close(name: AppNames, rules?: boolean): void;
24
+ toggle(name: AppNames, rules?: boolean): void;
20
25
  story(props: Types.Props.Main): Frame;
21
26
  mount(callback: () => Vide.Node, props: Types.Props.Main, target: Instance): Destructor;
22
27
  unMount(): void;
23
- toggle(name: AppNames, rules?: boolean): void;
24
28
  }
25
29
  export {};
@@ -31,7 +31,6 @@ do
31
31
  function AppForge:constructor()
32
32
  super.constructor(self)
33
33
  self.sources = {}
34
- self.attached = {}
35
34
  self.loaded = {}
36
35
  self.__px = false
37
36
  -- ▼ ReadonlyMap.forEach ▼
@@ -85,38 +84,50 @@ do
85
84
  warn("forge.bind is used for studio when game isnt running")
86
85
  end
87
86
  end
88
- function AppForge:attach(child, parent)
89
- local _attached = self.attached
90
- local _child = child
91
- local entry = _attached[_child]
92
- local _condition = entry
93
- if _condition ~= "" and _condition then
94
- _condition = entry == parent
95
- end
96
- if _condition ~= "" and _condition then
97
- return nil
87
+ function AppForge:anchor(name, anchor, props)
88
+ if name == anchor then
89
+ error(`Tried to anchor an App to itself`)
98
90
  end
99
- if not (entry ~= "" and entry) then
100
- local _loaded = self.loaded
101
- local _child_1 = child
102
- local childNode = _loaded[_child_1]
103
- if not childNode then
104
- return warn(`failed to get child: {entry} to attach to {parent}`)
105
- end
106
- local _loaded_1 = self.loaded
107
- local _parent = parent
108
- local parentNode = _loaded_1[_parent]
109
- if not parentNode then
110
- return warn(`failed to get parent: {parent} for {child} to attach to`)
111
- end
112
- apply(childNode)({
113
- Parent = parentNode,
114
- })
115
- local _attached_1 = self.attached
116
- local _child_2 = child
117
- local _parent_1 = parent
118
- _attached_1[_child_2] = _parent_1
91
+ local _anchor = anchor
92
+ local anchorApp = AppRegistry[_anchor]
93
+ if not anchorApp then
94
+ error(`Failed to get class for {anchor} from AppRegistry for anchor`)
119
95
  end
96
+ local _loaded = self.loaded
97
+ local _name = name
98
+ local _render = _loaded[_name]
99
+ if _render ~= nil then
100
+ _render = _render.render
101
+ end
102
+ local render = _render
103
+ if not render then
104
+ error(`Failed to get {name} from this.loaded for anchor to {anchor}`)
105
+ end
106
+ local achorRender = anchorApp.constructor.new(props, anchor):render()
107
+ apply(achorRender)({
108
+ Name = "Anchor",
109
+ [0] = render,
110
+ })
111
+ local _loaded_1 = self.loaded
112
+ local _name_1 = name
113
+ local prev = _loaded_1[_name_1]
114
+ local _loaded_2 = self.loaded
115
+ local _exp = name
116
+ local _object = {}
117
+ local _left = "container"
118
+ local _result = prev
119
+ if _result ~= nil then
120
+ _result = _result.container
121
+ end
122
+ _object[_left] = _result
123
+ local _left_1 = "render"
124
+ local _result_1 = prev
125
+ if _result_1 ~= nil then
126
+ _result_1 = _result_1.render
127
+ end
128
+ _object[_left_1] = _result_1
129
+ _object.anchor = achorRender
130
+ _loaded_2[_exp] = _object
120
131
  end
121
132
  function AppForge:getSource(name)
122
133
  local _sources = self.sources
@@ -161,6 +172,12 @@ do
161
172
  end
162
173
  self:set(name, false, rules)
163
174
  end
175
+ function AppForge:toggle(name, rules)
176
+ if rules == nil then
177
+ rules = true
178
+ end
179
+ self:set(name, not self:getSource(name)(), rules)
180
+ end
164
181
  function AppForge:story(props)
165
182
  local Container = create("Frame")({
166
183
  Name = "Story Container",
@@ -172,7 +189,6 @@ do
172
189
  apply(Container)({
173
190
  [0] = self:renderMount(props),
174
191
  })
175
- self:afterRender(props)
176
192
  return Container
177
193
  end
178
194
  function AppForge:mount(callback, props, target)
@@ -181,7 +197,6 @@ do
181
197
  apply(Container)({
182
198
  [0] = self:renderMount(props),
183
199
  })
184
- self:afterRender(props)
185
200
  return Container
186
201
  end, target)
187
202
  return self.innerMount
@@ -192,12 +207,6 @@ do
192
207
  _result()
193
208
  end
194
209
  end
195
- function AppForge:toggle(name, rules)
196
- if rules == nil then
197
- rules = true
198
- end
199
- self:set(name, not self:getSource(name)(), rules)
200
- end
201
210
  end
202
211
  return {
203
212
  default = AppForge,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/app-forge",
3
- "version": "0.6.0-alpha.82",
3
+ "version": "0.6.0-alpha.84",
4
4
  "description": "An App Manager for Vide",
5
5
  "main": "out/init.lua",
6
6
  "types": "out/index.d.ts",
@@ -33,22 +33,21 @@
33
33
  "publishConfig": {
34
34
  "access": "public"
35
35
  },
36
- "devDependencies": {
37
- "@biomejs/biome": "^2.3.7",
38
- "@rbxts/compiler-types": "3.0.0-types.0",
39
- "@rbxts/types": "^1.0.891",
40
- "roblox-ts": "3.0.0",
41
- "typescript": "^5.9.3"
42
- },
43
36
  "dependencies": {
44
- "@rbxts/loners-pretty-react-hooks": "^0.2.9",
45
- "@rbxts/object-utils": "^1.0.4",
46
37
  "@rbxts/services": "^1.6.0",
47
38
  "@rbxts/set-timeout": "^1.1.2"
48
39
  },
49
40
  "peerDependencies": {
41
+ "@rbxts/loners-pretty-react-hooks": "^0.2.9",
50
42
  "@rbxts/loners-pretty-vide-utils": "^0.1.7",
51
43
  "@rbxts/react": "^17.3.7-ts.1",
52
44
  "@rbxts/vide": "^0.5.7"
45
+ },
46
+ "devDependencies": {
47
+ "@biomejs/biome": "^2.3.7",
48
+ "@rbxts/compiler-types": "3.0.0-types.0",
49
+ "@rbxts/types": "^1.0.891",
50
+ "roblox-ts": "3.0.0",
51
+ "typescript": "^5.9.3"
53
52
  }
54
53
  }