bm-core-ui 2.9.5 → 2.10.1

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 (56) hide show
  1. package/build/@types/index.d.ts +320 -61
  2. package/build/BMCollectionView/BMCollectionView.js +79 -41
  3. package/build/BMCollectionView/BMCollectionViewFlowLayout.js +18 -5
  4. package/build/BMCoreUI.css +45 -18
  5. package/build/BMView/BMMenu.js +135 -7
  6. package/build/BMView/BMView_v2.5.js +59 -0
  7. package/build/BMWindow/BMKeyboardShortcut.js +338 -88
  8. package/build/BMWindow/BMPopover/BMPopover.js +52 -11
  9. package/build/BMWindow/BMWindow.js +32 -6
  10. package/build/Core/BMCoreUI.js +20 -8
  11. package/build/images/AlignBottom.png +0 -0
  12. package/build/images/AlignCenterX.png +0 -0
  13. package/build/images/AlignCenterY.png +0 -0
  14. package/build/images/AlignLeading.png +0 -0
  15. package/build/images/AlignTop.png +0 -0
  16. package/build/images/AlignTrailing.png +0 -0
  17. package/build/images/AllConstraints.png +0 -0
  18. package/build/images/BottomConstraint.png +0 -0
  19. package/build/images/CenterXConstraint.png +0 -0
  20. package/build/images/CenterYConstraint.png +0 -0
  21. package/build/images/CoreUI2.png +0 -0
  22. package/build/images/CoreUI2@2x.png +0 -0
  23. package/build/images/Desktop.png +0 -0
  24. package/build/images/DesktopMini.png +0 -0
  25. package/build/images/EqualHeight.png +0 -0
  26. package/build/images/EqualHorizontalSpacing.png +0 -0
  27. package/build/images/EqualHorizontalSpacingInSuperview.png +0 -0
  28. package/build/images/EqualVerticalSpacing.png +0 -0
  29. package/build/images/EqualVerticalSpacingInSuperview.png +0 -0
  30. package/build/images/EqualWidth.png +0 -0
  31. package/build/images/HeightConstraint.png +0 -0
  32. package/build/images/InactiveConstraints.png +0 -0
  33. package/build/images/Layout.png +0 -0
  34. package/build/images/LayoutVariables.png +0 -0
  35. package/build/images/LeftConstraint.png +0 -0
  36. package/build/images/OwnConstraints.png +0 -0
  37. package/build/images/Phone.png +0 -0
  38. package/build/images/PhoneLandscape.png +0 -0
  39. package/build/images/PhoneLandscapeMini.png +0 -0
  40. package/build/images/PhoneMini.png +0 -0
  41. package/build/images/PhonePortrait.png +0 -0
  42. package/build/images/PhonePortraitMini.png +0 -0
  43. package/build/images/Properties.png +0 -0
  44. package/build/images/RightConstraint.png +0 -0
  45. package/build/images/SubviewConstraints.png +0 -0
  46. package/build/images/Tablet.png +0 -0
  47. package/build/images/TabletLandscape.png +0 -0
  48. package/build/images/TabletLandscapeMini.png +0 -0
  49. package/build/images/TabletMini.png +0 -0
  50. package/build/images/TabletPortrait.png +0 -0
  51. package/build/images/TabletPortraitMini.png +0 -0
  52. package/build/images/TopConstraint.png +0 -0
  53. package/build/images/WidthConstraint.png +0 -0
  54. package/lib/@types/BMCoreUI.min.d.ts +320 -61
  55. package/lib/BMCoreUI.min.js +3 -1
  56. package/package.json +9 -10
@@ -1,6 +1,27 @@
1
1
  // @ts-check
2
2
 
