@rbxts/app-forge 0.4.4 → 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.
- package/out/container.d.ts +2 -1
- package/out/container.luau +22 -25
- package/out/decorator.d.ts +3 -3
- package/out/decorator.luau +5 -8
- package/out/helpers.d.ts +1 -1
- package/out/index.d.ts +8 -10
- package/out/init.luau +17 -29
- package/out/rules.d.ts +2 -2
- package/out/rules.luau +4 -4
- package/out/types.d.ts +3 -3
- package/package.json +4 -12
package/out/container.d.ts
CHANGED
package/out/container.luau
CHANGED
|
@@ -1,14 +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
|
|
7
|
-
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
|
+
local source = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).source
|
|
8
8
|
-- Types
|
|
9
9
|
-- Components
|
|
10
10
|
local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
|
|
11
|
-
|
|
11
|
+
-- Utility
|
|
12
|
+
local function createSource(name, manager)
|
|
12
13
|
local _name = name
|
|
13
14
|
local app = AppRegistry[_name]
|
|
14
15
|
if not app then
|
|
@@ -18,11 +19,11 @@ local function createBinding(name, manager)
|
|
|
18
19
|
if _condition == nil then
|
|
19
20
|
_condition = false
|
|
20
21
|
end
|
|
21
|
-
local
|
|
22
|
-
local
|
|
22
|
+
local appSource = source(_condition)
|
|
23
|
+
local _sources = manager.sources
|
|
23
24
|
local _name_1 = name
|
|
24
|
-
|
|
25
|
-
return
|
|
25
|
+
_sources[_name_1] = appSource
|
|
26
|
+
return source
|
|
26
27
|
end
|
|
27
28
|
local function createInstance(props)
|
|
28
29
|
local _binding = props
|
|
@@ -37,13 +38,8 @@ local function createInstance(props)
|
|
|
37
38
|
end
|
|
38
39
|
if not (forge.loaded[name] ~= nil) then
|
|
39
40
|
local instance = appClass.constructor.new(props)
|
|
40
|
-
local Render = function()
|
|
41
|
-
return instance:render()
|
|
42
|
-
end
|
|
43
41
|
local _loaded = forge.loaded
|
|
44
|
-
local _arg1 =
|
|
45
|
-
key = "Main",
|
|
46
|
-
})
|
|
42
|
+
local _arg1 = instance:render()
|
|
47
43
|
_loaded[name] = _arg1
|
|
48
44
|
end
|
|
49
45
|
return forge.loaded[name]
|
|
@@ -55,25 +51,26 @@ local function AppContainer(props)
|
|
|
55
51
|
if not (name ~= "" and name) then
|
|
56
52
|
error("App name is required in AppContainer")
|
|
57
53
|
end
|
|
58
|
-
|
|
54
|
+
createSource(name, forge)
|
|
59
55
|
local element = createInstance(props)
|
|
60
56
|
if not element then
|
|
61
57
|
error(`Failed to create instance for app "{name}"`)
|
|
62
58
|
end
|
|
63
59
|
if RunService:IsRunning() then
|
|
64
|
-
return
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
60
|
+
return nil
|
|
61
|
+
-- return (
|
|
62
|
+
-- <screengui key={name} ZIndexBehavior="Sibling" ResetOnSpawn={false}>
|
|
63
|
+
-- {element}
|
|
64
|
+
-- </screengui>
|
|
65
|
+
-- );
|
|
69
66
|
else
|
|
70
|
-
return
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
-- return (
|
|
68
|
+
-- <frame key={name} BackgroundTransparency={1} Size={UDim2.fromScale(1, 1)}>
|
|
69
|
+
-- {element}
|
|
70
|
+
-- </frame>
|
|
71
|
+
-- );
|
|
75
72
|
end
|
|
76
73
|
end
|
|
77
74
|
return {
|
|
78
|
-
|
|
75
|
+
default = AppContainer,
|
|
79
76
|
}
|
package/out/decorator.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
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,7 +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
|
|
10
|
+
readonly source: Vide.Source<boolean>;
|
|
11
11
|
constructor(props: Types.NameProps & Types.MainProps);
|
|
12
|
-
abstract render():
|
|
12
|
+
abstract render(): Vide.Node;
|
|
13
13
|
}
|
package/out/decorator.luau
CHANGED
|
@@ -3,8 +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-
|
|
7
|
-
local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "react-charm")).useAtom
|
|
6
|
+
local usePx = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-vide-utils").out).usePx
|
|
8
7
|
-- Types
|
|
9
8
|
local AppRegistry = {}
|
|
10
9
|
local function App(props)
|
|
@@ -34,9 +33,9 @@ do
|
|
|
34
33
|
if not (name ~= "" and name) then
|
|
35
34
|
error("App name is required in Args constructor")
|
|
36
35
|
end
|
|
37
|
-
local
|
|
38
|
-
if not
|
|
39
|
-
error("FAILED TO GET
|
|
36
|
+
local source = forge:getSource(name)
|
|
37
|
+
if not source and RunService:IsRunning() then
|
|
38
|
+
error("FAILED TO GET BIND FOR APP!")
|
|
40
39
|
end
|
|
41
40
|
local px = usePx(target)
|
|
42
41
|
self.forge = forge
|
|
@@ -45,9 +44,7 @@ do
|
|
|
45
44
|
_object.px = px
|
|
46
45
|
self.props = _object
|
|
47
46
|
self.name = name
|
|
48
|
-
self.
|
|
49
|
-
return atom
|
|
50
|
-
end)
|
|
47
|
+
self.source = source
|
|
51
48
|
end
|
|
52
49
|
end
|
|
53
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):
|
|
2
|
+
export declare function Render(props: Types.NameProps & Types.MainProps): import("@rbxts/vide").Node;
|
package/out/index.d.ts
CHANGED
|
@@ -1,21 +1,19 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { Atom } from "@rbxts/charm";
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
3
2
|
import type Types from "./types";
|
|
4
3
|
import { Args, App } from "./decorator";
|
|
5
4
|
export default class AppForge {
|
|
6
|
-
|
|
7
|
-
loaded: Map<string,
|
|
5
|
+
sources: Map<string, Vide.Source<boolean>>;
|
|
6
|
+
loaded: Map<string, Vide.Node>;
|
|
8
7
|
private rulesManager;
|
|
9
|
-
|
|
10
|
-
getState(name: AppNames[number]): Atom<boolean>;
|
|
8
|
+
getSource(name: AppNames[number]): Vide.Source<boolean>;
|
|
11
9
|
set(name: AppNames[number], value: boolean): void;
|
|
12
10
|
open(name: AppNames[number]): void;
|
|
13
11
|
close(name: AppNames[number]): void;
|
|
14
12
|
toggle(name: AppNames[number]): void;
|
|
15
|
-
renderApp(props: Types.NameProps & Types.MainProps):
|
|
16
|
-
renderApps(props: Types.NameProps & Types.MainProps):
|
|
17
|
-
renderAll(props: Types.MainProps):
|
|
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[];
|
|
18
16
|
}
|
|
19
17
|
export { App, Args };
|
|
20
18
|
export { Render } from "./helpers";
|
|
21
|
-
export type {
|
|
19
|
+
export type { NameProps, MainProps, ClassProps } from "./types";
|
package/out/init.luau
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local exports = {}
|
|
4
|
+
-- Services
|
|
4
5
|
-- Packages
|
|
5
|
-
local
|
|
6
|
+
local Vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
6
7
|
-- Types
|
|
7
8
|
-- Components
|
|
8
9
|
local _decorator = TS.import(script, script, "decorator")
|
|
9
10
|
local AppRegistry = _decorator.AppRegistry
|
|
10
11
|
local Args = _decorator.Args
|
|
11
12
|
local App = _decorator.App
|
|
12
|
-
local AppContainer = TS.import(script, script, "container").
|
|
13
|
+
local AppContainer = TS.import(script, script, "container").default
|
|
13
14
|
-- Classes
|
|
14
15
|
local RulesManager = TS.import(script, script, "rules").default
|
|
15
|
-
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
16
16
|
local AppForge
|
|
17
17
|
do
|
|
18
18
|
AppForge = setmetatable({}, {
|
|
@@ -26,43 +26,31 @@ do
|
|
|
26
26
|
return self:constructor(...) or self
|
|
27
27
|
end
|
|
28
28
|
function AppForge:constructor()
|
|
29
|
-
self.
|
|
29
|
+
self.sources = {}
|
|
30
30
|
self.loaded = {}
|
|
31
31
|
self.rulesManager = RulesManager.new(self)
|
|
32
32
|
end
|
|
33
|
-
function AppForge:
|
|
34
|
-
local
|
|
35
|
-
if _condition then
|
|
36
|
-
local _atoms = self.atoms
|
|
37
|
-
local _name = name
|
|
38
|
-
_condition = not (_atoms[_name] ~= nil)
|
|
39
|
-
end
|
|
40
|
-
if _condition then
|
|
41
|
-
return nil
|
|
42
|
-
end
|
|
43
|
-
local _atoms = self.atoms
|
|
33
|
+
function AppForge:getSource(name)
|
|
34
|
+
local _sources = self.sources
|
|
44
35
|
local _name = name
|
|
45
|
-
if not (
|
|
46
|
-
error(`App "{name}" has no
|
|
36
|
+
if not (_sources[_name] ~= nil) then
|
|
37
|
+
error(`App "{name}" has no source`)
|
|
47
38
|
end
|
|
48
|
-
local
|
|
39
|
+
local _sources_1 = self.sources
|
|
49
40
|
local _name_1 = name
|
|
50
|
-
return
|
|
51
|
-
end
|
|
52
|
-
function AppForge:getState(name)
|
|
53
|
-
return self:getAtom(name)
|
|
41
|
+
return _sources_1[_name_1]
|
|
54
42
|
end
|
|
55
43
|
function AppForge:set(name, value)
|
|
56
44
|
if not self.rulesManager:applyRules(name, value) then
|
|
57
45
|
return nil
|
|
58
46
|
end
|
|
59
|
-
local
|
|
47
|
+
local _sources = self.sources
|
|
60
48
|
local _name = name
|
|
61
|
-
local
|
|
62
|
-
if not
|
|
63
|
-
error(`App "{name}" has no
|
|
49
|
+
local source = _sources[_name]
|
|
50
|
+
if not source then
|
|
51
|
+
error(`App "{name}" has no source`)
|
|
64
52
|
end
|
|
65
|
-
|
|
53
|
+
source(value)
|
|
66
54
|
end
|
|
67
55
|
function AppForge:open(name)
|
|
68
56
|
self:set(name, true)
|
|
@@ -71,12 +59,12 @@ do
|
|
|
71
59
|
self:set(name, false)
|
|
72
60
|
end
|
|
73
61
|
function AppForge:toggle(name)
|
|
74
|
-
self:set(name, not self:
|
|
62
|
+
self:set(name, not self:getSource(name)())
|
|
75
63
|
end
|
|
76
64
|
function AppForge:renderApp(props)
|
|
77
65
|
local _attributes = table.clone(props)
|
|
78
66
|
setmetatable(_attributes, nil)
|
|
79
|
-
return
|
|
67
|
+
return Vide.jsx(AppContainer, _attributes)
|
|
80
68
|
end
|
|
81
69
|
function AppForge:renderApps(props)
|
|
82
70
|
local names = props.names
|
package/out/rules.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type AppForge from ".";
|
|
2
2
|
export default class RulesManager {
|
|
3
3
|
private appManager;
|
|
4
|
-
constructor(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:
|
|
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:
|
|
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:
|
|
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:
|
|
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-
|
|
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
|
|
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.
|
|
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-
|
|
56
|
-
"@rbxts/
|
|
57
|
-
"@rbxts/
|
|
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
|
}
|