vim-web 0.3.40 → 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/types/core-viewers/ultra/index.d.ts +2 -1
- package/dist/types/core-viewers/ultra/viewer/logger.d.ts +1 -1
- package/dist/types/core-viewers/ultra/viewer/renderer.d.ts +3 -1
- package/dist/types/core-viewers/ultra/viewer/rpcClient.d.ts +1 -0
- package/dist/types/core-viewers/ultra/viewer/rpcSafeClient.d.ts +8 -3
- package/dist/types/core-viewers/ultra/viewer/socketClient.d.ts +7 -1
- package/dist/types/core-viewers/ultra/viewer/viewer.d.ts +5 -6
- package/dist/types/core-viewers/ultra/viewer/viewport.d.ts +3 -1
- package/dist/types/core-viewers/ultra/viewer/vim.d.ts +4 -4
- package/dist/types/core-viewers/webgl/viewer/gizmos/sectionBox/sectionBoxInputs.d.ts +1 -0
- package/dist/types/react-viewers/ultra/errors/serverFileDownloadingError.d.ts +1 -1
- package/dist/types/react-viewers/ultra/errors/ultraErrors.d.ts +1 -1
- package/dist/types/react-viewers/ultra/ultraComponent.d.ts +1 -1
- package/dist/vim-web.iife.js +122 -63
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +122 -63
- package/dist/vim-web.js.map +1 -1
- package/package.json +1 -1
package/dist/vim-web.js
CHANGED
|
@@ -50152,10 +50152,10 @@ const defaultViewerSettings = {
|
|
|
50152
50152
|
background: { color: new Color(12698310) },
|
|
50153
50153
|
skybox: {
|
|
50154
50154
|
enable: true,
|
|
50155
|
-
skyColor: new Color(
|
|
50156
|
-
//
|
|
50157
|
-
groundColor: new Color(
|
|
50158
|
-
//
|
|
50155
|
+
skyColor: new Color(16777215),
|
|
50156
|
+
// white
|
|
50157
|
+
groundColor: new Color(16185078),
|
|
50158
|
+
// less white
|
|
50159
50159
|
sharpness: 2
|
|
50160
50160
|
},
|
|
50161
50161
|
groundPlane: {
|
|
@@ -55220,6 +55220,15 @@ class BoxInputs {
|
|
|
55220
55220
|
this.reg(canvas, "pointerdown", this.onMouseDown.bind(this));
|
|
55221
55221
|
this.reg(canvas, "pointermove", this.onMouseMove.bind(this));
|
|
55222
55222
|
this.reg(canvas, "pointerup", this.onMouseUp.bind(this));
|
|
55223
|
+
this.reg(canvas, "pointerleave", this.onPointerLeave.bind(this));
|
|
55224
|
+
}
|
|
55225
|
+
onPointerLeave(event) {
|
|
55226
|
+
var _a2;
|
|
55227
|
+
if (this.capturedId !== void 0) {
|
|
55228
|
+
return;
|
|
55229
|
+
}
|
|
55230
|
+
this.faceNormal.set(0, 0, 0);
|
|
55231
|
+
(_a2 = this.onFaceEnter) == null ? void 0 : _a2.call(this, this.faceNormal);
|
|
55223
55232
|
}
|
|
55224
55233
|
capturePointer(pointerId) {
|
|
55225
55234
|
this.releasePointer();
|
|
@@ -58111,6 +58120,9 @@ class RpcClient {
|
|
|
58111
58120
|
get url() {
|
|
58112
58121
|
return this._messenger.url;
|
|
58113
58122
|
}
|
|
58123
|
+
get connected() {
|
|
58124
|
+
return this._messenger.state.status === "connected";
|
|
58125
|
+
}
|
|
58114
58126
|
RPCAddNodeFlags(componentHandle, nodes, flags) {
|
|
58115
58127
|
const marshal = new Marshal();
|
|
58116
58128
|
marshal.writeString("RPCAddNodeFlags");
|
|
@@ -58807,6 +58819,9 @@ class RpcSafeClient {
|
|
|
58807
58819
|
get url() {
|
|
58808
58820
|
return this.rpc.url;
|
|
58809
58821
|
}
|
|
58822
|
+
get connected() {
|
|
58823
|
+
return this.rpc.connected;
|
|
58824
|
+
}
|
|
58810
58825
|
/*******************************************************************************
|
|
58811
58826
|
* SCENE MANAGEMENT METHODS
|
|
58812
58827
|
* Methods for managing the overall scene, including initialization, lighting,
|
|
@@ -59143,15 +59158,15 @@ class RpcSafeClient {
|
|
|
59143
59158
|
******************************************************************************/
|
|
59144
59159
|
/**
|
|
59145
59160
|
* Loads a VIM file from the local filesystem.
|
|
59146
|
-
* @param
|
|
59161
|
+
* @param source - The path to the VIM file (supports file:// protocol)
|
|
59147
59162
|
* @returns Promise resolving to the handle of the loaded VIM component
|
|
59148
59163
|
* @throws {Error} If the filename is invalid or empty
|
|
59149
59164
|
*/
|
|
59150
|
-
async RPCLoadVim(
|
|
59151
|
-
if (!Validation.isNonEmptyString(
|
|
59152
|
-
|
|
59165
|
+
async RPCLoadVim(source) {
|
|
59166
|
+
if (!Validation.isNonEmptyString(source.url)) return INVALID_HANDLE;
|
|
59167
|
+
const url = source.url.replace("file:///", "file://");
|
|
59153
59168
|
return await this.safeCall(
|
|
59154
|
-
() => this.rpc.RPCLoadVim(
|
|
59169
|
+
() => this.rpc.RPCLoadVim(url),
|
|
59155
59170
|
INVALID_HANDLE
|
|
59156
59171
|
);
|
|
59157
59172
|
}
|
|
@@ -59161,10 +59176,10 @@ class RpcSafeClient {
|
|
|
59161
59176
|
* @returns Promise resolving to the handle of the loaded VIM component
|
|
59162
59177
|
* @throws {Error} If the URL is invalid
|
|
59163
59178
|
*/
|
|
59164
|
-
async RPCLoadVimURL(
|
|
59165
|
-
if (!Validation.isURL(url)) return INVALID_HANDLE;
|
|
59179
|
+
async RPCLoadVimURL(source) {
|
|
59180
|
+
if (!Validation.isURL(source.url)) return INVALID_HANDLE;
|
|
59166
59181
|
return await this.safeCall(
|
|
59167
|
-
() => this.rpc.RPCLoadVimURL(url, ""),
|
|
59182
|
+
() => this.rpc.RPCLoadVimURL(source.url, source.authToken ?? ""),
|
|
59168
59183
|
INVALID_HANDLE
|
|
59169
59184
|
);
|
|
59170
59185
|
}
|
|
@@ -59548,9 +59563,9 @@ class Inputs extends InputHandler2 {
|
|
|
59548
59563
|
this._inputsMouse = new InputMouse(this._canvas, this._rpc, selection, camera2);
|
|
59549
59564
|
this._inputsTouch = new InputTouch(this._canvas, this._rpc);
|
|
59550
59565
|
this._keyboard = new InputKeyboard(this._rpc, selection, camera2, this);
|
|
59551
|
-
this.register();
|
|
59552
59566
|
}
|
|
59553
59567
|
onConnect() {
|
|
59568
|
+
this.register();
|
|
59554
59569
|
this._rpc.RPCSetMoveSpeed(this._moveSpeed);
|
|
59555
59570
|
}
|
|
59556
59571
|
register() {
|
|
@@ -59689,6 +59704,7 @@ const promise = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
59689
59704
|
ControllablePromise,
|
|
59690
59705
|
ResolvedPromise
|
|
59691
59706
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
59707
|
+
const DEFAULT_LOCAL_ULTRA_SERVER_URL = "ws://localhost:8123";
|
|
59692
59708
|
class SocketClient {
|
|
59693
59709
|
/**
|
|
59694
59710
|
* Constructs a new Messenger instance.
|
|
@@ -59703,6 +59719,7 @@ class SocketClient {
|
|
|
59703
59719
|
__publicField(this, "_rpcCallId", 0);
|
|
59704
59720
|
__publicField(this, "_reconnectTimeout");
|
|
59705
59721
|
__publicField(this, "_connectionTimeout");
|
|
59722
|
+
__publicField(this, "_attempts", -1);
|
|
59706
59723
|
__publicField(this, "_validateConnection");
|
|
59707
59724
|
/**
|
|
59708
59725
|
* Callback function to handle incoming video frames.
|
|
@@ -59753,7 +59770,12 @@ class SocketClient {
|
|
|
59753
59770
|
* @param url - The WebSocket URL to connect to.
|
|
59754
59771
|
* @returns A promise that resolves when the connection is established.
|
|
59755
59772
|
*/
|
|
59756
|
-
connect(
|
|
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;
|
|
59757
59779
|
if (!isWebSocketUrl(url)) {
|
|
59758
59780
|
this._disconnect({ status: "error", error: "connection", serverUrl: url });
|
|
59759
59781
|
return Promise.reject(new Error(`Invalid WebSocket URL: ${url}`));
|
|
@@ -59796,7 +59818,7 @@ class SocketClient {
|
|
|
59796
59818
|
* Disconnects from the current WebSocket server.
|
|
59797
59819
|
*/
|
|
59798
59820
|
disconnect(error) {
|
|
59799
|
-
this._logger.log("Disconnecting from "
|
|
59821
|
+
this._logger.log("Disconnecting from: ", this._connectingUrl);
|
|
59800
59822
|
this._connectingUrl = void 0;
|
|
59801
59823
|
this._disconnect(error);
|
|
59802
59824
|
}
|
|
@@ -59882,7 +59904,7 @@ class SocketClient {
|
|
|
59882
59904
|
this._disconnect(issues);
|
|
59883
59905
|
return;
|
|
59884
59906
|
}
|
|
59885
|
-
this._logger.log("Connected to "
|
|
59907
|
+
this._logger.log("Connected to: ", (_a2 = this._socket) == null ? void 0 : _a2.url);
|
|
59886
59908
|
this.updateState({ status: "connected" });
|
|
59887
59909
|
this._streamLogger.startLoggging();
|
|
59888
59910
|
this._connectPromise.resolve();
|
|
@@ -59895,11 +59917,16 @@ class SocketClient {
|
|
|
59895
59917
|
clearTimeout(this._connectionTimeout);
|
|
59896
59918
|
this._disconnect({ status: "error", error: "connection", serverUrl: this._connectingUrl });
|
|
59897
59919
|
this._logger.log("WebSocket closed.");
|
|
59898
|
-
this.
|
|
59899
|
-
|
|
59900
|
-
this.
|
|
59901
|
-
|
|
59902
|
-
|
|
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
|
+
}
|
|
59903
59930
|
}
|
|
59904
59931
|
/**
|
|
59905
59932
|
* Sends binary data over the WebSocket connection.
|
|
@@ -60195,7 +60222,10 @@ class Decoder {
|
|
|
60195
60222
|
this._logger.error("Error decoding video chunk: ", e);
|
|
60196
60223
|
}
|
|
60197
60224
|
}
|
|
60198
|
-
this._firstDecoded
|
|
60225
|
+
if (!this._firstDecoded) {
|
|
60226
|
+
this._firstDecoded = true;
|
|
60227
|
+
this._logger.log("First frame decoded");
|
|
60228
|
+
}
|
|
60199
60229
|
}
|
|
60200
60230
|
/**
|
|
60201
60231
|
* Clears the decoder state and renderer buffer.
|
|
@@ -60405,16 +60435,16 @@ class Vim2 {
|
|
|
60405
60435
|
if (this._request) {
|
|
60406
60436
|
return this._request;
|
|
60407
60437
|
}
|
|
60408
|
-
this._logger.log("Loading "
|
|
60438
|
+
this._logger.log("Loading: ", this.source);
|
|
60409
60439
|
this._request = new LoadRequest$1();
|
|
60410
60440
|
this._load(this.source, this._request).then(async (request2) => {
|
|
60411
60441
|
const result = await request2.getResult();
|
|
60412
60442
|
if (result.isSuccess) {
|
|
60413
|
-
this._logger.log(
|
|
60443
|
+
this._logger.log("Successfully loaded vim: ", this.source);
|
|
60414
60444
|
this.reapplyNodes();
|
|
60415
60445
|
this.reapplyColors();
|
|
60416
60446
|
} else {
|
|
60417
|
-
this._logger.log(
|
|
60447
|
+
this._logger.log("Failed to load vim: ", this.source);
|
|
60418
60448
|
}
|
|
60419
60449
|
});
|
|
60420
60450
|
return this._request;
|
|
@@ -60447,18 +60477,19 @@ class Vim2 {
|
|
|
60447
60477
|
}
|
|
60448
60478
|
/**
|
|
60449
60479
|
* Requests for the server to load the given URL or file path.
|
|
60450
|
-
* @param
|
|
60480
|
+
* @param source - The URL or file path to load.
|
|
60451
60481
|
* @param result - The load request object to update.
|
|
60452
60482
|
* @returns The updated load request.
|
|
60453
60483
|
*/
|
|
60454
|
-
async _load(
|
|
60455
|
-
const handle = await this._getHandle(
|
|
60484
|
+
async _load(source, result) {
|
|
60485
|
+
const handle = await this._getHandle(source, result);
|
|
60456
60486
|
if (result.isCompleted || handle === INVALID_HANDLE) {
|
|
60457
60487
|
return result;
|
|
60458
60488
|
}
|
|
60459
60489
|
while (true) {
|
|
60460
60490
|
try {
|
|
60461
60491
|
const state = await this._rpc.RPCGetVimLoadingState(handle);
|
|
60492
|
+
this._logger.log("state :", state);
|
|
60462
60493
|
result.onProgress(state.progress);
|
|
60463
60494
|
switch (state.status) {
|
|
60464
60495
|
// Keep waiting for the loading to complete
|
|
@@ -60495,16 +60526,16 @@ class Vim2 {
|
|
|
60495
60526
|
return "unknown";
|
|
60496
60527
|
}
|
|
60497
60528
|
}
|
|
60498
|
-
async _getHandle(
|
|
60529
|
+
async _getHandle(source, result) {
|
|
60499
60530
|
let handle = void 0;
|
|
60500
60531
|
try {
|
|
60501
|
-
if (isURL(url)) {
|
|
60502
|
-
handle = await this._rpc.RPCLoadVimURL(
|
|
60503
|
-
} else if (isFileURI(url)) {
|
|
60504
|
-
handle = await this._rpc.RPCLoadVim(
|
|
60532
|
+
if (isURL(source.url)) {
|
|
60533
|
+
handle = await this._rpc.RPCLoadVimURL(source);
|
|
60534
|
+
} else if (isFileURI(source.url)) {
|
|
60535
|
+
handle = await this._rpc.RPCLoadVim(source);
|
|
60505
60536
|
} else {
|
|
60506
60537
|
console.log("Defaulting to file path");
|
|
60507
|
-
handle = await this._rpc.RPCLoadVim(
|
|
60538
|
+
handle = await this._rpc.RPCLoadVim(source);
|
|
60508
60539
|
}
|
|
60509
60540
|
} catch (e) {
|
|
60510
60541
|
result.error("downloadingError", e.message);
|
|
@@ -60514,6 +60545,7 @@ class Vim2 {
|
|
|
60514
60545
|
result.error("downloadingError");
|
|
60515
60546
|
return INVALID_HANDLE;
|
|
60516
60547
|
}
|
|
60548
|
+
console.log("handle :", handle);
|
|
60517
60549
|
return handle;
|
|
60518
60550
|
}
|
|
60519
60551
|
/**
|
|
@@ -60719,13 +60751,27 @@ function wait(ms) {
|
|
|
60719
60751
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
60720
60752
|
}
|
|
60721
60753
|
const defaultLogger = {
|
|
60722
|
-
log: (message) => {
|
|
60723
|
-
|
|
60754
|
+
log: (message, obj) => {
|
|
60755
|
+
const caller = getCaller();
|
|
60756
|
+
const msg = `VIM Ultra : ${message}`;
|
|
60757
|
+
if (obj) {
|
|
60758
|
+
console.log(msg, obj, { caller });
|
|
60759
|
+
} else {
|
|
60760
|
+
console.log(msg, { caller });
|
|
60761
|
+
}
|
|
60724
60762
|
},
|
|
60725
60763
|
error: (message, e) => {
|
|
60726
|
-
console.error("VIM Ultra
|
|
60764
|
+
console.error("VIM Ultra " + message, e);
|
|
60727
60765
|
}
|
|
60728
60766
|
};
|
|
60767
|
+
function getCaller() {
|
|
60768
|
+
const stack = new Error().stack;
|
|
60769
|
+
if (!stack) return "";
|
|
60770
|
+
const files = stack.split("/");
|
|
60771
|
+
const file = files[files.length - 1];
|
|
60772
|
+
const clean = file.replace(/\?[^:]+/, "");
|
|
60773
|
+
return clean;
|
|
60774
|
+
}
|
|
60729
60775
|
function debounce(func, delay) {
|
|
60730
60776
|
let timeoutId;
|
|
60731
60777
|
return [function(...args) {
|
|
@@ -60743,14 +60789,16 @@ class Viewport2 {
|
|
|
60743
60789
|
* @param canvas - The HTML canvas element to observe and manage
|
|
60744
60790
|
* @param rpc - RPC client for viewport communication
|
|
60745
60791
|
*/
|
|
60746
|
-
constructor(canvas, rpc) {
|
|
60792
|
+
constructor(canvas, rpc, logger) {
|
|
60747
60793
|
/** The HTML canvas element used for rendering */
|
|
60748
60794
|
__publicField(this, "canvas");
|
|
60749
60795
|
__publicField(this, "_rpc");
|
|
60796
|
+
__publicField(this, "_logger");
|
|
60750
60797
|
__publicField(this, "_observer");
|
|
60751
60798
|
__publicField(this, "_clearTimeout");
|
|
60752
60799
|
this.canvas = canvas;
|
|
60753
60800
|
this._rpc = rpc;
|
|
60801
|
+
this._logger = logger;
|
|
60754
60802
|
const [debounced, clear] = debounce(() => this.onResize(), 250);
|
|
60755
60803
|
this._observer = new ResizeObserver(debounced);
|
|
60756
60804
|
this._observer.observe(canvas);
|
|
@@ -60761,14 +60809,16 @@ class Viewport2 {
|
|
|
60761
60809
|
* @private
|
|
60762
60810
|
*/
|
|
60763
60811
|
onResize() {
|
|
60764
|
-
|
|
60812
|
+
this._logger.log("Canvas resized to :", { x: this.canvas.offsetWidth, y: this.canvas.offsetHeight });
|
|
60765
60813
|
this.update();
|
|
60766
60814
|
}
|
|
60767
60815
|
/**
|
|
60768
60816
|
* Updates the aspect ratio of the viewport on the server
|
|
60769
60817
|
*/
|
|
60770
60818
|
update() {
|
|
60771
|
-
this._rpc.
|
|
60819
|
+
if (this._rpc.connected) {
|
|
60820
|
+
this._rpc.RPCSetAspectRatio(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
60821
|
+
}
|
|
60772
60822
|
}
|
|
60773
60823
|
/**
|
|
60774
60824
|
* Cleans up resources by removing resize observer and clearing timeouts
|
|
@@ -61314,14 +61364,16 @@ class Renderer2 {
|
|
|
61314
61364
|
* @param rpc - RPC client for communication with the rendering backend
|
|
61315
61365
|
* @param settings - Optional partial render settings to override defaults
|
|
61316
61366
|
*/
|
|
61317
|
-
constructor(rpc, settings2 = {}) {
|
|
61367
|
+
constructor(rpc, logger, settings2 = {}) {
|
|
61318
61368
|
__publicField(this, "_rpc");
|
|
61369
|
+
__publicField(this, "_logger");
|
|
61319
61370
|
__publicField(this, "_settings");
|
|
61320
61371
|
__publicField(this, "_animationFrame");
|
|
61321
61372
|
__publicField(this, "_updateLighting", false);
|
|
61322
61373
|
__publicField(this, "_updateGhostColor", false);
|
|
61323
61374
|
__publicField(this, "_updateIblRotation", false);
|
|
61324
61375
|
this._rpc = rpc;
|
|
61376
|
+
this._logger = logger;
|
|
61325
61377
|
this._settings = { ...defaultRenderSettings, ...settings2 };
|
|
61326
61378
|
}
|
|
61327
61379
|
/**
|
|
@@ -61330,8 +61382,12 @@ class Renderer2 {
|
|
|
61330
61382
|
*/
|
|
61331
61383
|
async validateConnection() {
|
|
61332
61384
|
const success = await this._rpc.RPCStartScene(this._settings);
|
|
61333
|
-
if (success)
|
|
61385
|
+
if (success) {
|
|
61386
|
+
this._logger.log("Scene stream started successfully");
|
|
61387
|
+
return void 0;
|
|
61388
|
+
}
|
|
61334
61389
|
const error = await this._rpc.RPCGetLastError();
|
|
61390
|
+
this._logger.error("Failed to start scene stream", error);
|
|
61335
61391
|
return {
|
|
61336
61392
|
status: "error",
|
|
61337
61393
|
error: "stream",
|
|
@@ -61523,7 +61579,6 @@ class Renderer2 {
|
|
|
61523
61579
|
}
|
|
61524
61580
|
}
|
|
61525
61581
|
}
|
|
61526
|
-
const DEFAULT_LOCAL_ULTRA_SERVER_URL = "ws://localhost:8123";
|
|
61527
61582
|
const INVALID_HANDLE = 4294967295;
|
|
61528
61583
|
class Viewer2 {
|
|
61529
61584
|
/**
|
|
@@ -61556,10 +61611,10 @@ class Viewer2 {
|
|
|
61556
61611
|
this.rpc = new RpcSafeClient(new RpcClient(this._socketClient));
|
|
61557
61612
|
this._canvas = canvas;
|
|
61558
61613
|
this._vims = new VimCollection();
|
|
61559
|
-
this._viewport = new Viewport2(canvas, this.rpc);
|
|
61614
|
+
this._viewport = new Viewport2(canvas, this.rpc, this._logger);
|
|
61560
61615
|
this._decoder = new Decoder(canvas, this._logger);
|
|
61561
61616
|
this._selection = new ViewerSelection(this.rpc, this._vims);
|
|
61562
|
-
this._renderer = new Renderer2(this.rpc);
|
|
61617
|
+
this._renderer = new Renderer2(this.rpc, this._logger);
|
|
61563
61618
|
this.colors = new ColorManager(this.rpc);
|
|
61564
61619
|
this._camera = new Camera3(this.rpc);
|
|
61565
61620
|
this._input = new Inputs(canvas, this.rpc, this._selection, this._camera, this._renderer);
|
|
@@ -61668,6 +61723,7 @@ class Viewer2 {
|
|
|
61668
61723
|
const remoteVersion = parseVersion(version2);
|
|
61669
61724
|
const localParsedVersion = parseVersion(localVersion);
|
|
61670
61725
|
if (localParsedVersion.major !== remoteVersion.major) {
|
|
61726
|
+
this._logger.error("Major version mismatch", { local: localParsedVersion, remote: remoteVersion });
|
|
61671
61727
|
return {
|
|
61672
61728
|
status: "error",
|
|
61673
61729
|
error: "compatibility",
|
|
@@ -61676,6 +61732,7 @@ class Viewer2 {
|
|
|
61676
61732
|
serverVersion: version2
|
|
61677
61733
|
};
|
|
61678
61734
|
}
|
|
61735
|
+
this._logger.log("API version check passed", { local: localParsedVersion, remote: remoteVersion });
|
|
61679
61736
|
return void 0;
|
|
61680
61737
|
}
|
|
61681
61738
|
/**
|
|
@@ -61694,8 +61751,8 @@ class Viewer2 {
|
|
|
61694
61751
|
* @param url - The server URL to connect to. Defaults to 'ws://localhost:8123'.
|
|
61695
61752
|
* @returns A promise that resolves when the connection is established.
|
|
61696
61753
|
*/
|
|
61697
|
-
async connect(
|
|
61698
|
-
await this._socketClient.connect(
|
|
61754
|
+
async connect(settings2) {
|
|
61755
|
+
await this._socketClient.connect(settings2);
|
|
61699
61756
|
}
|
|
61700
61757
|
/**
|
|
61701
61758
|
* Disconnects from the current VIM Ultra server.
|
|
@@ -61705,16 +61762,16 @@ class Viewer2 {
|
|
|
61705
61762
|
}
|
|
61706
61763
|
/**
|
|
61707
61764
|
* Requests the server to load the given URL or file path.
|
|
61708
|
-
* @param
|
|
61765
|
+
* @param source - The path or URL to the VIM file.
|
|
61709
61766
|
* @returns A load request object that can be used to wait for the load to complete.
|
|
61710
61767
|
*/
|
|
61711
|
-
loadVim(
|
|
61712
|
-
if (typeof
|
|
61768
|
+
loadVim(source) {
|
|
61769
|
+
if (typeof source.url !== "string" || source.url.trim() === "") {
|
|
61713
61770
|
const request22 = new LoadRequest$1();
|
|
61714
61771
|
request22.error("loadingError", "Invalid path");
|
|
61715
61772
|
return request22;
|
|
61716
61773
|
}
|
|
61717
|
-
const vim = new Vim2(this.rpc, this.colors,
|
|
61774
|
+
const vim = new Vim2(this.rpc, this.colors, source, this._logger);
|
|
61718
61775
|
this._vims.add(vim);
|
|
61719
61776
|
const request2 = vim.connect();
|
|
61720
61777
|
request2.getResult().then((result) => {
|
|
@@ -61758,7 +61815,6 @@ const index$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
61758
61815
|
__proto__: null,
|
|
61759
61816
|
Box3: Box32,
|
|
61760
61817
|
ColorHandle,
|
|
61761
|
-
DEFAULT_LOCAL_ULTRA_SERVER_URL,
|
|
61762
61818
|
INVALID_HANDLE,
|
|
61763
61819
|
Matrix44: Matrix4,
|
|
61764
61820
|
RGB,
|
|
@@ -74199,6 +74255,8 @@ function Overlay(props) {
|
|
|
74199
74255
|
relay("pointerdown", (s, e) => new PointerEvent(s, e), false);
|
|
74200
74256
|
relay("pointermove", (s, e) => new PointerEvent(s, e), false);
|
|
74201
74257
|
relay("pointerup", (s, e) => new PointerEvent(s, e), false);
|
|
74258
|
+
relay("pointerenter", (s, e) => new PointerEvent(s, e));
|
|
74259
|
+
relay("pointerleave", (s, e) => new PointerEvent(s, e));
|
|
74202
74260
|
relay("touchstart", (s, e) => new TouchEvent(s, e), false);
|
|
74203
74261
|
relay("touchend", (s, e) => new TouchEvent(s, e), false);
|
|
74204
74262
|
relay("touchmove", (s, e) => new TouchEvent(s, e), false);
|
|
@@ -75642,18 +75700,18 @@ function isFilePathOrUri(input) {
|
|
|
75642
75700
|
}
|
|
75643
75701
|
return true;
|
|
75644
75702
|
}
|
|
75645
|
-
function serverFileDownloadingError(url, server) {
|
|
75703
|
+
function serverFileDownloadingError(url, authToken, server) {
|
|
75646
75704
|
if (isFilePathOrUri(url)) {
|
|
75647
75705
|
return fileOpeningError(url);
|
|
75648
75706
|
}
|
|
75649
75707
|
return {
|
|
75650
75708
|
title: "File Downloading Error",
|
|
75651
|
-
body: body$4(server,
|
|
75709
|
+
body: body$4(server, authToken, server),
|
|
75652
75710
|
footer: footer(support),
|
|
75653
75711
|
canClose: false
|
|
75654
75712
|
};
|
|
75655
75713
|
}
|
|
75656
|
-
function body$4(server,
|
|
75714
|
+
function body$4(url, server, authToken) {
|
|
75657
75715
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
|
|
75658
75716
|
mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
75659
75717
|
"Oops, it appears that there’s an ",
|
|
@@ -75663,7 +75721,8 @@ function body$4(server, url) {
|
|
|
75663
75721
|
subTitle("Error details:"),
|
|
75664
75722
|
dotList([
|
|
75665
75723
|
server ? bullet("VIM ULTRA Server:", server) : null,
|
|
75666
|
-
bullet("File URL:", url)
|
|
75724
|
+
bullet("File URL:", url),
|
|
75725
|
+
authToken ? bullet("Auth Token:", authToken) : null
|
|
75667
75726
|
]),
|
|
75668
75727
|
subTitle("Troubleshooting tips:"),
|
|
75669
75728
|
numList([
|
|
@@ -75799,17 +75858,17 @@ function getErrorMessage(state) {
|
|
|
75799
75858
|
return serverStreamError(state.serverUrl);
|
|
75800
75859
|
}
|
|
75801
75860
|
}
|
|
75802
|
-
function getRequestErrorMessage(
|
|
75861
|
+
function getRequestErrorMessage(source, error) {
|
|
75803
75862
|
console.log(error);
|
|
75804
75863
|
switch (error) {
|
|
75805
75864
|
case "loadingError":
|
|
75806
|
-
return serverFileLoadingError(url);
|
|
75865
|
+
return serverFileLoadingError(source.url);
|
|
75807
75866
|
case "downloadingError":
|
|
75808
75867
|
case "unknown":
|
|
75809
75868
|
case "cancelled":
|
|
75810
|
-
return serverFileDownloadingError(url);
|
|
75869
|
+
return serverFileDownloadingError(source.url);
|
|
75811
75870
|
case "serverDisconnected":
|
|
75812
|
-
return serverConnectionError(url);
|
|
75871
|
+
return serverConnectionError(source.url);
|
|
75813
75872
|
}
|
|
75814
75873
|
}
|
|
75815
75874
|
function createUltraComponent(container) {
|
|
@@ -75864,13 +75923,13 @@ function updateModal(modal, state) {
|
|
|
75864
75923
|
}
|
|
75865
75924
|
}
|
|
75866
75925
|
function ToRef(viewer, modal) {
|
|
75867
|
-
function load(
|
|
75868
|
-
const request2 = viewer.loadVim(
|
|
75926
|
+
function load(source) {
|
|
75927
|
+
const request2 = viewer.loadVim(source);
|
|
75869
75928
|
void updateProgress(request2, modal);
|
|
75870
75929
|
void request2.getResult().then(
|
|
75871
75930
|
(result) => {
|
|
75872
75931
|
if (result.isError) {
|
|
75873
|
-
modal.message(getRequestErrorMessage(
|
|
75932
|
+
modal.message(getRequestErrorMessage(source, result.error));
|
|
75874
75933
|
return;
|
|
75875
75934
|
}
|
|
75876
75935
|
if (result.isSuccess) {
|