@rbxts/app-forge 0.4.5 → 0.4.6

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.
@@ -1,2 +1,3 @@
1
+ import "@rbxts/vide";
1
2
  import type Types from "./types";
2
- export declare function AppContainer(props: Types.NameProps & Types.MainProps): JSX.Element;
3
+ export default function AppContainer(props: Types.NameProps & Types.MainProps): void;
@@ -1,15 +1,15 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
+ TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
3
4
  -- Services
4
5
  local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
5
6
  -- Packages
6
- local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
7
- local React = _react
8
- local useBinding = _react.useBinding
7
+ local source = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).source
9
8
  -- Types
10
9
  -- Components
11
10
  local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
12
- local function createBinding(name, manager)
11
+ -- Utility
12
+ local function createSource(name, manager)
13
13
  local _name = name
14
14
  local app = AppRegistry[_name]
15
15
  if not app then
@@ -19,11 +19,11 @@ local function createBinding(name, manager)
19
19
  if _condition == nil then
20
20
  _condition = false
21
21
  end
22
- local binding = { useBinding(_condition) }
23
- local _binds = manager.binds
22
+ local appSource = source(_condition)
23
+ local _sources = manager.sources
24
24
  local _name_1 = name
25
- _binds[_name_1] = binding
26
- return unpack(binding)
25
+ _sources[_name_1] = appSource
26
+ return source
27
27
  end
28
28
  local function createInstance(props)
29
29
  local _binding = props
@@ -38,13 +38,8 @@ local function createInstance(props)
38
38
  end
39
39
  if not (forge.loaded[name] ~= nil) then
40
40
  local instance = appClass.constructor.new(props)
41
- local Render = function()
42
- return instance:render()
43
- end
44
41
  local _loaded = forge.loaded
45
- local _arg1 = React.createElement(Render, {
46
- key = "Main",
47
- })
42
+ local _arg1 = instance:render()
48
43
  _loaded[name] = _arg1
49
44
  end
50
45
  return forge.loaded[name]
@@ -56,25 +51,26 @@ local function AppContainer(props)
56
51
  if not (name ~= "" and name) then
57
52
  error("App name is required in AppContainer")
58
53
  end
59
- createBinding(name, forge)
54
+ createSource(name, forge)
60
55
  local element = createInstance(props)
61
56
  if not element then
62
57
  error(`Failed to create instance for app "{name}"`)
63
58
  end
64
59
  if RunService:IsRunning() then
65
- return React.createElement("screengui", {
66
- key = name,
67
- ZIndexBehavior = "Sibling",
68
- ResetOnSpawn = false,
69
- }, element)
60
+ return nil
61
+ -- return (
62
+ -- <screengui key={name} ZIndexBehavior="Sibling" ResetOnSpawn={false}>
63
+ -- {element}
64
+ -- </screengui>
65
+ -- );
70
66
  else
71
- return React.createElement("frame", {
72
- key = name,
73
- BackgroundTransparency = 1,
74
- Size = UDim2.fromScale(1, 1),
75
- }, element)
67
+ -- return (
68
+ -- <frame key={name} BackgroundTransparency={1} Size={UDim2.fromScale(1, 1)}>
69
+ -- {element}
70
+ -- </frame>
71
+ -- );
76
72
  end
77
73
  end
78
74
  return {
79
- AppContainer = AppContainer,
75
+ default = AppContainer,
80
76
  }
@@ -1,4 +1,4 @@
1
- import React from "@rbxts/react";
1
+ import Vide from "@rbxts/vide";
2
2
  import type Types from "./types";
3
3
  import type AppForge from ".";
4
4
  export declare const AppRegistry: Map<string, Types.AppRegistry>;
@@ -7,8 +7,7 @@ export declare abstract class Args {
7
7
  readonly forge: AppForge;
8
8
  readonly props: Types.ClassProps;
9
9
  readonly name: AppNames[number];
10
- readonly bind: React.Binding<boolean>;
11
- readonly state: Boolean;
10
+ readonly source: Vide.Source<boolean>;
12
11
  constructor(props: Types.NameProps & Types.MainProps);
13
- abstract render(): JSX.Element;
12
+ abstract render(): Vide.Node;
14
13
  }
@@ -3,7 +3,7 @@ local TS = _G[script]
3
3
  -- Services
4
4
  local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
5
5
  -- Packages
6
- local usePx = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-react-hooks").out).usePx
6
+ local usePx = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-vide-utils").out).usePx
7
7
  -- Types
8
8
  local AppRegistry = {}
9
9
  local function App(props)
@@ -33,8 +33,8 @@ do
33
33
  if not (name ~= "" and name) then
34
34
  error("App name is required in Args constructor")
35
35
  end
36
- local bind = forge:getBind(name)
37
- if not bind and RunService:IsRunning() then
36
+ local source = forge:getSource(name)
37
+ if not source and RunService:IsRunning() then
38
38
  error("FAILED TO GET BIND FOR APP!")
39
39
  end
40
40
  local px = usePx(target)
@@ -44,8 +44,7 @@ do
44
44
  _object.px = px
