@lvce-editor/title-bar-worker 2.7.0 → 2.8.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.
@@ -1031,6 +1031,8 @@ const diff = (oldState, newState) => {
1031
1031
  const {
1032
1032
  get: get$1,
1033
1033
  set: set$3,
1034
+ getCommandIds,
1035
+ registerCommands,
1034
1036
  wrapCommand
1035
1037
  } = create$2();
1036
1038
 
@@ -1042,12 +1044,6 @@ const diff2 = uid => {
1042
1044
  return diff(oldState, newState);
1043
1045
  };
1044
1046
 
1045
- const commandsIds = ['closeMenu', 'handleClickAt', 'focus', 'focusFirst', 'focusIndex', 'focusLast', 'focusNext', 'focusPrevious', 'handleClick', 'handleFocus', 'handleFocusOut', 'handleKeyArrowDown', 'handleKeyArrowLeft', 'handleKeyArrowRight', 'handleKeyArrowUp', 'handleKeyEnd', 'handleKeyEnter', 'handleKeyEscape', 'handleKeyHome', 'handleKeySpace', 'handleMenuClick', 'handleMenuMouseOver', 'handleMouseOut', 'handleMouseOver', 'handlePointerOver', 'handlePointerOut', 'toggleIndex', 'toggleMenu'];
1046
-
1047
- const getCommandIds = () => {
1048
- return commandsIds;
1049
- };
1050
-
1051
1047
  const Menu$1 = 'menu';
1052
1048
  const MenuBar = 'menubar';
1053
1049
  const MenuItem$1 = 'menuitem';
@@ -3028,6 +3024,16 @@ const parseKey = rawKey => {
3028
3024
  };
3029
3025
  };
3030
3026
 
3027
+ const getKeyDom = key => {
3028
+ const parsedKey = parseKey(key);
3029
+ const keyBindingsString = getKeyBindingString(parsedKey.key, false, parsedKey.isCtrl, parsedKey.isShift);
3030
+ return [{
3031
+ type: Span,
3032
+ className: MenuItemKeyBinding,
3033
+ childCount: 1
3034
+ }, text(keyBindingsString)];
3035
+ };
3036
+
3031
3037
  const classNameFocused = mergeClassNames(MenuItem, MenuItemFocused);
3032
3038
  const getMenuItemClassName = isFocused => {
3033
3039
  if (isFocused) {
@@ -3052,13 +3058,8 @@ const getMenuItemDefaultDom = menuItem => {
3052
3058
  }, text(label));
3053
3059
  if (key) {
3054
3060
  dom[0].childCount++;
3055
- const parsedKey = parseKey(key);
3056
- const keyBindingsString = getKeyBindingString(parsedKey.key, false, parsedKey.isCtrl, parsedKey.isShift);
3057
- dom.push({
3058
- type: Span,
3059
- className: MenuItemKeyBinding,
3060
- childCount: 1
3061
- }, text(keyBindingsString));
3061
+ const keyDom = getKeyDom(key);
3062
+ dom.push(...keyDom);
3062
3063
  }
3063
3064
  return dom;
3064
3065
  };
@@ -3109,11 +3110,8 @@ const getMenuItemSubMenuDom = menuItem => {
3109
3110
  isExpanded,
3110
3111
  level
3111
3112
  } = menuItem;
3112
- let className = MenuItem;
3113
- className += ' ' + MenuItemSubMenu;
3114
- if (isFocused) {
3115
- className += ' ' + MenuItemFocused;
3116
- }
3113
+ const baseClassName = mergeClassNames(MenuItem, MenuItemSubMenu);
3114
+ const className = isFocused ? mergeClassNames(baseClassName, MenuItemFocused) : baseClassName;
3117
3115
  return [{
3118
3116
  type: Div,
3119
3117
  className,
@@ -3859,6 +3857,7 @@ const commandMap = {
3859
3857
  };
3860
3858
 
3861
3859
  const listen = async () => {
3860
+ registerCommands(commandMap);
3862
3861
  const rpc = await WebWorkerRpcClient.create({
3863
3862
  commandMap: commandMap
3864
3863
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "2.7.0",
3
+ "version": "2.8.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",