@rbxts/centurion-ui 1.0.1 → 1.0.2
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.
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v3.0.0
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local Players = TS.import(script, TS.getModule(script, "@rbxts", "services")).Players
|
|
4
|
-
local
|
|
5
|
-
local
|
|
6
|
-
|
|
7
|
-
end
|
|
4
|
+
local _string = TS.import(script, script.Parent.Parent.Parent, "utils", "string")
|
|
5
|
+
local containsSpace = _string.containsSpace
|
|
6
|
+
local getQuoteChar = _string.getQuoteChar
|
|
8
7
|
local function getMatches(strings, text)
|
|
9
8
|
if text == nil then
|
|
10
9
|
table.sort(strings)
|
|
11
10
|
-- ▼ ReadonlyArray.map ▼
|
|
12
11
|
local _newValue = table.create(#strings)
|
|
13
12
|
local _callback = function(str, i)
|
|
14
|
-
|
|
13
|
+
local formatted = if containsSpace(str) then `"{str}"` else str
|
|
14
|
+
return { i, formatted, #formatted }
|
|
15
15
|
end
|
|
16
16
|
for _k, _v in strings do
|
|
17
17
|
_newValue[_k] = _callback(_v, _k - 1, strings)
|
|
@@ -21,39 +21,35 @@ local function getMatches(strings, text)
|
|
|
21
21
|
end
|
|
22
22
|
local textLower = string.lower(text)
|
|
23
23
|
local textEndIndex = #text
|
|
24
|
-
|
|
25
|
-
local
|
|
26
|
-
local
|
|
24
|
+
local quoteChar = getQuoteChar(text)
|
|
25
|
+
local quoted = quoteChar ~= nil
|
|
26
|
+
local results = {}
|
|
27
|
+
for i = 0, #strings - 1 do
|
|
28
|
+
local str = strings[i + 1]
|
|
29
|
+
if quoted then
|
|
30
|
+
str = `{quoteChar}{str}{quoteChar}`
|
|
31
|
+
elseif containsSpace(str) then
|
|
32
|
+
str = `"{str}"`
|
|
33
|
+
end
|
|
27
34
|
local part = string.sub(string.lower(str), 0, textEndIndex)
|
|
28
35
|
if part == textLower then
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
end
|
|
32
|
-
local _length = 0
|
|
33
|
-
for _k, _v in strings do
|
|
34
|
-
local _result = _callback(_v, _k - 1, strings)
|
|
35
|
-
if _result ~= nil then
|
|
36
|
-
_length += 1
|
|
37
|
-
_newValue[_length] = _result
|
|
36
|
+
local _arg0 = { i, str, #str }
|
|
37
|
+
table.insert(results, _arg0)
|
|
38
38
|
end
|
|
39
39
|
end
|
|
40
|
-
|
|
41
|
-
table.sort(_newValue, function(a, b)
|
|
40
|
+
table.sort(results, function(a, b)
|
|
42
41
|
return a[2] < b[2]
|
|
43
42
|
end)
|
|
44
|
-
return
|
|
43
|
+
return results
|
|
45
44
|
end
|
|
46
45
|
local function getArgumentSuggestion(arg, textPart)
|
|
47
46
|
local _result
|
|
48
47
|
if arg.options.suggestions ~= nil then
|
|
49
|
-
local
|
|
50
|
-
|
|
51
|
-
local
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
end
|
|
55
|
-
-- ▲ ReadonlyArray.map ▲
|
|
56
|
-
_result = _newValue
|
|
48
|
+
local _array = {}
|
|
49
|
+
local _length = #_array
|
|
50
|
+
local _array_1 = arg.options.suggestions
|
|
51
|
+
table.move(_array_1, 1, #_array_1, _length + 1, _array)
|
|
52
|
+
_result = _array
|
|
57
53
|
else
|
|
58
54
|
_result = {}
|
|
59
55
|
end
|
|
@@ -80,8 +76,7 @@ local function getArgumentSuggestion(arg, textPart)
|
|
|
80
76
|
local typeSuggestions = _result_1
|
|
81
77
|
if typeSuggestions ~= nil then
|
|
82
78
|
for _, text in typeSuggestions do
|
|
83
|
-
|
|
84
|
-
table.insert(suggestions, _arg0)
|
|
79
|
+
table.insert(suggestions, text)
|
|
85
80
|
end
|
|
86
81
|
end
|
|
87
82
|
local errorText
|
|
@@ -183,7 +178,7 @@ local function getCommandSuggestion(registry, parentPath, text)
|
|
|
183
178
|
local _newValue_1 = table.create(#sortedPaths)
|
|
184
179
|
local _callback_1 = function(_param)
|
|
185
180
|
local str = _param[2]
|
|
186
|
-
return
|
|
181
|
+
return str
|
|
187
182
|
end
|
|
188
183
|
for _k, _v in sortedPaths do
|
|
189
184
|
_newValue_1[_k] = _callback_1(_v, _k - 1, sortedPaths)
|
|
@@ -37,7 +37,6 @@ local getCommandSuggestion = _suggestion.getCommandSuggestion
|
|
|
37
37
|
local TerminalTextField = TS.import(script, script.Parent, "terminal-text-field").TerminalTextField
|
|
38
38
|
local MAX_HEIGHT = HISTORY_TEXT_SIZE * 10
|
|
39
39
|
local TEXT_FIELD_HEIGHT = 40
|
|
40
|
-
local START_QUOTE_PATTERN = `^(['"])`
|
|
41
40
|
local TRAILING_SPACE_PATTERN = "(%s+)$"
|
|
42
41
|
local function Terminal()
|
|
43
42
|
local client = useClient()
|
package/out/store.luau
CHANGED
|
@@ -5,6 +5,9 @@ local _charm = TS.import(script, TS.getModule(script, "@rbxts", "charm").src)
|
|
|
5
5
|
local atom = _charm.atom
|
|
6
6
|
local computed = _charm.computed
|
|
7
7
|
local DEFAULT_INTERFACE_OPTIONS = TS.import(script, script.Parent, "constants", "options").DEFAULT_INTERFACE_OPTIONS
|
|
8
|
+
local _string = TS.import(script, script.Parent, "utils", "string")
|
|
9
|
+
local isQuoteEnded = _string.isQuoteEnded
|
|
10
|
+
local isQuoteStarted = _string.isQuoteStarted
|
|
8
11
|
local interfaceVisible = atom(false)
|
|
9
12
|
local interfaceOptions = atom(DEFAULT_INTERFACE_OPTIONS)
|
|
10
13
|
local mouseOverInterface = atom(false)
|
|
@@ -19,19 +22,10 @@ end)
|
|
|
19
22
|
local atNextPart = computed(function()
|
|
20
23
|
local parts = terminalTextParts()
|
|
21
24
|
local textPart = parts[#parts]
|
|
22
|
-
local
|
|
23
|
-
if
|
|
24
|
-
|
|
25
|
-
_startQuote = string.match(_startQuote, _arg0)
|
|
25
|
+
local quoted = false
|
|
26
|
+
if textPart ~= nil then
|
|
27
|
+
quoted = isQuoteStarted(textPart) and not isQuoteEnded(textPart)
|
|
26
28
|
end
|
|
27
|
-
local startQuote = _startQuote
|
|
28
|
-
local _endQuote = textPart
|
|
29
|
-
if _endQuote ~= nil then
|
|
30
|
-
local _arg0 = `(['"])%s*$`
|
|
31
|
-
_endQuote = string.match(_endQuote, _arg0)
|
|
32
|
-
end
|
|
33
|
-
local endQuote = _endQuote
|
|
34
|
-
local quoted = startQuote ~= nil and endQuote == nil
|
|
35
29
|
return string.sub(terminalText(), -1) == " " and not quoted
|
|
36
30
|
end)
|
|
37
31
|
local terminalTextValid = atom(false)
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function containsSpace(text: string): boolean;
|
|
2
|
+
export declare function stripQuotes(text: string): string;
|
|
3
|
+
export declare function getQuoteChar(text: string): string;
|
|
4
|
+
export declare function isQuoteStarted(text: string): boolean;
|
|
5
|
+
export declare function isQuoteEnded(text: string): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v3.0.0
|
|
2
|
+
local START_QUOTE_PATTERN = `^(['"])`
|
|
3
|
+
local END_QUOTE_PATTERN = `(['"])%s*$`
|
|
4
|
+
local function containsSpace(text)
|
|
5
|
+
return not (#{ string.match(text, "%s") } == 0)
|
|
6
|
+
end
|
|
7
|
+
local function stripQuotes(text)
|
|
8
|
+
return (string.gsub((string.gsub(text, START_QUOTE_PATTERN, "")), END_QUOTE_PATTERN, ""))
|
|
9
|
+
end
|
|
10
|
+
local function getQuoteChar(text)
|
|
11
|
+
return (string.match(text, START_QUOTE_PATTERN))
|
|
12
|
+
end
|
|
13
|
+
local function isQuoteStarted(text)
|
|
14
|
+
return (string.match(text, START_QUOTE_PATTERN)) ~= nil
|
|
15
|
+
end
|
|
16
|
+
local function isQuoteEnded(text)
|
|
17
|
+
return (string.match(text, END_QUOTE_PATTERN)) ~= nil
|
|
18
|
+
end
|
|
19
|
+
return {
|
|
20
|
+
containsSpace = containsSpace,
|
|
21
|
+
stripQuotes = stripQuotes,
|
|
22
|
+
getQuoteChar = getQuoteChar,
|
|
23
|
+
isQuoteStarted = isQuoteStarted,
|
|
24
|
+
isQuoteEnded = isQuoteEnded,
|
|
25
|
+
}
|