@rbxts/centurion-ui 1.0.8 → 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.
Files changed (141) hide show
  1. package/README.md +60 -15
  2. package/centurion.luau +10 -0
  3. package/package.json +13 -23
  4. package/src/analyse/cursor.luau +25 -0
  5. package/src/analyse/highlight.luau +91 -0
  6. package/src/analyse/init.luau +318 -0
  7. package/src/analyse/leventine.luau +298 -0
  8. package/src/analyse/match.luau +39 -0
  9. package/src/analyse/suggest.luau +41 -0
  10. package/src/app/header.luau +128 -0
  11. package/src/app/history.luau +258 -0
  12. package/src/app/init.luau +699 -0
  13. package/src/app/suggestions.luau +419 -0
  14. package/src/button.luau +13 -0
  15. package/src/components/background.luau +37 -0
  16. package/src/components/container.luau +33 -0
  17. package/src/components/corner.luau +11 -0
  18. package/src/components/divider.luau +28 -0
  19. package/src/components/flex.luau +108 -0
  20. package/src/components/gap.luau +25 -0
  21. package/src/components/image.luau +33 -0
  22. package/src/components/padding.luau +59 -0
  23. package/src/components/stroke.luau +20 -0
  24. package/src/components/text.luau +57 -0
  25. package/src/components/textbox.luau +186 -0
  26. package/src/fade.luau +23 -0
  27. package/src/init.luau +142 -0
  28. package/src/input.luau +16 -0
  29. package/src/px.luau +68 -0
  30. package/src/rich.luau +14 -0
  31. package/src/state.luau +33 -0
  32. package/src/theme.luau +70 -0
  33. package/src/ts/index.d.ts +60 -0
  34. package/src/ts/init.luau +5 -0
  35. package/src/types.luau +85 -0
  36. package/vide/init.luau +8 -0
  37. package/vide/src/action.luau +25 -0
  38. package/vide/src/apply.luau +162 -0
  39. package/vide/src/batch.luau +23 -0
  40. package/vide/src/branch.luau +40 -0
  41. package/vide/src/changed.luau +18 -0
  42. package/vide/src/cleanup.luau +43 -0
  43. package/vide/src/context.luau +74 -0
  44. package/vide/src/create.luau +107 -0
  45. package/vide/src/defaults.luau +113 -0
  46. package/vide/src/derive.luau +18 -0
  47. package/vide/src/effect.luau +12 -0
  48. package/vide/src/flags.luau +12 -0
  49. package/vide/src/graph.luau +321 -0
  50. package/vide/src/implicit_effect.luau +125 -0
  51. package/vide/src/indexes.luau +121 -0
  52. package/vide/src/init.luau +10 -0
  53. package/vide/src/lib.luau +120 -0
  54. package/vide/src/mount.luau +11 -0
  55. package/vide/src/read.luau +5 -0
  56. package/vide/src/root.luau +35 -0
  57. package/vide/src/show.luau +36 -0
  58. package/vide/src/source.luau +31 -0
  59. package/vide/src/spring.luau +328 -0
  60. package/vide/src/switch.luau +114 -0
  61. package/vide/src/timeout.luau +27 -0
  62. package/vide/src/untrack.luau +25 -0
  63. package/vide/src/values.luau +131 -0
  64. package/out/app/centurion-app.d.ts +0 -3
  65. package/out/app/centurion-app.luau +0 -86
  66. package/out/app/index.d.ts +0 -32
  67. package/out/app/init.luau +0 -105
  68. package/out/components/history/history-line.d.ts +0 -9
  69. package/out/components/history/history-line.luau +0 -88
  70. package/out/components/history/history-list.d.ts +0 -11
  71. package/out/components/history/history-list.luau +0 -67
  72. package/out/components/history/index.d.ts +0 -1
  73. package/out/components/history/init.luau +0 -7
  74. package/out/components/index.d.ts +0 -2
  75. package/out/components/init.luau +0 -10
  76. package/out/components/suggestions/badge.d.ts +0 -16
  77. package/out/components/suggestions/badge.luau +0 -40
  78. package/out/components/suggestions/index.d.ts +0 -1
  79. package/out/components/suggestions/init.luau +0 -7
  80. package/out/components/suggestions/main-suggestion.d.ts +0 -9
  81. package/out/components/suggestions/main-suggestion.luau +0 -232
  82. package/out/components/suggestions/suggestion-list.d.ts +0 -8
  83. package/out/components/suggestions/suggestion-list.luau +0 -96
  84. package/out/components/suggestions/suggestions.d.ts +0 -2
  85. package/out/components/suggestions/suggestions.luau +0 -64
  86. package/out/components/suggestions/types.d.ts +0 -6
  87. package/out/components/suggestions/types.luau +0 -2
  88. package/out/components/suggestions/util.d.ts +0 -1
  89. package/out/components/suggestions/util.luau +0 -22
  90. package/out/components/terminal/command.d.ts +0 -6
  91. package/out/components/terminal/command.luau +0 -74
  92. package/out/components/terminal/index.d.ts +0 -1
  93. package/out/components/terminal/init.luau +0 -7
  94. package/out/components/terminal/suggestion.d.ts +0 -26
  95. package/out/components/terminal/suggestion.luau +0 -205
  96. package/out/components/terminal/terminal-text-field/index.d.ts +0 -1
  97. package/out/components/terminal/terminal-text-field/init.luau +0 -7
  98. package/out/components/terminal/terminal-text-field/suggestion.d.ts +0 -5
  99. package/out/components/terminal/terminal-text-field/suggestion.luau +0 -124
  100. package/out/components/terminal/terminal-text-field/terminal-text-field.d.ts +0 -13
  101. package/out/components/terminal/terminal-text-field/terminal-text-field.luau +0 -278
  102. package/out/components/terminal/terminal.d.ts +0 -2
  103. package/out/components/terminal/terminal.luau +0 -304
  104. package/out/components/ui/frame.d.ts +0 -17
  105. package/out/components/ui/frame.luau +0 -32
  106. package/out/components/ui/group.d.ts +0 -15
  107. package/out/components/ui/group.luau +0 -29
  108. package/out/components/ui/layer.d.ts +0 -8
  109. package/out/components/ui/layer.luau +0 -26
  110. package/out/components/ui/outline.d.ts +0 -15
  111. package/out/components/ui/outline.luau +0 -116
  112. package/out/components/ui/padding.d.ts +0 -10
  113. package/out/components/ui/padding.luau +0 -19
  114. package/out/components/ui/scrolling-frame.d.ts +0 -14
  115. package/out/components/ui/scrolling-frame.luau +0 -44
  116. package/out/components/ui/text-field.d.ts +0 -12
  117. package/out/components/ui/text-field.luau +0 -60
  118. package/out/components/ui/text.d.ts +0 -17
  119. package/out/components/ui/text.luau +0 -61
  120. package/out/constants/options.d.ts +0 -2
  121. package/out/constants/options.luau +0 -27
  122. package/out/constants/text.d.ts +0 -3
  123. package/out/constants/text.luau +0 -9
  124. package/out/constants/util.d.ts +0 -1
  125. package/out/constants/util.luau +0 -7
  126. package/out/hooks/use-client.d.ts +0 -2
  127. package/out/hooks/use-client.luau +0 -17
  128. package/out/hooks/use-event.d.ts +0 -14
  129. package/out/hooks/use-event.luau +0 -58
  130. package/out/hooks/use-px.d.ts +0 -19
  131. package/out/hooks/use-px.luau +0 -78
  132. package/out/index.d.ts +0 -2
  133. package/out/init.luau +0 -10
  134. package/out/palette.d.ts +0 -47
  135. package/out/palette.luau +0 -42
  136. package/out/store.d.ts +0 -12
  137. package/out/store.luau +0 -26
  138. package/out/types.d.ts +0 -44
  139. package/out/types.luau +0 -2
  140. package/out/utils/string.d.ts +0 -5
  141. package/out/utils/string.luau +0 -25
