@rbxts/centurion-ui 1.0.7 → 2.0.0-rc.1
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 +60 -15
- package/centurion.luau +10 -0
- package/package.json +13 -23
- package/src/analyse/cursor.luau +25 -0
- package/src/analyse/highlight.luau +91 -0
- package/src/analyse/init.luau +318 -0
- package/src/analyse/leventine.luau +298 -0
- package/src/analyse/match.luau +39 -0
- package/src/analyse/suggest.luau +41 -0
- package/src/app/header.luau +128 -0
- package/src/app/history.luau +258 -0
- package/src/app/init.luau +699 -0
- package/src/app/suggestions.luau +419 -0
- package/src/button.luau +13 -0
- package/src/components/background.luau +37 -0
- package/src/components/container.luau +33 -0
- package/src/components/corner.luau +11 -0
- package/src/components/divider.luau +28 -0
- package/src/components/flex.luau +108 -0
- package/src/components/gap.luau +25 -0
- package/src/components/image.luau +33 -0
- package/src/components/padding.luau +59 -0
- package/src/components/stroke.luau +20 -0
- package/src/components/text.luau +57 -0
- package/src/components/textbox.luau +186 -0
- package/src/fade.luau +23 -0
- package/src/init.luau +142 -0
- package/src/input.luau +16 -0
- package/src/px.luau +68 -0
- package/src/rich.luau +14 -0
- package/src/state.luau +33 -0
- package/src/theme.luau +70 -0
- package/src/ts/index.d.ts +60 -0
- package/src/ts/init.luau +5 -0
- package/src/types.luau +85 -0
- package/vide/init.luau +8 -0
- package/vide/src/action.luau +25 -0
- package/vide/src/apply.luau +162 -0
- package/vide/src/batch.luau +23 -0
- package/vide/src/branch.luau +40 -0
- package/vide/src/changed.luau +18 -0
- package/vide/src/cleanup.luau +43 -0
- package/vide/src/context.luau +74 -0
- package/vide/src/create.luau +107 -0
- package/vide/src/defaults.luau +113 -0
- package/vide/src/derive.luau +18 -0
- package/vide/src/effect.luau +12 -0
- package/vide/src/flags.luau +12 -0
- package/vide/src/graph.luau +321 -0
- package/vide/src/implicit_effect.luau +125 -0
- package/vide/src/indexes.luau +121 -0
- package/vide/src/init.luau +10 -0
- package/vide/src/lib.luau +120 -0
- package/vide/src/mount.luau +11 -0
- package/vide/src/read.luau +5 -0
- package/vide/src/root.luau +35 -0
- package/vide/src/show.luau +36 -0
- package/vide/src/source.luau +31 -0
- package/vide/src/spring.luau +328 -0
- package/vide/src/switch.luau +114 -0
- package/vide/src/timeout.luau +27 -0
- package/vide/src/untrack.luau +25 -0
- package/vide/src/values.luau +131 -0
- package/out/app/centurion-app.d.ts +0 -3
- package/out/app/centurion-app.luau +0 -86
- package/out/app/index.d.ts +0 -32
- package/out/app/init.luau +0 -105
- package/out/components/history/history-line.d.ts +0 -9
- package/out/components/history/history-line.luau +0 -88
- package/out/components/history/history-list.d.ts +0 -11
- package/out/components/history/history-list.luau +0 -67
- package/out/components/history/index.d.ts +0 -1
- package/out/components/history/init.luau +0 -7
- package/out/components/index.d.ts +0 -2
- package/out/components/init.luau +0 -10
- package/out/components/suggestions/badge.d.ts +0 -16
- package/out/components/suggestions/badge.luau +0 -40
- package/out/components/suggestions/index.d.ts +0 -1
- package/out/components/suggestions/init.luau +0 -7
- package/out/components/suggestions/main-suggestion.d.ts +0 -9
- package/out/components/suggestions/main-suggestion.luau +0 -232
- package/out/components/suggestions/suggestion-list.d.ts +0 -8
- package/out/components/suggestions/suggestion-list.luau +0 -96
- package/out/components/suggestions/suggestions.d.ts +0 -2
- package/out/components/suggestions/suggestions.luau +0 -64
- package/out/components/suggestions/types.d.ts +0 -6
- package/out/components/suggestions/types.luau +0 -2
- package/out/components/suggestions/util.d.ts +0 -1
- package/out/components/suggestions/util.luau +0 -22
- package/out/components/terminal/command.d.ts +0 -6
- package/out/components/terminal/command.luau +0 -74
- package/out/components/terminal/index.d.ts +0 -1
- package/out/components/terminal/init.luau +0 -7
- package/out/components/terminal/suggestion.d.ts +0 -26
- package/out/components/terminal/suggestion.luau +0 -205
- package/out/components/terminal/terminal-text-field/index.d.ts +0 -1
- package/out/components/terminal/terminal-text-field/init.luau +0 -7
- package/out/components/terminal/terminal-text-field/suggestion.d.ts +0 -5
- package/out/components/terminal/terminal-text-field/suggestion.luau +0 -124
- package/out/components/terminal/terminal-text-field/terminal-text-field.d.ts +0 -13
- package/out/components/terminal/terminal-text-field/terminal-text-field.luau +0 -273
- package/out/components/terminal/terminal.d.ts +0 -2
- package/out/components/terminal/terminal.luau +0 -304
- package/out/components/ui/frame.d.ts +0 -17
- package/out/components/ui/frame.luau +0 -32
- package/out/components/ui/group.d.ts +0 -15
- package/out/components/ui/group.luau +0 -29
- package/out/components/ui/layer.d.ts +0 -8
- package/out/components/ui/layer.luau +0 -26
- package/out/components/ui/outline.d.ts +0 -15
- package/out/components/ui/outline.luau +0 -116
- package/out/components/ui/padding.d.ts +0 -10
- package/out/components/ui/padding.luau +0 -19
- package/out/components/ui/scrolling-frame.d.ts +0 -14
- package/out/components/ui/scrolling-frame.luau +0 -44
- package/out/components/ui/text-field.d.ts +0 -12
- package/out/components/ui/text-field.luau +0 -60
- package/out/components/ui/text.d.ts +0 -17
- package/out/components/ui/text.luau +0 -61
- package/out/constants/options.d.ts +0 -2
- package/out/constants/options.luau +0 -27
- package/out/constants/text.d.ts +0 -3
- package/out/constants/text.luau +0 -9
- package/out/constants/util.d.ts +0 -1
- package/out/constants/util.luau +0 -7
- package/out/hooks/use-client.d.ts +0 -2
- package/out/hooks/use-client.luau +0 -17
- package/out/hooks/use-event.d.ts +0 -14
- package/out/hooks/use-event.luau +0 -58
- package/out/hooks/use-px.d.ts +0 -19
- package/out/hooks/use-px.luau +0 -78
- package/out/index.d.ts +0 -2
- package/out/init.luau +0 -10
- package/out/palette.d.ts +0 -47
- package/out/palette.luau +0 -42
- package/out/store.d.ts +0 -12
- package/out/store.luau +0 -26
- package/out/types.d.ts +0 -44
- package/out/types.luau +0 -2
- package/out/utils/string.d.ts +0 -5
- package/out/utils/string.luau +0 -25
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
4
|
-
local Vide = _vide
|
|
5
|
-
local For = _vide.For
|
|
6
|
-
local read = _vide.read
|
|
7
|
-
local source = _vide.source
|
|
8
|
-
local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
|
|
9
|
-
local options = TS.import(script, script.Parent.Parent.Parent, "store").options
|
|
10
|
-
local ScrollingFrame = TS.import(script, script.Parent.Parent, "ui", "scrolling-frame").ScrollingFrame
|
|
11
|
-
local HistoryLine = TS.import(script, script.Parent, "history-line").HistoryLine
|
|
12
|
-
local function HistoryList(_param)
|
|
13
|
-
local entries = _param.entries
|
|
14
|
-
local size = _param.size
|
|
15
|
-
local position = _param.position
|
|
16
|
-
local scrollingEnabled = _param.scrollingEnabled
|
|
17
|
-
local onContentSizeChanged = _param.onContentSizeChanged
|
|
18
|
-
local ref = source()
|
|
19
|
-
return Vide.jsx(ScrollingFrame, {
|
|
20
|
-
automaticCanvasSize = "Y",
|
|
21
|
-
size = size,
|
|
22
|
-
position = position,
|
|
23
|
-
canvasSize = UDim2.new(),
|
|
24
|
-
action = ref,
|
|
25
|
-
scrollBarColor = function()
|
|
26
|
-
return options().palette.subtext
|
|
27
|
-
end,
|
|
28
|
-
scrollingEnabled = scrollingEnabled,
|
|
29
|
-
scrollBarThickness = function()
|
|
30
|
-
return if read(scrollingEnabled) then 10 else 0
|
|
31
|
-
end,
|
|
32
|
-
scrollingDirection = "Y",
|
|
33
|
-
native = {
|
|
34
|
-
AbsoluteCanvasSizeChanged = function(rbx)
|
|
35
|
-
local frame = ref()
|
|
36
|
-
if frame == nil then
|
|
37
|
-
return nil
|
|
38
|
-
end
|
|
39
|
-
frame.CanvasPosition = Vector2.new(0, rbx.Y)
|
|
40
|
-
end,
|
|
41
|
-
},
|
|
42
|
-
}, Vide.jsx(For, {
|
|
43
|
-
each = function()
|
|
44
|
-
return read(entries)
|
|
45
|
-
end,
|
|
46
|
-
}, function(entry, index)
|
|
47
|
-
return Vide.jsx(HistoryLine, {
|
|
48
|
-
data = entry,
|
|
49
|
-
order = index,
|
|
50
|
-
})
|
|
51
|
-
end), Vide.jsx("uilistlayout", {
|
|
52
|
-
Padding = function()
|
|
53
|
-
return UDim.new(0, px(8))
|
|
54
|
-
end,
|
|
55
|
-
SortOrder = "LayoutOrder",
|
|
56
|
-
AbsoluteContentSizeChanged = function(rbx)
|
|
57
|
-
local _result = onContentSizeChanged
|
|
58
|
-
if _result ~= nil then
|
|
59
|
-
_result = _result(rbx)
|
|
60
|
-
end
|
|
61
|
-
return _result
|
|
62
|
-
end,
|
|
63
|
-
}))
|
|
64
|
-
end
|
|
65
|
-
return {
|
|
66
|
-
HistoryList = HistoryList,
|
|
67
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./history-list";
|
package/out/components/init.luau
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local exports = {}
|
|
4
|
-
for _k, _v in TS.import(script, script, "suggestions") or {} do
|
|
5
|
-
exports[_k] = _v
|
|
6
|
-
end
|
|
7
|
-
for _k, _v in TS.import(script, script, "terminal") or {} do
|
|
8
|
-
exports[_k] = _v
|
|
9
|
-
end
|
|
10
|
-
return exports
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import Vide, { Derivable, InstanceAttributes } from "@rbxts/vide";
|
|
2
|
-
interface BadgeProps {
|
|
3
|
-
anchor?: Derivable<Vector2>;
|
|
4
|
-
size?: Derivable<UDim2>;
|
|
5
|
-
position?: Derivable<UDim2>;
|
|
6
|
-
color?: Derivable<Color3>;
|
|
7
|
-
text?: Derivable<string>;
|
|
8
|
-
textColor?: Derivable<Color3>;
|
|
9
|
-
textSize?: Derivable<number>;
|
|
10
|
-
visible?: Derivable<boolean>;
|
|
11
|
-
children?: Vide.Node;
|
|
12
|
-
backgroundTransparency?: number;
|
|
13
|
-
native?: InstanceAttributes<TextLabel>;
|
|
14
|
-
}
|
|
15
|
-
export declare function Badge(props: BadgeProps): Vide.Node;
|
|
16
|
-
export {};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local Vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
4
|
-
local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
|
|
5
|
-
local options = TS.import(script, script.Parent.Parent.Parent, "store").options
|
|
6
|
-
local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
|
|
7
|
-
local Text = TS.import(script, script.Parent.Parent, "ui", "text").Text
|
|
8
|
-
local function Badge(props)
|
|
9
|
-
local _attributes = {
|
|
10
|
-
text = props.text,
|
|
11
|
-
textColor = props.textColor,
|
|
12
|
-
textSize = props.textSize,
|
|
13
|
-
textXAlignment = "Center",
|
|
14
|
-
size = UDim2.fromScale(1, 1),
|
|
15
|
-
font = function()
|
|
16
|
-
return options().font.bold
|
|
17
|
-
end,
|
|
18
|
-
}
|
|
19
|
-
local _attribute = props.native
|
|
20
|
-
if _attribute then
|
|
21
|
-
for _k, _v in _attribute do
|
|
22
|
-
_attributes[_k] = _v
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
return Vide.jsx(Frame, {
|
|
26
|
-
backgroundColor = props.color,
|
|
27
|
-
cornerRadius = function()
|
|
28
|
-
return UDim.new(0, px(4))
|
|
29
|
-
end,
|
|
30
|
-
backgroundTransparency = props.backgroundTransparency,
|
|
31
|
-
clipsDescendants = true,
|
|
32
|
-
anchor = props.anchor,
|
|
33
|
-
position = props.position,
|
|
34
|
-
size = props.size,
|
|
35
|
-
visible = props.visible,
|
|
36
|
-
}, Vide.jsx(Text, _attributes, props.children))
|
|
37
|
-
end
|
|
38
|
-
return {
|
|
39
|
-
Badge = Badge,
|
|
40
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./suggestions";
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import Vide, { Derivable } from "@rbxts/vide";
|
|
2
|
-
import { Suggestion } from "../../types";
|
|
3
|
-
export interface MainSuggestionProps {
|
|
4
|
-
suggestion: Derivable<Suggestion | undefined>;
|
|
5
|
-
currentText?: Derivable<string | undefined>;
|
|
6
|
-
action?: (instance: Frame) => void;
|
|
7
|
-
onSizeChanged?: (size: UDim2) => void;
|
|
8
|
-
}
|
|
9
|
-
export declare function MainSuggestion({ suggestion, currentText, action, onSizeChanged, }: MainSuggestionProps): Vide.Node;
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
4
|
-
local Vide = _vide
|
|
5
|
-
local derive = _vide.derive
|
|
6
|
-
local read = _vide.read
|
|
7
|
-
local source = _vide.source
|
|
8
|
-
local spring = _vide.spring
|
|
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 px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
|
|
13
|
-
local _store = TS.import(script, script.Parent.Parent.Parent, "store")
|
|
14
|
-
local mouseOverInterface = _store.mouseOverInterface
|
|
15
|
-
local options = _store.options
|
|
16
|
-
local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
|
|
17
|
-
local Padding = TS.import(script, script.Parent.Parent, "ui", "padding").Padding
|
|
18
|
-
local Text = TS.import(script, script.Parent.Parent, "ui", "text").Text
|
|
19
|
-
local highlightMatching = TS.import(script, script.Parent, "util").highlightMatching
|
|
20
|
-
local MAX_WIDTH = 180
|
|
21
|
-
local function MainSuggestion(_param)
|
|
22
|
-
local suggestion = _param.suggestion
|
|
23
|
-
local currentText = _param.currentText
|
|
24
|
-
local action = _param.action
|
|
25
|
-
local onSizeChanged = _param.onSizeChanged
|
|
26
|
-
local titleBounds = source(Vector2.new())
|
|
27
|
-
local descriptionBounds = source(Vector2.new())
|
|
28
|
-
local errorBounds = source(Vector2.new())
|
|
29
|
-
local badgeBounds = source(Vector2.new())
|
|
30
|
-
local errorText = derive(function()
|
|
31
|
-
local currentSuggestion = read(suggestion)
|
|
32
|
-
local _result = currentSuggestion
|
|
33
|
-
if _result ~= nil then
|
|
34
|
-
_result = _result.type
|
|
35
|
-
end
|
|
36
|
-
return if _result == "argument" then currentSuggestion.error else nil
|
|
37
|
-
end)
|
|
38
|
-
local windowSize = derive(function()
|
|
39
|
-
if read(suggestion) == nil then
|
|
40
|
-
local size = UDim2.new()
|
|
41
|
-
local _result = onSizeChanged
|
|
42
|
-
if _result ~= nil then
|
|
43
|
-
_result(size)
|
|
44
|
-
end
|
|
45
|
-
return size
|
|
46
|
-
end
|
|
47
|
-
local titleSize = read(titleBounds)
|
|
48
|
-
local descriptionSize = read(descriptionBounds)
|
|
49
|
-
local errorSize = read(errorBounds)
|
|
50
|
-
local width = math.max(titleSize.X, descriptionSize.X, errorSize.X) + badgeBounds().X
|
|
51
|
-
local height = titleSize.Y + descriptionSize.Y + errorSize.Y
|
|
52
|
-
local size = UDim2.fromOffset(width + px(8) * 2, height + px(8) * 2)
|
|
53
|
-
local _result = onSizeChanged
|
|
54
|
-
if _result ~= nil then
|
|
55
|
-
_result(size)
|
|
56
|
-
end
|
|
57
|
-
return size
|
|
58
|
-
end)
|
|
59
|
-
return Vide.jsx(Frame, {
|
|
60
|
-
action = action,
|
|
61
|
-
size = spring(windowSize, 0.2),
|
|
62
|
-
backgroundColor = function()
|
|
63
|
-
return options().palette.background
|
|
64
|
-
end,
|
|
65
|
-
backgroundTransparency = function()
|
|
66
|
-
local _condition = options().backgroundTransparency
|
|
67
|
-
if _condition == nil then
|
|
68
|
-
_condition = 0
|
|
69
|
-
end
|
|
70
|
-
return _condition
|
|
71
|
-
end,
|
|
72
|
-
cornerRadius = function()
|
|
73
|
-
return UDim.new(0, px(8))
|
|
74
|
-
end,
|
|
75
|
-
native = {
|
|
76
|
-
MouseEnter = function()
|
|
77
|
-
return mouseOverInterface(true)
|
|
78
|
-
end,
|
|
79
|
-
MouseLeave = function()
|
|
80
|
-
return mouseOverInterface(false)
|
|
81
|
-
end,
|
|
82
|
-
},
|
|
83
|
-
}, Vide.jsx(Padding, {
|
|
84
|
-
all = function()
|
|
85
|
-
return UDim.new(0, px(8))
|
|
86
|
-
end,
|
|
87
|
-
}), Vide.jsx(Text, {
|
|
88
|
-
text = function()
|
|
89
|
-
local currentSuggestion = read(suggestion)
|
|
90
|
-
local _result = currentSuggestion
|
|
91
|
-
if _result ~= nil then
|
|
92
|
-
_result = _result.type
|
|
93
|
-
end
|
|
94
|
-
local _result_1
|
|
95
|
-
if _result == "argument" then
|
|
96
|
-
_result_1 = currentSuggestion.title
|
|
97
|
-
else
|
|
98
|
-
local _exp = options().palette.highlight
|
|
99
|
-
local _result_2 = currentSuggestion
|
|
100
|
-
if _result_2 ~= nil then
|
|
101
|
-
_result_2 = _result_2.title
|
|
102
|
-
end
|
|
103
|
-
_result_1 = highlightMatching(_exp, _result_2, read(currentText))
|
|
104
|
-
end
|
|
105
|
-
return _result_1
|
|
106
|
-
end,
|
|
107
|
-
textSize = function()
|
|
108
|
-
return px(SUGGESTION_TITLE_TEXT_SIZE)
|
|
109
|
-
end,
|
|
110
|
-
textColor = function()
|
|
111
|
-
return options().palette.text
|
|
112
|
-
end,
|
|
113
|
-
textXAlignment = "Left",
|
|
114
|
-
textYAlignment = "Top",
|
|
115
|
-
font = function()
|
|
116
|
-
return options().font.bold
|
|
117
|
-
end,
|
|
118
|
-
richText = true,
|
|
119
|
-
size = function()
|
|
120
|
-
return UDim2.fromOffset(titleBounds().X, px(SUGGESTION_TITLE_TEXT_SIZE))
|
|
121
|
-
end,
|
|
122
|
-
native = {
|
|
123
|
-
TextBoundsChanged = function(bounds)
|
|
124
|
-
return titleBounds(bounds)
|
|
125
|
-
end,
|
|
126
|
-
},
|
|
127
|
-
}), Vide.jsx(Text, {
|
|
128
|
-
text = function()
|
|
129
|
-
local _result = read(suggestion)
|
|
130
|
-
if _result ~= nil then
|
|
131
|
-
_result = _result.description
|
|
132
|
-
end
|
|
133
|
-
local _condition = _result
|
|
134
|
-
if _condition == nil then
|
|
135
|
-
_condition = ""
|
|
136
|
-
end
|
|
137
|
-
return _condition
|
|
138
|
-
end,
|
|
139
|
-
textSize = function()
|
|
140
|
-
return px(SUGGESTION_TEXT_SIZE)
|
|
141
|
-
end,
|
|
142
|
-
textColor = function()
|
|
143
|
-
return options().palette.subtext
|
|
144
|
-
end,
|
|
145
|
-
textXAlignment = "Left",
|
|
146
|
-
textYAlignment = "Top",
|
|
147
|
-
textWrapped = true,
|
|
148
|
-
richText = true,
|
|
149
|
-
position = function()
|
|
150
|
-
return UDim2.fromOffset(0, px(SUGGESTION_TITLE_TEXT_SIZE))
|
|
151
|
-
end,
|
|
152
|
-
size = function()
|
|
153
|
-
return UDim2.fromOffset(px(MAX_WIDTH), math.max(descriptionBounds().Y, px(SUGGESTION_TEXT_SIZE)))
|
|
154
|
-
end,
|
|
155
|
-
native = {
|
|
156
|
-
TextBoundsChanged = function(rbx)
|
|
157
|
-
return descriptionBounds(rbx)
|
|
158
|
-
end,
|
|
159
|
-
},
|
|
160
|
-
}), Vide.jsx(Text, {
|
|
161
|
-
text = function()
|
|
162
|
-
local _condition = errorText()
|
|
163
|
-
if _condition == nil then
|
|
164
|
-
_condition = ""
|
|
165
|
-
end
|
|
166
|
-
return _condition
|
|
167
|
-
end,
|
|
168
|
-
textColor = function()
|
|
169
|
-
return options().palette.error
|
|
170
|
-
end,
|
|
171
|
-
textSize = function()
|
|
172
|
-
return px(SUGGESTION_TEXT_SIZE)
|
|
173
|
-
end,
|
|
174
|
-
textTransparency = spring(function()
|
|
175
|
-
return if errorText() ~= nil then 0 else 1
|
|
176
|
-
end, 0.2),
|
|
177
|
-
textXAlignment = "Left",
|
|
178
|
-
textWrapped = true,
|
|
179
|
-
automaticSize = "Y",
|
|
180
|
-
anchor = Vector2.new(0, 1),
|
|
181
|
-
position = UDim2.fromScale(0, 1),
|
|
182
|
-
size = function()
|
|
183
|
-
return UDim2.fromOffset(px(MAX_WIDTH), 0)
|
|
184
|
-
end,
|
|
185
|
-
native = {
|
|
186
|
-
TextBoundsChanged = function(bounds)
|
|
187
|
-
errorBounds(if errorText() ~= nil then bounds else Vector2.zero)
|
|
188
|
-
end,
|
|
189
|
-
},
|
|
190
|
-
}), Vide.jsx(Frame, {
|
|
191
|
-
backgroundColor = function()
|
|
192
|
-
return options().palette.highlight
|
|
193
|
-
end,
|
|
194
|
-
cornerRadius = function()
|
|
195
|
-
return UDim.new(0, px(4))
|
|
196
|
-
end,
|
|
197
|
-
clipsDescendants = true,
|
|
198
|
-
visible = function()
|
|
199
|
-
local currentSuggestion = read(suggestion)
|
|
200
|
-
return currentSuggestion ~= nil and currentSuggestion.type == "argument"
|
|
201
|
-
end,
|
|
202
|
-
anchor = Vector2.new(1, 0),
|
|
203
|
-
position = UDim2.fromScale(1, 0),
|
|
204
|
-
size = spring(function()
|
|
205
|
-
return UDim2.fromOffset(badgeBounds().X + px(4), px(SUGGESTION_TITLE_TEXT_SIZE))
|
|
206
|
-
end, 0.2),
|
|
207
|
-
}, Vide.jsx(Text, {
|
|
208
|
-
text = function()
|
|
209
|
-
local currentSuggestion = read(suggestion)
|
|
210
|
-
return if currentSuggestion ~= nil and currentSuggestion.type == "argument" then currentSuggestion.dataType else ""
|
|
211
|
-
end,
|
|
212
|
-
textColor = function()
|
|
213
|
-
return options().palette.surface
|
|
214
|
-
end,
|
|
215
|
-
textSize = function()
|
|
216
|
-
return px(SUGGESTION_TEXT_SIZE)
|
|
217
|
-
end,
|
|
218
|
-
textXAlignment = "Center",
|
|
219
|
-
font = function()
|
|
220
|
-
return options().font.bold
|
|
221
|
-
end,
|
|
222
|
-
size = UDim2.fromScale(1, 1),
|
|
223
|
-
native = {
|
|
224
|
-
TextBoundsChanged = function(bounds)
|
|
225
|
-
return badgeBounds(bounds)
|
|
226
|
-
end,
|
|
227
|
-
},
|
|
228
|
-
})))
|
|
229
|
-
end
|
|
230
|
-
return {
|
|
231
|
-
MainSuggestion = MainSuggestion,
|
|
232
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import Vide, { Derivable } from "@rbxts/vide";
|
|
2
|
-
import { Suggestion } from "../../types";
|
|
3
|
-
export interface SuggestionListProps {
|
|
4
|
-
suggestion?: Derivable<Suggestion | undefined>;
|
|
5
|
-
currentText?: Derivable<string | undefined>;
|
|
6
|
-
size: Derivable<UDim2>;
|
|
7
|
-
}
|
|
8
|
-
export declare function SuggestionList({ suggestion, currentText, size, }: SuggestionListProps): Vide.Node;
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local ArrayUtil = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.data).ArrayUtil
|
|
4
|
-
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
5
|
-
local Vide = _vide
|
|
6
|
-
local derive = _vide.derive
|
|
7
|
-
local For = _vide.For
|
|
8
|
-
local read = _vide.read
|
|
9
|
-
local SUGGESTION_TEXT_SIZE = TS.import(script, script.Parent.Parent.Parent, "constants", "text").SUGGESTION_TEXT_SIZE
|
|
10
|
-
local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
|
|
11
|
-
local _store = TS.import(script, script.Parent.Parent.Parent, "store")
|
|
12
|
-
local mouseOverInterface = _store.mouseOverInterface
|
|
13
|
-
local options = _store.options
|
|
14
|
-
local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
|
|
15
|
-
local Group = TS.import(script, script.Parent.Parent, "ui", "group").Group
|
|
16
|
-
local Padding = TS.import(script, script.Parent.Parent, "ui", "padding").Padding
|
|
17
|
-
local Text = TS.import(script, script.Parent.Parent, "ui", "text").Text
|
|
18
|
-
local highlightMatching = TS.import(script, script.Parent, "util").highlightMatching
|
|
19
|
-
local MAX_SUGGESTIONS = 3
|
|
20
|
-
local function SuggestionList(_param)
|
|
21
|
-
local suggestion = _param.suggestion
|
|
22
|
-
local currentText = _param.currentText
|
|
23
|
-
local size = _param.size
|
|
24
|
-
local suggestions = derive(function()
|
|
25
|
-
local _result = read(suggestion)
|
|
26
|
-
if _result ~= nil then
|
|
27
|
-
_result = _result.others
|
|
28
|
-
end
|
|
29
|
-
local _condition = _result
|
|
30
|
-
if _condition == nil then
|
|
31
|
-
_condition = {}
|
|
32
|
-
end
|
|
33
|
-
return ArrayUtil.slice(_condition, 0, MAX_SUGGESTIONS)
|
|
34
|
-
end)
|
|
35
|
-
return Vide.jsx(Group, {
|
|
36
|
-
size = size,
|
|
37
|
-
native = {
|
|
38
|
-
MouseEnter = function()
|
|
39
|
-
return mouseOverInterface(true)
|
|
40
|
-
end,
|
|
41
|
-
MouseLeave = function()
|
|
42
|
-
return mouseOverInterface(false)
|
|
43
|
-
end,
|
|
44
|
-
},
|
|
45
|
-
}, Vide.jsx("uilistlayout", {
|
|
46
|
-
SortOrder = "LayoutOrder",
|
|
47
|
-
Padding = function()
|
|
48
|
-
return UDim.new(0, px(8))
|
|
49
|
-
end,
|
|
50
|
-
}), Vide.jsx(For, {
|
|
51
|
-
each = suggestions,
|
|
52
|
-
}, function(name, i)
|
|
53
|
-
return Vide.jsx(Frame, {
|
|
54
|
-
size = function()
|
|
55
|
-
return UDim2.new(1, 0, 0, px(SUGGESTION_TEXT_SIZE + 6))
|
|
56
|
-
end,
|
|
57
|
-
backgroundColor = function()
|
|
58
|
-
return options().palette.background
|
|
59
|
-
end,
|
|
60
|
-
backgroundTransparency = function()
|
|
61
|
-
local _condition = options().backgroundTransparency
|
|
62
|
-
if _condition == nil then
|
|
63
|
-
_condition = 0
|
|
64
|
-
end
|
|
65
|
-
return _condition
|
|
66
|
-
end,
|
|
67
|
-
cornerRadius = function()
|
|
68
|
-
return UDim.new(0, px(8))
|
|
69
|
-
end,
|
|
70
|
-
clipsDescendants = true,
|
|
71
|
-
layoutOrder = i,
|
|
72
|
-
}, Vide.jsx(Padding, {
|
|
73
|
-
all = function()
|
|
74
|
-
return UDim.new(0, px(4))
|
|
75
|
-
end,
|
|
76
|
-
}), Vide.jsx(Text, {
|
|
77
|
-
size = function()
|
|
78
|
-
return UDim2.new(1, 0, 1, 0)
|
|
79
|
-
end,
|
|
80
|
-
text = function()
|
|
81
|
-
return highlightMatching(options().palette.highlight, name, read(currentText))
|
|
82
|
-
end,
|
|
83
|
-
textColor = function()
|
|
84
|
-
return options().palette.text
|
|
85
|
-
end,
|
|
86
|
-
textSize = function()
|
|
87
|
-
return px(SUGGESTION_TEXT_SIZE)
|
|
88
|
-
end,
|
|
89
|
-
textXAlignment = "Left",
|
|
90
|
-
richText = true,
|
|
91
|
-
}))
|
|
92
|
-
end))
|
|
93
|
-
end
|
|
94
|
-
return {
|
|
95
|
-
SuggestionList = SuggestionList,
|
|
96
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local TextService = TS.import(script, TS.getModule(script, "@rbxts", "services")).TextService
|
|
4
|
-
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
5
|
-
local Vide = _vide
|
|
6
|
-
local cleanup = _vide.cleanup
|
|
7
|
-
local derive = _vide.derive
|
|
8
|
-
local source = _vide.source
|
|
9
|
-
local spring = _vide.spring
|
|
10
|
-
local SUGGESTION_TEXT_SIZE = TS.import(script, script.Parent.Parent.Parent, "constants", "text").SUGGESTION_TEXT_SIZE
|
|
11
|
-
local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
|
|
12
|
-
local _store = TS.import(script, script.Parent.Parent.Parent, "store")
|
|
13
|
-
local currentSuggestion = _store.currentSuggestion
|
|
14
|
-
local currentTextPart = _store.currentTextPart
|
|
15
|
-
local Group = TS.import(script, script.Parent.Parent, "ui", "group").Group
|
|
16
|
-
local MainSuggestion = TS.import(script, script.Parent, "main-suggestion").MainSuggestion
|
|
17
|
-
local SuggestionList = TS.import(script, script.Parent, "suggestion-list").SuggestionList
|
|
18
|
-
local PADDING = 8
|
|
19
|
-
local function Suggestions()
|
|
20
|
-
local mainSize = source(UDim2.new())
|
|
21
|
-
local listBoundsParams = Instance.new("GetTextBoundsParams")
|
|
22
|
-
listBoundsParams.RichText = true
|
|
23
|
-
cleanup(listBoundsParams)
|
|
24
|
-
local listBounds = derive(function()
|
|
25
|
-
local width = 0
|
|
26
|
-
local _result = currentSuggestion()
|
|
27
|
-
if _result ~= nil then
|
|
28
|
-
_result = _result.others
|
|
29
|
-
end
|
|
30
|
-
local _condition = _result
|
|
31
|
-
if _condition == nil then
|
|
32
|
-
_condition = {}
|
|
33
|
-
end
|
|
34
|
-
local suggestions = _condition
|
|
35
|
-
for _, value in suggestions do
|
|
36
|
-
listBoundsParams.Text = value
|
|
37
|
-
local suggestionBounds = TextService:GetTextBoundsAsync(listBoundsParams)
|
|
38
|
-
width = math.max(width, suggestionBounds.X)
|
|
39
|
-
end
|
|
40
|
-
local height = #suggestions * px(SUGGESTION_TEXT_SIZE + 6) + (#suggestions - 1) * px(4) + px(8)
|
|
41
|
-
return Vector2.new(width, height)
|
|
42
|
-
end)
|
|
43
|
-
return Vide.jsx(Group, {
|
|
44
|
-
automaticSize = "XY",
|
|
45
|
-
size = UDim2.fromOffset(0, 0),
|
|
46
|
-
}, Vide.jsx(MainSuggestion, {
|
|
47
|
-
suggestion = currentSuggestion,
|
|
48
|
-
currentText = currentTextPart,
|
|
49
|
-
onSizeChanged = mainSize,
|
|
50
|
-
}), Vide.jsx(SuggestionList, {
|
|
51
|
-
suggestion = currentSuggestion,
|
|
52
|
-
currentText = currentTextPart,
|
|
53
|
-
size = spring(function()
|
|
54
|
-
return UDim2.new(0, math.max(listBounds().X, mainSize().X.Offset), 0, listBounds().Y)
|
|
55
|
-
end, 0.3),
|
|
56
|
-
}), Vide.jsx("uilistlayout", {
|
|
57
|
-
Padding = function()
|
|
58
|
-
return UDim.new(0, px(PADDING))
|
|
59
|
-
end,
|
|
60
|
-
}))
|
|
61
|
-
end
|
|
62
|
-
return {
|
|
63
|
-
Suggestions = Suggestions,
|
|
64
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function highlightMatching(color: Color3, text?: string, terminalText?: string): string;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v3.0.0
|
|
2
|
-
local function highlightMatching(color, text, terminalText)
|
|
3
|
-
if text == nil then
|
|
4
|
-
return ""
|
|
5
|
-
end
|
|
6
|
-
if terminalText == nil then
|
|
7
|
-
return text
|
|
8
|
-
end
|
|
9
|
-
local _text = text
|
|
10
|
-
local _arg1 = #terminalText
|
|
11
|
-
local subText = string.sub(_text, 0, _arg1)
|
|
12
|
-
if string.lower(terminalText) ~= string.lower(subText) then
|
|
13
|
-
return text
|
|
14
|
-
end
|
|
15
|
-
local _text_1 = text
|
|
16
|
-
local _arg0 = #terminalText + 1
|
|
17
|
-
local unhighlightedText = string.sub(_text_1, _arg0)
|
|
18
|
-
return `<font color="#{color:ToHex()}">{subText}</font>{unhighlightedText}`
|
|
19
|
-
end
|
|
20
|
-
return {
|
|
21
|
-
highlightMatching = highlightMatching,
|
|
22
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { BaseRegistry, ImmutableRegistryPath, RegistryPath } from "@rbxts/centurion";
|
|
2
|
-
import { BaseCommand } from "@rbxts/centurion/out/shared/core/command";
|
|
3
|
-
export declare function formatPartsAsPath(parts: string[]): string;
|
|
4
|
-
export declare function getValidPath(registry: BaseRegistry, text: string[]): ImmutableRegistryPath | undefined;
|
|
5
|
-
export declare function getArgumentNames(registry: BaseRegistry, path: RegistryPath): string[];
|
|
6
|
-
export declare function getMissingArgs(command: BaseCommand, text: string[]): string[];
|