45
45
  self.props = _object
46
46
  self.name = name
47
- self.bind = bind
48
- self.state = if self.bind then self.bind:getValue() else nil
47
+ self.source = source
49
48
  end
50
49
  end
51
50
  return {
package/out/helpers.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import Types from "./types";
2
- export declare function Render(props: Types.NameProps & Types.MainProps): JSX.Element | JSX.Element[];
2
+ export declare function Render(props: Types.NameProps & Types.MainProps): import("@rbxts/vide").Node;
package/out/index.d.ts CHANGED
@@ -1,20 +1,19 @@
1
- import React from "@rbxts/react";
1
+ import Vide from "@rbxts/vide";
2
2
  import type Types from "./types";
3
3
  import { Args, App } from "./decorator";
4
4
  export default class AppForge {
5
- binds: Map<string, [React.Binding<boolean>, (T: boolean) => void]>;
6
- loaded: Map<string, React.Element<any, string | React.JSXElementConstructor<any>>>;
5
+ sources: Map<string, Vide.Source<boolean>>;
6
+ loaded: Map<string, Vide.Node>;
7
7
  private rulesManager;
8
- getBind(name: AppNames[number]): React.Binding<boolean> | undefined;
9
- getState(name: AppNames[number]): boolean | undefined;
8
+ getSource(name: AppNames[number]): Vide.Source<boolean>;
10
9
  set(name: AppNames[number], value: boolean): void;
11
10
  open(name: AppNames[number]): void;
12
11
  close(name: AppNames[number]): void;
13
12
  toggle(name: AppNames[number]): void;
14
- renderApp(props: Types.NameProps & Types.MainProps): JSX.Element;
15
- renderApps(props: Types.NameProps & Types.MainProps): JSX.Element[];
16
- renderAll(props: Types.MainProps): JSX.Element[];
13
+ renderApp(props: Types.NameProps & Types.MainProps): Vide.Node;
14
+ renderApps(props: Types.NameProps & Types.MainProps): Vide.Node[];
15
+ renderAll(props: Types.MainProps): Vide.Node[];
17
16
  }
18
17
  export { App, Args };
19
18
  export { Render } from "./helpers";
20
- export type { MainProps, NameProps, Props } from "./types";
19
+ export type { NameProps, MainProps, ClassProps } from "./types";
package/out/init.luau CHANGED
@@ -2,16 +2,15 @@
2
2
  local TS = _G[script]
3
3
  local exports = {}
4
4
  -- Services
5
- local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
6
5
  -- Packages
7
- local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
6
+ local Vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
8
7
  -- Types
9
8
  -- Components
10
9
  local _decorator = TS.import(script, script, "decorator")
11
10
  local AppRegistry = _decorator.AppRegistry
12
11
  local Args = _decorator.Args
13
12
  local App = _decorator.App
14
- local AppContainer = TS.import(script, script, "container").AppContainer
13
+ local AppContainer = TS.import(script, script, "container").default
15
14
  -- Classes
16
15
  local RulesManager = TS.import(script, script, "rules").default
17
16
  local AppForge
@@ -27,49 +26,31 @@ do
27
26
  return self:constructor(...) or self
28
27
  end
29
28
  function AppForge:constructor()
30
- self.binds = {}
29
+ self.sources = {}
31
30
  self.loaded = {}
32
31
  self.rulesManager = RulesManager.new(self)
33
32
  end
34
- function AppForge:getBind(name)
35
- local _condition = not RunService:IsRunning()
36
- if _condition then
37
- local _binds = self.binds
38
- local _name = name
39
- _condition = not (_binds[_name] ~= nil)
40
- end
41
- if _condition then
42
- return nil
43
- end
44
- local _binds = self.binds
33
+ function AppForge:getSource(name)
34
+ local _sources = self.sources
45
35
  local _name = name
46
- if not (_binds[_name] ~= nil) then
47
- error(`App "{name}" has no binding`)
36
+ if not (_sources[_name] ~= nil) then
37
+ error(`App "{name}" has no source`)
48
38
  end
49
- local _binds_1 = self.binds
39
+ local _sources_1 = self.sources
50
40
  local _name_1 = name
51
- return _binds_1[_name_1][1]
52
- end
53
- function AppForge:getState(name)
54
- local _result = self:getBind(name)
55
- if _result ~= nil then
56
- _result = _result:getValue()
57
- end
58
- return _result
41
+ return _sources_1[_name_1]
59
42
  end
60
43
  function AppForge:set(name, value)
61
44
  if not self.rulesManager:applyRules(name, value) then
62
45
  return nil
63
46
  end
64
- local _binds = self.binds
47
+ local _sources = self.sources
65
48
  local _name = name
66
- local _binding = _binds[_name]
67
- local _ = _binding[1]
68
- local setBinding = _binding[2]
69
- if not setBinding then
70
- error(`App "{name}" has no binding setter`)
49
+ local source = _sources[_name]
50
+ if not source then
51
+ error(`App "{name}" has no source`)
71
52
  end
72
- setBinding(value)
53
+ source(value)
73
54
  end
74
55
  function AppForge:open(name)
75
56
  self:set(name, true)
@@ -78,12 +59,12 @@ do
78
59
  self:set(name, false)
79
60
  end
80
61
  function AppForge:toggle(name)
81
- self:set(name, not self:getState(name))
62
+ self:set(name, not self:getSource(name)())
82
63
  end
83
64
  function AppForge:renderApp(props)
84
65
  local _attributes = table.clone(props)
85
66
  setmetatable(_attributes, nil)
86
- return React.createElement(AppContainer, _attributes)
67
+ return Vide.jsx(AppContainer, _attributes)
87
68
  end
88
69
  function AppForge:renderApps(props)
89
70
  local names = props.names
package/out/rules.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import AppManager from ".";
1
+ import type AppForge from ".";
2
2
  export default class RulesManager {
3
3
  private appManager;
4
- constructor(appManager: AppManager);
4
+ constructor(appManager: AppForge);
5
5
  applyRules(name: AppNames[number], value: boolean): boolean;
6
6
  private inSameGroup;
7
7
  private blockedBy;
package/out/rules.luau CHANGED
@@ -78,7 +78,7 @@ do
78
78
  if _result_2 then
79
79
  return nil
80
80
  end
81
- if self.appManager:getState(n) then
81
+ if self.appManager:getSource(n)() then
82
82
  self.appManager:set(n, false)
83
83
  end
84
84
  end
@@ -154,7 +154,7 @@ do
154
154
  if self:inSameGroup(name, blocker) or not (blocker ~= "" and blocker) then
155
155
  continue
156
156
  end
157
- if self.appManager:getState(blocker) then
157
+ if self.appManager:getSource(blocker)() then
158
158
  return false
159
159
  end
160
160
  end
@@ -167,7 +167,7 @@ do
167
167
  if self:inSameGroup(name, b) or not (b ~= "" and b) then
168
168
  continue
169
169
  end
170
- if self.appManager:getState(b) then
170
+ if self.appManager:getSource(b)() then
171
171
  self.appManager:set(b, false)
172
172
  end
173
173
  end
@@ -182,7 +182,7 @@ do
182
182
  if self:inSameGroup(name, other) then
183
183
  continue
184
184
  end
185
- if self.appManager:getState(other) then
185
+ if self.appManager:getSource(other)() then
186
186
  self.appManager:set(other, false)
187
187
  end
188
188
  end
package/out/types.d.ts CHANGED
@@ -20,7 +20,7 @@ declare namespace Types {
20
20
  };
21
21
 
22
22
  type ClassProps = AppProps & {
23
- px: ReturnType<typeof import("@rbxts/loners-pretty-react-hooks").usePx>;
23
+ px: ReturnType<typeof import("@rbxts/loners-pretty-vide-utils").usePx>;
24
24
  };
25
25
 
26
26
  type AppRegistry = {
@@ -46,8 +46,8 @@ declare namespace Types {
46
46
  }
47
47
  }
48
48
 
49
- export type MainProps = Types.MainProps;
50
49
  export type NameProps = Types.NameProps;
51
- export type Props = Types.ClassProps;
50
+ export type MainProps = Types.MainProps;
51
+ export type ClassProps = Types.ClassProps;
52
52
 
53
53
  export default Types;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/app-forge",
3
- "version": "0.4.5",
3
+ "version": "0.4.6",
4
4
  "description": "An App Manager for react",
5
5
  "main": "out/init.lua",
6
6
  "packageManager": "bun@1.3.1",
@@ -35,26 +35,18 @@
35
35
  "devDependencies": {
36
36
  "@biomejs/biome": "^2.3.7",
37
37
  "@rbxts/compiler-types": "3.0.0-types.0",
38
- "@rbxts/react": "17.3.0-alpha.1",
39
- "@rbxts/react-roblox": "17.3.0-alpha.1",
40
38
  "@rbxts/types": "^1.0.891",
41
- "@typescript-eslint/eslint-plugin": "^8.46.4",
42
- "@typescript-eslint/parser": "^8.46.4",
43
39
  "roblox-ts": "3.0.0",
44
40
  "typescript": "^5.9.3"
45
41
  },
46
42
  "dependencies": {
47
- "@rbxts/charm": "^0.10.0",
48
- "@rbxts/loners-pretty-react-hooks": "^0.2.9",
49
- "@rbxts/react-charm": "^0.3.0",
50
43
  "@rbxts/ripple": "^0.9.3",
51
44
  "@rbxts/services": "^1.6.0",
52
45
  "@rbxts/set-timeout": "^1.1.2"
53
46
  },
54
47
  "peerDependencies": {
55
- "@rbxts/loners-pretty-react-hooks": "*",
56
- "@rbxts/react-roblox": "*",
57
- "@rbxts/react": "*",
58
- "@rbxts/charm": "*"
48
+ "@rbxts/loners-pretty-vide-utils": "^0.0.6",
49
+ "@rbxts/object-utils": "^1.0.4",
50
+ "@rbxts/vide": "^0.5.7"
59
51
  }
60
52
  }