@rbxts/centurion-ui 1.0.0-dev-814be1e → 1.0.0-dev-0822e84

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,5 +1,6 @@
1
1
  import { BaseRegistry, ImmutableRegistryPath, RegistryPath } from "@rbxts/centurion";
2
2
  import { BaseCommand } from "@rbxts/centurion/out/shared/core/command";
3
+ export declare function formatPartsAsPath(parts: string[]): string;
3
4
  export declare function getValidPath(registry: BaseRegistry, text: string[]): ImmutableRegistryPath | undefined;
4
5
  export declare function getArgumentNames(registry: BaseRegistry, path: RegistryPath): string[];
5
6
  export declare function getMissingArgs(command: BaseCommand, text: string[]): string[];
@@ -3,8 +3,10 @@ local TS = _G[script]
3
3
  local _centurion = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out)
4
4
  local ImmutableRegistryPath = _centurion.ImmutableRegistryPath
5
5
  local RegistryPath = _centurion.RegistryPath
6
- local formatPartsAsPath = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.string).formatPartsAsPath
7
6
  local IS_EDIT = TS.import(script, script.Parent.Parent.Parent, "constants", "util").IS_EDIT
7
+ local function formatPartsAsPath(parts)
8
+ return table.concat(parts, "/")
9
+ end
8
10
  local function getValidPath(registry, text)
9
11
  if #text == 0 then
10
12
  return nil
@@ -65,6 +67,7 @@ local function getMissingArgs(command, text)
65
67
  return missingArgs
66
68
  end
67
69
  return {
70
+ formatPartsAsPath = formatPartsAsPath,
68
71
  getValidPath = getValidPath,
69
72
  getArgumentNames = getArgumentNames,
70
73
  getMissingArgs = getMissingArgs,
@@ -1,8 +1,5 @@
1
1
  -- Compiled with roblox-ts v2.3.0-dev-26ec859
2
2
  local TS = _G[script]
3
- local _string = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.string)
4
- local endsWithSpace = _string.endsWithSpace
5
- local formatPartsAsPath = _string.formatPartsAsPath
6
3
  local subscribe = TS.import(script, TS.getModule(script, "@rbxts", "charm").src).subscribe
7
4
  local UserInputService = TS.import(script, TS.getModule(script, "@rbxts", "services")).UserInputService
8
5
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
@@ -29,7 +26,9 @@ local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
29
26
  local Padding = TS.import(script, script.Parent.Parent, "ui", "padding").Padding
30
27
  local Text = TS.import(script, script.Parent.Parent, "ui", "text").Text
31
28
  local TextField = TS.import(script, script.Parent.Parent, "ui", "text-field").TextField
32
- local getArgumentNames = TS.import(script, script.Parent, "command").getArgumentNames
29
+ local _command = TS.import(script, script.Parent, "command")
30
+ local formatPartsAsPath = _command.formatPartsAsPath
31
+ local getArgumentNames = _command.getArgumentNames
33
32
  local TEXT_SIZE = 22
34
33
  local function TerminalTextField(_param)
35
34
  local anchorPoint = _param.anchorPoint
@@ -96,7 +95,7 @@ local function TerminalTextField(_param)
96
95
  suggestionText("")
97
96
  return nil
98
97
  end
99
- local atNextPart = endsWithSpace(terminalText())
98
+ local atNextPart = string.sub(terminalText(), -1) == " "
100
99
  local textParts = terminalTextParts()
101
100
  if #textParts == 0 then
102
101
  suggestionText(suggestion.title)
@@ -175,7 +174,7 @@ local function TerminalTextField(_param)
175
174
  table.move(textParts, 1, #textParts, _length + 1, _array)
176
175
  local pathParts = _array
177
176
  local newText = currentText
178
- if endsWithSpace(currentText) then
177
+ if string.sub(currentText, -1) == " " then
179
178
  newText ..= suggestionTitle
180
179
  table.insert(pathParts, suggestionTitle)
181
180
  elseif not (#textParts == 0) then
@@ -227,10 +226,8 @@ local function TerminalTextField(_param)
227
226
  end
228
227
  local newText = text()
229
228
  local otherSuggestion = suggestion.others[1]
230
- if (string.match(otherSuggestion, "%s")) ~= nil then
231
- otherSuggestion = `"{otherSuggestion}"`
232
- end
233
- local _otherSuggestion = otherSuggestion
229
+ local _newText = newText
230
+ local _exp = #newText
234
231
  local _result = currentTextPart()
235
232
  if _result ~= nil then
236
233
  _result = #_result
@@ -239,7 +236,8 @@ local function TerminalTextField(_param)
239
236
  if _condition_1 == nil then
240
237
  _condition_1 = 0
241
238
  end
242
- newText ..= string.sub(_otherSuggestion, _condition_1 + 1)
239
+ newText = string.sub(_newText, 0, _exp - _condition_1)
240
+ newText ..= if #{ string.match(otherSuggestion, "%s") } == 0 then otherSuggestion else `"{otherSuggestion}"`
243
241
  if argIndex < #commandArgs - 1 then
244
242
  newText ..= " "
245
243
  end
@@ -2,9 +2,7 @@
2
2
  local TS = _G[script]
3
3
  local RegistryPath = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out).RegistryPath
4
4
  local ArrayUtil = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.data).ArrayUtil
5
- local _string = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.string)
6
- local endsWithSpace = _string.endsWithSpace
7
- local splitString = _string.splitString
5
+ local splitString = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.string).splitString
8
6
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
9
7
  local Vide = _vide
10
8
  local effect = _vide.effect
@@ -115,10 +113,9 @@ local function Terminal()
115
113
  end
116
114
  -- If the text ends in a space, we want to count that as having traversed
117
115
  -- to the next "part" of the text.
118
- local atNextPart = endsWithSpace(text)
116
+ local atNextPart = string.sub(text, -1) == " "
119
117
  local path = getValidPath(api.registry, parts)
120
118
  local command = if path ~= nil then api.registry:getCommand(path) else nil
121
- local atCommand = command ~= nil
122
119
  if command ~= nil then
123
120
  -- Check for missing arguments
124
121
  local missing = getMissingArgs(command, parts)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@rbxts/centurion-ui",
3
3
  "description": "Terminal UI for the Centurion command framework",
4
- "version": "1.0.0-dev-814be1e",
4
+ "version": "1.0.0-dev-0822e84",
5
5
  "author": "paradoxuum",
6
6
  "license": "MIT",
7
7
  "main": "out/init.lua",
@@ -32,7 +32,7 @@
32
32
  "dev": "shx rm -rf out && rbxtsc -w"
33
33
  },
34
34
  "devDependencies": {
35
- "@rbxts/centurion": "^1.0.0-dev-814be1e",
35
+ "@rbxts/centurion": "^1.0.0-dev-0822e84",
36
36
  "@rbxts/compiler-types": "2.3.0-types.1",
37
37
  "@rbxts/types": "^1.0.794",
38
38
  "roblox-ts": "2.3.0-dev-26ec859",