3
- import { NO } from "../Core/BMCoreUI";
3
+ import { BMHTMLEntity, NO } from "../Core/BMCoreUI";
4
+
5
+ /**
6
+ * A dictionary that contains the mapping between key codes and the character
7
+ * symbols that represent them.
8
+ */
9
+ const _BMKeyboardShortcutCharacterMap = {
10
+ Backquote: '`',
11
+ Minus: '-',
12
+ Equal: '=',
13
+ BracketLeft: '[',
14
+ BracketRight: ']',
15
+ Backslash: '\\',
16
+ Semicolon: ';',
17
+ Quote: '\'',
18
+ Comma: ',',
19
+ Period: '.',
20
+ Slash: '/',
21
+ Enter: BMHTMLEntity.Return,
22
+ Escape: BMHTMLEntity.Escape,
23
+ Backspace: BMHTMLEntity.Delete,
24
+ };
4
25
 
5
26
  // @type BMKeyboardShortcutModifier
6
27
 
@@ -10,44 +31,44 @@ import { NO } from "../Core/BMCoreUI";
10
31
  */
11
32
  export const BMKeyboardShortcutModifier = Object.freeze({ // <enum>
12
33
 
13
- /**
14
- * Represents the command key on macOS and iOS, windows key on Windows and meta key on Linux.
15
- */
16
- Command: {key: 'metaKey', value: 1}, // <enum>
34
+ /**
35
+ * Represents the command key on macOS and iOS, windows key on Windows and meta key on Linux.
36
+ */
37
+ Command: {key: 'metaKey', value: 1}, // <enum>
17
38
 
18
- /**
19
- * Represents the option key on macOS and alt on other systems.
20
- */
21
- Option: {key: 'altKey', value: 2}, // <enum>
39
+ /**
40
+ * Represents the option key on macOS and alt on other systems.
41
+ */
42
+ Option: {key: 'altKey', value: 2}, // <enum>
22
43
 
23
- /**
24
- * Represents the shit key.
25
- */
26
- Shift: {key: 'shiftKey', value: 4}, // <enum>
44
+ /**
45
+ * Represents the shit key.
46
+ */
47
+ Shift: {key: 'shiftKey', value: 4}, // <enum>
27
48
 
28
- /**
29
- * Represents the control key.
30
- */
31
- Control: {key: 'ctrlKey', value: 8}, // <enum>
49
+ /**
50
+ * Represents the control key.
51
+ */
52
+ Control: {key: 'ctrlKey', value: 8}, // <enum>
32
53
 
33
- /**
34
- * Represents the command key on macOS and iOS and control key on other systems.
35
- */
36
- System: {key: 'systemKey', value: (navigator.platform.startsWith('Mac') || /iPhone|iPad|iPod/.test(navigator.platform)) ? 1 : 8}, // <enum>
54
+ /**
55
+ * Represents the command key on macOS and iOS and control key on other systems.
56
+ */
57
+ System: {key: 'systemKey', value: (navigator.platform.startsWith('Mac') || /iPhone|iPad|iPod/.test(navigator.platform)) ? 1 : 8}, // <enum>
37
58
 
38
59
  });
39
60
 
40
61
  // @endtype
41
62
 
42
- // @type BMKeyboardShortcut
63
+ // @type BMKeySequence
43
64
 
44
65
  /**
45
- * A keyboard shortcut object describes the keys that must be pressed for a keyboard shortcut to trigger as
46
- * well as what should happen when that shortcut is triggered.
66
+ * A class whose instances describe sequences of keys on a keyboard that must be
67
+ * pressed for an action to take place.
47
68
  */
48
- export function BMKeyboardShortcut() {} // <constructor>
69
+ export function BMKeySequence() {} // <constructor>
49
70
 
