@lvce-editor/editor-worker 4.2.0 → 4.3.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.
@@ -2263,7 +2263,7 @@ const Completion = 'completion';
2263
2263
  const CompletionDetail$1 = 'completionDetail';
2264
2264
  const Find = 'find';
2265
2265
  const Hover = 'hover';
2266
- const Rename$1 = 'rename';
2266
+ const Rename = 'rename';
2267
2267
  const SourceAction = 'sourceAction';
2268
2268
 
2269
2269
  const isCompletionWidget = widget => {
@@ -2304,7 +2304,7 @@ const closeFind = editor => {
2304
2304
 
2305
2305
  // TODO duplicate code
2306
2306
  const isRenameWidget = widget => {
2307
- return widget.id === Rename$1;
2307
+ return widget.id === Rename;
2308
2308
  };
2309
2309
  const closeRename = editor => {
2310
2310
  const {
@@ -2425,20 +2425,19 @@ const create$6 = () => {
2425
2425
  };
2426
2426
 
2427
2427
  const ColorPicker$1 = 41;
2428
- const FindWidget = 16;
2429
- const EditorCompletion = 9;
2430
2428
  const CompletionDetail = 999;
2429
+ const EditorCompletion = 9;
2431
2430
  const Empty = 0;
2432
- const FocusFindWidgetToggleReplace = 42;
2433
- const FocusFindWidgetReplace = 43;
2434
- const FocusFindWidgetReplaceButton = 46;
2435
- const FocusFindWidgetReplaceAllButton = 47;
2431
+ const FindWidget = 16;
2432
+ const FocusEditorHover = 51;
2436
2433
  const FocusFindWidgetCloseButton = 48;
2437
2434
  const FocusFindWidgetNextMatchButton = 49;
2438
2435
  const FocusFindWidgetPreviousMatchButton = 50;
2439
- const FocusEditorHover = 51;
2436
+ const FocusFindWidgetReplace = 43;
2437
+ const FocusFindWidgetReplaceAllButton = 47;
2438
+ const FocusFindWidgetReplaceButton = 46;
2439
+ const FocusFindWidgetToggleReplace = 42;
2440
2440
  const SourceActions = 38;
2441
- const Rename = 999;
2442
2441
 
2443
2442
  const newStateGenerator$1 = state => {
2444
2443
  return loadContent$3(state);
@@ -5478,7 +5477,7 @@ const getRenamePosition = editor => {
5478
5477
  const create$3 = () => {
5479
5478
  const completionUid = create$7();
5480
5479
  const renameWidget = {
5481
- id: Rename$1,
5480
+ id: Rename,
5482
5481
  oldState: {
5483
5482
  uid: completionUid,
5484
5483
  focusedIndex: -1,
@@ -5495,7 +5494,7 @@ const create$3 = () => {
5495
5494
  focusedIndex: -1,
5496
5495
  oldValue: '',
5497
5496
  newValue: '',
5498
- focused: false,
5497
+ focused: true,
5499
5498
  x: 0,
5500
5499
  y: 0,
5501
5500
  width: 0,
@@ -5536,7 +5535,7 @@ const openRename = async editor => {
5536
5535
  return latestState;
5537
5536
  };
5538
5537
  const fullFocus = true;
5539
- return addWidgetToEditor(Rename$1, Rename, editor, create$3, newStateGenerator, fullFocus);
5538
+ return addWidgetToEditor(Rename, undefined, editor, create$3, newStateGenerator, fullFocus);
5540
5539
  };
5541
5540
 
5542
5541
  const organizeImports = async editor => {
@@ -8927,7 +8926,7 @@ const renderScrollBarX = {
8927
8926
  return [/* method */'setScrollBarHorizontal', /* scrollBarX */scrollBarX, /* scrollBarWidth */scrollBarWidth, /* deltaX */newState.deltaX];
8928
8927
  }
8929
8928
  };
8930
- const renderFocus$1 = {
8929
+ const renderFocus$2 = {
8931
8930
  isEqual(oldState, newState) {
8932
8931
  return oldState.focused === newState.focused;
8933
8932
  },
@@ -9025,7 +9024,7 @@ const renderWidgets = {
9025
9024
  },
9026
9025
  multiple: true
9027
9026
  };
9028
- const render$d = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$1, renderDecorations, renderGutterInfo, renderWidgets];
9027
+ const render$d = [renderLines, renderSelections, renderScrollBarX, renderScrollBarY, renderFocus$2, renderDecorations, renderGutterInfo, renderWidgets];
9029
9028
  const renderEditor = async id => {
9030
9029
  const instance = get$6(id);
9031
9030
  if (!instance) {
@@ -9808,7 +9807,9 @@ const addWidget = (widget, id, render) => {
9808
9807
  allCommands.push(['Viewlet.createFunctionalRoot', id, uid]);
9809
9808
  allCommands.push(...commands);
9810
9809
  allCommands.push(['Viewlet.send', uid, 'appendWidget']);
9811
- const focusCommandIndex = allCommands.findIndex(command => command[2] === 'focus');
9810
+ const focusCommandIndex = allCommands.findIndex(command => {
9811
+ return command[2] === 'focus' || command[0] === 'Viewlet.focusSelector';
9812
+ });
9812
9813
  // TODO have separate rendering functions, e.g.
9813
9814
  // 1. renderDom
9814
9815
  // 2. renderAriaAnnouncement
@@ -10722,7 +10723,7 @@ const renderBounds$2 = {
10722
10723
  return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
10723
10724
  }
10724
10725
  };
10725
- const renderFocus = {
10726
+ const renderFocus$1 = {
10726
10727
  isEqual(oldState, newState) {
10727
10728
  return oldState.focused === newState.focused && oldState.focus === newState.focus && oldState.focusSource === newState.focusSource;
10728
10729
  },
@@ -10751,7 +10752,7 @@ const renderFocus = {
10751
10752
  // },
10752
10753
  // }
10753
10754
 
10754
- const render$6 = [renderDetails, renderBounds$2, renderValue, renderFocus];
10755
+ const render$6 = [renderDetails, renderBounds$2, renderValue, renderFocus$1];
10755
10756
  const apply = (oldState, newState) => {
10756
10757
  // TODO avoid side effect
10757
10758
  if (oldState.focus !== newState.focus) {
@@ -10857,7 +10858,15 @@ const renderBounds$1 = {
10857
10858
  return [/* method */SetBounds, /* x */x, /* y */y, /* width */width, /* height */height];
10858
10859
  }
10859
10860
  };
10860
- const render$3 = [renderContent, renderBounds$1];
10861
+ const renderFocus = {
10862
+ isEqual(oldState, newState) {
10863
+ return oldState.focused === newState.focused;
10864
+ },
10865
+ apply(oldState, newState) {
10866
+ return [/* method */'Viewlet.focusSelector', newState.uid, '.RenameInputBox'];
10867
+ }
10868
+ };
10869
+ const render$3 = [renderContent, renderBounds$1, renderFocus];
10861
10870
  const renderFull = (oldState, newState) => {
10862
10871
  return renderParts(render$3, oldState, newState);
10863
10872
  };
@@ -10869,6 +10878,8 @@ const render$2 = widget => {
10869
10878
  for (const command of commands) {
10870
10879
  if (command[0] === 'Viewlet.setDom2') {
10871
10880
  wrappedCommands.push(command);
10881
+ } else if (command[0] === 'Viewlet.focusSelector') {
10882
+ wrappedCommands.push(command);
10872
10883
  } else {
10873
10884
  wrappedCommands.push(['Viewlet.send', uid, ...command]);
10874
10885
  }
@@ -11002,7 +11013,7 @@ const registerWidgets = () => {
11002
11013
  set$7(CompletionDetail$1, EditorCompletionDetailWidget);
11003
11014
  set$7(Find, EditorFindWidget);
11004
11015
  set$7(Hover, EditorHoverWidget);
11005
- set$7(Rename$1, EditorRenameWidget);
11016
+ set$7(Rename, EditorRenameWidget);
11006
11017
  set$7(SourceAction, EditorSourceActionWidget);
11007
11018
  };
11008
11019
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "4.2.0",
3
+ "version": "4.3.0",
4
4
  "description": "",
5
5
  "main": "dist/editorWorkerMain.js",
6
6
  "type": "module",