@rbxts/centurion-ui 1.0.1 → 1.0.3

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.
@@ -4,12 +4,12 @@ local UserInputService = TS.import(script, TS.getModule(script, "@rbxts", "servi
4
4
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
5
5
  local Vide = _vide
6
6
  local derive = _vide.derive
7
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
7
8
  local _components = TS.import(script, script.Parent.Parent, "components")
8
9
  local Suggestions = _components.Suggestions
9
10
  local Terminal = _components.Terminal
10
11
  local Group = TS.import(script, script.Parent.Parent, "components", "ui", "group").Group
11
12
  local Layer = TS.import(script, script.Parent.Parent, "components", "ui", "layer").Layer
12
- local useAtom = TS.import(script, script.Parent.Parent, "hooks", "use-atom").useAtom
13
13
  local useClient = TS.import(script, script.Parent.Parent, "hooks", "use-client").useClient
14
14
  local useEvent = TS.import(script, script.Parent.Parent, "hooks", "use-event").useEvent
15
15
  local _use_px = TS.import(script, script.Parent.Parent, "hooks", "use-px")
@@ -1,8 +1,32 @@
1
1
  import { CenturionClient } from "@rbxts/centurion";
2
2
  import { InterfaceOptions } from "../types";
3
3
  export declare namespace CenturionUI {
4
+ /**
5
+ * Returns whether the terminal UI is visible.
6
+ *
7
+ * @returns Whether the terminal UI is visible.
8
+ */
4
9
  function isVisible(): boolean;
10
+ /**
11
+ * Sets the visibility of the terminal UI.
12
+ *
13
+ * @param visible Whether the terminal UI should be visible.
14
+ */
5
15
  function setVisible(visible: boolean): void;
16
+ /**
17
+ * Updates the terminal UI options.
18
+ *
19
+ * @param options The options to update.
20
+ */
6
21
  function updateOptions(options: Partial<InterfaceOptions>): void;
22
+ /**
23
+ * Mounts the terminal UI.
24
+ *
25
+ * If `registerBuiltInCommands` is **true** (default), client commands
26
+ * will be registered.
27
+ *
28
+ * @param client The Centurion client.
29
+ * @param options The terminal UI options.
30
+ */
7
31
  function start(client: CenturionClient, options?: Partial<InterfaceOptions>): void;
8
32
  }
package/out/app/init.luau CHANGED
@@ -16,14 +16,35 @@ do
16
16
  local _container = CenturionUI
17
17
  local MAX_PRELOAD_ATTEMPTS = 3
18
18
  local PRELOAD_ATTEMPT_INTERVAL = 3
19
+ --[[
20
+ *
21
+ * Returns whether the terminal UI is visible.
22
+ *
23
+ * @returns Whether the terminal UI is visible.
24
+
25
+ ]]
19
26
  local function isVisible()
20
27
  return interfaceVisible()
21
28
  end
22
29
  _container.isVisible = isVisible
30
+ --[[
31
+ *
32
+ * Sets the visibility of the terminal UI.
33
+ *
34
+ * @param visible Whether the terminal UI should be visible.
35
+
36
+ ]]
23
37
  local function setVisible(visible)
24
38
  interfaceVisible(visible)
25
39
  end
26
40
  _container.setVisible = setVisible
41
+ --[[
42
+ *
43
+ * Updates the terminal UI options.
44
+ *
45
+ * @param options The options to update.
46
+
47
+ ]]
27
48
  local function updateOptions(options)
28
49
  interfaceOptions(function(prev)
29
50
  local _object = table.clone(DEFAULT_INTERFACE_OPTIONS)
@@ -38,6 +59,17 @@ do
38
59
  end)
39
60
  end
40
61
  _container.updateOptions = updateOptions
62
+ --[[
63
+ *
64
+ * Mounts the terminal UI.
65
+ *
66
+ * If `registerBuiltInCommands` is **true** (default), client commands
67
+ * will be registered.
68
+ *
69
+ * @param client The Centurion client.
70
+ * @param options The terminal UI options.
71
+
72
+ ]]
41
73
  local registerCommands
42
74
  local function start(client, options)
43
75
  if options == nil then
@@ -3,8 +3,8 @@ local TS = _G[script]
3
3
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
4
4
  local Vide = _vide
5
5
  local derive = _vide.derive
6
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
6
7
  local HISTORY_TEXT_SIZE = TS.import(script, script.Parent.Parent.Parent, "constants", "text").HISTORY_TEXT_SIZE
7
- local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
8
8
  local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
9
9
  local interfaceOptions = TS.import(script, script.Parent.Parent.Parent, "store").interfaceOptions
10
10
  local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
@@ -5,7 +5,7 @@ local Vide = _vide
5
5
  local derive = _vide.derive
6
6
  local For = _vide.For
7
7
  local read = _vide.read
8
- local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
8
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
9
9
  local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
10
10
  local interfaceOptions = TS.import(script, script.Parent.Parent.Parent, "store").interfaceOptions
11
11
  local ScrollingFrame = TS.import(script, script.Parent.Parent, "ui", "scrolling-frame").ScrollingFrame
@@ -1,7 +1,7 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local Vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
4
- local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
4
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
5
5
  local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
6
6
  local interfaceOptions = TS.import(script, script.Parent.Parent.Parent, "store").interfaceOptions
7
7
  local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
@@ -4,10 +4,10 @@ local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
4
4
  local Vide = _vide
5
5
  local read = _vide.read
6
6
  local spring = _vide.spring
7
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
7
8
  local _text = TS.import(script, script.Parent.Parent.Parent, "constants", "text")
8
9
  local SUGGESTION_TEXT_SIZE = _text.SUGGESTION_TEXT_SIZE
9
10
  local SUGGESTION_TITLE_TEXT_SIZE = _text.SUGGESTION_TITLE_TEXT_SIZE
10
- local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
11
11
  local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
12
12
  local _store = TS.import(script, script.Parent.Parent.Parent, "store")
13
13
  local interfaceOptions = _store.interfaceOptions
@@ -6,8 +6,8 @@ local Vide = _vide
6
6
  local derive = _vide.derive
7
7
  local For = _vide.For
8
8
  local read = _vide.read
9
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
9
10
  local SUGGESTION_TEXT_SIZE = TS.import(script, script.Parent.Parent.Parent, "constants", "text").SUGGESTION_TEXT_SIZE
10
- local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
11
11
  local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
12
12
  local _store = TS.import(script, script.Parent.Parent.Parent, "store")
13
13
  local interfaceOptions = _store.interfaceOptions
@@ -7,10 +7,10 @@ local cleanup = _vide.cleanup
7
7
  local derive = _vide.derive
8
8
  local source = _vide.source
9
9
  local spring = _vide.spring
10
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
10
11
  local _text = TS.import(script, script.Parent.Parent.Parent, "constants", "text")
11
12
  local SUGGESTION_TEXT_SIZE = _text.SUGGESTION_TEXT_SIZE
12
13
  local SUGGESTION_TITLE_TEXT_SIZE = _text.SUGGESTION_TITLE_TEXT_SIZE
13
- local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
14
14
  local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
15
15
  local useTextBounds = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-text-bounds").useTextBounds
16
16
  local _store = TS.import(script, script.Parent.Parent.Parent, "store")
@@ -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 MAX_OTHER_SUGGESTIONS = 3
5
- local function formatText(text)
6
- return if #{ string.match(text, "%s") } == 0 then text else `"{text}"`
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
- return { i, str, #str }
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
- -- ▼ ReadonlyArray.mapFiltered ▼
25
- local _newValue = {}
26
- local _callback = function(str, i)
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
- return { i, str, #str }
30
- end
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
- -- ▲ ReadonlyArray.mapFiltered ▲
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 _newValue
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 _exp = arg.options.suggestions
50
- -- ▼ ReadonlyArray.map ▼
51
- local _newValue = table.create(#_exp)
52
- for _k, _v in _exp do
53
- _newValue[_k] = formatText(_v, _k - 1, _exp)
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
- local _arg0 = formatText(text)
84
- table.insert(suggestions, _arg0)
79
+ table.insert(suggestions, text)
85
80
  end
86
81
  end
87
82
  local errorText
@@ -176,14 +171,14 @@ local function getCommandSuggestion(registry, parentPath, text)
176
171
  end
177
172
  local _object = {
178
173
  type = "command",
179
- title = firstPath:tail(),
174
+ title = mainData.name,
180
175
  }
181
176
  local _left = "others"
182
177
  -- ▼ ReadonlyArray.map ▼
183
178
  local _newValue_1 = table.create(#sortedPaths)
184
179
  local _callback_1 = function(_param)
185
180
  local str = _param[2]
186
- return formatText(str)
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)
@@ -1,12 +1,12 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
- local subscribe = TS.import(script, TS.getModule(script, "@rbxts", "charm").src).subscribe
3
+ local subscribe = TS.import(script, TS.getModule(script, "@rbxts", "Charm")).subscribe
4
4
  local UserInputService = TS.import(script, TS.getModule(script, "@rbxts", "services")).UserInputService
5
5
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
6
6
  local Vide = _vide
7
7
  local cleanup = _vide.cleanup
8
8
  local source = _vide.source
9
- local useAtom = TS.import(script, script.Parent.Parent.Parent.Parent, "hooks", "use-atom").useAtom
9
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
10
10
  local useClient = TS.import(script, script.Parent.Parent.Parent.Parent, "hooks", "use-client").useClient
11
11
  local useEvent = TS.import(script, script.Parent.Parent.Parent.Parent, "hooks", "use-event").useEvent
12
12
  local px = TS.import(script, script.Parent.Parent.Parent.Parent, "hooks", "use-px").px
@@ -8,8 +8,8 @@ local Vide = _vide
8
8
  local derive = _vide.derive
9
9
  local source = _vide.source
10
10
  local spring = _vide.spring
11
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
11
12
  local HISTORY_TEXT_SIZE = TS.import(script, script.Parent.Parent.Parent, "constants", "text").HISTORY_TEXT_SIZE
12
- local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
13
13
  local useClient = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-client").useClient
14
14
  local useHistory = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-history").useHistory
15
15
  local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
@@ -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()
@@ -3,7 +3,7 @@ local TS = _G[script]
3
3
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
4
4
  local Vide = _vide
5
5
  local read = _vide.read
6
- local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
6
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
7
7
  local interfaceOptions = TS.import(script, script.Parent.Parent.Parent, "store").interfaceOptions
8
8
  local function TextField(props)
9
9
  local options = useAtom(interfaceOptions)
@@ -3,7 +3,7 @@ local TS = _G[script]
3
3
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
4
4
  local Vide = _vide
5
5
  local read = _vide.read
6
- local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
6
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
7
7
  local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
8
8
  local interfaceOptions = TS.import(script, script.Parent.Parent.Parent, "store").interfaceOptions
9
9
  local function Text(props)
@@ -5,9 +5,9 @@ local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
5
5
  local cleanup = _vide.cleanup
6
6
  local derive = _vide.derive
7
7
  local source = _vide.source
8
+ local useAtom = TS.import(script, TS.getModule(script, "@rbxts", "VideCharm")).useAtom
8
9
  local HISTORY_TEXT_SIZE = TS.import(script, script.Parent.Parent, "constants", "text").HISTORY_TEXT_SIZE
9
10
  local interfaceOptions = TS.import(script, script.Parent.Parent, "store").interfaceOptions
10
- local useAtom = TS.import(script, script.Parent, "use-atom").useAtom
11
11
  local useClient = TS.import(script, script.Parent, "use-client").useClient
12
12
  local useEvent = TS.import(script, script.Parent, "use-event").useEvent
13
13
  local px = TS.import(script, script.Parent, "use-px").px
@@ -3,20 +3,26 @@ local TS = _G[script]
3
3
  local TextService = TS.import(script, TS.getModule(script, "@rbxts", "services")).TextService
4
4
  local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
5
5
  local cleanup = _vide.cleanup
6
- local derive = _vide.derive
6
+ local effect = _vide.effect
7
7
  local read = _vide.read
8
+ local source = _vide.source
9
+ local getBounds = TS.Promise.promisify(function(params)
10
+ return TextService:GetTextBoundsAsync(params)
11
+ end)
8
12
  local function useTextBounds(_param)
9
13
  local text = _param.text
10
14
  local font = _param.font
11
15
  local size = _param.size
12
16
  local width = _param.width
17
+ local bounds = source(Vector2.zero)
13
18
  local params = Instance.new("GetTextBoundsParams")
14
19
  params.RichText = true
15
20
  cleanup(params)
16
- return derive(function()
21
+ effect(function()
17
22
  local textValue = read(text)
18
23
  if textValue == nil then
19
- return Vector2.zero
24
+ bounds(Vector2.zero)
25
+ return nil
20
26
  end
21
27
  params.Text = textValue
22
28
  local fontValue = read(font)
@@ -31,8 +37,13 @@ local function useTextBounds(_param)
31
37
  if widthValue ~= nil then
32
38
  params.Width = widthValue
33
39
  end
34
- return TextService:GetTextBoundsAsync(params)
40
+ getBounds(params):andThen(function(value)
41
+ return bounds(value)
42
+ end):catch(function()
43
+ return bounds(Vector2.zero)
44
+ end)
35
45
  end)
46
+ return bounds
36
47
  end
37
48
  return {
38
49
  useTextBounds = useTextBounds,
package/out/store.d.ts CHANGED
@@ -8,7 +8,7 @@ export declare const commandArgIndex: import("@rbxts/charm").Atom<number | undef
8
8
  export declare const terminalArgIndex: import("@rbxts/charm").Atom<number | undefined>;
9
9
  export declare const currentSuggestion: import("@rbxts/charm").Atom<Suggestion | undefined>;
10
10
  export declare const terminalText: import("@rbxts/charm").Atom<string>;
11
- export declare const terminalTextParts: import("@rbxts/charm").Molecule<string[]>;
12
- export declare const atNextPart: import("@rbxts/charm").Molecule<boolean>;
11
+ export declare const terminalTextParts: import("@rbxts/charm").Selector<string[]>;
12
+ export declare const atNextPart: import("@rbxts/charm").Selector<boolean>;
13
13
  export declare const terminalTextValid: import("@rbxts/charm").Atom<boolean>;
14
14
  export declare const currentTextPart: import("@rbxts/charm").Atom<string | undefined>;
package/out/store.luau CHANGED
@@ -1,10 +1,13 @@
1
1
  -- Compiled with roblox-ts v3.0.0
2
2
  local TS = _G[script]
3
3
  local splitString = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.string).splitString
4
- local _charm = TS.import(script, TS.getModule(script, "@rbxts", "charm").src)
4
+ local _charm = TS.import(script, TS.getModule(script, "@rbxts", "Charm"))
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 _startQuote = textPart
23
- if _startQuote ~= nil then
24
- local _arg0 = `^(['"])`
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
+ }
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.1",
4
+ "version": "1.0.3",
5
5
  "author": "paradoxuum",
6
6
  "license": "MIT",
7
7
  "main": "out/init.lua",
@@ -32,20 +32,21 @@
32
32
  "dev": "shx rm -rf out && rbxtsc -w"
33
33
  },
34
34
  "devDependencies": {
35
- "@rbxts/centurion": "^1.0.0",
35
+ "@rbxts/centurion": "^1.0.1",
36
36
  "@rbxts/compiler-types": "3.0.0-types.0",
37
- "@rbxts/types": "^1.0.809",
37
+ "@rbxts/types": "^1.0.813",
38
38
  "roblox-ts": "3.0.0",
39
39
  "shx": "^0.3.4",
40
- "typescript": "=5.5.3"
40
+ "typescript": "5.5.3"
41
41
  },
42
42
  "dependencies": {
43
- "@rbxts/charm": "^0.7.5",
43
+ "@rbxts/charm": "^0.8.1",
44
44
  "@rbxts/services": "^1.5.5",
45
45
  "@rbxts/set-timeout": "^1.1.2",
46
- "@rbxts/vide": "^0.4.6"
46
+ "@rbxts/vide": "^0.5.0",
47
+ "@rbxts/vide-charm": "^0.1.1"
47
48
  },
48
49
  "peerDependencies": {
49
- "@rbxts/centurion": "^1.0.0"
50
+ "@rbxts/centurion": "^1.0.1"
50
51
  }
51
52
  }
@@ -1,2 +0,0 @@
1
- import { Molecule } from "@rbxts/charm";
2
- export declare function useAtom<T>(atom: Molecule<T>): import("@rbxts/vide").Source<T>;
@@ -1,17 +0,0 @@
1
- -- Compiled with roblox-ts v3.0.0
2
- local TS = _G[script]
3
- local subscribe = TS.import(script, TS.getModule(script, "@rbxts", "charm").src).subscribe
4
- local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
5
- local cleanup = _vide.cleanup
6
- local source = _vide.source
7
- local function useAtom(atom)
8
- local state = source(atom())
9
- local disconnect = subscribe(atom, state)
10
- cleanup(function()
11
- disconnect()
12
- end)
13
- return state
14
- end
15
- return {
16
- useAtom = useAtom,
17
- }