vim-web 0.3.41 → 0.3.42-dev.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.
package/dist/vim-web.js CHANGED
@@ -59704,6 +59704,7 @@ const promise = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
59704
59704
  ControllablePromise,
59705
59705
  ResolvedPromise
59706
59706
  }, Symbol.toStringTag, { value: "Module" }));
59707
+ const DEFAULT_LOCAL_ULTRA_SERVER_URL = "ws://localhost:8123";
59707
59708
  class SocketClient {
59708
59709
  /**
59709
59710
  * Constructs a new Messenger instance.
@@ -59718,6 +59719,7 @@ class SocketClient {
59718
59719
  __publicField(this, "_rpcCallId", 0);
59719
59720
  __publicField(this, "_reconnectTimeout");
59720
59721
  __publicField(this, "_connectionTimeout");
59722
+ __publicField(this, "_attempts", -1);
59721
59723
  __publicField(this, "_validateConnection");
59722
59724
  /**
59723
59725
  * Callback function to handle incoming video frames.
@@ -59768,7 +59770,12 @@ class SocketClient {
59768
59770
  * @param url - The WebSocket URL to connect to.
59769
59771
  * @returns A promise that resolves when the connection is established.
59770
59772
  */
59771
- connect(url) {
59773
+ connect(settings2) {
59774
+ settings2 = {
59775
+ url: (settings2 == null ? void 0 : settings2.url) ?? DEFAULT_LOCAL_ULTRA_SERVER_URL,
59776
+ attempts: (settings2 == null ? void 0 : settings2.attempts) ?? 0
59777
+ };
59778
+ const url = settings2.url;
59772
59779
  if (!isWebSocketUrl(url)) {
59773
59780
  this._disconnect({ status: "error", error: "connection", serverUrl: url });
59774
59781
  return Promise.reject(new Error(`Invalid WebSocket URL: ${url}`));
@@ -59910,11 +59917,16 @@ class SocketClient {
59910
59917
  clearTimeout(this._connectionTimeout);
59911
59918
  this._disconnect({ status: "error", error: "connection", serverUrl: this._connectingUrl });
59912
59919
  this._logger.log("WebSocket closed.");
59913
- this._logger.log("Attempting to reconnect in 5 seconds");
59914
- this._reconnectTimeout = setTimeout(() => {
59915
- this.updateState({ status: "connecting" });
59916
- this.connect(this._connectingUrl);
59917
- }, 5e3);
59920
+ if (this._attempts != 0) {
59921
+ this._logger.log("Attempting to reconnect in 5 seconds");
59922
+ this._reconnectTimeout = setTimeout(() => {
59923
+ this.updateState({ status: "connecting" });
59924
+ this.connect({
59925
+ url: this._connectingUrl,
59926
+ attempts: this._attempts - 1
59927
+ });
59928
+ }, 5e3);
59929
+ }
59918
59930
  }
59919
59931
  /**
59920
59932
  * Sends binary data over the WebSocket connection.
@@ -61567,7 +61579,6 @@ class Renderer2 {
61567
61579
  }
61568
61580
  }
61569
61581
  }
61570
- const DEFAULT_LOCAL_ULTRA_SERVER_URL = "ws://localhost:8123";
61571
61582
  const INVALID_HANDLE = 4294967295;
61572
61583
  class Viewer2 {
61573
61584
  /**
@@ -61740,8 +61751,8 @@ class Viewer2 {
61740
61751
  * @param url - The server URL to connect to. Defaults to 'ws://localhost:8123'.
61741
61752
  * @returns A promise that resolves when the connection is established.
61742
61753
  */
61743
- async connect(url = DEFAULT_LOCAL_ULTRA_SERVER_URL) {
61744
- await this._socketClient.connect(url);
61754
+ async connect(settings2) {
61755
+ await this._socketClient.connect(settings2);
61745
61756
  }
61746
61757
  /**
61747
61758
  * Disconnects from the current VIM Ultra server.
@@ -61804,7 +61815,6 @@ const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
61804
61815
  __proto__: null,
61805
61816
  Box3: Box32,
61806
61817
  ColorHandle,
61807
- DEFAULT_LOCAL_ULTRA_SERVER_URL,
61808
61818
  INVALID_HANDLE,
61809
61819
  Matrix44: Matrix4,
61810
61820
  RGB,
@@ -75712,7 +75722,7 @@ function body$4(url, server, authToken) {
75712
75722
  dotList([
75713
75723
  server ? bullet("VIM ULTRA Server:", server) : null,
75714
75724
  bullet("File URL:", url),
75715
- authToken ? bullet("Auth Token:", authToken) : null``
75725
+ authToken ? bullet("Auth Token:", authToken) : null
75716
75726
  ]),
75717
75727
  subTitle("Troubleshooting tips:"),
75718
75728
  numList([