@netless/window-manager 1.0.13-test.3 → 1.0.13-test.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -0
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +50 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/AppListener.ts +1 -1
- package/src/AppManager.ts +6 -2
- package/src/ContainerResizeObserver.ts +2 -0
- package/src/Utils/RoomHacker.ts +1 -1
- package/src/Utils/log.ts +2 -2
- package/src/View/MainView.ts +12 -5
- package/src/index.ts +21 -2
package/dist/index.mjs
CHANGED
|
@@ -464,7 +464,7 @@ class AppListeners {
|
|
|
464
464
|
break;
|
|
465
465
|
}
|
|
466
466
|
case Events.SetMainViewScenePath: {
|
|
467
|
-
console.log("[window-manager] mainMagixEventListener "
|
|
467
|
+
console.log("[window-manager] mainMagixEventListener " + JSON.stringify(data.payload));
|
|
468
468
|
this.setMainViewScenePathHandler(data.payload);
|
|
469
469
|
break;
|
|
470
470
|
}
|
|
@@ -5711,7 +5711,7 @@ class LocalConsole {
|
|
|
5711
5711
|
if (args === null) {
|
|
5712
5712
|
return;
|
|
5713
5713
|
}
|
|
5714
|
-
console.log(`[window-manager][${this.name}]
|
|
5714
|
+
console.log(`[window-manager][${this.name}]: ${args.join(", ")}`);
|
|
5715
5715
|
}
|
|
5716
5716
|
log(...args) {
|
|
5717
5717
|
const ms = this.debounceTime;
|
|
@@ -5723,7 +5723,7 @@ class LocalConsole {
|
|
|
5723
5723
|
this.flushTimer = setTimeout(() => this.flush(), ms);
|
|
5724
5724
|
return;
|
|
5725
5725
|
}
|
|
5726
|
-
console.log(`[window-manager][${this.name}]
|
|
5726
|
+
console.log(`[window-manager][${this.name}]: ${args.join(", ")}`);
|
|
5727
5727
|
}
|
|
5728
5728
|
}
|
|
5729
5729
|
const setupWrapper = (root) => {
|
|
@@ -7783,6 +7783,7 @@ const setDefaultCameraBound = (view) => {
|
|
|
7783
7783
|
minContentMode: () => 0.1
|
|
7784
7784
|
});
|
|
7785
7785
|
};
|
|
7786
|
+
window.___local_log = window.___local_log || /* @__PURE__ */ new Set();
|
|
7786
7787
|
class MainViewProxy {
|
|
7787
7788
|
constructor(manager) {
|
|
7788
7789
|
this.manager = manager;
|
|
@@ -7820,7 +7821,7 @@ class MainViewProxy {
|
|
|
7820
7821
|
() => this.mainViewCamera,
|
|
7821
7822
|
(camera) => {
|
|
7822
7823
|
if (camera && camera.id !== this.manager.uid) {
|
|
7823
|
-
console.log("[window-manager] cameraReaction "
|
|
7824
|
+
console.log("[window-manager] cameraReaction " + JSON.stringify(camera) + JSON.stringify(this.mainViewSize));
|
|
7824
7825
|
this.moveCameraToContian(this.mainViewSize);
|
|
7825
7826
|
this.moveCamera(camera);
|
|
7826
7827
|
}
|
|
@@ -7830,15 +7831,15 @@ class MainViewProxy {
|
|
|
7830
7831
|
};
|
|
7831
7832
|
this.sizeChangeHandler = debounce((size2) => {
|
|
7832
7833
|
if (size2) {
|
|
7833
|
-
console.log("[window-manager] sizeChangeHandler current size and camera", JSON.stringify(size2), JSON.stringify(this.mainViewCamera));
|
|
7834
7834
|
this.moveCameraToContian(size2);
|
|
7835
7835
|
this.moveCamera(this.mainViewCamera);
|
|
7836
|
+
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));
|
|
7836
7837
|
}
|
|
7837
7838
|
this.ensureMainViewSize();
|
|
7838
7839
|
}, 30);
|
|
7839
7840
|
this.onUpdateContainerSizeRatio = () => {
|
|
7840
7841
|
const size2 = this.store.getMainViewSize();
|
|
7841
|
-
console.log("[window-manager] onUpdateContainerSizeRatio "
|
|
7842
|
+
console.log("[window-manager] onUpdateContainerSizeRatio " + JSON.stringify(size2));
|
|
7842
7843
|
this.sizeChangeHandler(size2);
|
|
7843
7844
|
};
|
|
7844
7845
|
this.onCameraUpdatedByDevice = (camera) => {
|
|
@@ -7882,7 +7883,17 @@ class MainViewProxy {
|
|
|
7882
7883
|
this.startListenWritableChange();
|
|
7883
7884
|
});
|
|
7884
7885
|
const playgroundSizeChangeListener = () => {
|
|
7885
|
-
|
|
7886
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
7887
|
+
this.playgroundSizeChangeListenerLocalConsole.log(
|
|
7888
|
+
JSON.stringify(this.mainViewSize),
|
|
7889
|
+
JSON.stringify(this.mainViewCamera),
|
|
7890
|
+
window.outerHeight,
|
|
7891
|
+
window.outerWidth,
|
|
7892
|
+
(_b = (_a = window.visualViewport) == null ? void 0 : _a.width) != null ? _b : "null",
|
|
7893
|
+
(_d = (_c = window.visualViewport) == null ? void 0 : _c.height) != null ? _d : "null",
|
|
7894
|
+
(_f = (_e = window.visualViewport) == null ? void 0 : _e.offsetLeft) != null ? _f : "null",
|
|
7895
|
+
(_h = (_g = window.visualViewport) == null ? void 0 : _g.offsetTop) != null ? _h : "null"
|
|
7896
|
+
);
|
|
7886
7897
|
this.sizeChangeHandler(this.mainViewSize);
|
|
7887
7898
|
};
|
|
7888
7899
|
this.sideEffectManager.add(() => {
|
|
@@ -8152,7 +8163,7 @@ class AppManager {
|
|
|
8152
8163
|
sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
|
|
8153
8164
|
}
|
|
8154
8165
|
if (sceneName) {
|
|
8155
|
-
console.log(
|
|
8166
|
+
console.log(`[window-manager] onRemoveScenes setMainViewScenePath${ROOT_DIR}${sceneName}`);
|
|
8156
8167
|
this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
|
8157
8168
|
}
|
|
8158
8169
|
await this.setMainViewSceneIndex(nextIndex);
|
|
@@ -8718,6 +8729,7 @@ class AppManager {
|
|
|
8718
8729
|
(_a = this.boxManager) == null ? void 0 : _a.setMinimized(Boolean(this.store.getMinimized()));
|
|
8719
8730
|
}
|
|
8720
8731
|
bindMainView(divElement, disableCameraTransform) {
|
|
8732
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
8721
8733
|
const mainView = this.mainViewProxy.view;
|
|
8722
8734
|
mainView.disableCameraTransform = disableCameraTransform;
|
|
8723
8735
|
mainView.divElement = divElement;
|
|
@@ -8728,7 +8740,13 @@ class AppManager {
|
|
|
8728
8740
|
callbacks$1.emit("onMainViewMounted", mainView);
|
|
8729
8741
|
const hasRoot = this.hasRoot(mainView.divElement);
|
|
8730
8742
|
const rect = this.getRectByDivElement(mainView.divElement);
|
|
8731
|
-
console.log(
|
|
8743
|
+
console.log(
|
|
8744
|
+
"[window-manager] bindMainView hasRoot" + hasRoot + JSON.stringify(rect) + window.outerHeight + window.outerWidth,
|
|
8745
|
+
(_b = (_a = window.visualViewport) == null ? void 0 : _a.width) != null ? _b : "null",
|
|
8746
|
+
(_d = (_c = window.visualViewport) == null ? void 0 : _c.height) != null ? _d : "null",
|
|
8747
|
+
(_f = (_e = window.visualViewport) == null ? void 0 : _e.offsetLeft) != null ? _f : "null",
|
|
8748
|
+
(_h = (_g = window.visualViewport) == null ? void 0 : _g.offsetTop) != null ? _h : "null"
|
|
8749
|
+
);
|
|
8732
8750
|
}
|
|
8733
8751
|
hasRoot(divElement) {
|
|
8734
8752
|
let current = divElement;
|
|
@@ -8965,12 +8983,14 @@ class ContainerResizeObserver {
|
|
|
8965
8983
|
return containerResizeObserver;
|
|
8966
8984
|
}
|
|
8967
8985
|
observePlaygroundSize(container, sizer, wrapper) {
|
|
8986
|
+
console.log(`[window-manager] observePlaygroundSize ${container.getBoundingClientRect(), sizer.getBoundingClientRect(), wrapper.getBoundingClientRect()}`);
|
|
8968
8987
|
this.updateSizer(container.getBoundingClientRect(), sizer, wrapper);
|
|
8969
8988
|
this.containerResizeObserver = new ResizeObserver$2((entries) => {
|
|
8970
8989
|
var _a;
|
|
8971
8990
|
const containerRect = (_a = entries[0]) == null ? void 0 : _a.contentRect;
|
|
8972
8991
|
if (containerRect) {
|
|
8973
8992
|
this.updateSizer(containerRect, sizer, wrapper);
|
|
8993
|
+
console.log(`[window-manager] containerResizeObserver ${containerRect}`);
|
|
8974
8994
|
this.emitter.emit("playgroundSizeChange", containerRect);
|
|
8975
8995
|
}
|
|
8976
8996
|
});
|
|
@@ -9153,7 +9173,7 @@ const replaceRoomFunction = (room, manager) => {
|
|
|
9153
9173
|
var _a;
|
|
9154
9174
|
_scalePptToFit.call(room, ...args);
|
|
9155
9175
|
if ((_a = manager.appManager) == null ? void 0 : _a.mainViewProxy) {
|
|
9156
|
-
console.log("[window-manager] scalePptToFit "
|
|
9176
|
+
console.log("[window-manager] scalePptToFit " + JSON.stringify(args));
|
|
9157
9177
|
manager.appManager.mainViewProxy.setCameraAndSize();
|
|
9158
9178
|
}
|
|
9159
9179
|
};
|
|
@@ -19747,7 +19767,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
|
|
19747
19767
|
const _WindowManager = class extends InvisiblePlugin {
|
|
19748
19768
|
constructor(context) {
|
|
19749
19769
|
super(context);
|
|
19750
|
-
this.version = "1.0.13-test.
|
|
19770
|
+
this.version = "1.0.13-test.5";
|
|
19751
19771
|
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" } };
|
|
19752
19772
|
this.emitter = callbacks$1;
|
|
19753
19773
|
this.viewMode = ViewMode.Broadcaster;
|
|
@@ -19755,12 +19775,28 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
19755
19775
|
this._cursorUIDs = [];
|
|
19756
19776
|
this.containerSizeRatio = _WindowManager.containerSizeRatio;
|
|
19757
19777
|
this.visibleStateListener = () => {
|
|
19758
|
-
console.log("[window-manager] visibleStateListener isVisible:"
|
|
19778
|
+
console.log("[window-manager] visibleStateListener isVisible:" + !document.hidden);
|
|
19779
|
+
};
|
|
19780
|
+
this.onMainViewScenePathChangeHandler = (scenePath) => {
|
|
19781
|
+
const mainViewElement = this.mainView.divElement;
|
|
19782
|
+
if (mainViewElement) {
|
|
19783
|
+
const backgroundImage = mainViewElement.querySelector(".background img");
|
|
19784
|
+
if (backgroundImage) {
|
|
19785
|
+
const backgroundImageRect = backgroundImage == null ? void 0 : backgroundImage.getBoundingClientRect();
|
|
19786
|
+
const backgroundImageCSS = window.getComputedStyle(backgroundImage);
|
|
19787
|
+
const backgroundImageVisible = (backgroundImageRect == null ? void 0 : backgroundImageRect.width) > 0 && (backgroundImageRect == null ? void 0 : backgroundImageRect.height) > 0 && backgroundImageCSS.display !== "none";
|
|
19788
|
+
console.log("[window-manager] backgroundImageVisible" + backgroundImageVisible);
|
|
19789
|
+
return;
|
|
19790
|
+
}
|
|
19791
|
+
console.log("[window-manager] onMainViewScenePathChange" + scenePath + "backgroundImageVisible is not found");
|
|
19792
|
+
}
|
|
19793
|
+
console.log("[window-manager] onMainViewScenePathChange" + scenePath + "mainViewElement is not found");
|
|
19759
19794
|
};
|
|
19760
19795
|
_WindowManager.displayer = context.displayer;
|
|
19761
19796
|
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" } };
|
|
19762
19797
|
this.visibleStateListener();
|
|
19763
19798
|
document.addEventListener("visibilitychange", this.visibleStateListener);
|
|
19799
|
+
this.emitter.on("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
|
|
19764
19800
|
}
|
|
19765
19801
|
get Logger() {
|
|
19766
19802
|
return this._roomLogger;
|
|
@@ -19876,6 +19912,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
19876
19912
|
console.warn("[WindowManager]: indexedDB open failed");
|
|
19877
19913
|
console.log(error);
|
|
19878
19914
|
}
|
|
19915
|
+
manager.emitter.on("mainViewScenePathChange", manager.onMainViewScenePathChangeHandler);
|
|
19879
19916
|
return manager;
|
|
19880
19917
|
}
|
|
19881
19918
|
static initManager(room) {
|
|
@@ -20437,6 +20474,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
|
20437
20474
|
}
|
|
20438
20475
|
_WindowManager.params = void 0;
|
|
20439
20476
|
document.removeEventListener("visibilitychange", this.visibleStateListener);
|
|
20477
|
+
this.emitter.off("mainViewScenePathChange", this.onMainViewScenePathChangeHandler);
|
|
20440
20478
|
(_f = this._iframeBridge) == null ? void 0 : _f.destroy();
|
|
20441
20479
|
this._iframeBridge = void 0;
|
|
20442
20480
|
log("Destroyed");
|