@rbxts/uiblox 0.1.46 → 0.1.48
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/out/theme/constants/StateConstants.d.ts +0 -2
- package/out/theme/constants/StateConstants.luau +0 -4
- package/out/theme/context/ThemeProducer.d.ts +5 -0
- package/out/theme/context/ThemeProducer.luau +12 -0
- package/out/theme/context/ThemeProvider.d.ts +3 -7
- package/out/theme/context/ThemeProvider.luau +13 -19
- package/out/theme/hooks/useTheme.d.ts +5 -3
- package/out/theme/hooks/useTheme.luau +21 -5
- package/out/theme/index.d.ts +0 -5
- package/out/theme/init.luau +0 -4
- package/out/theme/types/index.d.ts +0 -3
- package/package.json +1 -1
- package/out/theme/enums/ThemeActionTypes.d.ts +0 -4
- package/out/theme/enums/ThemeActionTypes.luau +0 -8
- package/out/theme/enums/index.d.ts +0 -1
- package/out/theme/enums/init.luau +0 -7
- package/out/theme/types/context.d.ts +0 -13
- package/out/theme/types/context.luau +0 -2
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local DarkTheme = TS.import(script, script.Parent.Parent, "themes").DarkTheme
|
|
4
4
|
local DEFAULT_THEME = DarkTheme
|
|
5
|
-
local INITIAL_THEME_STATE = {
|
|
6
|
-
theme = DEFAULT_THEME,
|
|
7
|
-
}
|
|
8
5
|
return {
|
|
9
6
|
DEFAULT_THEME = DEFAULT_THEME,
|
|
10
|
-
INITIAL_THEME_STATE = INITIAL_THEME_STATE,
|
|
11
7
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local createProducer = TS.import(script, TS.getModule(script, "@rbxts", "reflex").src).createProducer
|
|
4
|
+
local DEFAULT_THEME = TS.import(script, script.Parent.Parent, "constants").DEFAULT_THEME
|
|
5
|
+
local themeProducer = createProducer(DEFAULT_THEME, {
|
|
6
|
+
setTheme = function(_state, theme)
|
|
7
|
+
return theme
|
|
8
|
+
end,
|
|
9
|
+
})
|
|
10
|
+
return {
|
|
11
|
+
themeProducer = themeProducer,
|
|
12
|
+
}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from "@rbxts/react";
|
|
2
1
|
import { Theme } from "../interfaces/index";
|
|
3
|
-
|
|
4
|
-
theme: Theme;
|
|
5
|
-
setTheme?: React.Dispatch<React.SetStateAction<Theme>>;
|
|
6
|
-
}>;
|
|
2
|
+
import { CustomizedProps } from "../types/index";
|
|
7
3
|
export interface ThemeProviderProps {
|
|
8
|
-
|
|
4
|
+
theme?: Theme;
|
|
9
5
|
}
|
|
10
|
-
|
|
6
|
+
declare function ThemeProvider(props: CustomizedProps<Instance, ThemeProviderProps>): JSX.Element;
|
|
11
7
|
export default ThemeProvider;
|
|
@@ -2,33 +2,27 @@
|
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
4
|
local React = _react
|
|
5
|
+
local StrictMode = _react.StrictMode
|
|
5
6
|
local useEffect = _react.useEffect
|
|
6
|
-
local
|
|
7
|
-
local useState = _react.useState
|
|
7
|
+
local ReflexProvider = TS.import(script, TS.getModule(script, "@rbxts", "react-reflex")).ReflexProvider
|
|
8
8
|
local DEFAULT_THEME = TS.import(script, script.Parent.Parent, "constants").DEFAULT_THEME
|
|
9
|
-
local
|
|
10
|
-
theme = DEFAULT_THEME,
|
|
11
|
-
})
|
|
9
|
+
local themeProducer = TS.import(script, script.Parent, "ThemeProducer").themeProducer
|
|
12
10
|
local function ThemeProvider(props)
|
|
13
11
|
local _binding = props
|
|
14
|
-
local
|
|
15
|
-
|
|
12
|
+
local theme = _binding.theme
|
|
13
|
+
if theme == nil then
|
|
14
|
+
theme = DEFAULT_THEME
|
|
15
|
+
end
|
|
16
|
+
local children = _binding.children
|
|
17
|
+
-- When theme prop changes
|
|
16
18
|
useEffect(function()
|
|
17
|
-
setTheme(
|
|
18
|
-
end, { initialTheme })
|
|
19
|
-
local memoizedValue = useMemo(function()
|
|
20
|
-
return {
|
|
21
|
-
theme = theme,
|
|
22
|
-
setTheme = setTheme,
|
|
23
|
-
}
|
|
19
|
+
themeProducer.setTheme(theme)
|
|
24
20
|
end, { theme })
|
|
25
|
-
return React.createElement(
|
|
26
|
-
|
|
27
|
-
},
|
|
21
|
+
return React.createElement(StrictMode, nil, React.createElement(ReflexProvider, {
|
|
22
|
+
producer = themeProducer,
|
|
23
|
+
}, children))
|
|
28
24
|
end
|
|
29
25
|
local default = ThemeProvider
|
|
30
26
|
return {
|
|
31
|
-
ThemeProvider = ThemeProvider,
|
|
32
|
-
ThemeContext = ThemeContext,
|
|
33
27
|
default = default,
|
|
34
28
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { Theme } from "../interfaces/index";
|
|
2
|
+
declare const useTheme: () => {
|
|
3
|
+
theme: Theme;
|
|
4
|
+
setTheme: (theme: Theme) => void;
|
|
4
5
|
};
|
|
6
|
+
export default useTheme;
|
|
@@ -1,10 +1,26 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
4
|
-
local
|
|
5
|
-
local
|
|
6
|
-
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local useCallback = _react.useCallback
|
|
5
|
+
local useMemo = _react.useMemo
|
|
6
|
+
local useState = _react.useState
|
|
7
|
+
local themeProducer = TS.import(script, script.Parent.Parent, "context", "ThemeProducer").themeProducer
|
|
8
|
+
local useTheme = function()
|
|
9
|
+
local theme, setTheme = useState(themeProducer:getState())
|
|
10
|
+
themeProducer:subscribe(function(state, _previousState)
|
|
11
|
+
setTheme(state)
|
|
12
|
+
end)
|
|
13
|
+
local setProducerTheme = useCallback(function(t)
|
|
14
|
+
themeProducer.setTheme(t)
|
|
15
|
+
end, { setTheme })
|
|
16
|
+
return useMemo(function()
|
|
17
|
+
return {
|
|
18
|
+
theme = theme,
|
|
19
|
+
setTheme = setProducerTheme,
|
|
20
|
+
}
|
|
21
|
+
end, { theme, setTheme })
|
|
7
22
|
end
|
|
23
|
+
local default = useTheme
|
|
8
24
|
return {
|
|
9
|
-
default =
|
|
25
|
+
default = default,
|
|
10
26
|
}
|
package/out/theme/index.d.ts
CHANGED
|
@@ -3,17 +3,12 @@ export * from "./constants/index";
|
|
|
3
3
|
export { DEFAULT_THEME } from "./constants/index";
|
|
4
4
|
export * from "./context/index";
|
|
5
5
|
export { ThemeProvider } from "./context/index";
|
|
6
|
-
export { ThemeContext } from "./context/index";
|
|
7
|
-
export * from "./enums/index";
|
|
8
6
|
export { useTheme } from "./hooks/index";
|
|
9
7
|
export * from "./interfaces/index";
|
|
10
8
|
export * from "./styles/index";
|
|
11
9
|
export * from "./themes/index";
|
|
12
10
|
export { default as DarkTheme } from "./themes/DarkTheme";
|
|
13
11
|
export { default as LightTheme } from "./themes/LightTheme";
|
|
14
|
-
export { ThemeState } from "./types/index";
|
|
15
|
-
export { ThemeAction } from "./types/index";
|
|
16
|
-
export { ThemeDispatch } from "./types/index";
|
|
17
12
|
export { CommonProps } from "./types/index";
|
|
18
13
|
export { BaseDefaultProps } from "./types/index";
|
|
19
14
|
export { BaseCustomizedProps } from "./types/index";
|
package/out/theme/init.luau
CHANGED
|
@@ -9,10 +9,6 @@ for _k, _v in TS.import(script, script, "context") or {} do
|
|
|
9
9
|
exports[_k] = _v
|
|
10
10
|
end
|
|
11
11
|
exports.ThemeProvider = TS.import(script, script, "context").ThemeProvider
|
|
12
|
-
exports.ThemeContext = TS.import(script, script, "context").ThemeContext
|
|
13
|
-
for _k, _v in TS.import(script, script, "enums") or {} do
|
|
14
|
-
exports[_k] = _v
|
|
15
|
-
end
|
|
16
12
|
exports.useTheme = TS.import(script, script, "hooks").useTheme
|
|
17
13
|
for _k, _v in TS.import(script, script, "interfaces") or {} do
|
|
18
14
|
exports[_k] = _v
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./ThemeActionTypes";
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { ThemeActionTypes } from "../enums/index";
|
|
2
|
-
import { Theme } from "../interfaces/index";
|
|
3
|
-
export interface ThemeState {
|
|
4
|
-
theme: Theme;
|
|
5
|
-
}
|
|
6
|
-
export type ThemeAction = {
|
|
7
|
-
type: ThemeActionTypes.Hydrate;
|
|
8
|
-
theme?: Theme;
|
|
9
|
-
} | {
|
|
10
|
-
type: ThemeActionTypes.SetTheme;
|
|
11
|
-
theme: Theme;
|
|
12
|
-
};
|
|
13
|
-
export type ThemeDispatch = React.Dispatch<ThemeAction>;
|