@rbxts/app-forge 0.4.5 → 0.4.7
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 -26
- package/out/decorator.d.ts +3 -4
- package/out/decorator.luau +4 -5
- package/out/helpers.d.ts +1 -1
- package/out/index.d.ts +9 -10
- package/out/init.luau +24 -35
- package/out/rules.d.ts +4 -3
- package/out/rules.luau +7 -5
- package/out/types.d.ts +3 -3
- package/package.json +4 -12
package/out/container.d.ts
CHANGED
package/out/container.luau
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
23
|
-
local
|
|
22
|
+
local appSource = source(_condition)
|
|
23
|
+
local _sources = manager.sources
|
|
24
24
|
local _name_1 = name
|
|
25
|
-
|
|
26
|
-
return
|
|
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 =
|
|
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
|
-
|
|
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
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
return nil
|
|
61
|
+
-- return (
|
|
62
|
+
-- <screengui key={name} ZIndexBehavior="Sibling" ResetOnSpawn={false}>
|
|
63
|
+
-- {element}
|
|
64
|
+
-- </screengui>
|
|
65
|
+
-- );
|
|
70
66
|
else
|
|
71
|
-
return
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
75
|
+
default = AppContainer,
|
|
80
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,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
|
|
11
|
-
readonly state: Boolean;
|
|
10
|
+
readonly source: Vide.Source<boolean>;
|
|
12
11
|
constructor(props: Types.NameProps & Types.MainProps);
|
|
13
|
-
abstract render():
|
|
12
|
+
abstract render(): Vide.Node;
|
|
14
13
|
}
|
package/out/decorator.luau
CHANGED
|
@@ -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-
|
|
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
|
|
37
|
-
if not
|
|
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.
|
|
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):
|
|
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
|
|
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
|
-
|
|
6
|
-
loaded: Map<string,
|
|
5
|
+
sources: Map<string, Vide.Source<boolean>>;
|
|
6
|
+
loaded: Map<string, Vide.Node>;
|
|
7
7
|
private rulesManager;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
set(name: AppNames[number], value: boolean): void;
|
|
8
|
+
getSource(name: AppNames[number]): Vide.Source<boolean>;
|
|
9
|
+
set(name: AppNames[number], value: Vide.Source<boolean> | 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):
|
|
15
|
-
renderApps(props: Types.NameProps & Types.MainProps):
|
|
16
|
-
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[];
|
|
17
16
|
}
|
|
18
17
|
export { App, Args };
|
|
19
18
|
export { Render } from "./helpers";
|
|
20
|
-
export type {
|
|
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
|
|
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").
|
|
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,39 @@ do
|
|
|
27
26
|
return self:constructor(...) or self
|
|
28
27
|
end
|
|
29
28
|
function AppForge:constructor()
|
|
30
|
-
self.
|
|
29
|
+
self.sources = {}
|
|
31
30
|
self.loaded = {}
|
|
32
31
|
self.rulesManager = RulesManager.new(self)
|
|
33
32
|
end
|
|
34
|
-
function AppForge:
|
|
35
|
-
local
|
|
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 (
|
|
47
|
-
error(`App "{name}" has no
|
|
36
|
+
if not (_sources[_name] ~= nil) then
|
|
37
|
+
error(`App "{name}" has no source`)
|
|
48
38
|
end
|
|
49
|
-
local
|
|
39
|
+
local _sources_1 = self.sources
|
|
50
40
|
local _name_1 = name
|
|
51
|
-
return
|
|
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
|
|
47
|
+
local _sources = self.sources
|
|
65
48
|
local _name = name
|
|
66
|
-
local
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
49
|
+
local source = _sources[_name]
|
|
50
|
+
if not source then
|
|
51
|
+
error(`App "{name}" has no source`)
|
|
52
|
+
end
|
|
53
|
+
local _value = value
|
|
54
|
+
if type(_value) == "function" then
|
|
55
|
+
local _sources_1 = self.sources
|
|
56
|
+
local _name_1 = name
|
|
57
|
+
local _value_1 = value
|
|
58
|
+
_sources_1[_name_1] = _value_1
|
|
59
|
+
else
|
|
60
|
+
source(value)
|
|
71
61
|
end
|
|
72
|
-
setBinding(value)
|
|
73
62
|
end
|
|
74
63
|
function AppForge:open(name)
|
|
75
64
|
self:set(name, true)
|
|
@@ -78,12 +67,12 @@ do
|
|
|
78
67
|
self:set(name, false)
|
|
79
68
|
end
|
|
80
69
|
function AppForge:toggle(name)
|
|
81
|
-
self:set(name, not self:
|
|
70
|
+
self:set(name, not self:getSource(name)())
|
|
82
71
|
end
|
|
83
72
|
function AppForge:renderApp(props)
|
|
84
73
|
local _attributes = table.clone(props)
|
|
85
74
|
setmetatable(_attributes, nil)
|
|
86
|
-
return
|
|
75
|
+
return Vide.jsx(AppContainer, _attributes)
|
|
87
76
|
end
|
|
88
77
|
function AppForge:renderApps(props)
|
|
89
78
|
local names = props.names
|
package/out/rules.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
2
|
+
import type AppForge from ".";
|
|
2
3
|
export default class RulesManager {
|
|
3
4
|
private appManager;
|
|
4
|
-
constructor(appManager:
|
|
5
|
-
applyRules(name: AppNames[number],
|
|
5
|
+
constructor(appManager: AppForge);
|
|
6
|
+
applyRules(name: AppNames[number], source: Vide.Source<boolean> | boolean): boolean;
|
|
6
7
|
private inSameGroup;
|
|
7
8
|
private blockedBy;
|
|
8
9
|
private blocks;
|
package/out/rules.luau
CHANGED
|
@@ -30,7 +30,7 @@ do
|
|
|
30
30
|
function RulesManager:constructor(appManager)
|
|
31
31
|
self.appManager = appManager
|
|
32
32
|
end
|
|
33
|
-
function RulesManager:applyRules(name,
|
|
33
|
+
function RulesManager:applyRules(name, source)
|
|
34
34
|
local _name = name
|
|
35
35
|
local appData = AppRegistry[_name]
|
|
36
36
|
local _rules = appData
|
|
@@ -38,6 +38,8 @@ do
|
|
|
38
38
|
_rules = _rules.rules
|
|
39
39
|
end
|
|
40
40
|
local rules = _rules
|
|
41
|
+
local _source = source
|
|
42
|
+
local value = if type(_source) == "function" then source() else source
|
|
41
43
|
local _result = rules
|
|
42
44
|
if _result ~= nil then
|
|
43
45
|
_result = _result.groups
|
|
@@ -78,7 +80,7 @@ do
|
|
|
78
80
|
if _result_2 then
|
|
79
81
|
return nil
|
|
80
82
|
end
|
|
81
|
-
if self.appManager:
|
|
83
|
+
if self.appManager:getSource(n)() then
|
|
82
84
|
self.appManager:set(n, false)
|
|
83
85
|
end
|
|
84
86
|
end
|
|
@@ -154,7 +156,7 @@ do
|
|
|
154
156
|
if self:inSameGroup(name, blocker) or not (blocker ~= "" and blocker) then
|
|
155
157
|
continue
|
|
156
158
|
end
|
|
157
|
-
if self.appManager:
|
|
159
|
+
if self.appManager:getSource(blocker)() then
|
|
158
160
|
return false
|
|
159
161
|
end
|
|
160
162
|
end
|
|
@@ -167,7 +169,7 @@ do
|
|
|
167
169
|
if self:inSameGroup(name, b) or not (b ~= "" and b) then
|
|
168
170
|
continue
|
|
169
171
|
end
|
|
170
|
-
if self.appManager:
|
|
172
|
+
if self.appManager:getSource(b)() then
|
|
171
173
|
self.appManager:set(b, false)
|
|
172
174
|
end
|
|
173
175
|
end
|
|
@@ -182,7 +184,7 @@ do
|
|
|
182
184
|
if self:inSameGroup(name, other) then
|
|
183
185
|
continue
|
|
184
186
|
end
|
|
185
|
-
if self.appManager:
|
|
187
|
+
if self.appManager:getSource(other)() then
|
|
186
188
|
self.appManager:set(other, false)
|
|
187
189
|
end
|
|
188
190
|
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.7",
|
|
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
|
}
|