@netless/window-manager 1.0.13-test.2 → 1.0.13-test.20
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/index.d.ts +33 -1
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +552 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AppListener.ts +1 -20
- package/src/AppManager.ts +29 -4
- package/src/AttributesDelegate.ts +7 -5
- package/src/ContainerResizeObserver.ts +15 -4
- package/src/InternalEmitter.ts +1 -0
- package/src/Utils/Common.ts +0 -1
- package/src/Utils/Reactive.ts +2 -2
- package/src/Utils/RoomHacker.ts +18 -1
- package/src/Utils/log.ts +37 -0
- package/src/View/MainView.ts +124 -12
- package/src/index.ts +451 -3
package/dist/index.mjs
CHANGED
|
@@ -352,7 +352,6 @@ const setScenePath = (room, scenePath) => {
|
|
|
352
352
|
if (room && room.isWritable) {
|
|
353
353
|
if (room.state.sceneState.scenePath !== scenePath) {
|
|
354
354
|
const nextScenePath = scenePath === "/" ? "" : scenePath;
|
|
355
|
-
console.log("[window-manager] real setScenePath for current room====>", nextScenePath);
|
|
356
355
|
room.setScenePath(nextScenePath);
|
|
357
356
|
}
|
|
358
357
|
}
|
|
@@ -464,7 +463,7 @@ class AppListeners {
|
|
|
464
463
|
break;
|
|
465
464
|
}
|
|
466
465
|
case Events.SetMainViewScenePath: {
|
|
467
|
-
console.log("[window-manager] mainMagixEventListener
|
|
466
|
+
console.log("[window-manager] mainMagixEventListener " + JSON.stringify(data.payload));
|
|
468
467
|
this.setMainViewScenePathHandler(data.payload);
|
|
469
468
|
break;
|
|
470
469
|
}
|
|
@@ -5697,6 +5696,35 @@ const log = (...args) => {
|
|
|
5697
5696
|
console.log(`[WindowManager]:`, ...args);
|
|
5698
5697
|
}
|
|
5699
5698
|
};
|
|
5699
|
+
class LocalConsole {
|
|
5700
|
+
constructor(name, debounceTime) {
|
|
5701
|
+
this.name = name;
|
|
5702
|
+
this.debounceTime = debounceTime;
|
|
5703
|
+
this.pendingArgs = null;
|
|
5704
|
+
this.flushTimer = null;
|
|
5705
|
+
}
|
|
5706
|
+
flush() {
|
|
5707
|
+
this.flushTimer = null;
|
|
5708
|
+
const args = this.pendingArgs;
|
|
5709
|
+
this.pendingArgs = null;
|
|
5710
|
+
if (args === null) {
|
|
5711
|
+
return;
|
|
5712
|
+
}
|
|
5713
|
+
console.log(`[window-manager][${this.name}]: ${args.join(", ")}`);
|
|
5714
|
+
}
|
|
5715
|
+
log(...args) {
|
|
5716
|
+
const ms = this.debounceTime;
|
|
5717
|
+
if (ms != null && ms > 0) {
|
|
5718
|
+
this.pendingArgs = args;
|
|
5719
|
+
if (this.flushTimer != null) {
|
|
5720
|
+
clearTimeout(this.flushTimer);
|
|
5721
|
+
}
|
|
5722
|
+
this.flushTimer = setTimeout(() => this.flush(), ms);
|
|
5723
|
+
return;
|
|
5724
|
+
}
|
|
5725
|
+
console.log(`[window-manager][${this.name}]: ${args.join(", ")}`);
|
|
5726
|
+
}
|
|
5727
|
+
}
|
|
5700
5728
|
const setupWrapper = (root) => {
|
|
5701
5729
|
const playground = document.createElement("div");
|
|
5702
5730
|
playground.className = "netless-window-manager-playground";
|
|
@@ -7004,6 +7032,7 @@ var Fields = /* @__PURE__ */ ((Fields2) => {
|
|
|
7004
7032
|
class AttributesDelegate {
|
|
7005
7033
|
constructor(context) {
|
|
7006
7034
|
this.context = context;
|
|
7035
|
+
this.setMainViewCameraConsole = new LocalConsole("setMainViewCamera", 30);
|
|
7007
7036
|
this.setAppFocus = (appId, focus) => {
|
|
7008
7037
|
if (focus) {
|
|
7009
7038
|
this.context.safeSetAttributes({ ["focus"]: appId });
|
|
@@ -7129,11 +7158,11 @@ class AttributesDelegate {
|
|
|
7129
7158
|
return this.attributes["boxState"];
|
|
7130
7159
|
}
|
|
7131
7160
|
setMainViewScenePath(scenePath) {
|
|
7132
|
-
console.log("[window-manager] setMainViewScenePath
|
|
7161
|
+
console.log("[window-manager] setMainViewScenePath " + scenePath);
|
|
7133
7162
|
this.context.safeSetAttributes({ _mainScenePath: scenePath });
|
|
7134
7163
|
}
|
|
7135
7164
|
setMainViewSceneIndex(index2) {
|
|
7136
|
-
console.log("[window-manager] setMainViewSceneIndex
|
|
7165
|
+
console.log("[window-manager] setMainViewSceneIndex " + index2);
|
|
7137
7166
|
this.context.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
7138
7167
|
}
|
|
7139
7168
|
getMainViewCamera() {
|
|
@@ -7143,19 +7172,19 @@ class AttributesDelegate {
|
|
|
7143
7172
|
return get(this.attributes, ["mainViewSize"]);
|
|
7144
7173
|
}
|
|
7145
7174
|
setMainViewCamera(camera) {
|
|
7146
|
-
|
|
7175
|
+
this.setMainViewCameraConsole.log(JSON.stringify(camera));
|
|
7147
7176
|
this.context.safeSetAttributes({ ["mainViewCamera"]: { ...camera } });
|
|
7148
7177
|
}
|
|
7149
7178
|
setMainViewSize(size2) {
|
|
7150
7179
|
if (size2.width === 0 || size2.height === 0)
|
|
7151
7180
|
return;
|
|
7152
|
-
console.log("[window-manager] setMainViewSize
|
|
7181
|
+
console.log("[window-manager] setMainViewSize size:" + JSON.stringify(size2));
|
|
7153
7182
|
this.context.safeSetAttributes({ ["mainViewSize"]: { ...size2 } });
|
|
7154
7183
|
}
|
|
7155
7184
|
setMainViewCameraAndSize(camera, size2) {
|
|
7156
7185
|
if (size2.width === 0 || size2.height === 0)
|
|
7157
7186
|
return;
|
|
7158
|
-
console.log("[window-manager] setMainViewCameraAndSize
|
|
7187
|
+
console.log("[window-manager] setMainViewCameraAndSize camera:" + JSON.stringify(camera) + ", size:" + JSON.stringify(size2));
|
|
7159
7188
|
this.context.safeSetAttributes({
|
|
7160
7189
|
["mainViewCamera"]: { ...camera },
|
|
7161
7190
|
["mainViewSize"]: { ...size2 }
|
|
@@ -7759,9 +7788,14 @@ class MainViewProxy {
|
|
|
7759
7788
|
this.polling = false;
|
|
7760
7789
|
this.started = false;
|
|
7761
7790
|
this.mainViewIsAddListener = false;
|
|
7791
|
+
this.isForcingMainViewDivElement = false;
|
|
7792
|
+
this.wrapperRectWorkaroundFrame = 0;
|
|
7762
7793
|
this.store = this.manager.store;
|
|
7763
7794
|
this.viewMode = this.manager.windowManger.viewMode;
|
|
7764
7795
|
this.sideEffectManager = new o$2();
|
|
7796
|
+
this.playgroundSizeChangeListenerLocalConsole = new LocalConsole("playgroundSizeChangeListener", 30);
|
|
7797
|
+
this.sizeUpdatedLocalConsole = new LocalConsole("sizeUpdated", 30);
|
|
7798
|
+
this.cameraUpdatedLocalConsole = new LocalConsole("cameraUpdated", 30);
|
|
7765
7799
|
this.syncCamera = () => {
|
|
7766
7800
|
if (!this.polling || this.viewMode !== ViewMode.Broadcaster)
|
|
7767
7801
|
return;
|
|
@@ -7781,6 +7815,32 @@ class MainViewProxy {
|
|
|
7781
7815
|
});
|
|
7782
7816
|
});
|
|
7783
7817
|
};
|
|
7818
|
+
this.onWrapperRectChange = (payload) => {
|
|
7819
|
+
this.pendingWrapperRectChange = payload;
|
|
7820
|
+
if (this.wrapperRectWorkaroundFrame) {
|
|
7821
|
+
cancelAnimationFrame(this.wrapperRectWorkaroundFrame);
|
|
7822
|
+
}
|
|
7823
|
+
this.wrapperRectWorkaroundFrame = requestAnimationFrame(this.runWrapperRectWorkaround);
|
|
7824
|
+
};
|
|
7825
|
+
this.runWrapperRectWorkaround = () => {
|
|
7826
|
+
this.wrapperRectWorkaroundFrame = 0;
|
|
7827
|
+
const payload = this.pendingWrapperRectChange;
|
|
7828
|
+
const element2 = this.mainView.divElement;
|
|
7829
|
+
this.pendingWrapperRectChange = void 0;
|
|
7830
|
+
if (!payload || !element2)
|
|
7831
|
+
return;
|
|
7832
|
+
const rect = element2.getBoundingClientRect();
|
|
7833
|
+
const observedSize = { width: rect.width, height: rect.height };
|
|
7834
|
+
const wrapperMatchesDom = Math.abs(payload.width - observedSize.width) <= 0.5 && Math.abs(payload.height - observedSize.height) <= 0.5;
|
|
7835
|
+
const viewIsStale = Math.abs(this.mainView.size.width - observedSize.width) > 0.5 || Math.abs(this.mainView.size.height - observedSize.height) > 0.5;
|
|
7836
|
+
if (wrapperMatchesDom && viewIsStale) {
|
|
7837
|
+
this.forceSyncMainViewDivElement(
|
|
7838
|
+
`wrapperRectChange:${payload.origin || "unknown"}`,
|
|
7839
|
+
observedSize,
|
|
7840
|
+
element2
|
|
7841
|
+
);
|
|
7842
|
+
}
|
|
7843
|
+
};
|
|
7784
7844
|
this.addCameraReaction = () => {
|
|
7785
7845
|
this.manager.refresher.add(Fields.MainViewCamera, this.cameraReaction);
|
|
7786
7846
|
};
|
|
@@ -7789,7 +7849,7 @@ class MainViewProxy {
|
|
|
7789
7849
|
() => this.mainViewCamera,
|
|
7790
7850
|
(camera) => {
|
|
7791
7851
|
if (camera && camera.id !== this.manager.uid) {
|
|
7792
|
-
console.log("[window-manager] cameraReaction
|
|
7852
|
+
console.log("[window-manager] cameraReaction " + JSON.stringify(camera) + JSON.stringify(this.mainViewSize));
|
|
7793
7853
|
this.moveCameraToContian(this.mainViewSize);
|
|
7794
7854
|
this.moveCamera(camera);
|
|
7795
7855
|
}
|
|
@@ -7801,13 +7861,13 @@ class MainViewProxy {
|
|
|
7801
7861
|
if (size2) {
|
|
7802
7862
|
this.moveCameraToContian(size2);
|
|
7803
7863
|
this.moveCamera(this.mainViewCamera);
|
|
7804
|
-
console.log("[window-manager] sizeChangeHandler
|
|
7864
|
+
console.log("[window-manager] sizeChangeHandler current size and camera" + JSON.stringify(size2) + JSON.stringify(this.mainViewCamera) + JSON.stringify(this.mainView.camera) + JSON.stringify(this.mainView.size));
|
|
7805
7865
|
}
|
|
7806
7866
|
this.ensureMainViewSize();
|
|
7807
7867
|
}, 30);
|
|
7808
7868
|
this.onUpdateContainerSizeRatio = () => {
|
|
7809
7869
|
const size2 = this.store.getMainViewSize();
|
|
7810
|
-
console.log("[window-manager] onUpdateContainerSizeRatio
|
|
7870
|
+
console.log("[window-manager] onUpdateContainerSizeRatio " + JSON.stringify(size2));
|
|
7811
7871
|
this.sizeChangeHandler(size2);
|
|
7812
7872
|
};
|
|
7813
7873
|
this.onCameraUpdatedByDevice = (camera) => {
|
|
@@ -7825,18 +7885,25 @@ class MainViewProxy {
|
|
|
7825
7885
|
this.store.setMainViewSize({ ...size2, id: this.manager.uid });
|
|
7826
7886
|
}, 50);
|
|
7827
7887
|
this._syncMainViewTimer = 0;
|
|
7828
|
-
this.
|
|
7888
|
+
this.handleCameraOrSizeUpdated = () => {
|
|
7829
7889
|
callbacks$1.emit("cameraStateChange", this.cameraState);
|
|
7830
7890
|
if (this.manager.room && this.manager.room.syncMainView) {
|
|
7831
7891
|
clearTimeout(this._syncMainViewTimer);
|
|
7832
7892
|
this._syncMainViewTimer = setTimeout(this.syncMainView, 100, this.manager.room);
|
|
7833
7893
|
}
|
|
7834
|
-
console.log("[window-manager] onCameraOrSizeUpdated====>", JSON.stringify(this.cameraState));
|
|
7835
7894
|
this.ensureMainViewSize();
|
|
7836
7895
|
};
|
|
7896
|
+
this.onCameraUpdated = (camera) => {
|
|
7897
|
+
this.cameraUpdatedLocalConsole.log(JSON.stringify(camera));
|
|
7898
|
+
this.handleCameraOrSizeUpdated();
|
|
7899
|
+
};
|
|
7900
|
+
this.onSizeUpdated = (size2) => {
|
|
7901
|
+
this.sizeUpdatedLocalConsole.log(JSON.stringify(size2));
|
|
7902
|
+
this.handleCameraOrSizeUpdated();
|
|
7903
|
+
};
|
|
7837
7904
|
this.syncMainView = (room) => {
|
|
7838
7905
|
if (room.isWritable) {
|
|
7839
|
-
console.log("[window-manager] syncMainView
|
|
7906
|
+
console.log("[window-manager] syncMainView ");
|
|
7840
7907
|
room.syncMainView(this.mainView);
|
|
7841
7908
|
}
|
|
7842
7909
|
};
|
|
@@ -7852,7 +7919,19 @@ class MainViewProxy {
|
|
|
7852
7919
|
this.startListenWritableChange();
|
|
7853
7920
|
});
|
|
7854
7921
|
const playgroundSizeChangeListener = () => {
|
|
7855
|
-
|
|
7922
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7923
|
+
this.playgroundSizeChangeListenerLocalConsole.log(
|
|
7924
|
+
JSON.stringify(this.mainView.camera),
|
|
7925
|
+
JSON.stringify(this.mainView.size),
|
|
7926
|
+
JSON.stringify(this.mainViewSize),
|
|
7927
|
+
JSON.stringify(this.mainViewCamera),
|
|
7928
|
+
window.outerHeight,
|
|
7929
|
+
window.outerWidth,
|
|
7930
|
+
(_b = (_a = window.visualViewport) == null ? void 0 : _a.width) != null ? _b : "null",
|
|
7931
|
+
(_d = (_c = window.visualViewport) == null ? void 0 : _c.height) != null ? _d : "null",
|
|
7932
|
+
(_f = (_e = window.visualViewport) == null ? void 0 : _e.offsetLeft) != null ? _f : "null",
|
|
7933
|
+
(_h = (_g = window.visualViewport) == null ? void 0 : _g.offsetTop) != null ? _h : "null"
|
|
7934
|
+
);
|
|
7856
7935
|
this.sizeChangeHandler(this.mainViewSize);
|
|
7857
7936
|
};
|
|
7858
7937
|
this.sideEffectManager.add(() => {
|
|
@@ -7861,6 +7940,9 @@ class MainViewProxy {
|
|
|
7861
7940
|
this.sideEffectManager.add(() => {
|
|
7862
7941
|
return internalEmitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio);
|
|
7863
7942
|
});
|
|
7943
|
+
this.sideEffectManager.add(() => {
|
|
7944
|
+
return internalEmitter.on("wrapperRectChange", this.onWrapperRectChange);
|
|
7945
|
+
});
|
|
7864
7946
|
this.sideEffectManager.add(() => {
|
|
7865
7947
|
return internalEmitter.on("startReconnect", () => {
|
|
7866
7948
|
if (!this.didRelease) {
|
|
@@ -7891,8 +7973,41 @@ class MainViewProxy {
|
|
|
7891
7973
|
this.moveCameraToContian(this.mainViewSize);
|
|
7892
7974
|
this.moveCamera(this.mainViewCamera);
|
|
7893
7975
|
}
|
|
7976
|
+
forceSyncMainViewDivElement(reason, observedSize, element2) {
|
|
7977
|
+
const { width: viewWidth, height: viewHeight } = this.mainView.size;
|
|
7978
|
+
if (Math.abs(viewWidth - observedSize.width) <= 0.5 && Math.abs(viewHeight - observedSize.height) <= 0.5) {
|
|
7979
|
+
return;
|
|
7980
|
+
}
|
|
7981
|
+
if (this.isForcingMainViewDivElement) {
|
|
7982
|
+
console.log("[window-manager] skipForceSyncMainViewDivElement " + JSON.stringify({
|
|
7983
|
+
reason,
|
|
7984
|
+
observedSize,
|
|
7985
|
+
viewSize: this.mainView.size
|
|
7986
|
+
}));
|
|
7987
|
+
return;
|
|
7988
|
+
}
|
|
7989
|
+
this.isForcingMainViewDivElement = true;
|
|
7990
|
+
console.log("[window-manager] forceSyncMainViewDivElement " + JSON.stringify({
|
|
7991
|
+
reason,
|
|
7992
|
+
observedSize,
|
|
7993
|
+
viewSize: this.mainView.size,
|
|
7994
|
+
mainViewSize: this.mainViewSize,
|
|
7995
|
+
mainViewCamera: this.mainViewCamera
|
|
7996
|
+
}));
|
|
7997
|
+
this.mainView.divElement = null;
|
|
7998
|
+
this.mainView.divElement = element2;
|
|
7999
|
+
queueMicrotask(() => {
|
|
8000
|
+
const rect = element2.getBoundingClientRect();
|
|
8001
|
+
console.log("[window-manager] forceSyncMainViewDivElementResult " + JSON.stringify({
|
|
8002
|
+
reason,
|
|
8003
|
+
viewSize: this.mainView.size,
|
|
8004
|
+
rect: { width: rect.width, height: rect.height }
|
|
8005
|
+
}));
|
|
8006
|
+
this.isForcingMainViewDivElement = false;
|
|
8007
|
+
});
|
|
8008
|
+
}
|
|
7894
8009
|
start() {
|
|
7895
|
-
console.log("[window-manager] start
|
|
8010
|
+
console.log("[window-manager] start attributes size:" + JSON.stringify(this.mainViewSize));
|
|
7896
8011
|
this.sizeChangeHandler(this.mainViewSize);
|
|
7897
8012
|
if (this.started)
|
|
7898
8013
|
return;
|
|
@@ -7901,6 +8016,10 @@ class MainViewProxy {
|
|
|
7901
8016
|
if (this.manager.room)
|
|
7902
8017
|
this.syncMainView(this.manager.room);
|
|
7903
8018
|
this.started = true;
|
|
8019
|
+
if (this.mainView.focusScenePath) {
|
|
8020
|
+
this.manager.windowManger.onMainViewScenePathChangeHandler(this.mainView.focusScenePath);
|
|
8021
|
+
}
|
|
8022
|
+
console.log("[window-manager] start end mainView size:" + JSON.stringify(this.mainView.size));
|
|
7904
8023
|
}
|
|
7905
8024
|
setCameraAndSize() {
|
|
7906
8025
|
const camera = { ...this.mainView.camera, id: this.manager.uid };
|
|
@@ -7974,13 +8093,13 @@ class MainViewProxy {
|
|
|
7974
8093
|
}
|
|
7975
8094
|
addCameraListener() {
|
|
7976
8095
|
this.view.callbacks.on("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
|
|
7977
|
-
this.view.callbacks.on("onCameraUpdated", this.
|
|
7978
|
-
this.view.callbacks.on("onSizeUpdated", this.
|
|
8096
|
+
this.view.callbacks.on("onCameraUpdated", this.onCameraUpdated);
|
|
8097
|
+
this.view.callbacks.on("onSizeUpdated", this.onSizeUpdated);
|
|
7979
8098
|
}
|
|
7980
8099
|
removeCameraListener() {
|
|
7981
8100
|
this.view.callbacks.off("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
|
|
7982
|
-
this.view.callbacks.off("onCameraUpdated", this.
|
|
7983
|
-
this.view.callbacks.off("onSizeUpdated", this.
|
|
8101
|
+
this.view.callbacks.off("onCameraUpdated", this.onCameraUpdated);
|
|
8102
|
+
this.view.callbacks.off("onSizeUpdated", this.onSizeUpdated);
|
|
7984
8103
|
}
|
|
7985
8104
|
ensureMainViewSize() {
|
|
7986
8105
|
if ((!this.mainViewSize || this.mainViewSize.width === 0 || this.mainViewSize.height === 0) && this.mainView.size.width > 0 && this.mainView.size.height > 0) {
|
|
@@ -8020,6 +8139,11 @@ class MainViewProxy {
|
|
|
8020
8139
|
this.started = false;
|
|
8021
8140
|
}
|
|
8022
8141
|
destroy() {
|
|
8142
|
+
console.log("[window-manager] destroy ");
|
|
8143
|
+
if (this.wrapperRectWorkaroundFrame) {
|
|
8144
|
+
cancelAnimationFrame(this.wrapperRectWorkaroundFrame);
|
|
8145
|
+
this.wrapperRectWorkaroundFrame = 0;
|
|
8146
|
+
}
|
|
8023
8147
|
this.removeMainViewListener();
|
|
8024
8148
|
this.stop();
|
|
8025
8149
|
this.sideEffectManager.flushAll();
|
|
@@ -8109,6 +8233,7 @@ class AppManager {
|
|
|
8109
8233
|
var _a, _b;
|
|
8110
8234
|
const { scenePath } = params;
|
|
8111
8235
|
if (scenePath === ROOT_DIR) {
|
|
8236
|
+
console.log("[window-manager] onRemoveScenes ROOT_DIR");
|
|
8112
8237
|
await this.onRootDirRemoved();
|
|
8113
8238
|
this.dispatchInternalEvent(Events.RootDirRemoved);
|
|
8114
8239
|
return;
|
|
@@ -8121,6 +8246,7 @@ class AppManager {
|
|
|
8121
8246
|
sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
|
|
8122
8247
|
}
|
|
8123
8248
|
if (sceneName) {
|
|
8249
|
+
console.log(`[window-manager] onRemoveScenes setMainViewScenePath ${ROOT_DIR}${sceneName}`);
|
|
8124
8250
|
this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
|
8125
8251
|
}
|
|
8126
8252
|
await this.setMainViewSceneIndex(nextIndex);
|
|
@@ -8418,7 +8544,7 @@ class AppManager {
|
|
|
8418
8544
|
const pageName = scenePath.replace(sceneDir, "").replace("/", "");
|
|
8419
8545
|
const index2 = scenes.findIndex((scene) => scene.name === pageName);
|
|
8420
8546
|
if (isInteger(index2) && index2 >= 0) {
|
|
8421
|
-
console.log("[window-manager] updateSceneIndex
|
|
8547
|
+
console.log("[window-manager] updateSceneIndex " + index2);
|
|
8422
8548
|
this.safeSetAttributes({ _mainSceneIndex: index2 });
|
|
8423
8549
|
}
|
|
8424
8550
|
}
|
|
@@ -8694,6 +8820,28 @@ class AppManager {
|
|
|
8694
8820
|
}
|
|
8695
8821
|
internalEmitter.emit("mainViewMounted");
|
|
8696
8822
|
callbacks$1.emit("onMainViewMounted", mainView);
|
|
8823
|
+
const hasRoot = this.hasRoot(mainView.divElement);
|
|
8824
|
+
const rect = this.getRectByDivElement(mainView.divElement);
|
|
8825
|
+
let log2 = `[window-manager] bindMainView hasRoot:${hasRoot}, rect:${JSON.stringify(rect)}, outerHeight:${window.outerHeight}, outerWidth:${window.outerWidth}`;
|
|
8826
|
+
const visualViewport = window.visualViewport;
|
|
8827
|
+
if (visualViewport) {
|
|
8828
|
+
log2 += `, visualViewportWidth:${visualViewport.width}, visualViewportHeight:${visualViewport.height}, visualViewportOffsetLeft:${visualViewport.offsetLeft}, visualViewportOffsetTop:${visualViewport.offsetTop}`;
|
|
8829
|
+
}
|
|
8830
|
+
console.log(log2);
|
|
8831
|
+
}
|
|
8832
|
+
hasRoot(divElement) {
|
|
8833
|
+
let current = divElement;
|
|
8834
|
+
while (current) {
|
|
8835
|
+
if (current.parentElement === document.body) {
|
|
8836
|
+
return true;
|
|
8837
|
+
}
|
|
8838
|
+
current = current.parentElement;
|
|
8839
|
+
}
|
|
8840
|
+
return false;
|
|
8841
|
+
}
|
|
8842
|
+
getRectByDivElement(divElement) {
|
|
8843
|
+
const rect = divElement.getBoundingClientRect();
|
|
8844
|
+
return rect;
|
|
8697
8845
|
}
|
|
8698
8846
|
setMainViewFocusPath(scenePath) {
|
|
8699
8847
|
var _a;
|
|
@@ -8805,7 +8953,7 @@ class AppManager {
|
|
|
8805
8953
|
async _setMainViewScenePath(scenePath) {
|
|
8806
8954
|
const success = this.setMainViewFocusPath(scenePath);
|
|
8807
8955
|
if (success) {
|
|
8808
|
-
console.log("[window-manager] _setMainViewScenePath
|
|
8956
|
+
console.log("[window-manager] _setMainViewScenePath " + scenePath);
|
|
8809
8957
|
this.safeSetAttributes({ _mainScenePath: scenePath });
|
|
8810
8958
|
this.store.setMainViewFocusPath(this.mainView);
|
|
8811
8959
|
this.updateSceneIndex();
|
|
@@ -8833,7 +8981,6 @@ class AppManager {
|
|
|
8833
8981
|
}
|
|
8834
8982
|
}
|
|
8835
8983
|
dispatchSetMainViewScenePath(scenePath) {
|
|
8836
|
-
console.log("[window-manager] dispatchSetMainViewScenePath====>", JSON.stringify(scenePath));
|
|
8837
8984
|
this.dispatchInternalEvent(Events.SetMainViewScenePath, { nextScenePath: scenePath });
|
|
8838
8985
|
callbacks$1.emit("mainViewScenePathChange", scenePath);
|
|
8839
8986
|
setScenePath(this.room, scenePath);
|
|
@@ -8909,6 +9056,7 @@ const ResizeObserver$2 = window.ResizeObserver || ResizeObserver$3;
|
|
|
8909
9056
|
class ContainerResizeObserver {
|
|
8910
9057
|
constructor(emitter) {
|
|
8911
9058
|
this.emitter = emitter;
|
|
9059
|
+
this.updateSizerLocalConsole = new LocalConsole("updateSizer", 30);
|
|
8912
9060
|
}
|
|
8913
9061
|
static create(container, sizer, wrapper, emitter) {
|
|
8914
9062
|
const containerResizeObserver = new ContainerResizeObserver(emitter);
|
|
@@ -8916,23 +9064,23 @@ class ContainerResizeObserver {
|
|
|
8916
9064
|
return containerResizeObserver;
|
|
8917
9065
|
}
|
|
8918
9066
|
observePlaygroundSize(container, sizer, wrapper) {
|
|
8919
|
-
this.updateSizer(container.getBoundingClientRect(), sizer, wrapper);
|
|
9067
|
+
this.updateSizer(container.getBoundingClientRect(), sizer, wrapper, "observePlaygroundSize");
|
|
8920
9068
|
this.containerResizeObserver = new ResizeObserver$2((entries) => {
|
|
8921
9069
|
var _a;
|
|
8922
9070
|
const containerRect = (_a = entries[0]) == null ? void 0 : _a.contentRect;
|
|
8923
9071
|
if (containerRect) {
|
|
8924
|
-
this.updateSizer(containerRect, sizer, wrapper);
|
|
9072
|
+
this.updateSizer(containerRect, sizer, wrapper, "containerResizeObserver");
|
|
8925
9073
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
8926
9074
|
}
|
|
8927
9075
|
});
|
|
8928
9076
|
this.disposer = this.emitter.on("containerSizeRatioUpdate", () => {
|
|
8929
9077
|
const containerRect = container.getBoundingClientRect();
|
|
8930
|
-
this.updateSizer(containerRect, sizer, wrapper);
|
|
9078
|
+
this.updateSizer(containerRect, sizer, wrapper, "containerSizeRatioUpdate");
|
|
8931
9079
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
8932
9080
|
});
|
|
8933
9081
|
this.containerResizeObserver.observe(container);
|
|
8934
9082
|
}
|
|
8935
|
-
updateSizer({ width, height }, sizer, wrapper) {
|
|
9083
|
+
updateSizer({ width, height }, sizer, wrapper, origin) {
|
|
8936
9084
|
if (width && height) {
|
|
8937
9085
|
if (height / width > WindowManager.containerSizeRatio) {
|
|
8938
9086
|
height = width * WindowManager.containerSizeRatio;
|
|
@@ -8943,6 +9091,13 @@ class ContainerResizeObserver {
|
|
|
8943
9091
|
}
|
|
8944
9092
|
wrapper.style.width = `${width}px`;
|
|
8945
9093
|
wrapper.style.height = `${height}px`;
|
|
9094
|
+
const wrapperRect = wrapper.getBoundingClientRect();
|
|
9095
|
+
this.updateSizerLocalConsole.log(`from ${origin}, traget size: ${JSON.stringify({ width, height })}, wrapperRect: ${wrapperRect.width} ${wrapperRect.height}`);
|
|
9096
|
+
this.emitter.emit("wrapperRectChange", {
|
|
9097
|
+
width: wrapperRect.width,
|
|
9098
|
+
height: wrapperRect.height,
|
|
9099
|
+
origin
|
|
9100
|
+
});
|
|
8946
9101
|
}
|
|
8947
9102
|
}
|
|
8948
9103
|
disconnect() {
|
|
@@ -9101,8 +9256,26 @@ const replaceRoomFunction = (room, manager) => {
|
|
|
9101
9256
|
});
|
|
9102
9257
|
const _scalePptToFit = room.scalePptToFit;
|
|
9103
9258
|
room.scalePptToFit = (...args) => {
|
|
9104
|
-
|
|
9259
|
+
var _a;
|
|
9105
9260
|
_scalePptToFit.call(room, ...args);
|
|
9261
|
+
if ((_a = manager.appManager) == null ? void 0 : _a.mainViewProxy) {
|
|
9262
|
+
manager.appManager.mainViewProxy.setCameraAndSize();
|
|
9263
|
+
}
|
|
9264
|
+
};
|
|
9265
|
+
const _putScenes = room.putScenes;
|
|
9266
|
+
room.putScenes = (...args) => {
|
|
9267
|
+
const [path, scenes] = args;
|
|
9268
|
+
const currentScenePath = manager.mainView.focusScenePath;
|
|
9269
|
+
if (currentScenePath && path && scenes) {
|
|
9270
|
+
console.log("[window-manager] putScenes " + JSON.stringify(args));
|
|
9271
|
+
for (const scene of scenes) {
|
|
9272
|
+
if (`${path}${scene.name}` === currentScenePath) {
|
|
9273
|
+
console.error(`[window-manager] putScenes: scene name can not be the same as the current scene path: ${currentScenePath}`);
|
|
9274
|
+
return;
|
|
9275
|
+
}
|
|
9276
|
+
}
|
|
9277
|
+
}
|
|
9278
|
+
return _putScenes.call(room, ...args);
|
|
9106
9279
|
};
|
|
9107
9280
|
room.moveCamera = (camera) => manager.moveCamera(camera);
|
|
9108
9281
|
room.moveCameraToContain = (...args) => manager.moveCameraToContain(...args);
|
|
@@ -19694,15 +19867,34 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
|
|
19694
19867
|
const _WindowManager = class extends InvisiblePlugin {
|
|
19695
19868
|
constructor(context) {
|
|
19696
19869
|
super(context);
|
|
19697
|
-
this.version = "1.0.13-test.
|
|
19870
|
+
this.version = "1.0.13-test.20";
|
|
19698
19871
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.53" }, "devDependencies": { "@hyrious/dts": "^0.2.2", "@netless/app-docs-viewer": "^0.2.19", "@netless/app-media-player": "0.1.4", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "1.0.0-next.30", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "side-effect-manager": "0.1.5", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.9.9", "vitest": "^0.14.1", "white-web-sdk": "^2.16.53" } };
|
|
19699
19872
|
this.emitter = callbacks$1;
|
|
19700
19873
|
this.viewMode = ViewMode.Broadcaster;
|
|
19701
19874
|
this.isReplay = isPlayer(this.displayer);
|
|
19702
19875
|
this._cursorUIDs = [];
|
|
19703
19876
|
this.containerSizeRatio = _WindowManager.containerSizeRatio;
|
|
19877
|
+
this.onMainViewScenePathChangeHandler = (scenePath) => {
|
|
19878
|
+
const mainViewElement = this.mainView.divElement;
|
|
19879
|
+
this.logMainViewVisibilityDiagnostics("onMainViewScenePathChange", scenePath, mainViewElement);
|
|
19880
|
+
if (mainViewElement) {
|
|
19881
|
+
const backgroundImage = mainViewElement.querySelector(".background img");
|
|
19882
|
+
if (backgroundImage) {
|
|
19883
|
+
const backgroundImageRect = backgroundImage == null ? void 0 : backgroundImage.getBoundingClientRect();
|
|
19884
|
+
const backgroundImageCSS = window.getComputedStyle(backgroundImage);
|
|
19885
|
+
const backgroundImageVisible = (backgroundImageRect == null ? void 0 : backgroundImageRect.width) > 0 && (backgroundImageRect == null ? void 0 : backgroundImageRect.height) > 0 && backgroundImageCSS.display !== "none";
|
|
19886
|
+
const camera = this.mainView.camera;
|
|
19887
|
+
console.log("[window-manager] backgroundImageVisible:" + backgroundImageVisible + " camera:" + JSON.stringify(camera));
|
|
19888
|
+
return;
|
|
19889
|
+
}
|
|
19890
|
+
console.log("[window-manager] onMainViewScenePathChange scenePath:" + scenePath + " backgroundImageVisible is not found");
|
|
19891
|
+
return;
|
|
19892
|
+
}
|
|
19893
|
+
console.log("[window-manager] onMainViewScenePathChange scenePath:" + scenePath + " mainViewElement is not found");
|
|
19894
|
+
};
|
|
19704
19895
|
_WindowManager.displayer = context.displayer;
|
|
19705
19896
|
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.3.0", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.53" }, "devDependencies": { "@hyrious/dts": "^0.2.2", "@netless/app-docs-viewer": "^0.2.19", "@netless/app-media-player": "0.1.4", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "1.0.0-next.30", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "jspdf": "^2.5.1", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "side-effect-manager": "0.1.5", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.9.9", "vitest": "^0.14.1", "white-web-sdk": "^2.16.53" } };
|
|
19897
|
+
this.emitter.on("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
|
|
19706
19898
|
}
|
|
19707
19899
|
get Logger() {
|
|
19708
19900
|
return this._roomLogger;
|
|
@@ -19818,8 +20010,338 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
19818
20010
|
console.warn("[WindowManager]: indexedDB open failed");
|
|
19819
20011
|
console.log(error);
|
|
19820
20012
|
}
|
|
20013
|
+
manager.emitter.on("mainViewScenePathChange", manager.onMainViewScenePathChangeHandler);
|
|
19821
20014
|
return manager;
|
|
19822
20015
|
}
|
|
20016
|
+
logMainViewVisibilityDiagnostics(tag, scenePath, mainViewElement) {
|
|
20017
|
+
var _a;
|
|
20018
|
+
const element2 = mainViewElement != null ? mainViewElement : (_a = this.mainView) == null ? void 0 : _a.divElement;
|
|
20019
|
+
const label = scenePath ? `${tag}:${scenePath}` : tag;
|
|
20020
|
+
const payload = this.collectMainViewVisibilityDiagnostics(element2, scenePath);
|
|
20021
|
+
this.emitMainViewVisibilityDiagnostic(label, payload.summary);
|
|
20022
|
+
if (payload.details) {
|
|
20023
|
+
this.emitMainViewVisibilityDiagnostic(`${label}:details`, payload.details);
|
|
20024
|
+
}
|
|
20025
|
+
}
|
|
20026
|
+
emitMainViewVisibilityDiagnostic(tag, payload) {
|
|
20027
|
+
var _a;
|
|
20028
|
+
const content = `[window-manager][visibility][${tag}] ${JSON.stringify(payload)}`;
|
|
20029
|
+
(_a = this._roomLogger) == null ? void 0 : _a.info(content);
|
|
20030
|
+
}
|
|
20031
|
+
collectMainViewVisibilityDiagnostics(mainViewElement, scenePath) {
|
|
20032
|
+
var _a, _b;
|
|
20033
|
+
const element2 = mainViewElement != null ? mainViewElement : null;
|
|
20034
|
+
const backgroundImage = element2 == null ? void 0 : element2.querySelector(".background img");
|
|
20035
|
+
const elementDiagnostic = element2 ? this.collectElementDiagnostic(element2) : null;
|
|
20036
|
+
const chainDiagnostics = element2 ? this.collectElementChainDiagnostics(element2) : [];
|
|
20037
|
+
const elementRect = (_b = (_a = element2 == null ? void 0 : element2.getBoundingClientRect) == null ? void 0 : _a.call(element2)) != null ? _b : null;
|
|
20038
|
+
const centerPoint = elementRect ? {
|
|
20039
|
+
x: elementRect.left + elementRect.width / 2,
|
|
20040
|
+
y: elementRect.top + elementRect.height / 2
|
|
20041
|
+
} : void 0;
|
|
20042
|
+
const topElement = centerPoint && Number.isFinite(centerPoint.x) && Number.isFinite(centerPoint.y) ? document.elementFromPoint(centerPoint.x, centerPoint.y) : null;
|
|
20043
|
+
const overlayStack = centerPoint && Number.isFinite(centerPoint.x) && Number.isFinite(centerPoint.y) && document.elementsFromPoint ? document.elementsFromPoint(centerPoint.x, centerPoint.y).slice(0, 10).map((item) => this.describeElement(item)).filter((item) => item !== null) : [];
|
|
20044
|
+
const topElementDiagnostic = topElement ? this.collectElementDiagnostic(topElement) : null;
|
|
20045
|
+
const backgroundImageDiagnostic = backgroundImage ? this.collectImageDiagnostic(backgroundImage) : null;
|
|
20046
|
+
const blockers = [];
|
|
20047
|
+
const warnings = [];
|
|
20048
|
+
const suspiciousAncestors = [];
|
|
20049
|
+
const mainViewBlockers = [];
|
|
20050
|
+
const mainViewWarnings = [];
|
|
20051
|
+
if (!element2) {
|
|
20052
|
+
blockers.push("mainViewElement.missing");
|
|
20053
|
+
}
|
|
20054
|
+
if (document.hidden || document.visibilityState === "hidden") {
|
|
20055
|
+
blockers.push("document.hidden");
|
|
20056
|
+
}
|
|
20057
|
+
if (elementDiagnostic) {
|
|
20058
|
+
this.appendRenderImpactIssues(
|
|
20059
|
+
"mainViewElement",
|
|
20060
|
+
elementDiagnostic,
|
|
20061
|
+
mainViewBlockers,
|
|
20062
|
+
mainViewWarnings
|
|
20063
|
+
);
|
|
20064
|
+
blockers.push(...mainViewBlockers);
|
|
20065
|
+
warnings.push(...mainViewWarnings);
|
|
20066
|
+
}
|
|
20067
|
+
chainDiagnostics.slice(1).forEach((diagnostic, index2) => {
|
|
20068
|
+
const ancestorBlockers = [];
|
|
20069
|
+
const ancestorWarnings = [];
|
|
20070
|
+
this.appendRenderImpactIssues(
|
|
20071
|
+
`ancestor[${index2 + 1}]`,
|
|
20072
|
+
diagnostic,
|
|
20073
|
+
ancestorBlockers,
|
|
20074
|
+
ancestorWarnings
|
|
20075
|
+
);
|
|
20076
|
+
if (ancestorBlockers.length > 0 || ancestorWarnings.length > 0) {
|
|
20077
|
+
blockers.push(...ancestorBlockers);
|
|
20078
|
+
warnings.push(...ancestorWarnings);
|
|
20079
|
+
suspiciousAncestors.push(this.pickRenderRelevantFields(diagnostic));
|
|
20080
|
+
}
|
|
20081
|
+
});
|
|
20082
|
+
let backgroundImageStatus = null;
|
|
20083
|
+
const backgroundImageBlockers = [];
|
|
20084
|
+
const backgroundImageWarnings = [];
|
|
20085
|
+
if (backgroundImageDiagnostic) {
|
|
20086
|
+
backgroundImageStatus = this.pickBackgroundImageStatus(backgroundImageDiagnostic);
|
|
20087
|
+
this.appendRenderImpactIssues(
|
|
20088
|
+
"backgroundImage",
|
|
20089
|
+
backgroundImageDiagnostic,
|
|
20090
|
+
backgroundImageBlockers,
|
|
20091
|
+
backgroundImageWarnings
|
|
20092
|
+
);
|
|
20093
|
+
blockers.push(...backgroundImageBlockers);
|
|
20094
|
+
warnings.push(...backgroundImageWarnings);
|
|
20095
|
+
if (backgroundImageDiagnostic.complete === false) {
|
|
20096
|
+
warnings.push("backgroundImage.loading");
|
|
20097
|
+
} else if (backgroundImageDiagnostic.naturalWidth === 0) {
|
|
20098
|
+
warnings.push("backgroundImage.empty");
|
|
20099
|
+
}
|
|
20100
|
+
}
|
|
20101
|
+
let topElementSummary = null;
|
|
20102
|
+
if (topElementDiagnostic) {
|
|
20103
|
+
const coveredByOutsideElement = Boolean(
|
|
20104
|
+
element2 && topElement && topElement !== element2 && !element2.contains(topElement)
|
|
20105
|
+
);
|
|
20106
|
+
topElementSummary = {
|
|
20107
|
+
node: topElementDiagnostic.node,
|
|
20108
|
+
coveredByOutsideElement
|
|
20109
|
+
};
|
|
20110
|
+
if (coveredByOutsideElement) {
|
|
20111
|
+
warnings.push(`center.coveredBy:${topElementDiagnostic.node}`);
|
|
20112
|
+
}
|
|
20113
|
+
}
|
|
20114
|
+
const summary = {
|
|
20115
|
+
scenePath: scenePath || null,
|
|
20116
|
+
timestamp: new Date().toISOString(),
|
|
20117
|
+
status: blockers.length > 0 ? "blocked" : warnings.length > 0 ? "uncertain" : "likely-renderable",
|
|
20118
|
+
canRender: blockers.length === 0,
|
|
20119
|
+
blockers,
|
|
20120
|
+
warnings
|
|
20121
|
+
};
|
|
20122
|
+
if (backgroundImageStatus && backgroundImageDiagnostic && (backgroundImageDiagnostic.complete === false || backgroundImageDiagnostic.naturalWidth === 0)) {
|
|
20123
|
+
summary.backgroundImage = backgroundImageStatus;
|
|
20124
|
+
}
|
|
20125
|
+
if (topElementSummary == null ? void 0 : topElementSummary.coveredByOutsideElement) {
|
|
20126
|
+
summary.coveringElement = topElementSummary.node;
|
|
20127
|
+
}
|
|
20128
|
+
const shouldEmitDetails = blockers.length > 0 || warnings.some(
|
|
20129
|
+
(warning) => warning !== "backgroundImage.loading" && warning !== "backgroundImage.empty"
|
|
20130
|
+
);
|
|
20131
|
+
const details = {};
|
|
20132
|
+
if ((mainViewBlockers.length > 0 || mainViewWarnings.length > 0) && elementDiagnostic) {
|
|
20133
|
+
details.mainViewElement = this.pickRenderRelevantFields(elementDiagnostic);
|
|
20134
|
+
}
|
|
20135
|
+
if (suspiciousAncestors.length > 0) {
|
|
20136
|
+
details.suspiciousAncestors = suspiciousAncestors;
|
|
20137
|
+
}
|
|
20138
|
+
if (backgroundImageDiagnostic && (backgroundImageBlockers.length > 0 || backgroundImageWarnings.length > 0 || backgroundImageDiagnostic.complete === false || backgroundImageDiagnostic.naturalWidth === 0)) {
|
|
20139
|
+
details.backgroundImage = {
|
|
20140
|
+
...this.pickRenderRelevantFields(backgroundImageDiagnostic),
|
|
20141
|
+
loadState: backgroundImageStatus
|
|
20142
|
+
};
|
|
20143
|
+
}
|
|
20144
|
+
if ((topElementSummary == null ? void 0 : topElementSummary.coveredByOutsideElement) && topElementDiagnostic) {
|
|
20145
|
+
details.topElementAtCenter = {
|
|
20146
|
+
...this.pickRenderRelevantFields(topElementDiagnostic),
|
|
20147
|
+
overlayStack
|
|
20148
|
+
};
|
|
20149
|
+
}
|
|
20150
|
+
return {
|
|
20151
|
+
summary,
|
|
20152
|
+
details: shouldEmitDetails && Object.keys(details).length > 0 ? details : null
|
|
20153
|
+
};
|
|
20154
|
+
}
|
|
20155
|
+
collectElementChainDiagnostics(element2) {
|
|
20156
|
+
const chain = [];
|
|
20157
|
+
let current = element2;
|
|
20158
|
+
while (current) {
|
|
20159
|
+
const diagnostic = this.collectElementDiagnostic(current);
|
|
20160
|
+
if (diagnostic) {
|
|
20161
|
+
chain.push(diagnostic);
|
|
20162
|
+
}
|
|
20163
|
+
current = current.parentElement;
|
|
20164
|
+
}
|
|
20165
|
+
return chain;
|
|
20166
|
+
}
|
|
20167
|
+
collectImageDiagnostic(image) {
|
|
20168
|
+
const diagnostic = this.collectElementDiagnostic(image);
|
|
20169
|
+
return {
|
|
20170
|
+
...diagnostic,
|
|
20171
|
+
currentSrc: image.currentSrc,
|
|
20172
|
+
src: image.getAttribute("src"),
|
|
20173
|
+
complete: image.complete,
|
|
20174
|
+
naturalWidth: image.naturalWidth,
|
|
20175
|
+
naturalHeight: image.naturalHeight
|
|
20176
|
+
};
|
|
20177
|
+
}
|
|
20178
|
+
appendRenderImpactIssues(label, diagnostic, blockers, warnings) {
|
|
20179
|
+
const opacity = Number.parseFloat(diagnostic.opacity || "1");
|
|
20180
|
+
if (diagnostic.hiddenAttribute) {
|
|
20181
|
+
blockers.push(`${label}.hiddenAttribute`);
|
|
20182
|
+
}
|
|
20183
|
+
if (diagnostic.display === "none") {
|
|
20184
|
+
blockers.push(`${label}.display:none`);
|
|
20185
|
+
}
|
|
20186
|
+
if (diagnostic.visibility === "hidden" || diagnostic.visibility === "collapse") {
|
|
20187
|
+
blockers.push(`${label}.visibility:${diagnostic.visibility}`);
|
|
20188
|
+
}
|
|
20189
|
+
if (Number.isFinite(opacity) && opacity <= 0.01) {
|
|
20190
|
+
blockers.push(`${label}.opacity:${diagnostic.opacity}`);
|
|
20191
|
+
}
|
|
20192
|
+
if (diagnostic.contentVisibility === "hidden") {
|
|
20193
|
+
blockers.push(`${label}.contentVisibility:hidden`);
|
|
20194
|
+
}
|
|
20195
|
+
if (diagnostic.transform !== "none") {
|
|
20196
|
+
warnings.push(`${label}.transform`);
|
|
20197
|
+
}
|
|
20198
|
+
if (diagnostic.filter !== "none") {
|
|
20199
|
+
warnings.push(`${label}.filter`);
|
|
20200
|
+
}
|
|
20201
|
+
if (diagnostic.backdropFilter !== "none") {
|
|
20202
|
+
warnings.push(`${label}.backdropFilter`);
|
|
20203
|
+
}
|
|
20204
|
+
if (diagnostic.clipPath !== "none") {
|
|
20205
|
+
warnings.push(`${label}.clipPath`);
|
|
20206
|
+
}
|
|
20207
|
+
if (diagnostic.maskImage !== "none") {
|
|
20208
|
+
warnings.push(`${label}.maskImage`);
|
|
20209
|
+
}
|
|
20210
|
+
if (diagnostic.mixBlendMode !== "normal") {
|
|
20211
|
+
warnings.push(`${label}.mixBlendMode:${diagnostic.mixBlendMode}`);
|
|
20212
|
+
}
|
|
20213
|
+
}
|
|
20214
|
+
pickRenderRelevantFields(diagnostic) {
|
|
20215
|
+
var _a, _b, _c, _d, _e, _f;
|
|
20216
|
+
const result = {
|
|
20217
|
+
node: diagnostic.node,
|
|
20218
|
+
display: diagnostic.display,
|
|
20219
|
+
visibility: diagnostic.visibility,
|
|
20220
|
+
opacity: diagnostic.opacity,
|
|
20221
|
+
hiddenAttribute: diagnostic.hiddenAttribute,
|
|
20222
|
+
contentVisibility: diagnostic.contentVisibility,
|
|
20223
|
+
backgroundColor: diagnostic.backgroundColor,
|
|
20224
|
+
backgroundAlpha: (_b = (_a = diagnostic.backgroundColorChannels) == null ? void 0 : _a.a) != null ? _b : null,
|
|
20225
|
+
color: diagnostic.color,
|
|
20226
|
+
colorAlpha: (_d = (_c = diagnostic.colorChannels) == null ? void 0 : _c.a) != null ? _d : null,
|
|
20227
|
+
textFillColor: diagnostic.textFillColor,
|
|
20228
|
+
textFillAlpha: (_f = (_e = diagnostic.textFillColorChannels) == null ? void 0 : _e.a) != null ? _f : null
|
|
20229
|
+
};
|
|
20230
|
+
if (diagnostic.transform !== "none") {
|
|
20231
|
+
result.transform = diagnostic.transform;
|
|
20232
|
+
}
|
|
20233
|
+
if (diagnostic.filter !== "none") {
|
|
20234
|
+
result.filter = diagnostic.filter;
|
|
20235
|
+
}
|
|
20236
|
+
if (diagnostic.backdropFilter !== "none") {
|
|
20237
|
+
result.backdropFilter = diagnostic.backdropFilter;
|
|
20238
|
+
}
|
|
20239
|
+
if (diagnostic.mixBlendMode !== "normal") {
|
|
20240
|
+
result.mixBlendMode = diagnostic.mixBlendMode;
|
|
20241
|
+
}
|
|
20242
|
+
if (diagnostic.clipPath !== "none") {
|
|
20243
|
+
result.clipPath = diagnostic.clipPath;
|
|
20244
|
+
}
|
|
20245
|
+
if (diagnostic.maskImage !== "none") {
|
|
20246
|
+
result.maskImage = diagnostic.maskImage;
|
|
20247
|
+
}
|
|
20248
|
+
if (diagnostic.overflow !== "visible") {
|
|
20249
|
+
result.overflow = diagnostic.overflow;
|
|
20250
|
+
}
|
|
20251
|
+
if (diagnostic.zIndex !== "auto") {
|
|
20252
|
+
result.zIndex = diagnostic.zIndex;
|
|
20253
|
+
}
|
|
20254
|
+
return result;
|
|
20255
|
+
}
|
|
20256
|
+
pickBackgroundImageStatus(diagnostic) {
|
|
20257
|
+
return {
|
|
20258
|
+
found: true,
|
|
20259
|
+
complete: diagnostic.complete,
|
|
20260
|
+
currentSrc: diagnostic.currentSrc || diagnostic.src || "",
|
|
20261
|
+
naturalWidth: diagnostic.naturalWidth,
|
|
20262
|
+
naturalHeight: diagnostic.naturalHeight
|
|
20263
|
+
};
|
|
20264
|
+
}
|
|
20265
|
+
collectElementDiagnostic(element2) {
|
|
20266
|
+
if (!element2) {
|
|
20267
|
+
return null;
|
|
20268
|
+
}
|
|
20269
|
+
const style2 = window.getComputedStyle(element2);
|
|
20270
|
+
const htmlElement = element2;
|
|
20271
|
+
return {
|
|
20272
|
+
node: this.describeElement(element2),
|
|
20273
|
+
isConnected: element2.isConnected,
|
|
20274
|
+
hiddenAttribute: htmlElement.hidden,
|
|
20275
|
+
ariaHidden: htmlElement.getAttribute("aria-hidden"),
|
|
20276
|
+
opacity: style2.opacity,
|
|
20277
|
+
alpha: style2.opacity,
|
|
20278
|
+
display: style2.display,
|
|
20279
|
+
visibility: style2.visibility,
|
|
20280
|
+
backgroundColor: style2.backgroundColor,
|
|
20281
|
+
backgroundColorChannels: this.parseColorChannels(style2.backgroundColor),
|
|
20282
|
+
color: style2.color,
|
|
20283
|
+
colorChannels: this.parseColorChannels(style2.color),
|
|
20284
|
+
textFillColor: style2.getPropertyValue("-webkit-text-fill-color"),
|
|
20285
|
+
textFillColorChannels: this.parseColorChannels(
|
|
20286
|
+
style2.getPropertyValue("-webkit-text-fill-color")
|
|
20287
|
+
),
|
|
20288
|
+
filter: style2.filter,
|
|
20289
|
+
backdropFilter: style2.getPropertyValue("backdrop-filter"),
|
|
20290
|
+
mixBlendMode: style2.mixBlendMode,
|
|
20291
|
+
transform: style2.transform,
|
|
20292
|
+
contentVisibility: style2.getPropertyValue("content-visibility"),
|
|
20293
|
+
clipPath: style2.clipPath,
|
|
20294
|
+
maskImage: style2.getPropertyValue("mask-image") || style2.getPropertyValue("-webkit-mask-image"),
|
|
20295
|
+
overflow: style2.overflow,
|
|
20296
|
+
zIndex: style2.zIndex
|
|
20297
|
+
};
|
|
20298
|
+
}
|
|
20299
|
+
describeElement(element2) {
|
|
20300
|
+
if (!element2) {
|
|
20301
|
+
return null;
|
|
20302
|
+
}
|
|
20303
|
+
const tagName = element2.tagName.toLowerCase();
|
|
20304
|
+
const id2 = element2.id ? `#${element2.id}` : "";
|
|
20305
|
+
const className = typeof element2.className === "string" && element2.className.trim() ? `.${element2.className.trim().replace(/\s+/g, ".")}` : "";
|
|
20306
|
+
return `${tagName}${id2}${className}`;
|
|
20307
|
+
}
|
|
20308
|
+
serializeRect(rect) {
|
|
20309
|
+
if (!rect) {
|
|
20310
|
+
return null;
|
|
20311
|
+
}
|
|
20312
|
+
return {
|
|
20313
|
+
x: rect.x,
|
|
20314
|
+
y: rect.y,
|
|
20315
|
+
width: rect.width,
|
|
20316
|
+
height: rect.height,
|
|
20317
|
+
top: rect.top,
|
|
20318
|
+
right: rect.right,
|
|
20319
|
+
bottom: rect.bottom,
|
|
20320
|
+
left: rect.left
|
|
20321
|
+
};
|
|
20322
|
+
}
|
|
20323
|
+
parseColorChannels(value) {
|
|
20324
|
+
const raw = (value == null ? void 0 : value.trim()) || "";
|
|
20325
|
+
if (!raw) {
|
|
20326
|
+
return { raw };
|
|
20327
|
+
}
|
|
20328
|
+
if (raw === "transparent") {
|
|
20329
|
+
return { raw, r: 0, g: 0, b: 0, a: 0 };
|
|
20330
|
+
}
|
|
20331
|
+
const matches = raw.match(/^rgba?\((.+)\)$/i);
|
|
20332
|
+
if (!matches) {
|
|
20333
|
+
return { raw };
|
|
20334
|
+
}
|
|
20335
|
+
const parts = matches[1].split(",").map((part) => part.trim());
|
|
20336
|
+
const [r2, g2, b2, a2] = parts.map((part) => Number(part));
|
|
20337
|
+
return {
|
|
20338
|
+
raw,
|
|
20339
|
+
r: Number.isFinite(r2) ? r2 : void 0,
|
|
20340
|
+
g: Number.isFinite(g2) ? g2 : void 0,
|
|
20341
|
+
b: Number.isFinite(b2) ? b2 : void 0,
|
|
20342
|
+
a: Number.isFinite(a2) ? a2 : raw.startsWith("rgb(") ? 1 : void 0
|
|
20343
|
+
};
|
|
20344
|
+
}
|
|
19823
20345
|
static initManager(room) {
|
|
19824
20346
|
return createInvisiblePlugin(room);
|
|
19825
20347
|
}
|
|
@@ -19882,6 +20404,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
19882
20404
|
this.appManager.setBoxManager(boxManager);
|
|
19883
20405
|
}
|
|
19884
20406
|
this.bindMainView(mainViewElement, params.disableCameraTransform);
|
|
20407
|
+
this.logMainViewVisibilityDiagnostics("bindContainer.afterBindMainView");
|
|
19885
20408
|
if (_WindowManager.wrapper) {
|
|
19886
20409
|
(_a = this.cursorManager) == null ? void 0 : _a.setupWrapper(_WindowManager.wrapper);
|
|
19887
20410
|
}
|
|
@@ -20378,6 +20901,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
20378
20901
|
(_e = _WindowManager.playground.parentNode) == null ? void 0 : _e.removeChild(_WindowManager.playground);
|
|
20379
20902
|
}
|
|
20380
20903
|
_WindowManager.params = void 0;
|
|
20904
|
+
this.emitter.off("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
|
|
20381
20905
|
(_f = this._iframeBridge) == null ? void 0 : _f.destroy();
|
|
20382
20906
|
this._iframeBridge = void 0;
|
|
20383
20907
|
log("Destroyed");
|