@lvce-editor/editor-worker 19.80.0 → 19.80.1

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/diff-sdk.js CHANGED
@@ -27510,6 +27510,20 @@ const applyTabCompletion = (editor, result) => {
27510
27510
  return editorSnippet(editor, result);
27511
27511
  };
27512
27512
 
27513
+ // State and undo history belong in this worker. Rendering reads changes separately.
27514
+ const wrapCommand = (fn, preservesTypingCoalescing = false) => {
27515
+ return wrapCommand$1(fn, preservesTypingCoalescing, false);
27516
+ };
27517
+ const wrapFocusCommand = fn => {
27518
+ return wrapFocusCommand$1(fn, false);
27519
+ };
27520
+ const wrapDeferredCommand = fn => {
27521
+ return wrapDeferredCommand$1(fn, false);
27522
+ };
27523
+ const wrapLatestCommand = fn => {
27524
+ return wrapLatestCommand$1(fn, false);
27525
+ };
27526
+
27513
27527
  const insertTab = editor => {
27514
27528
  return type(editor, getIndentString(editor));
27515
27529
  };
@@ -27556,6 +27570,28 @@ const handleTab = async editor => {
27556
27570
  return insertTab(editor);
27557
27571
  }
27558
27572
  };
27573
+ const createHandleTabCommand = () => {
27574
+ const handleTabFallback = wrapCommand(handleTab);
27575
+ const command = async uid => {
27576
+ // Deferred completion rendering can keep the editor's existing keyboard context.
27577
+ const editor = get$a(uid)?.newState;
27578
+ const widget = editor?.widgets.find(candidate => candidate.id === Completion);
27579
+ if (widget) {
27580
+ const hasItems = await invoke$4('Completions.hasItems', widget.newState.uid);
27581
+ if (!isCurrent$1(editor, get$a(uid)?.newState)) {
27582
+ return;
27583
+ }
27584
+ if (hasItems) {
27585
+ // Selecting a completion calls back into the editor's edit queue.
27586
+ await selectCurrent$1(uid);
27587
+ return;
27588
+ }
27589
+ }
27590
+ await handleTabFallback(uid);
27591
+ };
27592
+ registerStateCommand(command);
27593
+ return command;
27594
+ };
27559
27595
 
