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.iife.js
CHANGED
|
@@ -204,11 +204,12 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
204
204
|
Object.defineProperty(retriableRequest, "__esModule", { value: true });
|
|
205
205
|
retriableRequest.RetriableRequest = void 0;
|
|
206
206
|
class RetriableRequest {
|
|
207
|
-
constructor(url, headers, range2, responseType) {
|
|
207
|
+
constructor(url, headers, range2, responseType, maxTries) {
|
|
208
208
|
this.url = url;
|
|
209
209
|
this.headers = headers ?? {};
|
|
210
210
|
this.range = range2;
|
|
211
211
|
this.responseType = responseType;
|
|
212
|
+
this.maxTries = maxTries ?? 999;
|
|
212
213
|
}
|
|
213
214
|
abort() {
|
|
214
215
|
var _a2;
|
|
@@ -282,9 +283,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
282
283
|
this._active.clear();
|
|
283
284
|
this._queue.length = 0;
|
|
284
285
|
}
|
|
285
|
-
async http(range2, label) {
|
|
286
|
+
async http(range2, label, maxTries) {
|
|
286
287
|
const rangeStr = range2 ? `bytes=${range2.start}-${range2.end - 1}` : void 0;
|
|
287
|
-
const request2 = new retriableRequest_1.RetriableRequest(this.url, this.headers, rangeStr, "arraybuffer");
|
|
288
|
+
const request2 = new retriableRequest_1.RetriableRequest(this.url, this.headers, rangeStr, "arraybuffer", maxTries);
|
|
288
289
|
request2.msg = range2 ? `${label} : [${range2.start}, ${range2.end}] of ${this.url}` : `${label} of ${this.url}`;
|
|
289
290
|
this.enqueue(request2);
|
|
290
291
|
return new Promise((resolve, reject) => {
|
|
@@ -293,13 +294,18 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
293
294
|
this._tracker.update(label, e);
|
|
294
295
|
};
|
|
295
296
|
request2.onLoad = (result) => {
|
|
296
|
-
this.
|
|
297
|
+
this.end(request2, label);
|
|
297
298
|
resolve(result);
|
|
298
|
-
this.end(request2);
|
|
299
299
|
};
|
|
300
300
|
request2.onError = () => {
|
|
301
301
|
this._tracker.fail(label);
|
|
302
|
-
|
|
302
|
+
request2.maxTries -= 1;
|
|
303
|
+
if (request2.maxTries <= 0) {
|
|
304
|
+
this.end(request2, label);
|
|
305
|
+
reject(new Error("Max tries exceeded: " + request2.msg));
|
|
306
|
+
} else {
|
|
307
|
+
this.retry(request2);
|
|
308
|
+
}
|
|
303
309
|
};
|
|
304
310
|
});
|
|
305
311
|
}
|
|
@@ -312,8 +318,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
312
318
|
this.maxConcurency = Math.max(1, this.maxConcurency - 1);
|
|
313
319
|
setTimeout(() => this.enqueue(request2), 2e3);
|
|
314
320
|
}
|
|
315
|
-
end(request2) {
|
|
321
|
+
end(request2, label) {
|
|
316
322
|
this.logs.log("Finished " + request2.msg);
|
|
323
|
+
this._tracker.end(label);
|
|
317
324
|
this._active.delete(request2);
|
|
318
325
|
this.next();
|
|
319
326
|
}
|
|
@@ -4977,7 +4984,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4977
4984
|
* Downloads and parse header from remote.
|
|
4978
4985
|
*/
|
|
4979
4986
|
async requestHeader() {
|
|
4980
|
-
const
|
|
4987
|
+
const tries = this.offset === 0 ? 3 : 999;
|
|
4988
|
+
const buffer = await this.request(new Range(0, 32), "Header", tries);
|
|
4981
4989
|
if (!buffer)
|
|
4982
4990
|
throw new Error("Could not get BFAST Header");
|
|
4983
4991
|
const result = BFastHeader.createFromBuffer(buffer);
|
|
@@ -4988,8 +4996,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
4988
4996
|
* @param range range to get, or get full resource if undefined
|
|
4989
4997
|
* @param label label for logs
|
|
4990
4998
|
*/
|
|
4991
|
-
async request(range2, label) {
|
|
4992
|
-
const buffer = this.local(range2, label) ?? await this.remote(range2, label) ?? await this.remote(void 0, label);
|
|
4999
|
+
async request(range2, label, maxTries) {
|
|
5000
|
+
const buffer = this.local(range2, label) ?? await this.remote(range2, label, maxTries) ?? await this.remote(void 0, label, maxTries);
|
|
4993
5001
|
if (!buffer) {
|
|
4994
5002
|
throw new Error(`Could not load vim at ${this.source}`);
|
|
4995
5003
|
}
|
|
@@ -5011,11 +5019,11 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5011
5019
|
/**
|
|
5012
5020
|
* returns requested range from remote.
|
|
5013
5021
|
*/
|
|
5014
|
-
async remote(range2, label) {
|
|
5022
|
+
async remote(range2, label, maxTries = -1) {
|
|
5015
5023
|
if (!(this.source instanceof remoteBuffer_1.RemoteBuffer))
|
|
5016
5024
|
return void 0;
|
|
5017
5025
|
const r = range2 == null ? void 0 : range2.offset(this.offset);
|
|
5018
|
-
const buffer = await this.source.http(r, `${this.name}.${label}
|
|
5026
|
+
const buffer = await this.source.http(r, `${this.name}.${label}`, maxTries);
|
|
5019
5027
|
if (range2 && ((buffer == null ? void 0 : buffer.byteLength) ?? 0) < range2.length) {
|
|
5020
5028
|
console.log("Range request request failed.");
|
|
5021
5029
|
return void 0;
|
|
@@ -5968,85 +5976,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
5968
5976
|
remoteVimx.RemoteVimx = RemoteVimx;
|
|
5969
5977
|
return remoteVimx;
|
|
5970
5978
|
}
|
|
5971
|
-
var requester = {};
|
|
5972
|
-
var hasRequiredRequester;
|
|
5973
|
-
function requireRequester() {
|
|
5974
|
-
if (hasRequiredRequester) return requester;
|
|
5975
|
-
hasRequiredRequester = 1;
|
|
5976
|
-
Object.defineProperty(requester, "__esModule", { value: true });
|
|
5977
|
-
requester.Requester = void 0;
|
|
5978
|
-
const logging_1 = requireLogging$1();
|
|
5979
|
-
const retriableRequest_1 = requireRetriableRequest();
|
|
5980
|
-
const requestTracker_1 = requireRequestTracker();
|
|
5981
|
-
class Requester {
|
|
5982
|
-
constructor(verbose = false) {
|
|
5983
|
-
this.maxConcurency = 10;
|
|
5984
|
-
this._queue = [];
|
|
5985
|
-
this._active = /* @__PURE__ */ new Set();
|
|
5986
|
-
this._logs = verbose ? new logging_1.DefaultLog() : new logging_1.NoLog();
|
|
5987
|
-
this._tracker = new requestTracker_1.RequestTracker(void 0, this._logs);
|
|
5988
|
-
this._tracker.onUpdate = (p) => {
|
|
5989
|
-
var _a2;
|
|
5990
|
-
return (_a2 = this.onProgress) == null ? void 0 : _a2.call(this, p);
|
|
5991
|
-
};
|
|
5992
|
-
}
|
|
5993
|
-
abort() {
|
|
5994
|
-
this._active.forEach((request2) => {
|
|
5995
|
-
request2.abort();
|
|
5996
|
-
});
|
|
5997
|
-
this._active.clear();
|
|
5998
|
-
this._queue.length = 0;
|
|
5999
|
-
}
|
|
6000
|
-
async http(url, headers = {}, label) {
|
|
6001
|
-
const request2 = new retriableRequest_1.RetriableRequest(url, headers, void 0, "arraybuffer");
|
|
6002
|
-
request2.msg = url;
|
|
6003
|
-
this.enqueue(request2);
|
|
6004
|
-
return new Promise((resolve, reject) => {
|
|
6005
|
-
this._tracker.start(label);
|
|
6006
|
-
request2.onProgress = (e) => {
|
|
6007
|
-
this._tracker.update(label, e);
|
|
6008
|
-
};
|
|
6009
|
-
request2.onLoad = (result) => {
|
|
6010
|
-
this._tracker.end(label);
|
|
6011
|
-
resolve(result);
|
|
6012
|
-
this.end(request2);
|
|
6013
|
-
};
|
|
6014
|
-
request2.onError = () => {
|
|
6015
|
-
this._tracker.fail(label);
|
|
6016
|
-
this.retry(request2);
|
|
6017
|
-
};
|
|
6018
|
-
});
|
|
6019
|
-
}
|
|
6020
|
-
enqueue(xhr) {
|
|
6021
|
-
this._queue.push(xhr);
|
|
6022
|
-
this.next();
|
|
6023
|
-
}
|
|
6024
|
-
retry(xhr) {
|
|
6025
|
-
this._active.delete(xhr);
|
|
6026
|
-
this.maxConcurency = Math.max(1, this.maxConcurency - 1);
|
|
6027
|
-
setTimeout(() => this.enqueue(xhr), 2e3);
|
|
6028
|
-
}
|
|
6029
|
-
end(xhr) {
|
|
6030
|
-
this._active.delete(xhr);
|
|
6031
|
-
this.next();
|
|
6032
|
-
}
|
|
6033
|
-
next() {
|
|
6034
|
-
if (this._queue.length === 0) {
|
|
6035
|
-
return;
|
|
6036
|
-
}
|
|
6037
|
-
if (this._active.size >= this.maxConcurency) {
|
|
6038
|
-
return;
|
|
6039
|
-
}
|
|
6040
|
-
const next = this._queue[0];
|
|
6041
|
-
this._queue.shift();
|
|
6042
|
-
this._active.add(next);
|
|
6043
|
-
next.send();
|
|
6044
|
-
this._logs.log("Starting " + next.msg);
|
|
6045
|
-
}
|
|
6046
|
-
}
|
|
6047
|
-
requester.Requester = Requester;
|
|
6048
|
-
return requester;
|
|
6049
|
-
}
|
|
6050
5979
|
var objectModel = {};
|
|
6051
5980
|
var entityTable = {};
|
|
6052
5981
|
var hasRequiredEntityTable;
|
|
@@ -8836,6 +8765,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
8836
8765
|
table.getHostIndex(index2).then((v) => result.hostIndex = v),
|
|
8837
8766
|
table.getFromRoomIndex(index2).then((v) => result.fromRoomIndex = v),
|
|
8838
8767
|
table.getToRoomIndex(index2).then((v) => result.toRoomIndex = v),
|
|
8768
|
+
table.getSuperComponentIndex(index2).then((v) => result.superComponentIndex = v),
|
|
8839
8769
|
table.getElementIndex(index2).then((v) => result.elementIndex = v)
|
|
8840
8770
|
]);
|
|
8841
8771
|
return result;
|
|
@@ -8888,6 +8818,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
8888
8818
|
let hostIndex;
|
|
8889
8819
|
let fromRoomIndex;
|
|
8890
8820
|
let toRoomIndex;
|
|
8821
|
+
let superComponentIndex;
|
|
8891
8822
|
let elementIndex;
|
|
8892
8823
|
await Promise.all([
|
|
8893
8824
|
(async () => {
|
|
@@ -8971,6 +8902,9 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
8971
8902
|
(async () => {
|
|
8972
8903
|
toRoomIndex = await localTable.getNumberArray("index:Vim.Room:ToRoom");
|
|
8973
8904
|
})(),
|
|
8905
|
+
(async () => {
|
|
8906
|
+
superComponentIndex = await localTable.getNumberArray("index:Vim.Element:SuperComponent");
|
|
8907
|
+
})(),
|
|
8974
8908
|
(async () => {
|
|
8975
8909
|
elementIndex = await localTable.getNumberArray("index:Vim.Element:Element");
|
|
8976
8910
|
})()
|
|
@@ -9007,6 +8941,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9007
8941
|
hostIndex: hostIndex ? hostIndex[i2] : void 0,
|
|
9008
8942
|
fromRoomIndex: fromRoomIndex ? fromRoomIndex[i2] : void 0,
|
|
9009
8943
|
toRoomIndex: toRoomIndex ? toRoomIndex[i2] : void 0,
|
|
8944
|
+
superComponentIndex: superComponentIndex ? superComponentIndex[i2] : void 0,
|
|
9010
8945
|
elementIndex: elementIndex ? elementIndex[i2] : void 0
|
|
9011
8946
|
});
|
|
9012
8947
|
}
|
|
@@ -9206,6 +9141,20 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
9206
9141
|
}
|
|
9207
9142
|
return await ((_a2 = this.document.room) == null ? void 0 : _a2.get(index2));
|
|
9208
9143
|
}
|
|
9144
|
+
async getSuperComponentIndex(familyInstanceIndex) {
|
|
9145
|
+
return await this.entityTable.getNumber(familyInstanceIndex, "index:Vim.Element:SuperComponent");
|
|
9146
|
+
}
|
|
9147
|
+
async getAllSuperComponentIndex() {
|
|
9148
|
+
return await this.entityTable.getNumberArray("index:Vim.Element:SuperComponent");
|
|
9149
|
+
}
|
|
9150
|
+
async getSuperComponent(familyInstanceIndex) {
|
|
9151
|
+
var _a2;
|
|
9152
|
+
const index2 = await this.getSuperComponentIndex(familyInstanceIndex);
|
|
9153
|
+
if (index2 === void 0) {
|
|
9154
|
+
return void 0;
|
|
9155
|
+
}
|
|
9156
|
+
return await ((_a2 = this.document.element) == null ? void 0 : _a2.get(index2));
|
|
9157
|
+
}
|
|
9209
9158
|
async getElementIndex(familyInstanceIndex) {
|
|
9210
9159
|
return await this.entityTable.getNumber(familyInstanceIndex, "index:Vim.Element:Element");
|
|
9211
9160
|
}
|
|
@@ -13378,7 +13327,6 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
13378
13327
|
__exportStar(requireG3dScene(), exports2);
|
|
13379
13328
|
__exportStar(requireRemoteBuffer(), exports2);
|
|
13380
13329
|
__exportStar(requireRequestTracker(), exports2);
|
|
13381
|
-
__exportStar(requireRequester(), exports2);
|
|
13382
13330
|
__exportStar(requireRemoteValue(), exports2);
|
|
13383
13331
|
__exportStar(requireVimHeader(), exports2);
|
|
13384
13332
|
__exportStar(requireObjectModel(), exports2);
|
|
@@ -47943,6 +47891,7 @@ void main() {
|
|
|
47943
47891
|
}
|
|
47944
47892
|
function createMaskMaterial() {
|
|
47945
47893
|
return new ShaderMaterial({
|
|
47894
|
+
side: DoubleSide,
|
|
47946
47895
|
uniforms: {},
|
|
47947
47896
|
clipping: true,
|
|
47948
47897
|
vertexShader: `
|
|
@@ -50219,10 +50168,10 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
50219
50168
|
background: { color: new Color(12698310) },
|
|
50220
50169
|
skybox: {
|
|
50221
50170
|
enable: true,
|
|
50222
|
-
skyColor: new Color(
|
|
50223
|
-
//
|
|
50224
|
-
groundColor: new Color(
|
|
50225
|
-
//
|
|
50171
|
+
skyColor: new Color(16777215),
|
|
50172
|
+
// white
|
|
50173
|
+
groundColor: new Color(16185078),
|
|
50174
|
+
// less white
|
|
50226
50175
|
sharpness: 2
|
|
50227
50176
|
},
|
|
50228
50177
|
groundPlane: {
|
|
@@ -53658,7 +53607,7 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
53658
53607
|
onUpdate() {
|
|
53659
53608
|
this.updateScale();
|
|
53660
53609
|
this.setPosition(this._camera.target);
|
|
53661
|
-
this.show(
|
|
53610
|
+
this.show(this._inputs.pointerActive === "orbit");
|
|
53662
53611
|
}
|
|
53663
53612
|
/**
|
|
53664
53613
|
* Determines whether the orbit gizmo is enabled.
|
|
@@ -53680,6 +53629,7 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
53680
53629
|
}
|
|
53681
53630
|
clearTimeout(this._timeout);
|
|
53682
53631
|
this._gizmos.visible = show;
|
|
53632
|
+
this._renderer.needsUpdate = true;
|
|
53683
53633
|
if (show) {
|
|
53684
53634
|
this._timeout = setTimeout(() => {
|
|
53685
53635
|
this._gizmos.visible = false;
|
|
@@ -55286,6 +55236,15 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
55286
55236
|
this.reg(canvas, "pointerdown", this.onMouseDown.bind(this));
|
|
55287
55237
|
this.reg(canvas, "pointermove", this.onMouseMove.bind(this));
|
|
55288
55238
|
this.reg(canvas, "pointerup", this.onMouseUp.bind(this));
|
|
55239
|
+
this.reg(canvas, "pointerleave", this.onPointerLeave.bind(this));
|
|
55240
|
+
}
|
|
55241
|
+
onPointerLeave(event) {
|
|
55242
|
+
var _a2;
|
|
55243
|
+
if (this.capturedId !== void 0) {
|
|
55244
|
+
return;
|
|
55245
|
+
}
|
|
55246
|
+
this.faceNormal.set(0, 0, 0);
|
|
55247
|
+
(_a2 = this.onFaceEnter) == null ? void 0 : _a2.call(this, this.faceNormal);
|
|
55289
55248
|
}
|
|
55290
55249
|
capturePointer(pointerId) {
|
|
55291
55250
|
this.releasePointer();
|
|
@@ -58177,6 +58136,9 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
58177
58136
|
get url() {
|
|
58178
58137
|
return this._messenger.url;
|
|
58179
58138
|
}
|
|
58139
|
+
get connected() {
|
|
58140
|
+
return this._messenger.state.status === "connected";
|
|
58141
|
+
}
|
|
58180
58142
|
RPCAddNodeFlags(componentHandle, nodes, flags) {
|
|
58181
58143
|
const marshal = new Marshal();
|
|
58182
58144
|
marshal.writeString("RPCAddNodeFlags");
|
|
@@ -58873,6 +58835,9 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
58873
58835
|
get url() {
|
|
58874
58836
|
return this.rpc.url;
|
|
58875
58837
|
}
|
|
58838
|
+
get connected() {
|
|
58839
|
+
return this.rpc.connected;
|
|
58840
|
+
}
|
|
58876
58841
|
/*******************************************************************************
|
|
58877
58842
|
* SCENE MANAGEMENT METHODS
|
|
58878
58843
|
* Methods for managing the overall scene, including initialization, lighting,
|
|
@@ -59209,15 +59174,15 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
59209
59174
|
******************************************************************************/
|
|
59210
59175
|
/**
|
|
59211
59176
|
* Loads a VIM file from the local filesystem.
|
|
59212
|
-
* @param
|
|
59177
|
+
* @param source - The path to the VIM file (supports file:// protocol)
|
|
59213
59178
|
* @returns Promise resolving to the handle of the loaded VIM component
|
|
59214
59179
|
* @throws {Error} If the filename is invalid or empty
|
|
59215
59180
|
*/
|
|
59216
|
-
async RPCLoadVim(
|
|
59217
|
-
if (!Validation.isNonEmptyString(
|
|
59218
|
-
|
|
59181
|
+
async RPCLoadVim(source) {
|
|
59182
|
+
if (!Validation.isNonEmptyString(source.url)) return INVALID_HANDLE;
|
|
59183
|
+
const url = source.url.replace("file:///", "file://");
|
|
59219
59184
|
return await this.safeCall(
|
|
59220
|
-
() => this.rpc.RPCLoadVim(
|
|
59185
|
+
() => this.rpc.RPCLoadVim(url),
|
|
59221
59186
|
INVALID_HANDLE
|
|
59222
59187
|
);
|
|
59223
59188
|
}
|
|
@@ -59227,10 +59192,10 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
59227
59192
|
* @returns Promise resolving to the handle of the loaded VIM component
|
|
59228
59193
|
* @throws {Error} If the URL is invalid
|
|
59229
59194
|
*/
|
|
59230
|
-
async RPCLoadVimURL(
|
|
59231
|
-
if (!Validation.isURL(url)) return INVALID_HANDLE;
|
|
59195
|
+
async RPCLoadVimURL(source) {
|
|
59196
|
+
if (!Validation.isURL(source.url)) return INVALID_HANDLE;
|
|
59232
59197
|
return await this.safeCall(
|
|
59233
|
-
() => this.rpc.RPCLoadVimURL(url, ""),
|
|
59198
|
+
() => this.rpc.RPCLoadVimURL(source.url, source.authToken ?? ""),
|
|
59234
59199
|
INVALID_HANDLE
|
|
59235
59200
|
);
|
|
59236
59201
|
}
|
|
@@ -59614,9 +59579,9 @@ data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAZAAAAGQCAYAAACAvzbMAAAAAXNSR0IArs
|
|
|
59614
59579
|
this._inputsMouse = new InputMouse(this._canvas, this._rpc, selection, camera2);
|
|
59615
59580
|
this._inputsTouch = new InputTouch(this._canvas, this._rpc);
|
|
59616
59581
|
this._keyboard = new InputKeyboard(this._rpc, selection, camera2, this);
|
|
59617
|
-
this.register();
|
|
59618
59582
|
}
|
|
59619
59583
|
onConnect() {
|
|
59584
|
+
this.register();
|
|
59620
59585
|
this._rpc.RPCSetMoveSpeed(this._moveSpeed);
|
|
59621
59586
|
}
|
|
59622
59587
|
register() {
|
|
@@ -59862,7 +59827,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59862
59827
|
* Disconnects from the current WebSocket server.
|
|
59863
59828
|
*/
|
|
59864
59829
|
disconnect(error) {
|
|
59865
|
-
this._logger.log("Disconnecting from "
|
|
59830
|
+
this._logger.log("Disconnecting from: ", this._connectingUrl);
|
|
59866
59831
|
this._connectingUrl = void 0;
|
|
59867
59832
|
this._disconnect(error);
|
|
59868
59833
|
}
|
|
@@ -59948,7 +59913,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
59948
59913
|
this._disconnect(issues);
|
|
59949
59914
|
return;
|
|
59950
59915
|
}
|
|
59951
|
-
this._logger.log("Connected to "
|
|
59916
|
+
this._logger.log("Connected to: ", (_a2 = this._socket) == null ? void 0 : _a2.url);
|
|
59952
59917
|
this.updateState({ status: "connected" });
|
|
59953
59918
|
this._streamLogger.startLoggging();
|
|
59954
59919
|
this._connectPromise.resolve();
|
|
@@ -60261,7 +60226,10 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60261
60226
|
this._logger.error("Error decoding video chunk: ", e);
|
|
60262
60227
|
}
|
|
60263
60228
|
}
|
|
60264
|
-
this._firstDecoded
|
|
60229
|
+
if (!this._firstDecoded) {
|
|
60230
|
+
this._firstDecoded = true;
|
|
60231
|
+
this._logger.log("First frame decoded");
|
|
60232
|
+
}
|
|
60265
60233
|
}
|
|
60266
60234
|
/**
|
|
60267
60235
|
* Clears the decoder state and renderer buffer.
|
|
@@ -60471,16 +60439,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60471
60439
|
if (this._request) {
|
|
60472
60440
|
return this._request;
|
|
60473
60441
|
}
|
|
60474
|
-
this._logger.log("Loading "
|
|
60442
|
+
this._logger.log("Loading: ", this.source);
|
|
60475
60443
|
this._request = new LoadRequest$1();
|
|
60476
60444
|
this._load(this.source, this._request).then(async (request2) => {
|
|
60477
60445
|
const result = await request2.getResult();
|
|
60478
60446
|
if (result.isSuccess) {
|
|
60479
|
-
this._logger.log(
|
|
60447
|
+
this._logger.log("Successfully loaded vim: ", this.source);
|
|
60480
60448
|
this.reapplyNodes();
|
|
60481
60449
|
this.reapplyColors();
|
|
60482
60450
|
} else {
|
|
60483
|
-
this._logger.log(
|
|
60451
|
+
this._logger.log("Failed to load vim: ", this.source);
|
|
60484
60452
|
}
|
|
60485
60453
|
});
|
|
60486
60454
|
return this._request;
|
|
@@ -60513,18 +60481,19 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60513
60481
|
}
|
|
60514
60482
|
/**
|
|
60515
60483
|
* Requests for the server to load the given URL or file path.
|
|
60516
|
-
* @param
|
|
60484
|
+
* @param source - The URL or file path to load.
|
|
60517
60485
|
* @param result - The load request object to update.
|
|
60518
60486
|
* @returns The updated load request.
|
|
60519
60487
|
*/
|
|
60520
|
-
async _load(
|
|
60521
|
-
const handle = await this._getHandle(
|
|
60488
|
+
async _load(source, result) {
|
|
60489
|
+
const handle = await this._getHandle(source, result);
|
|
60522
60490
|
if (result.isCompleted || handle === INVALID_HANDLE) {
|
|
60523
60491
|
return result;
|
|
60524
60492
|
}
|
|
60525
60493
|
while (true) {
|
|
60526
60494
|
try {
|
|
60527
60495
|
const state = await this._rpc.RPCGetVimLoadingState(handle);
|
|
60496
|
+
this._logger.log("state :", state);
|
|
60528
60497
|
result.onProgress(state.progress);
|
|
60529
60498
|
switch (state.status) {
|
|
60530
60499
|
// Keep waiting for the loading to complete
|
|
@@ -60561,16 +60530,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60561
60530
|
return "unknown";
|
|
60562
60531
|
}
|
|
60563
60532
|
}
|
|
60564
|
-
async _getHandle(
|
|
60533
|
+
async _getHandle(source, result) {
|
|
60565
60534
|
let handle = void 0;
|
|
60566
60535
|
try {
|
|
60567
|
-
if (isURL(url)) {
|
|
60568
|
-
handle = await this._rpc.RPCLoadVimURL(
|
|
60569
|
-
} else if (isFileURI(url)) {
|
|
60570
|
-
handle = await this._rpc.RPCLoadVim(
|
|
60536
|
+
if (isURL(source.url)) {
|
|
60537
|
+
handle = await this._rpc.RPCLoadVimURL(source);
|
|
60538
|
+
} else if (isFileURI(source.url)) {
|
|
60539
|
+
handle = await this._rpc.RPCLoadVim(source);
|
|
60571
60540
|
} else {
|
|
60572
60541
|
console.log("Defaulting to file path");
|
|
60573
|
-
handle = await this._rpc.RPCLoadVim(
|
|
60542
|
+
handle = await this._rpc.RPCLoadVim(source);
|
|
60574
60543
|
}
|
|
60575
60544
|
} catch (e) {
|
|
60576
60545
|
result.error("downloadingError", e.message);
|
|
@@ -60580,6 +60549,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60580
60549
|
result.error("downloadingError");
|
|
60581
60550
|
return INVALID_HANDLE;
|
|
60582
60551
|
}
|
|
60552
|
+
console.log("handle :", handle);
|
|
60583
60553
|
return handle;
|
|
60584
60554
|
}
|
|
60585
60555
|
/**
|
|
@@ -60785,13 +60755,27 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60785
60755
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
60786
60756
|
}
|
|
60787
60757
|
const defaultLogger = {
|
|
60788
|
-
log: (message) => {
|
|
60789
|
-
|
|
60758
|
+
log: (message, obj) => {
|
|
60759
|
+
const caller = getCaller();
|
|
60760
|
+
const msg = `VIM Ultra : ${message}`;
|
|
60761
|
+
if (obj) {
|
|
60762
|
+
console.log(msg, obj, { caller });
|
|
60763
|
+
} else {
|
|
60764
|
+
console.log(msg, { caller });
|
|
60765
|
+
}
|
|
60790
60766
|
},
|
|
60791
60767
|
error: (message, e) => {
|
|
60792
|
-
console.error("VIM Ultra
|
|
60768
|
+
console.error("VIM Ultra " + message, e);
|
|
60793
60769
|
}
|
|
60794
60770
|
};
|
|
60771
|
+
function getCaller() {
|
|
60772
|
+
const stack = new Error().stack;
|
|
60773
|
+
if (!stack) return "";
|
|
60774
|
+
const files = stack.split("/");
|
|
60775
|
+
const file = files[files.length - 1];
|
|
60776
|
+
const clean = file.replace(/\?[^:]+/, "");
|
|
60777
|
+
return clean;
|
|
60778
|
+
}
|
|
60795
60779
|
function debounce(func, delay) {
|
|
60796
60780
|
let timeoutId;
|
|
60797
60781
|
return [function(...args) {
|
|
@@ -60809,14 +60793,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60809
60793
|
* @param canvas - The HTML canvas element to observe and manage
|
|
60810
60794
|
* @param rpc - RPC client for viewport communication
|
|
60811
60795
|
*/
|
|
60812
|
-
constructor(canvas, rpc) {
|
|
60796
|
+
constructor(canvas, rpc, logger) {
|
|
60813
60797
|
/** The HTML canvas element used for rendering */
|
|
60814
60798
|
__publicField(this, "canvas");
|
|
60815
60799
|
__publicField(this, "_rpc");
|
|
60800
|
+
__publicField(this, "_logger");
|
|
60816
60801
|
__publicField(this, "_observer");
|
|
60817
60802
|
__publicField(this, "_clearTimeout");
|
|
60818
60803
|
this.canvas = canvas;
|
|
60819
60804
|
this._rpc = rpc;
|
|
60805
|
+
this._logger = logger;
|
|
60820
60806
|
const [debounced, clear] = debounce(() => this.onResize(), 250);
|
|
60821
60807
|
this._observer = new ResizeObserver(debounced);
|
|
60822
60808
|
this._observer.observe(canvas);
|
|
@@ -60827,14 +60813,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
60827
60813
|
* @private
|
|
60828
60814
|
*/
|
|
60829
60815
|
onResize() {
|
|
60830
|
-
|
|
60816
|
+
this._logger.log("Canvas resized to :", { x: this.canvas.offsetWidth, y: this.canvas.offsetHeight });
|
|
60831
60817
|
this.update();
|
|
60832
60818
|
}
|
|
60833
60819
|
/**
|
|
60834
60820
|
* Updates the aspect ratio of the viewport on the server
|
|
60835
60821
|
*/
|
|
60836
60822
|
update() {
|
|
60837
|
-
this._rpc.
|
|
60823
|
+
if (this._rpc.connected) {
|
|
60824
|
+
this._rpc.RPCSetAspectRatio(this.canvas.offsetWidth, this.canvas.offsetHeight);
|
|
60825
|
+
}
|
|
60838
60826
|
}
|
|
60839
60827
|
/**
|
|
60840
60828
|
* Cleans up resources by removing resize observer and clearing timeouts
|
|
@@ -61372,7 +61360,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61372
61360
|
const defaultRenderSettings = {
|
|
61373
61361
|
...defaultSceneSettings,
|
|
61374
61362
|
lockIblRotation: true,
|
|
61375
|
-
ghostColor: new RGBA(
|
|
61363
|
+
ghostColor: new RGBA(14 / 255, 14 / 255, 14 / 255, 1 / 255)
|
|
61376
61364
|
};
|
|
61377
61365
|
class Renderer {
|
|
61378
61366
|
/**
|
|
@@ -61380,14 +61368,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61380
61368
|
* @param rpc - RPC client for communication with the rendering backend
|
|
61381
61369
|
* @param settings - Optional partial render settings to override defaults
|
|
61382
61370
|
*/
|
|
61383
|
-
constructor(rpc, settings2 = {}) {
|
|
61371
|
+
constructor(rpc, logger, settings2 = {}) {
|
|
61384
61372
|
__publicField(this, "_rpc");
|
|
61373
|
+
__publicField(this, "_logger");
|
|
61385
61374
|
__publicField(this, "_settings");
|
|
61386
61375
|
__publicField(this, "_animationFrame");
|
|
61387
61376
|
__publicField(this, "_updateLighting", false);
|
|
61388
61377
|
__publicField(this, "_updateGhostColor", false);
|
|
61389
61378
|
__publicField(this, "_updateIblRotation", false);
|
|
61390
61379
|
this._rpc = rpc;
|
|
61380
|
+
this._logger = logger;
|
|
61391
61381
|
this._settings = { ...defaultRenderSettings, ...settings2 };
|
|
61392
61382
|
}
|
|
61393
61383
|
/**
|
|
@@ -61396,8 +61386,12 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61396
61386
|
*/
|
|
61397
61387
|
async validateConnection() {
|
|
61398
61388
|
const success = await this._rpc.RPCStartScene(this._settings);
|
|
61399
|
-
if (success)
|
|
61389
|
+
if (success) {
|
|
61390
|
+
this._logger.log("Scene stream started successfully");
|
|
61391
|
+
return void 0;
|
|
61392
|
+
}
|
|
61400
61393
|
const error = await this._rpc.RPCGetLastError();
|
|
61394
|
+
this._logger.error("Failed to start scene stream", error);
|
|
61401
61395
|
return {
|
|
61402
61396
|
status: "error",
|
|
61403
61397
|
error: "stream",
|
|
@@ -61622,10 +61616,10 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61622
61616
|
this.rpc = new RpcSafeClient(new RpcClient(this._socketClient));
|
|
61623
61617
|
this._canvas = canvas;
|
|
61624
61618
|
this._vims = new VimCollection();
|
|
61625
|
-
this._viewport = new Viewport(canvas, this.rpc);
|
|
61619
|
+
this._viewport = new Viewport(canvas, this.rpc, this._logger);
|
|
61626
61620
|
this._decoder = new Decoder(canvas, this._logger);
|
|
61627
61621
|
this._selection = new ViewerSelection(this.rpc, this._vims);
|
|
61628
|
-
this._renderer = new Renderer(this.rpc);
|
|
61622
|
+
this._renderer = new Renderer(this.rpc, this._logger);
|
|
61629
61623
|
this.colors = new ColorManager(this.rpc);
|
|
61630
61624
|
this._camera = new Camera(this.rpc);
|
|
61631
61625
|
this._input = new Inputs(canvas, this.rpc, this._selection, this._camera, this._renderer);
|
|
@@ -61734,6 +61728,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61734
61728
|
const remoteVersion = parseVersion(version2);
|
|
61735
61729
|
const localParsedVersion = parseVersion(localVersion);
|
|
61736
61730
|
if (localParsedVersion.major !== remoteVersion.major) {
|
|
61731
|
+
this._logger.error("Major version mismatch", { local: localParsedVersion, remote: remoteVersion });
|
|
61737
61732
|
return {
|
|
61738
61733
|
status: "error",
|
|
61739
61734
|
error: "compatibility",
|
|
@@ -61742,6 +61737,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61742
61737
|
serverVersion: version2
|
|
61743
61738
|
};
|
|
61744
61739
|
}
|
|
61740
|
+
this._logger.log("API version check passed", { local: localParsedVersion, remote: remoteVersion });
|
|
61745
61741
|
return void 0;
|
|
61746
61742
|
}
|
|
61747
61743
|
/**
|
|
@@ -61771,16 +61767,16 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
61771
61767
|
}
|
|
61772
61768
|
/**
|
|
61773
61769
|
* Requests the server to load the given URL or file path.
|
|
61774
|
-
* @param
|
|
61770
|
+
* @param source - The path or URL to the VIM file.
|
|
61775
61771
|
* @returns A load request object that can be used to wait for the load to complete.
|
|
61776
61772
|
*/
|
|
61777
|
-
loadVim(
|
|
61778
|
-
if (typeof
|
|
61773
|
+
loadVim(source) {
|
|
61774
|
+
if (typeof source.url !== "string" || source.url.trim() === "") {
|
|
61779
61775
|
const request22 = new LoadRequest$1();
|
|
61780
61776
|
request22.error("loadingError", "Invalid path");
|
|
61781
61777
|
return request22;
|
|
61782
61778
|
}
|
|
61783
|
-
const vim = new Vim(this.rpc, this.colors,
|
|
61779
|
+
const vim = new Vim(this.rpc, this.colors, source, this._logger);
|
|
61784
61780
|
this._vims.add(vim);
|
|
61785
61781
|
const request2 = vim.connect();
|
|
61786
61782
|
request2.getResult().then((result) => {
|
|
@@ -74265,6 +74261,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
74265
74261
|
relay("pointerdown", (s, e) => new PointerEvent(s, e), false);
|
|
74266
74262
|
relay("pointermove", (s, e) => new PointerEvent(s, e), false);
|
|
74267
74263
|
relay("pointerup", (s, e) => new PointerEvent(s, e), false);
|
|
74264
|
+
relay("pointerenter", (s, e) => new PointerEvent(s, e));
|
|
74265
|
+
relay("pointerleave", (s, e) => new PointerEvent(s, e));
|
|
74268
74266
|
relay("touchstart", (s, e) => new TouchEvent(s, e), false);
|
|
74269
74267
|
relay("touchend", (s, e) => new TouchEvent(s, e), false);
|
|
74270
74268
|
relay("touchmove", (s, e) => new TouchEvent(s, e), false);
|
|
@@ -75708,18 +75706,18 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75708
75706
|
}
|
|
75709
75707
|
return true;
|
|
75710
75708
|
}
|
|
75711
|
-
function serverFileDownloadingError(url, server) {
|
|
75709
|
+
function serverFileDownloadingError(url, authToken, server) {
|
|
75712
75710
|
if (isFilePathOrUri(url)) {
|
|
75713
75711
|
return fileOpeningError(url);
|
|
75714
75712
|
}
|
|
75715
75713
|
return {
|
|
75716
75714
|
title: "File Downloading Error",
|
|
75717
|
-
body: body$4(server,
|
|
75715
|
+
body: body$4(server, authToken, server),
|
|
75718
75716
|
footer: footer(support),
|
|
75719
75717
|
canClose: false
|
|
75720
75718
|
};
|
|
75721
75719
|
}
|
|
75722
|
-
function body$4(server,
|
|
75720
|
+
function body$4(url, server, authToken) {
|
|
75723
75721
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
|
|
75724
75722
|
mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
75725
75723
|
"Oops, it appears that there’s an ",
|
|
@@ -75729,7 +75727,8 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75729
75727
|
subTitle("Error details:"),
|
|
75730
75728
|
dotList([
|
|
75731
75729
|
server ? bullet("VIM ULTRA Server:", server) : null,
|
|
75732
|
-
bullet("File URL:", url)
|
|
75730
|
+
bullet("File URL:", url),
|
|
75731
|
+
authToken ? bullet("Auth Token:", authToken) : null``
|
|
75733
75732
|
]),
|
|
75734
75733
|
subTitle("Troubleshooting tips:"),
|
|
75735
75734
|
numList([
|
|
@@ -75834,7 +75833,7 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75834
75833
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: vcRoboto, children: [
|
|
75835
75834
|
mainText(/* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
75836
75835
|
"Oops, it appears that there’s an ",
|
|
75837
|
-
bold("error starting a stream on the VIM
|
|
75836
|
+
bold("error starting a stream on the VIM Ultra Server"),
|
|
75838
75837
|
". Please check the following conditions to get back up and running quickly."
|
|
75839
75838
|
] })),
|
|
75840
75839
|
subTitle("Troubleshooting tips:"),
|
|
@@ -75865,17 +75864,17 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75865
75864
|
return serverStreamError(state.serverUrl);
|
|
75866
75865
|
}
|
|
75867
75866
|
}
|
|
75868
|
-
function getRequestErrorMessage(
|
|
75867
|
+
function getRequestErrorMessage(source, error) {
|
|
75869
75868
|
console.log(error);
|
|
75870
75869
|
switch (error) {
|
|
75871
75870
|
case "loadingError":
|
|
75872
|
-
return serverFileLoadingError(url);
|
|
75871
|
+
return serverFileLoadingError(source.url);
|
|
75873
75872
|
case "downloadingError":
|
|
75874
75873
|
case "unknown":
|
|
75875
75874
|
case "cancelled":
|
|
75876
|
-
return serverFileDownloadingError(url);
|
|
75875
|
+
return serverFileDownloadingError(source.url);
|
|
75877
75876
|
case "serverDisconnected":
|
|
75878
|
-
return serverConnectionError(url);
|
|
75877
|
+
return serverConnectionError(source.url);
|
|
75879
75878
|
}
|
|
75880
75879
|
}
|
|
75881
75880
|
function createUltraComponent(container) {
|
|
@@ -75930,13 +75929,13 @@ Averrage Date/Second ${avgDataRatePS} kb
|
|
|
75930
75929
|
}
|
|
75931
75930
|
}
|
|
75932
75931
|
function ToRef(viewer, modal) {
|
|
75933
|
-
function load(
|
|
75934
|
-
const request2 = viewer.loadVim(
|
|
75932
|
+
function load(source) {
|
|
75933
|
+
const request2 = viewer.loadVim(source);
|
|
75935
75934
|
void updateProgress(request2, modal);
|
|
75936
75935
|
void request2.getResult().then(
|
|
75937
75936
|
(result) => {
|
|
75938
75937
|
if (result.isError) {
|
|
75939
|
-
modal.message(getRequestErrorMessage(
|
|
75938
|
+
modal.message(getRequestErrorMessage(source, result.error));
|
|
75940
75939
|
return;
|
|
75941
75940
|
}
|
|
75942
75941
|
if (result.isSuccess) {
|