@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.
Files changed (115) hide show
  1. package/README.md +29 -0
  2. package/out/app/centurion-app.d.ts +3 -0
  3. package/out/app/centurion-app.lua +92 -0
  4. package/out/app/index.d.ts +6 -1
  5. package/out/app/init.lua +57 -4
  6. package/out/components/history/history-line.d.ts +5 -5
  7. package/out/components/history/history-line.lua +51 -27
  8. package/out/components/history/history-list.d.ts +8 -12
  9. package/out/components/history/history-list.lua +41 -41
  10. package/out/components/index.d.ts +1 -0
  11. package/out/components/init.lua +3 -0
  12. package/out/components/suggestions/badge.d.ts +11 -11
  13. package/out/components/suggestions/badge.lua +14 -20
  14. package/out/components/suggestions/main-suggestion.d.ts +6 -8
  15. package/out/components/suggestions/main-suggestion.lua +153 -143
  16. package/out/components/suggestions/suggestion-list.d.ts +5 -5
  17. package/out/components/suggestions/suggestion-list.lua +70 -49
  18. package/out/components/suggestions/suggestions.d.ts +2 -1
  19. package/out/components/suggestions/suggestions.lua +41 -50
  20. package/out/components/suggestions/util.d.ts +2 -2
  21. package/out/components/suggestions/util.lua +1 -0
  22. package/out/components/terminal/index.d.ts +1 -0
  23. package/out/{store/history → components/terminal}/init.lua +1 -1
  24. package/out/components/terminal/terminal-text-field.d.ts +11 -0
  25. package/out/components/terminal/terminal-text-field.lua +319 -0
  26. package/out/components/terminal/terminal.d.ts +2 -0
  27. package/out/components/terminal/terminal.lua +240 -0
  28. package/out/components/ui/frame.d.ts +17 -18
  29. package/out/components/ui/frame.lua +8 -10
  30. package/out/components/ui/group.d.ts +13 -15
  31. package/out/components/ui/group.lua +6 -9
  32. package/out/components/ui/layer.d.ts +5 -5
  33. package/out/components/ui/layer.lua +3 -3
  34. package/out/components/ui/outline.d.ts +13 -12
  35. package/out/components/ui/outline.lua +64 -54
  36. package/out/components/ui/padding.d.ts +7 -7
  37. package/out/components/ui/padding.lua +2 -2
  38. package/out/components/ui/scrolling-frame.d.ts +11 -12
  39. package/out/components/ui/scrolling-frame.lua +4 -9
  40. package/out/components/ui/text-field.d.ts +10 -9
  41. package/out/components/ui/text-field.lua +15 -13
  42. package/out/components/ui/text.d.ts +16 -16
  43. package/out/components/ui/text.lua +39 -38
  44. package/out/constants/springs.lua +1 -1
  45. package/out/hooks/use-api.d.ts +3 -0
  46. package/out/hooks/use-api.lua +18 -0
  47. package/out/hooks/use-atom.d.ts +2 -0
  48. package/out/hooks/use-atom.lua +17 -0
  49. package/out/hooks/use-debounce-source.d.ts +11 -0
  50. package/out/hooks/use-debounce-source.lua +27 -0
  51. package/out/hooks/use-event.d.ts +14 -0
  52. package/out/hooks/use-event.lua +58 -0
  53. package/out/hooks/use-history.d.ts +2 -0
  54. package/out/hooks/use-history.lua +56 -0
  55. package/out/hooks/use-motion.d.ts +4 -4
  56. package/out/hooks/use-motion.lua +11 -16
  57. package/out/hooks/use-px.d.ts +13 -1
  58. package/out/hooks/use-px.lua +52 -39
  59. package/out/store.d.ts +14 -0
  60. package/out/store.lua +44 -0
  61. package/out/types.d.ts +7 -4
  62. package/out/util/argument.d.ts +2 -1
  63. package/out/util/argument.lua +25 -0
  64. package/out/util/suggestion.d.ts +2 -2
  65. package/out/util/suggestion.lua +9 -14
  66. package/package.json +14 -14
  67. package/out/app/app.d.ts +0 -6
  68. package/out/app/app.lua +0 -83
  69. package/out/app/terminal-app.d.ts +0 -1
  70. package/out/app/terminal-app.lua +0 -61
  71. package/out/components/terminal-text-field.d.ts +0 -11
  72. package/out/components/terminal-text-field.lua +0 -289
  73. package/out/components/terminal-window.d.ts +0 -1
  74. package/out/components/terminal-window.lua +0 -265
  75. package/out/components/terminal.d.ts +0 -1
  76. package/out/components/terminal.lua +0 -26
  77. package/out/components/ui/shortcut-group.d.ts +0 -6
  78. package/out/components/ui/shortcut-group.lua +0 -100
  79. package/out/hooks/use-store.d.ts +0 -3
  80. package/out/hooks/use-store.lua +0 -7
  81. package/out/providers/api-provider.d.ts +0 -8
  82. package/out/providers/api-provider.lua +0 -17
  83. package/out/providers/options-provider.d.ts +0 -13
  84. package/out/providers/options-provider.lua +0 -39
  85. package/out/providers/root-provider.d.ts +0 -11
  86. package/out/providers/root-provider.lua +0 -24
  87. package/out/store/app/app-selectors.d.ts +0 -2
  88. package/out/store/app/app-selectors.lua +0 -7
  89. package/out/store/app/app-slice.d.ts +0 -8
  90. package/out/store/app/app-slice.lua +0 -17
  91. package/out/store/app/index.d.ts +0 -2
  92. package/out/store/app/init.lua +0 -10
  93. package/out/store/command/command-selectors.d.ts +0 -2
  94. package/out/store/command/command-selectors.lua +0 -7
  95. package/out/store/command/command-slice.d.ts +0 -15
  96. package/out/store/command/command-slice.lua +0 -21
  97. package/out/store/command/index.d.ts +0 -2
  98. package/out/store/command/init.lua +0 -10
  99. package/out/store/history/history-slice.d.ts +0 -11
  100. package/out/store/history/history-slice.lua +0 -52
  101. package/out/store/history/index.d.ts +0 -1
  102. package/out/store/index.d.ts +0 -46
  103. package/out/store/init.lua +0 -18
  104. package/out/store/suggestion/index.d.ts +0 -2
  105. package/out/store/suggestion/init.lua +0 -10
  106. package/out/store/suggestion/suggestion-selectors.d.ts +0 -2
  107. package/out/store/suggestion/suggestion-selectors.lua +0 -7
  108. package/out/store/suggestion/suggestion-slice.d.ts +0 -9
  109. package/out/store/suggestion/suggestion-slice.lua +0 -15
  110. package/out/store/text/index.d.ts +0 -2
  111. package/out/store/text/init.lua +0 -10
  112. package/out/store/text/text-selectors.d.ts +0 -3
  113. package/out/store/text/text-selectors.lua +0 -11
  114. package/out/store/text/text-slice.d.ts +0 -20
  115. 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,3 @@
