vim-web 0.5.0-dev.10 → 0.5.0-dev.11

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/vim-web.js CHANGED
@@ -60906,6 +60906,7 @@ class Vim2 {
60906
60906
  // Color tracking remains unchanged.
60907
60907
  __publicField(this, "_elementColors", /* @__PURE__ */ new Map());
60908
60908
  __publicField(this, "_updatedColors", /* @__PURE__ */ new Set());
60909
+ __publicField(this, "_removedColors", /* @__PURE__ */ new Set());
60909
60910
  // Delayed update flag.
60910
60911
  __publicField(this, "_updateScheduled", false);
60911
60912
  __publicField(this, "_elementCount", 0);
@@ -61071,16 +61072,18 @@ class Vim2 {
61071
61072
  }
61072
61073
  this.applyColor(elements, color);
61073
61074
  }
61074
- applyColor(elements, color) {
61075
- for (let i = 0; i < color.length; i++) {
61076
- const c = color[i];
61075
+ applyColor(elements, colors) {
61076
+ for (let i = 0; i < colors.length; i++) {
61077
+ const color = colors[i];
61077
61078
  const element = elements[i];
61078
- if (c === void 0) {
61079
+ const existingColor = this._elementColors.get(element);
61080
+ if (color === void 0 && existingColor !== void 0) {
61079
61081
  this._elementColors.delete(element);
61080
- } else {
61081
- this._elementColors.set(element, c);
61082
+ this._removedColors.add(element);
61083
+ } else if (color !== existingColor) {
61084
+ this._elementColors.set(element, color);
61085
+ this._updatedColors.add(element);
61082
61086
  }
61083
- this._updatedColors.add(element);
61084
61087
  }
61085
61088
  this.scheduleColorUpdate();
61086
61089
  }
@@ -61100,6 +61103,7 @@ class Vim2 {
61100
61103
  }
61101
61104
  reapplyColors() {
61102
61105
  this._updatedColors.clear();
61106
+ this._removedColors.clear();
61103
61107
  this._elementColors.forEach((c, n) => this._updatedColors.add(n));
61104
61108
  this.scheduleColorUpdate();
61105
61109
  }
@@ -61116,12 +61120,15 @@ class Vim2 {
61116
61120
  this._renderer.notifySceneUpdated();
61117
61121
  }
61118
61122
  async updateRemoteColors() {
61119
- const elements = Array.from(this._updatedColors);
61120
- const colors = elements.map((n) => this._elementColors.get(n));
61123
+ const updatedElement = Array.from(this._updatedColors);
61124
+ const removedElement = Array.from(this._removedColors);
61125
+ const colors = updatedElement.map((n) => this._elementColors.get(n));
61121
61126
  const remoteColors = await this._colors.getColors(colors);
61122
61127
  const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
61123
- this._rpc.RPCSetMaterialOverridesForElements(this._handle, elements, colorIds);
61128
+ this._rpc.RPCClearMaterialOverridesForElements(this._handle, removedElement);
61129
+ this._rpc.RPCSetMaterialOverridesForElements(this._handle, updatedElement, colorIds);
61124
61130
  this._updatedColors.clear();
61131
+ this._removedColors.clear();
61125
61132
  }
61126
61133
  }
61127
61134
  function wait(ms) {