@rbxts/uiblox 0.1.14 → 0.1.16

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 CHANGED
@@ -36,12 +36,12 @@ How does it do this? Well, there are two main exports from this package:
36
36
  - An extensible Theme type + default Dark (default) and Light themes
37
37
  - ... Light theme palette is a WIP
38
38
  - makeStyles/createStyles utilities to serve up Instance-extended property
39
- tables that can be applied to your Roact Components
40
- - ThemeProvider which can wrap your application and uses Rodux to tell
39
+ tables that can be applied to your React Components
40
+ - ThemeProvider which can wrap your application and uses Reflex to tell
41
41
  sub-components which theme to style off of (via makeStyles)
42
- - Uses Rodux
42
+ - Uses Reflex
43
43
  - @rbxts/uiblox -> ui
44
- - Packaged and reusable typed Roact components
44
+ - Packaged and reusable typed React components
45
45
 
46
46
  # How to use
47
47
 
@@ -65,10 +65,10 @@ You can house all of your components within shared.
65
65
  #### src/shared/ui/app/App.tsx
66
66
 
67
67
  The top-level class for our UI. Loads the actual ApplLayout into ScreenGui. This
68
- is what we later pass to `Roact.mount()`.
68
+ is what we later pass when mounting the App.
69
69
 
70
70
  ```javascript
71
- import Roact, { Component } from "@rbxts/roact";
71
+ import React, { Component } from "@rbxts/react";
72
72
 
73
73
  class App extends Component {
74
74
  render() {
@@ -94,7 +94,7 @@ You can also choose to create your own theme with the `Theme` interface exported
94
94
  from `@rbxts/uiblox`.
95
95
 
96
96
  ```javascript
97
- import Roact, { Component } from "@rbxts/roact";
97
+ import React, { Component } from "@rbxts/react";
98
98
  import { Storyblox } from "shared/ui/storyblox";
99
99
  import { DarkTheme, ThemeProvider } from "@rbxts/uiblox";
100
100
  import usePageLayoutStyles from "./PageLayout.styles";
@@ -205,26 +205,28 @@ Some sample logic for mounting app when player spawns (on client).
205
205
  Mount the App in the LocalPlayer's `PlayerGui`.
206
206
 
207
207
  ```javascript
208
- import Roact, { Tree } from "@rbxts/roact";
208
+ import Log from "@rbxts/log";
209
+ import React, { StrictMode } from "@rbxts/react";
210
+ import { createPortal, createRoot } from "@rbxts/react-roblox";
209
211
  import { Players } from "@rbxts/services";
210
- import { App } from "shared/ui/App";
212
+ import { APP_CONTAINER_NAME } from "shared/constants/AppConstants";
213
+ import App from "shared/packages/ui/app/components/App";
211
214
 
212
215
  class AppLoader {
213
- protected _tree: Tree | undefined;
216
+ protected root: React.ReactNode | undefined;
214
217
 
215
218
  Mount() {
216
- const playerGui = Players.LocalPlayer.FindFirstChild("PlayerGui") as PlayerGui;
219
+ const playerGui = Players.LocalPlayer.FindFirstChildOfClass("PlayerGui");
217
220
 
218
- const appComponent = <App />;
219
- this._tree = Roact.mount(appComponent, playerGui, "App");
220
- print("App mounted");
221
- }
222
-
223
- Unmount() {
224
- if (this._tree) {
225
- Roact.unmount(this._tree);
226
- print("App unmounted");
221
+ if (!playerGui) {
222
+ Log.Error("PlayerGui not found");
223
+ return;
227
224
  }
225
+
226
+ const root = createRoot(new Instance("Folder"));
227
+
228
+ root.render(<StrictMode>{createPortal(<App key={APP_CONTAINER_NAME} />, playerGui)}</StrictMode>);
229
+ Log.Info("App mounted");
228
230
  }
229
231
  }
230
232
 
@@ -22,9 +22,23 @@ local classNames = function(conditionalStyles, ...)
22
22
  end
23
23
  -- ▲ ReadonlyMap.forEach ▲
24
24
  end
25
+ -- ▼ ReadonlyArray.forEach ▼
26
+ local _callback = function(value)
27
+ if value ~= 0 and value == value and value ~= "" and value then
28
+ local _object = table.clone(style)
29
+ setmetatable(_object, nil)
30
+ for _k, _v in value do
31
+ _object[_k] = _v
32
+ end
33
+ style = _object
34
+ end
35
+ end
36
+ for _k, _v in styles do
37
+ _callback(_v, _k - 1, styles)
38
+ end
39
+ -- ▲ ReadonlyArray.forEach ▲
25
40
  local _object = table.clone(style)
26
41
  setmetatable(_object, nil)
27
- _object.styles = styles
28
42
  return _object
29
43
  end
30
44
  local default = classNames
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rbxts/uiblox",
3
- "version": "0.1.14",
3
+ "version": "0.1.16",
4
4
  "description": "UI Library and theming for roblox-ts projects",
5
5
  "main": "out/init.lua",
6
6
  "scripts": {