@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
package/out/app/app.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ClientAPI } from "@rbxts/centurion";
|
|
2
|
+
import { InterfaceOptions } from "../types";
|
|
3
|
+
export declare namespace CenturionUI {
|
|
4
|
+
function updateOptions(options: Partial<InterfaceOptions>): void;
|
|
5
|
+
function create(options?: Partial<InterfaceOptions>): (api: ClientAPI) => void;
|
|
6
|
+
}
|
package/out/app/app.lua
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _config = script.Parent
|
|
4
|
+
if _config ~= nil then
|
|
5
|
+
_config = _config:FindFirstChild("config")
|
|
6
|
+
end
|
|
7
|
+
local config = _config
|
|
8
|
+
if config ~= nil and config.ClassName == "ModuleScript" then
|
|
9
|
+
require(config)
|
|
10
|
+
end
|
|
11
|
+
local Signal = TS.import(script, TS.getModule(script, "@rbxts", "beacon").out).Signal
|
|
12
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
13
|
+
local React = _react
|
|
14
|
+
local StrictMode = _react.StrictMode
|
|
15
|
+
local _react_roblox = TS.import(script, TS.getModule(script, "@rbxts", "react-roblox"))
|
|
16
|
+
local createPortal = _react_roblox.createPortal
|
|
17
|
+
local createRoot = _react_roblox.createRoot
|
|
18
|
+
local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
|
|
19
|
+
local ContentProvider = _services.ContentProvider
|
|
20
|
+
local Players = _services.Players
|
|
21
|
+
local DEFAULT_INTERFACE_OPTIONS = TS.import(script, script.Parent.Parent, "constants", "options").DEFAULT_INTERFACE_OPTIONS
|
|
22
|
+
local RootProvider = TS.import(script, script.Parent.Parent, "providers", "root-provider").RootProvider
|
|
23
|
+
local TerminalApp = TS.import(script, script.Parent, "terminal-app").TerminalApp
|
|
24
|
+
local CenturionUI = {}
|
|
25
|
+
do
|
|
26
|
+
local _container = CenturionUI
|
|
27
|
+
local MAX_PRELOAD_ATTEMPTS = 3
|
|
28
|
+
local PRELOAD_ATTEMPT_INTERVAL = 3
|
|
29
|
+
local optionsChanged = Signal.new()
|
|
30
|
+
local function updateOptions(options)
|
|
31
|
+
optionsChanged:Fire(options)
|
|
32
|
+
end
|
|
33
|
+
_container.updateOptions = updateOptions
|
|
34
|
+
local function create(options)
|
|
35
|
+
if options == nil then
|
|
36
|
+
options = {}
|
|
37
|
+
end
|
|
38
|
+
return function(api)
|
|
39
|
+
local root = createRoot(Instance.new("Folder"))
|
|
40
|
+
local target = Players.LocalPlayer:WaitForChild("PlayerGui")
|
|
41
|
+
-- Attempt to preload font
|
|
42
|
+
task.spawn(function()
|
|
43
|
+
local _result = options.font
|
|
44
|
+
if _result ~= nil then
|
|
45
|
+
_result = _result.regular
|
|
46
|
+
end
|
|
47
|
+
local _condition = _result
|
|
48
|
+
if _condition == nil then
|
|
49
|
+
_condition = DEFAULT_INTERFACE_OPTIONS.font.regular
|
|
50
|
+
end
|
|
51
|
+
local fontFamily = _condition.Family
|
|
52
|
+
local attempts = 0
|
|
53
|
+
while attempts < MAX_PRELOAD_ATTEMPTS do
|
|
54
|
+
ContentProvider:PreloadAsync({ fontFamily }, function(_, status)
|
|
55
|
+
if status == Enum.AssetFetchStatus.Success then
|
|
56
|
+
attempts = MAX_PRELOAD_ATTEMPTS
|
|
57
|
+
end
|
|
58
|
+
end)
|
|
59
|
+
if attempts == MAX_PRELOAD_ATTEMPTS then
|
|
60
|
+
break
|
|
61
|
+
end
|
|
62
|
+
task.wait(PRELOAD_ATTEMPT_INTERVAL)
|
|
63
|
+
attempts += 1
|
|
64
|
+
end
|
|
65
|
+
end)
|
|
66
|
+
local _attributes = {
|
|
67
|
+
api = api,
|
|
68
|
+
}
|
|
69
|
+
local _object = table.clone(DEFAULT_INTERFACE_OPTIONS)
|
|
70
|
+
setmetatable(_object, nil)
|
|
71
|
+
for _k, _v in options do
|
|
72
|
+
_object[_k] = _v
|
|
73
|
+
end
|
|
74
|
+
_attributes.options = _object
|
|
75
|
+
_attributes.optionsChanged = optionsChanged
|
|
76
|
+
root:render(createPortal(React.createElement(StrictMode, nil, React.createElement(RootProvider, _attributes, React.createElement(TerminalApp))), target))
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
_container.create = create
|
|
80
|
+
end
|
|
81
|
+
return {
|
|
82
|
+
CenturionUI = CenturionUI,
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./app";
|
package/out/app/init.lua
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function TerminalApp(): JSX.Element;
|
|
@@ -0,0 +1,61 @@
|
|
|
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 useContext = _react.useContext
|
|
7
|
+
local useMemo = _react.useMemo
|
|
8
|
+
local useSelector = TS.import(script, TS.getModule(script, "@rbxts", "react-reflex")).useSelector
|
|
9
|
+
local UserInputService = TS.import(script, TS.getModule(script, "@rbxts", "services")).UserInputService
|
|
10
|
+
local Terminal = TS.import(script, script.Parent.Parent, "components", "terminal").default
|
|
11
|
+
local Layer = TS.import(script, script.Parent.Parent, "components", "ui", "layer").Layer
|
|
12
|
+
local OptionsContext = TS.import(script, script.Parent.Parent, "providers", "options-provider").OptionsContext
|
|
13
|
+
local store = TS.import(script, script.Parent.Parent, "store").store
|
|
14
|
+
local selectVisible = TS.import(script, script.Parent.Parent, "store", "app").selectVisible
|
|
15
|
+
local function TerminalApp()
|
|
16
|
+
local options = useContext(OptionsContext)
|
|
17
|
+
local visible = useSelector(selectVisible)
|
|
18
|
+
local validKeys = useMemo(function()
|
|
19
|
+
local _set = {}
|
|
20
|
+
for _, _v in options.activationKeys do
|
|
21
|
+
_set[_v] = true
|
|
22
|
+
end
|
|
23
|
+
return _set
|
|
24
|
+
end, { options })
|
|
25
|
+
local mouseInputTypes = useMemo(function()
|
|
26
|
+
return {
|
|
27
|
+
[Enum.UserInputType.MouseButton1] = true,
|
|
28
|
+
[Enum.UserInputType.MouseButton2] = true,
|
|
29
|
+
[Enum.UserInputType.Touch] = true,
|
|
30
|
+
}
|
|
31
|
+
end, {})
|
|
32
|
+
useEventListener(UserInputService.InputBegan, function(input, gameProcessed)
|
|
33
|
+
local _keyCode = input.KeyCode
|
|
34
|
+
local _condition = validKeys[_keyCode] ~= nil
|
|
35
|
+
if _condition then
|
|
36
|
+
_condition = not gameProcessed
|
|
37
|
+
end
|
|
38
|
+
if _condition then
|
|
39
|
+
store.setVisible(not visible)
|
|
40
|
+
else
|
|
41
|
+
local _condition_1 = options.hideOnLostFocus
|
|
42
|
+
if _condition_1 then
|
|
43
|
+
local _userInputType = input.UserInputType
|
|
44
|
+
_condition_1 = mouseInputTypes[_userInputType] ~= nil
|
|
45
|
+
if _condition_1 then
|
|
46
|
+
_condition_1 = not options.isMouseOnGUI
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
if _condition_1 then
|
|
50
|
+
store.setVisible(false)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end)
|
|
54
|
+
return React.createElement(Layer, {
|
|
55
|
+
displayOrder = options.displayOrder,
|
|
56
|
+
visible = visible,
|
|
57
|
+
}, React.createElement(Terminal))
|
|
58
|
+
end
|
|
59
|
+
return {
|
|
60
|
+
TerminalApp = TerminalApp,
|
|
61
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { HistoryEntry } from "@rbxts/centurion";
|
|
2
|
+
import { BindingOrValue } from "@rbxts/pretty-react-hooks";
|
|
3
|
+
interface HistoryLineProps {
|
|
4
|
+
data: HistoryEntry;
|
|
5
|
+
size?: BindingOrValue<UDim2>;
|
|
6
|
+
position?: BindingOrValue<UDim2>;
|
|
7
|
+
order?: BindingOrValue<number>;
|
|
8
|
+
}
|
|
9
|
+
export declare function HistoryLine({ data, size, position, order }: HistoryLineProps): JSX.Element;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
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 useContext = _react.useContext
|
|
6
|
+
local useMemo = _react.useMemo
|
|
7
|
+
local HISTORY_TEXT_SIZE = TS.import(script, script.Parent.Parent.Parent, "constants", "text").HISTORY_TEXT_SIZE
|
|
8
|
+
local usePx = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").usePx
|
|
9
|
+
local OptionsContext = TS.import(script, script.Parent.Parent.Parent, "providers", "options-provider").OptionsContext
|
|
10
|
+
local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
|
|
11
|
+
local Group = TS.import(script, script.Parent.Parent, "ui", "group").Group
|
|
12
|
+
local Outline = TS.import(script, script.Parent.Parent, "ui", "outline").Outline
|
|
13
|
+
local Text = TS.import(script, script.Parent.Parent, "ui", "text").Text
|
|
14
|
+
local TextField = TS.import(script, script.Parent.Parent, "ui", "text-field").TextField
|
|
15
|
+
local function HistoryLine(_param)
|
|
16
|
+
local data = _param.data
|
|
17
|
+
local size = _param.size
|
|
18
|
+
local position = _param.position
|
|
19
|
+
local order = _param.order
|
|
20
|
+
local options = useContext(OptionsContext)
|
|
21
|
+
local px = usePx()
|
|
22
|
+
local date = useMemo(function()
|
|
23
|
+
local dateTime = DateTime.fromUnixTimestamp(data.sentAt):FormatLocalTime("LT", "en-us")
|
|
24
|
+
local dateParts = string.split(dateTime, " ")
|
|
25
|
+
return `<b>{dateParts[1]}</b> {dateParts[2]}`
|
|
26
|
+
end, { data })
|
|
27
|
+
return React.createElement(Group, {
|
|
28
|
+
size = size,
|
|
29
|
+
position = position,
|
|
30
|
+
layoutOrder = order,
|
|
31
|
+
}, React.createElement(Frame, {
|
|
32
|
+
backgroundColor = options.palette.surface,
|
|
33
|
+
size = UDim2.fromOffset(px(76), px(HISTORY_TEXT_SIZE + 4)),
|
|
34
|
+
cornerRadius = UDim.new(0, px(4)),
|
|
35
|
+
}, React.createElement(Text, {
|
|
36
|
+
size = UDim2.fromScale(1, 1),
|
|
37
|
+
text = date,
|
|
38
|
+
textColor = options.palette.text,
|
|
39
|
+
textSize = px(HISTORY_TEXT_SIZE),
|
|
40
|
+
richText = true,
|
|
41
|
+
}), React.createElement(Outline, {
|
|
42
|
+
innerThickness = px(1),
|
|
43
|
+
innerTransparency = 0.25,
|
|
44
|
+
innerColor = if data.success then options.palette.success else options.palette.error,
|
|
45
|
+
outerThickness = 0,
|
|
46
|
+
cornerRadius = UDim.new(0, px(4)),
|
|
47
|
+
})), React.createElement(TextField, {
|
|
48
|
+
anchorPoint = Vector2.new(1, 0),
|
|
49
|
+
size = UDim2.new(1, -px(84), 1, 0),
|
|
50
|
+
position = UDim2.fromScale(1, 0),
|
|
51
|
+
text = data.text,
|
|
52
|
+
textSize = px(HISTORY_TEXT_SIZE),
|
|
53
|
+
textColor = if data.success then options.palette.text else options.palette.error,
|
|
54
|
+
textEditable = false,
|
|
55
|
+
textXAlignment = "Left",
|
|
56
|
+
clearTextOnFocus = false,
|
|
57
|
+
font = options.font.medium,
|
|
58
|
+
richText = true,
|
|
59
|
+
}))
|
|
60
|
+
end
|
|
61
|
+
return {
|
|
62
|
+
HistoryLine = HistoryLine,
|
|
63
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { BindingOrValue } from "@rbxts/pretty-react-hooks";
|
|
2
|
+
import { HistoryLineData } from "../../types";
|
|
3
|
+
export interface HistoryData {
|
|
4
|
+
lines: HistoryLineData[];
|
|
5
|
+
height: number;
|
|
6
|
+
}
|
|
7
|
+
interface HistoryListProps {
|
|
8
|
+
data: HistoryData;
|
|
9
|
+
size?: BindingOrValue<UDim2>;
|
|
10
|
+
position?: BindingOrValue<UDim2>;
|
|
11
|
+
maxHeight?: number;
|
|
12
|
+
scrollingEnabled?: BindingOrValue<boolean>;
|
|
13
|
+
}
|
|
14
|
+
export declare function HistoryList({ data, size, position, maxHeight, }: HistoryListProps): JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local mapBinding = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).mapBinding
|
|
4
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
5
|
+
local React = _react
|
|
6
|
+
local useBinding = _react.useBinding
|
|
7
|
+
local useContext = _react.useContext
|
|
8
|
+
local useEffect = _react.useEffect
|
|
9
|
+
local usePx = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").usePx
|
|
10
|
+
local OptionsContext = TS.import(script, script.Parent.Parent.Parent, "providers", "options-provider").OptionsContext
|
|
11
|
+
local ScrollingFrame = TS.import(script, script.Parent.Parent, "ui", "scrolling-frame").ScrollingFrame
|
|
12
|
+
local HistoryLine = TS.import(script, script.Parent, "history-line").HistoryLine
|
|
13
|
+
local function HistoryList(_param)
|
|
14
|
+
local data = _param.data
|
|
15
|
+
local size = _param.size
|
|
16
|
+
local position = _param.position
|
|
17
|
+
local maxHeight = _param.maxHeight
|
|
18
|
+
local px = usePx()
|
|
19
|
+
local options = useContext(OptionsContext)
|
|
20
|
+
local scrollingEnabled, setScrollingEnabled = useBinding(false)
|
|
21
|
+
local canvasSize, setCanvasSize = useBinding(UDim2.new())
|
|
22
|
+
local canvasPosition, setCanvasPosition = useBinding(Vector2.new())
|
|
23
|
+
useEffect(function()
|
|
24
|
+
local height = data.height - px(8)
|
|
25
|
+
setCanvasSize(UDim2.new(0, 0, 0, height))
|
|
26
|
+
setCanvasPosition(Vector2.new(0, height))
|
|
27
|
+
if maxHeight ~= nil then
|
|
28
|
+
setScrollingEnabled(height > maxHeight)
|
|
29
|
+
end
|
|
30
|
+
end, { data, px })
|
|
31
|
+
local _exp = data.lines
|
|
32
|
+
-- ▼ ReadonlyArray.map ▼
|
|
33
|
+
local _newValue = table.create(#_exp)
|
|
34
|
+
local _callback = function(data, i)
|
|
35
|
+
return React.createElement(HistoryLine, {
|
|
36
|
+
key = `{data.entry.sentAt}-{i}`,
|
|
37
|
+
size = UDim2.new(1, 0, 0, data.height),
|
|
38
|
+
data = data.entry,
|
|
39
|
+
})
|
|
40
|
+
end
|
|
41
|
+
for _k, _v in _exp do
|
|
42
|
+
_newValue[_k] = _callback(_v, _k - 1, _exp)
|
|
43
|
+
end
|
|
44
|
+
-- ▲ ReadonlyArray.map ▲
|
|
45
|
+
return React.createElement(ScrollingFrame, {
|
|
46
|
+
size = size,
|
|
47
|
+
position = position,
|
|
48
|
+
canvasSize = canvasSize,
|
|
49
|
+
canvasPosition = canvasPosition,
|
|
50
|
+
scrollBarColor = options.palette.subtext,
|
|
51
|
+
scrollBarThickness = mapBinding(scrollingEnabled, function(val)
|
|
52
|
+
return if val then 10 else 0
|
|
53
|
+
end),
|
|
54
|
+
scrollingEnabled = scrollingEnabled,
|
|
55
|
+
}, _newValue, React.createElement("uilistlayout", {
|
|
56
|
+
Padding = UDim.new(0, px(8)),
|
|
57
|
+
SortOrder = "LayoutOrder",
|
|
58
|
+
}))
|
|
59
|
+
end
|
|
60
|
+
return {
|
|
61
|
+
HistoryList = HistoryList,
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./history-list";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./terminal";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BindingOrValue } from "@rbxts/pretty-react-hooks";
|
|
2
|
+
interface BadgeProps {
|
|
3
|
+
anchorPoint?: BindingOrValue<Vector2>;
|
|
4
|
+
size?: BindingOrValue<UDim2>;
|
|
5
|
+
position?: BindingOrValue<UDim2>;
|
|
6
|
+
color?: BindingOrValue<Color3>;
|
|
7
|
+
text?: BindingOrValue<string>;
|
|
8
|
+
textColor?: BindingOrValue<Color3>;
|
|
9
|
+
textSize?: BindingOrValue<number>;
|
|
10
|
+
visible?: BindingOrValue<boolean>;
|
|
11
|
+
onTextBoundsChange?: (textBounds: Vector2) => void;
|
|
12
|
+
children?: JSX.Element;
|
|
13
|
+
backgroundTransparency?: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function Badge({ anchorPoint, size, position, color, text, textColor, textSize, visible, onTextBoundsChange, children, backgroundTransparency, }: BadgeProps): JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
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 useContext = _react.useContext
|
|
6
|
+
local usePx = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").usePx
|
|
7
|
+
local OptionsContext = TS.import(script, script.Parent.Parent.Parent, "providers", "options-provider").OptionsContext
|
|
8
|
+
local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
|
|
9
|
+
local Text = TS.import(script, script.Parent.Parent, "ui", "text").Text
|
|
10
|
+
local function Badge(_param)
|
|
11
|
+
local anchorPoint = _param.anchorPoint
|
|
12
|
+
local size = _param.size
|
|
13
|
+
local position = _param.position
|
|
14
|
+
local color = _param.color
|
|
15
|
+
local text = _param.text
|
|
16
|
+
local textColor = _param.textColor
|
|
17
|
+
local textSize = _param.textSize
|
|
18
|
+
local visible = _param.visible
|
|
19
|
+
local onTextBoundsChange = _param.onTextBoundsChange
|
|
20
|
+
local children = _param.children
|
|
21
|
+
local backgroundTransparency = _param.backgroundTransparency
|
|
22
|
+
local options = useContext(OptionsContext)
|
|
23
|
+
local px = usePx()
|
|
24
|
+
return React.createElement(Frame, {
|
|
25
|
+
anchorPoint = anchorPoint,
|
|
26
|
+
size = size,
|
|
27
|
+
position = position,
|
|
28
|
+
backgroundColor = color,
|
|
29
|
+
cornerRadius = UDim.new(0, px(4)),
|
|
30
|
+
visible = visible,
|
|
31
|
+
clipsDescendants = true,
|
|
32
|
+
backgroundTransparency = backgroundTransparency,
|
|
33
|
+
}, React.createElement(Text, {
|
|
34
|
+
text = text,
|
|
35
|
+
textColor = textColor,
|
|
36
|
+
textSize = textSize,
|
|
37
|
+
size = UDim2.fromScale(1, 1),
|
|
38
|
+
font = options.font.bold,
|
|
39
|
+
change = {
|
|
40
|
+
TextBounds = function(rbx)
|
|
41
|
+
local _result = onTextBoundsChange
|
|
42
|
+
if _result ~= nil then
|
|
43
|
+
_result = _result(rbx.TextBounds)
|
|
44
|
+
end
|
|
45
|
+
return _result
|
|
46
|
+
end,
|
|
47
|
+
},
|
|
48
|
+
}), children)
|
|
49
|
+
end
|
|
50
|
+
return {
|
|
51
|
+
Badge = Badge,
|
|
52
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./suggestions";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BindingOrValue } from "@rbxts/pretty-react-hooks";
|
|
2
|
+
import { Binding } from "@rbxts/react";
|
|
3
|
+
import { Suggestion } from "../../types";
|
|
4
|
+
import { SuggestionTextBounds } from "./types";
|
|
5
|
+
export interface MainSuggestionProps {
|
|
6
|
+
suggestion?: Suggestion;
|
|
7
|
+
argument: BindingOrValue<boolean>;
|
|
8
|
+
currentText?: string;
|
|
9
|
+
size: BindingOrValue<UDim2>;
|
|
10
|
+
sizes: Binding<SuggestionTextBounds>;
|
|
11
|
+
}
|
|
12
|
+
export declare function MainSuggestion({ suggestion, currentText, size, sizes, argument, }: MainSuggestionProps): JSX.Element;
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local lerpBinding = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).lerpBinding
|
|
4
|
+
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
5
|
+
local React = _react
|
|
6
|
+
local useContext = _react.useContext
|
|
7
|
+
local useEffect = _react.useEffect
|
|
8
|
+
local springs = TS.import(script, script.Parent.Parent.Parent, "constants", "springs").springs
|
|
9
|
+
local _text = TS.import(script, script.Parent.Parent.Parent, "constants", "text")
|
|
10
|
+
local SUGGESTION_TEXT_SIZE = _text.SUGGESTION_TEXT_SIZE
|
|
11
|
+
local SUGGESTION_TITLE_TEXT_SIZE = _text.SUGGESTION_TITLE_TEXT_SIZE
|
|
12
|
+
local useMotion = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-motion").useMotion
|
|
13
|
+
local usePx = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").usePx
|
|
14
|
+
local OptionsContext = TS.import(script, script.Parent.Parent.Parent, "providers", "options-provider").OptionsContext
|
|
15
|
+
local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
|
|
16
|
+
local Padding = TS.import(script, script.Parent.Parent, "ui", "padding").Padding
|
|
17
|
+
local ShortcutGroup = TS.import(script, script.Parent.Parent, "ui", "shortcut-group").ShortcutGroup
|
|
18
|
+
local Text = TS.import(script, script.Parent.Parent, "ui", "text").Text
|
|
19
|
+
local Badge = TS.import(script, script.Parent, "badge").Badge
|
|
20
|
+
local highlightMatching = TS.import(script, script.Parent, "util").highlightMatching
|
|
21
|
+
local function showKeybindsGui(props)
|
|
22
|
+
if props.suggestion and props.suggestion.main.type == "command" and (props.suggestion.main).shortcuts ~= nil and props.options.showShortcutSuggestions then
|
|
23
|
+
return true
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
local function MainSuggestion(_param)
|
|
27
|
+
local suggestion = _param.suggestion
|
|
28
|
+
local currentText = _param.currentText
|
|
29
|
+
local size = _param.size
|
|
30
|
+
local sizes = _param.sizes
|
|
31
|
+
local argument = _param.argument
|
|
32
|
+
local px = usePx()
|
|
33
|
+
local options = useContext(OptionsContext)
|
|
34
|
+
local titleHeight, titleHeightMotion = useMotion(0)
|
|
35
|
+
local badgeWidth, badgeWidthMotion = useMotion(0)
|
|
36
|
+
useEffect(function()
|
|
37
|
+
local _result = suggestion
|
|
38
|
+
if _result ~= nil then
|
|
39
|
+
_result = _result.main.description
|
|
40
|
+
end
|
|
41
|
+
titleHeightMotion:spring(if _result ~= nil then 1 else 0, springs.responsive)
|
|
42
|
+
end, { suggestion })
|
|
43
|
+
local _exp = React.createElement(Padding, {
|
|
44
|
+
all = UDim.new(0, px(8)),
|
|
45
|
+
})
|
|
46
|
+
local _exp_1 = React.createElement(Badge, {
|
|
47
|
+
anchorPoint = Vector2.new(1, 0),
|
|
48
|
+
size = badgeWidth:map(function(width)
|
|
49
|
+
return UDim2.fromOffset(math.round(width), px(24))
|
|
50
|
+
end),
|
|
51
|
+
position = UDim2.fromScale(1, 0),
|
|
52
|
+
color = options.palette.highlight,
|
|
53
|
+
text = if argument and suggestion ~= nil then (suggestion.main).dataType else "",
|
|
54
|
+
textColor = options.palette.surface,
|
|
55
|
+
textSize = px(SUGGESTION_TEXT_SIZE),
|
|
56
|
+
visible = argument,
|
|
57
|
+
onTextBoundsChange = function(textBounds)
|
|
58
|
+
return badgeWidthMotion:spring(textBounds.X + px(8), {
|
|
59
|
+
mass = 0.5,
|
|
60
|
+
tension = 400,
|
|
61
|
+
})
|
|
62
|
+
end,
|
|
63
|
+
})
|
|
64
|
+
local _result
|
|
65
|
+
if showKeybindsGui({
|
|
66
|
+
options = options,
|
|
67
|
+
suggestion = suggestion,
|
|
68
|
+
}) then
|
|
69
|
+
local _attributes = {}
|
|
70
|
+
local _result_1 = suggestion
|
|
71
|
+
if _result_1 ~= nil then
|
|
72
|
+
_result_1 = _result_1.main.type
|
|
73
|
+
end
|
|
74
|
+
local _result_2
|
|
75
|
+
if _result_1 == "command" then
|
|
76
|
+
local _result_3 = suggestion
|
|
77
|
+
if _result_3 ~= nil then
|
|
78
|
+
_result_3 = _result_3.main
|
|
79
|
+
end
|
|
80
|
+
_result_2 = _result_3.shortcuts
|
|
81
|
+
else
|
|
82
|
+
_result_2 = {}
|
|
83
|
+
end
|
|
84
|
+
_attributes.shortcuts = _result_2
|
|
85
|
+
_result = (React.createElement(ShortcutGroup, _attributes))
|
|
86
|
+
else
|
|
87
|
+
_result = (React.createElement(React.Fragment))
|
|
88
|
+
end
|
|
89
|
+
local _attributes = {
|
|
90
|
+
size = sizes:map(function(val)
|
|
91
|
+
return val.title
|
|
92
|
+
end),
|
|
93
|
+
position = lerpBinding(titleHeight, UDim2.fromOffset(0, 0), UDim2.fromOffset(0, px(-4))),
|
|
94
|
+
}
|
|
95
|
+
local _result_1
|
|
96
|
+
if argument then
|
|
97
|
+
local _result_2 = suggestion
|
|
98
|
+
if _result_2 ~= nil then
|
|
99
|
+
_result_2 = _result_2.main.title
|
|
100
|
+
end
|
|
101
|
+
_result_1 = _result_2
|
|
102
|
+
else
|
|
103
|
+
local _exp_2 = options.palette.highlight
|
|
104
|
+
local _result_2 = suggestion
|
|
105
|
+
if _result_2 ~= nil then
|
|
106
|
+
_result_2 = _result_2.main.title
|
|
107
|
+
end
|
|
108
|
+
_result_1 = highlightMatching(_exp_2, _result_2, currentText)
|
|
109
|
+
end
|
|
110
|
+
_attributes.text = _result_1
|
|
111
|
+
_attributes.textSize = px(SUGGESTION_TITLE_TEXT_SIZE)
|
|
112
|
+
_attributes.textColor = options.palette.text
|
|
113
|
+
_attributes.textXAlignment = "Left"
|
|
114
|
+
_attributes.textYAlignment = "Top"
|
|
115
|
+
_attributes.richText = true
|
|
116
|
+
_attributes.font = options.font.bold
|
|
117
|
+
local _exp_2 = React.createElement(Text, _attributes)
|
|
118
|
+
local _attributes_1 = {
|
|
119
|
+
size = sizes:map(function(val)
|
|
120
|
+
return val.description
|
|
121
|
+
end),
|
|
122
|
+
position = UDim2.fromOffset(0, px(SUGGESTION_TITLE_TEXT_SIZE)),
|
|
123
|
+
}
|
|
124
|
+
local _result_2 = suggestion
|
|
125
|
+
if _result_2 ~= nil then
|
|
126
|
+
_result_2 = _result_2.main.description
|
|
127
|
+
end
|
|
128
|
+
local _condition = _result_2
|
|
129
|
+
if _condition == nil then
|
|
130
|
+
_condition = ""
|
|
131
|
+
end
|
|
132
|
+
_attributes_1.text = _condition
|
|
133
|
+
_attributes_1.textSize = px(SUGGESTION_TEXT_SIZE)
|
|
134
|
+
_attributes_1.textColor = options.palette.subtext
|
|
135
|
+
_attributes_1.textXAlignment = "Left"
|
|
136
|
+
_attributes_1.textYAlignment = "Top"
|
|
137
|
+
_attributes_1.textWrapped = true
|
|
138
|
+
_attributes_1.richText = true
|
|
139
|
+
local _exp_3 = React.createElement(Text, _attributes_1)
|
|
140
|
+
local _attributes_2 = {
|
|
141
|
+
anchorPoint = Vector2.new(0, 1),
|
|
142
|
+
size = sizes:map(function(val)
|
|
143
|
+
return UDim2.new(1, 0, 0, val.errorTextHeight)
|
|
144
|
+
end),
|
|
145
|
+
position = UDim2.fromScale(0, 1),
|
|
146
|
+
}
|
|
147
|
+
local _result_3
|
|
148
|
+
if argument and suggestion ~= nil then
|
|
149
|
+
local _condition_1 = (suggestion.main).error
|
|
150
|
+
if _condition_1 == nil then
|
|
151
|
+
_condition_1 = ""
|
|
152
|
+
end
|
|
153
|
+
_result_3 = _condition_1
|
|
154
|
+
else
|
|
155
|
+
_result_3 = ""
|
|
156
|
+
end
|
|
157
|
+
_attributes_2.text = _result_3
|
|
158
|
+
_attributes_2.textColor = options.palette.error
|
|
159
|
+
_attributes_2.textSize = px(SUGGESTION_TEXT_SIZE)
|
|
160
|
+
_attributes_2.textWrapped = true
|
|
161
|
+
_attributes_2.textXAlignment = "Left"
|
|
162
|
+
return React.createElement(Frame, {
|
|
163
|
+
size = size,
|
|
164
|
+
backgroundColor = options.palette.background,
|
|
165
|
+
backgroundTransparency = options.backgroundTransparency,
|
|
166
|
+
cornerRadius = UDim.new(0, px(8)),
|
|
167
|
+
clipsDescendants = false,
|
|
168
|
+
event = {
|
|
169
|
+
MouseEnter = function()
|
|
170
|
+
return options.setMouseOnGUI(true)
|
|
171
|
+
end,
|
|
172
|
+
MouseLeave = function()
|
|
173
|
+
return options.setMouseOnGUI(false)
|
|
174
|
+
end,
|
|
175
|
+
},
|
|
176
|
+
}, _exp, _exp_1, _result, _exp_2, _exp_3, React.createElement(Text, _attributes_2))
|
|
177
|
+
end
|
|
178
|
+
return {
|
|
179
|
+
MainSuggestion = MainSuggestion,
|
|
180
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BindingOrValue } from "@rbxts/pretty-react-hooks";
|
|
2
|
+
import { Suggestion } from "../../types";
|
|
3
|
+
export interface SuggestionListProps {
|
|
4
|
+
suggestion?: Suggestion;
|
|
5
|
+
currentText?: string;
|
|
6
|
+
size: BindingOrValue<UDim2>;
|
|
7
|
+
}
|
|
8
|
+
export declare function SuggestionList({ suggestion, currentText, size, }: SuggestionListProps): JSX.Element;
|