@rbxts/app-forge 0.6.0-alpha.40 → 0.6.0-alpha.42

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,8 +1,8 @@
1
1
  import Vide from "@rbxts/vide";
2
2
  import type Types from "./types";
3
3
  import type AppForge from ".";
4
- export declare const AppRegistry: Map<string, Types.AppRegistry>;
5
- export declare function App(props: Types.AppRegistryProps): <T extends new (props: Types.MainProps) => Args>(constructor: T) => T;
4
+ export declare const AppRegistry: Map<string, Types.AppRegistry<string>>;
5
+ export declare function App<N extends AppNames>(props: Types.AppRegistryProps<N>): <T extends new (props: Types.MainProps) => Args>(constructor: T) => T;
6
6
  export declare abstract class Args {
7
7
  readonly forge: AppForge;
8
8
  readonly props: Types.ClassProps;
@@ -4,18 +4,6 @@ local TS = _G[script]
4
4
  -- Components
5
5
  local AppRegistry = TS.import(script, script.Parent.Parent, "decorator").AppRegistry
6
6
  local function ParentRule(entry, forge)
7
- local _entry = entry
8
- local entryApp = AppRegistry[_entry]
9
- local _result = entryApp
10
- if _result ~= nil then
11
- _result = _result.rules
12
- if _result ~= nil then
13
- _result = _result.parent
14
- end
15
- end
16
- if not (_result ~= "" and _result) then
17
- return nil
18
- end
19
7
  local children = {}
20
8
  -- ▼ ReadonlyMap.forEach ▼
21
9
  local _callback = function(app, name)
@@ -28,9 +16,12 @@ local function ParentRule(entry, forge)
28
16
  _condition = rules.parent == entry
29
17
  end
30
18
  if _condition ~= "" and _condition then
19
+ if entry == name then
20
+ return warn(`{entry} tried to close {name} either they have the same ID name or they ARE the same`)
21
+ end
31
22
  local _sources = forge.sources
32
- local _entry_1 = entry
33
- if not _sources[_entry_1]() then
23
+ local _entry = entry
24
+ if not _sources[_entry]() then
34
25
  local _name = name
35
26
  table.insert(children, _name)
36
27
  end
@@ -3,10 +3,10 @@ import type { Args } from "./decorator";
3
3
  import type AppForge from ".";
4
4
 
5
5
  declare namespace Types {
6
- type AppRegistryProps = {
7
- name: AppNames;
6
+ type AppRegistryProps<N extends AppNames> = {
7
+ name: N;
8
8
  visible?: boolean;
9
- rules?: Rules.All;
9
+ rules?: Rules.All<N>;
10
10
  };
11
11
 
12
12
  type NameProps =
@@ -30,15 +30,15 @@ declare namespace Types {
30
30
  px: typeof import("@rbxts/loners-pretty-vide-utils").px;
31
31
  };
32
32
 
33
- type AppRegistry = {
33
+ type AppRegistry<N extends AppNames = AppNames> = {
34
34
  constructor: new (props: MainProps) => Args;
35
35
  visible?: boolean;
36
- rules?: Rules.All;
36
+ rules?: Rules.All<N>;
37
37
  };
38
38
 
39
39
  namespace Rules {
40
- type All = {
41
- parent?: AppNames | string;
40
+ type All<N extends AppNames> = {
41
+ parent?: Exclude<AppNames, N> | string;
42
42
  exclusiveGroup?: GroupNames | string;
43
43
  };
44
44
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/app-forge",
3
- "version": "0.6.0-alpha.40",
3
+ "version": "0.6.0-alpha.42",
4
4
  "description": "An App Manager for react",
5
5
  "main": "out/init.lua",
6
6
  "types": "out/index.d.ts",