vim-web 0.5.0-dev.7 → 0.5.0-dev.8
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
|
@@ -58368,7 +58368,7 @@ class ColorManager {
|
|
|
58368
58368
|
}
|
|
58369
58369
|
/**
|
|
58370
58370
|
* Creates or retrieves cached color instances for multiple hex values.
|
|
58371
|
-
* @param colors - Array of
|
|
58371
|
+
* @param colors - Array of color values or undefined for no color
|
|
58372
58372
|
* @returns Promise resolving to an array of ColorHandles in the same order as input, or undefined if creation fails
|
|
58373
58373
|
* @remarks Duplicate hex values will be mapped to the same color instance for efficiency
|
|
58374
58374
|
*/
|
|
@@ -58378,15 +58378,23 @@ class ColorManager {
|
|
|
58378
58378
|
const toCreate = [];
|
|
58379
58379
|
for (let i = 0; i < colors.length; i++) {
|
|
58380
58380
|
const color = colors[i];
|
|
58381
|
-
|
|
58382
|
-
|
|
58383
|
-
|
|
58384
|
-
}
|
|
58381
|
+
if (color === void 0) {
|
|
58382
|
+
result[i] = void 0;
|
|
58383
|
+
continue;
|
|
58384
|
+
}
|
|
58385
|
+
const hex = (color == null ? void 0 : color.getHex()) ?? -1;
|
|
58386
|
+
const remoteColor = this._hexToColor.get(hex);
|
|
58387
|
+
if (remoteColor) {
|
|
58388
|
+
result[i] = remoteColor;
|
|
58389
|
+
continue;
|
|
58390
|
+
}
|
|
58391
|
+
const indices = hexToIndices.get(hex);
|
|
58392
|
+
if (indices) {
|
|
58385
58393
|
hexToIndices.get(hex).push(i);
|
|
58386
|
-
|
|
58387
|
-
toCreate.push(color);
|
|
58388
|
-
hexToIndices.set(hex, [i]);
|
|
58394
|
+
continue;
|
|
58389
58395
|
}
|
|
58396
|
+
toCreate.push(color);
|
|
58397
|
+
hexToIndices.set(hex, [i]);
|
|
58390
58398
|
}
|
|
58391
58399
|
const remoteColors = await this._createColors(toCreate);
|
|
58392
58400
|
if (!remoteColors) return void 0;
|
|
@@ -61018,22 +61026,22 @@ class Vim2 {
|
|
|
61018
61026
|
const colors = new Array(elementIndex.length).fill(color);
|
|
61019
61027
|
this.applyColor(elementIndex, colors);
|
|
61020
61028
|
}
|
|
61021
|
-
async setColors(
|
|
61022
|
-
if (color.length !==
|
|
61023
|
-
throw new Error("Color and
|
|
61029
|
+
async setColors(elements, color) {
|
|
61030
|
+
if (color.length !== elements.length) {
|
|
61031
|
+
throw new Error("Color and elements length must be equal");
|
|
61024
61032
|
}
|
|
61025
|
-
this.applyColor(
|
|
61033
|
+
this.applyColor(elements, color);
|
|
61026
61034
|
}
|
|
61027
|
-
applyColor(
|
|
61035
|
+
applyColor(elements, color) {
|
|
61028
61036
|
for (let i = 0; i < color.length; i++) {
|
|
61029
61037
|
const c = color[i];
|
|
61030
|
-
const
|
|
61038
|
+
const element = elements[i];
|
|
61031
61039
|
if (c === void 0) {
|
|
61032
|
-
this._elementColors.delete(
|
|
61040
|
+
this._elementColors.delete(element);
|
|
61033
61041
|
} else {
|
|
61034
|
-
this._elementColors.set(
|
|
61042
|
+
this._elementColors.set(element, c);
|
|
61035
61043
|
}
|
|
61036
|
-
this._updatedColors.add(
|
|
61044
|
+
this._updatedColors.add(element);
|
|
61037
61045
|
}
|
|
61038
61046
|
this.scheduleColorUpdate();
|
|
61039
61047
|
}
|
|
@@ -61069,11 +61077,11 @@ class Vim2 {
|
|
|
61069
61077
|
this._renderer.notifySceneUpdated();
|
|
61070
61078
|
}
|
|
61071
61079
|
async updateRemoteColors() {
|
|
61072
|
-
const
|
|
61073
|
-
const colors =
|
|
61080
|
+
const elements = Array.from(this._updatedColors);
|
|
61081
|
+
const colors = elements.map((n) => this._elementColors.get(n));
|
|
61074
61082
|
const remoteColors = await this._colors.getColors(colors);
|
|
61075
61083
|
const colorIds = remoteColors.map((c) => (c == null ? void 0 : c.id) ?? -1);
|
|
61076
|
-
this._rpc.RPCSetMaterialOverridesForElements(this._handle,
|
|
61084
|
+
this._rpc.RPCSetMaterialOverridesForElements(this._handle, elements, colorIds);
|
|
61077
61085
|
this._updatedColors.clear();
|
|
61078
61086
|
}
|
|
61079
61087
|
}
|