27560
27596
  const relaunchWorkers = async () => {
27561
27597
  await dispose();
@@ -28686,20 +28722,6 @@ const updateDebugInfo = async debugId => {
28686
28722
  await RendererWorker.invoke('Editor.rerender', key);
28687
28723
  };
28688
28724
 
28689
- // State and undo history belong in this worker. Rendering reads changes separately.
28690
- const wrapCommand = (fn, preservesTypingCoalescing = false) => {
28691
- return wrapCommand$1(fn, preservesTypingCoalescing, false);
28692
- };
28693
- const wrapFocusCommand = fn => {
28694
- return wrapFocusCommand$1(fn, false);
28695
- };
28696
- const wrapDeferredCommand = fn => {
28697
- return wrapDeferredCommand$1(fn, false);
28698
- };
28699
- const wrapLatestCommand = fn => {
28700
- return wrapLatestCommand$1(fn, false);
28701
- };
28702
-
28703
28725
  const handleMouseDownAndRender = (uid, ...args) => {
28704
28726
  return executeAndRender(commandMap['Editor.handleMouseDown'], uid, args);
28705
28727
  };
@@ -28887,7 +28909,7 @@ const commandMap = {
28887
28909
  'Editor.handleSettingsChanged': wrapCommand(handleSettingsChanged),
28888
28910
  'Editor.handleSingleClick': wrapCommand(handleSingleClick),
28889
28911
  'Editor.handleSourceActionClick': selectItem,
28890
- 'Editor.handleTab': wrapCommand(handleTab),
28912
+ 'Editor.handleTab': createHandleTabCommand(),
28891
28913
  'Editor.handleTouchEnd': wrapCommand(handleTouchEnd),
28892
28914
  'Editor.handleTouchMove': wrapCommand(handleTouchMove),
28893
28915
  'Editor.handleTouchStart': wrapCommand(handleTouchStart),
@@ -27961,6 +27961,20 @@ const applyTabCompletion = (editor, result) => {
27961
27961
  return editorSnippet(editor, result);
27962
27962
  };
27963
27963
 
27964
+ // State and undo history belong in this worker. Rendering reads changes separately.
27965
+ const wrapCommand = (fn, preservesTypingCoalescing = false) => {
27966
+ return wrapCommand$1(fn, preservesTypingCoalescing, false);
27967
+ };
27968
+ const wrapFocusCommand = fn => {
27969
+ return wrapFocusCommand$1(fn, false);
27970
+ };
27971
+ const wrapDeferredCommand = fn => {
27972
+ return wrapDeferredCommand$1(fn, false);
27973
+ };
27974
+ const wrapLatestCommand = fn => {
27975
+ return wrapLatestCommand$1(fn, false);
27976
+ };
27977
+
27964
27978
  const insertTab = editor => {
27965
27979
  return type(editor, getIndentString(editor));
27966
27980
  };
@@ -28007,6 +28021,27 @@ const handleTab = async editor => {
28007
28021
  return insertTab(editor);
28008
28022
  }
28009
28023
  };
28024
+ const createHandleTabCommand = () => {
28025
+ const handleTabFallback = wrapCommand(handleTab);
28026
+ const command = async uid => {
28027
+ // Deferred completion rendering can keep the editor's existing keyboard context.
28028
+ const editor = get$9(uid)?.newState;
28029
+ const widget = editor?.widgets.find(candidate => candidate.id === Completion);
28030
+ if (widget) {
28031
+ const hasItems = await invoke$4('Completions.hasItems', widget.newState.uid);
28032
+ if (!isCurrent$1(editor, get$9(uid)?.newState)) {
28033
+ return;
28034
+ }
28035
+ if (hasItems) {
28036
+ // Selecting a completion calls back into the editor's edit queue.
28037
+ await selectCurrent$1(uid);
28038
+ return;
28039
+ }
28040
+ }
28041
+ await handleTabFallback(uid);
28042
+ };
28043
+ return command;
28044
+ };
28010
28045
 
28011
28046
  const relaunchWorkers = async () => {
28012
28047
  await dispose();
@@ -29137,20 +29172,6 @@ const updateDebugInfo = async debugId => {
29137
29172
  await invoke$e('Editor.rerender', key);
29138
29173
  };
29139
29174
 
29140
- // State and undo history belong in this worker. Rendering reads changes separately.
29141
- const wrapCommand = (fn, preservesTypingCoalescing = false) => {
29142
- return wrapCommand$1(fn, preservesTypingCoalescing, false);
29143
- };
29144
- const wrapFocusCommand = fn => {
29145
- return wrapFocusCommand$1(fn, false);
29146
- };
29147
- const wrapDeferredCommand = fn => {
29148
- return wrapDeferredCommand$1(fn, false);
29149
- };
29150
- const wrapLatestCommand = fn => {
29151
- return wrapLatestCommand$1(fn, false);
29152
- };
29153
-
29154
29175
  const handleMouseDownAndRender = (uid, ...args) => {
29155
29176
  return executeAndRender(commandMap['Editor.handleMouseDown'], uid, args);
29156
29177
  };
@@ -29335,7 +29356,7 @@ const commandMap = {
29335
29356
  'Editor.handleSettingsChanged': wrapCommand(handleSettingsChanged),
29336
29357
  'Editor.handleSingleClick': wrapCommand(handleSingleClick),
29337
29358
  'Editor.handleSourceActionClick': selectItem,
29338
- 'Editor.handleTab': wrapCommand(handleTab),
29359
+ 'Editor.handleTab': createHandleTabCommand(),
29339
29360
  'Editor.handleTouchEnd': wrapCommand(handleTouchEnd),
29340
29361
  'Editor.handleTouchMove': wrapCommand(handleTouchMove),
29341
29362
  'Editor.handleTouchStart': wrapCommand(handleTouchStart),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.80.0",
3
+ "version": "19.80.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"