@lvce-editor/title-bar-worker 2.6.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';
@@ -1146,7 +1142,7 @@ const i18nString = (key, placeholders = emptyObject) => {
1146
1142
  /**
1147
1143
  * @enum {string}
1148
1144
  */
1149
- const UiStrings$2 = {
1145
+ const UiStrings$1 = {
1150
1146
  Copy: 'Copy',
1151
1147
  CopyLineDown: 'Copy Line Down',
1152
1148
  CopyLineUp: 'Copy Line Up',
@@ -1160,40 +1156,40 @@ const UiStrings$2 = {
1160
1156
  ToggleLineComment: 'Toggle Line Comment',
1161
1157
  Undo: 'Undo'};
1162
1158
  const cut = () => {
1163
- return i18nString(UiStrings$2.Cut);
1159
+ return i18nString(UiStrings$1.Cut);
1164
1160
  };
1165
1161
  const copy = () => {
1166
- return i18nString(UiStrings$2.Copy);
1162
+ return i18nString(UiStrings$1.Copy);
1167
1163
  };
1168
1164
  const paste = () => {
1169
- return i18nString(UiStrings$2.Paste);
1165
+ return i18nString(UiStrings$1.Paste);
1170
1166
  };
1171
1167
  const undo = () => {
1172
- return i18nString(UiStrings$2.Undo);
1168
+ return i18nString(UiStrings$1.Undo);
1173
1169
  };
1174
1170
  const redo = () => {
1175
- return i18nString(UiStrings$2.Redo);
1171
+ return i18nString(UiStrings$1.Redo);
1176
1172
  };
1177
1173
  const toggleLineComment = () => {
1178
- return i18nString(UiStrings$2.ToggleLineComment);
1174
+ return i18nString(UiStrings$1.ToggleLineComment);
1179
1175
  };
1180
1176
  const toggleBlockComment = () => {
1181
- return i18nString(UiStrings$2.ToggleBlockComment);
1177
+ return i18nString(UiStrings$1.ToggleBlockComment);
1182
1178
  };
1183
1179
  const selectAll = () => {
1184
- return i18nString(UiStrings$2.SelectAll);
1180
+ return i18nString(UiStrings$1.SelectAll);
1185
1181
  };
1186
1182
  const copyLineUp = () => {
1187
- return i18nString(UiStrings$2.CopyLineUp);
1183
+ return i18nString(UiStrings$1.CopyLineUp);
1188
1184
  };
1189
1185
  const copyLineDown = () => {
1190
- return i18nString(UiStrings$2.CopyLineDown);
1186
+ return i18nString(UiStrings$1.CopyLineDown);
1191
1187
  };
1192
1188
  const moveLineUp = () => {
1193
- return i18nString(UiStrings$2.MoveLineUp);
1189
+ return i18nString(UiStrings$1.MoveLineUp);
1194
1190
  };
1195
1191
  const moveLineDown = () => {
1196
- return i18nString(UiStrings$2.MoveLineDown);
1192
+ return i18nString(UiStrings$1.MoveLineDown);
1197
1193
  };
1198
1194
 
1199
1195
  const Edit$1 = 2;
@@ -1272,7 +1268,7 @@ const MenuEntriesEdit = {
1272
1268
  /**
1273
1269
  * @enum {string}
1274
1270
  */
1275
- const UiStrings$1 = {
1271
+ const UiStrings = {
1276
1272
  NewFile: 'New File',
1277
1273
  NewWindow: 'New Window',
1278
1274
  OpenFile: 'Open File',
@@ -1283,28 +1279,28 @@ const UiStrings$1 = {
1283
1279
  SaveAll: 'Save All'
1284
1280
  };
1285
1281
  const newFile = () => {
1286
- return i18nString(UiStrings$1.NewFile);
1282
+ return i18nString(UiStrings.NewFile);
1287
1283
  };
1288
1284
  const newWindow = () => {
1289
- return i18nString(UiStrings$1.NewWindow);
1285
+ return i18nString(UiStrings.NewWindow);
1290
1286
  };
1291
1287
  const openFile = () => {
1292
- return i18nString(UiStrings$1.OpenFile);
1288
+ return i18nString(UiStrings.OpenFile);
1293
1289
  };
1294
1290
  const openFolder = () => {
1295
- return i18nString(UiStrings$1.OpenFolder);
1291
+ return i18nString(UiStrings.OpenFolder);
1296
1292
  };
1297
1293
  const openRecent = () => {
1298
- return i18nString(UiStrings$1.OpenRecent);
1294
+ return i18nString(UiStrings.OpenRecent);
1299
1295
  };
1300
1296
  const save = () => {
1301
- return i18nString(UiStrings$1.Save);
1297
+ return i18nString(UiStrings.Save);
1302
1298
  };
1303
1299
  const saveAll = () => {
1304
- return i18nString(UiStrings$1.SaveAll);
1300
+ return i18nString(UiStrings.SaveAll);
1305
1301
  };
1306
1302
  const exit = () => {
1307
- return i18nString(UiStrings$1.Exit);
1303
+ return i18nString(UiStrings.Exit);
1308
1304
  };
1309
1305
 
1310
1306
  const Web = 1;
@@ -1388,6 +1384,7 @@ const Help = 'Help';
1388
1384
  const Maximize = 'Maximize';
1389
1385
  const Minimize = 'Minimize';
1390
1386
  const MoreDot = 'More ...';
1387
+ const NewTerminal = 'New Terminal';
1391
1388
  const OpenProcessExplorer = 'Open Process Explorer';
1392
1389
  const Run = 'Run';
1393
1390
  const Selection = 'Selection';
@@ -1963,21 +1960,11 @@ const MenuEntriesSelection = {
1963
1960
  id: id$3
1964
1961
  };
1965
1962
 
1966
- /**
1967
- * @enum {string}
1968
- */
1969
- const UiStrings = {
1970
- NewTerminal: 'New Terminal'
1971
- };
1972
- const newTerminal = () => {
1973
- return i18nString(UiStrings.NewTerminal);
1974
- };
1975
-
1976
1963
  const id$2 = Terminal$1;
1977
1964
  const getMenuEntries$6 = () => {
1978
1965
  return [{
1979
1966
  id: 'newTerminal',
1980
- label: newTerminal(),
1967
+ label: i18nString(NewTerminal),
1981
1968
  flags: None,
1982
1969
  command: 'Layout.togglePanel',
1983
1970
  args: ['Terminal']
@@ -2135,12 +2122,6 @@ const getMenuEntries$1 = (id, platform) => {
2135
2122
  return menu.getMenuEntries(platform);
2136
2123
  };
2137
2124
 
2138
- const getTitleBarButtonsWeb = () => {
2139
- return [];
2140
- };
2141
- const getTitleBarButtonsRemote = () => {
2142
- return [];
2143
- };
2144
2125
  const getTitleBarButtonsElectron = (controlsOverlayEnabled, titleBarStyleCustom) => {
2145
2126
  if (controlsOverlayEnabled) {
2146
2127
  return [];
@@ -2166,6 +2147,15 @@ const getTitleBarButtonsElectron = (controlsOverlayEnabled, titleBarStyleCustom)
2166
2147
  }
2167
2148
  return [];
2168
2149
  };
2150
+
2151
+ const getTitleBarButtonsRemote = () => {
2152
+ return [];
2153
+ };
2154
+
2155
+ const getTitleBarButtonsWeb = () => {
2156
+ return [];
2157
+ };
2158
+
2169
2159
  const getTitleBarButtons = (platform, controlsOverlayEnabled, titleBarStyleCustom) => {
2170
2160
  switch (platform) {
2171
2161
  case Electron:
@@ -2226,12 +2216,11 @@ const createTitleBarButton = button => {
2226
2216
  };
2227
2217
 
2228
2218
  const getTitleBarButtonsVirtualDom = buttons => {
2229
- const dom = [{
2219
+ return [{
2230
2220
  type: Div,
2231
2221
  className: mergeClassNames(Viewlet, TitleBarButtons),
2232
2222
  childCount: buttons.length
2233
2223
  }, ...buttons.flatMap(createTitleBarButton)];
2234
- return dom;
2235
2224
  };
2236
2225
 
2237
2226
  const parentNode = {
@@ -3035,6 +3024,16 @@ const parseKey = rawKey => {
3035
3024
  };
3036
3025
  };
3037
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
+
3038
3037
  const classNameFocused = mergeClassNames(MenuItem, MenuItemFocused);
3039
3038
  const getMenuItemClassName = isFocused => {
3040
3039
  if (isFocused) {
@@ -3059,13 +3058,8 @@ const getMenuItemDefaultDom = menuItem => {
3059
3058
  }, text(label));
3060
3059
  if (key) {
3061
3060
  dom[0].childCount++;
3062
- const parsedKey = parseKey(key);
3063
- const keyBindingsString = getKeyBindingString(parsedKey.key, false, parsedKey.isCtrl, parsedKey.isShift);
3064
- dom.push({
3065
- type: Span,
3066
- className: MenuItemKeyBinding,
3067
- childCount: 1
3068
- }, text(keyBindingsString));
3061
+ const keyDom = getKeyDom(key);
3062
+ dom.push(...keyDom);
3069
3063
  }
3070
3064
  return dom;
3071
3065
  };
@@ -3116,11 +3110,8 @@ const getMenuItemSubMenuDom = menuItem => {
3116
3110
  isExpanded,
3117
3111
  level
3118
3112
  } = menuItem;
3119
- let className = MenuItem;
3120
- className += ' ' + MenuItemSubMenu;
3121
- if (isFocused) {
3122
- className += ' ' + MenuItemFocused;
3123
- }
3113
+ const baseClassName = mergeClassNames(MenuItem, MenuItemSubMenu);
3114
+ const className = isFocused ? mergeClassNames(baseClassName, MenuItemFocused) : baseClassName;
3124
3115
  return [{
3125
3116
  type: Div,
3126
3117
  className,
@@ -3866,6 +3857,7 @@ const commandMap = {
3866
3857
  };
3867
3858
 
3868
3859
  const listen = async () => {
3860
+ registerCommands(commandMap);
3869
3861
  const rpc = await WebWorkerRpcClient.create({
3870
3862
  commandMap: commandMap
3871
3863
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/title-bar-worker",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "description": "Title Bar Worker",
5
5
  "repository": {
6
6
  "type": "git",