@quenty/inputkeymaputils 7.25.0 → 7.26.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 CHANGED
@@ -3,6 +3,17 @@
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
+ # [7.26.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputkeymaputils@7.25.0...@quenty/inputkeymaputils@7.26.0) (2023-05-08)
7
+
8
+
9
+ ### Features
10
+
11
+ * Add InputKeyMapList.fromInputKeys(inputKeys, options) ([be1c478](https://github.com/Quenty/NevermoreEngine/commit/be1c478e63371e32d27cb36e42b444b666fc425b))
12
+
13
+
14
+
15
+
16
+
6
17
  # [7.25.0](https://github.com/Quenty/NevermoreEngine/compare/@quenty/inputkeymaputils@7.24.0...@quenty/inputkeymaputils@7.25.0) (2023-04-24)
7
18
 
8
19
  **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": "7.25.0",
3
+ "version": "7.26.0",
4
4
  "description": "System to define rebindable key bindings and inputs for Roblox.",
5
5
  "keywords": [
6
6
  "Roblox",
@@ -27,24 +27,24 @@
27
27
  ],
28
28
  "dependencies": {
29
29
  "@quenty/baseobject": "^6.2.1",
30
- "@quenty/brio": "^8.11.0",
31
- "@quenty/clienttranslator": "^8.19.0",
30
+ "@quenty/brio": "^8.12.0",
31
+ "@quenty/clienttranslator": "^8.20.0",
32
32
  "@quenty/enumutils": "^3.1.0",
33
- "@quenty/inputmode": "^7.17.0",
33
+ "@quenty/inputmode": "^7.18.0",
34
34
  "@quenty/loader": "^6.2.1",
35
35
  "@quenty/maid": "^2.5.0",
36
- "@quenty/observablecollection": "^5.14.0",
36
+ "@quenty/observablecollection": "^5.15.0",
37
37
  "@quenty/pseudolocalize": "^3.2.0",
38
38
  "@quenty/rx": "^7.10.0",
39
39
  "@quenty/servicebag": "^6.6.1",
40
- "@quenty/statestack": "^8.12.0",
40
+ "@quenty/statestack": "^8.13.0",
41
41
  "@quenty/string": "^3.1.0",
42
42
  "@quenty/table": "^3.2.0",
43
- "@quenty/valuebaseutils": "^7.12.0",
44
- "@quenty/valueobject": "^7.12.0"
43
+ "@quenty/valuebaseutils": "^7.13.0",
44
+ "@quenty/valueobject": "^7.13.0"
45
45
  },
46
46
  "publishConfig": {
47
47
  "access": "public"
48
48
  },
49
- "gitHead": "a8a760988c8fd88c2581c5c496a8bad845de104c"
49
+ "gitHead": "2ad8cea7dd3ad79a39afd7d7b785b489b90553fd"
50
50
  }
@@ -54,6 +54,7 @@ local SlottedTouchButtonUtils = require("SlottedTouchButtonUtils")
54
54
  local StateStack = require("StateStack")
55
55
  local String = require("String")
56
56
  local InputChordUtils = require("InputChordUtils")
57
+ local InputModeTypes = require("InputModeTypes")
57
58
 
58
59
  local InputKeyMapList = setmetatable({}, BaseObject)
59
60
  InputKeyMapList.ClassName = "InputKeyMapList"
@@ -83,6 +84,46 @@ function InputKeyMapList.new(inputMapName, inputKeyMapList, options)
83
84
  return self
84
85
  end
85
86
 
87
+ --[=[
88
+ Constructs a new InputKeyMapList from specific keys
89
+
90
+ ```
91
+ local inputKeyMapList = InputKeyMapList.fromInputKeys({ Enum.KeyCode.E })
92
+ ```
93
+
94
+ @param inputKeys { any }
95
+ @param options { bindingName: string, rebindable: boolean } | nil -- Optional configuration options
96
+ @return InputKeyMapList
97
+ ]=]
98
+ function InputKeyMapList.fromInputKeys(inputKeys, options)
99
+ assert(type(inputKeys) == "table", "Bad inputKeys")
100
+
101
+ local self = InputKeyMapList.new("generated", {}, options or {
102
+ rebindable = false;
103
+ bindingName = "generated";
104
+ })
105
+
106
+ local INPUT_TYPES = {
107
+ InputModeTypes.KeyboardAndMouse;
108
+ InputModeTypes.Gamepads;
109
+ InputModeTypes.Touch;
110
+ }
111
+
112
+ for _, inputModeType in pairs(INPUT_TYPES) do
113
+ local inputTypes = {}
114
+ for _, item in pairs(inputKeys) do
115
+ if inputModeType:IsValid(item) then
116
+ table.insert(inputTypes, item)
117
+ end
118
+ end
119
+
120
+ -- Adding it ensures clean up
121
+ self:Add(InputKeyMap.new(inputModeType, inputTypes))
122
+ end
123
+
124
+ return self
125
+ end
126
+
86
127
  --[=[
87
128
  Returns whether this value is an InputKeyMapList
88
129