@@ -1,278 +0,0 @@
1
- -- Compiled with roblox-ts v3.0.0
2
- local TS = _G[script]
3
- local UserInputService = TS.import(script, TS.getModule(script, "@rbxts", "services")).UserInputService
4
- local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
5
- local Vide = _vide
6
- local effect = _vide.effect
7
- local source = _vide.source
8
- local useClient = TS.import(script, script.Parent.Parent.Parent.Parent, "hooks", "use-client").useClient
9
- local useEvent = TS.import(script, script.Parent.Parent.Parent.Parent, "hooks", "use-event").useEvent
10
- local px = TS.import(script, script.Parent.Parent.Parent.Parent, "hooks", "use-px").px
11
- local _store = TS.import(script, script.Parent.Parent.Parent.Parent, "store")
12
- local currentCommandPath = _store.currentCommandPath
13
- local currentSuggestion = _store.currentSuggestion
14
- local options = _store.options
15
- local terminalTextValid = _store.terminalTextValid
16
- local visible = _store.visible
17
- local Frame = TS.import(script, script.Parent.Parent.Parent, "ui", "frame").Frame
18
- local Padding = TS.import(script, script.Parent.Parent.Parent, "ui", "padding").Padding
19
- local Text = TS.import(script, script.Parent.Parent.Parent, "ui", "text").Text
20
- local TextField = TS.import(script, script.Parent.Parent.Parent, "ui", "text-field").TextField
21
- local _suggestion = TS.import(script, script.Parent, "suggestion")
22
- local completeArgument = _suggestion.completeArgument
23
- local completeCommand = _suggestion.completeCommand
24
- local getSuggestedText = _suggestion.getSuggestedText
25
- local TEXT_SIZE = 22
26
- local function TerminalTextField(_param)
27
- local anchor = _param.anchor
28
- local size = _param.size
29
- local position = _param.position
30
- local backgroundTransparency = _param.backgroundTransparency
31
- local onTextChange = _param.onTextChange
32
- local onSubmit = _param.onSubmit
33
- local textParts = _param.textParts
34
- local atNextPart = _param.atNextPart
35
- local client = useClient()
36
- local ref = source()
37
- local commandHistory = source({})
38
- local commandHistoryIndex = source(nil)
39
- local suggestionText = source("")
40
- local currentTextValue = ""
41
- local onScreenKeyboard = false
42
- -- Focus text field when terminal becomes visible
43
- effect(function()
44
- if visible() then
45
- local _result = ref()
46
- if _result ~= nil then
47
- _result:CaptureFocus()
48
- end
49
- else
50
- local _result = ref()
51
- if _result ~= nil then
52
- _result:ReleaseFocus()
53
- end
54
- end
55
- end)
56
- local setText = function(text)
57
- local textBox = ref()
58
- if textBox == nil then
59
- return nil
60
- end
61
- textBox.Text = text
62
- textBox.CursorPosition = #text + 1
63
- end
64
- local traverseHistory = function(up)
65
- local history = commandHistory()
66
- if #history == 0 then
67
- return nil
68
- end
69
- local historyIndex = commandHistoryIndex()
70
- if not up and historyIndex == nil then
71
- return nil
72
- end
73
- local textBox = ref()
74
- if textBox == nil then
75
- return nil
76
- end
77
- local lastIndex = #history - 1
78
- if not up and historyIndex == lastIndex then
79
- setText("")
80
- commandHistoryIndex(nil)
81
- return nil
82
- end
83
- local _condition = historyIndex
84
- if _condition == nil then
85
- _condition = #history
86
- end
87
- local newIndex = math.clamp(_condition + (if up then -1 else 1), 0, lastIndex)
88
- setText(history[newIndex + 1])
89
- commandHistoryIndex(newIndex)
90
- end
91
- effect(function()
92
- local _exp = client.registry
93
- local _result = ref()
94
- if _result ~= nil then
95
- _result = _result.Text
96
- end
97
- local _condition = _result
98
- if _condition == nil then
99
- _condition = ""
100
- end
101
- suggestionText(getSuggestedText(_exp, _condition, textParts(), atNextPart(), currentSuggestion()))
102
- end)
103
- useEvent(UserInputService.InputBegan, function(input)
104
- local textBox = ref()
105
- local _condition = textBox == nil
106
- if not _condition then
107
- local _result = textBox
108
- if _result ~= nil then
109
- _result = _result:IsFocused()
110
- end
111
- _condition = not _result
112
- end
113
- if _condition then
114
- return nil
115
- end
116
- -- Handle history traversal
117
- if input.KeyCode == Enum.KeyCode.Up then
118
- traverseHistory(true)
119
- elseif input.KeyCode == Enum.KeyCode.Down then
120
- traverseHistory(false)
121
- end
122
- if input.KeyCode ~= Enum.KeyCode.Tab then
123
- return nil
124
- end
125
- -- Handle autocompletion
126
- local commandPath = currentCommandPath()
127
- local suggestion = currentSuggestion()
128
- if suggestion == nil then
129
- return nil
130
- end
131
- local currentText = textBox.Text
132
- if commandPath == nil then
133
- setText(completeCommand(client.registry, textBox.Text, textParts(), suggestion.title))
134
- return nil
135
- end
136
- local _result = client.registry:getCommand(commandPath)
137
- if _result ~= nil then
138
- _result = _result.options.arguments
139
- if _result ~= nil then
140
- _result = #_result
141
- end
142
- end
143
- local _condition_1 = _result
144
- if _condition_1 == nil then
145
- _condition_1 = 0
146
- end
147
- local argCount = _condition_1
148
- if suggestion.type == "command" and argCount ~= 0 then
149
- setText(`{currentText} `)
150
- return nil
151
- end
152
- if #suggestion.others == 0 then
153
- setText(currentText)
154
- return nil
155
- end
156
- setText(completeArgument(currentText, suggestion.others[1], argCount))
157
- end)
158
- return Vide.jsx(Frame, {
159
- anchor = anchor,
160
- size = size,
161
- position = position,
162
- backgroundColor = function()
163
- return options().palette.surface
164
- end,
165
- backgroundTransparency = backgroundTransparency,
166
- cornerRadius = function()
167
- return UDim.new(0, px(4))
168
- end,
169
- }, Vide.jsx(Padding, {
170
- all = function()
171
- return UDim.new(0, px(8))
172
- end,
173
- }), Vide.jsx(TextField, {
174
- action = ref,
175
- size = UDim2.fromScale(1, 1),
176
- textSize = function()
177
- return px(TEXT_SIZE)
178
- end,
179
- textColor = function()
180
- return if terminalTextValid() then options().palette.success else options().palette.error
181
- end,
182
- textXAlignment = "Left",
183
- placeholderText = "Enter command...",
184
- placeholderColor = function()
185
- return options().palette.subtext
186
- end,
187
- font = function()
188
- return options().font.medium
189
- end,
190
- clearTextOnFocus = false,
191
- native = {
192
- FocusLost = function(enterPressed)
193
- if not enterPressed then
194
- return nil
195
- end
196
- local textBox = ref()
197
- if textBox == nil then
198
- return nil
199
- end
200
- local currentText = textBox.Text
201
- local history = commandHistory()
202
- if currentText ~= "" and (#history == 0 or history[#history] ~= currentText) then
203
- local _array = {}
204
- local _length = #_array
205
- local _historyLength = #history
206
- table.move(history, 1, _historyLength, _length + 1, _array)
207
- _length += _historyLength
208
- _array[_length + 1] = textBox.Text
209
- commandHistory(_array)
210
- end
211
- commandHistoryIndex(nil)
212
- local _result = onSubmit
213
- if _result ~= nil then
214
- _result(currentText)
215
- end
216
- textBox.Text = ""
217
- if not onScreenKeyboard then
218
- textBox:CaptureFocus()
219
- end
220
- onScreenKeyboard = false
221
- end,
222
- TextChanged = function(currentText)
223
- local textBox = ref()
224
- if textBox == nil then
225
- return nil
226
- end
227
- local historyIndex = commandHistoryIndex()
228
- if historyIndex ~= nil and currentText ~= commandHistory()[historyIndex + 1] then
229
- commandHistoryIndex(nil)
230
- end
231
- -- Remove line breaks
232
- local value = currentText
233
- if (string.match(value, "[\n\r]")) ~= nil then
234
- value = (string.gsub(value, "[\n\r]", ""))
235
- end
236
- -- Remove all tabs from text input - we use these for autocompletion
237
- if (string.match(value, "\t")) ~= nil then
238
- value = (string.gsub(value, "\t", ""))
239
- end
240
- textBox.Text = value
241
- if currentTextValue == value then
242
- return nil
243
- end
244
- currentTextValue = value
245
- local _result = onTextChange
246
- if _result ~= nil then
247
- _result(value)
248
- end
249
- end,
250
- ReturnPressedFromOnScreenKeyboard = function()
251
- local textBox = ref()
252
- if textBox == nil then
253
- return nil
254
- end
255
- task.wait()
256
- onScreenKeyboard = true
257
- textBox:ReleaseFocus(true)
258
- end,
259
- },
260
- zIndex = 2,
261
- }), Vide.jsx(Text, {
262
- size = UDim2.fromScale(1, 1),
263
- text = suggestionText,
264
- textColor = function()
265
- return options().palette.subtext
266
- end,
267
- textSize = function()
268
- return px(TEXT_SIZE)
269
- end,
270
- textXAlignment = "Left",
271
- font = function()
272
- return options().font.medium
273
- end,
274
- }))
275
- end
276
- return {
277
- TerminalTextField = TerminalTextField,
278
- }
@@ -1,2 +0,0 @@
1
- import Vide from "@rbxts/vide";
2
- export declare function Terminal(): Vide.Node;
@@ -1,304 +0,0 @@
1
- -- Compiled with roblox-ts v3.0.0
2
- local TS = _G[script]
3
- local RegistryPath = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out).RegistryPath
4
- local ArrayUtil = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.data).ArrayUtil
5
- local splitString = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.shared.util.string).splitString
6
- local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
7
- local Vide = _vide
8
- local derive = _vide.derive
9
- local source = _vide.source
10
- local spring = _vide.spring
11
- local HISTORY_TEXT_SIZE = TS.import(script, script.Parent.Parent.Parent, "constants", "text").HISTORY_TEXT_SIZE
12
- local useClient = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-client").useClient
13
- local useEvent = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-event").useEvent
14
- local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
15
- local _store = TS.import(script, script.Parent.Parent.Parent, "store")
16
- local commandArgIndex = _store.commandArgIndex
17
- local currentCommandPath = _store.currentCommandPath
18
- local currentSuggestion = _store.currentSuggestion
19
- local currentTextPart = _store.currentTextPart
20
- local mouseOverInterface = _store.mouseOverInterface
21
- local options = _store.options
22
- local terminalArgIndex = _store.terminalArgIndex
23
- local terminalText = _store.terminalText
24
- local terminalTextValid = _store.terminalTextValid
25
- local _string = TS.import(script, script.Parent.Parent.Parent, "utils", "string")
26
- local isQuoteEnded = _string.isQuoteEnded
27
- local isQuoteStarted = _string.isQuoteStarted
28
- local HistoryList = TS.import(script, script.Parent.Parent, "history").HistoryList
29
- local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
30
- local Padding = TS.import(script, script.Parent.Parent, "ui", "padding").Padding
31
- local _command = TS.import(script, script.Parent, "command")
32
- local getMissingArgs = _command.getMissingArgs
33
- local getValidPath = _command.getValidPath
34
- local _suggestion = TS.import(script, script.Parent, "suggestion")
35
- local getArgumentSuggestion = _suggestion.getArgumentSuggestion
36
- local getCommandSuggestion = _suggestion.getCommandSuggestion
37
- local TerminalTextField = TS.import(script, script.Parent, "terminal-text-field").TerminalTextField
38
- local MAX_HEIGHT = HISTORY_TEXT_SIZE * 10
39
- local TEXT_FIELD_HEIGHT = 40
40
- local TRAILING_SPACE_PATTERN = "(%s+)$"
41
- local function Terminal()
42
- local client = useClient()
43
- local missingArgs = source({})
44
- local history = source(client.dispatcher:getHistory())
45
- local historyHeight = source(0)
46
- useEvent(client.dispatcher.historyUpdated, function(entries)
47
- local _array = {}
48
- local _length = #_array
49
- table.move(entries, 1, #entries, _length + 1, _array)
50
- return history(_array)
51
- end)
52
- local maxHeight = derive(function()
53
- return px(MAX_HEIGHT)
54
- end)
55
- local scrollingEnabled = derive(function()
56
- return historyHeight() > maxHeight()
57
- end)
58
- local terminalTextParts = derive(function()
59
- return splitString(terminalText(), " ", true)
60
- end)
61
- local atNextPart = derive(function()
62
- local parts = terminalTextParts()
63
- local textPart = parts[#parts]
64
- local quoted = false
65
- if textPart ~= nil then
66
- quoted = isQuoteStarted(textPart) and not isQuoteEnded(textPart)
67
- end
68
- return string.sub(terminalText(), -1) == " " and not quoted
69
- end)
70
- local terminalHeight = derive(function()
71
- local padding = px.ceil(TEXT_FIELD_HEIGHT + 16)
72
- if #history() == 0 then
73
- return padding
74
- end
75
- local clampedHeight = if scrollingEnabled() then maxHeight() else historyHeight()
76
- return math.ceil(padding + clampedHeight + px(8))
77
- end)
78
- return Vide.jsx(Frame, {
79
- size = spring(function()
80
- return UDim2.new(1, 0, 0, terminalHeight())
81
- end, 0.2),
82
- backgroundColor = function()
83
- return options().palette.background
84
- end,
85
- backgroundTransparency = function()
86
- local _condition = options().backgroundTransparency
87
- if _condition == nil then
88
- _condition = 0
89
- end
90
- return _condition
91
- end,
92
- cornerRadius = function()
93
- return UDim.new(0, px(8))
94
- end,
95
- native = {
96
- MouseEnter = function()
97
- return mouseOverInterface(true)
98
- end,
99
- MouseLeave = function()
100
- return mouseOverInterface(false)
101
- end,
102
- },
103
- }, Vide.jsx(Padding, {
104
- all = function()
105
- return UDim.new(0, px(8))
106
- end,
107
- }), Vide.jsx(HistoryList, {
108
- size = function()
109
- return UDim2.new(1, 0, 1, -px(TEXT_FIELD_HEIGHT + 8))
110
- end,
111
- entries = history,
112
- scrollingEnabled = scrollingEnabled,
113
- onContentSizeChanged = function(size)
114
- historyHeight(size.Y)
115
- end,
116
- }), Vide.jsx(TerminalTextField, {
117
- anchor = Vector2.new(0, 1),
118
- size = function()
119
- return UDim2.new(1, 0, 0, px(TEXT_FIELD_HEIGHT))
120
- end,
121
- position = UDim2.fromScale(0, 1),
122
- backgroundTransparency = function()
123
- local _condition = options().backgroundTransparency
124
- if _condition == nil then
125
- _condition = 0
126
- end
127
- return _condition
128
- end,
129
- textParts = terminalTextParts,
130
- atNextPart = atNextPart,
131
- onTextChange = function(text)
132
- terminalText(text)
133
- terminalTextValid(false)
134
- missingArgs({})
135
- local parts = terminalTextParts()
136
- if #parts == 0 then
137
- currentCommandPath(nil)
138
- currentSuggestion(nil)
139
- terminalArgIndex(nil)
140
- return nil
141
- end
142
- -- If the text ends in a space, we want to count that as having traversed
143
- -- to the next "part" of the text.
144
- local endsInSpace = string.sub(text, -1) == " "
145
- local path = getValidPath(client.registry, parts)
146
- local command = if path ~= nil then client.registry:getCommand(path) else nil
147
- if command ~= nil then
148
- -- Check for missing arguments
149
- local missing = getMissingArgs(command, parts)
150
- local _result = command.options.arguments
151
- if _result ~= nil then
152
- _result = #_result == 0
153
- end
154
- local _condition = _result
155
- if _condition == nil then
156
- _condition = true
157
- end
158
- local noArgs = _condition
159
- currentCommandPath(path)
160
- missingArgs(missing)
161
- terminalTextValid(noArgs or #missing == 0 or (endsInSpace and #missing == 1))
162
- else
163
- currentCommandPath(nil)
164
- terminalTextValid(false)
165
- end
166
- local textPart = parts[#parts]
167
- local atNext = atNextPart()
168
- if atNext then
169
- textPart = nil
170
- elseif textPart ~= nil then
171
- local _condition = (string.match(text, TRAILING_SPACE_PATTERN))
172
- if _condition == nil then
173
- _condition = ""
174
- end
175
- local spaces = _condition
176
- textPart ..= tostring(spaces)
177
- end
178
- local argIndex = if path ~= nil then #parts - path:size() - (if atNext then 0 else 1) else -1
179
- terminalArgIndex(argIndex)
180
- if command == nil or argIndex == -1 then
181
- -- Get command suggestions
182
- local parentPath = if not (#parts == 0) then RegistryPath.new(ArrayUtil.slice(parts, 0, #parts - (if atNext then 0 else 1))) else nil
183
- currentTextPart(textPart)
184
- local _exp = client.registry
185
- local _result = parentPath
186
- if _result ~= nil then
187
- _result = _result:isEmpty()
188
- end
189
- currentSuggestion(getCommandSuggestion(_exp, if not _result then parentPath else nil, textPart))
190
- return nil
191
- end
192
- -- Handle arguments
193
- local args = command.options.arguments
194
- if args == nil then
195
- currentTextPart(nil)
196
- currentSuggestion(nil)
197
- commandArgIndex(nil)
198
- return nil
199
- end
200
- local index = -1
201
- local currentArg
202
- local endIndex = -1
203
- for i = 0, argIndex do
204
- if endIndex == nil or i <= endIndex then
205
- continue
206
- end
207
- index += 1
208
- if index >= #args then
209
- currentArg = nil
210
- break
211
- end
212
- currentArg = args[index + 1]
213
- local _condition = currentArg.numArgs
214
- if _condition == nil then
215
- _condition = 1
216
- end
217
- local numArgs = _condition
218
- endIndex = if numArgs ~= "rest" then i + (numArgs - 1) else nil
219
- end
220
- local _registry = client.registry
221
- local _result = currentArg
222
- if _result ~= nil then
223
- _result = _result.type
224
- end
225
- local _condition = _result
226
- if _condition == nil then
227
- _condition = ""
228
- end
229
- local argType = _registry:getType(_condition)
230
- if currentArg == nil or argType == nil then
231
- currentSuggestion(nil)
232
- currentTextPart(nil)
233
- terminalArgIndex(nil)
234
- commandArgIndex(nil)
235
- return nil
236
- end
237
- commandArgIndex(index)
238
- local argTextPart
239
- local suggestion
240
- if argType.kind == "single" then
241
- argTextPart = textPart
242
- suggestion = getArgumentSuggestion({
243
- kind = "single",
244
- options = currentArg,
245
- type = argType,
246
- input = argTextPart,
247
- }, argTextPart)
248
- else
249
- local _condition_1 = textPart
250
- if _condition_1 == nil then
251
- _condition_1 = ""
252
- end
253
- local textParts = splitString(_condition_1, ",", true)
254
- local lastText = if not (#textParts == 0) then textParts[#textParts] else nil
255
- local _result_1 = textPart
256
- if _result_1 ~= nil then
257
- _result_1 = string.sub(_result_1, -1)
258
- end
259
- argTextPart = if _result_1 ~= "," then lastText else nil
260
- suggestion = getArgumentSuggestion({
261
- kind = "list",
262
- options = currentArg,
263
- type = argType,
264
- input = if #textParts > 1 then textParts else nil,
265
- }, argTextPart)
266
- end
267
- currentTextPart(argTextPart)
268
- currentSuggestion(suggestion)
269
- local _result_1 = suggestion
270
- if _result_1 ~= nil then
271
- _result_1 = _result_1.error
272
- end
273
- if _result_1 ~= nil then
274
- terminalTextValid(false)
275
- end
276
- end,
277
- onSubmit = function()
278
- local commandPath = currentCommandPath()
279
- local command = if commandPath ~= nil then client.registry:getCommand(commandPath) else nil
280
- if commandPath == nil or command == nil then
281
- client.dispatcher:addHistoryEntry({
282
- success = false,
283
- text = "Command not found.",
284
- sentAt = os.time(),
285
- })
286
- return nil
287
- end
288
- local missing = missingArgs()
289
- if not (#missing == 0) then
290
- client.dispatcher:addHistoryEntry({
291
- success = false,
292
- text = `Missing arguments: {table.concat(missing, ", ")}`,
293
- sentAt = os.time(),
294
- })
295
- return nil
296
- end
297
- local args = ArrayUtil.slice(splitString(terminalText(), " "), commandPath:size())
298
- client.dispatcher:run(commandPath, args)
299
- end,
300
- }))
301
- end
302
- return {
303
- Terminal = Terminal,
304
- }
@@ -1,17 +0,0 @@
1
- import Vide, { ActionAttributes, Derivable, InferEnumNames, InstanceAttributes } from "@rbxts/vide";
2
- export interface FrameProps<T extends Instance = Frame> extends ActionAttributes<T> {
3
- size?: Derivable<UDim2>;
4
- position?: Derivable<UDim2>;
5
- anchor?: Derivable<Vector2>;
6
- rotation?: Derivable<number>;
7
- backgroundColor?: Derivable<Color3>;
8
- backgroundTransparency?: Derivable<number>;
9
- clipsDescendants?: Derivable<boolean>;
10
- visible?: Derivable<boolean>;
11
- zIndex?: Derivable<number>;
12
- layoutOrder?: Derivable<number>;
13
- cornerRadius?: Derivable<UDim>;
14
- automaticSize?: InferEnumNames<Enum.AutomaticSize>;
15
- native?: InstanceAttributes<T>;
16
- }
17
- export declare function Frame(props: FrameProps): Vide.Node;
@@ -1,32 +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 function Frame(props)
5
- local _attributes = {
6
- AutomaticSize = props.automaticSize,
7
- Size = props.size,
8
- Position = props.position,
9
- AnchorPoint = props.anchor,
10
- Rotation = props.rotation,
11
- BackgroundColor3 = props.backgroundColor,
12
- BackgroundTransparency = props.backgroundTransparency,
13
- ClipsDescendants = props.clipsDescendants,
14
- Visible = props.visible,
15
- ZIndex = props.zIndex,
16
- LayoutOrder = props.layoutOrder,
17
- action = props.action,
18
- BorderSizePixel = 0,
19
- }
20
- local _attribute = props.native
21
- if _attribute then
22
- for _k, _v in _attribute do
23
- _attributes[_k] = _v
24
- end
25
- end
26
- return Vide.jsx("frame", _attributes, props.cornerRadius and Vide.jsx("uicorner", {
27
- CornerRadius = props.cornerRadius,
28
- }), props.children)
29
- end
30
- return {
31
- Frame = Frame,
32
- }
@@ -1,15 +0,0 @@
1
- import Vide, { Derivable } from "@rbxts/vide";
2
- import { FrameProps } from "./frame";
3
- interface GroupProps extends Omit<FrameProps, "backgroundTransparency" | "backgroundColor"> {
4
- name?: Derivable<string>;
5
- anchor?: Derivable<Vector2>;
6
- position?: Derivable<UDim2>;
7
- size?: Derivable<UDim2>;
8
- rotation?: Derivable<number>;
9
- clipsDescendants?: Derivable<boolean>;
10
- layoutOrder?: Derivable<number>;
11
- visible?: Derivable<boolean>;
12
- zIndex?: Derivable<number>;
13
- }
14
- export declare function Group(props: GroupProps): Vide.Node;
15
- export {};
@@ -1,29 +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 function Group(props)
5
- local _attributes = {
6
- AutomaticSize = props.automaticSize,
7
- AnchorPoint = props.anchor,
8
- Position = props.position,
9
- Size = props.size or UDim2.fromScale(1, 1),
10
- Rotation = props.rotation,
11
- BackgroundTransparency = 1,
12
- ClipsDescendants = props.clipsDescendants,
13
- Visible = props.visible,
14
- ZIndex = props.zIndex,
15
- LayoutOrder = props.layoutOrder,
16
- action = props.action,
17
- BorderSizePixel = 0,
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", _attributes, props.children)
26
- end
27
- return {
28
- Group = Group,
29
- }
@@ -1,8 +0,0 @@
1
- import Vide, { Derivable } from "@rbxts/vide";
2
- interface LayerProps extends Vide.PropsWithChildren {
3
- name?: Derivable<string>;
4
- visible?: Derivable<boolean>;
5
- displayOrder?: Derivable<number>;
6
- }
7
- export declare function Layer({ name, visible, displayOrder, children }: LayerProps): Vide.Node;
8
- export {};