@rbxts/forge 0.0.5
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/LICENSE.md +9 -0
- package/README.md +146 -0
- package/out/appRegistry.d.ts +21 -0
- package/out/appRegistry.luau +97 -0
- package/out/context.d.ts +7 -0
- package/out/context.luau +12 -0
- package/out/forge.d.ts +22 -0
- package/out/forge.luau +209 -0
- package/out/global.d.ts +8 -0
- package/out/helpers/bindAppSource.d.ts +2 -0
- package/out/helpers/bindAppSource.luau +22 -0
- package/out/helpers/getAppEntry.d.ts +1 -0
- package/out/helpers/getAppEntry.luau +21 -0
- package/out/helpers/getAppSource.d.ts +1 -0
- package/out/helpers/getAppSource.luau +21 -0
- package/out/helpers/hasAppSource.d.ts +1 -0
- package/out/helpers/hasAppSource.luau +24 -0
- package/out/helpers/setAppSource.d.ts +1 -0
- package/out/helpers/setAppSource.luau +34 -0
- package/out/hooks/useAppContext.d.ts +5 -0
- package/out/hooks/useAppContext.luau +14 -0
- package/out/hooks/useEventListener.d.ts +22 -0
- package/out/hooks/useEventListener.luau +64 -0
- package/out/hooks/usePx.d.ts +11 -0
- package/out/hooks/usePx.luau +93 -0
- package/out/index.d.ts +5 -0
- package/out/init.luau +13 -0
- package/out/renders.d.ts +18 -0
- package/out/renders.luau +310 -0
- package/out/ruleEngine/check/exclusiveGroup.d.ts +2 -0
- package/out/ruleEngine/check/exclusiveGroup.luau +49 -0
- package/out/ruleEngine/check/parent.d.ts +2 -0
- package/out/ruleEngine/check/parent.luau +37 -0
- package/out/ruleEngine/index.d.ts +7 -0
- package/out/ruleEngine/init.luau +73 -0
- package/out/ruleEngine/render/anchor.d.ts +2 -0
- package/out/ruleEngine/render/anchor.luau +11 -0
- package/out/types.d.ts +96 -0
- package/package.json +52 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Littensy
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# AppForge
|
|
2
|
+
|
|
3
|
+
**⚠️ SOME OF THIS MIGHT BE OUTDATED! ⚠️**
|
|
4
|
+
|
|
5
|
+
> ⚠️ **Documentation Notice**
|
|
6
|
+
> Written with AI assistance. Please report any issues in [GitHub Issues](https://github.com/Loner1536/AppForge/issues) or on Discord: `@loner71x`.
|
|
7
|
+
|
|
8
|
+
**AppForge** is a **declarative UI application manager** for [Vide](https://github.com/centau/vide) in **roblox-ts**. It allows you to structure, mount, and control UI “apps” with centralized visibility, parent-child relationships, exclusive groups, and ZIndex rules — without tangled state.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ✨ Features
|
|
13
|
+
|
|
14
|
+
- **App-based UI architecture**: self-contained UI units
|
|
15
|
+
- **Centralized visibility** per app
|
|
16
|
+
- **Rules system**: parent/child, exclusive groups, ZIndex
|
|
17
|
+
- **Render groups** for selective mounting
|
|
18
|
+
- **Fully typed with roblox-ts**
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## 📦 Installation
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npm install @rbxts/app-forge
|
|
26
|
+
npm install @rbxts/vide
|
|
27
|
+
|
|
28
|
+
Or using Bun:
|
|
29
|
+
|
|
30
|
+
bun add @rbxts/app-forge
|
|
31
|
+
bun add @rbxts/vide
|
|
32
|
+
|
|
33
|
+
🧠 Core Concepts
|
|
34
|
+
App
|
|
35
|
+
|
|
36
|
+
An App is a self-contained UI unit:
|
|
37
|
+
|
|
38
|
+
Owns its visibility source
|
|
39
|
+
|
|
40
|
+
Renders a Vide tree
|
|
41
|
+
|
|
42
|
+
Can have rules: parent/child, exclusive groups, ZIndex
|
|
43
|
+
|
|
44
|
+
Apps are defined using the @App decorator and must extend Args.
|
|
45
|
+
Forge
|
|
46
|
+
|
|
47
|
+
AppForge is the runtime manager:
|
|
48
|
+
|
|
49
|
+
Holds all visibility sources
|
|
50
|
+
|
|
51
|
+
Mounts/unmounts apps in the UI
|
|
52
|
+
|
|
53
|
+
Applies rules automatically
|
|
54
|
+
|
|
55
|
+
Exposes imperative helpers: open, close, toggle
|
|
56
|
+
|
|
57
|
+
One Forge ONLY is VERY recommended.
|
|
58
|
+
Rules
|
|
59
|
+
parent Child app closes automatically when parent closes
|
|
60
|
+
parentGroup Leave Empty if target Tree doesnt have one
|
|
61
|
+
attach anchors child tree to parent
|
|
62
|
+
|
|
63
|
+
exclusiveGroup Only one app in the group may be open
|
|
64
|
+
index Sets ZIndex of the app tree
|
|
65
|
+
|
|
66
|
+
Rules are reactively enforced when visibility changes.
|
|
67
|
+
Render Groups
|
|
68
|
+
|
|
69
|
+
Render groups let you mount selective apps:
|
|
70
|
+
|
|
71
|
+
Example: Lobby UI vs In-Game UI
|
|
72
|
+
|
|
73
|
+
Example: HUD vs Menus
|
|
74
|
+
|
|
75
|
+
Apps can be rendered by group, name, or multiple names using the Forge’s internal rendering methods.
|
|
76
|
+
🧩 Basic Usage
|
|
77
|
+
Creating a Forge
|
|
78
|
+
|
|
79
|
+
import { CreateForge } from "@rbxts/app-forge";
|
|
80
|
+
|
|
81
|
+
const forge = new CreateForge();
|
|
82
|
+
|
|
83
|
+
Mounting to the PlayerGui
|
|
84
|
+
|
|
85
|
+
forge.mount(
|
|
86
|
+
<screengui
|
|
87
|
+
Name="AppRoot"
|
|
88
|
+
ZIndexBehavior="Sibling"
|
|
89
|
+
ResetOnSpawn={false}
|
|
90
|
+
/>,
|
|
91
|
+
{ props: {}, forge },
|
|
92
|
+
Players.LocalPlayer.WaitForChild("PlayerGui")
|
|
93
|
+
);
|
|
94
|
+
|
|
95
|
+
⚠️ Note: You pass the root node directly, not a function.
|
|
96
|
+
|
|
97
|
+
Controlling Apps
|
|
98
|
+
|
|
99
|
+
forge.open("Inventory");
|
|
100
|
+
forge.close("Inventory");
|
|
101
|
+
forge.toggle("Inventory");
|
|
102
|
+
|
|
103
|
+
open(name): Shows the app
|
|
104
|
+
|
|
105
|
+
close(name): Hides the app
|
|
106
|
+
|
|
107
|
+
toggle(name): Toggles visibility
|
|
108
|
+
|
|
109
|
+
Defining an App
|
|
110
|
+
|
|
111
|
+
import { App, Args } from "@rbxts/app-forge";
|
|
112
|
+
|
|
113
|
+
@App({
|
|
114
|
+
name: "Inventory",
|
|
115
|
+
renderGroup: "Lobby",
|
|
116
|
+
visible: false,
|
|
117
|
+
rules: { zIndex: 2 },
|
|
118
|
+
})
|
|
119
|
+
export class Inventory extends Args {
|
|
120
|
+
render() {
|
|
121
|
+
const { px } = this.props; // px comes from the Forge
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<frame
|
|
125
|
+
BackgroundColor3={Color3.fromRGB(100, 100, 100)}
|
|
126
|
+
Size={() => UDim2.fromOffset(px(500), px(500))}
|
|
127
|
+
/>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
@App registers the app with the Forge
|
|
133
|
+
|
|
134
|
+
px provides scaling helpers automatically
|
|
135
|
+
|
|
136
|
+
rules define relationships
|
|
137
|
+
|
|
138
|
+
⚠️ Notes
|
|
139
|
+
|
|
140
|
+
Apps are singletons per Forge
|
|
141
|
+
|
|
142
|
+
API is alpha — may change
|
|
143
|
+
|
|
144
|
+
📜 License
|
|
145
|
+
|
|
146
|
+
MIT
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
export declare const AppRegistry: Map<string, Map<string, Types.AppRegistry.Static>>;
|
|
4
|
+
export declare const AppSources: Map<string, Map<string, Vide.Source<boolean>>>;
|
|
5
|
+
/**
|
|
6
|
+
* Registers a Vide App with AppForge.
|
|
7
|
+
*
|
|
8
|
+
* This runs at definition time and validates static configuration.
|
|
9
|
+
*/
|
|
10
|
+
export declare function App<N extends AppNames>(props: Types.AppRegistry.Props<N>): <T extends new (props: Types.Props.Main, name: AppNames, group?: AppGroups) => Args>(constructor: T) => T;
|
|
11
|
+
/**
|
|
12
|
+
* Base class for all AppForge Apps.
|
|
13
|
+
*/
|
|
14
|
+
export declare abstract class Args {
|
|
15
|
+
readonly props: Types.Props.Class;
|
|
16
|
+
readonly source: Vide.Source<boolean>;
|
|
17
|
+
readonly group: AppGroups;
|
|
18
|
+
readonly name: AppNames;
|
|
19
|
+
constructor(props: Types.Props.Main, name: AppNames, group?: AppGroups);
|
|
20
|
+
abstract render(): Vide.Node;
|
|
21
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
-- Types
|
|
5
|
+
-- Hooks
|
|
6
|
+
local px = TS.import(script, script.Parent, "hooks", "usePx").px
|
|
7
|
+
local AppRegistry = {}
|
|
8
|
+
local AppSources = {}
|
|
9
|
+
--[[
|
|
10
|
+
*
|
|
11
|
+
* Registers a Vide App with AppForge.
|
|
12
|
+
*
|
|
13
|
+
* This runs at definition time and validates static configuration.
|
|
14
|
+
|
|
15
|
+
]]
|
|
16
|
+
local function App(props)
|
|
17
|
+
return function(constructor)
|
|
18
|
+
local _name = props.name
|
|
19
|
+
local _result = AppRegistry[_name]
|
|
20
|
+
if _result ~= nil then
|
|
21
|
+
local _condition = props.group
|
|
22
|
+
if not (_condition ~= "" and _condition) then
|
|
23
|
+
_condition = "None"
|
|
24
|
+
end
|
|
25
|
+
_result = _result[_condition] ~= nil
|
|
26
|
+
end
|
|
27
|
+
if _result then
|
|
28
|
+
local _exp = props.name
|
|
29
|
+
local _condition = props.group
|
|
30
|
+
if not (_condition ~= "" and _condition) then
|
|
31
|
+
_condition = "None"
|
|
32
|
+
end
|
|
33
|
+
error(`Duplicate registered App name "{_exp} in same Group name {_condition}". ` .. `App names must be globally unique.`, 2)
|
|
34
|
+
end
|
|
35
|
+
local _value = props.name
|
|
36
|
+
if not (_value ~= "" and _value) then
|
|
37
|
+
error("App registration failed: missing app name", 2)
|
|
38
|
+
end
|
|
39
|
+
local _name_1 = props.name
|
|
40
|
+
if not AppRegistry[_name_1] then
|
|
41
|
+
local _name_2 = props.name
|
|
42
|
+
AppRegistry[_name_2] = {}
|
|
43
|
+
end
|
|
44
|
+
local _name_2 = props.name
|
|
45
|
+
local _result_1 = AppRegistry[_name_2]
|
|
46
|
+
if _result_1 ~= nil then
|
|
47
|
+
local _condition = props.group
|
|
48
|
+
if not (_condition ~= "" and _condition) then
|
|
49
|
+
_condition = "None"
|
|
50
|
+
end
|
|
51
|
+
local _object = {
|
|
52
|
+
constructor = constructor,
|
|
53
|
+
}
|
|
54
|
+
local _left = "group"
|
|
55
|
+
local _condition_1 = props.group
|
|
56
|
+
if not (_condition_1 ~= "" and _condition_1) then
|
|
57
|
+
_condition_1 = "None"
|
|
58
|
+
end
|
|
59
|
+
_object[_left] = _condition_1
|
|
60
|
+
_object.visible = props.visible
|
|
61
|
+
_object.rules = props.rules
|
|
62
|
+
_result_1[_condition] = _object
|
|
63
|
+
end
|
|
64
|
+
return constructor
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
--[[
|
|
68
|
+
*
|
|
69
|
+
* Base class for all AppForge Apps.
|
|
70
|
+
|
|
71
|
+
]]
|
|
72
|
+
local Args
|
|
73
|
+
do
|
|
74
|
+
Args = {}
|
|
75
|
+
function Args:constructor(props, name, group)
|
|
76
|
+
local _binding = props
|
|
77
|
+
local forge = _binding.forge
|
|
78
|
+
local _condition = group
|
|
79
|
+
if not (_condition ~= "" and _condition) then
|
|
80
|
+
_condition = "None"
|
|
81
|
+
end
|
|
82
|
+
self.group = _condition
|
|
83
|
+
self.name = name
|
|
84
|
+
local _object = table.clone(props.props)
|
|
85
|
+
setmetatable(_object, nil)
|
|
86
|
+
_object.forge = forge
|
|
87
|
+
_object.px = px
|
|
88
|
+
self.props = _object
|
|
89
|
+
self.source = forge:getSource(name, group)
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
return {
|
|
93
|
+
App = App,
|
|
94
|
+
AppRegistry = AppRegistry,
|
|
95
|
+
AppSources = AppSources,
|
|
96
|
+
Args = Args,
|
|
97
|
+
}
|
package/out/context.d.ts
ADDED
package/out/context.luau
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
local context = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).context
|
|
5
|
+
-- Types
|
|
6
|
+
local Contexts = {
|
|
7
|
+
App = context(nil),
|
|
8
|
+
}
|
|
9
|
+
local default = Contexts
|
|
10
|
+
return {
|
|
11
|
+
default = default,
|
|
12
|
+
}
|
package/out/forge.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import Vide from "@rbxts/vide";
|
|
2
|
+
import type Types from "./types";
|
|
3
|
+
import Renders from "./renders";
|
|
4
|
+
export default class AppForge extends Renders {
|
|
5
|
+
constructor();
|
|
6
|
+
private createSource;
|
|
7
|
+
getSource(name: AppNames, group?: AppGroups): Vide.Source<boolean>;
|
|
8
|
+
bind(name: AppNames, group: AppGroups | undefined, value: Vide.Source<boolean>): void;
|
|
9
|
+
set(name: AppNames, group: AppGroups | undefined, value: boolean, rules?: boolean): void;
|
|
10
|
+
open(name: AppNames, group?: AppGroups, rules?: boolean): void;
|
|
11
|
+
close(name: AppNames, group?: AppGroups, rules?: boolean): void;
|
|
12
|
+
toggle(name: AppNames, group?: AppGroups, rules?: boolean): void;
|
|
13
|
+
story: ({ props, target, renders, config, }: {
|
|
14
|
+
props: AppProps;
|
|
15
|
+
target: GuiObject;
|
|
16
|
+
renders?: Types.Props.Render;
|
|
17
|
+
config?: Types.Props.Config;
|
|
18
|
+
}) => Frame;
|
|
19
|
+
render: ({ props }: {
|
|
20
|
+
props: Omit<Types.Props.Main, "forge">;
|
|
21
|
+
}) => Instance[];
|
|
22
|
+
}
|
package/out/forge.luau
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
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
|
+
local Vide = _vide
|
|
8
|
+
local apply = _vide.apply
|
|
9
|
+
local create = _vide.create
|
|
10
|
+
local effect = _vide.effect
|
|
11
|
+
local untrack = _vide.untrack
|
|
12
|
+
-- Types
|
|
13
|
+
-- Classes
|
|
14
|
+
local Renders = TS.import(script, script.Parent, "renders").default
|
|
15
|
+
-- Components
|
|
16
|
+
local AppRegistry = TS.import(script, script.Parent, "appRegistry").AppRegistry
|
|
17
|
+
-- Helpers
|
|
18
|
+
local bindAppSource = TS.import(script, script.Parent, "helpers", "bindAppSource").default
|
|
19
|
+
local getAppSource = TS.import(script, script.Parent, "helpers", "getAppSource").default
|
|
20
|
+
local hasAppSource = TS.import(script, script.Parent, "helpers", "hasAppSource").default
|
|
21
|
+
local setAppSource = TS.import(script, script.Parent, "helpers", "setAppSource").default
|
|
22
|
+
local getAppEntry = TS.import(script, script.Parent, "helpers", "getAppEntry").default
|
|
23
|
+
local AppForge
|
|
24
|
+
do
|
|
25
|
+
local super = Renders
|
|
26
|
+
AppForge = setmetatable({}, {
|
|
27
|
+
__tostring = function()
|
|
28
|
+
return "AppForge"
|
|
29
|
+
end,
|
|
30
|
+
__index = super,
|
|
31
|
+
})
|
|
32
|
+
AppForge.__index = AppForge
|
|
33
|
+
function AppForge.new(...)
|
|
34
|
+
local self = setmetatable({}, AppForge)
|
|
35
|
+
return self:constructor(...) or self
|
|
36
|
+
end
|
|
37
|
+
function AppForge:constructor()
|
|
38
|
+
super.constructor(self)
|
|
39
|
+
self.story = function(_param)
|
|
40
|
+
local props = _param.props
|
|
41
|
+
local target = _param.target
|
|
42
|
+
local renders = _param.renders
|
|
43
|
+
local config = _param.config
|
|
44
|
+
local Container = create("Frame")({
|
|
45
|
+
Name = "Story Container",
|
|
46
|
+
BackgroundTransparency = 1,
|
|
47
|
+
AnchorPoint = Vector2.new(0.5, 0.5),
|
|
48
|
+
Position = UDim2.fromScale(0.5, 0.5),
|
|
49
|
+
Size = UDim2.fromScale(1, 1),
|
|
50
|
+
})
|
|
51
|
+
local _fn = apply(Container)
|
|
52
|
+
local _object = {}
|
|
53
|
+
local _left = 0
|
|
54
|
+
local _self = self
|
|
55
|
+
local _object_1 = {
|
|
56
|
+
props = props,
|
|
57
|
+
forge = self,
|
|
58
|
+
renders = renders,
|
|
59
|
+
}
|
|
60
|
+
local _left_1 = "config"
|
|
61
|
+
local _object_2 = {}
|
|
62
|
+
local _left_2 = "px"
|
|
63
|
+
local _object_3 = {
|
|
64
|
+
target = target,
|
|
65
|
+
}
|
|
66
|
+
local _left_3 = "minScale"
|
|
67
|
+
local _result = config
|
|
68
|
+
if _result ~= nil then
|
|
69
|
+
_result = _result.px.minScale
|
|
70
|
+
end
|
|
71
|
+
_object_3[_left_3] = _result
|
|
72
|
+
_object_2[_left_2] = _object_3
|
|
73
|
+
_object_1[_left_1] = _object_2
|
|
74
|
+
_object[_left] = _self:Initalize(_object_1)
|
|
75
|
+
_fn(_object)
|
|
76
|
+
return Container
|
|
77
|
+
end
|
|
78
|
+
self.render = function(_param)
|
|
79
|
+
local props = _param.props
|
|
80
|
+
local _self = self
|
|
81
|
+
local _object = table.clone(props)
|
|
82
|
+
setmetatable(_object, nil)
|
|
83
|
+
_object.forge = self
|
|
84
|
+
return _self:Initalize(_object)
|
|
85
|
+
end
|
|
86
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
87
|
+
local _callback = function(entryMap, name)
|
|
88
|
+
-- ▼ ReadonlyMap.forEach ▼
|
|
89
|
+
local _callback_1 = function(_, group)
|
|
90
|
+
self:createSource(name, group)
|
|
91
|
+
end
|
|
92
|
+
for _k, _v in entryMap do
|
|
93
|
+
_callback_1(_v, _k, entryMap)
|
|
94
|
+
end
|
|
95
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
96
|
+
end
|
|
97
|
+
for _k, _v in AppRegistry do
|
|
98
|
+
_callback(_v, _k, AppRegistry)
|
|
99
|
+
end
|
|
100
|
+
-- ▲ ReadonlyMap.forEach ▲
|
|
101
|
+
end
|
|
102
|
+
function AppForge:createSource(name, group)
|
|
103
|
+
if group == nil then
|
|
104
|
+
group = "None"
|
|
105
|
+
end
|
|
106
|
+
local entry = getAppEntry(name, group)
|
|
107
|
+
if not entry then
|
|
108
|
+
return nil
|
|
109
|
+
end
|
|
110
|
+
if hasAppSource(name, group) then
|
|
111
|
+
return nil
|
|
112
|
+
end
|
|
113
|
+
local _exp = name
|
|
114
|
+
local _exp_1 = group
|
|
115
|
+
local _condition = entry.visible
|
|
116
|
+
if _condition == nil then
|
|
117
|
+
_condition = false
|
|
118
|
+
end
|
|
119
|
+
setAppSource(_exp, _exp_1, _condition)
|
|
120
|
+
end
|
|
121
|
+
function AppForge:getSource(name, group)
|
|
122
|
+
if group == nil then
|
|
123
|
+
group = "None"
|
|
124
|
+
end
|
|
125
|
+
if not hasAppSource(name, group) then
|
|
126
|
+
self:createSource(name, group)
|
|
127
|
+
end
|
|
128
|
+
local src = getAppSource(name, group)
|
|
129
|
+
return src
|
|
130
|
+
end
|
|
131
|
+
function AppForge:bind(name, group, value)
|
|
132
|
+
if group == nil then
|
|
133
|
+
group = "None"
|
|
134
|
+
end
|
|
135
|
+
if not RunService:IsRunning() then
|
|
136
|
+
bindAppSource(name, group, value)
|
|
137
|
+
local count = 0
|
|
138
|
+
local _prev
|
|
139
|
+
effect(function()
|
|
140
|
+
count += 1
|
|
141
|
+
_prev = value()
|
|
142
|
+
untrack(function()
|
|
143
|
+
return self:checkRules(self, name, group)
|
|
144
|
+
end)
|
|
145
|
+
if Vide.strict and count == 2 then
|
|
146
|
+
count = 0
|
|
147
|
+
elseif not Vide.strict and count == 1 then
|
|
148
|
+
count = 0
|
|
149
|
+
end
|
|
150
|
+
end)
|
|
151
|
+
else
|
|
152
|
+
warn(".bind should ONLY be used for UI-Labs or something that displays UI WITHOUT the game running")
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
function AppForge:set(name, group, value, rules)
|
|
156
|
+
if group == nil then
|
|
157
|
+
group = "None"
|
|
158
|
+
end
|
|
159
|
+
if rules == nil then
|
|
160
|
+
rules = true
|
|
161
|
+
end
|
|
162
|
+
local src = getAppSource(name, group)
|
|
163
|
+
if not src then
|
|
164
|
+
return nil
|
|
165
|
+
end
|
|
166
|
+
local prev = src()
|
|
167
|
+
if prev == value then
|
|
168
|
+
return nil
|
|
169
|
+
end
|
|
170
|
+
src(value)
|
|
171
|
+
if rules then
|
|
172
|
+
self:checkRules(self, name, group)
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
function AppForge:open(name, group, rules)
|
|
176
|
+
if group == nil then
|
|
177
|
+
group = "None"
|
|
178
|
+
end
|
|
179
|
+
if rules == nil then
|
|
180
|
+
rules = true
|
|
181
|
+
end
|
|
182
|
+
self:set(name, group, true, rules)
|
|
183
|
+
end
|
|
184
|
+
function AppForge:close(name, group, rules)
|
|
185
|
+
if group == nil then
|
|
186
|
+
group = "None"
|
|
187
|
+
end
|
|
188
|
+
if rules == nil then
|
|
189
|
+
rules = true
|
|
190
|
+
end
|
|
191
|
+
self:set(name, group, false, rules)
|
|
192
|
+
end
|
|
193
|
+
function AppForge:toggle(name, group, rules)
|
|
194
|
+
if group == nil then
|
|
195
|
+
group = "None"
|
|
196
|
+
end
|
|
197
|
+
if rules == nil then
|
|
198
|
+
rules = true
|
|
199
|
+
end
|
|
200
|
+
local src = self:getSource(name, group)
|
|
201
|
+
if not src then
|
|
202
|
+
return nil
|
|
203
|
+
end
|
|
204
|
+
self:set(name, group, not src(), rules)
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
return {
|
|
208
|
+
default = AppForge,
|
|
209
|
+
}
|
package/out/global.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
-- Components
|
|
5
|
+
local AppSources = TS.import(script, script.Parent.Parent, "appRegistry").AppSources
|
|
6
|
+
local function bindAppSource(name, group, value)
|
|
7
|
+
local _name = name
|
|
8
|
+
if not AppSources[_name] then
|
|
9
|
+
local _name_1 = name
|
|
10
|
+
AppSources[_name_1] = {}
|
|
11
|
+
end
|
|
12
|
+
local _name_1 = name
|
|
13
|
+
local _result = AppSources[_name_1]
|
|
14
|
+
if _result ~= nil then
|
|
15
|
+
local _group = group
|
|
16
|
+
local _value = value
|
|
17
|
+
_result[_group] = _value
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
return {
|
|
21
|
+
default = bindAppSource,
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getAppEntry(name: AppNames, group: AppGroups): import("../types").default.AppRegistry.Static | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Components
|
|
4
|
+
local AppRegistry = TS.import(script, script.Parent.Parent, "appRegistry").AppRegistry
|
|
5
|
+
local function getAppEntry(name, group)
|
|
6
|
+
local _name = name
|
|
7
|
+
local entryMap = AppRegistry[_name]
|
|
8
|
+
local _entry = entryMap
|
|
9
|
+
if _entry ~= nil then
|
|
10
|
+
local _group = group
|
|
11
|
+
_entry = _entry[_group]
|
|
12
|
+
end
|
|
13
|
+
local entry = _entry
|
|
14
|
+
if not entry then
|
|
15
|
+
warn(`Failed to get entry for name {name} and group {group}`)
|
|
16
|
+
end
|
|
17
|
+
return entry
|
|
18
|
+
end
|
|
19
|
+
return {
|
|
20
|
+
default = getAppEntry,
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function getAppSource(name: AppNames, group: AppGroups): import("@rbxts/vide").Source<boolean> | undefined;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Components
|
|
4
|
+
local AppSources = TS.import(script, script.Parent.Parent, "appRegistry").AppSources
|
|
5
|
+
local function getAppSource(name, group)
|
|
6
|
+
local _name = name
|
|
7
|
+
local sourceMap = AppSources[_name]
|
|
8
|
+
local _source = sourceMap
|
|
9
|
+
if _source ~= nil then
|
|
10
|
+
local _group = group
|
|
11
|
+
_source = _source[_group]
|
|
12
|
+
end
|
|
13
|
+
local source = _source
|
|
14
|
+
if not source then
|
|
15
|
+
warn(`Failed to find source for name: {name} group: {group} \n {debug.traceback()}`)
|
|
16
|
+
end
|
|
17
|
+
return source
|
|
18
|
+
end
|
|
19
|
+
return {
|
|
20
|
+
default = getAppSource,
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function hasAppSource(name: AppNames, group: AppGroups): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Components
|
|
4
|
+
local AppSources = TS.import(script, script.Parent.Parent, "appRegistry").AppSources
|
|
5
|
+
local function hasAppSource(name, group)
|
|
6
|
+
local _name = name
|
|
7
|
+
local sourceMap = AppSources[_name]
|
|
8
|
+
if not sourceMap then
|
|
9
|
+
return false
|
|
10
|
+
end
|
|
11
|
+
local _source = sourceMap
|
|
12
|
+
if _source ~= nil then
|
|
13
|
+
local _group = group
|
|
14
|
+
_source = _source[_group]
|
|
15
|
+
end
|
|
16
|
+
local source = _source
|
|
17
|
+
if not source then
|
|
18
|
+
return false
|
|
19
|
+
end
|
|
20
|
+
return true
|
|
21
|
+
end
|
|
22
|
+
return {
|
|
23
|
+
default = hasAppSource,
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function setAppSource(name: AppNames, group: AppGroups, value: boolean): void;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Packages
|
|
4
|
+
local source = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).source
|
|
5
|
+
-- Components
|
|
6
|
+
local AppSources = TS.import(script, script.Parent.Parent, "appRegistry").AppSources
|
|
7
|
+
local function setAppSource(name, group, value)
|
|
8
|
+
local _name = name
|
|
9
|
+
if not AppSources[_name] then
|
|
10
|
+
local _name_1 = name
|
|
11
|
+
AppSources[_name_1] = {}
|
|
12
|
+
end
|
|
13
|
+
local _name_1 = name
|
|
14
|
+
local _src = AppSources[_name_1]
|
|
15
|
+
if _src ~= nil then
|
|
16
|
+
local _group = group
|
|
17
|
+
_src = _src[_group]
|
|
18
|
+
end
|
|
19
|
+
local src = _src
|
|
20
|
+
if not src then
|
|
21
|
+
local newSource = source(value)
|
|
22
|
+
local _name_2 = name
|
|
23
|
+
local _result = AppSources[_name_2]
|
|
24
|
+
if _result ~= nil then
|
|
25
|
+
local _group = group
|
|
26
|
+
_result[_group] = newSource
|
|
27
|
+
end
|
|
28
|
+
else
|
|
29
|
+
src(false)
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
return {
|
|
33
|
+
default = setAppSource,
|
|
34
|
+
}
|