vim-web 0.3.42-dev.4 → 0.3.42-dev.6
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/types/core-viewers/ultra/viewer/socketClient.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/viewer.d.ts +1 -1
- package/dist/vim-web.iife.js +24 -43
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +30 -49
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
package/dist/vim-web.js
CHANGED
|
@@ -49947,7 +49947,7 @@ async function loadFromVim(bfast2, settings2, onProgress) {
|
|
|
49947
49947
|
}
|
|
49948
49948
|
return vim;
|
|
49949
49949
|
}
|
|
49950
|
-
let DeferredPromise$
|
|
49950
|
+
let DeferredPromise$1 = class DeferredPromise extends Promise {
|
|
49951
49951
|
constructor(executor = () => {
|
|
49952
49952
|
}) {
|
|
49953
49953
|
var _a2;
|
|
@@ -50010,8 +50010,8 @@ class VimRequest {
|
|
|
50010
50010
|
__publicField(this, "_error");
|
|
50011
50011
|
// Promises to await progress updates and completion
|
|
50012
50012
|
__publicField(this, "_progress", { loaded: 0, total: 0, all: /* @__PURE__ */ new Map() });
|
|
50013
|
-
__publicField(this, "_progressPromise", new DeferredPromise$
|
|
50014
|
-
__publicField(this, "_completionPromise", new DeferredPromise$
|
|
50013
|
+
__publicField(this, "_progressPromise", new DeferredPromise$1());
|
|
50014
|
+
__publicField(this, "_completionPromise", new DeferredPromise$1());
|
|
50015
50015
|
this._source = source;
|
|
50016
50016
|
this._settings = settings2;
|
|
50017
50017
|
this.startRequest();
|
|
@@ -50025,7 +50025,7 @@ class VimRequest {
|
|
|
50025
50025
|
const vim = await open(this._bfast, this._settings, (progress) => {
|
|
50026
50026
|
this._progress = progress;
|
|
50027
50027
|
this._progressPromise.resolve(progress);
|
|
50028
|
-
this._progressPromise = new DeferredPromise$
|
|
50028
|
+
this._progressPromise = new DeferredPromise$1();
|
|
50029
50029
|
});
|
|
50030
50030
|
this._vimResult = vim;
|
|
50031
50031
|
} catch (err) {
|
|
@@ -59773,7 +59773,7 @@ class SocketClient {
|
|
|
59773
59773
|
connect(settings2) {
|
|
59774
59774
|
settings2 = {
|
|
59775
59775
|
url: (settings2 == null ? void 0 : settings2.url) ?? DEFAULT_LOCAL_ULTRA_SERVER_URL,
|
|
59776
|
-
retries: (settings2 == null ? void 0 : settings2.retries) ??
|
|
59776
|
+
retries: (settings2 == null ? void 0 : settings2.retries) ?? -1,
|
|
59777
59777
|
timeout: (settings2 == null ? void 0 : settings2.timeout) ?? 5e3,
|
|
59778
59778
|
retryDelay: (settings2 == null ? void 0 : settings2.retryDelay) ?? 5e3
|
|
59779
59779
|
};
|
|
@@ -59787,11 +59787,14 @@ class SocketClient {
|
|
|
59787
59787
|
return this._connectPromise.promise;
|
|
59788
59788
|
} else {
|
|
59789
59789
|
this._clearSocket();
|
|
59790
|
+
this._connectionSettings = void 0;
|
|
59790
59791
|
this._connectPromise.reject("Connection to a different server");
|
|
59791
59792
|
}
|
|
59792
59793
|
}
|
|
59793
|
-
this.
|
|
59794
|
-
|
|
59794
|
+
if (this.url !== url) {
|
|
59795
|
+
this._connectPromise = new ControllablePromise();
|
|
59796
|
+
this._connectionSettings = settings2;
|
|
59797
|
+
}
|
|
59795
59798
|
this.updateState({ status: "connecting" });
|
|
59796
59799
|
try {
|
|
59797
59800
|
this._socket = new WebSocket(url);
|
|
@@ -59826,7 +59829,7 @@ class SocketClient {
|
|
|
59826
59829
|
* Handles the disconnection logic, stopping logging and clearing the socket.
|
|
59827
59830
|
*/
|
|
59828
59831
|
_disconnect(error) {
|
|
59829
|
-
|
|
59832
|
+
this._logger.log("disconnect", error);
|
|
59830
59833
|
clearTimeout(this._reconnectTimeout);
|
|
59831
59834
|
clearTimeout(this._connectionTimeout);
|
|
59832
59835
|
this._streamLogger.stopLogging();
|
|
@@ -59907,25 +59910,28 @@ class SocketClient {
|
|
|
59907
59910
|
this._logger.log("Connected to: ", (_a2 = this._socket) == null ? void 0 : _a2.url);
|
|
59908
59911
|
this.updateState({ status: "connected" });
|
|
59909
59912
|
this._streamLogger.startLoggging();
|
|
59910
|
-
this._connectPromise.resolve();
|
|
59913
|
+
this._connectPromise.resolve(true);
|
|
59911
59914
|
}
|
|
59912
59915
|
/**
|
|
59913
59916
|
* Handler for WebSocket 'close' event.
|
|
59914
59917
|
* @param _event - The event object.
|
|
59915
59918
|
*/
|
|
59916
59919
|
_onClose(_event) {
|
|
59920
|
+
const connecting = this.state.status === "connecting" || this.state.status === "validating";
|
|
59917
59921
|
this._logger.log("WebSocket closed.");
|
|
59918
59922
|
clearTimeout(this._connectionTimeout);
|
|
59919
59923
|
this._disconnect({ status: "error", error: "connection", serverUrl: this.url });
|
|
59920
|
-
if (this._connectionSettings.retries === 0) {
|
|
59924
|
+
if (connecting && this._connectionSettings.retries === 0) {
|
|
59921
59925
|
this._logger.log("No more retries left");
|
|
59922
|
-
this._connectPromise.resolve();
|
|
59926
|
+
this._connectPromise.resolve(false);
|
|
59923
59927
|
return;
|
|
59924
59928
|
}
|
|
59925
59929
|
this._logger.log("Attempting to reconnect in 5 seconds");
|
|
59926
59930
|
this._reconnectTimeout = setTimeout(() => {
|
|
59927
59931
|
this.updateState({ status: "connecting" });
|
|
59928
|
-
|
|
59932
|
+
if (connecting) {
|
|
59933
|
+
this._connectionSettings.retries--;
|
|
59934
|
+
}
|
|
59929
59935
|
this.connect(this._connectionSettings);
|
|
59930
59936
|
}, this._connectionSettings.retryDelay);
|
|
59931
59937
|
}
|
|
@@ -60300,31 +60306,6 @@ class Decoder {
|
|
|
60300
60306
|
this._pendingFrame = frame;
|
|
60301
60307
|
}
|
|
60302
60308
|
}
|
|
60303
|
-
let DeferredPromise$1 = class DeferredPromise2 extends Promise {
|
|
60304
|
-
constructor(executor = () => {
|
|
60305
|
-
}) {
|
|
60306
|
-
var _a2;
|
|
60307
|
-
let resolver;
|
|
60308
|
-
let rejector;
|
|
60309
|
-
super((resolve, reject) => {
|
|
60310
|
-
resolver = resolve;
|
|
60311
|
-
rejector = reject;
|
|
60312
|
-
return executor(resolve, reject);
|
|
60313
|
-
});
|
|
60314
|
-
__publicField(this, "resolve");
|
|
60315
|
-
__publicField(this, "reject");
|
|
60316
|
-
__publicField(this, "initialCallStack");
|
|
60317
|
-
this.resolve = resolver;
|
|
60318
|
-
this.reject = rejector;
|
|
60319
|
-
this.initialCallStack = (_a2 = Error().stack) == null ? void 0 : _a2.split("\n").slice(2).join("\n");
|
|
60320
|
-
}
|
|
60321
|
-
/** @throws error with amended call stack */
|
|
60322
|
-
rejectWithError(error) {
|
|
60323
|
-
var _a2;
|
|
60324
|
-
error.stack = [(_a2 = error.stack) == null ? void 0 : _a2.split("\n")[0], this.initialCallStack].join("\n");
|
|
60325
|
-
this.reject(error);
|
|
60326
|
-
}
|
|
60327
|
-
};
|
|
60328
60309
|
class LoadSuccess {
|
|
60329
60310
|
constructor(vim) {
|
|
60330
60311
|
__publicField(this, "isError", false);
|
|
@@ -60347,8 +60328,8 @@ class LoadError {
|
|
|
60347
60328
|
let LoadRequest$1 = class LoadRequest {
|
|
60348
60329
|
constructor() {
|
|
60349
60330
|
__publicField(this, "_progress", 0);
|
|
60350
|
-
__publicField(this, "_progressPromise", new
|
|
60351
|
-
__publicField(this, "_completionPromise", new
|
|
60331
|
+
__publicField(this, "_progressPromise", new ControllablePromise());
|
|
60332
|
+
__publicField(this, "_completionPromise", new ControllablePromise());
|
|
60352
60333
|
__publicField(this, "_result");
|
|
60353
60334
|
}
|
|
60354
60335
|
get isCompleted() {
|
|
@@ -60361,18 +60342,18 @@ let LoadRequest$1 = class LoadRequest {
|
|
|
60361
60342
|
return;
|
|
60362
60343
|
}
|
|
60363
60344
|
while (this._result === void 0) {
|
|
60364
|
-
await this._progressPromise;
|
|
60345
|
+
await this._progressPromise.promise;
|
|
60365
60346
|
yield this._progress;
|
|
60366
60347
|
}
|
|
60367
60348
|
}
|
|
60368
60349
|
async getResult() {
|
|
60369
|
-
await this._completionPromise;
|
|
60350
|
+
await this._completionPromise.promise;
|
|
60370
60351
|
return this._result;
|
|
60371
60352
|
}
|
|
60372
60353
|
onProgress(progress) {
|
|
60373
60354
|
this._progress = progress;
|
|
60374
60355
|
this._progressPromise.resolve();
|
|
60375
|
-
this._progressPromise = new
|
|
60356
|
+
this._progressPromise = new ControllablePromise();
|
|
60376
60357
|
}
|
|
60377
60358
|
success(vim) {
|
|
60378
60359
|
this._result = new LoadSuccess(vim);
|
|
@@ -61753,7 +61734,7 @@ class Viewer2 {
|
|
|
61753
61734
|
* @returns A promise that resolves when the connection is established.
|
|
61754
61735
|
*/
|
|
61755
61736
|
async connect(settings2) {
|
|
61756
|
-
|
|
61737
|
+
return this._socketClient.connect(settings2);
|
|
61757
61738
|
}
|
|
61758
61739
|
/**
|
|
61759
61740
|
* Disconnects from the current VIM Ultra server.
|
|
@@ -74996,7 +74977,7 @@ const bimInfoData = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
74996
74977
|
__proto__: null,
|
|
74997
74978
|
useBimInfo
|
|
74998
74979
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
74999
|
-
class
|
|
74980
|
+
class DeferredPromise2 extends Promise {
|
|
75000
74981
|
constructor(executor = () => {
|
|
75001
74982
|
}) {
|
|
75002
74983
|
var _a2;
|
|
@@ -75027,9 +75008,9 @@ class LoadRequest2 {
|
|
|
75027
75008
|
__publicField(this, "_callbacks");
|
|
75028
75009
|
__publicField(this, "_request");
|
|
75029
75010
|
__publicField(this, "_progress", { loaded: 0, total: 0, all: /* @__PURE__ */ new Map() });
|
|
75030
|
-
__publicField(this, "_progressPromise", new
|
|
75011
|
+
__publicField(this, "_progressPromise", new DeferredPromise2());
|
|
75031
75012
|
__publicField(this, "_isDone", false);
|
|
75032
|
-
__publicField(this, "_completionPromise", new
|
|
75013
|
+
__publicField(this, "_completionPromise", new DeferredPromise2());
|
|
75033
75014
|
this.source = source;
|
|
75034
75015
|
this._callbacks = callbacks;
|
|
75035
75016
|
this.startRequest(source, settings2);
|
|
@@ -75050,7 +75031,7 @@ class LoadRequest2 {
|
|
|
75050
75031
|
this._callbacks.onProgress(progress);
|
|
75051
75032
|
this._progress = progress;
|
|
75052
75033
|
this._progressPromise.resolve();
|
|
75053
|
-
this._progressPromise = new
|
|
75034
|
+
this._progressPromise = new DeferredPromise2();
|
|
75054
75035
|
}
|
|
75055
75036
|
onSuccess() {
|
|
75056
75037
|
this._callbacks.onDone();
|
|
@@ -75410,7 +75391,7 @@ function setComponentBehind(value) {
|
|
|
75410
75391
|
}
|
|
75411
75392
|
}
|
|
75412
75393
|
function createWebglComponent(container, componentSettings = {}, viewerSettings = {}) {
|
|
75413
|
-
const promise2 = new
|
|
75394
|
+
const promise2 = new DeferredPromise2();
|
|
75414
75395
|
const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
|
|
75415
75396
|
const viewer = new Viewer$1(viewerSettings);
|
|
75416
75397
|
viewer.viewport.reparent(cmpContainer.gfx);
|
|
@@ -75873,7 +75854,7 @@ function getRequestErrorMessage(source, error) {
|
|
|
75873
75854
|
}
|
|
75874
75855
|
}
|
|
75875
75856
|
function createUltraComponent(container) {
|
|
75876
|
-
const promise2 = new
|
|
75857
|
+
const promise2 = new DeferredPromise2();
|
|
75877
75858
|
const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
|
|
75878
75859
|
const viewer = Viewer2.createWithCanvas(cmpContainer.gfx);
|
|
75879
75860
|
const reactRoot = clientExports.createRoot(cmpContainer.ui);
|