vim-web 0.3.42-dev.3 → 0.3.42-dev.5
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 +5 -4
- package/dist/types/core-viewers/ultra/viewer/viewer.d.ts +1 -1
- package/dist/vim-web.iife.js +35 -55
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +41 -61
- 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) {
|
|
@@ -59719,7 +59719,6 @@ class SocketClient {
|
|
|
59719
59719
|
__publicField(this, "_rpcCallId", 0);
|
|
59720
59720
|
__publicField(this, "_reconnectTimeout");
|
|
59721
59721
|
__publicField(this, "_connectionTimeout");
|
|
59722
|
-
__publicField(this, "_retries", -1);
|
|
59723
59722
|
__publicField(this, "_validateConnection");
|
|
59724
59723
|
/**
|
|
59725
59724
|
* Callback function to handle incoming video frames.
|
|
@@ -59730,7 +59729,7 @@ class SocketClient {
|
|
|
59730
59729
|
__publicField(this, "_state", { status: "disconnected" });
|
|
59731
59730
|
__publicField(this, "_onStatusUpdate", new distExports.SimpleEventDispatcher());
|
|
59732
59731
|
__publicField(this, "_connectPromise", new ResolvedPromise(void 0));
|
|
59733
|
-
__publicField(this, "
|
|
59732
|
+
__publicField(this, "_connectionSettings");
|
|
59734
59733
|
this._logger = logger;
|
|
59735
59734
|
this._rpcCallId = 0;
|
|
59736
59735
|
this._streamLogger = new StreamLogger(logger);
|
|
@@ -59763,7 +59762,8 @@ class SocketClient {
|
|
|
59763
59762
|
* @returns The WebSocket URL as a string, or undefined if not set.
|
|
59764
59763
|
*/
|
|
59765
59764
|
get url() {
|
|
59766
|
-
|
|
59765
|
+
var _a2;
|
|
59766
|
+
return (_a2 = this._connectionSettings) == null ? void 0 : _a2.url;
|
|
59767
59767
|
}
|
|
59768
59768
|
/**
|
|
59769
59769
|
* Connects to a WebSocket server at the specified URL.
|
|
@@ -59773,7 +59773,9 @@ 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
|
+
timeout: (settings2 == null ? void 0 : settings2.timeout) ?? 5e3,
|
|
59778
|
+
retryDelay: (settings2 == null ? void 0 : settings2.retryDelay) ?? 5e3
|
|
59777
59779
|
};
|
|
59778
59780
|
const url = settings2.url;
|
|
59779
59781
|
if (!isWebSocketUrl(url)) {
|
|
@@ -59785,16 +59787,18 @@ class SocketClient {
|
|
|
59785
59787
|
return this._connectPromise.promise;
|
|
59786
59788
|
} else {
|
|
59787
59789
|
this._clearSocket();
|
|
59790
|
+
this._connectionSettings = void 0;
|
|
59788
59791
|
this._connectPromise.reject("Connection to a different server");
|
|
59789
59792
|
}
|
|
59790
59793
|
}
|
|
59791
|
-
this.
|
|
59792
|
-
|
|
59793
|
-
|
|
59794
|
+
if (this.url !== url) {
|
|
59795
|
+
this._connectPromise = new ControllablePromise();
|
|
59796
|
+
this._connectionSettings = settings2;
|
|
59797
|
+
}
|
|
59794
59798
|
this.updateState({ status: "connecting" });
|
|
59795
59799
|
try {
|
|
59796
59800
|
this._socket = new WebSocket(url);
|
|
59797
|
-
this._connectionTimeout = setTimeout(() => this._onClose(),
|
|
59801
|
+
this._connectionTimeout = setTimeout(() => this._onClose(), settings2.timeout);
|
|
59798
59802
|
this._socket.onopen = (e) => {
|
|
59799
59803
|
this._onOpen(e);
|
|
59800
59804
|
};
|
|
@@ -59817,15 +59821,15 @@ class SocketClient {
|
|
|
59817
59821
|
* Disconnects from the current WebSocket server.
|
|
59818
59822
|
*/
|
|
59819
59823
|
disconnect(error) {
|
|
59820
|
-
this._logger.log("Disconnecting from: ", this.
|
|
59821
|
-
this.
|
|
59824
|
+
this._logger.log("Disconnecting from: ", this.url);
|
|
59825
|
+
this._connectionSettings = void 0;
|
|
59822
59826
|
this._disconnect(error);
|
|
59823
59827
|
}
|
|
59824
59828
|
/**
|
|
59825
59829
|
* Handles the disconnection logic, stopping logging and clearing the socket.
|
|
59826
59830
|
*/
|
|
59827
59831
|
_disconnect(error) {
|
|
59828
|
-
|
|
59832
|
+
this._logger.log("disconnect", error);
|
|
59829
59833
|
clearTimeout(this._reconnectTimeout);
|
|
59830
59834
|
clearTimeout(this._connectionTimeout);
|
|
59831
59835
|
this._streamLogger.stopLogging();
|
|
@@ -59906,29 +59910,30 @@ class SocketClient {
|
|
|
59906
59910
|
this._logger.log("Connected to: ", (_a2 = this._socket) == null ? void 0 : _a2.url);
|
|
59907
59911
|
this.updateState({ status: "connected" });
|
|
59908
59912
|
this._streamLogger.startLoggging();
|
|
59909
|
-
this._connectPromise.resolve();
|
|
59913
|
+
this._connectPromise.resolve(true);
|
|
59910
59914
|
}
|
|
59911
59915
|
/**
|
|
59912
59916
|
* Handler for WebSocket 'close' event.
|
|
59913
59917
|
* @param _event - The event object.
|
|
59914
59918
|
*/
|
|
59915
59919
|
_onClose(_event) {
|
|
59920
|
+
const connecting = this.state.status === "connecting" || this.state.status === "validating";
|
|
59916
59921
|
this._logger.log("WebSocket closed.");
|
|
59917
59922
|
clearTimeout(this._connectionTimeout);
|
|
59918
|
-
this._disconnect({ status: "error", error: "connection", serverUrl: this.
|
|
59919
|
-
if (this.
|
|
59923
|
+
this._disconnect({ status: "error", error: "connection", serverUrl: this.url });
|
|
59924
|
+
if (connecting && this._connectionSettings.retries === 0) {
|
|
59920
59925
|
this._logger.log("No more retries left");
|
|
59921
|
-
this._connectPromise.resolve();
|
|
59926
|
+
this._connectPromise.resolve(false);
|
|
59922
59927
|
return;
|
|
59923
59928
|
}
|
|
59924
59929
|
this._logger.log("Attempting to reconnect in 5 seconds");
|
|
59925
59930
|
this._reconnectTimeout = setTimeout(() => {
|
|
59926
59931
|
this.updateState({ status: "connecting" });
|
|
59927
|
-
|
|
59928
|
-
|
|
59929
|
-
|
|
59930
|
-
|
|
59931
|
-
},
|
|
59932
|
+
if (connecting) {
|
|
59933
|
+
this._connectionSettings.retries--;
|
|
59934
|
+
}
|
|
59935
|
+
this.connect(this._connectionSettings);
|
|
59936
|
+
}, this._connectionSettings.retryDelay);
|
|
59932
59937
|
}
|
|
59933
59938
|
/**
|
|
59934
59939
|
* Sends binary data over the WebSocket connection.
|
|
@@ -60301,31 +60306,6 @@ class Decoder {
|
|
|
60301
60306
|
this._pendingFrame = frame;
|
|
60302
60307
|
}
|
|
60303
60308
|
}
|
|
60304
|
-
let DeferredPromise$1 = class DeferredPromise2 extends Promise {
|
|
60305
|
-
constructor(executor = () => {
|
|
60306
|
-
}) {
|
|
60307
|
-
var _a2;
|
|
60308
|
-
let resolver;
|
|
60309
|
-
let rejector;
|
|
60310
|
-
super((resolve, reject) => {
|
|
60311
|
-
resolver = resolve;
|
|
60312
|
-
rejector = reject;
|
|
60313
|
-
return executor(resolve, reject);
|
|
60314
|
-
});
|
|
60315
|
-
__publicField(this, "resolve");
|
|
60316
|
-
__publicField(this, "reject");
|
|
60317
|
-
__publicField(this, "initialCallStack");
|
|
60318
|
-
this.resolve = resolver;
|
|
60319
|
-
this.reject = rejector;
|
|
60320
|
-
this.initialCallStack = (_a2 = Error().stack) == null ? void 0 : _a2.split("\n").slice(2).join("\n");
|
|
60321
|
-
}
|
|
60322
|
-
/** @throws error with amended call stack */
|
|
60323
|
-
rejectWithError(error) {
|
|
60324
|
-
var _a2;
|
|
60325
|
-
error.stack = [(_a2 = error.stack) == null ? void 0 : _a2.split("\n")[0], this.initialCallStack].join("\n");
|
|
60326
|
-
this.reject(error);
|
|
60327
|
-
}
|
|
60328
|
-
};
|
|
60329
60309
|
class LoadSuccess {
|
|
60330
60310
|
constructor(vim) {
|
|
60331
60311
|
__publicField(this, "isError", false);
|
|
@@ -60348,8 +60328,8 @@ class LoadError {
|
|
|
60348
60328
|
let LoadRequest$1 = class LoadRequest {
|
|
60349
60329
|
constructor() {
|
|
60350
60330
|
__publicField(this, "_progress", 0);
|
|
60351
|
-
__publicField(this, "_progressPromise", new
|
|
60352
|
-
__publicField(this, "_completionPromise", new
|
|
60331
|
+
__publicField(this, "_progressPromise", new ControllablePromise());
|
|
60332
|
+
__publicField(this, "_completionPromise", new ControllablePromise());
|
|
60353
60333
|
__publicField(this, "_result");
|
|
60354
60334
|
}
|
|
60355
60335
|
get isCompleted() {
|
|
@@ -60362,18 +60342,18 @@ let LoadRequest$1 = class LoadRequest {
|
|
|
60362
60342
|
return;
|
|
60363
60343
|
}
|
|
60364
60344
|
while (this._result === void 0) {
|
|
60365
|
-
await this._progressPromise;
|
|
60345
|
+
await this._progressPromise.promise;
|
|
60366
60346
|
yield this._progress;
|
|
60367
60347
|
}
|
|
60368
60348
|
}
|
|
60369
60349
|
async getResult() {
|
|
60370
|
-
await this._completionPromise;
|
|
60350
|
+
await this._completionPromise.promise;
|
|
60371
60351
|
return this._result;
|
|
60372
60352
|
}
|
|
60373
60353
|
onProgress(progress) {
|
|
60374
60354
|
this._progress = progress;
|
|
60375
60355
|
this._progressPromise.resolve();
|
|
60376
|
-
this._progressPromise = new
|
|
60356
|
+
this._progressPromise = new ControllablePromise();
|
|
60377
60357
|
}
|
|
60378
60358
|
success(vim) {
|
|
60379
60359
|
this._result = new LoadSuccess(vim);
|
|
@@ -61754,7 +61734,7 @@ class Viewer2 {
|
|
|
61754
61734
|
* @returns A promise that resolves when the connection is established.
|
|
61755
61735
|
*/
|
|
61756
61736
|
async connect(settings2) {
|
|
61757
|
-
|
|
61737
|
+
return this._socketClient.connect(settings2);
|
|
61758
61738
|
}
|
|
61759
61739
|
/**
|
|
61760
61740
|
* Disconnects from the current VIM Ultra server.
|
|
@@ -74997,7 +74977,7 @@ const bimInfoData = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineP
|
|
|
74997
74977
|
__proto__: null,
|
|
74998
74978
|
useBimInfo
|
|
74999
74979
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
75000
|
-
class
|
|
74980
|
+
class DeferredPromise2 extends Promise {
|
|
75001
74981
|
constructor(executor = () => {
|
|
75002
74982
|
}) {
|
|
75003
74983
|
var _a2;
|
|
@@ -75028,9 +75008,9 @@ class LoadRequest2 {
|
|
|
75028
75008
|
__publicField(this, "_callbacks");
|
|
75029
75009
|
__publicField(this, "_request");
|
|
75030
75010
|
__publicField(this, "_progress", { loaded: 0, total: 0, all: /* @__PURE__ */ new Map() });
|
|
75031
|
-
__publicField(this, "_progressPromise", new
|
|
75011
|
+
__publicField(this, "_progressPromise", new DeferredPromise2());
|
|
75032
75012
|
__publicField(this, "_isDone", false);
|
|
75033
|
-
__publicField(this, "_completionPromise", new
|
|
75013
|
+
__publicField(this, "_completionPromise", new DeferredPromise2());
|
|
75034
75014
|
this.source = source;
|
|
75035
75015
|
this._callbacks = callbacks;
|
|
75036
75016
|
this.startRequest(source, settings2);
|
|
@@ -75051,7 +75031,7 @@ class LoadRequest2 {
|
|
|
75051
75031
|
this._callbacks.onProgress(progress);
|
|
75052
75032
|
this._progress = progress;
|
|
75053
75033
|
this._progressPromise.resolve();
|
|
75054
|
-
this._progressPromise = new
|
|
75034
|
+
this._progressPromise = new DeferredPromise2();
|
|
75055
75035
|
}
|
|
75056
75036
|
onSuccess() {
|
|
75057
75037
|
this._callbacks.onDone();
|
|
@@ -75411,7 +75391,7 @@ function setComponentBehind(value) {
|
|
|
75411
75391
|
}
|
|
75412
75392
|
}
|
|
75413
75393
|
function createWebglComponent(container, componentSettings = {}, viewerSettings = {}) {
|
|
75414
|
-
const promise2 = new
|
|
75394
|
+
const promise2 = new DeferredPromise2();
|
|
75415
75395
|
const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
|
|
75416
75396
|
const viewer = new Viewer$1(viewerSettings);
|
|
75417
75397
|
viewer.viewport.reparent(cmpContainer.gfx);
|
|
@@ -75874,7 +75854,7 @@ function getRequestErrorMessage(source, error) {
|
|
|
75874
75854
|
}
|
|
75875
75855
|
}
|
|
75876
75856
|
function createUltraComponent(container) {
|
|
75877
|
-
const promise2 = new
|
|
75857
|
+
const promise2 = new DeferredPromise2();
|
|
75878
75858
|
const cmpContainer = container instanceof HTMLElement ? createContainer(container) : container ?? createContainer();
|
|
75879
75859
|
const viewer = Viewer2.createWithCanvas(cmpContainer.gfx);
|
|
75880
75860
|
const reactRoot = clientExports.createRoot(cmpContainer.ui);
|