50
- BMKeyboardShortcut.prototype = {
71
+ BMKeySequence.prototype = {
51
72
 
52
73
  /**
53
74
  * The key that should be pressed for this keyboard shortcut.
@@ -58,7 +79,7 @@ BMKeyboardShortcut.prototype = {
58
79
  },
59
80
 
60
81
  /**
61
- * An optional array of keyboard modifiers that must be pressed
82
+ * An array of keyboard modifiers that must be pressed
62
83
  * together with the key in order to trigger the shortcut.
63
84
  */
64
85
  _modifiers: undefined, // <[BMKeyboardShortcutModifier]>
@@ -66,6 +87,196 @@ BMKeyboardShortcut.prototype = {
66
87
  if (this._modifiers) return this._modifiers.slice();
67
88
  },
68
89
 
90
+ /**
91
+ * Designated initializer. Initializes this key sequence with the specified key and optional modifiers.
92
+ * @param key <String> The key that should be pressed for this key sequence.
93
+ * This maps to the `code` property of keyboard events.
94
+ * {
95
+ * @param modifiers <[BMKeyboardShortcutModifier], nullable> Defaults to an empty array. An optional array of modifiers
96
+ * that must be pressed together with the target key.
97
+ * }
98
+ * @return <BMKeySequence> This key sequence.
99
+ */
100
+ initWithKeyCode(key, {modifiers} = {modifiers: []}) {
101
+ this._key = key;
102
+ this._modifiers = modifiers?.slice() ?? [];
103
+
104
+ for (const modifier of this._modifiers) {
105
+ this._modifierBitmap = this._modifierBitmap | modifier.value;
106
+ }
107
+
108
+ return this;
109
+ },
110
+
111
+ /**
112
+ * Initializes this key sequence with the specified keyboard event, using the event's key code
113
+ * and any active modifier keys. If the event includes the control or command keys, these may be converted
114
+ * into a system key modifier based on the current platform.
115
+ * @param event <KeyboardEvent> The keyboard event from which this key sequence should be initialized.
116
+ * @return <BMKeySequence> This key sequence.
117
+ */
118
+ initWithKeyboardEvent(event) {
119
+ const modifiers = [];
120
+ if (event.shiftKey) {
121
+ modifiers.push(BMKeyboardShortcutModifier.Shift);
122
+ }
123
+ if (event.altKey) {
124
+ modifiers.push(BMKeyboardShortcutModifier.Option);
125
+ }
126
+ if (event.metaKey) {
127
+ if (BMKeyboardShortcutModifier.System.value == BMKeyboardShortcutModifier.Command.value) {
128
+ modifiers.push(BMKeyboardShortcutModifier.System);
129
+ }
130
+ else {
131
+ modifiers.push(BMKeyboardShortcutModifier.Command);
132
+ }
133
+ }
134
+ if (event.ctrlKey) {
135
+ if (BMKeyboardShortcutModifier.System.value == BMKeyboardShortcutModifier.Control.value) {
136
+ modifiers.push(BMKeyboardShortcutModifier.System);
137
+ }
138
+ else {
139
+ modifiers.push(BMKeyboardShortcutModifier.Control);
140
+ }
141
+ }
142
+
143
+ return this.initWithKeyCode(event.code, {modifiers});
144
+ },
145
+
146
+ /**
147
+ * A string description of this key sequence, intended to be displayed to end-users.
148
+ * Its format depends on the current platform.
149
+ */
150
+ get HTMLDescription() { // <String>
151
+ let representation = '';
152
+ const code = this.keyCode || '';
153
+
154
+ if (code.startsWith('Key')) {
155
+ // Alphanumeric keys can be extracted from the key code
156
+ representation = code.substring(3);
157
+ }
158
+ else if (code.startsWith('Digit')) {
159
+ // Digit keys can also be extracted from the key code
160
+ representation = code.substring(5);
161
+ }
162
+ else {
163
+ // Otherwise use the character code map, defaulting to showing the code otherwise
164
+ representation = _BMKeyboardShortcutCharacterMap[code] || code;
165
+ }
166
+
167
+ const isAppleSystem = (navigator.platform.startsWith('Mac') || /iPhone|iPad|iPod/.test(navigator.platform));
168
+
169
+ // Add the modifier keys
170
+ if (this.modifiers.includes(BMKeyboardShortcutModifier.System)) {
171
+ if (isAppleSystem) {
172
+ representation = BMHTMLEntity.Command + representation;
173
+ }
174
+ else {
175
+ representation = 'Ctrl + ' + representation;
176
+ }
177
+ }
178
+
179
+ if (this.modifiers.includes(BMKeyboardShortcutModifier.Command)) {
180
+ if (isAppleSystem) {
181
+ representation = BMHTMLEntity.Command + representation;
182
+ }
183
+ else {
184
+ representation = 'Win + ' + representation;
185
+ }
186
+ }
187
+
188
+ if (this.modifiers.includes(BMKeyboardShortcutModifier.Shift)) {
189
+ if (isAppleSystem) {
190
+ representation = BMHTMLEntity.Shift + representation;
191
+ }
192
+ else {
193
+ representation = 'Shift + ' + representation;
194
+ }
195
+ }
196
+
197
+ if (this.modifiers.includes(BMKeyboardShortcutModifier.Option)) {
198
+ if (isAppleSystem) {
199
+ representation = BMHTMLEntity.Option + representation;
200
+ }
201
+ else {
202
+ representation = 'Alt + ' + representation;
203
+ }
204
+ }
205
+
206
+ if (this.modifiers.includes(BMKeyboardShortcutModifier.Control)) {
207
+ if (isAppleSystem) {
208
+ representation = BMHTMLEntity.Control + representation;
209
+ }
210
+ else {
211
+ representation = 'Ctrl + ' + representation;
212
+ }
213
+ }
214
+
215
+ return representation;
216
+ }
217
+ };
218
+
219
+ /**
220
+ * Creates and returns a key sequence initialized with the specified key and optional modifiers.
221
+ * @param key <String> The key that should be pressed for this key sequence.
222
+ * This maps to the `code` property of keyboard events.
223
+ * {
224
+ * @param modifiers <[BMKeyboardShortcutModifier], nullable> Defaults to an empty array. An optional array of modifiers
225
+ * that must be pressed together with the target key.
226
+ * }
227
+ * @return <BMKeySequence> This key sequence.
228
+ */
229
+ BMKeySequence.keySequenceWithKeyCode = function (key, args) {
230
+ return new this().initWithKeyCode(key, args);
231
+ };
232
+
233
+ /**
234
+ * Creates and returns a key sequence initialized with the specified keyboard event, using the event's key code
235
+ * and any active modifier keys. If the event includes the control or command keys, these may be converted
236
+ * into a system key modifier based on the current platform.
237
+ * @param event <KeyboardEvent> The keyboard event from which this key sequence should be initialized.
238
+ * @return <BMKeySequence> This key sequence.
239
+ */
240
+ BMKeySequence.keySequenceWithKeyboardEvent = function (event) {
241
+ return new this().initWithKeyboardEvent(event);
242
+ }
243
+
244
+ // @endtype
245
+
246
+ // @type BMKeyboardShortcut
247
+
248
+ /**
249
+ * A keyboard shortcut object describes the keys that must be pressed for a keyboard shortcut to trigger as
250
+ * well as what should happen when that shortcut is triggered.
251
+ */
252
+ export function BMKeyboardShortcut() {} // <constructor>
253
+
254
+ BMKeyboardShortcut.prototype = {
255
+
256
+ /**
257
+ * The key sequence that should be pressed to trigger this keyboard shortcut.
258
+ */
259
+ _keySequence: undefined, // <BMKeySequence>
260
+ get keySequence() {
261
+ return this._keySequence;
262
+ },
263
+
264
+ /**
265
+ * The key that should be pressed for this keyboard shortcut.
266
+ */
267
+ get keyCode() { // <String>
268
+ return this._keySequence._key;
269
+ },
270
+
271
+ /**
272
+ * An array of keyboard modifiers that must be pressed
273
+ * together with the key in order to trigger the shortcut.
274
+ */
275
+ get modifiers() { // <[BMKeyboardShortcutModifier]>
276
+ if (this._keySequence._modifiers) return this._keySequence._modifiers.slice();
277
+ return [];
278
+ },
279
+
69
280
  /**
70
281
  * A bitmap describing the modifiers that should be active.
71
282
  */
@@ -101,7 +312,38 @@ BMKeyboardShortcut.prototype = {
101
312
  preventsDefault: NO, // <Boolean>
102
313
 
103
314
  /**
104
- * Designated initializer. Initializes this keyboard shortcut with the given key and optional modifiers, as well as
315
+ * Designated Initializer. Initializes this keyboard shortcut with the specified key sequence and the action that the
316
+ * keyboard shortcut should trigger.
317
+ * @param keySequence <BMKeySequence> The key sequence describing the keyboard buttons that
318
+ * should be pressed to trigger this keyboard shortcut.
319
+ * {
320
+ * @param target <AnyObject> The object that will handle this keyboard shortcut action.
321
+ * @param action <String> The name of a method on the target object that will be invoked when this
322
+ * keyboard shortcut is triggered. That method will receive the following arguments:
323
+ *
324
+ * - `event`: {@link KeyboardEvent} The keyboard event that triggered the keyboard shortcut
325
+ * - `{forKeyboardShortcut}`: {@link BMKeyboardShortcut} The associated keyboard shortcut
326
+ * @param preventsDefault <Boolean, nullable> Defaults to `NO`. When set to `YES`, the default action of the event that triggers
327
+ * normally as a result of the key sequence will be prevented.
328
+ * }
329
+ * @return <BMKeyboardShortcut> This keyboard shortcut.
330
+ */
331
+ initWithKeySequence(keySequence, {target, action, preventsDefault} = {}) {
332
+ this._keySequence = keySequence;
333
+
334
+ this._target = target;
335
+ this._action = action;
336
+ this.preventsDefault = preventsDefault || NO;
337
+
338
+ for (const modifier of this.modifiers) {
339
+ this._modifierBitmap = this._modifierBitmap | modifier.value;
340
+ }
341
+
342
+ return this;
343
+ },
344
+
345
+ /**
346
+ * Initializes this keyboard shortcut with the given key and optional modifiers, as well as
105
347
  * the target and action that will handle it.
106
348
  *
107
349
  * In order to be triggered, this keyboard shortcut must be registered with an event handler such as a window
@@ -110,65 +352,44 @@ BMKeyboardShortcut.prototype = {
110
352
  * {
111
353
  * @param modifiers <[BMKeyboardShortcutModifier], nullable> Defaults to an empty array. An optional array of keyboard modifiers that must be active.
112
354
  * for the keyboard shortcut to fire.
113
- * @param target <AnyObject> The object that will handle this keyboard shortcut action.
114
- * @param action <String> The name of a method on the target object that will be invoked when this
115
- * keyboard shortcut is triggered. That method will receive the keyboard event as its single parameter.
116
- * @param preventsDefault <Boolean, nullable> Defaults to `NO`. When set to `YES`, the default action of the event that triggers this keyboard shortcut will be prevented.
355
+ * @param target <AnyObject> The object that will handle this keyboard shortcut action.
356
+ * @param action <String> The name of a method on the target object that will be invoked when this
357
+ * keyboard shortcut is triggered. That method will receive the following arguments:
358
+ *
359
+ * - `event`: {@link KeyboardEvent} The keyboard event that triggered the keyboard shortcut
360
+ * - `{forKeyboardShortcut}`: {@link BMKeyboardShortcut} The associated keyboard shortcut
361
+ * @param preventsDefault <Boolean, nullable> Defaults to `NO`. When set to `YES`, the default action of the event that triggers
362
+ * normally as a result of the key sequence will be prevented.
117
363
  * }
118
364
  * @return <BMKeyboardShortcut> This keyboard shortcut.
119
365
  */
120
366
  initWithKeyCode(key, {modifiers, target, action, preventsDefault} = {modifiers: []}) {
121
- this._key = key;
122
- this._modifiers = modifiers || [];
123
- this._target = target;
124
- this._action = action;
125
- this.preventsDefault = preventsDefault || NO;
367
+ const keySequence = new BMKeySequence().initWithKeyCode(key, {modifiers});
368
+ this._keySequence = keySequence;
126
369
 
127
- for (const modifier of this._modifiers) {
128
- this._modifierBitmap = this._modifierBitmap | modifier.value;
129
- }
130
-
131
- return this;
370
+ return this.initWithKeySequence(keySequence, {target, action, preventsDefault});
132
371
  },
133
372
 
134
373
  /**
135
374
  * Initializes this keyboard shortcut with the given keyboard event. If the event includes the control or command keys, these may be converted
136
375
  * into a system key modifier based on the current platform.
137
- * @param event <KeyboardEvent> The keyboard event from which this keyboard shortcut should be initialized.
376
+ * @param event <KeyboardEvent> The keyboard event from which this keyboard shortcut should be initialized.
138
377
  * {
139
- * @param target <AnyObject> The object that will handle this keyboard shortcut action.
140
- * @param action <String> The name of a method on the target object that will be invoked when this
141
- * keyboard shortcut is triggered. That method will receive the keyboard event as its single parameter.
142
- * @param preventsDefault <Boolean, nullable> Defaults to `NO`. When set to `YES`, the default action of the event that triggers this keyboard shortcut will be prevented.
143
- * }
378
+ * @param target <AnyObject> The object that will handle this keyboard shortcut action.
379
+ * @param action <String> The name of a method on the target object that will be invoked when this
380
+ * keyboard shortcut is triggered. That method will receive the following arguments:
144
381
  *
382
+ * - `event`: {@link KeyboardEvent} The keyboard event that triggered the keyboard shortcut
383
+ * - `{forKeyboardShortcut}`: {@link BMKeyboardShortcut} The associated keyboard shortcut
384
+ * @param preventsDefault <Boolean, nullable> Defaults to `NO`. When set to `YES`, the default action of the event that triggers
385
+ * normally as a result of the key sequence will be prevented.
386
+ * }
387
+ * @return <BMKeyboardShortcut> This keyboard shortcut.
145
388
  */
146
389
  initWithKeyboardEvent(event, {target, action, preventsDefault} = {}) {
147
- const modifiers = [];
148
- if (event.shiftKey) {
149
- modifiers.push(BMKeyboardShortcutModifier.Shift);
150
- }
151
- if (event.altKey) {
152
- modifiers.push(BMKeyboardShortcutModifier.Option);
153
- }
154
- if (event.metaKey) {
155
- if (BMKeyboardShortcutModifier.System.value == BMKeyboardShortcutModifier.Command.value) {
156
- modifiers.push(BMKeyboardShortcutModifier.System);
157
- }
158
- else {
159
- modifiers.push(BMKeyboardShortcutModifier.Command);
160
- }
161
- }
162
- if (event.ctrlKey) {
163
- if (BMKeyboardShortcutModifier.System.value == BMKeyboardShortcutModifier.Control.value) {
164
- modifiers.push(BMKeyboardShortcutModifier.System);
165
- }
166
- else {
167
- modifiers.push(BMKeyboardShortcutModifier.Control);
168
- }
169
- }
390
+ const keySequence = new BMKeySequence().initWithKeyboardEvent(event);
170
391
 
171
- return this.initWithKeyCode(event.code, {modifiers, target, action, preventsDefault});
392
+ return this.initWithKeySequence(keySequence, {target, action, preventsDefault});
172
393
  },
173
394
 
174
395
  /**
@@ -179,7 +400,7 @@ BMKeyboardShortcut.prototype = {
179
400
  * @param targetID <Object ^(String)> A callback that is invoked with the target ID and should return
180
401
  * the target object which will handle the keyboard shortcut.
181
402
  * }
182
- * @returns <Object> This keyboard shortcut.
403
+ * @returns <BMKeyboardShortcut> This keyboard shortcut.
183
404
  */
184
405
  initWithSerializedKeyboardShortcut(shortcut, {targetID: resolver}) {
185
406
  if (shortcut._class != 'BMKeyboardShortcut') {
@@ -188,8 +409,9 @@ BMKeyboardShortcut.prototype = {
188
409
 
189
410
  const target = resolver(shortcut._targetID);
190
411
 
412
+ const modifierValues = Object.values(BMKeyboardShortcutModifier);
191
413
  const modifiers = shortcut._modifiers.map(modifier => {
192
- return Object.values(BMKeyboardShortcutModifier).find(m => m.key == modifier)
414
+ return modifierValues.find(m => m.key == modifier)
193
415
  });
194
416
 
195
417
  return this.initWithKeyCode(shortcut._key, {modifiers, target, action: shortcut._action, preventsDefault: shortcut._preventsDefault});
@@ -205,8 +427,8 @@ BMKeyboardShortcut.prototype = {
205
427
  serializedKeyboardShortcutWithTargetID(ID) {
206
428
  return {
207
429
  _class: `BMKeyboardShortcut`,
208
- _key: this._key,
209
- _modifiers: this._modifiers.map(m => m.key),
430
+ _key: this.keyCode,
431
+ _modifiers: this.modifiers.map(m => m.key),
210
432
  _targetID: ID,
211
433
  _action: this._action,
212
434
  _preventsDefault: this.preventsDefault,
@@ -215,6 +437,27 @@ BMKeyboardShortcut.prototype = {
215
437
 
216
438
  };
217
439
 
440
+ /**
441
+ * Constructs and returns a keyboard shortcut with the specified key sequence and action that will be triggered
442
+ * by the keyboard shortcut.
443
+ * @param keySequence <BMKeySequence> The key sequence describing the keys that should be pressed to
444
+ * trigger this shortcut.s
445
+ * {
446
+ * @param target <AnyObject> The object that will handle this keyboard shortcut action.
447
+ * @param action <String> The name of a method on the target object that will be invoked when this
448
+ * keyboard shortcut is triggered. That method will receive the following arguments:
449
+ *
450
+ * - `event`: {@link KeyboardEvent} The keyboard event that triggered the keyboard shortcut
451
+ * - `{forKeyboardShortcut}`: {@link BMKeyboardShortcut} The associated keyboard shortcut
452
+ * @param preventsDefault <Boolean, nullable> Defaults to `NO`. When set to `YES`, the default action of the event that triggers
453
+ * normally as a result of the key sequence will be prevented.
454
+ * }
455
+ * @return <BMKeyboardShortcut> A keyboard shortcut.
456
+ */
457
+ BMKeyboardShortcut.keyboardShortcutWithKeySequence = function (event, args) {
458
+ return (new BMKeyboardShortcut).initWithKeySequence(event, args);
459
+ };
460
+
218
461
  /**
219
462
  * Constructs and returns a keyboard shortcut with the given key and optional modifiers, as well as
220
463
  * the target and action that will handle it.
@@ -225,10 +468,14 @@ BMKeyboardShortcut.prototype = {
225
468
  * {
226
469
  * @param modifiers <[BMKeyboardShortcutModifier], nullable> Defaults to an empty array. An optional array of keyboard modifiers that must be active.
227
470
  * for the keyboard shortcut to fire.
228
- * @param target <AnyObject> The object that will handle this keyboard shortcut action.
229
- * @param action <String> The name of a method on the target object that will be invoked when this
230
- * keyboard shortcut is triggered. That method will receive the keyboard event as its single parameter.
231
- * @param preventsDefault <Boolean, nullable> Defaults to `NO`. When set to `YES`, the default action of the event that triggers this keyboard shortcut will be prevented.
471
+ * @param target <AnyObject> The object that will handle this keyboard shortcut action.
472
+ * @param action <String> The name of a method on the target object that will be invoked when this
473
+ * keyboard shortcut is triggered. That method will receive the following arguments:
474
+ *
475
+ * - `event`: {@link KeyboardEvent} The keyboard event that triggered the keyboard shortcut
476
+ * - `{forKeyboardShortcut}`: {@link BMKeyboardShortcut} The associated keyboard shortcut
477
+ * @param preventsDefault <Boolean, nullable> Defaults to `NO`. When set to `YES`, the default action of the event that triggers
478
+ * normally as a result of the key sequence will be prevented.
232
479
  * }
233
480
  * @return <BMKeyboardShortcut> A keyboard shortcut.
234
481
  */
@@ -236,18 +483,21 @@ BMKeyboardShortcut.keyboardShortcutWithKeyCode = function (key, args) {
236
483
  return (new BMKeyboardShortcut).initWithKeyCode(key, args);
237
484
  };
238
485
 
239
-
240
486
  /**
241
487
  * Constructs and returns a keyboard shortcut with the given keyboard event. If the event includes the control or command keys, these may be converted
242
488
  * into a system key modifier based on the current platform.
243
- * @param event <KeyboardEvent> The keyboard event from which this keyboard shortcut should be initialized.
489
+ * @param event <KeyboardEvent> The keyboard event from which this keyboard shortcut should be initialized.
244
490
  * {
245
- * @param target <AnyObject> The object that will handle this keyboard shortcut action.
246
- * @param action <String> The name of a method on the target object that will be invoked when this
247
- * keyboard shortcut is triggered. That method will receive the keyboard event as its single parameter.
248
- * @param preventsDefault <Boolean, nullable> Defaults to `NO`. When set to `YES`, the default action of the event that triggers this keyboard shortcut will be prevented.
249
- * }
491
+ * @param target <AnyObject> The object that will handle this keyboard shortcut action.
492
+ * @param action <String> The name of a method on the target object that will be invoked when this
493
+ * keyboard shortcut is triggered. That method will receive the following arguments:
250
494
  *
495
+ * - `event`: {@link KeyboardEvent} The keyboard event that triggered the keyboard shortcut
496
+ * - `{forKeyboardShortcut}`: {@link BMKeyboardShortcut} The associated keyboard shortcut
497
+ * @param preventsDefault <Boolean, nullable> Defaults to `NO`. When set to `YES`, the default action of the event that triggers
498
+ * normally as a result of the key sequence will be prevented.
499
+ * }
500
+ * @return <BMKeyboardShortcut> A keyboard shortcut.
251
501
  */
252
502
  BMKeyboardShortcut.keyboardShortcutWithKeyboardEvent = function (event, args) {
253
503
  return (new BMKeyboardShortcut).initWithKeyboardEvent(event, args);
@@ -261,7 +511,7 @@ BMKeyboardShortcut.keyboardShortcutWithKeyboardEvent = function (event, args) {
261
511
  * @param targetID <Object ^(String)> A callback that is invoked with the target ID and should return
262
512
  * the target object which will handle the keyboard shortcut.
263
513
  * }
264
- * @returns <Object> A keyboard shortcut.
514
+ * @returns <BMKeyboardShortcut, nullable> A keyboard shortcut.
265
515
  */
266
516
  BMKeyboardShortcut.keyboardShortcutWithSerializedKeyboardShortcut = function (shortcut, args) {
267
517
  return (new BMKeyboardShortcut).initWithSerializedKeyboardShortcut(shortcut, args);