@lvce-editor/editor-worker 19.33.0 → 19.34.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.
@@ -3482,6 +3482,7 @@ const getUrlAtOffset = (editor, offset) => {
3482
3482
  };
3483
3483
 
3484
3484
  const EditorChange = 1;
3485
+ const EditorSelection$1 = 2;
3485
3486
 
3486
3487
  const state$9 = Object.create(null);
3487
3488
 
@@ -5064,6 +5065,36 @@ const dispose$2 = uid => {
5064
5065
  pendingSaves.delete(uid);
5065
5066
  };
5066
5067
 
5068
+ const getEditorStatus = editor => {
5069
+ const primarySelectionIndex = editor.primarySelectionIndex || 0;
5070
+ const rowIndex = editor.selections[primarySelectionIndex + 2] || 0;
5071
+ const columnIndex = editor.selections[primarySelectionIndex + 3] || 0;
5072
+ return {
5073
+ column: columnIndex + 1,
5074
+ encoding: 'utf8',
5075
+ languageId: editor.languageId,
5076
+ line: rowIndex + 1,
5077
+ tabSize: editor.tabSize
5078
+ };
5079
+ };
5080
+
5081
+ const equals = (oldStatus, newStatus) => {
5082
+ return oldStatus.column === newStatus.column && oldStatus.encoding === newStatus.encoding && oldStatus.languageId === newStatus.languageId && oldStatus.line === newStatus.line && oldStatus.tabSize === newStatus.tabSize;
5083
+ };
5084
+ const notifyEditorStatusChange = async (oldEditor, newEditor) => {
5085
+ if (newEditor.initial || !newEditor.focused) {
5086
+ return;
5087
+ }
5088
+ const newStatus = getEditorStatus(newEditor);
5089
+ if (!oldEditor.initial && oldEditor.focused && equals(getEditorStatus(oldEditor), newStatus)) {
5090
+ return;
5091
+ }
5092
+ await notifyListeners(EditorSelection$1, 'StatusBar.handleEditorStatusChanged', newStatus);
5093
+ };
5094
+ const notifyEditorStatusCleared = async () => {
5095
+ await notifyListeners(EditorSelection$1, 'StatusBar.handleEditorStatusChanged', undefined);
5096
+ };
5097
+
5067
5098
  const addWidget$1 = widget => {
5068
5099
  const module = get$7(widget.id);
5069
5100
  if (!module) {
@@ -5157,6 +5188,9 @@ const disposeEditor = async editorUid => {
5157
5188
  dispose$1(editorUid);
5158
5189
  dispose$2(editorUid);
5159
5190
  dispose$3(editorUid);
5191
+ if (getKeys$2().length === 0) {
5192
+ await notifyEditorStatusCleared();
5193
+ }
5160
5194
  return commands;
5161
5195
  };
5162
5196
 
@@ -14043,7 +14077,7 @@ const renderCss = {
14043
14077
  };
14044
14078
  const renderFocus$1 = {
14045
14079
  apply: (oldState, newState) => [/* method */'setFocused', newState.focused],
14046
- isEqual: (oldState, newState) => oldState.focused === newState.focused
14080
+ isEqual: isEqual$2
14047
14081
  };
14048
14082
  const renderFocusContext = {
14049
14083
  apply: (oldState, newState) => [SetFocusContext$1, newState.uid, newState.focus, 0, newState.uid, 'Editor'],
@@ -14468,6 +14502,7 @@ const wrapCommand = (fn, preservesTypingCoalescing = false) => async (uid, ...ar
14468
14502
  }
14469
14503
  set$8(uid, state, finalEditor);
14470
14504
  }
14505
+ await notifyEditorStatusChange(state, finalEditor);
14471
14506
  if (!initial && uri === finalEditor.uri && (lines !== finalEditor.lines || modified !== finalEditor.modified || redoStack !== finalEditor.redoStack || undoStack !== finalEditor.undoStack)) {
14472
14507
  for (const key of getKeys$2()) {
14473
14508
  const otherUid = Number(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/editor-worker",
3
- "version": "19.33.0",
3
+ "version": "19.34.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git@github.com:lvce-editor/editor-worker.git"