@quenty/inputkeymaputils 14.43.1 → 14.44.0
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/CHANGELOG.md +10 -0
- package/package.json +5 -5
- package/src/Client/InputKeyMapListUtils.lua +27 -15
- package/src/Client/InputKeyMapServiceClient.lua +23 -7
- package/src/Server/InputKeyMapService.lua +10 -3
- package/src/Shared/InputKeyMapRegistryServiceShared.lua +49 -16
- package/src/Shared/Types/InputChordUtils.lua +18 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,16 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [14.44.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputkeymaputils@14.43.1...@quenty/inputkeymaputils@14.44.0) (2026-07-14)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **inputkeymaputils:** supply [@type](https://github.com/type) value so moonwave-extractor passes ([8f6d832](https://github.com/Quenty/NevermoreEngine/commit/8f6d8324ac613a39e31cdb317b9fdd796749fe01))
|
|
11
|
+
|
|
12
|
+
### Features
|
|
13
|
+
|
|
14
|
+
- **inputkeymaputils:** convert package to --!strict ([6eb30a3](https://github.com/Quenty/NevermoreEngine/commit/6eb30a34f76212e77326a5aa3310f3d6579e0de2))
|
|
15
|
+
|
|
6
16
|
## [14.43.1](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputkeymaputils@14.43.0...@quenty/inputkeymaputils@14.43.1) (2026-05-30)
|
|
7
17
|
|
|
8
18
|
**Note:** Version bump only for package @quenty/inputkeymaputils
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quenty/inputkeymaputils",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.44.0",
|
|
4
4
|
"description": "System to define rebindable key bindings and inputs for Roblox.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Roblox",
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@quenty/baseobject": "10.13.0",
|
|
33
33
|
"@quenty/brio": "14.30.1",
|
|
34
|
-
"@quenty/clienttranslator": "14.
|
|
34
|
+
"@quenty/clienttranslator": "14.38.0",
|
|
35
35
|
"@quenty/ducktype": "5.11.0",
|
|
36
36
|
"@quenty/enumutils": "3.4.6",
|
|
37
|
-
"@quenty/inputmode": "13.
|
|
37
|
+
"@quenty/inputmode": "13.35.0",
|
|
38
38
|
"@quenty/loader": "10.11.0",
|
|
39
39
|
"@quenty/maid": "3.9.0",
|
|
40
40
|
"@quenty/nevermore-test-runner": "1.4.0",
|
|
41
|
-
"@quenty/observablecollection": "12.
|
|
41
|
+
"@quenty/observablecollection": "12.39.0",
|
|
42
42
|
"@quenty/pseudolocalize": "3.5.2",
|
|
43
43
|
"@quenty/rx": "13.28.3",
|
|
44
44
|
"@quenty/servicebag": "11.18.1",
|
|
@@ -53,5 +53,5 @@
|
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
55
55
|
},
|
|
56
|
-
"gitHead": "
|
|
56
|
+
"gitHead": "13f0162f4971a77378e55e9b7236aea94f0dd3a8"
|
|
57
57
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Client side utility helpers for observing input modes for the current client.
|
|
4
4
|
|
|
@@ -7,8 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
local require = require(script.Parent.loader).load(script)
|
|
9
9
|
|
|
10
|
+
local InputKeyMap = require("InputKeyMap")
|
|
10
11
|
local InputKeyMapList = require("InputKeyMapList")
|
|
12
|
+
local InputModeType = require("InputModeType")
|
|
11
13
|
local InputModeTypeSelector = require("InputModeTypeSelector")
|
|
14
|
+
local InputTypeUtils = require("InputTypeUtils")
|
|
12
15
|
local Maid = require("Maid")
|
|
13
16
|
local Observable = require("Observable")
|
|
14
17
|
local Rx = require("Rx")
|
|
@@ -24,7 +27,7 @@ local InputKeyMapListUtils = {}
|
|
|
24
27
|
@return InputModeTypeSelector
|
|
25
28
|
]=]
|
|
26
29
|
function InputKeyMapListUtils.getNewInputModeTypeSelector(
|
|
27
|
-
inputKeyMapList,
|
|
30
|
+
inputKeyMapList: InputKeyMapList.InputKeyMapList,
|
|
28
31
|
serviceBag: ServiceBag.ServiceBag
|
|
29
32
|
): InputModeTypeSelector.InputModeTypeSelector
|
|
30
33
|
assert(InputKeyMapList.isInputKeyMapList(inputKeyMapList), "Bad inputKeyMapList")
|
|
@@ -40,19 +43,22 @@ end
|
|
|
40
43
|
@param serviceBag ServiceBag
|
|
41
44
|
@return Observable<InputKeyMap>
|
|
42
45
|
]=]
|
|
43
|
-
function InputKeyMapListUtils.observeActiveInputKeyMap(
|
|
46
|
+
function InputKeyMapListUtils.observeActiveInputKeyMap(
|
|
47
|
+
inputKeyMapList: InputKeyMapList.InputKeyMapList,
|
|
48
|
+
serviceBag: ServiceBag.ServiceBag
|
|
49
|
+
): Observable.Observable<InputKeyMap.InputKeyMap?>
|
|
44
50
|
assert(InputKeyMapList.isInputKeyMapList(inputKeyMapList), "Bad inputKeyMapList")
|
|
45
51
|
assert(ServiceBag.isServiceBag(serviceBag), "Bad serviceBag")
|
|
46
52
|
|
|
47
|
-
return InputKeyMapListUtils.observeActiveInputModeType(inputKeyMapList, serviceBag):Pipe({
|
|
48
|
-
Rx.switchMap(function(activeInputModeType)
|
|
53
|
+
return (InputKeyMapListUtils.observeActiveInputModeType(inputKeyMapList, serviceBag) :: any):Pipe({
|
|
54
|
+
Rx.switchMap(function(activeInputModeType): any
|
|
49
55
|
if activeInputModeType then
|
|
50
56
|
return inputKeyMapList:ObserveInputKeyMapForInputMode(activeInputModeType)
|
|
51
57
|
else
|
|
52
58
|
return Rx.of(nil)
|
|
53
59
|
end
|
|
54
60
|
end),
|
|
55
|
-
})
|
|
61
|
+
}) :: any
|
|
56
62
|
end
|
|
57
63
|
|
|
58
64
|
--[=[
|
|
@@ -67,20 +73,23 @@ end
|
|
|
67
73
|
@param serviceBag ServiceBag
|
|
68
74
|
@return Observable<{ InputType }?>
|
|
69
75
|
]=]
|
|
70
|
-
function InputKeyMapListUtils.observeActiveInputTypesList(
|
|
76
|
+
function InputKeyMapListUtils.observeActiveInputTypesList(
|
|
77
|
+
inputKeyMapList: InputKeyMapList.InputKeyMapList,
|
|
78
|
+
serviceBag: ServiceBag.ServiceBag
|
|
79
|
+
): Observable.Observable<{ InputTypeUtils.InputType }?>
|
|
71
80
|
assert(InputKeyMapList.isInputKeyMapList(inputKeyMapList), "Bad inputKeyMapList")
|
|
72
81
|
assert(ServiceBag.isServiceBag(serviceBag), "Bad serviceBag")
|
|
73
82
|
|
|
74
|
-
return InputKeyMapListUtils.observeActiveInputKeyMap(inputKeyMapList, serviceBag):Pipe({
|
|
75
|
-
Rx.switchMap(function(activeInputMap)
|
|
83
|
+
return (InputKeyMapListUtils.observeActiveInputKeyMap(inputKeyMapList, serviceBag) :: any):Pipe({
|
|
84
|
+
Rx.switchMap(function(activeInputMap): any
|
|
76
85
|
if activeInputMap then
|
|
77
86
|
return activeInputMap:ObserveInputTypesList()
|
|
78
87
|
else
|
|
79
88
|
return Rx.of(nil)
|
|
80
89
|
end
|
|
81
|
-
end),
|
|
82
|
-
Rx.distinct(),
|
|
83
|
-
})
|
|
90
|
+
end) :: any,
|
|
91
|
+
Rx.distinct() :: any,
|
|
92
|
+
}) :: any
|
|
84
93
|
end
|
|
85
94
|
|
|
86
95
|
--[=[
|
|
@@ -90,11 +99,14 @@ end
|
|
|
90
99
|
@param serviceBag ServiceBag
|
|
91
100
|
@return Observable<InputModeType?>
|
|
92
101
|
]=]
|
|
93
|
-
function InputKeyMapListUtils.observeActiveInputModeType(
|
|
102
|
+
function InputKeyMapListUtils.observeActiveInputModeType(
|
|
103
|
+
inputKeyMapList: InputKeyMapList.InputKeyMapList,
|
|
104
|
+
serviceBag: ServiceBag.ServiceBag
|
|
105
|
+
): Observable.Observable<InputModeType.InputModeType?>
|
|
94
106
|
assert(InputKeyMapList.isInputKeyMapList(inputKeyMapList), "Bad inputKeyMapList")
|
|
95
107
|
assert(ServiceBag.isServiceBag(serviceBag), "Bad serviceBag")
|
|
96
108
|
|
|
97
|
-
return Observable.new(function(sub)
|
|
109
|
+
return Observable.new((function(sub: any)
|
|
98
110
|
local maid = Maid.new()
|
|
99
111
|
|
|
100
112
|
local selector = maid:Add(InputKeyMapListUtils.getNewInputModeTypeSelector(inputKeyMapList, serviceBag))
|
|
@@ -105,7 +117,7 @@ function InputKeyMapListUtils.observeActiveInputModeType(inputKeyMapList, servic
|
|
|
105
117
|
sub:Fire(selector.Value)
|
|
106
118
|
|
|
107
119
|
return maid
|
|
108
|
-
end)
|
|
120
|
+
end) :: any) :: any
|
|
109
121
|
end
|
|
110
122
|
|
|
111
123
|
return InputKeyMapListUtils
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
@class InputKeyMapServiceClient
|
|
4
4
|
]=]
|
|
5
5
|
|
|
6
6
|
local require = require(script.Parent.loader).load(script)
|
|
7
7
|
|
|
8
|
+
local InputKeyMapList = require("InputKeyMapList")
|
|
9
|
+
local InputKeyMapRegistryServiceShared = require("InputKeyMapRegistryServiceShared")
|
|
8
10
|
local Maid = require("Maid")
|
|
9
11
|
local PseudoLocalize = require("PseudoLocalize")
|
|
10
12
|
local ServiceBag = require("ServiceBag")
|
|
@@ -12,8 +14,18 @@ local ServiceBag = require("ServiceBag")
|
|
|
12
14
|
local InputKeyMapServiceClient = {}
|
|
13
15
|
InputKeyMapServiceClient.ServiceName = "InputKeyMapServiceClient"
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
export type InputKeyMapServiceClient = typeof(setmetatable(
|
|
18
|
+
{} :: {
|
|
19
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
20
|
+
_maid: Maid.Maid,
|
|
21
|
+
_translator: any,
|
|
22
|
+
_registryService: InputKeyMapRegistryServiceShared.InputKeyMapRegistryServiceShared,
|
|
23
|
+
},
|
|
24
|
+
{} :: typeof({ __index = InputKeyMapServiceClient })
|
|
25
|
+
))
|
|
26
|
+
|
|
27
|
+
function InputKeyMapServiceClient.Init(self: InputKeyMapServiceClient, serviceBag: ServiceBag.ServiceBag): ()
|
|
28
|
+
assert(not (self :: any)._serviceBag, "Already initialized")
|
|
17
29
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
18
30
|
self._maid = Maid.new()
|
|
19
31
|
|
|
@@ -22,16 +34,20 @@ function InputKeyMapServiceClient:Init(serviceBag: ServiceBag.ServiceBag)
|
|
|
22
34
|
|
|
23
35
|
-- Internal
|
|
24
36
|
self._translator = self._serviceBag:GetService(require("InputKeyMapTranslator"))
|
|
25
|
-
self._registryService = self._serviceBag:GetService(require("InputKeyMapRegistryServiceShared"))
|
|
37
|
+
self._registryService = self._serviceBag:GetService(require("InputKeyMapRegistryServiceShared")) :: any
|
|
26
38
|
|
|
27
39
|
self:_ensureLocalizationEntries()
|
|
28
40
|
end
|
|
29
41
|
|
|
30
|
-
function InputKeyMapServiceClient
|
|
42
|
+
function InputKeyMapServiceClient.FindInputKeyMapList(
|
|
43
|
+
self: InputKeyMapServiceClient,
|
|
44
|
+
providerName: string,
|
|
45
|
+
listName: string
|
|
46
|
+
): InputKeyMapList.InputKeyMapList?
|
|
31
47
|
return self._registryService:FindInputKeyMapList(providerName, listName)
|
|
32
48
|
end
|
|
33
49
|
|
|
34
|
-
function InputKeyMapServiceClient
|
|
50
|
+
function InputKeyMapServiceClient._ensureLocalizationEntries(self: InputKeyMapServiceClient): ()
|
|
35
51
|
self._maid:GiveTask(self._registryService:ObserveInputKeyMapListsBrio():Subscribe(function(brio)
|
|
36
52
|
if brio:IsDead() then
|
|
37
53
|
return
|
|
@@ -59,7 +75,7 @@ function InputKeyMapServiceClient:_ensureLocalizationEntries()
|
|
|
59
75
|
end))
|
|
60
76
|
end
|
|
61
77
|
|
|
62
|
-
function InputKeyMapServiceClient
|
|
78
|
+
function InputKeyMapServiceClient.Destroy(self: InputKeyMapServiceClient): ()
|
|
63
79
|
self._maid:DoCleaning()
|
|
64
80
|
end
|
|
65
81
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
@class InputKeyMapService
|
|
4
4
|
]=]
|
|
@@ -10,8 +10,15 @@ local ServiceBag = require("ServiceBag")
|
|
|
10
10
|
local InputKeyMapService = {}
|
|
11
11
|
InputKeyMapService.ServiceName = "InputKeyMapService"
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
export type InputKeyMapService = typeof(setmetatable(
|
|
14
|
+
{} :: {
|
|
15
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
16
|
+
},
|
|
17
|
+
{} :: typeof({ __index = InputKeyMapService })
|
|
18
|
+
))
|
|
19
|
+
|
|
20
|
+
function InputKeyMapService.Init(self: InputKeyMapService, serviceBag: ServiceBag.ServiceBag): ()
|
|
21
|
+
assert(not (self :: any)._serviceBag, "Already initialized")
|
|
15
22
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
16
23
|
|
|
17
24
|
-- Internal
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Provides retrieval of input key maps across the game. Available on both the client and the server.
|
|
4
4
|
|
|
@@ -11,7 +11,10 @@ local RunService = game:GetService("RunService")
|
|
|
11
11
|
|
|
12
12
|
local require = require(script.Parent.loader).load(script)
|
|
13
13
|
|
|
14
|
+
local Brio = require("Brio")
|
|
15
|
+
local InputKeyMapList = require("InputKeyMapList")
|
|
14
16
|
local Maid = require("Maid")
|
|
17
|
+
local Observable = require("Observable")
|
|
15
18
|
local ObservableList = require("ObservableList")
|
|
16
19
|
local Rx = require("Rx")
|
|
17
20
|
local RxBrioUtils = require("RxBrioUtils")
|
|
@@ -20,8 +23,21 @@ local ServiceBag = require("ServiceBag")
|
|
|
20
23
|
local InputKeyMapRegistryServiceShared = {}
|
|
21
24
|
InputKeyMapRegistryServiceShared.ServiceName = "InputKeyMapRegistryServiceShared"
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
export type InputKeyMapRegistryServiceShared = typeof(setmetatable(
|
|
27
|
+
{} :: {
|
|
28
|
+
_serviceBag: ServiceBag.ServiceBag,
|
|
29
|
+
_maid: Maid.Maid,
|
|
30
|
+
_providerLookupByName: { [string]: any },
|
|
31
|
+
_providersList: ObservableList.ObservableList<any>,
|
|
32
|
+
},
|
|
33
|
+
{} :: typeof({ __index = InputKeyMapRegistryServiceShared })
|
|
34
|
+
))
|
|
35
|
+
|
|
36
|
+
function InputKeyMapRegistryServiceShared.Init(
|
|
37
|
+
self: InputKeyMapRegistryServiceShared,
|
|
38
|
+
serviceBag: ServiceBag.ServiceBag
|
|
39
|
+
): ()
|
|
40
|
+
assert(not (self :: any)._serviceBag, "Already initialized")
|
|
25
41
|
self._serviceBag = assert(serviceBag, "No serviceBag")
|
|
26
42
|
self._maid = Maid.new()
|
|
27
43
|
|
|
@@ -30,7 +46,7 @@ function InputKeyMapRegistryServiceShared:Init(serviceBag: ServiceBag.ServiceBag
|
|
|
30
46
|
self._providersList = ObservableList.new()
|
|
31
47
|
self._maid:GiveTask(self._providersList)
|
|
32
48
|
|
|
33
|
-
self._maid:GiveTask(self._providersList:ObserveItemsBrio():Subscribe(function(brio)
|
|
49
|
+
self._maid:GiveTask((self._providersList:ObserveItemsBrio() :: any):Subscribe(function(brio)
|
|
34
50
|
if brio:IsDead() then
|
|
35
51
|
return
|
|
36
52
|
end
|
|
@@ -54,40 +70,53 @@ function InputKeyMapRegistryServiceShared:Init(serviceBag: ServiceBag.ServiceBag
|
|
|
54
70
|
end))
|
|
55
71
|
end
|
|
56
72
|
|
|
57
|
-
function InputKeyMapRegistryServiceShared
|
|
73
|
+
function InputKeyMapRegistryServiceShared.RegisterProvider(
|
|
74
|
+
self: InputKeyMapRegistryServiceShared,
|
|
75
|
+
provider: any
|
|
76
|
+
): () -> ()
|
|
58
77
|
assert(provider, "Bad provider")
|
|
59
78
|
assert(self._providersList, "Not initialized")
|
|
60
79
|
|
|
61
80
|
return self._providersList:Add(provider)
|
|
62
81
|
end
|
|
63
82
|
|
|
64
|
-
function InputKeyMapRegistryServiceShared
|
|
83
|
+
function InputKeyMapRegistryServiceShared.ObserveProvidersBrio(
|
|
84
|
+
self: InputKeyMapRegistryServiceShared
|
|
85
|
+
): Observable.Observable<Brio.Brio<any>>
|
|
65
86
|
return self._providersList:ObserveItemsBrio()
|
|
66
87
|
end
|
|
67
88
|
|
|
68
|
-
function InputKeyMapRegistryServiceShared
|
|
69
|
-
|
|
70
|
-
|
|
89
|
+
function InputKeyMapRegistryServiceShared.ObserveInputKeyMapListsBrio(self: InputKeyMapRegistryServiceShared): Observable.Observable<
|
|
90
|
+
Brio.Brio<InputKeyMapList.InputKeyMapList>
|
|
91
|
+
>
|
|
92
|
+
return (self:ObserveProvidersBrio() :: any):Pipe({
|
|
93
|
+
RxBrioUtils.flatMapBrio(function(provider): any
|
|
71
94
|
return provider:ObserveInputKeyMapListsBrio()
|
|
72
95
|
end),
|
|
73
96
|
})
|
|
74
97
|
end
|
|
75
98
|
|
|
76
|
-
function InputKeyMapRegistryServiceShared
|
|
99
|
+
function InputKeyMapRegistryServiceShared.GetProvider(self: InputKeyMapRegistryServiceShared, providerName: string): any
|
|
77
100
|
assert(type(providerName) == "string", "Bad providerName")
|
|
78
101
|
|
|
79
102
|
return self._providerLookupByName[providerName]
|
|
80
103
|
end
|
|
81
104
|
|
|
82
|
-
function InputKeyMapRegistryServiceShared
|
|
105
|
+
function InputKeyMapRegistryServiceShared.ObserveInputKeyMapList(
|
|
106
|
+
self: InputKeyMapRegistryServiceShared,
|
|
107
|
+
providerName: any,
|
|
108
|
+
inputKeyMapListName: any
|
|
109
|
+
): Observable.Observable<
|
|
110
|
+
InputKeyMapList.InputKeyMapList?
|
|
111
|
+
>
|
|
83
112
|
assert(providerName, "Bad providerName")
|
|
84
113
|
assert(inputKeyMapListName, "Bad inputKeyMapListName")
|
|
85
114
|
|
|
86
|
-
return Rx.combineLatest({
|
|
115
|
+
return (Rx.combineLatest({
|
|
87
116
|
providerName = providerName,
|
|
88
117
|
inputKeyMapListName = inputKeyMapListName,
|
|
89
|
-
}):Pipe({
|
|
90
|
-
Rx.map(function(state)
|
|
118
|
+
}) :: any):Pipe({
|
|
119
|
+
Rx.map(function(state: any): any
|
|
91
120
|
if not (type(state.inputKeyMapListName) == "string" and type(state.providerName) == "string") then
|
|
92
121
|
return nil
|
|
93
122
|
end
|
|
@@ -110,7 +139,11 @@ function InputKeyMapRegistryServiceShared:ObserveInputKeyMapList(providerName, i
|
|
|
110
139
|
})
|
|
111
140
|
end
|
|
112
141
|
|
|
113
|
-
function InputKeyMapRegistryServiceShared
|
|
142
|
+
function InputKeyMapRegistryServiceShared.FindInputKeyMapList(
|
|
143
|
+
self: InputKeyMapRegistryServiceShared,
|
|
144
|
+
providerName: string,
|
|
145
|
+
inputKeyMapListName: string
|
|
146
|
+
): InputKeyMapList.InputKeyMapList?
|
|
114
147
|
assert(type(providerName) == "string", "Bad providerName")
|
|
115
148
|
assert(type(inputKeyMapListName) == "string", "Bad inputKeyMapListName")
|
|
116
149
|
|
|
@@ -132,7 +165,7 @@ function InputKeyMapRegistryServiceShared:FindInputKeyMapList(providerName: stri
|
|
|
132
165
|
return nil
|
|
133
166
|
end
|
|
134
167
|
|
|
135
|
-
function InputKeyMapRegistryServiceShared
|
|
168
|
+
function InputKeyMapRegistryServiceShared.Destroy(self: InputKeyMapRegistryServiceShared): ()
|
|
136
169
|
self._maid:DoCleaning()
|
|
137
170
|
end
|
|
138
171
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
--!
|
|
1
|
+
--!strict
|
|
2
2
|
--[=[
|
|
3
3
|
Standardized data type to define an input chord, such as Ctrl+Z.
|
|
4
4
|
|
|
@@ -9,6 +9,18 @@ local require = require(script.Parent.loader).load(script)
|
|
|
9
9
|
|
|
10
10
|
local EnumUtils = require("EnumUtils")
|
|
11
11
|
|
|
12
|
+
--[=[
|
|
13
|
+
A modifier input chord data type that separates keyCode from modifier keys.
|
|
14
|
+
|
|
15
|
+
@type ModifierInputChord { type: "ModifierInputChord", modifiers: { Enum.KeyCode }, keyCode: Enum.KeyCode }
|
|
16
|
+
@within InputChordUtils
|
|
17
|
+
]=]
|
|
18
|
+
export type ModifierInputChord = {
|
|
19
|
+
type: "ModifierInputChord",
|
|
20
|
+
modifiers: { Enum.KeyCode },
|
|
21
|
+
keyCode: Enum.KeyCode,
|
|
22
|
+
}
|
|
23
|
+
|
|
12
24
|
local InputChordUtils = {}
|
|
13
25
|
|
|
14
26
|
--[=[
|
|
@@ -16,7 +28,7 @@ local InputChordUtils = {}
|
|
|
16
28
|
@param data any
|
|
17
29
|
@return boolean
|
|
18
30
|
]=]
|
|
19
|
-
function InputChordUtils.isModifierInputChord(data)
|
|
31
|
+
function InputChordUtils.isModifierInputChord(data: any): boolean
|
|
20
32
|
return type(data) == "table"
|
|
21
33
|
and data.type == "ModifierInputChord"
|
|
22
34
|
and type(data.modifiers) == "table"
|
|
@@ -34,7 +46,10 @@ end
|
|
|
34
46
|
@param keyCode KeyCode
|
|
35
47
|
@return ModifierInputChord
|
|
36
48
|
]=]
|
|
37
|
-
function InputChordUtils.createModifierInputChord(
|
|
49
|
+
function InputChordUtils.createModifierInputChord(
|
|
50
|
+
modifiers: { Enum.KeyCode },
|
|
51
|
+
keyCode: Enum.KeyCode
|
|
52
|
+
): ModifierInputChord
|
|
38
53
|
assert(type(modifiers) == "table", "Bad modifiers")
|
|
39
54
|
assert(EnumUtils.isOfType(Enum.KeyCode, keyCode), "Bad keyCode")
|
|
40
55
|
|