@lvce-editor/source-control-worker 2.13.0 → 2.14.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.
@@ -1048,6 +1048,7 @@ const TargetValue = 'event.target.value';
1048
1048
  const Enter = 3;
1049
1049
 
1050
1050
  const User = 1;
1051
+ const Script = 2;
1051
1052
 
1052
1053
  const CtrlCmd = 1 << 11 >>> 0;
1053
1054
 
@@ -1062,6 +1063,7 @@ const IconThemeWorker = 7009;
1062
1063
 
1063
1064
  const SetCss = 'Viewlet.setCss';
1064
1065
  const SetDom2 = 'Viewlet.setDom2';
1066
+ const SetFocusContext = 'Viewlet.setFocusContext';
1065
1067
  const SetValueByName = 'Viewlet.setValueByName';
1066
1068
 
1067
1069
  const List = 1;
@@ -1284,20 +1286,27 @@ const create2 = (id, uri, x, y, width, height, workspacePath) => {
1284
1286
  history: [],
1285
1287
  viewMode: 1,
1286
1288
  iconDefinitions: [],
1287
- decorationIcons: []
1289
+ decorationIcons: [],
1290
+ focus: 0
1288
1291
  };
1289
1292
  set(id, state, state);
1290
1293
  };
1291
1294
 
1292
- const isEqual$2 = (oldState, newState) => {
1295
+ const isEqual$3 = (oldState, newState) => {
1293
1296
  return oldState.inputBoxHeight === newState.inputBoxHeight;
1294
1297
  };
1295
1298
 
1299
+ const isEqual$2 = (oldState, newState) => {
1300
+ return oldState.focus === newState.focus;
1301
+ };
1302
+
1296
1303
  const isEqual$1 = (oldState, newState) => {
1297
1304
  return oldState.allGroups === newState.allGroups && oldState.deltaY === newState.deltaY && oldState.items === newState.items && oldState.maxLineY === newState.maxLineY && oldState.minLineY === newState.minLineY && oldState.visibleItems === newState.visibleItems;
1298
1305
  };
1299
1306
 
1300
1307
  const RenderItems = 4;
1308
+ const RenderFocus = 6;
1309
+ const RenderFocusContext = 7;
1301
1310
  const RenderValue = 8;
1302
1311
  const RenderCss = 10;
1303
1312
 
@@ -1305,8 +1314,8 @@ const isEqual = (oldState, newState) => {
1305
1314
  return newState.inputSource === User || oldState.inputValue === newState.inputValue;
1306
1315
  };
1307
1316
 
1308
- const modules = [isEqual$1, isEqual, isEqual$2];
1309
- const numbers = [RenderItems, RenderValue, RenderCss];
1317
+ const modules = [isEqual$1, isEqual, isEqual$3, isEqual$2];
1318
+ const numbers = [RenderItems, RenderValue, RenderCss, RenderFocus];
1310
1319
 
1311
1320
  const diff = (oldState, newState) => {
1312
1321
  const diffResult = [];
@@ -2135,8 +2144,12 @@ const handleContextMenu = async (state, button, x, y) => {
2135
2144
  return state;
2136
2145
  };
2137
2146
 
2138
- const handleFocus = async state => {
2139
- return state;
2147
+ const handleInputFocus = async state => {
2148
+ return {
2149
+ ...state,
2150
+ focus: FocusSourceControlInput,
2151
+ inputSource: Script
2152
+ };
2140
2153
  };
2141
2154
 
2142
2155
  const handleInput = async (state, value, inputSource = User) => {
@@ -2157,6 +2170,11 @@ const handleInput = async (state, value, inputSource = User) => {
2157
2170
  };
2158
2171
  };
2159
2172
 
2173
+ const handleInputBlur = async state => {
2174
+ // TODO reset focus
2175
+ return state;
2176
+ };
2177
+
2160
2178
  const handleMessagePort = async port => {
2161
2179
  await PlainMessagePortRpc.create({
2162
2180
  commandMap: {},
@@ -2282,6 +2300,14 @@ const renderCss = (oldState, newState) => {
2282
2300
  return [SetCss, id, css];
2283
2301
  };
2284
2302
 
2303
+ const renderFocusContext = (oldState, newState) => {
2304
+ const {
2305
+ id,
2306
+ focus
2307
+ } = newState;
2308
+ return [SetFocusContext, id, focus];
2309
+ };
2310
+
2285
2311
  const Actions = 'Actions';
2286
2312
  const SourceControlButtons = 'SourceControlButtons';
2287
2313
  const Grow = 'Grow';
@@ -2607,6 +2633,8 @@ const getRenderer = diffType => {
2607
2633
  return renderValue;
2608
2634
  case RenderCss:
2609
2635
  return renderCss;
2636
+ case RenderFocusContext:
2637
+ return renderFocusContext;
2610
2638
  default:
2611
2639
  throw new Error('unknown renderer');
2612
2640
  }
@@ -2776,7 +2804,7 @@ const commandMap = {
2776
2804
  'SourceControl.handleClickAt': wrapCommand(handleClickAt),
2777
2805
  'SourceControl.handleClickSourceControlButtons': wrapCommand(handleClickSourceControlButtons),
2778
2806
  'SourceControl.handleContextMenu': wrapCommand(handleContextMenu),
2779
- 'SourceControl.handleFocus': wrapCommand(handleFocus),
2807
+ 'SourceControl.handleFocus': wrapCommand(handleInputFocus),
2780
2808
  'SourceControl.handleInput': wrapCommand(handleInput),
2781
2809
  'SourceControl.handleMessagePort': handleMessagePort,
2782
2810
  'SourceControl.handleMouseOut': wrapCommand(handleMouseOut),
@@ -2797,7 +2825,8 @@ const commandMap = {
2797
2825
  'SourceControl.terminate': terminate,
2798
2826
  'SourceControl.updateIcons': wrapCommand(updateIcons),
2799
2827
  'SourceControl.viewAsList': wrapCommand(viewAsList),
2800
- 'SourceControl.viewAsTree': wrapCommand(viewAsTree)
2828
+ 'SourceControl.viewAsTree': wrapCommand(viewAsTree),
2829
+ 'SourceControl.handleInputBlur': wrapCommand(handleInputBlur)
2801
2830
  };
2802
2831
 
2803
2832
  const listen = async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/source-control-worker",
3
- "version": "2.13.0",
3
+ "version": "2.14.0",
4
4
  "description": "Source Control Worker",
5
5
  "keywords": [
6
6
  "Lvce Editor"