1
+ import { ClientAPI } from "@rbxts/centurion";
2
+ import Vide from "@rbxts/vide";
3
+ export declare function CenturionApp(api: ClientAPI): Vide.Node;
@@ -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
+ }
@@ -1 +1,6 @@
1
- export * from "./app";
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 exports = {}
4
- for _k, _v in TS.import(script, script, "app") or {} do
5
- exports[_k] = _v
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 exports
58
+ return {
59
+ CenturionUI = CenturionUI,
60
+ }
@@ -1,10 +1,10 @@
1
1
  import { HistoryEntry } from "@rbxts/centurion";
2
- import { BindingOrValue } from "@rbxts/pretty-react-hooks";
2
+ import Vide, { Derivable } from "@rbxts/vide";
3
3
  interface HistoryLineProps {
4
4
  data: HistoryEntry;
5
- size?: BindingOrValue<UDim2>;
6
- position?: BindingOrValue<UDim2>;
7
- order?: BindingOrValue<number>;
5
+ size?: Derivable<UDim2>;
6
+ position?: Derivable<UDim2>;
7
+ order?: Derivable<number>;
8
8
  }
9
- export declare function HistoryLine({ data, size, position, order }: HistoryLineProps): JSX.Element;
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 _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
- local React = _react
5
- local useContext = _react.useContext
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 usePx = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").usePx
9
- local OptionsContext = TS.import(script, script.Parent.Parent.Parent, "providers", "options-provider").OptionsContext
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 = useContext(OptionsContext)
21
- local px = usePx()
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, { data })
27
- return React.createElement(Group, {
25
+ end)
26
+ return Vide.jsx(Group, {
28
27
  size = size,
29
28
  position = position,
30
29
  layoutOrder = order,
31
- }, React.createElement(Frame, {
32
- backgroundColor = options.palette.surface,
33
- size = UDim2.fromOffset(px(76), px(HISTORY_TEXT_SIZE + 4)),
34
- cornerRadius = UDim.new(0, px(4)),
35
- }, React.createElement(Text, {
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 = options.palette.text,
39
- textSize = px(HISTORY_TEXT_SIZE),
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
- }), React.createElement(Outline, {
42
- innerThickness = px(1),
50
+ }), Vide.jsx(Outline, {
51
+ innerThickness = function()
52
+ return px(1)
53
+ end,
43
54
  innerTransparency = 0.25,
44
- innerColor = if data.success then options.palette.success else options.palette.error,
55
+ innerColor = function()
56
+ return if data.success then options().palette.success else options().palette.error
57
+ end,
45
58
  outerThickness = 0,
46
- cornerRadius = UDim.new(0, px(4)),
47
- })), React.createElement(TextField, {
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 = UDim2.new(1, -px(84), 1, 0),
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 = px(HISTORY_TEXT_SIZE),
53
- textColor = if data.success then options.palette.text else options.palette.error,
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 = options.font.medium,
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 { BindingOrValue } from "@rbxts/pretty-react-hooks";
2
- import { HistoryLineData } from "../../types";
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?: BindingOrValue<UDim2>;
10
- position?: BindingOrValue<UDim2>;
11
- maxHeight?: number;
12
- scrollingEnabled?: BindingOrValue<boolean>;
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): JSX.Element;
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 mapBinding = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).mapBinding
4
- local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
5
- local React = _react
6
- local useBinding = _react.useBinding
7
- local useContext = _react.useContext
8
- local useEffect = _react.useEffect
9
- local usePx = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").usePx
10
- 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 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 px = usePx()
19
- local options = useContext(OptionsContext)
20
- local scrollingEnabled, setScrollingEnabled = useBinding(false)
21
- local canvasSize, setCanvasSize = useBinding(UDim2.new())
22
- local canvasPosition, setCanvasPosition = useBinding(Vector2.new())
23
- useEffect(function()
24
- local height = data.height - px(8)
25
- setCanvasSize(UDim2.new(0, 0, 0, height))
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
- setScrollingEnabled(height > maxHeight)
28
+ scrollingEnabled(height > read(maxHeight))
29
29
  end
30
- end, { data, px })
31
- local _exp = data.lines
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 = canvasPosition,
50
- scrollBarColor = options.palette.subtext,
51
- scrollBarThickness = mapBinding(scrollingEnabled, function(val)
52
- return if val then 10 else 0
53
- end),
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
- }, _newValue, React.createElement("uilistlayout", {
56
- Padding = UDim.new(0, px(8)),
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
@@ -1 +1,2 @@
1
+ export * from "./suggestions";
1
2
  export * from "./terminal";
@@ -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 { BindingOrValue } from "@rbxts/pretty-react-hooks";
1
+ import Vide, { Derivable } from "@rbxts/vide";
2
2
  interface BadgeProps {
3
- anchorPoint?: BindingOrValue<Vector2>;
4
- size?: BindingOrValue<UDim2>;
5
- position?: BindingOrValue<UDim2>;
6
- color?: BindingOrValue<Color3>;
7
- text?: BindingOrValue<string>;
8
- textColor?: BindingOrValue<Color3>;
9
- textSize?: BindingOrValue<number>;
10
- visible?: BindingOrValue<boolean>;
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?: JSX.Element;
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): JSX.Element;
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 _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
4
- local React = _react
5
- local useContext = _react.useContext
6
- local usePx = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").usePx
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 = useContext(OptionsContext)
23
- local px = usePx()
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 = UDim.new(0, px(4)),
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
- }, React.createElement(Text, {
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 = options.font.bold,
39
- change = {
40
- TextBounds = function(rbx)
41
- local _result = onTextBoundsChange
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 { BindingOrValue } from "@rbxts/pretty-react-hooks";
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?: Suggestion;
7
- argument: BindingOrValue<boolean>;
8
- currentText?: string;
9
- size: BindingOrValue<UDim2>;
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, argument, }: MainSuggestionProps): JSX.Element;
10
+ export declare function MainSuggestion({ suggestion, currentText, size, sizes, }: MainSuggestionProps): Vide.Node;