@lvce-editor/constants 1.25.0 → 1.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/dist/index.d.ts CHANGED
@@ -643,6 +643,12 @@ declare const RestoreFocus = 6;
643
643
  declare const Ignore = 7;
644
644
  declare const Keyboard = -1;
645
645
  declare const LeftClick = 0;
646
+ export interface ParsedKey {
647
+ readonly key: string;
648
+ readonly isCtrl: boolean;
649
+ readonly isShift: boolean;
650
+ }
651
+ declare const parseKey: (rawKey: number) => ParsedKey;
646
652
  declare const SetText = 1;
647
653
  declare const Replace$1 = 2;
648
654
  declare const SetAttribute = 3;
@@ -911,6 +917,9 @@ declare namespace MenuItemFlags {
911
917
  declare namespace MouseEventType {
912
918
  export { Keyboard, LeftClick };
913
919
  }
920
+ declare namespace ParseKey {
921
+ export { parseKey };
922
+ }
914
923
  declare namespace PatchType {
915
924
  export { Add, NavigateChild, NavigateParent, NavigateSibling, Remove$1 as Remove, RemoveAttribute, RemoveChild, Replace$1 as Replace, SetAttribute, SetText };
916
925
  }
@@ -966,6 +975,7 @@ export {
966
975
  MenuEntryId,
967
976
  MenuItemFlags,
968
977
  MouseEventType,
978
+ ParseKey,
969
979
  PatchType,
970
980
  PlatformType,
971
981
  RpcId,
@@ -21,6 +21,7 @@ export * as KeyModifier from "../KeyModifier/KeyModifier.js";
21
21
  export * as MenuEntryId from "../MenuEntryId/MenuEntryId.js";
22
22
  export * as MenuItemFlags from "../MenuItemFlags/MenuItemFlags.js";
23
23
  export * as MouseEventType from "../MouseEventType/MouseEventType.js";
24
+ export * as ParseKey from "../ParseKey/ParseKey.js";
24
25
  export * as PatchType from "../PatchType/PatchType.js";
25
26
  export * as PlatformType from "../PlatformType/PlatformType.js";
26
27
  export * as RpcId from "../RpcId/RpcId.js";
@@ -0,0 +1,13 @@
1
+ import * as GetKeyCodeString from "../GetKeyCodeString/GetKeyCodeString.js";
2
+ import * as KeyModifier from "../KeyModifier/KeyModifier.js";
3
+ export const parseKey = (rawKey) => {
4
+ const isCtrl = Boolean(rawKey & KeyModifier.CtrlCmd);
5
+ const isShift = Boolean(rawKey & KeyModifier.Shift);
6
+ const keyCode = rawKey & 0x00_00_00_ff;
7
+ const key = GetKeyCodeString.getKeyCodeString(keyCode);
8
+ return {
9
+ key,
10
+ isCtrl,
11
+ isShift,
12
+ };
13
+ };
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/constants",
3
- "version": "1.25.0",
3
+ "version": "1.26.0",
4
4
  "description": "Constants",
5
5
  "license": "MIT",
6
6
  "author": "Lvce Editor",