@rbxts/app-forge 0.7.2-alpha.2 → 0.7.2-alpha.20
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/README.md +35 -192
- package/out/{vide/classes → classes}/renders.d.ts +5 -3
- package/out/{vide/classes → classes}/renders.luau +3 -1
- package/out/{vide/classes → classes}/rules/exclusiveGroup.d.ts +1 -1
- package/out/{vide/classes → classes}/rules/index.d.ts +1 -1
- package/out/{react → classes}/rules/parent.d.ts +1 -1
- package/out/{vide/classes → classes}/rules/parent.luau +1 -0
- package/out/{vide/context.d.ts → context.d.ts} +1 -1
- package/out/{vide/debug → debug}/debugger.luau +1 -1
- package/out/{vide/decorator.d.ts → decorator.d.ts} +1 -1
- package/out/{vide/decorator.luau → decorator.luau} +0 -6
- package/out/{vide/hooks → hooks}/useAppContext.d.ts +1 -1
- package/out/{vide/hooks → hooks}/usePx.luau +0 -5
- package/out/index.d.ts +5 -11
- package/out/init.luau +6 -14
- package/out/{vide/index.d.ts → main.d.ts} +2 -2
- package/out/{vide/init.luau → main.luau} +35 -10
- package/out/{vide/types.d.ts → types.d.ts} +2 -2
- package/package.json +4 -10
- package/out/react/container.d.ts +0 -10
- package/out/react/container.luau +0 -60
- package/out/react/context.d.ts +0 -7
- package/out/react/context.luau +0 -12
- package/out/react/decorator.d.ts +0 -14
- package/out/react/decorator.luau +0 -51
- package/out/react/helpers.d.ts +0 -6
- package/out/react/helpers.luau +0 -74
- package/out/react/hooks/useAppContext.d.ts +0 -5
- package/out/react/hooks/useAppContext.luau +0 -16
- package/out/react/hooks/usePx.d.ts +0 -15
- package/out/react/hooks/usePx.luau +0 -117
- package/out/react/index.d.ts +0 -44
- package/out/react/init.luau +0 -123
- package/out/react/rules/index.d.ts +0 -6
- package/out/react/rules/init.luau +0 -27
- package/out/react/rules/parent.luau +0 -42
- package/out/react/types.d.ts +0 -44
- package/out/vide/classes/rules/parent.d.ts +0 -2
- /package/out/{vide/classes → classes}/rules/exclusiveGroup.luau +0 -0
- /package/out/{vide/classes → classes}/rules/init.luau +0 -0
- /package/out/{vide/context.luau → context.luau} +0 -0
- /package/out/{vide/debug → debug}/debugger.d.ts +0 -0
- /package/out/{vide/debug → debug}/index.d.ts +0 -0
- /package/out/{vide/debug → debug}/init.luau +0 -0
- /package/out/{vide/debug → debug}/logger.d.ts +0 -0
- /package/out/{vide/debug → debug}/logger.luau +0 -0
- /package/out/{vide/hooks → hooks}/useAppContext.luau +0 -0
- /package/out/{vide/hooks → hooks}/useEventListener.d.ts +0 -0
- /package/out/{vide/hooks → hooks}/useEventListener.luau +0 -0
- /package/out/{vide/hooks → hooks}/usePx.d.ts +0 -0
package/README.md
CHANGED
|
@@ -26,6 +26,7 @@ If you’ve ever ended up with tangled UI state, duplicated visibility logic, or
|
|
|
26
26
|
* **px scaling** built-in via `loners-pretty-vide-utils`
|
|
27
27
|
* **Vide context integration**
|
|
28
28
|
* **Story / sandbox rendering**
|
|
29
|
+
* **Built-in debug logger & performance tracing**
|
|
29
30
|
* Fully typed with **roblox-ts**
|
|
30
31
|
|
|
31
32
|
---
|
|
@@ -86,6 +87,7 @@ Apps are registered using a decorator and rendered through `AppForge`.
|
|
|
86
87
|
* mounts and unmounts UI
|
|
87
88
|
* enforces rules
|
|
88
89
|
* exposes imperative helpers (`open`, `close`, `toggle`)
|
|
90
|
+
* owns the **debugger & logger** instance
|
|
89
91
|
|
|
90
92
|
You usually create **one Forge per UI root**.
|
|
91
93
|
|
|
@@ -134,8 +136,6 @@ const forge = new CreateVideForge();
|
|
|
134
136
|
|
|
135
137
|
### Mounting (Game Runtime)
|
|
136
138
|
|
|
137
|
-
AppForge is mounted once from application bootstrap code (commonly a Flamework controller).
|
|
138
|
-
|
|
139
139
|
```ts
|
|
140
140
|
const forge = new CreateVideForge();
|
|
141
141
|
|
|
@@ -152,52 +152,6 @@ forge.mount(
|
|
|
152
152
|
);
|
|
153
153
|
```
|
|
154
154
|
|
|
155
|
-
Notes:
|
|
156
|
-
|
|
157
|
-
* `forge` is **implicitly available** to Apps
|
|
158
|
-
* `props` are user-defined and become `this.props` inside Apps
|
|
159
|
-
* visibility & rules are controlled entirely by the Forge
|
|
160
|
-
|
|
161
|
-
---
|
|
162
|
-
|
|
163
|
-
### Mounting (Game Runtime)
|
|
164
|
-
|
|
165
|
-
AppForge is typically mounted from a **controller** (e.g. Flamework) and targets `PlayerGui`.
|
|
166
|
-
|
|
167
|
-
```ts
|
|
168
|
-
const forge = new CreateVideForge();
|
|
169
|
-
|
|
170
|
-
forge.mount(
|
|
171
|
-
() => (
|
|
172
|
-
<screengui
|
|
173
|
-
Name="App"
|
|
174
|
-
ZIndexBehavior="Sibling"
|
|
175
|
-
ResetOnSpawn={false}
|
|
176
|
-
/>
|
|
177
|
-
),
|
|
178
|
-
props,
|
|
179
|
-
Players.LocalPlayer.WaitForChild("PlayerGui"),
|
|
180
|
-
);
|
|
181
|
-
```
|
|
182
|
-
|
|
183
|
-
This:
|
|
184
|
-
|
|
185
|
-
* creates a single root `ScreenGui`
|
|
186
|
-
* mounts all rendered apps under it
|
|
187
|
-
* keeps AppForge in control of visibility & rules
|
|
188
|
-
|
|
189
|
-
---
|
|
190
|
-
|
|
191
|
-
### Mounting
|
|
192
|
-
|
|
193
|
-
```ts
|
|
194
|
-
forge.mount(
|
|
195
|
-
() => <screengui ResetOnSpawn={false} />,
|
|
196
|
-
props,
|
|
197
|
-
playerGui,
|
|
198
|
-
);
|
|
199
|
-
```
|
|
200
|
-
|
|
201
155
|
---
|
|
202
156
|
|
|
203
157
|
### Opening & Closing Apps
|
|
@@ -208,20 +162,11 @@ forge.close("Inventory");
|
|
|
208
162
|
forge.toggle("Inventory");
|
|
209
163
|
```
|
|
210
164
|
|
|
211
|
-
You can also access the reactive source directly:
|
|
212
|
-
|
|
213
|
-
```ts
|
|
214
|
-
const visible = forge.getSource("Inventory");
|
|
215
|
-
```
|
|
216
|
-
|
|
217
165
|
---
|
|
218
166
|
|
|
219
167
|
## 🧱 Defining an App
|
|
220
168
|
|
|
221
169
|
```ts
|
|
222
|
-
import { VideApp, VideArgs } from "@rbxts/app-forge";
|
|
223
|
-
import Vide from "@rbxts/vide";
|
|
224
|
-
|
|
225
170
|
@VideApp({
|
|
226
171
|
name: "Inventory",
|
|
227
172
|
renderGroup: "Lobby",
|
|
@@ -246,165 +191,71 @@ export class Inventory extends VideArgs {
|
|
|
246
191
|
|
|
247
192
|
---
|
|
248
193
|
|
|
249
|
-
##
|
|
250
|
-
|
|
251
|
-
```ts
|
|
252
|
-
@VideApp({
|
|
253
|
-
name: "InventoryInfo",
|
|
254
|
-
renderGroup: "Lobby",
|
|
255
|
-
rules: {
|
|
256
|
-
parent: "Inventory",
|
|
257
|
-
},
|
|
258
|
-
})
|
|
259
|
-
export class InventoryInfo extends VideArgs {
|
|
260
|
-
render() {
|
|
261
|
-
return <frame />;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
Behavior:
|
|
267
|
-
|
|
268
|
-
* When `Inventory` closes → `InventoryInfo` closes
|
|
269
|
-
* Child is **anchored** to parent unless `detach: true`
|
|
270
|
-
|
|
271
|
-
```ts
|
|
272
|
-
rules: {
|
|
273
|
-
parent: "Inventory",
|
|
274
|
-
detach: true,
|
|
275
|
-
}
|
|
276
|
-
```
|
|
277
|
-
|
|
278
|
-
---
|
|
279
|
-
|
|
280
|
-
## 🚦 Exclusive Groups
|
|
281
|
-
|
|
282
|
-
```ts
|
|
283
|
-
@VideApp({
|
|
284
|
-
name: "Settings",
|
|
285
|
-
rules: {
|
|
286
|
-
exclusiveGroup: "Menus",
|
|
287
|
-
},
|
|
288
|
-
})
|
|
289
|
-
```
|
|
194
|
+
## 🐞 Debugging & Logging
|
|
290
195
|
|
|
291
|
-
|
|
196
|
+
AppForge includes a **built-in debugger** designed for Studio-only diagnostics.
|
|
292
197
|
|
|
293
|
-
|
|
198
|
+
### Debug Tags
|
|
294
199
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
AppForge supports **multiple render selection modes**. You can render by:
|
|
298
|
-
|
|
299
|
-
* a single app name
|
|
300
|
-
* multiple app names
|
|
301
|
-
* one or more render groups
|
|
302
|
-
* combinations of `group + name(s)`
|
|
303
|
-
|
|
304
|
-
All render options are passed via `VideRenderProps`.
|
|
305
|
-
|
|
306
|
-
---
|
|
307
|
-
|
|
308
|
-
### Render a single app
|
|
200
|
+
Debug output is grouped by **typed tags**:
|
|
309
201
|
|
|
310
202
|
```ts
|
|
311
|
-
|
|
203
|
+
type DebugTag =
|
|
204
|
+
| "render"
|
|
205
|
+
| "rules"
|
|
206
|
+
| "state"
|
|
207
|
+
| "px"
|
|
208
|
+
| "lifecycle";
|
|
312
209
|
```
|
|
313
210
|
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
### Render multiple apps
|
|
317
|
-
|
|
318
|
-
```ts
|
|
319
|
-
render: { names: ["Inventory", "InventoryInfo"] }
|
|
320
|
-
```
|
|
211
|
+
Each subsystem logs under its respective tag.
|
|
321
212
|
|
|
322
213
|
---
|
|
323
214
|
|
|
324
|
-
###
|
|
215
|
+
### Enabling Debug Tags
|
|
325
216
|
|
|
326
217
|
```ts
|
|
327
|
-
render
|
|
218
|
+
forge.debug.enable("render");
|
|
219
|
+
forge.debug.enable("rules");
|
|
328
220
|
```
|
|
329
221
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
### Render by group + name
|
|
222
|
+
Enable everything at once:
|
|
333
223
|
|
|
334
224
|
```ts
|
|
335
|
-
|
|
336
|
-
group: "Lobby",
|
|
337
|
-
name: "Inventory",
|
|
338
|
-
}
|
|
225
|
+
forge.debug.enableAll();
|
|
339
226
|
```
|
|
340
227
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
---
|
|
344
|
-
|
|
345
|
-
### Render by group + names
|
|
228
|
+
Disable:
|
|
346
229
|
|
|
347
230
|
```ts
|
|
348
|
-
render
|
|
349
|
-
group: "Lobby",
|
|
350
|
-
names: ["Inventory", "Settings"],
|
|
351
|
-
}
|
|
231
|
+
forge.debug.disable("render");
|
|
352
232
|
```
|
|
353
233
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
* are in the specified group(s)
|
|
357
|
-
* and whose names match the provided list
|
|
234
|
+
Debug logging only runs in **Roblox Studio**.
|
|
358
235
|
|
|
359
236
|
---
|
|
360
237
|
|
|
361
|
-
|
|
238
|
+
### Performance Tracing
|
|
362
239
|
|
|
363
|
-
|
|
240
|
+
Certain systems emit **timing logs** when enabled:
|
|
364
241
|
|
|
365
242
|
```ts
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
return forge.story({
|
|
369
|
-
props,
|
|
370
|
-
config: {
|
|
371
|
-
px: {
|
|
372
|
-
target: storyProps.target,
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
render: { group: "Lobby" },
|
|
376
|
-
});
|
|
243
|
+
forge.debug.enable("render");
|
|
377
244
|
```
|
|
378
245
|
|
|
379
|
-
|
|
246
|
+
Output example:
|
|
380
247
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
248
|
+
```
|
|
249
|
+
[PERF][render][Inventory] 1.243ms
|
|
250
|
+
```
|
|
384
251
|
|
|
385
252
|
---
|
|
386
253
|
|
|
387
|
-
|
|
254
|
+
### Static Registration Logs
|
|
388
255
|
|
|
389
|
-
App
|
|
256
|
+
App registration (decorators) run **before a Forge exists**.
|
|
390
257
|
|
|
391
|
-
|
|
392
|
-
import { Provider } from "@rbxts/vide";
|
|
393
|
-
import { VideContexts } from "@rbxts/app-forge";
|
|
394
|
-
|
|
395
|
-
<Provider context={VideContexts.App} value={this.props}>
|
|
396
|
-
{() => <Child />}
|
|
397
|
-
</Provider>
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
Or via hook:
|
|
401
|
-
|
|
402
|
-
````ts
|
|
403
|
-
```ts
|
|
404
|
-
import { useVideAppContext } from "@rbxts/app-forge";
|
|
405
|
-
|
|
406
|
-
const app = useVideAppContext();
|
|
407
|
-
````
|
|
258
|
+
These use an internal **static logger** and will still emit warnings and errors during Studio load (e.g. duplicate app names).
|
|
408
259
|
|
|
409
260
|
---
|
|
410
261
|
|
|
@@ -418,6 +269,7 @@ AppForge
|
|
|
418
269
|
├─ Rule Engine
|
|
419
270
|
│ ├─ Parent Rule
|
|
420
271
|
│ └─ Exclusive Group Rule
|
|
272
|
+
├─ Debugger / Logger
|
|
421
273
|
└─ Vide Mount
|
|
422
274
|
```
|
|
423
275
|
|
|
@@ -428,6 +280,7 @@ AppForge
|
|
|
428
280
|
* Apps are **singletons per Forge**
|
|
429
281
|
* Rendering twice will warn if px is re‑initialized
|
|
430
282
|
* Rules are enforced **reactively**
|
|
283
|
+
* Debug logging is **Studio-only**
|
|
431
284
|
* This package is currently **alpha** — APIs may change
|
|
432
285
|
|
|
433
286
|
---
|
|
@@ -443,27 +296,17 @@ AppForge
|
|
|
443
296
|
|
|
444
297
|
## ⚛️ React Support (Planned)
|
|
445
298
|
|
|
446
|
-
AppForge is designed as a **renderer-agnostic App Manager**.
|
|
299
|
+
AppForge is designed as a **renderer-agnostic App Manager**.
|
|
447
300
|
|
|
448
301
|
Currently:
|
|
449
302
|
|
|
450
303
|
* ✅ **Vide renderer** is production-ready
|
|
451
304
|
* 🚧 **React renderer** exists but is **very early / experimental**
|
|
452
305
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
Public surface (subject to change):
|
|
456
|
-
|
|
457
|
-
```ts
|
|
458
|
-
import { ReactApp, ReactArgs, CreateReactForge } from "@rbxts/app-forge";
|
|
459
|
-
```
|
|
460
|
-
|
|
461
|
-
**Vide is the recommended and supported path today.**
|
|
306
|
+
Vide is the recommended and supported path today.
|
|
462
307
|
|
|
463
308
|
---
|
|
464
309
|
|
|
465
310
|
## 📜 License
|
|
466
311
|
|
|
467
312
|
MIT
|
|
468
|
-
|
|
469
|
-
---
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import Vide from "@rbxts/vide";
|
|
2
2
|
import type Types from "../types";
|
|
3
|
-
import type AppForge from "
|
|
3
|
+
import type AppForge from "../main";
|
|
4
4
|
import Rules from "./rules";
|
|
5
5
|
export default class Renders extends Rules {
|
|
6
6
|
protected anchored: Map<string, {
|
|
@@ -12,7 +12,9 @@ export default class Renders extends Rules {
|
|
|
12
12
|
* Entry point for mounting renders.
|
|
13
13
|
* Decides render strategy based on props.
|
|
14
14
|
*/
|
|
15
|
-
protected renderMount(this: AppForge, props: Types.Props.Main): Vide.Node
|
|
15
|
+
protected renderMount(this: AppForge, props: Types.Props.Main): void | Instance | Vide.InstanceAttributes<Instance> | Vide.Action<any> | ReadonlyMap<number, Vide.Node> | {
|
|
16
|
+
readonly [key: number]: Vide.Node;
|
|
17
|
+
} | Vide.FunctionNode;
|
|
16
18
|
private renderNames;
|
|
17
19
|
private collectByGroup;
|
|
18
20
|
private normalizeGroups;
|
|
@@ -21,5 +23,5 @@ export default class Renders extends Rules {
|
|
|
21
23
|
protected renderGroup(this: AppForge, props: Types.Props.Main): Vide.Node[];
|
|
22
24
|
protected renderGroupByName(this: AppForge, props: Types.Props.Main): Vide.Node[];
|
|
23
25
|
protected renderGroupByNames(this: AppForge, props: Types.Props.Main): Vide.Node[];
|
|
24
|
-
protected renderAll(this: AppForge, props: Types.Props.Main): Vide.Node[];
|
|
26
|
+
protected renderAll(this: AppForge, props: Types.Props.Main): void | Vide.Node[];
|
|
25
27
|
}
|
|
@@ -162,7 +162,6 @@ do
|
|
|
162
162
|
end
|
|
163
163
|
self.debug:time("render", name)
|
|
164
164
|
if not (self.loaded[name] ~= nil) then
|
|
165
|
-
self.debug:logTag("render", name, "Creating render instance")
|
|
166
165
|
local render = appClass.constructor.new(props, name):render()
|
|
167
166
|
apply(render)({
|
|
168
167
|
Name = "Render",
|
|
@@ -248,6 +247,9 @@ do
|
|
|
248
247
|
_callback(_v, _k, AppRegistry)
|
|
249
248
|
end
|
|
250
249
|
-- ▲ ReadonlyMap.forEach ▲
|
|
250
|
+
if not names then
|
|
251
|
+
return self.logger:log("WARN", "When mounting | Renderer found 0 apps, Makes sure you add the Directory of the Apps to Flamework!")
|
|
252
|
+
end
|
|
251
253
|
return self:renderNames(props, names, self)
|
|
252
254
|
end
|
|
253
255
|
end
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type AppForge from "
|
|
1
|
+
import type AppForge from "../../main";
|
|
2
2
|
export default function ExclusiveGroupRule(entry: AppNames, forge: AppForge): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type Types from "../../types";
|
|
2
|
-
import type AppForge from "
|
|
2
|
+
import type AppForge from "../../main";
|
|
3
3
|
export default class Rules {
|
|
4
4
|
protected processing: Set<string>;
|
|
5
5
|
protected renderRules(this: AppForge, name: AppNames, props: Types.Props.Main): void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type AppForge from "
|
|
1
|
+
import type AppForge from "../../main";
|
|
2
2
|
export default function ParentRule(entry: AppNames, forge: AppForge): void;
|
|
@@ -53,7 +53,7 @@ do
|
|
|
53
53
|
if not self:isEnabled(tag) then
|
|
54
54
|
return nil
|
|
55
55
|
end
|
|
56
|
-
self.log("DEBUG", `[{tag}][{app}] {message}`, data
|
|
56
|
+
self.log("DEBUG", `[{tag}][{app}] {message}`, data)
|
|
57
57
|
end
|
|
58
58
|
function Debugger:time(tag, app)
|
|
59
59
|
if not RunService:IsStudio() then
|
|
@@ -29,12 +29,6 @@ local function App(props)
|
|
|
29
29
|
logger:log("ERROR", "Attempted to register App without a name", props)
|
|
30
30
|
error("App registration failed: missing app name", 2)
|
|
31
31
|
end
|
|
32
|
-
logger:log("DEBUG", "Registering App", {
|
|
33
|
-
name = props.name,
|
|
34
|
-
renderGroup = props.renderGroup,
|
|
35
|
-
visible = props.visible,
|
|
36
|
-
rules = props.rules,
|
|
37
|
-
})
|
|
38
32
|
local _name_1 = props.name
|
|
39
33
|
local _arg1 = {
|
|
40
34
|
constructor = constructor,
|
|
@@ -74,11 +74,6 @@ local function usePx(target, baseResolution, minScale)
|
|
|
74
74
|
return nil
|
|
75
75
|
end
|
|
76
76
|
INITIALIZED = true
|
|
77
|
-
logger:log("DEBUG", "Initializing px scaling", {
|
|
78
|
-
target = target,
|
|
79
|
-
baseResolution = baseResolution,
|
|
80
|
-
minScale = minScale,
|
|
81
|
-
})
|
|
82
77
|
if baseResolution then
|
|
83
78
|
BASE_RESOLUTION(baseResolution)
|
|
84
79
|
end
|
package/out/index.d.ts
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
export { App
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export { default as
|
|
5
|
-
export {
|
|
6
|
-
export type { MainProps as VideProps, ClassProps as VideClassProps, RenderProps as VideRenderProps, } from "./vide/types";
|
|
7
|
-
export type { MainProps as ReactProps, ClassProps as ReactClassProps, } from "./react/types";
|
|
8
|
-
export { default as useReactAppContext } from "./react/hooks/useAppContext";
|
|
9
|
-
export { default as ReactContexts } from "./react/context";
|
|
10
|
-
export { default as useVideAppContext } from "./vide/hooks/useAppContext";
|
|
11
|
-
export { default as VideContexts } from "./vide/context";
|
|
1
|
+
export { App, Args } from "./decorator";
|
|
2
|
+
export { default as CreateForge } from "./main";
|
|
3
|
+
export type { ForgeProps, ClassProps, RenderProps, } from "./types";
|
|
4
|
+
export { default as useAppContext } from "./hooks/useAppContext";
|
|
5
|
+
export { default as Contexts } from "./context";
|
package/out/init.luau
CHANGED
|
@@ -2,20 +2,12 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local exports = {}
|
|
4
4
|
-- Decorators
|
|
5
|
-
local _decorator = TS.import(script, script, "
|
|
6
|
-
exports.
|
|
7
|
-
exports.
|
|
8
|
-
local _decorator_1 = TS.import(script, script, "vide", "decorator")
|
|
9
|
-
exports.VideApp = _decorator_1.App
|
|
10
|
-
exports.VideArgs = _decorator_1.Args
|
|
5
|
+
local _decorator = TS.import(script, script, "decorator")
|
|
6
|
+
exports.App = _decorator.App
|
|
7
|
+
exports.Args = _decorator.Args
|
|
11
8
|
-- Creators
|
|
12
|
-
exports.
|
|
13
|
-
exports.CreateVideForge = TS.import(script, script, "vide").default
|
|
14
|
-
-- Helpers
|
|
15
|
-
exports.RenderReact = TS.import(script, script, "react", "helpers").Render
|
|
9
|
+
exports.CreateForge = TS.import(script, script, "main").default
|
|
16
10
|
-- Types
|
|
17
|
-
exports.
|
|
18
|
-
exports.
|
|
19
|
-
exports.useVideAppContext = TS.import(script, script, "vide", "hooks", "useAppContext").default
|
|
20
|
-
exports.VideContexts = TS.import(script, script, "vide", "context").default
|
|
11
|
+
exports.useAppContext = TS.import(script, script, "hooks", "useAppContext").default
|
|
12
|
+
exports.Contexts = TS.import(script, script, "context").default
|
|
21
13
|
return exports
|
|
@@ -26,8 +26,8 @@ export default class AppForge extends Renders {
|
|
|
26
26
|
open(name: AppNames, rules?: boolean): void;
|
|
27
27
|
close(name: AppNames, rules?: boolean): void;
|
|
28
28
|
toggle(name: AppNames, rules?: boolean): void;
|
|
29
|
-
story(props: Types.Props.
|
|
30
|
-
mount(
|
|
29
|
+
story(props: AppProps, render: Types.Props.Render, target: GuiObject): Frame;
|
|
30
|
+
mount(node: Vide.Node, props: Types.Props.Main, target: Instance): Destructor;
|
|
31
31
|
unMount(): void;
|
|
32
32
|
}
|
|
33
33
|
export {};
|
|
@@ -4,6 +4,7 @@ local TS = _G[script]
|
|
|
4
4
|
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
5
5
|
-- Packages
|
|
6
6
|
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
7
|
+
local Vide = _vide
|
|
7
8
|
local apply = _vide.apply
|
|
8
9
|
local create = _vide.create
|
|
9
10
|
local effect = _vide.effect
|
|
@@ -11,11 +12,11 @@ local mount = _vide.mount
|
|
|
11
12
|
local source = _vide.source
|
|
12
13
|
local untrack = _vide.untrack
|
|
13
14
|
-- Classes
|
|
14
|
-
local Renders = TS.import(script, script, "classes", "renders").default
|
|
15
|
+
local Renders = TS.import(script, script.Parent, "classes", "renders").default
|
|
15
16
|
-- Helpers
|
|
16
|
-
local AppRegistry = TS.import(script, script, "decorator").AppRegistry
|
|
17
|
+
local AppRegistry = TS.import(script, script.Parent, "decorator").AppRegistry
|
|
17
18
|
-- Debug
|
|
18
|
-
local _debug = TS.import(script, script, "debug")
|
|
19
|
+
local _debug = TS.import(script, script.Parent, "debug")
|
|
19
20
|
local Logger = _debug.Logger
|
|
20
21
|
local Debugger = _debug.Debugger
|
|
21
22
|
local AppForge
|
|
@@ -109,11 +110,27 @@ do
|
|
|
109
110
|
local _name = name
|
|
110
111
|
local _value = value
|
|
111
112
|
_sources[_name] = _value
|
|
113
|
+
local prev
|
|
114
|
+
local log = function()
|
|
115
|
+
return self.debug:logTag("state", name, "Visibility changed", {
|
|
116
|
+
from = prev,
|
|
117
|
+
to = value,
|
|
118
|
+
})
|
|
119
|
+
end
|
|
120
|
+
local count = 0
|
|
112
121
|
effect(function()
|
|
113
|
-
|
|
122
|
+
count += 1
|
|
123
|
+
prev = value()
|
|
114
124
|
untrack(function()
|
|
115
125
|
return self:checkRules(name)
|
|
116
126
|
end)
|
|
127
|
+
if Vide.strict and count == 2 then
|
|
128
|
+
log()
|
|
129
|
+
count = 0
|
|
130
|
+
elseif not Vide.strict and count == 1 then
|
|
131
|
+
log()
|
|
132
|
+
count = 0
|
|
133
|
+
end
|
|
117
134
|
end)
|
|
118
135
|
else
|
|
119
136
|
self.logger:log("WARN", "forge.bind called while game is running", {
|
|
@@ -246,7 +263,7 @@ do
|
|
|
246
263
|
end
|
|
247
264
|
self:set(name, not self:getSource(name)(), rules)
|
|
248
265
|
end
|
|
249
|
-
function AppForge:story(props)
|
|
266
|
+
function AppForge:story(props, render, target)
|
|
250
267
|
self.debug:logTag("lifecycle", "story", "Creating story mount")
|
|
251
268
|
local Container = create("Frame")({
|
|
252
269
|
Name = "Story Container",
|
|
@@ -256,18 +273,26 @@ do
|
|
|
256
273
|
Size = UDim2.fromScale(1, 1),
|
|
257
274
|
})
|
|
258
275
|
apply(Container)({
|
|
259
|
-
[0] = self:renderMount(
|
|
276
|
+
[0] = self:renderMount({
|
|
277
|
+
props = props,
|
|
278
|
+
forge = self,
|
|
279
|
+
render = render,
|
|
280
|
+
config = {
|
|
281
|
+
px = {
|
|
282
|
+
target = target,
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
}),
|
|
260
286
|
})
|
|
261
287
|
return Container
|
|
262
288
|
end
|
|
263
|
-
function AppForge:mount(
|
|
289
|
+
function AppForge:mount(node, props, target)
|
|
264
290
|
self.debug:logTag("lifecycle", "mount", "Mounting AppForge")
|
|
265
|
-
local Container = callback()
|
|
266
291
|
self.innerMount = mount(function()
|
|
267
|
-
apply(
|
|
292
|
+
apply(node)({
|
|
268
293
|
[0] = self:renderMount(props),
|
|
269
294
|
})
|
|
270
|
-
return
|
|
295
|
+
return node
|
|
271
296
|
end, target)
|
|
272
297
|
return self.innerMount
|
|
273
298
|
end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Types
|
|
2
2
|
import type { Args } from "./decorator";
|
|
3
|
-
import type AppForge from "
|
|
3
|
+
import type AppForge from "./main";
|
|
4
4
|
|
|
5
5
|
declare namespace Types {
|
|
6
6
|
namespace Props {
|
|
@@ -78,7 +78,7 @@ declare namespace Types {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
export type
|
|
81
|
+
export type ForgeProps = Types.Props.Main;
|
|
82
82
|
export type ClassProps = Types.Props.Class;
|
|
83
83
|
export type RenderProps = Types.Props.Render;
|
|
84
84
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rbxts/app-forge",
|
|
3
|
-
"version": "0.7.2-alpha.
|
|
3
|
+
"version": "0.7.2-alpha.20",
|
|
4
4
|
"description": "An App Manager for Vide",
|
|
5
5
|
"main": "out/init.lua",
|
|
6
6
|
"types": "out/index.d.ts",
|
|
@@ -34,24 +34,18 @@
|
|
|
34
34
|
"access": "public"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
+
"@rbxts/set-timeout": "^1.1.2",
|
|
37
38
|
"@rbxts/services": "^1.6.0",
|
|
38
|
-
"@rbxts/
|
|
39
|
-
},
|
|
40
|
-
"peerDependencies": {
|
|
41
|
-
"@rbxts/react": "^17.3.7-ts.1",
|
|
42
|
-
"@rbxts/vide": "^0.5.7"
|
|
39
|
+
"@rbxts/vide": "^0.6.0"
|
|
43
40
|
},
|
|
44
41
|
"peerDependenciesMeta": {
|
|
45
|
-
"@rbxts/react": {
|
|
46
|
-
"optional": true
|
|
47
|
-
},
|
|
48
42
|
"@rbxts/vide": {
|
|
49
43
|
"optional": true
|
|
50
44
|
}
|
|
51
45
|
},
|
|
52
46
|
"devDependencies": {
|
|
53
|
-
"@biomejs/biome": "^2.3.7",
|
|
54
47
|
"@rbxts/compiler-types": "3.0.0-types.0",
|
|
48
|
+
"@biomejs/biome": "^2.3.7",
|
|
55
49
|
"@rbxts/types": "^1.0.891",
|
|
56
50
|
"roblox-ts": "3.0.0",
|
|
57
51
|
"typescript": "^5.9.3"
|