@rbxts/centurion-ui 1.0.0-dev-284510d → 1.0.0-dev-a7b777e
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.
- package/README.md +29 -0
- package/out/app/centurion-app.d.ts +3 -0
- package/out/app/centurion-app.lua +92 -0
- package/out/app/index.d.ts +6 -1
- package/out/app/init.lua +57 -4
- package/out/components/history/history-line.d.ts +5 -5
- package/out/components/history/history-line.lua +51 -27
- package/out/components/history/history-list.d.ts +8 -12
- package/out/components/history/history-list.lua +41 -41
- package/out/components/index.d.ts +1 -0
- package/out/components/init.lua +3 -0
- package/out/components/suggestions/badge.d.ts +11 -11
- package/out/components/suggestions/badge.lua +14 -20
- package/out/components/suggestions/main-suggestion.d.ts +6 -8
- package/out/components/suggestions/main-suggestion.lua +153 -143
- package/out/components/suggestions/suggestion-list.d.ts +5 -5
- package/out/components/suggestions/suggestion-list.lua +70 -49
- package/out/components/suggestions/suggestions.d.ts +2 -1
- package/out/components/suggestions/suggestions.lua +41 -50
- package/out/components/suggestions/util.d.ts +2 -2
- package/out/components/suggestions/util.lua +1 -0
- package/out/components/terminal/index.d.ts +1 -0
- package/out/{store/history → components/terminal}/init.lua +1 -1
- package/out/components/terminal/terminal-text-field.d.ts +11 -0
- package/out/components/terminal/terminal-text-field.lua +319 -0
- package/out/components/terminal/terminal.d.ts +2 -0
- package/out/components/terminal/terminal.lua +240 -0
- package/out/components/ui/frame.d.ts +17 -18
- package/out/components/ui/frame.lua +8 -10
- package/out/components/ui/group.d.ts +13 -15
- package/out/components/ui/group.lua +6 -9
- package/out/components/ui/layer.d.ts +5 -5
- package/out/components/ui/layer.lua +3 -3
- package/out/components/ui/outline.d.ts +13 -12
- package/out/components/ui/outline.lua +64 -54
- package/out/components/ui/padding.d.ts +7 -7
- package/out/components/ui/padding.lua +2 -2
- package/out/components/ui/scrolling-frame.d.ts +11 -12
- package/out/components/ui/scrolling-frame.lua +4 -9
- package/out/components/ui/text-field.d.ts +10 -9
- package/out/components/ui/text-field.lua +15 -13
- package/out/components/ui/text.d.ts +16 -16
- package/out/components/ui/text.lua +39 -38
- package/out/constants/springs.lua +1 -1
- package/out/hooks/use-api.d.ts +3 -0
- package/out/hooks/use-api.lua +18 -0
- package/out/hooks/use-atom.d.ts +2 -0
- package/out/hooks/use-atom.lua +17 -0
- package/out/hooks/use-debounce-source.d.ts +11 -0
- package/out/hooks/use-debounce-source.lua +27 -0
- package/out/hooks/use-event.d.ts +14 -0
- package/out/hooks/use-event.lua +58 -0
- package/out/hooks/use-history.d.ts +2 -0
- package/out/hooks/use-history.lua +56 -0
- package/out/hooks/use-motion.d.ts +4 -4
- package/out/hooks/use-motion.lua +11 -16
- package/out/hooks/use-px.d.ts +13 -1
- package/out/hooks/use-px.lua +52 -39
- package/out/store.d.ts +14 -0
- package/out/store.lua +44 -0
- package/out/types.d.ts +7 -4
- package/out/util/argument.d.ts +2 -1
- package/out/util/argument.lua +25 -0
- package/out/util/suggestion.d.ts +2 -2
- package/out/util/suggestion.lua +9 -14
- package/package.json +14 -14
- package/out/app/app.d.ts +0 -6
- package/out/app/app.lua +0 -83
- package/out/app/terminal-app.d.ts +0 -1
- package/out/app/terminal-app.lua +0 -61
- package/out/components/terminal-text-field.d.ts +0 -11
- package/out/components/terminal-text-field.lua +0 -289
- package/out/components/terminal-window.d.ts +0 -1
- package/out/components/terminal-window.lua +0 -265
- package/out/components/terminal.d.ts +0 -1
- package/out/components/terminal.lua +0 -26
- package/out/components/ui/shortcut-group.d.ts +0 -6
- package/out/components/ui/shortcut-group.lua +0 -100
- package/out/hooks/use-store.d.ts +0 -3
- package/out/hooks/use-store.lua +0 -7
- package/out/providers/api-provider.d.ts +0 -8
- package/out/providers/api-provider.lua +0 -17
- package/out/providers/options-provider.d.ts +0 -13
- package/out/providers/options-provider.lua +0 -39
- package/out/providers/root-provider.d.ts +0 -11
- package/out/providers/root-provider.lua +0 -24
- package/out/store/app/app-selectors.d.ts +0 -2
- package/out/store/app/app-selectors.lua +0 -7
- package/out/store/app/app-slice.d.ts +0 -8
- package/out/store/app/app-slice.lua +0 -17
- package/out/store/app/index.d.ts +0 -2
- package/out/store/app/init.lua +0 -10
- package/out/store/command/command-selectors.d.ts +0 -2
- package/out/store/command/command-selectors.lua +0 -7
- package/out/store/command/command-slice.d.ts +0 -15
- package/out/store/command/command-slice.lua +0 -21
- package/out/store/command/index.d.ts +0 -2
- package/out/store/command/init.lua +0 -10
- package/out/store/history/history-slice.d.ts +0 -11
- package/out/store/history/history-slice.lua +0 -52
- package/out/store/history/index.d.ts +0 -1
- package/out/store/index.d.ts +0 -46
- package/out/store/init.lua +0 -18
- package/out/store/suggestion/index.d.ts +0 -2
- package/out/store/suggestion/init.lua +0 -10
- package/out/store/suggestion/suggestion-selectors.d.ts +0 -2
- package/out/store/suggestion/suggestion-selectors.lua +0 -7
- package/out/store/suggestion/suggestion-slice.d.ts +0 -9
- package/out/store/suggestion/suggestion-slice.lua +0 -15
- package/out/store/text/index.d.ts +0 -2
- package/out/store/text/init.lua +0 -10
- package/out/store/text/text-selectors.d.ts +0 -3
- package/out/store/text/text-selectors.lua +0 -11
- package/out/store/text/text-slice.d.ts +0 -20
- package/out/store/text/text-slice.lua +0 -29
package/README.md
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<a href="https://centurion.paradoxum.dev/" target="_blank">
|
|
3
|
+
<img src="../../docs/src/assets/logo.webp" width="150" />
|
|
4
|
+
</a>
|
|
5
|
+
|
|
6
|
+
<h1>Centurion - UI</h1>
|
|
7
|
+
|
|
8
|
+
<p>
|
|
9
|
+
<strong>A flexible and extensible command framework for roblox-ts</strong>
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
This package contains Centurion's user interface. To use it, you must
|
|
13
|
+
also install [@rbxts/centurion](https://www.npmjs.com/package/@rbxts/centurion).
|
|
14
|
+
|
|
15
|
+
[![CI status][ci-badge]][ci-url]
|
|
16
|
+
[![npm latest version][npm-latest-badge]][npm-latest-url]
|
|
17
|
+
[![npm dev version][npm-next-badge]][npm-next-url]
|
|
18
|
+
|
|
19
|
+
[npm-latest-badge]: https://img.shields.io/npm/v/%40rbxts%2Fcenturion?logo=npm&label=latest&color=green
|
|
20
|
+
[npm-latest-url]: https://www.npmjs.com/package/@rbxts/centurion/v/latest
|
|
21
|
+
[npm-next-badge]: https://img.shields.io/npm/v/%40rbxts%2Fcenturion%2Fnext?logo=npm&label=next
|
|
22
|
+
[npm-next-url]: https://www.npmjs.com/package/@rbxts/centurion/v/next
|
|
23
|
+
[ci-badge]: https://github.com/paradoxuum/centurion/actions/workflows/ci.yml/badge.svg?branch=main
|
|
24
|
+
[ci-url]: https://github.com/paradoxuum/centurion/actions/workflows/ci.yml
|
|
25
|
+
|
|
26
|
+
<a href="https://centurion.paradoxum.dev/">📖 Documentation</a>
|
|
27
|
+
</div>
|
|
28
|
+
|
|
29
|
+
<img src="../../public/banner.png" />
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
+
local TS = _G[script]
|
|
3
|
+
local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
|
|
4
|
+
local GuiService = _services.GuiService
|
|
5
|
+
local UserInputService = _services.UserInputService
|
|
6
|
+
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
7
|
+
local Vide = _vide
|
|
8
|
+
local derive = _vide.derive
|
|
9
|
+
local _components = TS.import(script, script.Parent.Parent, "components")
|
|
10
|
+
local Suggestions = _components.Suggestions
|
|
11
|
+
local Terminal = _components.Terminal
|
|
12
|
+
local Group = TS.import(script, script.Parent.Parent, "components", "ui", "group").Group
|
|
13
|
+
local Layer = TS.import(script, script.Parent.Parent, "components", "ui", "layer").Layer
|
|
14
|
+
local useAPI = TS.import(script, script.Parent.Parent, "hooks", "use-api").useAPI
|
|
15
|
+
local useAtom = TS.import(script, script.Parent.Parent, "hooks", "use-atom").useAtom
|
|
16
|
+
local useEvent = TS.import(script, script.Parent.Parent, "hooks", "use-event").useEvent
|
|
17
|
+
local _use_px = TS.import(script, script.Parent.Parent, "hooks", "use-px")
|
|
18
|
+
local px = _use_px.px
|
|
19
|
+
local usePx = _use_px.usePx
|
|
20
|
+
local _store = TS.import(script, script.Parent.Parent, "store")
|
|
21
|
+
local interfaceOptions = _store.interfaceOptions
|
|
22
|
+
local interfaceVisible = _store.interfaceVisible
|
|
23
|
+
local mouseOverInterface = _store.mouseOverInterface
|
|
24
|
+
local MOUSE_INPUT_TYPES = {
|
|
25
|
+
[Enum.UserInputType.MouseButton1] = true,
|
|
26
|
+
[Enum.UserInputType.MouseButton2] = true,
|
|
27
|
+
[Enum.UserInputType.Touch] = true,
|
|
28
|
+
}
|
|
29
|
+
local function CenturionApp(api)
|
|
30
|
+
useAPI(api)
|
|
31
|
+
usePx()
|
|
32
|
+
local options = useAtom(interfaceOptions)
|
|
33
|
+
local visible = useAtom(interfaceVisible)
|
|
34
|
+
local validKeys = derive(function()
|
|
35
|
+
local _set = {}
|
|
36
|
+
for _, _v in options().activationKeys do
|
|
37
|
+
_set[_v] = true
|
|
38
|
+
end
|
|
39
|
+
return _set
|
|
40
|
+
end)
|
|
41
|
+
useEvent(UserInputService.InputBegan, function(input, gameProcessed)
|
|
42
|
+
local _exp = validKeys()
|
|
43
|
+
local _keyCode = input.KeyCode
|
|
44
|
+
local _condition = _exp[_keyCode] ~= nil
|
|
45
|
+
if _condition then
|
|
46
|
+
_condition = not gameProcessed
|
|
47
|
+
end
|
|
48
|
+
if _condition then
|
|
49
|
+
interfaceVisible(not visible())
|
|
50
|
+
else
|
|
51
|
+
local _condition_1 = options().hideOnLostFocus
|
|
52
|
+
if _condition_1 then
|
|
53
|
+
local _userInputType = input.UserInputType
|
|
54
|
+
_condition_1 = MOUSE_INPUT_TYPES[_userInputType] ~= nil
|
|
55
|
+
if _condition_1 then
|
|
56
|
+
_condition_1 = not mouseOverInterface()
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
if _condition_1 then
|
|
60
|
+
interfaceVisible(false)
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
end)
|
|
64
|
+
return Vide.jsx(Layer, {
|
|
65
|
+
displayOrder = function()
|
|
66
|
+
local _condition = options().displayOrder
|
|
67
|
+
if _condition == nil then
|
|
68
|
+
_condition = 0
|
|
69
|
+
end
|
|
70
|
+
return _condition
|
|
71
|
+
end,
|
|
72
|
+
visible = visible,
|
|
73
|
+
}, Vide.jsx(Group, {
|
|
74
|
+
anchorPoint = function()
|
|
75
|
+
return options().anchorPoint or Vector2.new(0, 0)
|
|
76
|
+
end,
|
|
77
|
+
size = function()
|
|
78
|
+
return options().size or UDim2.new(0, px(1024), 1, 0)
|
|
79
|
+
end,
|
|
80
|
+
position = function()
|
|
81
|
+
return options().position or UDim2.fromOffset(px(16), px(8) + (GuiService:GetGuiInset()).Y)
|
|
82
|
+
end,
|
|
83
|
+
}, Vide.jsx(Terminal), Vide.jsx(Suggestions), Vide.jsx("uilistlayout", {
|
|
84
|
+
Padding = function()
|
|
85
|
+
return UDim.new(0, px(8))
|
|
86
|
+
end,
|
|
87
|
+
SortOrder = "LayoutOrder",
|
|
88
|
+
})))
|
|
89
|
+
end
|
|
90
|
+
return {
|
|
91
|
+
CenturionApp = CenturionApp,
|
|
92
|
+
}
|
package/out/app/index.d.ts
CHANGED
|
@@ -1 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { ClientAPI } from "@rbxts/centurion";
|
|
2
|
+
import { InterfaceOptions } from "../types";
|
|
3
|
+
export declare namespace CenturionUI {
|
|
4
|
+
function updateOptions(options: Partial<InterfaceOptions>): void;
|
|
5
|
+
function create(options?: Partial<InterfaceOptions>): (api: ClientAPI) => void;
|
|
6
|
+
}
|
package/out/app/init.lua
CHANGED
|
@@ -1,7 +1,60 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
local Signal = TS.import(script, TS.getModule(script, "@rbxts", "beacon").out).Signal
|
|
4
|
+
local _services = TS.import(script, TS.getModule(script, "@rbxts", "services"))
|
|
5
|
+
local ContentProvider = _services.ContentProvider
|
|
6
|
+
local Players = _services.Players
|
|
7
|
+
local mount = TS.import(script, TS.getModule(script, "@rbxts", "vide").src).mount
|
|
8
|
+
local DEFAULT_INTERFACE_OPTIONS = TS.import(script, script.Parent, "constants", "options").DEFAULT_INTERFACE_OPTIONS
|
|
9
|
+
local CenturionApp = TS.import(script, script, "centurion-app").CenturionApp
|
|
10
|
+
local CenturionUI = {}
|
|
11
|
+
do
|
|
12
|
+
local _container = CenturionUI
|
|
13
|
+
local MAX_PRELOAD_ATTEMPTS = 3
|
|
14
|
+
local PRELOAD_ATTEMPT_INTERVAL = 3
|
|
15
|
+
local optionsChanged = Signal.new()
|
|
16
|
+
local function updateOptions(options)
|
|
17
|
+
optionsChanged:Fire(options)
|
|
18
|
+
end
|
|
19
|
+
_container.updateOptions = updateOptions
|
|
20
|
+
local function create(options)
|
|
21
|
+
if options == nil then
|
|
22
|
+
options = {}
|
|
23
|
+
end
|
|
24
|
+
return function(api)
|
|
25
|
+
-- Attempt to preload font
|
|
26
|
+
task.spawn(function()
|
|
27
|
+
local _result = options.font
|
|
28
|
+
if _result ~= nil then
|
|
29
|
+
_result = _result.regular
|
|
30
|
+
end
|
|
31
|
+
local _condition = _result
|
|
32
|
+
if _condition == nil then
|
|
33
|
+
_condition = DEFAULT_INTERFACE_OPTIONS.font.regular
|
|
34
|
+
end
|
|
35
|
+
local fontFamily = _condition.Family
|
|
36
|
+
local attempts = 0
|
|
37
|
+
while attempts < MAX_PRELOAD_ATTEMPTS do
|
|
38
|
+
ContentProvider:PreloadAsync({ fontFamily }, function(_, status)
|
|
39
|
+
if status == Enum.AssetFetchStatus.Success then
|
|
40
|
+
attempts = MAX_PRELOAD_ATTEMPTS
|
|
41
|
+
end
|
|
42
|
+
end)
|
|
43
|
+
if attempts == MAX_PRELOAD_ATTEMPTS then
|
|
44
|
+
break
|
|
45
|
+
end
|
|
46
|
+
task.wait(PRELOAD_ATTEMPT_INTERVAL)
|
|
47
|
+
attempts += 1
|
|
48
|
+
end
|
|
49
|
+
end)
|
|
50
|
+
local target = Players.LocalPlayer:WaitForChild("PlayerGui")
|
|
51
|
+
mount(function()
|
|
52
|
+
return CenturionApp(api)
|
|
53
|
+
end, target)
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
_container.create = create
|
|
6
57
|
end
|
|
7
|
-
return
|
|
58
|
+
return {
|
|
59
|
+
CenturionUI = CenturionUI,
|
|
60
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { HistoryEntry } from "@rbxts/centurion";
|
|
2
|
-
import {
|
|
2
|
+
import Vide, { Derivable } from "@rbxts/vide";
|
|
3
3
|
interface HistoryLineProps {
|
|
4
4
|
data: HistoryEntry;
|
|
5
|
-
size?:
|
|
6
|
-
position?:
|
|
7
|
-
order?:
|
|
5
|
+
size?: Derivable<UDim2>;
|
|
6
|
+
position?: Derivable<UDim2>;
|
|
7
|
+
order?: Derivable<number>;
|
|
8
8
|
}
|
|
9
|
-
export declare function HistoryLine({ data, size, position, order }: HistoryLineProps):
|
|
9
|
+
export declare function HistoryLine({ data, size, position, order }: HistoryLineProps): Vide.Node;
|
|
10
10
|
export {};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
4
|
-
local
|
|
5
|
-
local
|
|
6
|
-
local useMemo = _react.useMemo
|
|
3
|
+
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
4
|
+
local Vide = _vide
|
|
5
|
+
local derive = _vide.derive
|
|
7
6
|
local HISTORY_TEXT_SIZE = TS.import(script, script.Parent.Parent.Parent, "constants", "text").HISTORY_TEXT_SIZE
|
|
8
|
-
local
|
|
9
|
-
local
|
|
7
|
+
local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
|
|
8
|
+
local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
|
|
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
|
|
11
11
|
local Group = TS.import(script, script.Parent.Parent, "ui", "group").Group
|
|
12
12
|
local Outline = TS.import(script, script.Parent.Parent, "ui", "outline").Outline
|
|
@@ -17,44 +17,68 @@ local function HistoryLine(_param)
|
|
|
17
17
|
local size = _param.size
|
|
18
18
|
local position = _param.position
|
|
19
19
|
local order = _param.order
|
|
20
|
-
local options =
|
|
21
|
-
local
|
|
22
|
-
local date = useMemo(function()
|
|
20
|
+
local options = useAtom(interfaceOptions)
|
|
21
|
+
local date = derive(function()
|
|
23
22
|
local dateTime = DateTime.fromUnixTimestamp(data.sentAt):FormatLocalTime("LT", "en-us")
|
|
24
23
|
local dateParts = string.split(dateTime, " ")
|
|
25
24
|
return `<b>{dateParts[1]}</b> {dateParts[2]}`
|
|
26
|
-
end
|
|
27
|
-
return
|
|
25
|
+
end)
|
|
26
|
+
return Vide.jsx(Group, {
|
|
28
27
|
size = size,
|
|
29
28
|
position = position,
|
|
30
29
|
layoutOrder = order,
|
|
31
|
-
},
|
|
32
|
-
backgroundColor =
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
}, Vide.jsx(Frame, {
|
|
31
|
+
backgroundColor = function()
|
|
32
|
+
return options().palette.surface
|
|
33
|
+
end,
|
|
34
|
+
size = function()
|
|
35
|
+
return UDim2.fromOffset(px(76), px(HISTORY_TEXT_SIZE + 4))
|
|
36
|
+
end,
|
|
37
|
+
cornerRadius = function()
|
|
38
|
+
return UDim.new(0, px(4))
|
|
39
|
+
end,
|
|
40
|
+
}, Vide.jsx(Text, {
|
|
36
41
|
size = UDim2.fromScale(1, 1),
|
|
37
42
|
text = date,
|
|
38
|
-
textColor =
|
|
39
|
-
|
|
43
|
+
textColor = function()
|
|
44
|
+
return options().palette.text
|
|
45
|
+
end,
|
|
46
|
+
textSize = function()
|
|
47
|
+
return px(HISTORY_TEXT_SIZE)
|
|
48
|
+
end,
|
|
40
49
|
richText = true,
|
|
41
|
-
}),
|
|
42
|
-
innerThickness =
|
|
50
|
+
}), Vide.jsx(Outline, {
|
|
51
|
+
innerThickness = function()
|
|
52
|
+
return px(1)
|
|
53
|
+
end,
|
|
43
54
|
innerTransparency = 0.25,
|
|
44
|
-
innerColor =
|
|
55
|
+
innerColor = function()
|
|
56
|
+
return if data.success then options().palette.success else options().palette.error
|
|
57
|
+
end,
|
|
45
58
|
outerThickness = 0,
|
|
46
|
-
cornerRadius =
|
|
47
|
-
|
|
59
|
+
cornerRadius = function()
|
|
60
|
+
return UDim.new(0, px(4))
|
|
61
|
+
end,
|
|
62
|
+
})), Vide.jsx(TextField, {
|
|
48
63
|
anchorPoint = Vector2.new(1, 0),
|
|
49
|
-
size =
|
|
64
|
+
size = function()
|
|
65
|
+
return UDim2.new(1, -px(84), 1, 0)
|
|
66
|
+
end,
|
|
50
67
|
position = UDim2.fromScale(1, 0),
|
|
51
68
|
text = data.text,
|
|
52
|
-
textSize =
|
|
53
|
-
|
|
69
|
+
textSize = function()
|
|
70
|
+
return px(HISTORY_TEXT_SIZE)
|
|
71
|
+
end,
|
|
72
|
+
textColor = function()
|
|
73
|
+
local palette = options().palette
|
|
74
|
+
return if data.success then palette.text else palette.error
|
|
75
|
+
end,
|
|
54
76
|
textEditable = false,
|
|
55
77
|
textXAlignment = "Left",
|
|
56
78
|
clearTextOnFocus = false,
|
|
57
|
-
font =
|
|
79
|
+
font = function()
|
|
80
|
+
return options().font.medium
|
|
81
|
+
end,
|
|
58
82
|
richText = true,
|
|
59
83
|
}))
|
|
60
84
|
end
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
export interface HistoryData {
|
|
4
|
-
lines: HistoryLineData[];
|
|
5
|
-
height: number;
|
|
6
|
-
}
|
|
1
|
+
import Vide, { Derivable } from "@rbxts/vide";
|
|
2
|
+
import { HistoryData } from "../../types";
|
|
7
3
|
interface HistoryListProps {
|
|
8
|
-
data: HistoryData
|
|
9
|
-
size?:
|
|
10
|
-
position?:
|
|
11
|
-
maxHeight?: number
|
|
12
|
-
scrollingEnabled?:
|
|
4
|
+
data: Derivable<HistoryData>;
|
|
5
|
+
size?: Derivable<UDim2>;
|
|
6
|
+
position?: Derivable<UDim2>;
|
|
7
|
+
maxHeight?: Derivable<number>;
|
|
8
|
+
scrollingEnabled?: Derivable<boolean>;
|
|
13
9
|
}
|
|
14
|
-
export declare function HistoryList({ data, size, position, maxHeight, }: HistoryListProps):
|
|
10
|
+
export declare function HistoryList({ data, size, position, maxHeight, }: HistoryListProps): Vide.Node;
|
|
15
11
|
export {};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
4
|
-
local
|
|
5
|
-
local
|
|
6
|
-
local
|
|
7
|
-
local
|
|
8
|
-
local
|
|
9
|
-
local
|
|
10
|
-
local
|
|
3
|
+
local _vide = TS.import(script, TS.getModule(script, "@rbxts", "vide").src)
|
|
4
|
+
local Vide = _vide
|
|
5
|
+
local effect = _vide.effect
|
|
6
|
+
local For = _vide.For
|
|
7
|
+
local read = _vide.read
|
|
8
|
+
local source = _vide.source
|
|
9
|
+
local useAtom = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-atom").useAtom
|
|
10
|
+
local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
|
|
11
|
+
local interfaceOptions = TS.import(script, script.Parent.Parent.Parent, "store").interfaceOptions
|
|
11
12
|
local ScrollingFrame = TS.import(script, script.Parent.Parent, "ui", "scrolling-frame").ScrollingFrame
|
|
12
13
|
local HistoryLine = TS.import(script, script.Parent, "history-line").HistoryLine
|
|
13
14
|
local function HistoryList(_param)
|
|
@@ -15,45 +16,44 @@ local function HistoryList(_param)
|
|
|
15
16
|
local size = _param.size
|
|
16
17
|
local position = _param.position
|
|
17
18
|
local maxHeight = _param.maxHeight
|
|
18
|
-
local
|
|
19
|
-
local
|
|
20
|
-
local
|
|
21
|
-
local
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
setCanvasPosition(Vector2.new(0, height))
|
|
19
|
+
local options = useAtom(interfaceOptions)
|
|
20
|
+
local scrollingEnabled = source(false)
|
|
21
|
+
local canvasSize = source(UDim2.new())
|
|
22
|
+
local canvasPos = source(Vector2.new())
|
|
23
|
+
effect(function()
|
|
24
|
+
local height = read(data).height - px(8)
|
|
25
|
+
canvasSize(UDim2.new(0, 0, 0, height))
|
|
26
|
+
canvasPos(Vector2.new(0, height))
|
|
27
27
|
if maxHeight ~= nil then
|
|
28
|
-
|
|
28
|
+
scrollingEnabled(height > read(maxHeight))
|
|
29
29
|
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
-- ▼ ReadonlyArray.map ▼
|
|
33
|
-
local _newValue = table.create(#_exp)
|
|
34
|
-
local _callback = function(data, i)
|
|
35
|
-
return React.createElement(HistoryLine, {
|
|
36
|
-
key = `{data.entry.sentAt}-{i}`,
|
|
37
|
-
size = UDim2.new(1, 0, 0, data.height),
|
|
38
|
-
data = data.entry,
|
|
39
|
-
})
|
|
40
|
-
end
|
|
41
|
-
for _k, _v in _exp do
|
|
42
|
-
_newValue[_k] = _callback(_v, _k - 1, _exp)
|
|
43
|
-
end
|
|
44
|
-
-- ▲ ReadonlyArray.map ▲
|
|
45
|
-
return React.createElement(ScrollingFrame, {
|
|
30
|
+
end)
|
|
31
|
+
return Vide.jsx(ScrollingFrame, {
|
|
46
32
|
size = size,
|
|
47
33
|
position = position,
|
|
48
34
|
canvasSize = canvasSize,
|
|
49
|
-
canvasPosition =
|
|
50
|
-
scrollBarColor =
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
canvasPosition = canvasPos,
|
|
36
|
+
scrollBarColor = function()
|
|
37
|
+
return options().palette.subtext
|
|
38
|
+
end,
|
|
39
|
+
scrollBarThickness = function()
|
|
40
|
+
return if scrollingEnabled() then 10 else 0
|
|
41
|
+
end,
|
|
54
42
|
scrollingEnabled = scrollingEnabled,
|
|
55
|
-
},
|
|
56
|
-
|
|
43
|
+
}, Vide.jsx(For, {
|
|
44
|
+
each = function()
|
|
45
|
+
return read(data).lines
|
|
46
|
+
end,
|
|
47
|
+
}, function(line, index)
|
|
48
|
+
return Vide.jsx(HistoryLine, {
|
|
49
|
+
size = UDim2.new(1, 0, 0, line.height),
|
|
50
|
+
data = line.entry,
|
|
51
|
+
order = index,
|
|
52
|
+
})
|
|
53
|
+
end), Vide.jsx("uilistlayout", {
|
|
54
|
+
Padding = function()
|
|
55
|
+
return UDim.new(0, px(8))
|
|
56
|
+
end,
|
|
57
57
|
SortOrder = "LayoutOrder",
|
|
58
58
|
}))
|
|
59
59
|
end
|
package/out/components/init.lua
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
2
|
local TS = _G[script]
|
|
3
3
|
local exports = {}
|
|
4
|
+
for _k, _v in TS.import(script, script, "suggestions") or {} do
|
|
5
|
+
exports[_k] = _v
|
|
6
|
+
end
|
|
4
7
|
for _k, _v in TS.import(script, script, "terminal") or {} do
|
|
5
8
|
exports[_k] = _v
|
|
6
9
|
end
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import Vide, { Derivable } from "@rbxts/vide";
|
|
2
2
|
interface BadgeProps {
|
|
3
|
-
anchorPoint?:
|
|
4
|
-
size?:
|
|
5
|
-
position?:
|
|
6
|
-
color?:
|
|
7
|
-
text?:
|
|
8
|
-
textColor?:
|
|
9
|
-
textSize?:
|
|
10
|
-
visible?:
|
|
3
|
+
anchorPoint?: Derivable<Vector2>;
|
|
4
|
+
size?: Derivable<UDim2>;
|
|
5
|
+
position?: Derivable<UDim2>;
|
|
6
|
+
color?: Derivable<Color3>;
|
|
7
|
+
text?: Derivable<string>;
|
|
8
|
+
textColor?: Derivable<Color3>;
|
|
9
|
+
textSize?: Derivable<number>;
|
|
10
|
+
visible?: Derivable<boolean>;
|
|
11
11
|
onTextBoundsChange?: (textBounds: Vector2) => void;
|
|
12
|
-
children?:
|
|
12
|
+
children?: Vide.Node;
|
|
13
13
|
backgroundTransparency?: number;
|
|
14
14
|
}
|
|
15
|
-
export declare function Badge({ anchorPoint, size, position, color, text, textColor, textSize, visible, onTextBoundsChange, children, backgroundTransparency, }: BadgeProps):
|
|
15
|
+
export declare function Badge({ anchorPoint, size, position, color, text, textColor, textSize, visible, onTextBoundsChange, children, backgroundTransparency, }: BadgeProps): Vide.Node;
|
|
16
16
|
export {};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
2
|
local TS = _G[script]
|
|
3
|
-
local
|
|
4
|
-
local
|
|
5
|
-
local
|
|
6
|
-
local
|
|
7
|
-
local OptionsContext = TS.import(script, script.Parent.Parent.Parent, "providers", "options-provider").OptionsContext
|
|
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
|
|
5
|
+
local px = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").px
|
|
6
|
+
local interfaceOptions = TS.import(script, script.Parent.Parent.Parent, "store").interfaceOptions
|
|
8
7
|
local Frame = TS.import(script, script.Parent.Parent, "ui", "frame").Frame
|
|
9
8
|
local Text = TS.import(script, script.Parent.Parent, "ui", "text").Text
|
|
10
9
|
local function Badge(_param)
|
|
@@ -19,32 +18,27 @@ local function Badge(_param)
|
|
|
19
18
|
local onTextBoundsChange = _param.onTextBoundsChange
|
|
20
19
|
local children = _param.children
|
|
21
20
|
local backgroundTransparency = _param.backgroundTransparency
|
|
22
|
-
local options =
|
|
23
|
-
|
|
24
|
-
return React.createElement(Frame, {
|
|
21
|
+
local options = useAtom(interfaceOptions)
|
|
22
|
+
return Vide.jsx(Frame, {
|
|
25
23
|
anchorPoint = anchorPoint,
|
|
26
24
|
size = size,
|
|
27
25
|
position = position,
|
|
28
26
|
backgroundColor = color,
|
|
29
|
-
cornerRadius =
|
|
27
|
+
cornerRadius = function()
|
|
28
|
+
return UDim.new(0, px(4))
|
|
29
|
+
end,
|
|
30
30
|
visible = visible,
|
|
31
31
|
clipsDescendants = true,
|
|
32
32
|
backgroundTransparency = backgroundTransparency,
|
|
33
|
-
},
|
|
33
|
+
}, Vide.jsx(Text, {
|
|
34
34
|
text = text,
|
|
35
35
|
textColor = textColor,
|
|
36
36
|
textSize = textSize,
|
|
37
37
|
size = UDim2.fromScale(1, 1),
|
|
38
|
-
font =
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if _result ~= nil then
|
|
43
|
-
_result = _result(rbx.TextBounds)
|
|
44
|
-
end
|
|
45
|
-
return _result
|
|
46
|
-
end,
|
|
47
|
-
},
|
|
38
|
+
font = function()
|
|
39
|
+
return options().font.bold
|
|
40
|
+
end,
|
|
41
|
+
textBoundsChanged = onTextBoundsChange,
|
|
48
42
|
}), children)
|
|
49
43
|
end
|
|
50
44
|
return {
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Binding } from "@rbxts/react";
|
|
1
|
+
import Vide, { Derivable } from "@rbxts/vide";
|
|
3
2
|
import { Suggestion } from "../../types";
|
|
4
3
|
import { SuggestionTextBounds } from "./types";
|
|
5
4
|
export interface MainSuggestionProps {
|
|
6
|
-
suggestion
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
sizes: Binding<SuggestionTextBounds>;
|
|
5
|
+
suggestion: Derivable<Suggestion | undefined>;
|
|
6
|
+
currentText?: Derivable<string | undefined>;
|
|
7
|
+
size: Derivable<UDim2>;
|
|
8
|
+
sizes: Derivable<SuggestionTextBounds>;
|
|
11
9
|
}
|
|
12
|
-
export declare function MainSuggestion({ suggestion, currentText, size, sizes,
|
|
10
|
+
export declare function MainSuggestion({ suggestion, currentText, size, sizes, }: MainSuggestionProps): Vide.Node;
|