@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
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
-- Types
|
|
4
|
+
-- Components
|
|
5
|
+
-- Rules
|
|
6
|
+
local ExclusiveGroupRule = TS.import(script, script, "check", "exclusiveGroup").default
|
|
7
|
+
local AnchorRule = TS.import(script, script, "render", "anchor").default
|
|
8
|
+
local ParentRule = TS.import(script, script, "check", "parent").default
|
|
9
|
+
-- Helpers
|
|
10
|
+
local getAppEntry = TS.import(script, script.Parent, "helpers", "getAppEntry").default
|
|
11
|
+
local Rules
|
|
12
|
+
do
|
|
13
|
+
Rules = setmetatable({}, {
|
|
14
|
+
__tostring = function()
|
|
15
|
+
return "Rules"
|
|
16
|
+
end,
|
|
17
|
+
})
|
|
18
|
+
Rules.__index = Rules
|
|
19
|
+
function Rules.new(...)
|
|
20
|
+
local self = setmetatable({}, Rules)
|
|
21
|
+
return self:constructor(...) or self
|
|
22
|
+
end
|
|
23
|
+
function Rules:constructor()
|
|
24
|
+
self.processing = {}
|
|
25
|
+
end
|
|
26
|
+
function Rules:renderRules(name, group, props)
|
|
27
|
+
if group == nil then
|
|
28
|
+
group = "None"
|
|
29
|
+
end
|
|
30
|
+
local entry = getAppEntry(name, group)
|
|
31
|
+
if not entry then
|
|
32
|
+
error(`renderRules: App Entry name "{name}" group "{group}" not registered`, 2)
|
|
33
|
+
end
|
|
34
|
+
local rules = entry.rules
|
|
35
|
+
if not rules then
|
|
36
|
+
return nil
|
|
37
|
+
end
|
|
38
|
+
-- Parent Anchor
|
|
39
|
+
local _condition = rules.parent
|
|
40
|
+
if _condition ~= "" and _condition then
|
|
41
|
+
_condition = not rules.anchor
|
|
42
|
+
end
|
|
43
|
+
if _condition ~= "" and _condition then
|
|
44
|
+
AnchorRule(name, group, props)
|
|
45
|
+
end
|
|
46
|
+
-- Index
|
|
47
|
+
if rules.zIndex ~= nil then
|
|
48
|
+
-- TODO: will be a separate file under ruleEngine
|
|
49
|
+
-- forge.index(name, rules.zIndex);
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
function Rules:checkRules(forge, name, group)
|
|
53
|
+
local _processing = self.processing
|
|
54
|
+
local _name = name
|
|
55
|
+
if _processing[_name] ~= nil then
|
|
56
|
+
return nil
|
|
57
|
+
end
|
|
58
|
+
local _processing_1 = self.processing
|
|
59
|
+
local _name_1 = name
|
|
60
|
+
_processing_1[_name_1] = true
|
|
61
|
+
TS.try(function()
|
|
62
|
+
ParentRule(forge, name, group)
|
|
63
|
+
ExclusiveGroupRule(forge, name, group)
|
|
64
|
+
end, nil, function()
|
|
65
|
+
local _processing_2 = self.processing
|
|
66
|
+
local _name_2 = name
|
|
67
|
+
_processing_2[_name_2] = nil
|
|
68
|
+
end)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
return {
|
|
72
|
+
default = Rules,
|
|
73
|
+
}
|
package/out/types.d.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
// Types
|
|
2
|
+
import type { Args } from "./appRegistry";
|
|
3
|
+
import type AppForge from "./forge";
|
|
4
|
+
|
|
5
|
+
declare namespace Types {
|
|
6
|
+
namespace Props {
|
|
7
|
+
type NameSelector =
|
|
8
|
+
| { name: AppNames; names?: never }
|
|
9
|
+
| { names: AppNames[]; name?: never }
|
|
10
|
+
| { name?: undefined; names?: undefined };
|
|
11
|
+
|
|
12
|
+
type GroupSelector =
|
|
13
|
+
| { group: AppGroups; groups?: never }
|
|
14
|
+
| { groups: AppGroups[]; group?: never }
|
|
15
|
+
| { group?: undefined; groups?: undefined };
|
|
16
|
+
|
|
17
|
+
export type Render = NameSelector & GroupSelector;
|
|
18
|
+
|
|
19
|
+
type Main = {
|
|
20
|
+
props: AppProps;
|
|
21
|
+
forge: AppForge;
|
|
22
|
+
config?: Config;
|
|
23
|
+
renders?: Render;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
type Config = {
|
|
27
|
+
px: {
|
|
28
|
+
target?: GuiObject | Camera;
|
|
29
|
+
resolution?: Vector2;
|
|
30
|
+
minScale?: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
type Class = AppProps & {
|
|
35
|
+
forge: AppForge;
|
|
36
|
+
px: typeof import("./hooks/usePx").px;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
namespace AppRegistry {
|
|
41
|
+
type Props<N extends AppNames> = {
|
|
42
|
+
name: N;
|
|
43
|
+
visible?: boolean;
|
|
44
|
+
group?: AppGroups;
|
|
45
|
+
rules?: Rules.Generic<N>;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
type Static = {
|
|
49
|
+
constructor: new (props: Types.Props.Main, name: AppNames, group?: AppGroups) => Args;
|
|
50
|
+
|
|
51
|
+
visible?: boolean;
|
|
52
|
+
group?: AppGroups;
|
|
53
|
+
rules?: Rules.Static;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
type Generic<N extends AppNames = AppNames> = {
|
|
57
|
+
constructor: new (props: Types.Props.Main, name: AppNames, group?: AppGroups) => Args;
|
|
58
|
+
|
|
59
|
+
visible?: boolean;
|
|
60
|
+
group?: AppGroups;
|
|
61
|
+
rules?: Rules.Generic<N>;
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
namespace Rules {
|
|
66
|
+
type WithParent<P> = {
|
|
67
|
+
parent: P;
|
|
68
|
+
|
|
69
|
+
parentGroup?: AppGroups;
|
|
70
|
+
anchor?: boolean;
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
type WithoutParent = {
|
|
74
|
+
parent?: never;
|
|
75
|
+
|
|
76
|
+
parentGroup?: never;
|
|
77
|
+
anchor?: never;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
export type Static = {
|
|
81
|
+
exclusiveGroup?: string;
|
|
82
|
+
zIndex?: number;
|
|
83
|
+
} & (WithParent<string> | WithoutParent);
|
|
84
|
+
|
|
85
|
+
export type Generic<N extends AppNames = AppNames> = {
|
|
86
|
+
exclusiveGroup?: AppGroups;
|
|
87
|
+
zIndex?: number;
|
|
88
|
+
} & (WithParent<Exclude<AppNames, N>> | WithoutParent);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export type ForgeProps = Types.Props.Main;
|
|
93
|
+
export type ClassProps = Types.Props.Class;
|
|
94
|
+
export type RenderProps = Types.Props.Render;
|
|
95
|
+
|
|
96
|
+
export default Types;
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@rbxts/forge",
|
|
3
|
+
"version": "0.0.5",
|
|
4
|
+
"description": "An App Manager for Vide",
|
|
5
|
+
"main": "out/init.lua",
|
|
6
|
+
"types": "out/index.d.ts",
|
|
7
|
+
"packageManager": "bun@1.3.1",
|
|
8
|
+
"scripts": {
|
|
9
|
+
"build": "rbxtsc",
|
|
10
|
+
"dev": "rbxtsc -w --type game --rojo test.project.json",
|
|
11
|
+
"login": "bunx npm login --auth-type=legacy"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"roblox-ts",
|
|
15
|
+
"vide"
|
|
16
|
+
],
|
|
17
|
+
"author": "loner1536",
|
|
18
|
+
"license": "MIT",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "https://github.com/Loner1536/AppForge"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/Loner1536/AppForge/issues"
|
|
25
|
+
},
|
|
26
|
+
"files": [
|
|
27
|
+
"out",
|
|
28
|
+
"!**/*.tsbuildinfo",
|
|
29
|
+
"!**/*.spec.lua",
|
|
30
|
+
"!**/*.spec.d.ts"
|
|
31
|
+
],
|
|
32
|
+
"publishConfig": {
|
|
33
|
+
"access": "public"
|
|
34
|
+
},
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@rbxts/set-timeout": "^1.1.2",
|
|
37
|
+
"@rbxts/services": "^1.6.0",
|
|
38
|
+
"@rbxts/vide": "^0.6.0"
|
|
39
|
+
},
|
|
40
|
+
"peerDependenciesMeta": {
|
|
41
|
+
"@rbxts/vide": {
|
|
42
|
+
"optional": true
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"devDependencies": {
|
|
46
|
+
"@rbxts/compiler-types": "3.0.0-types.0",
|
|
47
|
+
"@biomejs/biome": "^2.3.7",
|
|
48
|
+
"@rbxts/types": "^1.0.891",
|
|
49
|
+
"roblox-ts": "3.0.0",
|
|
50
|
+
"typescript": "^5.9.3"
|
|
51
|
+
}
|
|
52
|
+
}
|