@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
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local _util = TS.import(script, TS.getModule(script, "@rbxts", "centurion").out.client.util)
|
|
4
|
-
local getModifierKeyName = _util.getModifierKeyName
|
|
5
|
-
local getShortcutKeycodes = _util.getShortcutKeycodes
|
|
6
|
-
local isModifierKey = _util.isModifierKey
|
|
7
|
-
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
8
|
-
local React = _react
|
|
9
|
-
local useContext = _react.useContext
|
|
10
|
-
local useState = _react.useState
|
|
11
|
-
local usePx = TS.import(script, script.Parent.Parent.Parent, "hooks", "use-px").usePx
|
|
12
|
-
local OptionsContext = TS.import(script, script.Parent.Parent.Parent, "providers", "options-provider").OptionsContext
|
|
13
|
-
local Badge = TS.import(script, script.Parent.Parent, "suggestions", "badge").Badge
|
|
14
|
-
local Frame = TS.import(script, script.Parent, "frame").Frame
|
|
15
|
-
local Padding = TS.import(script, script.Parent, "padding").Padding
|
|
16
|
-
local function Key(props)
|
|
17
|
-
local options = props.options
|
|
18
|
-
local isModifier = isModifierKey(props.keyCode)
|
|
19
|
-
local size, setSize = useState(UDim2.new(0, 24, 0, 24))
|
|
20
|
-
return React.createElement(Frame, {
|
|
21
|
-
backgroundTransparency = 1,
|
|
22
|
-
layoutOrder = if isModifier then -1 else 0,
|
|
23
|
-
automaticSize = "XY",
|
|
24
|
-
}, React.createElement(Badge, {
|
|
25
|
-
color = if isModifier then options.palette.highlight else options.palette.surface,
|
|
26
|
-
text = if isModifier then getModifierKeyName(props.keyCode) else props.keyCode.Name,
|
|
27
|
-
textColor = if isModifier then options.palette.text else options.palette.text,
|
|
28
|
-
textSize = 16,
|
|
29
|
-
size = size,
|
|
30
|
-
onTextBoundsChange = function(textBounds)
|
|
31
|
-
setSize(UDim2.new(0, math.max(24, textBounds.X + 12), 0, 24))
|
|
32
|
-
end,
|
|
33
|
-
backgroundTransparency = if isModifier then 0.5 else 0,
|
|
34
|
-
}, if isModifier then (React.createElement("uistroke", {
|
|
35
|
-
Color = options.palette.highlight,
|
|
36
|
-
Thickness = 1,
|
|
37
|
-
})) else (React.createElement("uistroke", {
|
|
38
|
-
Color = options.palette.subtext,
|
|
39
|
-
Thickness = 1,
|
|
40
|
-
}))))
|
|
41
|
-
end
|
|
42
|
-
local function ShortcutGroup(props)
|
|
43
|
-
local options = useContext(OptionsContext)
|
|
44
|
-
local px = usePx()
|
|
45
|
-
local _exp = React.createElement(Padding, {
|
|
46
|
-
all = UDim.new(0, px(8)),
|
|
47
|
-
})
|
|
48
|
-
local _exp_1 = React.createElement("uilistlayout", {
|
|
49
|
-
HorizontalAlignment = "Left",
|
|
50
|
-
FillDirection = "Vertical",
|
|
51
|
-
Padding = UDim.new(0, 8),
|
|
52
|
-
})
|
|
53
|
-
local _result = props.shortcuts
|
|
54
|
-
if _result ~= nil then
|
|
55
|
-
-- ▼ ReadonlyArray.map ▼
|
|
56
|
-
local _newValue = table.create(#_result)
|
|
57
|
-
local _callback = function(shortcut, index)
|
|
58
|
-
local shortcuts = getShortcutKeycodes(shortcut)
|
|
59
|
-
local _exp_2 = React.createElement("uilistlayout", {
|
|
60
|
-
FillDirection = "Horizontal",
|
|
61
|
-
SortOrder = "LayoutOrder",
|
|
62
|
-
Padding = UDim.new(0, 8),
|
|
63
|
-
})
|
|
64
|
-
-- ▼ ReadonlyArray.map ▼
|
|
65
|
-
local _newValue_1 = table.create(#shortcuts)
|
|
66
|
-
local _callback_1 = function(key)
|
|
67
|
-
return React.createElement(Key, {
|
|
68
|
-
options = options,
|
|
69
|
-
keyCode = key,
|
|
70
|
-
key = string.lower(key.Name),
|
|
71
|
-
})
|
|
72
|
-
end
|
|
73
|
-
for _k, _v in shortcuts do
|
|
74
|
-
_newValue_1[_k] = _callback_1(_v, _k - 1, shortcuts)
|
|
75
|
-
end
|
|
76
|
-
-- ▲ ReadonlyArray.map ▲
|
|
77
|
-
return React.createElement(Frame, {
|
|
78
|
-
automaticSize = "XY",
|
|
79
|
-
backgroundTransparency = 1,
|
|
80
|
-
key = `shortcut-{index}`,
|
|
81
|
-
}, _exp_2, _newValue_1)
|
|
82
|
-
end
|
|
83
|
-
for _k, _v in _result do
|
|
84
|
-
_newValue[_k] = _callback(_v, _k - 1, _result)
|
|
85
|
-
end
|
|
86
|
-
-- ▲ ReadonlyArray.map ▲
|
|
87
|
-
_result = _newValue
|
|
88
|
-
end
|
|
89
|
-
return React.createElement(Frame, {
|
|
90
|
-
backgroundTransparency = options.backgroundTransparency,
|
|
91
|
-
backgroundColor = options.palette.background,
|
|
92
|
-
size = UDim2.new(1, 0, 1, 0),
|
|
93
|
-
position = UDim2.new(1, px(16), 0, -px(8)),
|
|
94
|
-
cornerRadius = UDim.new(0, px(8)),
|
|
95
|
-
automaticSize = "XY",
|
|
96
|
-
}, _exp, _exp_1, _result)
|
|
97
|
-
end
|
|
98
|
-
return {
|
|
99
|
-
ShortcutGroup = ShortcutGroup,
|
|
100
|
-
}
|
package/out/hooks/use-store.d.ts
DELETED
package/out/hooks/use-store.lua
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { ClientAPI } from "@rbxts/centurion";
|
|
2
|
-
import React from "@rbxts/react";
|
|
3
|
-
interface ApiProviderProps extends React.PropsWithChildren {
|
|
4
|
-
api: ClientAPI;
|
|
5
|
-
}
|
|
6
|
-
export declare const ApiContext: React.Context<ClientAPI>;
|
|
7
|
-
export declare function ApiProvider({ api, children }: ApiProviderProps): JSX.Element;
|
|
8
|
-
export {};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
-
local React = _react
|
|
5
|
-
local createContext = _react.createContext
|
|
6
|
-
local ApiContext = createContext({})
|
|
7
|
-
local function ApiProvider(_param)
|
|
8
|
-
local api = _param.api
|
|
9
|
-
local children = _param.children
|
|
10
|
-
return React.createElement(ApiContext.Provider, {
|
|
11
|
-
value = api,
|
|
12
|
-
}, children)
|
|
13
|
-
end
|
|
14
|
-
return {
|
|
15
|
-
ApiProvider = ApiProvider,
|
|
16
|
-
ApiContext = ApiContext,
|
|
17
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Signal } from "@rbxts/beacon";
|
|
2
|
-
import React from "@rbxts/react";
|
|
3
|
-
import { InterfaceOptions } from "../types";
|
|
4
|
-
export interface InterfaceOptionsWithState extends InterfaceOptions {
|
|
5
|
-
isMouseOnGUI: boolean;
|
|
6
|
-
setMouseOnGUI: (newState: boolean) => void;
|
|
7
|
-
}
|
|
8
|
-
export declare const OptionsContext: React.Context<InterfaceOptionsWithState>;
|
|
9
|
-
export interface OptionsProviderProps extends React.PropsWithChildren {
|
|
10
|
-
value: InterfaceOptions;
|
|
11
|
-
changed: Signal<[options: Partial<InterfaceOptions>]>;
|
|
12
|
-
}
|
|
13
|
-
export declare function OptionsProvider({ value, changed, children, }: OptionsProviderProps): JSX.Element;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local useEventListener = TS.import(script, TS.getModule(script, "@rbxts", "pretty-react-hooks").out).useEventListener
|
|
4
|
-
local _react = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
5
|
-
local React = _react
|
|
6
|
-
local createContext = _react.createContext
|
|
7
|
-
local useState = _react.useState
|
|
8
|
-
-- we can safely assign to {} as the value will always be assigned in the provider
|
|
9
|
-
local OptionsContext = createContext({})
|
|
10
|
-
local function OptionsProvider(_param)
|
|
11
|
-
local value = _param.value
|
|
12
|
-
local changed = _param.changed
|
|
13
|
-
local children = _param.children
|
|
14
|
-
local isMouseOnGUI, setMouseOnGUI = useState(false)
|
|
15
|
-
local _object = table.clone(value)
|
|
16
|
-
setmetatable(_object, nil)
|
|
17
|
-
local options, setOptions = useState(_object)
|
|
18
|
-
useEventListener(changed, function(options)
|
|
19
|
-
setOptions(function(prev)
|
|
20
|
-
local _object_1 = table.clone(prev)
|
|
21
|
-
setmetatable(_object_1, nil)
|
|
22
|
-
for _k, _v in options do
|
|
23
|
-
_object_1[_k] = _v
|
|
24
|
-
end
|
|
25
|
-
return _object_1
|
|
26
|
-
end)
|
|
27
|
-
end)
|
|
28
|
-
local _attributes = {}
|
|
29
|
-
local _object_1 = table.clone(options)
|
|
30
|
-
setmetatable(_object_1, nil)
|
|
31
|
-
_object_1.isMouseOnGUI = isMouseOnGUI
|
|
32
|
-
_object_1.setMouseOnGUI = setMouseOnGUI
|
|
33
|
-
_attributes.value = _object_1
|
|
34
|
-
return React.createElement(OptionsContext.Provider, _attributes, children)
|
|
35
|
-
end
|
|
36
|
-
return {
|
|
37
|
-
OptionsProvider = OptionsProvider,
|
|
38
|
-
OptionsContext = OptionsContext,
|
|
39
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Signal } from "@rbxts/beacon";
|
|
2
|
-
import { ClientAPI } from "@rbxts/centurion";
|
|
3
|
-
import React from "@rbxts/react";
|
|
4
|
-
import { InterfaceOptions } from "../types";
|
|
5
|
-
interface RootProviderProps extends React.PropsWithChildren {
|
|
6
|
-
api: ClientAPI;
|
|
7
|
-
options: InterfaceOptions;
|
|
8
|
-
optionsChanged: Signal<[options: Partial<InterfaceOptions>]>;
|
|
9
|
-
}
|
|
10
|
-
export declare function RootProvider({ api, options, optionsChanged, children, }: RootProviderProps): JSX.Element;
|
|
11
|
-
export {};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local React = TS.import(script, TS.getModule(script, "@rbxts", "react"))
|
|
4
|
-
local ReflexProvider = TS.import(script, TS.getModule(script, "@rbxts", "react-reflex")).ReflexProvider
|
|
5
|
-
local store = TS.import(script, script.Parent.Parent, "store").store
|
|
6
|
-
local ApiProvider = TS.import(script, script.Parent, "api-provider").ApiProvider
|
|
7
|
-
local OptionsProvider = TS.import(script, script.Parent, "options-provider").OptionsProvider
|
|
8
|
-
local function RootProvider(_param)
|
|
9
|
-
local api = _param.api
|
|
10
|
-
local options = _param.options
|
|
11
|
-
local optionsChanged = _param.optionsChanged
|
|
12
|
-
local children = _param.children
|
|
13
|
-
return React.createElement(ReflexProvider, {
|
|
14
|
-
producer = store,
|
|
15
|
-
}, React.createElement(ApiProvider, {
|
|
16
|
-
api = api,
|
|
17
|
-
}, React.createElement(OptionsProvider, {
|
|
18
|
-
value = options,
|
|
19
|
-
changed = optionsChanged,
|
|
20
|
-
}, children)))
|
|
21
|
-
end
|
|
22
|
-
return {
|
|
23
|
-
RootProvider = RootProvider,
|
|
24
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local createProducer = TS.import(script, TS.getModule(script, "@rbxts", "reflex").src).createProducer
|
|
4
|
-
local initialAppState = {
|
|
5
|
-
visible = false,
|
|
6
|
-
}
|
|
7
|
-
local appSlice = createProducer(initialAppState, {
|
|
8
|
-
setVisible = function(state, visible)
|
|
9
|
-
local _object = table.clone(state)
|
|
10
|
-
setmetatable(_object, nil)
|
|
11
|
-
_object.visible = visible
|
|
12
|
-
return _object
|
|
13
|
-
end,
|
|
14
|
-
})
|
|
15
|
-
return {
|
|
16
|
-
appSlice = appSlice,
|
|
17
|
-
}
|
package/out/store/app/index.d.ts
DELETED
package/out/store/app/init.lua
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local exports = {}
|
|
4
|
-
for _k, _v in TS.import(script, script, "app-selectors") or {} do
|
|
5
|
-
exports[_k] = _v
|
|
6
|
-
end
|
|
7
|
-
for _k, _v in TS.import(script, script, "app-slice") or {} do
|
|
8
|
-
exports[_k] = _v
|
|
9
|
-
end
|
|
10
|
-
return exports
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ImmutableRegistryPath } from "@rbxts/centurion";
|
|
2
|
-
export interface CommandState {
|
|
3
|
-
path?: ImmutableRegistryPath;
|
|
4
|
-
argIndex?: number;
|
|
5
|
-
}
|
|
6
|
-
export declare const commandSlice: import("@rbxts/reflex").Producer<CommandState, {
|
|
7
|
-
setCommand: (state: CommandState, path?: ImmutableRegistryPath) => {
|
|
8
|
-
path: ImmutableRegistryPath | undefined;
|
|
9
|
-
argIndex?: number;
|
|
10
|
-
};
|
|
11
|
-
setArgIndex: (state: CommandState, index?: number) => {
|
|
12
|
-
argIndex: number | undefined;
|
|
13
|
-
path?: ImmutableRegistryPath;
|
|
14
|
-
};
|
|
15
|
-
}>;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local createProducer = TS.import(script, TS.getModule(script, "@rbxts", "reflex").src).createProducer
|
|
4
|
-
local initialCommandState = {}
|
|
5
|
-
local commandSlice = createProducer(initialCommandState, {
|
|
6
|
-
setCommand = function(state, path)
|
|
7
|
-
local _object = table.clone(state)
|
|
8
|
-
setmetatable(_object, nil)
|
|
9
|
-
_object.path = path
|
|
10
|
-
return _object
|
|
11
|
-
end,
|
|
12
|
-
setArgIndex = function(state, index)
|
|
13
|
-
local _object = table.clone(state)
|
|
14
|
-
setmetatable(_object, nil)
|
|
15
|
-
_object.argIndex = index
|
|
16
|
-
return _object
|
|
17
|
-
end,
|
|
18
|
-
})
|
|
19
|
-
return {
|
|
20
|
-
commandSlice = commandSlice,
|
|
21
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local exports = {}
|
|
4
|
-
for _k, _v in TS.import(script, script, "command-selectors") or {} do
|
|
5
|
-
exports[_k] = _v
|
|
6
|
-
end
|
|
7
|
-
for _k, _v in TS.import(script, script, "command-slice") or {} do
|
|
8
|
-
exports[_k] = _v
|
|
9
|
-
end
|
|
10
|
-
return exports
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export interface HistoryState {
|
|
2
|
-
commandHistory: string[];
|
|
3
|
-
commandHistoryIndex: number;
|
|
4
|
-
}
|
|
5
|
-
export declare const historySlice: import("@rbxts/reflex").Producer<HistoryState, {
|
|
6
|
-
addCommandHistory: (state: HistoryState, command: string, limit: number) => HistoryState;
|
|
7
|
-
setCommandHistoryIndex: (state: HistoryState, index: number) => {
|
|
8
|
-
commandHistoryIndex: number;
|
|
9
|
-
commandHistory: string[];
|
|
10
|
-
};
|
|
11
|
-
}>;
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local createProducer = TS.import(script, TS.getModule(script, "@rbxts", "reflex").src).createProducer
|
|
4
|
-
local initialHistoryState = {
|
|
5
|
-
commandHistory = {},
|
|
6
|
-
commandHistoryIndex = -1,
|
|
7
|
-
}
|
|
8
|
-
--[[
|
|
9
|
-
*
|
|
10
|
-
* Limits an array by removing the first n (limit) elements if
|
|
11
|
-
* the array's size exceeds the limit.
|
|
12
|
-
*
|
|
13
|
-
* @param array The array to limit
|
|
14
|
-
* @param limit The limit
|
|
15
|
-
|
|
16
|
-
]]
|
|
17
|
-
local function limitArray(array, limit)
|
|
18
|
-
if #array <= limit then
|
|
19
|
-
return nil
|
|
20
|
-
end
|
|
21
|
-
for i = 0, math.min(#array - 1, limit - 1) do
|
|
22
|
-
table.remove(array, i + 1)
|
|
23
|
-
end
|
|
24
|
-
end
|
|
25
|
-
local historySlice = createProducer(initialHistoryState, {
|
|
26
|
-
addCommandHistory = function(state, command, limit)
|
|
27
|
-
if #state.commandHistory > 0 and state.commandHistory[#state.commandHistory] == command then
|
|
28
|
-
return state
|
|
29
|
-
end
|
|
30
|
-
local _array = {}
|
|
31
|
-
local _length = #_array
|
|
32
|
-
local _array_1 = state.commandHistory
|
|
33
|
-
table.move(_array_1, 1, #_array_1, _length + 1, _array)
|
|
34
|
-
local commandHistory = _array
|
|
35
|
-
limitArray(commandHistory, limit)
|
|
36
|
-
local _command = command
|
|
37
|
-
table.insert(commandHistory, _command)
|
|
38
|
-
local _object = table.clone(state)
|
|
39
|
-
setmetatable(_object, nil)
|
|
40
|
-
_object.commandHistory = commandHistory
|
|
41
|
-
return _object
|
|
42
|
-
end,
|
|
43
|
-
setCommandHistoryIndex = function(state, index)
|
|
44
|
-
local _object = table.clone(state)
|
|
45
|
-
setmetatable(_object, nil)
|
|
46
|
-
_object.commandHistoryIndex = index
|
|
47
|
-
return _object
|
|
48
|
-
end,
|
|
49
|
-
})
|
|
50
|
-
return {
|
|
51
|
-
historySlice = historySlice,
|
|
52
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./history-slice";
|
package/out/store/index.d.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { InferState } from "@rbxts/reflex";
|
|
2
|
-
export type RootStore = typeof store;
|
|
3
|
-
export type RootState = InferState<RootStore>;
|
|
4
|
-
export declare const store: import("@rbxts/reflex").CombineProducers<{
|
|
5
|
-
app: import("@rbxts/reflex").Producer<import("./app").AppState, {
|
|
6
|
-
setVisible: (state: import("./app").AppState, visible: boolean) => {
|
|
7
|
-
visible: boolean;
|
|
8
|
-
};
|
|
9
|
-
}>;
|
|
10
|
-
command: import("@rbxts/reflex").Producer<import("./command").CommandState, {
|
|
11
|
-
setCommand: (state: import("./command").CommandState, path?: import("@rbxts/centurion").ImmutableRegistryPath) => {
|
|
12
|
-
path: import("@rbxts/centurion").ImmutableRegistryPath | undefined;
|
|
13
|
-
argIndex?: number;
|
|
14
|
-
};
|
|
15
|
-
setArgIndex: (state: import("./command").CommandState, index?: number) => {
|
|
16
|
-
argIndex: number | undefined;
|
|
17
|
-
path?: import("@rbxts/centurion").ImmutableRegistryPath;
|
|
18
|
-
};
|
|
19
|
-
}>;
|
|
20
|
-
history: import("@rbxts/reflex").Producer<import("./history").HistoryState, {
|
|
21
|
-
addCommandHistory: (state: import("./history").HistoryState, command: string, limit: number) => import("./history").HistoryState;
|
|
22
|
-
setCommandHistoryIndex: (state: import("./history").HistoryState, index: number) => {
|
|
23
|
-
commandHistoryIndex: number;
|
|
24
|
-
commandHistory: string[];
|
|
25
|
-
};
|
|
26
|
-
}>;
|
|
27
|
-
suggestion: import("@rbxts/reflex").Producer<import("./suggestion").SuggestionState, {
|
|
28
|
-
setSuggestion: (state: import("./suggestion").SuggestionState, suggestion?: import("../types").Suggestion) => {
|
|
29
|
-
current: import("../types").Suggestion | undefined;
|
|
30
|
-
};
|
|
31
|
-
}>;
|
|
32
|
-
text: import("@rbxts/reflex").Producer<import("./text").TextState, {
|
|
33
|
-
setText: (state: import("./text").TextState, text: string, textParts: string[]) => {
|
|
34
|
-
value: string;
|
|
35
|
-
parts: string[];
|
|
36
|
-
index: number;
|
|
37
|
-
valid: boolean;
|
|
38
|
-
};
|
|
39
|
-
setTextValid: (state: import("./text").TextState, valid: boolean) => {
|
|
40
|
-
valid: boolean;
|
|
41
|
-
value: string;
|
|
42
|
-
parts: string[];
|
|
43
|
-
index: number;
|
|
44
|
-
};
|
|
45
|
-
}>;
|
|
46
|
-
}>;
|
package/out/store/init.lua
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local combineProducers = TS.import(script, TS.getModule(script, "@rbxts", "reflex").src).combineProducers
|
|
4
|
-
local appSlice = TS.import(script, script, "app").appSlice
|
|
5
|
-
local commandSlice = TS.import(script, script, "command").commandSlice
|
|
6
|
-
local historySlice = TS.import(script, script, "history").historySlice
|
|
7
|
-
local suggestionSlice = TS.import(script, script, "suggestion").suggestionSlice
|
|
8
|
-
local textSlice = TS.import(script, script, "text").textSlice
|
|
9
|
-
local store = combineProducers({
|
|
10
|
-
app = appSlice,
|
|
11
|
-
command = commandSlice,
|
|
12
|
-
history = historySlice,
|
|
13
|
-
suggestion = suggestionSlice,
|
|
14
|
-
text = textSlice,
|
|
15
|
-
})
|
|
16
|
-
return {
|
|
17
|
-
store = store,
|
|
18
|
-
}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local exports = {}
|
|
4
|
-
for _k, _v in TS.import(script, script, "suggestion-selectors") or {} do
|
|
5
|
-
exports[_k] = _v
|
|
6
|
-
end
|
|
7
|
-
for _k, _v in TS.import(script, script, "suggestion-slice") or {} do
|
|
8
|
-
exports[_k] = _v
|
|
9
|
-
end
|
|
10
|
-
return exports
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { Suggestion } from "../../types";
|
|
2
|
-
export interface SuggestionState {
|
|
3
|
-
current?: Suggestion;
|
|
4
|
-
}
|
|
5
|
-
export declare const suggestionSlice: import("@rbxts/reflex").Producer<SuggestionState, {
|
|
6
|
-
setSuggestion: (state: SuggestionState, suggestion?: Suggestion) => {
|
|
7
|
-
current: Suggestion | undefined;
|
|
8
|
-
};
|
|
9
|
-
}>;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local createProducer = TS.import(script, TS.getModule(script, "@rbxts", "reflex").src).createProducer
|
|
4
|
-
local initialSuggestionState = {}
|
|
5
|
-
local suggestionSlice = createProducer(initialSuggestionState, {
|
|
6
|
-
setSuggestion = function(state, suggestion)
|
|
7
|
-
local _object = table.clone(state)
|
|
8
|
-
setmetatable(_object, nil)
|
|
9
|
-
_object.current = suggestion
|
|
10
|
-
return _object
|
|
11
|
-
end,
|
|
12
|
-
})
|
|
13
|
-
return {
|
|
14
|
-
suggestionSlice = suggestionSlice,
|
|
15
|
-
}
|
package/out/store/text/init.lua
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local exports = {}
|
|
4
|
-
for _k, _v in TS.import(script, script, "text-selectors") or {} do
|
|
5
|
-
exports[_k] = _v
|
|
6
|
-
end
|
|
7
|
-
for _k, _v in TS.import(script, script, "text-slice") or {} do
|
|
8
|
-
exports[_k] = _v
|
|
9
|
-
end
|
|
10
|
-
return exports
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
export interface TextState {
|
|
2
|
-
value: string;
|
|
3
|
-
parts: string[];
|
|
4
|
-
index: number;
|
|
5
|
-
valid: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare const textSlice: import("@rbxts/reflex").Producer<TextState, {
|
|
8
|
-
setText: (state: TextState, text: string, textParts: string[]) => {
|
|
9
|
-
value: string;
|
|
10
|
-
parts: string[];
|
|
11
|
-
index: number;
|
|
12
|
-
valid: boolean;
|
|
13
|
-
};
|
|
14
|
-
setTextValid: (state: TextState, valid: boolean) => {
|
|
15
|
-
valid: boolean;
|
|
16
|
-
value: string;
|
|
17
|
-
parts: string[];
|
|
18
|
-
index: number;
|
|
19
|
-
};
|
|
20
|
-
}>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
-- Compiled with roblox-ts v2.3.0-dev-26ec859
|
|
2
|
-
local TS = _G[script]
|
|
3
|
-
local createProducer = TS.import(script, TS.getModule(script, "@rbxts", "reflex").src).createProducer
|
|
4
|
-
local initialTextState = {
|
|
5
|
-
value = "",
|
|
6
|
-
parts = {},
|
|
7
|
-
index = -1,
|
|
8
|
-
valid = false,
|
|
9
|
-
}
|
|
10
|
-
local textSlice = createProducer(initialTextState, {
|
|
11
|
-
setText = function(state, text, textParts)
|
|
12
|
-
local endsWithSpace = #textParts > 0 and #{ string.match(text, "%s$") } > 0
|
|
13
|
-
local _object = table.clone(state)
|
|
14
|
-
setmetatable(_object, nil)
|
|
15
|
-
_object.value = text
|
|
16
|
-
_object.parts = textParts
|
|
17
|
-
_object.index = if endsWithSpace then #textParts else #textParts - 1
|
|
18
|
-
return _object
|
|
19
|
-
end,
|
|
20
|
-
setTextValid = function(state, valid)
|
|
21
|
-
local _object = table.clone(state)
|
|
22
|
-
setmetatable(_object, nil)
|
|
23
|
-
_object.valid = valid
|
|
24
|
-
return _object
|
|
25
|
-
end,
|
|
26
|
-
})
|
|
27
|
-
return {
|
|
28
|
-
textSlice = textSlice,
|
|
29
|
-
}
|