@rbxts/react-clean-ui 1.0.5
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 +3 -0
- package/out/Components/Decorator/BoxShadow.d.ts +10 -0
- package/out/Components/Decorator/BoxShadow.luau +41 -0
- package/out/Components/Decorator/Corners.d.ts +7 -0
- package/out/Components/Decorator/Corners.luau +15 -0
- package/out/Components/Decorator/Padding.d.ts +3 -0
- package/out/Components/Decorator/Padding.luau +18 -0
- package/out/Components/Decorator/index.d.ts +3 -0
- package/out/Components/Decorator/init.luau +13 -0
- package/out/Components/Input/Button.d.ts +24 -0
- package/out/Components/Input/Button.luau +159 -0
- package/out/Components/Input/Checkbox.d.ts +12 -0
- package/out/Components/Input/Checkbox.luau +79 -0
- package/out/Components/Input/HoverButton.d.ts +16 -0
- package/out/Components/Input/HoverButton.luau +127 -0
- package/out/Components/Input/Input.d.ts +12 -0
- package/out/Components/Input/Input.luau +92 -0
- package/out/Components/Input/Select.d.ts +30 -0
- package/out/Components/Input/Select.luau +288 -0
- package/out/Components/Input/Slider.d.ts +51 -0
- package/out/Components/Input/Slider.luau +415 -0
- package/out/Components/Input/index.d.ts +6 -0
- package/out/Components/Input/init.luau +22 -0
- package/out/Components/Layout/Column.d.ts +13 -0
- package/out/Components/Layout/Column.luau +60 -0
- package/out/Components/Layout/Container.d.ts +6 -0
- package/out/Components/Layout/Container.luau +73 -0
- package/out/Components/Layout/Draggable.d.ts +46 -0
- package/out/Components/Layout/Draggable.luau +315 -0
- package/out/Components/Layout/Droppable.d.ts +10 -0
- package/out/Components/Layout/Droppable.luau +34 -0
- package/out/Components/Layout/Fieldset.d.ts +34 -0
- package/out/Components/Layout/Fieldset.luau +130 -0
- package/out/Components/Layout/FlexItem.d.ts +11 -0
- package/out/Components/Layout/FlexItem.luau +20 -0
- package/out/Components/Layout/Group.d.ts +34 -0
- package/out/Components/Layout/Group.luau +168 -0
- package/out/Components/Layout/HStack.d.ts +12 -0
- package/out/Components/Layout/HStack.luau +21 -0
- package/out/Components/Layout/Row.d.ts +15 -0
- package/out/Components/Layout/Row.luau +87 -0
- package/out/Components/Layout/Scroller.d.ts +7 -0
- package/out/Components/Layout/Scroller.luau +54 -0
- package/out/Components/Layout/Tabs.d.ts +31 -0
- package/out/Components/Layout/Tabs.luau +189 -0
- package/out/Components/Layout/VStack.d.ts +11 -0
- package/out/Components/Layout/VStack.luau +21 -0
- package/out/Components/Layout/index.d.ts +12 -0
- package/out/Components/Layout/init.luau +40 -0
- package/out/Components/Navigation/Menu.d.ts +19 -0
- package/out/Components/Navigation/Menu.luau +91 -0
- package/out/Components/Navigation/index.d.ts +1 -0
- package/out/Components/Navigation/init.luau +7 -0
- package/out/Components/Surface/Box.d.ts +7 -0
- package/out/Components/Surface/Box.luau +50 -0
- package/out/Components/Surface/Card.d.ts +25 -0
- package/out/Components/Surface/Card.luau +138 -0
- package/out/Components/Surface/Icon.d.ts +10 -0
- package/out/Components/Surface/Icon.luau +64 -0
- package/out/Components/Surface/Panel.d.ts +4 -0
- package/out/Components/Surface/Panel.luau +33 -0
- package/out/Components/Surface/index.d.ts +4 -0
- package/out/Components/Surface/init.luau +16 -0
- package/out/Components/Typography/Text.d.ts +18 -0
- package/out/Components/Typography/Text.luau +48 -0
- package/out/Components/Typography/index.d.ts +1 -0
- package/out/Components/Typography/init.luau +7 -0
- package/out/Components/index.d.ts +8 -0
- package/out/Components/init.luau +28 -0
- package/out/Contexts/draggable.context.d.ts +8 -0
- package/out/Contexts/draggable.context.luau +7 -0
- package/out/Contexts/droppable.context.d.ts +6 -0
- package/out/Contexts/droppable.context.luau +7 -0
- package/out/Contexts/index.d.ts +6 -0
- package/out/Contexts/init.luau +22 -0
- package/out/Contexts/navigation.context.d.ts +5 -0
- package/out/Contexts/navigation.context.luau +9 -0
- package/out/Contexts/overlay.context.d.ts +13 -0
- package/out/Contexts/overlay.context.luau +17 -0
- package/out/Contexts/row.context.d.ts +9 -0
- package/out/Contexts/row.context.luau +12 -0
- package/out/Contexts/theme.context.d.ts +3 -0
- package/out/Contexts/theme.context.luau +8 -0
- package/out/Helpers/breakpoint.helper.d.ts +7 -0
- package/out/Helpers/breakpoint.helper.luau +124 -0
- package/out/Helpers/color.helper.d.ts +5 -0
- package/out/Helpers/color.helper.luau +101 -0
- package/out/Helpers/create-ui-story.d.ts +16 -0
- package/out/Helpers/create-ui-story.luau +38 -0
- package/out/Helpers/css.helper.d.ts +12 -0
- package/out/Helpers/css.helper.luau +114 -0
- package/out/Helpers/gui.helper.d.ts +10 -0
- package/out/Helpers/gui.helper.luau +134 -0
- package/out/Helpers/index.d.ts +8 -0
- package/out/Helpers/init.luau +28 -0
- package/out/Helpers/size.helper.d.ts +14 -0
- package/out/Helpers/size.helper.luau +162 -0
- package/out/Helpers/spacing.helper.d.ts +7 -0
- package/out/Helpers/spacing.helper.luau +57 -0
- package/out/Helpers/typography.helper.d.ts +7 -0
- package/out/Helpers/typography.helper.luau +91 -0
- package/out/Interfaces/clean.element.props.d.ts +109 -0
- package/out/Interfaces/clean.element.props.luau +5 -0
- package/out/Interfaces/icon.d.ts +2 -0
- package/out/Interfaces/icon.luau +2 -0
- package/out/Interfaces/index.d.ts +3 -0
- package/out/Interfaces/init.luau +13 -0
- package/out/Interfaces/userinput.d.ts +22 -0
- package/out/Interfaces/userinput.luau +8 -0
- package/out/Providers/index.d.ts +3 -0
- package/out/Providers/init.luau +13 -0
- package/out/Providers/overlay.provider.d.ts +3 -0
- package/out/Providers/overlay.provider.luau +25 -0
- package/out/Providers/registry.provider.d.ts +33 -0
- package/out/Providers/registry.provider.luau +119 -0
- package/out/Providers/theme.provider.d.ts +8 -0
- package/out/Providers/theme.provider.luau +12 -0
- package/out/Theme/CleanTheme.d.ts +169 -0
- package/out/Theme/CleanTheme.luau +2 -0
- package/out/Theme/DefaultIcons.d.ts +2 -0
- package/out/Theme/DefaultIcons.luau +791 -0
- package/out/Theme/index.d.ts +3 -0
- package/out/Theme/init.luau +13 -0
- package/out/Theme/themes/dark.theme.d.ts +2 -0
- package/out/Theme/themes/dark.theme.luau +345 -0
- package/out/Theme/themes/default.theme.d.ts +2 -0
- package/out/Theme/themes/default.theme.luau +403 -0
- package/out/Theme/themes/index.d.ts +3 -0
- package/out/Theme/themes/init.luau +13 -0
- package/out/Theme/themes/sandstone.theme.d.ts +2 -0
- package/out/Theme/themes/sandstone.theme.luau +345 -0
- package/out/index.d.ts +6 -0
- package/out/init.luau +22 -0
- package/package.json +43 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local NavigationContext = React.createContext({
|
|
5
|
+
collapsed = false,
|
|
6
|
+
})
|
|
7
|
+
return {
|
|
8
|
+
NavigationContext = NavigationContext,
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
export interface OverlayContextValue {
|
|
3
|
+
overlay?: Frame;
|
|
4
|
+
}
|
|
5
|
+
export declare const OverlayContext: React.Context<OverlayContextValue>;
|
|
6
|
+
export interface OverlayProviderProps {
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
}
|
|
9
|
+
interface OverlayConsumerProps {
|
|
10
|
+
render: (overlay: Frame | undefined) => React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare function OverlayConsumer(props: OverlayConsumerProps): React.ReactNode;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local OverlayContext = React.createContext({})
|
|
5
|
+
local function OverlayConsumer(props)
|
|
6
|
+
local overlayContext = React.useContext(OverlayContext)
|
|
7
|
+
local _props = props
|
|
8
|
+
local _result = overlayContext
|
|
9
|
+
if _result ~= nil then
|
|
10
|
+
_result = _result.overlay
|
|
11
|
+
end
|
|
12
|
+
return _props.render(_result)
|
|
13
|
+
end
|
|
14
|
+
return {
|
|
15
|
+
OverlayConsumer = OverlayConsumer,
|
|
16
|
+
OverlayContext = OverlayContext,
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import { Breakpoint } from "../Interfaces/clean.element.props";
|
|
3
|
+
export interface RowContextValue {
|
|
4
|
+
width: number;
|
|
5
|
+
breakpoint: Breakpoint;
|
|
6
|
+
padding: UDim;
|
|
7
|
+
children: number;
|
|
8
|
+
}
|
|
9
|
+
export declare const RowContext: React.Context<RowContextValue>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local RowContext = React.createContext({
|
|
5
|
+
width = 0,
|
|
6
|
+
padding = UDim.new(0, 0),
|
|
7
|
+
breakpoint = "xl",
|
|
8
|
+
children = 0,
|
|
9
|
+
})
|
|
10
|
+
return {
|
|
11
|
+
RowContext = RowContext,
|
|
12
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local DefaultTheme = TS.import(script, script.Parent.Parent, "Theme", "themes", "default.theme").DefaultTheme
|
|
5
|
+
local CleanThemeContext = React.createContext(DefaultTheme)
|
|
6
|
+
return {
|
|
7
|
+
CleanThemeContext = CleanThemeContext,
|
|
8
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Breakpoint, BreakpointValue } from "../Interfaces/";
|
|
2
|
+
export declare class BreakpointHelper {
|
|
3
|
+
private static readonly breakpointOrder;
|
|
4
|
+
static getValue<T>(breakpoint: Breakpoint, value?: BreakpointValue<T>): T | undefined;
|
|
5
|
+
static compare(left: Breakpoint, operator: ">" | ">=" | "<" | "<=" | "==" | "!=", right: Breakpoint): boolean;
|
|
6
|
+
static getBreakpoint(width: number, breakpoints: BreakpointValue<number>): Breakpoint;
|
|
7
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local BreakpointHelper
|
|
3
|
+
do
|
|
4
|
+
BreakpointHelper = setmetatable({}, {
|
|
5
|
+
__tostring = function()
|
|
6
|
+
return "BreakpointHelper"
|
|
7
|
+
end,
|
|
8
|
+
})
|
|
9
|
+
BreakpointHelper.__index = BreakpointHelper
|
|
10
|
+
function BreakpointHelper.new(...)
|
|
11
|
+
local self = setmetatable({}, BreakpointHelper)
|
|
12
|
+
return self:constructor(...) or self
|
|
13
|
+
end
|
|
14
|
+
function BreakpointHelper:constructor()
|
|
15
|
+
end
|
|
16
|
+
function BreakpointHelper:getValue(breakpoint, value)
|
|
17
|
+
if value == nil then
|
|
18
|
+
return nil
|
|
19
|
+
end
|
|
20
|
+
repeat
|
|
21
|
+
local _fallthrough = false
|
|
22
|
+
if breakpoint == "xl" then
|
|
23
|
+
local _condition = value.xl
|
|
24
|
+
if _condition == nil then
|
|
25
|
+
_condition = value.lg
|
|
26
|
+
if _condition == nil then
|
|
27
|
+
_condition = value.md
|
|
28
|
+
if _condition == nil then
|
|
29
|
+
_condition = value.sm
|
|
30
|
+
if _condition == nil then
|
|
31
|
+
_condition = value.xs
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
return _condition
|
|
37
|
+
end
|
|
38
|
+
if breakpoint == "lg" then
|
|
39
|
+
local _condition = value.lg
|
|
40
|
+
if _condition == nil then
|
|
41
|
+
_condition = value.md
|
|
42
|
+
if _condition == nil then
|
|
43
|
+
_condition = value.sm
|
|
44
|
+
if _condition == nil then
|
|
45
|
+
_condition = value.xs
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
return _condition
|
|
50
|
+
end
|
|
51
|
+
if breakpoint == "md" then
|
|
52
|
+
local _condition = value.md
|
|
53
|
+
if _condition == nil then
|
|
54
|
+
_condition = value.sm
|
|
55
|
+
if _condition == nil then
|
|
56
|
+
_condition = value.xs
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
return _condition
|
|
60
|
+
end
|
|
61
|
+
if breakpoint == "sm" then
|
|
62
|
+
local _condition = value.sm
|
|
63
|
+
if _condition == nil then
|
|
64
|
+
_condition = value.xs
|
|
65
|
+
end
|
|
66
|
+
return _condition
|
|
67
|
+
end
|
|
68
|
+
if breakpoint == "xs" then
|
|
69
|
+
end
|
|
70
|
+
return value.xs
|
|
71
|
+
until true
|
|
72
|
+
end
|
|
73
|
+
function BreakpointHelper:compare(left, operator, right)
|
|
74
|
+
local a = BreakpointHelper.breakpointOrder[left]
|
|
75
|
+
local b = BreakpointHelper.breakpointOrder[right]
|
|
76
|
+
repeat
|
|
77
|
+
local _fallthrough = false
|
|
78
|
+
if operator == ">" then
|
|
79
|
+
return a > b
|
|
80
|
+
end
|
|
81
|
+
if operator == ">=" then
|
|
82
|
+
return a >= b
|
|
83
|
+
end
|
|
84
|
+
if operator == "<" then
|
|
85
|
+
return a < b
|
|
86
|
+
end
|
|
87
|
+
if operator == "<=" then
|
|
88
|
+
return a <= b
|
|
89
|
+
end
|
|
90
|
+
if operator == "!=" then
|
|
91
|
+
return a ~= b
|
|
92
|
+
end
|
|
93
|
+
if operator == "==" then
|
|
94
|
+
end
|
|
95
|
+
return a == b
|
|
96
|
+
until true
|
|
97
|
+
end
|
|
98
|
+
function BreakpointHelper:getBreakpoint(width, breakpoints)
|
|
99
|
+
local active = "xs"
|
|
100
|
+
if breakpoints.sm ~= nil and width >= breakpoints.sm then
|
|
101
|
+
active = "sm"
|
|
102
|
+
end
|
|
103
|
+
if breakpoints.md ~= nil and width >= breakpoints.md then
|
|
104
|
+
active = "md"
|
|
105
|
+
end
|
|
106
|
+
if breakpoints.lg ~= nil and width >= breakpoints.lg then
|
|
107
|
+
active = "lg"
|
|
108
|
+
end
|
|
109
|
+
if breakpoints.xl ~= nil and width >= breakpoints.xl then
|
|
110
|
+
active = "xl"
|
|
111
|
+
end
|
|
112
|
+
return active
|
|
113
|
+
end
|
|
114
|
+
BreakpointHelper.breakpointOrder = {
|
|
115
|
+
xs = 0,
|
|
116
|
+
sm = 1,
|
|
117
|
+
md = 2,
|
|
118
|
+
lg = 3,
|
|
119
|
+
xl = 4,
|
|
120
|
+
}
|
|
121
|
+
end
|
|
122
|
+
return {
|
|
123
|
+
BreakpointHelper = BreakpointHelper,
|
|
124
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CleanTheme, InlineIntentColors, IntentScheme } from "../Theme";
|
|
2
|
+
import { ButtonFlag, Intent } from "../Interfaces";
|
|
3
|
+
export declare class ColorHelper {
|
|
4
|
+
static getIntentColors(theme: CleanTheme, intent: Intent | undefined, state?: ButtonFlag, componentColors?: Partial<Record<Intent, InlineIntentColors>>): IntentScheme;
|
|
5
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local ColorHelper
|
|
3
|
+
do
|
|
4
|
+
ColorHelper = setmetatable({}, {
|
|
5
|
+
__tostring = function()
|
|
6
|
+
return "ColorHelper"
|
|
7
|
+
end,
|
|
8
|
+
})
|
|
9
|
+
ColorHelper.__index = ColorHelper
|
|
10
|
+
function ColorHelper.new(...)
|
|
11
|
+
local self = setmetatable({}, ColorHelper)
|
|
12
|
+
return self:constructor(...) or self
|
|
13
|
+
end
|
|
14
|
+
function ColorHelper:constructor()
|
|
15
|
+
end
|
|
16
|
+
function ColorHelper:getIntentColors(theme, intent, state, componentColors)
|
|
17
|
+
if state == nil then
|
|
18
|
+
state = "default"
|
|
19
|
+
end
|
|
20
|
+
local selectedIntent = intent or "primary"
|
|
21
|
+
local defaultPrimary = theme.colors.intents.primary
|
|
22
|
+
local defaultMatching = theme.colors.intents[selectedIntent]
|
|
23
|
+
local _componentPrimary = componentColors
|
|
24
|
+
if _componentPrimary ~= nil then
|
|
25
|
+
_componentPrimary = _componentPrimary.primary
|
|
26
|
+
end
|
|
27
|
+
local componentPrimary = _componentPrimary
|
|
28
|
+
local _componentMatching = componentColors
|
|
29
|
+
if _componentMatching ~= nil then
|
|
30
|
+
_componentMatching = _componentMatching[selectedIntent]
|
|
31
|
+
end
|
|
32
|
+
local componentMatching = _componentMatching
|
|
33
|
+
local _object = table.clone(defaultPrimary.default)
|
|
34
|
+
setmetatable(_object, nil)
|
|
35
|
+
local _condition = defaultPrimary[state]
|
|
36
|
+
if _condition == nil then
|
|
37
|
+
_condition = {}
|
|
38
|
+
end
|
|
39
|
+
for _k, _v in _condition do
|
|
40
|
+
_object[_k] = _v
|
|
41
|
+
end
|
|
42
|
+
for _k, _v in defaultMatching.default do
|
|
43
|
+
_object[_k] = _v
|
|
44
|
+
end
|
|
45
|
+
local _condition_1 = defaultMatching[state]
|
|
46
|
+
if _condition_1 == nil then
|
|
47
|
+
_condition_1 = {}
|
|
48
|
+
end
|
|
49
|
+
for _k, _v in _condition_1 do
|
|
50
|
+
_object[_k] = _v
|
|
51
|
+
end
|
|
52
|
+
local _result = componentPrimary
|
|
53
|
+
if _result ~= nil then
|
|
54
|
+
_result = _result.default
|
|
55
|
+
end
|
|
56
|
+
local _condition_2 = _result
|
|
57
|
+
if _condition_2 == nil then
|
|
58
|
+
_condition_2 = {}
|
|
59
|
+
end
|
|
60
|
+
for _k, _v in _condition_2 do
|
|
61
|
+
_object[_k] = _v
|
|
62
|
+
end
|
|
63
|
+
local _result_1 = componentPrimary
|
|
64
|
+
if _result_1 ~= nil then
|
|
65
|
+
_result_1 = _result_1[state]
|
|
66
|
+
end
|
|
67
|
+
local _condition_3 = _result_1
|
|
68
|
+
if _condition_3 == nil then
|
|
69
|
+
_condition_3 = {}
|
|
70
|
+
end
|
|
71
|
+
for _k, _v in _condition_3 do
|
|
72
|
+
_object[_k] = _v
|
|
73
|
+
end
|
|
74
|
+
local _result_2 = componentMatching
|
|
75
|
+
if _result_2 ~= nil then
|
|
76
|
+
_result_2 = _result_2.default
|
|
77
|
+
end
|
|
78
|
+
local _condition_4 = _result_2
|
|
79
|
+
if _condition_4 == nil then
|
|
80
|
+
_condition_4 = {}
|
|
81
|
+
end
|
|
82
|
+
for _k, _v in _condition_4 do
|
|
83
|
+
_object[_k] = _v
|
|
84
|
+
end
|
|
85
|
+
local _result_3 = componentMatching
|
|
86
|
+
if _result_3 ~= nil then
|
|
87
|
+
_result_3 = _result_3[state]
|
|
88
|
+
end
|
|
89
|
+
local _condition_5 = _result_3
|
|
90
|
+
if _condition_5 == nil then
|
|
91
|
+
_condition_5 = {}
|
|
92
|
+
end
|
|
93
|
+
for _k, _v in _condition_5 do
|
|
94
|
+
_object[_k] = _v
|
|
95
|
+
end
|
|
96
|
+
return _object
|
|
97
|
+
end
|
|
98
|
+
end
|
|
99
|
+
return {
|
|
100
|
+
ColorHelper = ColorHelper,
|
|
101
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from "@rbxts/react";
|
|
2
|
+
import ReactRoblox from "@rbxts/react-roblox";
|
|
3
|
+
import { InferProps } from "@rbxts/ui-labs";
|
|
4
|
+
declare const controls: {
|
|
5
|
+
Theme: import("@rbxts/ui-labs/src/ControlTypings/Advanced").AdvancedTypes.Choose<"Default" | "Dark" | "Sandstone">;
|
|
6
|
+
};
|
|
7
|
+
type StoryProps = InferProps<typeof controls>;
|
|
8
|
+
export declare function createStory(render: (props: StoryProps) => React.ReactNode): {
|
|
9
|
+
react: typeof React;
|
|
10
|
+
reactRoblox: typeof ReactRoblox;
|
|
11
|
+
controls: {
|
|
12
|
+
Theme: import("@rbxts/ui-labs/src/ControlTypings/Advanced").AdvancedTypes.Choose<"Default" | "Dark" | "Sandstone">;
|
|
13
|
+
};
|
|
14
|
+
story: (props: StoryProps) => React.JSX.Element;
|
|
15
|
+
};
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local ReactRoblox = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox"))
|
|
5
|
+
local _Theme = TS.import(script, script.Parent.Parent, "Theme")
|
|
6
|
+
local DarkTheme = _Theme.DarkTheme
|
|
7
|
+
local DefaultTheme = _Theme.DefaultTheme
|
|
8
|
+
local SandstoneTheme = _Theme.SandstoneTheme
|
|
9
|
+
local Choose = TS.import(script, TS.getModule(script, "@rbxts", "ui-labs").src).Choose
|
|
10
|
+
local _ = TS.import(script, script.Parent.Parent, "Providers")
|
|
11
|
+
local OverlayProvider = _.OverlayProvider
|
|
12
|
+
local ThemeProvider = _.ThemeProvider
|
|
13
|
+
local RegistryProvider = TS.import(script, script.Parent.Parent, "Providers", "registry.provider").RegistryProvider
|
|
14
|
+
local controls = {
|
|
15
|
+
Theme = Choose({ "Default", "Dark", "Sandstone" }),
|
|
16
|
+
}
|
|
17
|
+
local function createStory(render)
|
|
18
|
+
return {
|
|
19
|
+
react = React,
|
|
20
|
+
reactRoblox = ReactRoblox,
|
|
21
|
+
controls = controls,
|
|
22
|
+
story = function(props)
|
|
23
|
+
local theme = DefaultTheme
|
|
24
|
+
if props.controls.Theme == "Dark" then
|
|
25
|
+
theme = DarkTheme
|
|
26
|
+
end
|
|
27
|
+
if props.controls.Theme == "Sandstone" then
|
|
28
|
+
theme = SandstoneTheme
|
|
29
|
+
end
|
|
30
|
+
return React.createElement(RegistryProvider, nil, React.createElement(ThemeProvider, {
|
|
31
|
+
theme = theme,
|
|
32
|
+
}, React.createElement(OverlayProvider, nil, render(props))))
|
|
33
|
+
end,
|
|
34
|
+
}
|
|
35
|
+
end
|
|
36
|
+
return {
|
|
37
|
+
createStory = createStory,
|
|
38
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CssShadow, CssSize } from "../Interfaces/clean.element.props";
|
|
2
|
+
interface ParsedShadow {
|
|
3
|
+
offset: UDim2;
|
|
4
|
+
blurRadius: UDim;
|
|
5
|
+
spread: UDim2;
|
|
6
|
+
}
|
|
7
|
+
export declare class CssHelper {
|
|
8
|
+
static parseCssShadow(value: CssShadow): ParsedShadow | undefined;
|
|
9
|
+
private static isZero;
|
|
10
|
+
static parseCssSize(value: CssSize): UDim;
|
|
11
|
+
}
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local CssHelper
|
|
3
|
+
do
|
|
4
|
+
CssHelper = setmetatable({}, {
|
|
5
|
+
__tostring = function()
|
|
6
|
+
return "CssHelper"
|
|
7
|
+
end,
|
|
8
|
+
})
|
|
9
|
+
CssHelper.__index = CssHelper
|
|
10
|
+
function CssHelper.new(...)
|
|
11
|
+
local self = setmetatable({}, CssHelper)
|
|
12
|
+
return self:constructor(...) or self
|
|
13
|
+
end
|
|
14
|
+
function CssHelper:constructor()
|
|
15
|
+
end
|
|
16
|
+
function CssHelper:parseCssShadow(value)
|
|
17
|
+
local _value = value
|
|
18
|
+
if type(_value) == "number" then
|
|
19
|
+
if value == 0 then
|
|
20
|
+
return nil
|
|
21
|
+
end
|
|
22
|
+
local size = self:parseCssSize(value)
|
|
23
|
+
return {
|
|
24
|
+
offset = UDim2.new(size, size),
|
|
25
|
+
blurRadius = UDim.new(0, 0),
|
|
26
|
+
spread = UDim2.new(),
|
|
27
|
+
}
|
|
28
|
+
end
|
|
29
|
+
local _exp = string.split(value, " ")
|
|
30
|
+
-- ▼ ReadonlyArray.filter ▼
|
|
31
|
+
local _newValue = {}
|
|
32
|
+
local _callback = function(part)
|
|
33
|
+
return #part > 0
|
|
34
|
+
end
|
|
35
|
+
local _length = 0
|
|
36
|
+
for _k, _v in _exp do
|
|
37
|
+
if _callback(_v, _k - 1, _exp) == true then
|
|
38
|
+
_length += 1
|
|
39
|
+
_newValue[_length] = _v
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
-- ▲ ReadonlyArray.filter ▲
|
|
43
|
+
local parts = _newValue
|
|
44
|
+
local _self = self
|
|
45
|
+
local _condition = parts[1]
|
|
46
|
+
if _condition == nil then
|
|
47
|
+
_condition = "0"
|
|
48
|
+
end
|
|
49
|
+
local x = _self:parseCssSize(_condition)
|
|
50
|
+
local _self_1 = self
|
|
51
|
+
local _condition_1 = parts[2]
|
|
52
|
+
if _condition_1 == nil then
|
|
53
|
+
_condition_1 = parts[1]
|
|
54
|
+
if _condition_1 == nil then
|
|
55
|
+
_condition_1 = "0"
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
local y = _self_1:parseCssSize(_condition_1)
|
|
59
|
+
local _self_2 = self
|
|
60
|
+
local _condition_2 = parts[3]
|
|
61
|
+
if _condition_2 == nil then
|
|
62
|
+
_condition_2 = "0"
|
|
63
|
+
end
|
|
64
|
+
local blur = _self_2:parseCssSize(_condition_2)
|
|
65
|
+
local _self_3 = self
|
|
66
|
+
local _condition_3 = parts[4]
|
|
67
|
+
if _condition_3 == nil then
|
|
68
|
+
_condition_3 = "0"
|
|
69
|
+
end
|
|
70
|
+
local spread = _self_3:parseCssSize(_condition_3)
|
|
71
|
+
local isZero = self:isZero(x) and self:isZero(y) and self:isZero(blur) and self:isZero(spread)
|
|
72
|
+
if isZero then
|
|
73
|
+
return nil
|
|
74
|
+
end
|
|
75
|
+
return {
|
|
76
|
+
offset = UDim2.new(x, y),
|
|
77
|
+
blurRadius = blur,
|
|
78
|
+
spread = UDim2.new(spread, spread),
|
|
79
|
+
}
|
|
80
|
+
end
|
|
81
|
+
function CssHelper:isZero(value)
|
|
82
|
+
return value.Scale == 0 and value.Offset == 0
|
|
83
|
+
end
|
|
84
|
+
function CssHelper:parseCssSize(value)
|
|
85
|
+
local _value = value
|
|
86
|
+
if type(_value) == "number" then
|
|
87
|
+
return UDim.new(0, value)
|
|
88
|
+
end
|
|
89
|
+
if string.sub(value, -1) == "%" then
|
|
90
|
+
local _condition = tonumber(string.sub(value, 1, -2))
|
|
91
|
+
if _condition == nil then
|
|
92
|
+
_condition = 0
|
|
93
|
+
end
|
|
94
|
+
local amount = _condition
|
|
95
|
+
return UDim.new(amount / 100, 0)
|
|
96
|
+
end
|
|
97
|
+
if string.sub(value, -2) == "px" then
|
|
98
|
+
local _condition = tonumber(string.sub(value, 1, -3))
|
|
99
|
+
if _condition == nil then
|
|
100
|
+
_condition = 0
|
|
101
|
+
end
|
|
102
|
+
local amount = _condition
|
|
103
|
+
return UDim.new(0, amount)
|
|
104
|
+
end
|
|
105
|
+
local _condition = tonumber(value)
|
|
106
|
+
if _condition == nil then
|
|
107
|
+
_condition = 0
|
|
108
|
+
end
|
|
109
|
+
return UDim.new(0, _condition)
|
|
110
|
+
end
|
|
111
|
+
end
|
|
112
|
+
return {
|
|
113
|
+
CssHelper = CssHelper,
|
|
114
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare class GuiHelper {
|
|
2
|
+
static findHighestAncestorOfClass<T extends Instance>(instance: Instance, className: string): T | undefined;
|
|
3
|
+
static printParentTree(instance: Instance): void;
|
|
4
|
+
static isPointInsideGuiObject(guiObject: GuiObject, point: Vector2): boolean;
|
|
5
|
+
static getGuiObjectsAtPosition(instance: Instance, point: Vector2): GuiObject[];
|
|
6
|
+
static getGuiRenderOrder(instance: Instance): GuiObject[];
|
|
7
|
+
private static getGuiRoot;
|
|
8
|
+
private static getRenderSurfaces;
|
|
9
|
+
private static appendGuiObjects;
|
|
10
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
|
|
4
|
+
local Players = _services.Players
|
|
5
|
+
local RunService = _services.RunService
|
|
6
|
+
local GuiHelper
|
|
7
|
+
do
|
|
8
|
+
GuiHelper = setmetatable({}, {
|
|
9
|
+
__tostring = function()
|
|
10
|
+
return "GuiHelper"
|
|
11
|
+
end,
|
|
12
|
+
})
|
|
13
|
+
GuiHelper.__index = GuiHelper
|
|
14
|
+
function GuiHelper.new(...)
|
|
15
|
+
local self = setmetatable({}, GuiHelper)
|
|
16
|
+
return self:constructor(...) or self
|
|
17
|
+
end
|
|
18
|
+
function GuiHelper:constructor()
|
|
19
|
+
end
|
|
20
|
+
function GuiHelper:findHighestAncestorOfClass(instance, className)
|
|
21
|
+
local current = instance
|
|
22
|
+
local highest
|
|
23
|
+
while current do
|
|
24
|
+
if current:IsA(className) then
|
|
25
|
+
highest = current
|
|
26
|
+
end
|
|
27
|
+
current = current.Parent
|
|
28
|
+
end
|
|
29
|
+
return highest
|
|
30
|
+
end
|
|
31
|
+
function GuiHelper:printParentTree(instance)
|
|
32
|
+
local current = instance
|
|
33
|
+
while current ~= nil do
|
|
34
|
+
print(`{current.ClassName}: {current.Name}`)
|
|
35
|
+
current = current.Parent
|
|
36
|
+
end
|
|
37
|
+
end
|
|
38
|
+
function GuiHelper:isPointInsideGuiObject(guiObject, point)
|
|
39
|
+
local position = guiObject.AbsolutePosition
|
|
40
|
+
local size = guiObject.AbsoluteSize
|
|
41
|
+
return point.X >= position.X and point.X <= position.X + size.X and point.Y >= position.Y and point.Y <= position.Y + size.Y
|
|
42
|
+
end
|
|
43
|
+
function GuiHelper:getGuiObjectsAtPosition(instance, point)
|
|
44
|
+
local root = self:findHighestAncestorOfClass(instance, "Frame")
|
|
45
|
+
if root == nil then
|
|
46
|
+
return {}
|
|
47
|
+
end
|
|
48
|
+
local results = {}
|
|
49
|
+
for _, descendant in root:GetDescendants() do
|
|
50
|
+
if descendant:IsA("GuiObject") and descendant.Visible and self:isPointInsideGuiObject(descendant, point) then
|
|
51
|
+
table.insert(results, descendant)
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
table.sort(results, function(a, b)
|
|
55
|
+
return a.ZIndex > b.ZIndex
|
|
56
|
+
end)
|
|
57
|
+
return results
|
|
58
|
+
end
|
|
59
|
+
function GuiHelper:getGuiRenderOrder(instance)
|
|
60
|
+
local result = {}
|
|
61
|
+
for _, surface in self:getRenderSurfaces(self:getGuiRoot(instance)) do
|
|
62
|
+
self:appendGuiObjects(surface.root, result)
|
|
63
|
+
end
|
|
64
|
+
return result
|
|
65
|
+
end
|
|
66
|
+
function GuiHelper:getGuiRoot(instance)
|
|
67
|
+
if RunService:IsRunning() then
|
|
68
|
+
return Players.LocalPlayer:WaitForChild("PlayerGui")
|
|
69
|
+
end
|
|
70
|
+
local r = self:findHighestAncestorOfClass(instance, "PluginGuiService")
|
|
71
|
+
if r == nil then
|
|
72
|
+
error(`No root`)
|
|
73
|
+
end
|
|
74
|
+
return r
|
|
75
|
+
end
|
|
76
|
+
function GuiHelper:getRenderSurfaces(root)
|
|
77
|
+
local surfaces = {}
|
|
78
|
+
local visit
|
|
79
|
+
visit = function(instance)
|
|
80
|
+
for index, child in ipairs(instance:GetChildren()) do
|
|
81
|
+
if child:IsA("LayerCollector") then
|
|
82
|
+
local _arg0 = {
|
|
83
|
+
root = child,
|
|
84
|
+
rootIndex = index,
|
|
85
|
+
}
|
|
86
|
+
table.insert(surfaces, _arg0)
|
|
87
|
+
-- Don't recurse into another render surface.
|
|
88
|
+
continue
|
|
89
|
+
end
|
|
90
|
+
visit(child)
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
visit(root)
|
|
94
|
+
table.sort(surfaces, function(a, b)
|
|
95
|
+
if a.root:IsA("ScreenGui") and b.root:IsA("ScreenGui") then
|
|
96
|
+
if a.root.DisplayOrder ~= b.root.DisplayOrder then
|
|
97
|
+
return a.root.DisplayOrder < b.root.DisplayOrder
|
|
98
|
+
end
|
|
99
|
+
end
|
|
100
|
+
return a.rootIndex < b.rootIndex
|
|
101
|
+
end)
|
|
102
|
+
return surfaces
|
|
103
|
+
end
|
|
104
|
+
function GuiHelper:appendGuiObjects(parent, result)
|
|
105
|
+
local children = {}
|
|
106
|
+
for index, child in ipairs(parent:GetChildren()) do
|
|
107
|
+
if not child:IsA("GuiObject") then
|
|
108
|
+
continue
|
|
109
|
+
end
|
|
110
|
+
local _arg0 = {
|
|
111
|
+
object = child,
|
|
112
|
+
siblingIndex = index,
|
|
113
|
+
}
|
|
114
|
+
table.insert(children, _arg0)
|
|
115
|
+
end
|
|
116
|
+
table.sort(children, function(a, b)
|
|
117
|
+
if a.object.ZIndex ~= b.object.ZIndex then
|
|
118
|
+
return a.object.ZIndex < b.object.ZIndex
|
|
119
|
+
end
|
|
120
|
+
-- Preserve sibling order.
|
|
121
|
+
return a.siblingIndex < b.siblingIndex
|
|
122
|
+
end)
|
|
123
|
+
for _, child in children do
|
|
124
|
+
-- Parent renders before its children.
|
|
125
|
+
local _result = result
|
|
126
|
+
local _object = child.object
|
|
127
|
+
table.insert(_result, _object)
|
|
128
|
+
self:appendGuiObjects(child.object, result)
|
|
129
|
+
end
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
return {
|
|
133
|
+
GuiHelper = GuiHelper,
|
|
134
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './breakpoint.helper';
|
|
2
|
+
export * from './color.helper';
|
|
3
|
+
export * from './create-ui-story';
|
|
4
|
+
export * from './css.helper';
|
|
5
|
+
export * from './gui.helper';
|
|
6
|
+
export * from './size.helper';
|
|
7
|
+
export * from './spacing.helper';
|
|
8
|
+
export * from './typography.helper';
|