@netless/window-manager 1.0.13-test.14 → 1.0.13-test.16
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 +9 -0
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -3
- package/dist/index.mjs.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/ContainerResizeObserver.ts +7 -1
- package/src/InternalEmitter.ts +1 -0
- package/src/View/MainView.ts +56 -1
- package/src/style.css +2 -0
package/dist/index.mjs
CHANGED
|
@@ -7792,6 +7792,7 @@ class MainViewProxy {
|
|
|
7792
7792
|
this.started = false;
|
|
7793
7793
|
this.mainViewIsAddListener = false;
|
|
7794
7794
|
this.isForcingMainViewDivElement = false;
|
|
7795
|
+
this.wrapperRectWorkaroundFrame = 0;
|
|
7795
7796
|
this.store = this.manager.store;
|
|
7796
7797
|
this.viewMode = this.manager.windowManger.viewMode;
|
|
7797
7798
|
this.sideEffectManager = new o$2();
|
|
@@ -7815,6 +7816,44 @@ class MainViewProxy {
|
|
|
7815
7816
|
});
|
|
7816
7817
|
});
|
|
7817
7818
|
};
|
|
7819
|
+
this.onWrapperRectChange = (payload) => {
|
|
7820
|
+
this.pendingWrapperRectChange = payload;
|
|
7821
|
+
console.log("[window-manager] onWrapperRectChange " + JSON.stringify({
|
|
7822
|
+
...payload,
|
|
7823
|
+
viewSize: this.mainView.size
|
|
7824
|
+
}));
|
|
7825
|
+
if (this.wrapperRectWorkaroundFrame) {
|
|
7826
|
+
cancelAnimationFrame(this.wrapperRectWorkaroundFrame);
|
|
7827
|
+
}
|
|
7828
|
+
this.wrapperRectWorkaroundFrame = requestAnimationFrame(this.runWrapperRectWorkaround);
|
|
7829
|
+
};
|
|
7830
|
+
this.runWrapperRectWorkaround = () => {
|
|
7831
|
+
this.wrapperRectWorkaroundFrame = 0;
|
|
7832
|
+
const payload = this.pendingWrapperRectChange;
|
|
7833
|
+
const element2 = this.mainView.divElement;
|
|
7834
|
+
this.pendingWrapperRectChange = void 0;
|
|
7835
|
+
if (!payload || !element2)
|
|
7836
|
+
return;
|
|
7837
|
+
const rect = element2.getBoundingClientRect();
|
|
7838
|
+
const observedSize = { width: rect.width, height: rect.height };
|
|
7839
|
+
const wrapperMatchesDom = Math.abs(payload.width - observedSize.width) <= 0.5 && Math.abs(payload.height - observedSize.height) <= 0.5;
|
|
7840
|
+
const viewIsStale = Math.abs(this.mainView.size.width - observedSize.width) > 0.5 || Math.abs(this.mainView.size.height - observedSize.height) > 0.5;
|
|
7841
|
+
console.log("[window-manager] runWrapperRectWorkaround " + JSON.stringify({
|
|
7842
|
+
origin: payload.origin,
|
|
7843
|
+
wrapperRect: payload,
|
|
7844
|
+
domRect: observedSize,
|
|
7845
|
+
viewSize: this.mainView.size,
|
|
7846
|
+
wrapperMatchesDom,
|
|
7847
|
+
viewIsStale
|
|
7848
|
+
}));
|
|
7849
|
+
if (wrapperMatchesDom && viewIsStale) {
|
|
7850
|
+
this.forceSyncMainViewDivElement(
|
|
7851
|
+
`wrapperRectChange:${payload.origin || "unknown"}`,
|
|
7852
|
+
observedSize,
|
|
7853
|
+
element2
|
|
7854
|
+
);
|
|
7855
|
+
}
|
|
7856
|
+
};
|
|
7818
7857
|
this.addCameraReaction = () => {
|
|
7819
7858
|
this.manager.refresher.add(Fields.MainViewCamera, this.cameraReaction);
|
|
7820
7859
|
};
|
|
@@ -7892,7 +7931,6 @@ class MainViewProxy {
|
|
|
7892
7931
|
} : null,
|
|
7893
7932
|
viewSize: this.mainView.size
|
|
7894
7933
|
}));
|
|
7895
|
-
this.forceSyncMainViewDivElement("mainViewResizeObserver", observedSize, target);
|
|
7896
7934
|
};
|
|
7897
7935
|
this._syncMainViewTimer = 0;
|
|
7898
7936
|
this.handleCameraOrSizeUpdated = (source, payload) => {
|
|
@@ -7959,6 +7997,9 @@ class MainViewProxy {
|
|
|
7959
7997
|
this.sideEffectManager.add(() => {
|
|
7960
7998
|
return internalEmitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio);
|
|
7961
7999
|
});
|
|
8000
|
+
this.sideEffectManager.add(() => {
|
|
8001
|
+
return internalEmitter.on("wrapperRectChange", this.onWrapperRectChange);
|
|
8002
|
+
});
|
|
7962
8003
|
this.sideEffectManager.add(() => {
|
|
7963
8004
|
return internalEmitter.on("startReconnect", () => {
|
|
7964
8005
|
if (!this.didRelease) {
|
|
@@ -8182,6 +8223,10 @@ class MainViewProxy {
|
|
|
8182
8223
|
}
|
|
8183
8224
|
destroy() {
|
|
8184
8225
|
console.log("[window-manager] destroy ");
|
|
8226
|
+
if (this.wrapperRectWorkaroundFrame) {
|
|
8227
|
+
cancelAnimationFrame(this.wrapperRectWorkaroundFrame);
|
|
8228
|
+
this.wrapperRectWorkaroundFrame = 0;
|
|
8229
|
+
}
|
|
8185
8230
|
this.removeMainViewListener();
|
|
8186
8231
|
this.disconnectMainViewResizeObserver();
|
|
8187
8232
|
this.stop();
|
|
@@ -9136,7 +9181,13 @@ class ContainerResizeObserver {
|
|
|
9136
9181
|
wrapper.style.width = `${width}px`;
|
|
9137
9182
|
wrapper.style.height = `${height}px`;
|
|
9138
9183
|
wrapper.style.backgroundColor = "green";
|
|
9139
|
-
|
|
9184
|
+
const wrapperRect = wrapper.getBoundingClientRect();
|
|
9185
|
+
console.log(`[window-manager] updateSizer from ${origin}: ${JSON.stringify({ width, height })} ${wrapper.style.width} ${wrapper.style.height} ${JSON.stringify(wrapperRect)}`);
|
|
9186
|
+
this.emitter.emit("wrapperRectChange", {
|
|
9187
|
+
width: wrapperRect.width,
|
|
9188
|
+
height: wrapperRect.height,
|
|
9189
|
+
origin
|
|
9190
|
+
});
|
|
9140
9191
|
}
|
|
9141
9192
|
}
|
|
9142
9193
|
disconnect() {
|
|
@@ -19892,7 +19943,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
|
|
|
19892
19943
|
const _WindowManager = class extends InvisiblePlugin {
|
|
19893
19944
|
constructor(context) {
|
|
19894
19945
|
super(context);
|
|
19895
|
-
this.version = "1.0.13-test.
|
|
19946
|
+
this.version = "1.0.13-test.16";
|
|
19896
19947
|
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" } };
|
|
19897
19948
|
this.emitter = callbacks$1;
|
|
19898
19949
|
this.viewMode = ViewMode.Broadcaster;
|