@rbxts/uiblox 0.1.14 → 0.1.15
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 +10 -10
- package/out/theme/styles/utilities/classNames.luau +15 -1
- package/package.json +1 -1
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
|
|
40
|
-
- ThemeProvider which can wrap your application and uses
|
|
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
|
|
42
|
+
- Uses Reflex
|
|
43
43
|
- @rbxts/uiblox -> ui
|
|
44
|
-
- Packaged and reusable typed
|
|
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 `
|
|
68
|
+
is what we later pass to `React.mount()`.
|
|
69
69
|
|
|
70
70
|
```javascript
|
|
71
|
-
import
|
|
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
|
|
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,7 +205,7 @@ 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
|
|
208
|
+
import React, { Tree } from "@rbxts/react";
|
|
209
209
|
import { Players } from "@rbxts/services";
|
|
210
210
|
import { App } from "shared/ui/App";
|
|
211
211
|
|
|
@@ -216,13 +216,13 @@ class AppLoader {
|
|
|
216
216
|
const playerGui = Players.LocalPlayer.FindFirstChild("PlayerGui") as PlayerGui;
|
|
217
217
|
|
|
218
218
|
const appComponent = <App />;
|
|
219
|
-
this._tree =
|
|
219
|
+
this._tree = React.mount(appComponent, playerGui, "App");
|
|
220
220
|
print("App mounted");
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
Unmount() {
|
|
224
224
|
if (this._tree) {
|
|
225
|
-
|
|
225
|
+
React.unmount(this._tree);
|
|
226
226
|
print("App unmounted");
|
|
227
227
|
}
|
|
228
228
|
}
|
|
@@ -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
|