@rbxts/centurion-ui 1.0.0-dev-84057f1 → 1.0.0-dev-ac608c1

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
@@ -1,9 +1,8 @@
1
1
  -- Compiled with roblox-ts v2.3.0-dev-26ec859
2
2
  local TS = _G[script]
3
+ local RegistryPath = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out).RegistryPath
3
4
  local ArrayUtil = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.data).ArrayUtil
4
- local _string = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.string)
5
- local endsWithSpace = _string.endsWithSpace
6
- local splitString = _string.splitString
5
+ local splitString = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.string).splitString
7
6
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
8
7
  local Vide = _vide
9
8
  local effect = _vide.effect
@@ -114,7 +113,7 @@ local function Terminal()
114
113
  end
115
114
  -- If the text ends in a space, we want to count that as having traversed
116
115
  -- to the next "part" of the text.
117
- local atNextPart = endsWithSpace(text)
116
+ local atNextPart = string.sub(text, -1) == " "
118
117
  local path = getValidPath(api.registry, parts)
119
118
  local command = if path ~= nil then api.registry:getCommand(path) else nil
120
119
  if command ~= nil then
@@ -140,12 +139,7 @@ local function Terminal()
140
139
  terminalArgIndex(argIndex)
141
140
  if command == nil or argIndex == -1 then
142
141
  -- Get command suggestions
143
- local index = #parts - (if atNextPart then 1 else 2)
144
- local _parentPath = path
145
- if _parentPath ~= nil then
146
- _parentPath = _parentPath:slice(0, index)
147
- end
148
- local parentPath = _parentPath
142
+ local parentPath = if not (#parts == 0) then RegistryPath.new(ArrayUtil.slice(parts, 0, #parts - (if atNextPart then 0 else 1))) else nil
149
143
  local _exp = api.registry
150
144
  local _result = parentPath
151
145
  if _result ~= nil then
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-84057f1",
4
+ "version": "1.0.0-dev-ac608c1",
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-84057f1",
35
+ "@rbxts/centurion": "^1.0.0-dev-ac608c1",
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",