@rbxts/centurion-ui 1.0.0-dev-284510d
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/app/app.d.ts +6 -0
- package/out/app/app.lua +83 -0
- package/out/app/index.d.ts +1 -0
- package/out/app/init.lua +7 -0
- package/out/app/terminal-app.d.ts +1 -0
- package/out/app/terminal-app.lua +61 -0
- package/out/components/history/history-line.d.ts +10 -0
- package/out/components/history/history-line.lua +63 -0
- package/out/components/history/history-list.d.ts +15 -0
- package/out/components/history/history-list.lua +62 -0
- package/out/components/history/index.d.ts +1 -0
- package/out/components/history/init.lua +7 -0
- package/out/components/index.d.ts +1 -0
- package/out/components/init.lua +7 -0
- package/out/components/suggestions/badge.d.ts +16 -0
- package/out/components/suggestions/badge.lua +52 -0
- package/out/components/suggestions/index.d.ts +1 -0
- package/out/components/suggestions/init.lua +7 -0
- package/out/components/suggestions/main-suggestion.d.ts +12 -0
- package/out/components/suggestions/main-suggestion.lua +180 -0
- package/out/components/suggestions/suggestion-list.d.ts +8 -0
- package/out/components/suggestions/suggestion-list.lua +70 -0
- package/out/components/suggestions/suggestions.d.ts +1 -0
- package/out/components/suggestions/suggestions.lua +117 -0
- package/out/components/suggestions/types.d.ts +6 -0
- package/out/components/suggestions/types.lua +2 -0
- package/out/components/suggestions/util.d.ts +4 -0
- package/out/components/suggestions/util.lua +72 -0
- package/out/components/terminal-text-field.d.ts +11 -0
- package/out/components/terminal-text-field.lua +289 -0
- package/out/components/terminal-window.d.ts +1 -0
- package/out/components/terminal-window.lua +265 -0
- package/out/components/terminal.d.ts +1 -0
- package/out/components/terminal.lua +26 -0
- package/out/components/ui/frame.d.ts +20 -0
- package/out/components/ui/frame.lua +29 -0
- package/out/components/ui/group.d.ts +17 -0
- package/out/components/ui/group.lua +24 -0
- package/out/components/ui/layer.d.ts +7 -0
- package/out/components/ui/layer.lua +23 -0
- package/out/components/ui/outline.d.ts +14 -0
- package/out/components/ui/outline.lua +106 -0
- package/out/components/ui/padding.d.ts +10 -0
- package/out/components/ui/padding.lua +19 -0
- package/out/components/ui/scrolling-frame.d.ts +15 -0
- package/out/components/ui/scrolling-frame.lua +42 -0
- package/out/components/ui/shortcut-group.d.ts +6 -0
- package/out/components/ui/shortcut-group.lua +100 -0
- package/out/components/ui/text-field.d.ts +13 -0
- package/out/components/ui/text-field.lua +53 -0
- package/out/components/ui/text.d.ts +20 -0
- package/out/components/ui/text.lua +55 -0
- package/out/constants/options.d.ts +2 -0
- package/out/constants/options.lua +19 -0
- package/out/constants/springs.d.ts +19 -0
- package/out/constants/springs.lua +20 -0
- package/out/constants/text.d.ts +3 -0
- package/out/constants/text.lua +9 -0
- package/out/constants/util.d.ts +1 -0
- package/out/constants/util.lua +7 -0
- package/out/hooks/use-motion.d.ts +4 -0
- package/out/hooks/use-motion.lua +24 -0
- package/out/hooks/use-px.d.ts +24 -0
- package/out/hooks/use-px.lua +56 -0
- package/out/hooks/use-store.d.ts +3 -0
- package/out/hooks/use-store.lua +7 -0
- package/out/index.d.ts +2 -0
- package/out/init.lua +10 -0
- package/out/palette.d.ts +56 -0
- package/out/palette.lua +51 -0
- package/out/providers/api-provider.d.ts +8 -0
- package/out/providers/api-provider.lua +17 -0
- package/out/providers/options-provider.d.ts +13 -0
- package/out/providers/options-provider.lua +39 -0
- package/out/providers/root-provider.d.ts +11 -0
- package/out/providers/root-provider.lua +24 -0
- package/out/store/app/app-selectors.d.ts +2 -0
- package/out/store/app/app-selectors.lua +7 -0
- package/out/store/app/app-slice.d.ts +8 -0
- package/out/store/app/app-slice.lua +17 -0
- package/out/store/app/index.d.ts +2 -0
- package/out/store/app/init.lua +10 -0
- package/out/store/command/command-selectors.d.ts +2 -0
- package/out/store/command/command-selectors.lua +7 -0
- package/out/store/command/command-slice.d.ts +15 -0
- package/out/store/command/command-slice.lua +21 -0
- package/out/store/command/index.d.ts +2 -0
- package/out/store/command/init.lua +10 -0
- package/out/store/history/history-slice.d.ts +11 -0
- package/out/store/history/history-slice.lua +52 -0
- package/out/store/history/index.d.ts +1 -0
- package/out/store/history/init.lua +7 -0
- package/out/store/index.d.ts +46 -0
- package/out/store/init.lua +18 -0
- package/out/store/suggestion/index.d.ts +2 -0
- package/out/store/suggestion/init.lua +10 -0
- package/out/store/suggestion/suggestion-selectors.d.ts +2 -0
- package/out/store/suggestion/suggestion-selectors.lua +7 -0
- package/out/store/suggestion/suggestion-slice.d.ts +9 -0
- package/out/store/suggestion/suggestion-slice.lua +15 -0
- package/out/store/text/index.d.ts +2 -0
- package/out/store/text/init.lua +10 -0
- package/out/store/text/text-selectors.d.ts +3 -0
- package/out/store/text/text-selectors.lua +11 -0
- package/out/store/text/text-slice.d.ts +20 -0
- package/out/store/text/text-slice.lua +29 -0
- package/out/types.d.ts +40 -0
- package/out/types.lua +2 -0
- package/out/util/argument.d.ts +2 -0
- package/out/util/argument.lua +26 -0
- package/out/util/suggestion.d.ts +4 -0
- package/out/util/suggestion.lua +208 -0
- package/package.json +54 -0
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _util = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.client.util)
|
|
4
|
+
local getModifierKeyName = _util.getModifierKeyName
|
|
5
|
+
local getShortcutKeycodes = _util.getShortcutKeycodes
|
|
6
|
+
local isModifierKey = _util.isModifierKey
|
|
7
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
8
|
+
local React = _react
|
|
9
|
+
local useContext = _react.useContext
|
|
10
|
+
local useState = _react.useState
|
|
11
|
+
local usePx = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").usePx
|
|
12
|
+
local OptionsContext = TS.import(script, script.Parent.Parent.Parent, "providers", "options-provider").OptionsContext
|
|
13
|
+
local Badge = TS.import(script, script.Parent.Parent, "suggestions", "badge").Badge
|
|
14
|
+
local Frame = TS.import(script, script.Parent, "frame").Frame
|
|
15
|
+
local Padding = TS.import(script, script.Parent, "padding").Padding
|
|
16
|
+
local function Key(props)
|
|
17
|
+
local options = props.options
|
|
18
|
+
local isModifier = isModifierKey(props.keyCode)
|
|
19
|
+
local size, setSize = useState(UDim2.new(0, 24, 0, 24))
|
|
20
|
+
return React.createElement(Frame, {
|
|
21
|
+
backgroundTransparency = 1,
|
|
22
|
+
layoutOrder = if isModifier then -1 else 0,
|
|
23
|
+
automaticSize = "XY",
|
|
24
|
+
}, React.createElement(Badge, {
|
|
25
|
+
color = if isModifier then options.palette.highlight else options.palette.surface,
|
|
26
|
+
text = if isModifier then getModifierKeyName(props.keyCode) else props.keyCode.Name,
|
|
27
|
+
textColor = if isModifier then options.palette.text else options.palette.text,
|
|
28
|
+
textSize = 16,
|
|
29
|
+
size = size,
|
|
30
|
+
onTextBoundsChange = function(textBounds)
|
|
31
|
+
setSize(UDim2.new(0, math.max(24, textBounds.X + 12), 0, 24))
|
|
32
|
+
end,
|
|
33
|
+
backgroundTransparency = if isModifier then 0.5 else 0,
|
|
34
|
+
}, if isModifier then (React.createElement("uistroke", {
|
|
35
|
+
Color = options.palette.highlight,
|
|
36
|
+
Thickness = 1,
|
|
37
|
+
})) else (React.createElement("uistroke", {
|
|
38
|
+
Color = options.palette.subtext,
|
|
39
|
+
Thickness = 1,
|
|
40
|
+
}))))
|
|
41
|
+
end
|
|
42
|
+
local function ShortcutGroup(props)
|
|
43
|
+
local options = useContext(OptionsContext)
|
|
44
|
+
local px = usePx()
|
|
45
|
+
local _exp = React.createElement(Padding, {
|
|
46
|
+
all = UDim.new(0, px(8)),
|
|
47
|
+
})
|
|
48
|
+
local _exp_1 = React.createElement("uilistlayout", {
|
|
49
|
+
HorizontalAlignment = "Left",
|
|
50
|
+
FillDirection = "Vertical",
|
|
51
|
+
Padding = UDim.new(0, 8),
|
|
52
|
+
})
|
|
53
|
+
local _result = props.shortcuts
|
|
54
|
+
if _result ~= nil then
|
|
55
|
+
-- ▼ ReadonlyArray.map ▼
|
|
56
|
+
local _newValue = table.create(#_result)
|
|
57
|
+
local _callback = function(shortcut, index)
|
|
58
|
+
local shortcuts = getShortcutKeycodes(shortcut)
|
|
59
|
+
local _exp_2 = React.createElement("uilistlayout", {
|
|
60
|
+
FillDirection = "Horizontal",
|
|
61
|
+
SortOrder = "LayoutOrder",
|
|
62
|
+
Padding = UDim.new(0, 8),
|
|
63
|
+
})
|
|
64
|
+
-- ▼ ReadonlyArray.map ▼
|
|
65
|
+
local _newValue_1 = table.create(#shortcuts)
|
|
66
|
+
local _callback_1 = function(key)
|
|
67
|
+
return React.createElement(Key, {
|
|
68
|
+
options = options,
|
|
69
|
+
keyCode = key,
|
|
70
|
+
key = string.lower(key.Name),
|
|
71
|
+
})
|
|
72
|
+
end
|
|
73
|
+
for _k, _v in shortcuts do
|
|
74
|
+
_newValue_1[_k] = _callback_1(_v, _k - 1, shortcuts)
|
|
75
|
+
end
|
|
76
|
+
-- ▲ ReadonlyArray.map ▲
|
|
77
|
+
return React.createElement(Frame, {
|
|
78
|
+
automaticSize = "XY",
|
|
79
|
+
backgroundTransparency = 1,
|
|
80
|
+
key = `shortcut-{index}`,
|
|
81
|
+
}, _exp_2, _newValue_1)
|
|
82
|
+
end
|
|
83
|
+
for _k, _v in _result do
|
|
84
|
+
_newValue[_k] = _callback(_v, _k - 1, _result)
|
|
85
|
+
end
|
|
86
|
+
-- ▲ ReadonlyArray.map ▲
|
|
87
|
+
_result = _newValue
|
|
88
|
+
end
|
|
89
|
+
return React.createElement(Frame, {
|
|
90
|
+
backgroundTransparency = options.backgroundTransparency,
|
|
91
|
+
backgroundColor = options.palette.background,
|
|
92
|
+
size = UDim2.new(1, 0, 1, 0),
|
|
93
|
+
position = UDim2.new(1, px(16), 0, -px(8)),
|
|
94
|
+
cornerRadius = UDim.new(0, px(8)),
|
|
95
|
+
automaticSize = "XY",
|
|
96
|
+
}, _exp, _exp_1, _result)
|
|
97
|
+
end
|
|
98
|
+
return {
|
|
99
|
+
ShortcutGroup = ShortcutGroup,
|
|
100
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { BindingOrValue } from "@rbxts/pretty-react-hooks";
|
|
2
|
+
import React from "@rbxts/react";
|
|
3
|
+
import { TextProps } from "./text";
|
|
4
|
+
interface TextFieldProps extends TextProps<TextBox> {
|
|
5
|
+
text?: BindingOrValue<string>;
|
|
6
|
+
placeholderText?: BindingOrValue<string>;
|
|
7
|
+
placeholderColor?: BindingOrValue<Color3>;
|
|
8
|
+
clearTextOnFocus?: BindingOrValue<boolean>;
|
|
9
|
+
multiLine?: BindingOrValue<boolean>;
|
|
10
|
+
textEditable?: BindingOrValue<boolean>;
|
|
11
|
+
}
|
|
12
|
+
export declare const TextField: React.ForwardRefExoticComponent<Omit<TextFieldProps, "ref"> & React.RefAttributes<TextBox>>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local forwardRef = _react.forwardRef
|
|
5
|
+
local useContext = _react.useContext
|
|
6
|
+
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
7
|
+
local OptionsContext = TS.import(script, script.Parent.Parent.Parent, "providers", "options-provider").OptionsContext
|
|
8
|
+
local TextField = forwardRef(function(props, ref)
|
|
9
|
+
local options = useContext(OptionsContext)
|
|
10
|
+
local _attributes = {
|
|
11
|
+
ref = ref,
|
|
12
|
+
PlaceholderText = props.placeholderText,
|
|
13
|
+
PlaceholderColor3 = props.placeholderColor,
|
|
14
|
+
ClearTextOnFocus = props.clearTextOnFocus,
|
|
15
|
+
MultiLine = props.multiLine,
|
|
16
|
+
TextEditable = props.textEditable,
|
|
17
|
+
Font = Enum.Font.Unknown,
|
|
18
|
+
FontFace = props.font or options.font.regular,
|
|
19
|
+
Text = props.text,
|
|
20
|
+
TextColor3 = props.textColor,
|
|
21
|
+
TextSize = props.textSize,
|
|
22
|
+
TextTransparency = props.textTransparency,
|
|
23
|
+
TextTruncate = props.textTruncate,
|
|
24
|
+
TextWrapped = props.textWrapped,
|
|
25
|
+
TextXAlignment = props.textXAlignment,
|
|
26
|
+
TextYAlignment = props.textYAlignment,
|
|
27
|
+
TextScaled = props.textScaled,
|
|
28
|
+
RichText = props.richText,
|
|
29
|
+
AutomaticSize = props.textAutoResize,
|
|
30
|
+
Size = props.size,
|
|
31
|
+
Position = props.position,
|
|
32
|
+
AnchorPoint = props.anchorPoint,
|
|
33
|
+
BackgroundColor3 = props.backgroundColor,
|
|
34
|
+
}
|
|
35
|
+
local _condition = props.backgroundTransparency
|
|
36
|
+
if _condition == nil then
|
|
37
|
+
_condition = 1
|
|
38
|
+
end
|
|
39
|
+
_attributes.BackgroundTransparency = _condition
|
|
40
|
+
_attributes.ClipsDescendants = props.clipsDescendants
|
|
41
|
+
_attributes.Visible = props.visible
|
|
42
|
+
_attributes.ZIndex = props.zIndex
|
|
43
|
+
_attributes.LayoutOrder = props.layoutOrder
|
|
44
|
+
_attributes.BorderSizePixel = 0
|
|
45
|
+
_attributes.Event = props.event or {}
|
|
46
|
+
_attributes.Change = props.change or {}
|
|
47
|
+
return React.createElement("textbox", _attributes, props.cornerRadius and React.createElement("uicorner", {
|
|
48
|
+
CornerRadius = props.cornerRadius,
|
|
49
|
+
}), props.children)
|
|
50
|
+
end)
|
|
51
|
+
return {
|
|
52
|
+
TextField = TextField,
|
|
53
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { BindingOrValue } from "@rbxts/pretty-react-hooks";
|
|
2
|
+
import React from "@rbxts/react";
|
|
3
|
+
import { FrameProps } from "./frame";
|
|
4
|
+
export interface TextProps<T extends Instance = TextLabel> extends FrameProps<T> {
|
|
5
|
+
font?: Font;
|
|
6
|
+
text?: BindingOrValue<string>;
|
|
7
|
+
textColor?: BindingOrValue<Color3>;
|
|
8
|
+
textSize?: BindingOrValue<number>;
|
|
9
|
+
textTransparency?: BindingOrValue<number>;
|
|
10
|
+
textWrapped?: BindingOrValue<boolean>;
|
|
11
|
+
textXAlignment?: React.InferEnumNames<Enum.TextXAlignment>;
|
|
12
|
+
textYAlignment?: React.InferEnumNames<Enum.TextYAlignment>;
|
|
13
|
+
textTruncate?: React.InferEnumNames<Enum.TextTruncate>;
|
|
14
|
+
textScaled?: BindingOrValue<boolean>;
|
|
15
|
+
textHeight?: BindingOrValue<number>;
|
|
16
|
+
textAutoResize?: "X" | "Y" | "XY";
|
|
17
|
+
richText?: BindingOrValue<boolean>;
|
|
18
|
+
maxVisibleGraphemes?: BindingOrValue<number>;
|
|
19
|
+
}
|
|
20
|
+
export declare const Text: React.ForwardRefExoticComponent<Omit<TextProps<TextLabel>, "ref"> & React.RefAttributes<TextLabel>>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local forwardRef = _react.forwardRef
|
|
6
|
+
local useContext = _react.useContext
|
|
7
|
+
local usePx = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").usePx
|
|
8
|
+
local OptionsContext = TS.import(script, script.Parent.Parent.Parent, "providers", "options-provider").OptionsContext
|
|
9
|
+
local Text = forwardRef(function(props, ref)
|
|
10
|
+
local px = usePx()
|
|
11
|
+
local options = useContext(OptionsContext)
|
|
12
|
+
local _attributes = {
|
|
13
|
+
ref = ref,
|
|
14
|
+
Font = Enum.Font.Unknown,
|
|
15
|
+
FontFace = props.font or options.font.regular,
|
|
16
|
+
Text = props.text,
|
|
17
|
+
TextColor3 = props.textColor,
|
|
18
|
+
}
|
|
19
|
+
local _condition = props.textSize
|
|
20
|
+
if _condition == nil then
|
|
21
|
+
_condition = px(16)
|
|
22
|
+
end
|
|
23
|
+
_attributes.TextSize = _condition
|
|
24
|
+
_attributes.TextTransparency = props.textTransparency
|
|
25
|
+
_attributes.TextWrapped = props.textWrapped
|
|
26
|
+
_attributes.TextXAlignment = props.textXAlignment
|
|
27
|
+
_attributes.TextYAlignment = props.textYAlignment
|
|
28
|
+
_attributes.TextTruncate = props.textTruncate
|
|
29
|
+
_attributes.TextScaled = props.textScaled
|
|
30
|
+
_attributes.LineHeight = props.textHeight
|
|
31
|
+
_attributes.RichText = props.richText
|
|
32
|
+
_attributes.MaxVisibleGraphemes = props.maxVisibleGraphemes
|
|
33
|
+
_attributes.Size = props.size
|
|
34
|
+
_attributes.AutomaticSize = props.textAutoResize
|
|
35
|
+
_attributes.Position = props.position
|
|
36
|
+
_attributes.AnchorPoint = props.anchorPoint
|
|
37
|
+
_attributes.BackgroundColor3 = props.backgroundColor
|
|
38
|
+
local _condition_1 = props.backgroundTransparency
|
|
39
|
+
if _condition_1 == nil then
|
|
40
|
+
_condition_1 = 1
|
|
41
|
+
end
|
|
42
|
+
_attributes.BackgroundTransparency = _condition_1
|
|
43
|
+
_attributes.ClipsDescendants = props.clipsDescendants
|
|
44
|
+
_attributes.Visible = props.visible
|
|
45
|
+
_attributes.ZIndex = props.zIndex
|
|
46
|
+
_attributes.LayoutOrder = props.layoutOrder
|
|
47
|
+
_attributes.Change = props.change or {}
|
|
48
|
+
_attributes.Event = props.event or {}
|
|
49
|
+
return React.createElement("textlabel", _attributes, props.cornerRadius and React.createElement("uicorner", {
|
|
50
|
+
CornerRadius = props.cornerRadius,
|
|
51
|
+
}), props.children)
|
|
52
|
+
end)
|
|
53
|
+
return {
|
|
54
|
+
Text = Text,
|
|
55
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local DefaultPalette = TS.import(script, script.Parent.Parent, "palette").DefaultPalette
|
|
4
|
+
local DEFAULT_INTERFACE_OPTIONS = {
|
|
5
|
+
displayOrder = 1000,
|
|
6
|
+
activationKeys = { Enum.KeyCode.F2 },
|
|
7
|
+
hideOnLostFocus = true,
|
|
8
|
+
font = {
|
|
9
|
+
regular = Font.new("rbxassetid://16658221428"),
|
|
10
|
+
medium = Font.new("rbxassetid://16658221428", Enum.FontWeight.Medium),
|
|
11
|
+
bold = Font.new("rbxassetid://16658221428", Enum.FontWeight.Bold),
|
|
12
|
+
},
|
|
13
|
+
palette = DefaultPalette.mocha,
|
|
14
|
+
backgroundTransparency = 0.2,
|
|
15
|
+
showShortcutSuggestions = true,
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
DEFAULT_INTERFACE_OPTIONS = DEFAULT_INTERFACE_OPTIONS,
|
|
19
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SpringOptions } from "@rbxts/ripple";
|
|
2
|
+
export declare const springs: {
|
|
3
|
+
bubbly: {
|
|
4
|
+
tension: number;
|
|
5
|
+
friction: number;
|
|
6
|
+
};
|
|
7
|
+
responsive: {
|
|
8
|
+
tension: number;
|
|
9
|
+
};
|
|
10
|
+
gentle: {
|
|
11
|
+
tension: number;
|
|
12
|
+
friction: number;
|
|
13
|
+
};
|
|
14
|
+
default: SpringOptions;
|
|
15
|
+
wobbly: SpringOptions;
|
|
16
|
+
stiff: SpringOptions;
|
|
17
|
+
slow: SpringOptions;
|
|
18
|
+
molasses: SpringOptions;
|
|
19
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local config = TS.import(script, TS.getModule(script, "@rbxts", "ripple")).config
|
|
4
|
+
local _object = table.clone(config.spring)
|
|
5
|
+
setmetatable(_object, nil)
|
|
6
|
+
_object.bubbly = {
|
|
7
|
+
tension = 400,
|
|
8
|
+
friction = 14,
|
|
9
|
+
}
|
|
10
|
+
_object.responsive = {
|
|
11
|
+
tension = 400,
|
|
12
|
+
}
|
|
13
|
+
_object.gentle = {
|
|
14
|
+
tension = 250,
|
|
15
|
+
friction = 30,
|
|
16
|
+
}
|
|
17
|
+
local springs = _object
|
|
18
|
+
return {
|
|
19
|
+
springs = springs,
|
|
20
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local HISTORY_TEXT_SIZE = 18
|
|
3
|
+
local SUGGESTION_TITLE_TEXT_SIZE = 26
|
|
4
|
+
local SUGGESTION_TEXT_SIZE = 20
|
|
5
|
+
return {
|
|
6
|
+
HISTORY_TEXT_SIZE = HISTORY_TEXT_SIZE,
|
|
7
|
+
SUGGESTION_TITLE_TEXT_SIZE = SUGGESTION_TITLE_TEXT_SIZE,
|
|
8
|
+
SUGGESTION_TEXT_SIZE = SUGGESTION_TEXT_SIZE,
|
|
9
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const IS_EDIT: boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
4
|
+
local IS_EDIT = RunService:IsStudio() and not RunService:IsRunning()
|
|
5
|
+
return {
|
|
6
|
+
IS_EDIT = IS_EDIT,
|
|
7
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { Binding } from "@rbxts/react";
|
|
2
|
+
import { Motion, MotionGoal } from "@rbxts/ripple";
|
|
3
|
+
export declare function useMotion(initialValue: number): LuaTuple<[Binding<number>, Motion]>;
|
|
4
|
+
export declare function useMotion<T extends MotionGoal>(initialValue: T): LuaTuple<[Binding<T>, Motion<T>]>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local useEventListener = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useEventListener
|
|
4
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
5
|
+
local useBinding = _react.useBinding
|
|
6
|
+
local useMemo = _react.useMemo
|
|
7
|
+
local createMotion = TS.import(script, TS.getModule(script, "@rbxts", "ripple")).createMotion
|
|
8
|
+
local RunService = TS.import(script, TS.getModule(script, "@rbxts", "services")).RunService
|
|
9
|
+
local function useMotion(initialValue)
|
|
10
|
+
local motion = useMemo(function()
|
|
11
|
+
return createMotion(initialValue)
|
|
12
|
+
end, {})
|
|
13
|
+
local binding, setValue = useBinding(initialValue)
|
|
14
|
+
useEventListener(RunService.Heartbeat, function(delta)
|
|
15
|
+
local value = motion:step(delta)
|
|
16
|
+
if value ~= binding:getValue() then
|
|
17
|
+
setValue(value)
|
|
18
|
+
end
|
|
19
|
+
end)
|
|
20
|
+
return binding, motion
|
|
21
|
+
end
|
|
22
|
+
return {
|
|
23
|
+
useMotion = useMotion,
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
interface ScaleFunction {
|
|
2
|
+
/**
|
|
3
|
+
* Scales `pixels` based on the current viewport size and rounds the result.
|
|
4
|
+
*/
|
|
5
|
+
(pixels: number): number;
|
|
6
|
+
/**
|
|
7
|
+
* Scales `pixels` and rounds the result to the nearest even number.
|
|
8
|
+
*/
|
|
9
|
+
even: (pixels: number) => number;
|
|
10
|
+
/**
|
|
11
|
+
* Scales a number based on the current viewport size without rounding.
|
|
12
|
+
*/
|
|
13
|
+
scale: (percent: number) => number;
|
|
14
|
+
/**
|
|
15
|
+
* Scales `pixels` and rounds the result down.
|
|
16
|
+
*/
|
|
17
|
+
floor: (pixels: number) => number;
|
|
18
|
+
/**
|
|
19
|
+
* Scales `pixels` and rounds the result up.
|
|
20
|
+
*/
|
|
21
|
+
ceil: (pixels: number) => number;
|
|
22
|
+
}
|
|
23
|
+
export declare function usePx(): ScaleFunction;
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _pretty_react_hooks = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out)
|
|
4
|
+
local useCamera = _pretty_react_hooks.useCamera
|
|
5
|
+
local useDebounceState = _pretty_react_hooks.useDebounceState
|
|
6
|
+
local useEventListener = _pretty_react_hooks.useEventListener
|
|
7
|
+
local useMemo = TS.import(script, TS.getModule(script, "@rbxts", "react")).useMemo
|
|
8
|
+
local BASE_RESOLUTION = Vector2.new(1280, 832)
|
|
9
|
+
local MIN_SCALE = 0.75
|
|
10
|
+
local DOMINANT_AXIS = 0.5
|
|
11
|
+
--[[
|
|
12
|
+
*
|
|
13
|
+
* @see https://discord.com/channels/476080952636997633/476080952636997635/1146857136358432900
|
|
14
|
+
|
|
15
|
+
]]
|
|
16
|
+
local function calculateScale(viewport)
|
|
17
|
+
local width = math.log(viewport.X / BASE_RESOLUTION.X, 2)
|
|
18
|
+
local height = math.log(viewport.Y / BASE_RESOLUTION.Y, 2)
|
|
19
|
+
local centered = width + (height - width) * DOMINANT_AXIS
|
|
20
|
+
return math.max(2 ^ centered, MIN_SCALE)
|
|
21
|
+
end
|
|
22
|
+
local function usePx()
|
|
23
|
+
local camera = useCamera()
|
|
24
|
+
local scale, setScale = useDebounceState(calculateScale(camera.ViewportSize), {
|
|
25
|
+
wait = 0.2,
|
|
26
|
+
leading = true,
|
|
27
|
+
})
|
|
28
|
+
useEventListener(camera:GetPropertyChangedSignal("ViewportSize"), function()
|
|
29
|
+
setScale(calculateScale(camera.ViewportSize))
|
|
30
|
+
end)
|
|
31
|
+
return useMemo(function()
|
|
32
|
+
local api = {
|
|
33
|
+
even = function(value)
|
|
34
|
+
return math.round(value * scale * 0.5) * 2
|
|
35
|
+
end,
|
|
36
|
+
scale = function(value)
|
|
37
|
+
return value * scale
|
|
38
|
+
end,
|
|
39
|
+
floor = function(value)
|
|
40
|
+
return math.floor(value * scale)
|
|
41
|
+
end,
|
|
42
|
+
ceil = function(value)
|
|
43
|
+
return math.ceil(value * scale)
|
|
44
|
+
end,
|
|
45
|
+
}
|
|
46
|
+
setmetatable(api, {
|
|
47
|
+
__call = function(_, value)
|
|
48
|
+
return math.round(value * scale)
|
|
49
|
+
end,
|
|
50
|
+
})
|
|
51
|
+
return api
|
|
52
|
+
end, { scale })
|
|
53
|
+
end
|
|
54
|
+
return {
|
|
55
|
+
usePx = usePx,
|
|
56
|
+
}
|
package/out/index.d.ts
ADDED
package/out/init.lua
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local exports = {}
|
|
4
|
+
for _k, _v in TS.import(script, script, "app") or {} do
|
|
5
|
+
exports[_k] = _v
|
|
6
|
+
end
|
|
7
|
+
for _k, _v in TS.import(script, script, "palette") or {} do
|
|
8
|
+
exports[_k] = _v
|
|
9
|
+
end
|
|
10
|
+
return exports
|
package/out/palette.d.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export interface InterfacePalette {
|
|
2
|
+
background: Color3;
|
|
3
|
+
surface: Color3;
|
|
4
|
+
text: Color3;
|
|
5
|
+
subtext: Color3;
|
|
6
|
+
highlight: Color3;
|
|
7
|
+
success: Color3;
|
|
8
|
+
error: Color3;
|
|
9
|
+
}
|
|
10
|
+
export declare const DefaultPalette: {
|
|
11
|
+
readonly mocha: {
|
|
12
|
+
readonly background: Color3;
|
|
13
|
+
readonly surface: Color3;
|
|
14
|
+
readonly text: Color3;
|
|
15
|
+
readonly subtext: Color3;
|
|
16
|
+
readonly highlight: Color3;
|
|
17
|
+
readonly success: Color3;
|
|
18
|
+
readonly error: Color3;
|
|
19
|
+
};
|
|
20
|
+
readonly macchiato: {
|
|
21
|
+
readonly background: Color3;
|
|
22
|
+
readonly surface: Color3;
|
|
23
|
+
readonly text: Color3;
|
|
24
|
+
readonly subtext: Color3;
|
|
25
|
+
readonly highlight: Color3;
|
|
26
|
+
readonly success: Color3;
|
|
27
|
+
readonly error: Color3;
|
|
28
|
+
};
|
|
29
|
+
readonly frappe: {
|
|
30
|
+
readonly background: Color3;
|
|
31
|
+
readonly surface: Color3;
|
|
32
|
+
readonly text: Color3;
|
|
33
|
+
readonly subtext: Color3;
|
|
34
|
+
readonly highlight: Color3;
|
|
35
|
+
readonly success: Color3;
|
|
36
|
+
readonly error: Color3;
|
|
37
|
+
};
|
|
38
|
+
readonly latte: {
|
|
39
|
+
readonly background: Color3;
|
|
40
|
+
readonly surface: Color3;
|
|
41
|
+
readonly text: Color3;
|
|
42
|
+
readonly subtext: Color3;
|
|
43
|
+
readonly highlight: Color3;
|
|
44
|
+
readonly success: Color3;
|
|
45
|
+
readonly error: Color3;
|
|
46
|
+
};
|
|
47
|
+
readonly builder: {
|
|
48
|
+
readonly background: Color3;
|
|
49
|
+
readonly surface: Color3;
|
|
50
|
+
readonly text: Color3;
|
|
51
|
+
readonly subtext: Color3;
|
|
52
|
+
readonly highlight: Color3;
|
|
53
|
+
readonly success: Color3;
|
|
54
|
+
readonly error: Color3;
|
|
55
|
+
};
|
|
56
|
+
};
|
package/out/palette.lua
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local DefaultPalette = {
|
|
3
|
+
mocha = {
|
|
4
|
+
background = Color3.fromRGB(24, 24, 37),
|
|
5
|
+
surface = Color3.fromRGB(30, 30, 46),
|
|
6
|
+
text = Color3.fromRGB(205, 214, 244),
|
|
7
|
+
subtext = Color3.fromRGB(166, 173, 200),
|
|
8
|
+
highlight = Color3.fromRGB(137, 180, 250),
|
|
9
|
+
success = Color3.fromRGB(166, 227, 161),
|
|
10
|
+
error = Color3.fromRGB(243, 139, 168),
|
|
11
|
+
},
|
|
12
|
+
macchiato = {
|
|
13
|
+
background = Color3.fromRGB(30, 32, 48),
|
|
14
|
+
surface = Color3.fromRGB(36, 39, 58),
|
|
15
|
+
text = Color3.fromRGB(202, 211, 245),
|
|
16
|
+
subtext = Color3.fromRGB(165, 173, 203),
|
|
17
|
+
highlight = Color3.fromRGB(138, 173, 244),
|
|
18
|
+
success = Color3.fromRGB(166, 218, 149),
|
|
19
|
+
error = Color3.fromRGB(237, 135, 150),
|
|
20
|
+
},
|
|
21
|
+
frappe = {
|
|
22
|
+
background = Color3.fromRGB(41, 44, 60),
|
|
23
|
+
surface = Color3.fromRGB(48, 52, 70),
|
|
24
|
+
text = Color3.fromRGB(198, 208, 245),
|
|
25
|
+
subtext = Color3.fromRGB(165, 173, 206),
|
|
26
|
+
highlight = Color3.fromRGB(140, 170, 238),
|
|
27
|
+
success = Color3.fromRGB(166, 209, 137),
|
|
28
|
+
error = Color3.fromRGB(231, 130, 132),
|
|
29
|
+
},
|
|
30
|
+
latte = {
|
|
31
|
+
background = Color3.fromRGB(230, 233, 239),
|
|
32
|
+
surface = Color3.fromRGB(239, 241, 245),
|
|
33
|
+
text = Color3.fromRGB(76, 79, 105),
|
|
34
|
+
subtext = Color3.fromRGB(92, 95, 119),
|
|
35
|
+
highlight = Color3.fromRGB(30, 102, 245),
|
|
36
|
+
success = Color3.fromRGB(64, 160, 43),
|
|
37
|
+
error = Color3.fromRGB(210, 15, 57),
|
|
38
|
+
},
|
|
39
|
+
builder = {
|
|
40
|
+
background = Color3.fromRGB(0, 0, 0),
|
|
41
|
+
surface = Color3.fromRGB(53, 53, 53),
|
|
42
|
+
text = Color3.fromRGB(255, 255, 255),
|
|
43
|
+
subtext = Color3.fromRGB(162, 162, 162),
|
|
44
|
+
highlight = Color3.fromRGB(239, 122, 54),
|
|
45
|
+
success = Color3.fromRGB(78, 204, 90),
|
|
46
|
+
error = Color3.fromRGB(255, 68, 68),
|
|
47
|
+
},
|
|
48
|
+
}
|
|
49
|
+
return {
|
|
50
|
+
DefaultPalette = DefaultPalette,
|
|
51
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ClientAPI } from "@rbxts/centurion";
|
|
2
|
+
import React from "@rbxts/react";
|
|
3
|
+
interface ApiProviderProps extends React.PropsWithChildren {
|
|
4
|
+
api: ClientAPI;
|
|
5
|
+
}
|
|
6
|
+
export declare const ApiContext: React.Context<ClientAPI>;
|
|
7
|
+
export declare function ApiProvider({ api, children }: ApiProviderProps): JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
+
local React = _react
|
|
5
|
+
local createContext = _react.createContext
|
|
6
|
+
local ApiContext = createContext({})
|
|
7
|
+
local function ApiProvider(_param)
|
|
8
|
+
local api = _param.api
|
|
9
|
+
local children = _param.children
|
|
10
|
+
return React.createElement(ApiContext.Provider, {
|
|
11
|
+
value = api,
|
|
12
|
+
}, children)
|
|
13
|
+
end
|
|
14
|
+
return {
|
|
15
|
+
ApiProvider = ApiProvider,
|
|
16
|
+
ApiContext = ApiContext,
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Signal } from "@rbxts/beacon";
|
|
2
|
+
import React from "@rbxts/react";
|
|
3
|
+
import { InterfaceOptions } from "../types";
|
|
4
|
+
export interface InterfaceOptionsWithState extends InterfaceOptions {
|
|
5
|
+
isMouseOnGUI: boolean;
|
|
6
|
+
setMouseOnGUI: (newState: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const OptionsContext: React.Context<InterfaceOptionsWithState>;
|
|
9
|
+
export interface OptionsProviderProps extends React.PropsWithChildren {
|
|
10
|
+
value: InterfaceOptions;
|
|
11
|
+
changed: Signal<[options: Partial<InterfaceOptions>]>;
|
|
12
|
+
}
|
|
13
|
+
export declare function OptionsProvider({ value, changed, children, }: OptionsProviderProps): JSX.Element;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local useEventListener = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useEventListener
|
|
4
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
5
|
+
local React = _react
|
|
6
|
+
local createContext = _react.createContext
|
|
7
|
+
local useState = _react.useState
|
|
8
|
+
-- we can safely assign to {} as the value will always be assigned in the provider
|
|
9
|
+
local OptionsContext = createContext({})
|
|
10
|
+
local function OptionsProvider(_param)
|
|
11
|
+
local value = _param.value
|
|
12
|
+
local changed = _param.changed
|
|
13
|
+
local children = _param.children
|
|
14
|
+
local isMouseOnGUI, setMouseOnGUI = useState(false)
|
|
15
|
+
local _object = table.clone(value)
|
|
16
|
+
setmetatable(_object, nil)
|
|
17
|
+
local options, setOptions = useState(_object)
|
|
18
|
+
useEventListener(changed, function(options)
|
|
19
|
+
setOptions(function(prev)
|
|
20
|
+
local _object_1 = table.clone(prev)
|
|
21
|
+
setmetatable(_object_1, nil)
|
|
22
|
+
for _k, _v in options do
|
|
23
|
+
_object_1[_k] = _v
|
|
24
|
+
end
|
|
25
|
+
return _object_1
|
|
26
|
+
end)
|
|
27
|
+
end)
|
|
28
|
+
local _attributes = {}
|
|
29
|
+
local _object_1 = table.clone(options)
|
|
30
|
+
setmetatable(_object_1, nil)
|
|
31
|
+
_object_1.isMouseOnGUI = isMouseOnGUI
|
|
32
|
+
_object_1.setMouseOnGUI = setMouseOnGUI
|
|
33
|
+
_attributes.value = _object_1
|
|
34
|
+
return React.createElement(OptionsContext.Provider, _attributes, children)
|
|
35
|
+
end
|
|
36
|
+
return {
|
|
37
|
+
OptionsProvider = OptionsProvider,
|
|
38
|
+
OptionsContext = OptionsContext,
|
|
39
|
+
}
|