@rbxts/app-forge 0.6.0-alpha.73 → 0.6.0-alpha.75

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,9 @@
1
- import type AppForge from "..";
2
1
  import type Types from "../types";
2
+ import type AppForge from "..";
3
3
  import Rules from "./rules";
4
4
  export default class Renders extends Rules {
5
5
  constructor();
6
+ protected renderMount(this: AppForge, props: Types.Props.Main): ScreenGui | Frame | (ScreenGui | Frame)[];
6
7
  private renderNames;
7
8
  private collectByGroup;
8
9
  private normalizeGroups;
@@ -3,6 +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-vide-utils").out).usePx
6
7
  local create = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).create
7
8
  -- Types
8
9
  -- Components
@@ -26,6 +27,60 @@ do
26
27
  function Renders:constructor()
27
28
  super.constructor(self)
28
29
  end
30
+ function Renders:renderMount(props)
31
+ local _binding = props
32
+ local config = _binding.config
33
+ local render = _binding.render
34
+ local forge = _binding.forge
35
+ if not forge.__px then
36
+ local _result = config
37
+ if _result ~= nil then
38
+ _result = _result.px.target
39
+ end
40
+ local _result_1 = config
41
+ if _result_1 ~= nil then
42
+ _result_1 = _result_1.px.resolution
43
+ end
44
+ local _result_2 = config
45
+ if _result_2 ~= nil then
46
+ _result_2 = _result_2.px.minScale
47
+ end
48
+ usePx(_result, _result_1, _result_2)
49
+ forge.__px = true
50
+ else
51
+ warn("Rendering twice making a second px")
52
+ end
53
+ if render then
54
+ local _condition = render.name
55
+ if _condition ~= "" and _condition then
56
+ _condition = render.group
57
+ end
58
+ if _condition ~= "" and _condition then
59
+ return forge:renderGroupByName(props)
60
+ else
61
+ local _value = render.names and render.group
62
+ if _value ~= "" and _value then
63
+ return forge:renderGroupByNames(props)
64
+ else
65
+ local _result = render
66
+ if _result ~= nil then
67
+ _result = _result.name
68
+ end
69
+ if _result ~= "" and _result then
70
+ return forge:renderApp(props)
71
+ elseif render.names then
72
+ return forge:renderApps(props)
73
+ else
74
+ local _value_1 = render.group
75
+ if _value_1 ~= "" and _value_1 then
76
+ return forge:renderGroup(props)
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ return self:renderAll(props)
83
+ end
29
84
  function Renders:renderNames(props, names, forge)
30
85
  if #names == 0 then
31
86
  error("No app names provided to renderApps")
@@ -1,10 +1,11 @@
1
1
  import Vide from "@rbxts/vide";
2
2
  import Renders from "./classes/renders";
3
3
  import Types from "./types";
4
+ type Destructor = () => void;
4
5
  export default class AppForge extends Renders {
5
6
  protected sources: Map<string, Vide.Source<boolean>>;
6
7
  protected loaded: Map<string, Vide.Node>;
7
- protected innerMount?: () => void;
8
+ protected innerMount?: Destructor;
8
9
  protected __px: boolean;
9
10
  constructor();
10
11
  protected createSource(name: AppNames): typeof Vide.source | undefined;
@@ -14,7 +15,9 @@ export default class AppForge extends Renders {
14
15
  set(name: AppNames, value: boolean, rules?: boolean): void;
15
16
  open(name: AppNames, rules?: boolean): void;
16
17
  close(name: AppNames, rules?: boolean): void;
17
- mount(callback: () => Vide.Node, props: Types.Props.Main, target: Instance): void;
18
+ story(props: Types.Props.Main): Frame;
19
+ mount(callback: () => Vide.Node, props: Types.Props.Main, target: Instance): Destructor;
18
20
  unMount(): void;
19
21
  toggle(name: AppNames, rules?: boolean): void;
20
22
  }
23
+ export {};
@@ -5,11 +5,11 @@ local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services"))
5
5
  -- Packages
6
6
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
7
7
  local apply = _vide.apply
8
+ local create = _vide.create
8
9
  local effect = _vide.effect
9
10
  local mount = _vide.mount
10
11
  local source = _vide.source
11
12
  local untrack = _vide.untrack
12
- local usePx = TS.import(script, TS.getModule(script, "@rbxts", "loners-pretty-vide-utils").out).usePx
13
13
  -- Classes
14
14
  local Renders = TS.import(script, script, "classes", "renders").default
15
15
  -- Helpers
@@ -127,66 +127,29 @@ do
127
127
  end
128
128
  self:set(name, false, rules)
129
129
  end
130
+ function AppForge:story(props)
131
+ local Container = create("Frame")({
132
+ Name = "Story Container",
133
+ BackgroundTransparency = 1,
134
+ AnchorPoint = Vector2.new(0.5, 0.5),
135
+ Position = UDim2.fromScale(0.5, 0.5),
136
+ Size = UDim2.fromScale(1, 1),
137
+ Interactable = false,
138
+ })
139
+ apply(Container)({
140
+ [0] = self:renderMount(props),
141
+ })
142
+ return Container
143
+ end
130
144
  function AppForge:mount(callback, props, target)
131
- local _binding = props
132
- local config = _binding.config
133
- local render = _binding.render
134
- if not self.__px then
135
- local _result = config
136
- if _result ~= nil then
137
- _result = _result.px.target
138
- end
139
- local _result_1 = config
140
- if _result_1 ~= nil then
141
- _result_1 = _result_1.px.resolution
142
- end
143
- local _result_2 = config
144
- if _result_2 ~= nil then
145
- _result_2 = _result_2.px.minScale
146
- end
147
- usePx(_result, _result_1, _result_2)
148
- self.__px = true
149
- else
150
- warn("Rendering twice making a second px")
151
- end
152
- local children
153
- if render then
154
- local _condition = render.name
155
- if _condition ~= "" and _condition then
156
- _condition = render.group
157
- end
158
- if _condition ~= "" and _condition then
159
- children = self:renderGroupByName(props)
160
- else
161
- local _value = render.names and render.group
162
- if _value ~= "" and _value then
163
- children = self:renderGroupByNames(props)
164
- else
165
- local _result = render
166
- if _result ~= nil then
167
- _result = _result.name
168
- end
169
- if _result ~= "" and _result then
170
- children = self:renderApp(props)
171
- elseif render.names then
172
- children = self:renderApps(props)
173
- else
174
- local _value_1 = render.group
175
- if _value_1 ~= "" and _value_1 then
176
- children = self:renderGroup(props)
177
- end
178
- end
179
- end
180
- end
181
- end
182
- children = self:renderAll(props)
183
145
  local Container = callback()
184
146
  apply(Container)({
185
- [0] = children,
147
+ [0] = self:renderMount(props),
186
148
  })
187
149
  self.innerMount = mount(function()
188
150
  return Container
189
151
  end, target)
152
+ return self.innerMount
190
153
  end
191
154
  function AppForge:unMount()
192
155
  local _result = self.innerMount
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/app-forge",
3
- "version": "0.6.0-alpha.73",
3
+ "version": "0.6.0-alpha.75",
4
4
  "description": "An App Manager for Vide",
5
5
  "main": "out/init.lua",
6
6
  "types": "out/index.d.ts",