vim-web 0.3.39 → 0.3.41
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/README.md +2 -2
- package/dist/style.css +6 -0
- package/dist/types/core-viewers/ultra/index.d.ts +1 -0
- 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/viewer.d.ts +3 -3
- 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/helpers/loadRequest.d.ts +1 -1
- 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/types/react-viewers/webgl/webglLoading.d.ts +1 -1
- package/dist/vim-web.iife.js +147 -148
- package/dist/vim-web.iife.js.map +1 -1
- package/dist/vim-web.js +147 -148
- package/dist/vim-web.js.map +1 -1
- package/package.json +2 -2
package/dist/vim-web.js
CHANGED
|
@@ -188,11 +188,12 @@ function requireRetriableRequest() {
|
|
|
188
188
|
Object.defineProperty(retriableRequest, "__esModule", { value: true });
|
|
189
189
|
retriableRequest.RetriableRequest = void 0;
|
|
190
190
|
class RetriableRequest {
|
|
191
|
-
constructor(url, headers, range2, responseType) {
|
|
191
|
+
constructor(url, headers, range2, responseType, maxTries) {
|
|
192
192
|
this.url = url;
|
|
193
193
|
this.headers = headers ?? {};
|
|
194
194
|
this.range = range2;
|
|
195
195
|
this.responseType = responseType;
|
|
196
|
+
this.maxTries = maxTries ?? 999;
|
|
196
197
|
}
|
|
197
198
|
abort() {
|
|
198
199
|
var _a2;
|
|
@@ -266,9 +267,9 @@ function requireRemoteBuffer() {
|
|
|
266
267
|
this._active.clear();
|
|
267
268
|
this._queue.length = 0;
|
|
268
269
|
}
|
|
269
|
-
async http(range2, label) {
|
|
270
|
+
async http(range2, label, maxTries) {
|
|
270
271
|
const rangeStr = range2 ? `bytes=${range2.start}-${range2.end - 1}` : void 0;
|
|
271
|
-
const request2 = new retriableRequest_1.RetriableRequest(this.url, this.headers, rangeStr, "arraybuffer");
|
|
272
|
+
const request2 = new retriableRequest_1.RetriableRequest(this.url, this.headers, rangeStr, "arraybuffer", maxTries);
|
|
272
273
|
request2.msg = range2 ? `${label} : [${range2.start}, ${range2.end}] of ${this.url}` : `${label} of ${this.url}`;
|
|
273
274
|
this.enqueue(request2);
|
|
274
275
|
return new Promise((resolve, reject) => {
|
|
@@ -277,13 +278,18 @@ function requireRemoteBuffer() {
|
|
|
277
278
|
this._tracker.update(label, e);
|
|
278
279
|
};
|
|
279
280
|
request2.onLoad = (result) => {
|
|
280
|
-
this.
|
|
281
|
+
this.end(request2, label);
|
|
281
282
|
resolve(result);
|
|
282
|
-
this.end(request2);
|
|
283
283
|
};
|
|
284
284
|
request2.onError = () => {
|
|
285
285
|
this._tracker.fail(label);
|
|
286
|
-
|
|
286
|
+
request2.maxTries -= 1;
|
|
287
|
+
if (request2.maxTries <= 0) {
|
|
288
|
+
this.end(request2, label);
|
|
289
|
+
reject(new Error("Max tries exceeded: " + request2.msg));
|
|
290
|
+
} else {
|
|
291
|
+
this.retry(request2);
|
|
292
|
+
}
|
|
287
293
|
};
|
|
288
294
|
});
|
|
289
295
|
}
|
|
@@ -296,8 +302,9 @@ function requireRemoteBuffer() {
|
|
|
296
302
|
this.maxConcurency = Math.max(1, this.maxConcurency - 1);
|
|
297
303
|
setTimeout(() => this.enqueue(request2), 2e3);
|
|
298
304
|
}
|
|
299
|
-
end(request2) {
|
|
305
|
+
end(request2, label) {
|
|
300
306
|
this.logs.log("Finished " + request2.msg);
|
|
307
|
+
this._tracker.end(label);
|
|
301
308
|
this._active.delete(request2);
|
|
302
309
|
this.next();
|
|
303
310
|
}
|
|
@@ -4961,7 +4968,8 @@ function requireBfast() {
|
|
|
4961
4968
|
* Downloads and parse header from remote.
|
|
4962
4969
|
*/
|
|
4963
4970
|
async requestHeader() {
|
|
4964
|
-
const
|
|
4971
|
+
const tries = this.offset === 0 ? 3 : 999;
|
|
4972
|
+
const buffer = await this.request(new Range(0, 32), "Header", tries);
|
|
4965
4973
|
if (!buffer)
|
|
4966
4974
|
throw new Error("Could not get BFAST Header");
|
|
4967
4975
|
const result = BFastHeader.createFromBuffer(buffer);
|
|
@@ -4972,8 +4980,8 @@ function requireBfast() {
|
|
|
4972
4980
|
* @param range range to get, or get full resource if undefined
|
|
4973
4981
|
* @param label label for logs
|
|
4974
4982
|
*/
|
|
4975
|
-
async request(range2, label) {
|
|
4976
|
-
const buffer = this.local(range2, label) ?? await this.remote(range2, label) ?? await this.remote(void 0, label);
|
|
4983
|
+
async request(range2, label, maxTries) {
|
|
4984
|
+
const buffer = this.local(range2, label) ?? await this.remote(range2, label, maxTries) ?? await this.remote(void 0, label, maxTries);
|
|
4977
4985
|
if (!buffer) {
|
|
4978
4986
|
throw new Error(`Could not load vim at ${this.source}`);
|
|
4979
4987
|
}
|
|
@@ -4995,11 +5003,11 @@ function requireBfast() {
|
|
|
4995
5003
|
/**
|
|
4996
5004
|
* returns requested range from remote.
|
|
4997
5005
|
*/
|
|
4998
|
-
async remote(range2, label) {
|
|
5006
|
+
async remote(range2, label, maxTries = -1) {
|
|
4999
5007
|
if (!(this.source instanceof remoteBuffer_1.RemoteBuffer))
|
|
5000
5008
|
return void 0;
|
|
5001
5009
|
const r = range2 == null ? void 0 : range2.offset(this.offset);
|
|
5002
|
-
const buffer = await this.source.http(r, `${this.name}.${label}
|
|
5010
|
+
const buffer = await this.source.http(r, `${this.name}.${label}`, maxTries);
|
|
5003
5011
|
if (range2 && ((buffer == null ? void 0 : buffer.byteLength) ?? 0) < range2.length) {
|
|
5004
5012
|
console.log("Range request request failed.");
|
|
5005
5013
|
return void 0;
|
|
@@ -5952,85 +5960,6 @@ function requireRemoteVimx() {
|
|
|
5952
5960
|
remoteVimx.RemoteVimx = RemoteVimx;
|
|
5953
5961
|
return remoteVimx;
|
|
5954
5962
|
}
|
|
5955
|
-
var requester = {};
|
|
5956
|
-
var hasRequiredRequester;
|
|
5957
|
-
function requireRequester() {
|
|
5958
|
-
if (hasRequiredRequester) return requester;
|
|
5959
|
-
hasRequiredRequester = 1;
|
|
5960
|
-
Object.defineProperty(requester, "__esModule", { value: true });
|
|
5961
|
-
requester.Requester = void 0;
|
|
5962
|
-
const logging_1 = requireLogging$1();
|
|
5963
|
-
const retriableRequest_1 = requireRetriableRequest();
|
|
5964
|
-
const requestTracker_1 = requireRequestTracker();
|
|
5965
|
-
class Requester {
|
|
5966
|
-
constructor(verbose = false) {
|
|
5967
|
-
this.maxConcurency = 10;
|
|
5968
|
-
this._queue = [];
|
|
5969
|
-
this._active = /* @__PURE__ */ new Set();
|
|
5970
|
-
this._logs = verbose ? new logging_1.DefaultLog() : new logging_1.NoLog();
|
|
5971
|
-
this._tracker = new requestTracker_1.RequestTracker(void 0, this._logs);
|
|
5972
|
-
this._tracker.onUpdate = (p) => {
|
|
5973
|
-
var _a2;
|
|
5974
|
-
return (_a2 = this.onProgress) == null ? void 0 : _a2.call(this, p);
|
|
5975
|
-
};
|
|
5976
|
-
}
|
|
5977
|
-
abort() {
|
|
5978
|
-
this._active.forEach((request2) => {
|
|
5979
|
-
request2.abort();
|
|
5980
|
-
});
|
|
5981
|
-
this._active.clear();
|
|
5982
|
-
this._queue.length = 0;
|
|
5983
|
-
}
|
|
5984
|
-
async http(url, headers = {}, label) {
|
|
5985
|
-
const request2 = new retriableRequest_1.RetriableRequest(url, headers, void 0, "arraybuffer");
|
|
5986
|
-
request2.msg = url;
|
|
5987
|
-
this.enqueue(request2);
|
|
5988
|
-
return new Promise((resolve, reject) => {
|
|
5989
|
-
this._tracker.start(label);
|
|
5990
|
-
request2.onProgress = (e) => {
|
|
5991
|
-
this._tracker.update(label, e);
|
|
5992
|
-
};
|
|
5993
|
-
request2.onLoad = (result) => {
|
|
5994
|
-
this._tracker.end(label);
|
|
5995
|
-
resolve(result);
|
|
5996
|
-
this.end(request2);
|
|
5997
|
-
};
|
|
5998
|
-
request2.onError = () => {
|
|
5999
|
-
this._tracker.fail(label);
|
|
6000
|
-
this.retry(request2);
|
|
6001
|
-
};
|
|
6002
|
-
});
|
|
6003
|
-
}
|
|
6004
|
-
enqueue(xhr) {
|
|
6005
|
-
this._queue.push(xhr);
|
|
6006
|
-
this.next();
|
|
6007
|
-
}
|
|
6008
|
-
retry(xhr) {
|
|
6009
|
-
this._active.delete(xhr);
|
|
6010
|
-
this.maxConcurency = Math.max(1, this.maxConcurency - 1);
|
|
6011
|
-
setTimeout(() => this.enqueue(xhr), 2e3);
|
|
6012
|
-
}
|
|
6013
|
-
end(xhr) {
|
|
6014
|
-
this._active.delete(xhr);
|
|
6015
|
-
this.next();
|
|
6016
|
-
}
|
|
6017
|
-
next() {
|
|
6018
|
-
if (this._queue.length === 0) {
|
|
6019
|
-
return;
|
|
6020
|
-
}
|
|
6021
|
-
if (this._active.size >= this.maxConcurency) {
|
|
6022
|
-
return;
|
|
6023
|
-
}
|
|
6024
|
-
const next = this._queue[0];
|
|
6025
|
-
this._queue.shift();
|
|
6026
|
-
this._active.add(next);
|
|
6027
|
-
next.send();
|
|
6028
|
-
this._logs.log("Starting " + next.msg);
|
|
6029
|
-
}
|
|
6030
|
-
}
|
|
6031
|
-
requester.Requester = Requester;
|
|
6032
|
-
return requester;
|
|
6033
|
-
}
|
|
6034
5963
|
var objectModel = {};
|
|
6035
5964
|
var entityTable = {};
|
|
6036
5965
|
var hasRequiredEntityTable;
|
|
@@ -8820,6 +8749,7 @@ function requireObjectModel() {
|
|
|
8820
8749
|
table.getHostIndex(index2).then((v) => result.hostIndex = v),
|
|
8821
8750
|
table.getFromRoomIndex(index2).then((v) => result.fromRoomIndex = v),
|
|
8822
8751
|
table.getToRoomIndex(index2).then((v) => result.toRoomIndex = v),
|
|
8752
|
+
table.getSuperComponentIndex(index2).then((v) => result.superComponentIndex = v),
|
|
8823
8753
|
table.getElementIndex(index2).then((v) => result.elementIndex = v)
|
|
8824
8754
|
]);
|
|
8825
8755
|
return result;
|
|
@@ -8872,6 +8802,7 @@ function requireObjectModel() {
|
|
|
8872
8802
|
let hostIndex;
|
|
8873
8803
|
let fromRoomIndex;
|
|
8874
8804
|
let toRoomIndex;
|
|
8805
|
+
let superComponentIndex;
|
|
8875
8806
|
let elementIndex;
|
|
8876
8807
|
await Promise.all([
|
|
8877
8808
|
(async () => {
|
|
@@ -8955,6 +8886,9 @@ function requireObjectModel() {
|
|
|
8955
8886
|
(async () => {
|
|
8956
8887
|
toRoomIndex = await localTable.getNumberArray("index:Vim.Room:ToRoom");
|
|
8957
8888
|
})(),
|
|
8889
|
+
(async () => {
|
|
8890
|
+
superComponentIndex = await localTable.getNumberArray("index:Vim.Element:SuperComponent");
|
|
8891
|
+
})(),
|
|
8958
8892
|
(async () => {
|
|
8959
8893
|
elementIndex = await localTable.getNumberArray("index:Vim.Element:Element");
|
|
8960
8894
|
})()
|
|
@@ -8991,6 +8925,7 @@ function requireObjectModel() {
|
|
|
8991
8925
|
hostIndex: hostIndex ? hostIndex[i] : void 0,
|
|
8992
8926
|
fromRoomIndex: fromRoomIndex ? fromRoomIndex[i] : void 0,
|
|
8993
8927
|
toRoomIndex: toRoomIndex ? toRoomIndex[i] : void 0,
|
|
8928
|
+
superComponentIndex: superComponentIndex ? superComponentIndex[i] : void 0,
|
|
8994
8929
|
elementIndex: elementIndex ? elementIndex[i] : void 0
|
|
8995
8930
|
});
|
|
8996
8931
|
}
|
|
@@ -9190,6 +9125,20 @@ function requireObjectModel() {
|
|
|
9190
9125
|
}
|
|
9191
9126
|
return await ((_a2 = this.document.room) == null ? void 0 : _a2.get(index2));
|
|
9192
9127
|
}
|
|
9128
|
+
async getSuperComponentIndex(familyInstanceIndex) {
|
|
9129
|
+
return await this.entityTable.getNumber(familyInstanceIndex, "index:Vim.Element:SuperComponent");
|
|
9130
|
+
}
|
|
9131
|
+
async getAllSuperComponentIndex() {
|
|
9132
|
+
return await this.entityTable.getNumberArray("index:Vim.Element:SuperComponent");
|
|
9133
|
+
}
|
|
9134
|
+
async getSuperComponent(familyInstanceIndex) {
|
|
9135
|
+
var _a2;
|
|
9136
|
+
const index2 = await this.getSuperComponentIndex(familyInstanceIndex);
|
|
9137
|
+
if (index2 === void 0) {
|
|
9138
|
+
return void 0;
|
|
9139
|
+
}
|
|
9140
|
+
return await ((_a2 = this.document.element) == null ? void 0 : _a2.get(index2));
|
|
9141
|
+
}
|
|
9193
9142
|
async getElementIndex(familyInstanceIndex) {
|
|
9194
9143
|
return await this.entityTable.getNumber(familyInstanceIndex, "index:Vim.Element:Element");
|
|
9195
9144
|
}
|
|
@@ -13362,7 +13311,6 @@ function requireDist$3() {
|
|
|
13362
13311
|
__exportStar(requireG3dScene(), exports);
|
|
13363
13312
|
__exportStar(requireRemoteBuffer(), exports);
|
|
13364
13313
|
__exportStar(requireRequestTracker(), exports);
|
|
13365
|
-
__exportStar(requireRequester(), exports);
|
|
13366
13314
|
__exportStar(requireRemoteValue(), exports);
|
|
13367
13315
|
__exportStar(requireVimHeader(), exports);
|
|
13368
13316
|
__exportStar(requireObjectModel(), exports);
|
|
@@ -47927,6 +47875,7 @@ class StandardMaterial {
|
|
|
47927
47875
|
}
|
|
47928
47876
|
function createMaskMaterial() {
|
|
47929
47877
|
return new ShaderMaterial({
|
|
47878
|
+
side: DoubleSide,
|
|
47930
47879
|
uniforms: {},
|
|
47931
47880
|
clipping: true,
|
|
47932
47881
|
vertexShader: `
|
|
@@ -50203,10 +50152,10 @@ const defaultViewerSettings = {
|
|
|
50203
50152
|
background: { color: new Color(12698310) },
|
|
50204
50153
|
skybox: {
|
|
50205
50154
|
enable: true,
|
|
50206
|
-
skyColor: new Color(
|
|
50207
|
-
//
|
|
50208
|
-
groundColor: new Color(
|
|
50209
|
-
//
|
|
50155
|
+
skyColor: new Color(16777215),
|
|
50156
|
+
// white
|
|
50157
|
+
groundColor: new Color(16185078),
|
|
50158
|
+
// less white
|
|
50210
50159
|
sharpness: 2
|
|
50211
50160
|
},
|
|
50212
50161
|
groundPlane: {
|
|
@@ -53642,7 +53591,7 @@ class GizmoOrbit {
|
|
|
53642
53591
|
onUpdate() {
|
|
53643
53592
|
this.updateScale();
|
|
53644
53593
|
this.setPosition(this._camera.target);
|
|
53645
|
-
this.show(
|
|
53594
|
+
this.show(this._inputs.pointerActive === "orbit");
|
|
53646
53595
|
}
|
|
53647
53596
|
/**
|
|
53648
53597
|
* Determines whether the orbit gizmo is enabled.
|
|
@@ -53664,6 +53613,7 @@ class GizmoOrbit {
|
|
|
53664
53613
|
}
|
|
53665
53614
|
clearTimeout(this._timeout);
|
|
53666
53615
|
this._gizmos.visible = show;
|
|
53616
|
+
this._renderer.needsUpdate = true;
|
|
53667
53617
|
if (show) {
|
|
53668
53618
|
this._timeout = setTimeout(() => {
|
|
53669
53619
|
this._gizmos.visible = false;
|
|
@@ -55270,6 +55220,15 @@ class BoxInputs {
|
|
|
55270
55220
|
this.reg(canvas, "pointerdown", this.onMouseDown.bind(this));
|
|
55271
55221
|
this.reg(canvas, "pointermove", this.onMouseMove.bind(this));
|
|
55272
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);
|
|
55273
55232
|
}
|
|
55274
55233
|
capturePointer(pointerId) {
|
|
55275
55234
|
this.releasePointer();
|
|
@@ -58161,6 +58120,9 @@ class RpcClient {
|
|
|
58161
58120
|
get url() {
|
|
58162
58121
|
return this._messenger.url;
|
|
58163
58122
|
}
|
|
58123
|
+
get connected() {
|
|
58124
|
+
return this._messenger.state.status === "connected";
|
|
58125
|
+
}
|
|
58164
58126
|
RPCAddNodeFlags(componentHandle, nodes, flags) {
|
|
58165
58127
|
const marshal = new Marshal();
|
|
58166
58128
|
marshal.writeString("RPCAddNodeFlags");
|
|
@@ -58857,6 +58819,9 @@ class RpcSafeClient {
|
|
|
58857
58819
|
get url() {
|
|
58858
58820
|
return this.rpc.url;
|
|
58859
58821
|
}
|
|
58822
|
+
get connected() {
|
|
58823
|
+
return this.rpc.connected;
|
|
58824
|
+
}
|
|
58860
58825
|
/*******************************************************************************
|
|
58861
58826
|
* SCENE MANAGEMENT METHODS
|
|
58862
58827
|
* Methods for managing the overall scene, including initialization, lighting,
|
|
@@ -59193,15 +59158,15 @@ class RpcSafeClient {
|
|
|
59193
59158
|
******************************************************************************/
|
|
59194
59159
|
/**
|
|
59195
59160
|
* Loads a VIM file from the local filesystem.
|
|
59196
|
-
* @param
|
|
59161
|
+
* @param source - The path to the VIM file (supports file:// protocol)
|
|
59197
59162
|
* @returns Promise resolving to the handle of the loaded VIM component
|
|
59198
59163
|
* @throws {Error} If the filename is invalid or empty
|
|
59199
59164
|
*/
|
|
59200
|
-
async RPCLoadVim(
|
|
59201
|
-
if (!Validation.isNonEmptyString(
|
|
59202
|
-
|
|
59165
|
+
async RPCLoadVim(source) {
|
|
59166
|
+
if (!Validation.isNonEmptyString(source.url)) return INVALID_HANDLE;
|
|
59167
|
+
const url = source.url.replace("file:///", "file://");
|
|
59203
59168
|
return await this.safeCall(
|
|
59204
|
-
() => this.rpc.RPCLoadVim(
|
|
59169
|
+
() => this.rpc.RPCLoadVim(url),
|
|
59205
59170
|
INVALID_HANDLE
|
|
59206
59171
|
);
|
|
59207
59172
|
}
|
|
@@ -59211,10 +59176,10 @@ class RpcSafeClient {
|
|
|
59211
59176
|
* @returns Promise resolving to the handle of the loaded VIM component
|
|
59212
59177
|
* @throws {Error} If the URL is invalid
|
|
59213
59178
|
*/
|
|
59214
|
-
async RPCLoadVimURL(
|
|
59215
|
-
if (!Validation.isURL(url)) return INVALID_HANDLE;
|
|
59179
|
+
async RPCLoadVimURL(source) {
|
|
59180
|
+
if (!Validation.isURL(source.url)) return INVALID_HANDLE;
|
|
59216
59181
|
return await this.safeCall(
|
|
59217
|
-
() => this.rpc.RPCLoadVimURL(url, ""),
|
|
59182
|
+
() => this.rpc.RPCLoadVimURL(source.url, source.authToken ?? ""),
|
|
59218
59183
|
INVALID_HANDLE
|
|
59219
59184
|
);
|
|
59220
59185
|
}
|
|
@@ -59598,9 +59563,9 @@ class Inputs extends InputHandler2 {
|
|
|
59598
59563
|
this._inputsMouse = new InputMouse(this._canvas, this._rpc, selection, camera2);
|
|
59599
59564
|
this._inputsTouch = new InputTouch(this._canvas, this._rpc);
|
|
59600
59565
|
this._keyboard = new InputKeyboard(this._rpc, selection, camera2, this);
|
|
59601
|
-
this.register();
|
|
59602
59566
|
}
|
|
59603
59567
|
onConnect() {
|
|
59568
|
+
this.register();
|
|
59604
59569
|
this._rpc.RPCSetMoveSpeed(this._moveSpeed);
|
|
59605
59570
|
}
|
|
59606
59571
|
register() {
|
|
@@ -59846,7 +59811,7 @@ class SocketClient {
|
|
|
59846
59811
|
* Disconnects from the current WebSocket server.
|
|
59847
59812
|
*/
|
|
59848
59813
|
disconnect(error) {
|
|
59849
|
-
this._logger.log("Disconnecting from "
|
|
59814
|
+
this._logger.log("Disconnecting from: ", this._connectingUrl);
|
|
59850
59815
|
this._connectingUrl = void 0;
|
|
59851
59816
|
this._disconnect(error);
|
|
59852
59817
|
}
|
|
@@ -59932,7 +59897,7 @@ class SocketClient {
|
|
|
59932
59897
|
this._disconnect(issues);
|
|
59933
59898
|
return;
|
|
59934
59899
|
}
|
|
59935
|
-
this._logger.log("Connected to "
|
|
59900
|
+
this._logger.log("Connected to: ", (_a2 = this._socket) == null ? void 0 : _a2.url);
|
|
59936
59901
|
this.updateState({ status: "connected" });
|
|
59937
59902
|
this._streamLogger.startLoggging();
|
|
59938
59903
|
this._connectPromise.resolve();
|
|
@@ -60245,7 +60210,10 @@ class Decoder {
|
|
|
60245
60210
|
this._logger.error("Error decoding video chunk: ", e);
|
|
60246
60211
|
}
|
|
60247
60212
|
}
|
|
60248
|
-
this._firstDecoded
|
|
60213
|
+
if (!this._firstDecoded) {
|
|
60214
|
+
this._firstDecoded = true;
|
|
60215
|
+
this._logger.log("First frame decoded");
|
|
60216
|
+
}
|
|
60249
60217
|
}
|
|
60250
60218
|
/**
|
|
60251
60219
|
* Clears the decoder state and renderer buffer.
|
|
@@ -60455,16 +60423,16 @@ class Vim2 {
|
|
|
60455
60423
|
if (this._request) {
|
|
60456
60424
|
return this._request;
|
|
60457
60425
|
}
|
|
60458
|
-
this._logger.log("Loading "
|
|
60426
|
+
this._logger.log("Loading: ", this.source);
|
|
60459
60427
|
this._request = new LoadRequest$1();
|
|
60460
60428
|
this._load(this.source, this._request).then(async (request2) => {
|
|
60461
60429
|
const result = await request2.getResult();
|
|
60462
60430
|
if (result.isSuccess) {
|
|
60463
|
-
this._logger.log(
|
|
60431
|
+
this._logger.log("Successfully loaded vim: ", this.source);
|
|
60464
60432
|
this.reapplyNodes();
|
|
60465
60433
|
this.reapplyColors();
|
|
60466
60434
|
} else {
|
|
60467
|
-
this._logger.log(
|
|
60435
|
+
this._logger.log("Failed to load vim: ", this.source);
|
|
60468
60436
|
}
|
|
60469
60437
|
});
|
|
60470
60438
|
return this._request;
|
|
@@ -60497,18 +60465,19 @@ class Vim2 {
|
|
|
60497
60465
|
}
|
|
60498
60466
|
/**
|
|
60499
60467
|
* Requests for the server to load the given URL or file path.
|
|
60500
|
-
* @param
|
|
60468
|
+
* @param source - The URL or file path to load.
|
|
60501
60469
|
* @param result - The load request object to update.
|
|
60502
60470
|
* @returns The updated load request.
|
|
60503
60471
|
*/
|
|
60504
|
-
async _load(
|
|
60505
|
-
const handle = await this._getHandle(
|
|
60472
|
+
async _load(source, result) {
|
|
60473
|
+
const handle = await this._getHandle(source, result);
|
|
60506
60474
|
if (result.isCompleted || handle === INVALID_HANDLE) {
|
|
60507
60475
|
return result;
|
|
60508
60476
|
}
|
|
60509
60477
|
while (true) {
|
|
60510
60478
|
try {
|
|
60511
60479
|
const state = await this._rpc.RPCGetVimLoadingState(handle);
|
|
60480
|
+
this._logger.log("state :", state);
|
|
60512
60481
|
result.onProgress(state.progress);
|
|
60513
60482
|
switch (state.status) {
|
|
60514
60483
|
// Keep waiting for the loading to complete
|
|
@@ -60545,16 +60514,16 @@ class Vim2 {
|
|
|
60545
60514
|
return "unknown";
|
|
60546
60515
|
}
|
|
60547
60516
|
}
|
|
60548
|
-
async _getHandle(
|
|
60517
|
+
async _getHandle(source, result) {
|
|
60549
60518
|
let handle = void 0;
|
|
60550
60519
|
try {
|
|
60551
|
-
if (isURL(url)) {
|
|
60552
|
-
handle = await this._rpc.RPCLoadVimURL(
|
|
60553
|
-
} else if (isFileURI(url)) {
|
|
60554
|
-
handle = await this._rpc.RPCLoadVim(
|
|
60520
|
+
if (isURL(source.url)) {
|
|
60521
|
+
handle = await this._rpc.RPCLoadVimURL(source);
|
|
60522
|
+
} else if (isFileURI(source.url)) {
|
|
60523
|
+
handle = await this._rpc.RPCLoadVim(source);
|
|
60555
60524
|
} else {
|
|
60556
60525
|
console.log("Defaulting to file path");
|
|
60557
|
-
handle = await this._rpc.RPCLoadVim(
|
|
60526
|
+
handle = await this._rpc.RPCLoadVim(source);
|
|
60558
60527
|
}
|
|
60559
60528
|
} catch (e) {
|
|
60560
60529
|
result.error("downloadingError", e.message);
|
|
@@ -60564,6 +60533,7 @@ class Vim2 {
|
|
|
60564
60533
|
result.error("downloadingError");
|
|
60565
60534
|
return INVALID_HANDLE;
|
|
60566
60535
|
}
|
|
60536
|
+
console.log("handle :", handle);
|
|
60567
60537
|
return handle;
|
|
60568
60538
|
}
|
|
60569
60539
|
/**
|
|
@@ -60769,13 +60739,27 @@ function wait(ms) {
|
|
|
60769
60739
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
60770
60740
|
}
|
|
60771
60741
|
const defaultLogger = {
|
|
60772
|
-
log: (message) => {
|
|
60773
|
-
|
|
60742
|
+
log: (message, obj) => {
|
|
60743
|
+
const caller = getCaller();
|
|
60744
|
+
const msg = `VIM Ultra : ${message}`;
|
|
60745
|
+
if (obj) {
|
|
60746
|
+
console.log(msg, obj, { caller });
|
|
60747
|
+
} else {
|
|
60748
|
+
console.log(msg, { caller });
|
|
60749
|
+
}
|
|
60774
60750
|
},
|
|
60775
60751
|
error: (message, e) => {
|
|
60776
|
-
console.error("VIM Ultra
|
|
60752
|
+
console.error("VIM Ultra " + message, e);
|
|
60777
60753
|
}
|
|
60778
60754
|
};
|
|
60755
|
+
function getCaller() {
|
|
60756
|
+
const stack = new Error().stack;
|
|
60757
|
+
if (!stack) return "";
|
|
60758
|
+
const files = stack.split("/");
|
|
60759
|
+
const file = files[files.length - 1];
|
|
60760
|
+
const clean = file.replace(/\?[^:]+/, "");
|
|
60761
|
+
return clean;
|
|
60762
|
+
}
|
|
60779
60763
|
function debounce(func, delay) {
|
|
60780
60764
|
let timeoutId;
|
|
60781
60765
|
return [function(...args) {
|
|
@@ -60793,14 +60777,16 @@ class Viewport2 {
|
|
|
60793
60777
|
* @param canvas - The HTML canvas element to observe and manage
|
|
60794
60778
|
* @param rpc - RPC client for viewport communication
|
|
60795
60779
|
*/
|
|
60796
|
-
constructor(canvas, rpc) {
|
|
60780
|
+
constructor(canvas, rpc, logger) {
|
|
60797
60781
|
/** The HTML canvas element used for rendering */
|
|
60798
60782
|
__publicField(this, "canvas");
|
|
60799
60783
|
__publicField(this, "_rpc");
|
|
60784
|
+
__publicField(this, "_logger");
|
|
60800
60785
|
__publicField(this, "_observer");
|
|
60801
60786
|
__publicField(this, "_clearTimeout");
|
|
60802
60787
|
this.canvas = canvas;
|
|
60803
60788
|
this._rpc = rpc;
|
|
60789
|
+
this._logger = logger;
|
|
60804
60790
|
const [debounced, clear] = debounce(() => this.onResize(), 250);
|
|
60805
60791
|
this._observer = new ResizeObserver(debounced);
|
|
60806
60792
|
this._observer.observe(canvas);
|
|
@@ -60811,14 +60797,16 @@ class Viewport2 {
|
|
|
60811
60797
|
* @private
|
|
60812
60798
|
*/
|
|
60813
60799
|
onResize() {
|
|
60814
|
-
|
|
60800
|
+
this._logger.log("Canvas resized to :", { x: this.canvas.offsetWidth, y: this.canvas.offsetHeight });
|
|
60815
60801
|
this.update();
|
|
60816
60802
|
}
|
|
60817
60803
|
/**
|
|
60818
60804
|
* Updates the aspect ratio of the viewport on the server
|
|
60819
60805
|
*/
|
|
60820
60806
|
update() {
|
|
60821
|
-
this._rpc.
|
|
60807
|
+
if (this._rpc.connected) {
|
|
60808
|
+
this._rpc.RPCSetAspectRatio(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
60809
|
+
}
|
|
60822
60810
|
}
|
|
60823
60811
|
/**
|
|
60824
60812
|
* Cleans up resources by removing resize observer and clearing timeouts
|
|
@@ -61356,7 +61344,7 @@ class VimCollection {
|
|
|
61356
61344
|
const defaultRenderSettings = {
|
|
61357
61345
|
...defaultSceneSettings,
|
|
61358
61346
|
lockIblRotation: true,
|
|
61359
|
-
ghostColor: new RGBA(
|
|
61347
|
+
ghostColor: new RGBA(14 / 255, 14 / 255, 14 / 255, 1 / 255)
|
|
61360
61348
|
};
|
|
61361
61349
|
class Renderer2 {
|
|
61362
61350
|
/**
|
|
@@ -61364,14 +61352,16 @@ class Renderer2 {
|
|
|
61364
61352
|
* @param rpc - RPC client for communication with the rendering backend
|
|
61365
61353
|
* @param settings - Optional partial render settings to override defaults
|
|
61366
61354
|
*/
|
|
61367
|
-
constructor(rpc, settings2 = {}) {
|
|
61355
|
+
constructor(rpc, logger, settings2 = {}) {
|
|
61368
61356
|
__publicField(this, "_rpc");
|
|
61357
|
+
__publicField(this, "_logger");
|
|
61369
61358
|
__publicField(this, "_settings");
|
|
61370
61359
|
__publicField(this, "_animationFrame");
|
|
61371
61360
|
__publicField(this, "_updateLighting", false);
|
|
61372
61361
|
__publicField(this, "_updateGhostColor", false);
|
|
61373
61362
|
__publicField(this, "_updateIblRotation", false);
|
|
61374
61363
|
this._rpc = rpc;
|
|
61364
|
+
this._logger = logger;
|
|
61375
61365
|
this._settings = { ...defaultRenderSettings, ...settings2 };
|
|
61376
61366
|
}
|
|
61377
61367
|
/**
|
|
@@ -61380,8 +61370,12 @@ class Renderer2 {
|
|
|
61380
61370
|
*/
|
|
61381
61371
|
async validateConnection() {
|
|
61382
61372
|
const success = await this._rpc.RPCStartScene(this._settings);
|
|
61383
|
-
if (success)
|
|
61373
|
+
if (success) {
|
|
61374
|
+
this._logger.log("Scene stream started successfully");
|
|
61375
|
+
return void 0;
|
|
61376
|
+
}
|
|
61384
61377
|
const error = await this._rpc.RPCGetLastError();
|
|
61378
|
+
this._logger.error("Failed to start scene stream", error);
|
|
61385
61379
|
return {
|
|
61386
61380
|
status: "error",
|
|
61387
61381
|
error: "stream",
|
|
@@ -61606,10 +61600,10 @@ class Viewer2 {
|
|
|
61606
61600
|
this.rpc = new RpcSafeClient(new RpcClient(this._socketClient));
|
|
61607
61601
|
this._canvas = canvas;
|
|
61608
61602
|
this._vims = new VimCollection();
|
|
61609
|
-
this._viewport = new Viewport2(canvas, this.rpc);
|
|
61603
|
+
this._viewport = new Viewport2(canvas, this.rpc, this._logger);
|
|
61610
61604
|
this._decoder = new Decoder(canvas, this._logger);
|
|
61611
61605
|
this._selection = new ViewerSelection(this.rpc, this._vims);
|
|
61612
|
-
this._renderer = new Renderer2(this.rpc);
|
|
61606
|
+
this._renderer = new Renderer2(this.rpc, this._logger);
|
|
61613
61607
|
this.colors = new ColorManager(this.rpc);
|
|
61614
61608
|
this._camera = new Camera3(this.rpc);
|
|
61615
61609
|
this._input = new Inputs(canvas, this.rpc, this._selection, this._camera, this._renderer);
|
|
@@ -61718,6 +61712,7 @@ class Viewer2 {
|
|
|
61718
61712
|
const remoteVersion = parseVersion(version2);
|
|
61719
61713
|
const localParsedVersion = parseVersion(localVersion);
|
|
61720
61714
|
if (localParsedVersion.major !== remoteVersion.major) {
|
|
61715
|
+
this._logger.error("Major version mismatch", { local: localParsedVersion, remote: remoteVersion });
|
|
61721
61716
|
return {
|
|
61722
61717
|
status: "error",
|
|
61723
61718
|
error: "compatibility",
|
|
@@ -61726,6 +61721,7 @@ class Viewer2 {
|
|
|
61726
61721
|
serverVersion: version2
|
|
61727
61722
|
};
|
|
61728
61723
|
}
|
|
61724
|
+
this._logger.log("API version check passed", { local: localParsedVersion, remote: remoteVersion });
|
|
61729
61725
|
return void 0;
|
|
61730
61726
|
}
|
|
61731
61727
|
/**
|
|
@@ -61755,16 +61751,16 @@ class Viewer2 {
|
|
|
61755
61751
|
}
|
|
61756
61752
|
/**
|
|
61757
61753
|
* Requests the server to load the given URL or file path.
|
|
61758
|
-
* @param
|
|
61754
|
+
* @param source - The path or URL to the VIM file.
|
|
61759
61755
|
* @returns A load request object that can be used to wait for the load to complete.
|
|
61760
61756
|
*/
|
|
61761
|
-
loadVim(
|
|
61762
|
-
if (typeof
|
|
61757
|
+
loadVim(source) {
|
|
61758
|
+
if (typeof source.url !== "string" || source.url.trim() === "") {
|
|
61763
61759
|
const request22 = new LoadRequest$1();
|
|
61764
61760
|
request22.error("loadingError", "Invalid path");
|
|
61765
61761
|
return request22;
|
|
61766
61762
|
}
|
|
61767
|
-
const vim = new Vim2(this.rpc, this.colors,
|
|
61763
|
+
const vim = new Vim2(this.rpc, this.colors, source, this._logger);
|
|
61768
61764
|
this._vims.add(vim);
|
|
61769
61765
|
const request2 = vim.connect();
|
|
61770
61766
|
request2.getResult().then((result) => {
|
|
@@ -74249,6 +74245,8 @@ function Overlay(props) {
|
|
|
74249
74245
|
relay("pointerdown", (s, e) => new PointerEvent(s, e), false);
|
|
74250
74246
|
relay("pointermove", (s, e) => new PointerEvent(s, e), false);
|
|
74251
74247
|
relay("pointerup", (s, e) => new PointerEvent(s, e), false);
|
|
74248
|
+
relay("pointerenter", (s, e) => new PointerEvent(s, e));
|
|
74249
|
+
relay("pointerleave", (s, e) => new PointerEvent(s, e));
|
|
74252
74250
|
relay("touchstart", (s, e) => new TouchEvent(s, e), false);
|
|
74253
74251
|
relay("touchend", (s, e) => new TouchEvent(s, e), false);
|
|
74254
74252
|
relay("touchmove", (s, e) => new TouchEvent(s, e), false);
|
|
@@ -75692,18 +75690,18 @@ function isFilePathOrUri(input) {
|
|
|
75692
75690
|
}
|
|
75693
75691
|
return true;
|
|
75694
75692
|
}
|
|
75695
|
-
function serverFileDownloadingError(url, server) {
|
|
75693
|
+
function serverFileDownloadingError(url, authToken, server) {
|
|
75696
75694
|
if (isFilePathOrUri(url)) {
|
|
75697
75695
|
return fileOpeningError(url);
|
|
75698
75696
|
}
|
|
75699
75697
|
return {
|
|
75700
75698
|
title: "File Downloading Error",
|
|
75701
|
-
body: body$4(server,
|
|
75699
|
+
body: body$4(server, authToken, server),
|
|
75702
75700
|
footer: footer(support),
|
|
75703
75701
|
canClose: false
|
|
75704
75702
|
};
|
|
75705
75703
|
}
|
|
75706
|
-
function body$4(server,
|
|
75704
|
+
function body$4(url, server, authToken) {
|
|
75707
75705
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
|
|
75708
75706
|
mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
75709
75707
|
"Oops, it appears that there’s an ",
|
|
@@ -75713,7 +75711,8 @@ function body$4(server, url) {
|
|
|
75713
75711
|
subTitle("Error details:"),
|
|
75714
75712
|
dotList([
|
|
75715
75713
|
server ? bullet("VIM ULTRA Server:", server) : null,
|
|
75716
|
-
bullet("File URL:", url)
|
|
75714
|
+
bullet("File URL:", url),
|
|
75715
|
+
authToken ? bullet("Auth Token:", authToken) : null``
|
|
75717
75716
|
]),
|
|
75718
75717
|
subTitle("Troubleshooting tips:"),
|
|
75719
75718
|
numList([
|
|
@@ -75818,7 +75817,7 @@ function body(url) {
|
|
|
75818
75817
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
|
|
75819
75818
|
mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
75820
75819
|
"Oops, it appears that there’s an ",
|
|
75821
|
-
bold("error starting a stream on the VIM
|
|
75820
|
+
bold("error starting a stream on the VIM Ultra Server"),
|
|
75822
75821
|
". Please check the following conditions to get back up and running quickly."
|
|
75823
75822
|
] })),
|
|
75824
75823
|
subTitle("Troubleshooting tips:"),
|
|
@@ -75849,17 +75848,17 @@ function getErrorMessage(state) {
|
|
|
75849
75848
|
return serverStreamError(state.serverUrl);
|
|
75850
75849
|
}
|
|
75851
75850
|
}
|
|
75852
|
-
function getRequestErrorMessage(
|
|
75851
|
+
function getRequestErrorMessage(source, error) {
|
|
75853
75852
|
console.log(error);
|
|
75854
75853
|
switch (error) {
|
|
75855
75854
|
case "loadingError":
|
|
75856
|
-
return serverFileLoadingError(url);
|
|
75855
|
+
return serverFileLoadingError(source.url);
|
|
75857
75856
|
case "downloadingError":
|
|
75858
75857
|
case "unknown":
|
|
75859
75858
|
case "cancelled":
|
|
75860
|
-
return serverFileDownloadingError(url);
|
|
75859
|
+
return serverFileDownloadingError(source.url);
|
|
75861
75860
|
case "serverDisconnected":
|
|
75862
|
-
return serverConnectionError(url);
|
|
75861
|
+
return serverConnectionError(source.url);
|
|
75863
75862
|
}
|
|
75864
75863
|
}
|
|
75865
75864
|
function createUltraComponent(container) {
|
|
@@ -75914,13 +75913,13 @@ function updateModal(modal, state) {
|
|
|
75914
75913
|
}
|
|
75915
75914
|
}
|
|
75916
75915
|
function ToRef(viewer, modal) {
|
|
75917
|
-
function load(
|
|
75918
|
-
const request2 = viewer.loadVim(
|
|
75916
|
+
function load(source) {
|
|
75917
|
+
const request2 = viewer.loadVim(source);
|
|
75919
75918
|
void updateProgress(request2, modal);
|
|
75920
75919
|
void request2.getResult().then(
|
|
75921
75920
|
(result) => {
|
|
75922
75921
|
if (result.isError) {
|
|
75923
|
-
modal.message(getRequestErrorMessage(
|
|
75922
|
+
modal.message(getRequestErrorMessage(source, result.error));
|
|
75924
75923
|
return;
|
|
75925
75924
|
}
|
|
75926
75925
|
if (result.isSuccess) {
|