@netless/window-manager 0.3.0-canary.3 → 0.3.2
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/AppListener.d.ts +0 -1
- package/dist/ViewManager.d.ts +1 -0
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +2 -2
- package/src/AppContext.ts +2 -7
- package/src/AppListener.ts +0 -15
- package/src/AppManager.ts +9 -5
- package/src/Utils/Common.ts +1 -1
- package/src/index.ts +1 -1
- package/src/viewManager.ts +6 -6
- package/e2e/cypress/screenshots/reconnect.spec.ts//351/207/215/350/277/236 -- /346/226/255/347/275/221/351/207/215/350/277/236 (failed).png +0 -0
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.2",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.es.js",
|
6
6
|
"module": "dist/index.es.js",
|
@@ -24,7 +24,7 @@
|
|
24
24
|
"@juggle/resize-observer": "^3.3.1",
|
25
25
|
"@netless/app-docs-viewer": "^0.1.21",
|
26
26
|
"@netless/app-media-player": "0.1.0-beta.5",
|
27
|
-
"@netless/telebox-insider": "0.2.
|
27
|
+
"@netless/telebox-insider": "0.2.4",
|
28
28
|
"emittery": "^0.9.2",
|
29
29
|
"lodash": "^4.17.21",
|
30
30
|
"p-retry": "^4.6.1",
|
package/src/AppContext.ts
CHANGED
@@ -102,13 +102,8 @@ export class AppContext<TAttrs extends Record<string, any>, AppOptions = any> {
|
|
102
102
|
|
103
103
|
public async setScenePath(scenePath: string): Promise<void> {
|
104
104
|
if (!this.appProxy.box) return;
|
105
|
-
|
106
|
-
|
107
|
-
} else {
|
108
|
-
this.emitter.emit("focus", true);
|
109
|
-
await wait(50);
|
110
|
-
setScenePath(this.getRoom(), scenePath);
|
111
|
-
}
|
105
|
+
this.appProxy.setFullPath(scenePath);
|
106
|
+
this.manager.viewManager.switchAppToWriter(this.appId);
|
112
107
|
}
|
113
108
|
|
114
109
|
public mountView(dom: HTMLDivElement): void {
|
package/src/AppListener.ts
CHANGED
@@ -30,10 +30,6 @@ export class AppListeners {
|
|
30
30
|
this.appResizeHandler(data.payload);
|
31
31
|
break;
|
32
32
|
}
|
33
|
-
case Events.AppBlur: {
|
34
|
-
this.appBlurHandler(data.payload);
|
35
|
-
break;
|
36
|
-
}
|
37
33
|
case Events.AppBoxStateChange: {
|
38
34
|
this.appBoxStateHandler(data.payload);
|
39
35
|
break;
|
@@ -57,21 +53,10 @@ export class AppListeners {
|
|
57
53
|
this.manager.room?.refreshViewSize();
|
58
54
|
};
|
59
55
|
|
60
|
-
private appBlurHandler = (payload: any) => {
|
61
|
-
const proxy = this.appProxies.get(payload.appId);
|
62
|
-
if (proxy) {
|
63
|
-
proxy.appEmitter.emit("writableChange", false);
|
64
|
-
if (proxy.view?.mode === ViewVisionMode.Writable) {
|
65
|
-
this.manager.viewManager.refreshViews();
|
66
|
-
}
|
67
|
-
}
|
68
|
-
};
|
69
|
-
|
70
56
|
private appBoxStateHandler = (payload: any) => {
|
71
57
|
this.boxManager.setBoxState(payload.state);
|
72
58
|
};
|
73
59
|
|
74
|
-
|
75
60
|
private switchViewsToFreedomHandler = () => {
|
76
61
|
this.manager.viewManager.freedomAllViews();
|
77
62
|
};
|
package/src/AppManager.ts
CHANGED
@@ -80,16 +80,20 @@ export class AppManager {
|
|
80
80
|
this.refresher?.add("maximized", () => {
|
81
81
|
return autorun(
|
82
82
|
() => {
|
83
|
-
const maximized = this.attributes.maximized
|
84
|
-
this.boxManager.teleBoxManager.
|
83
|
+
const maximized = this.attributes.maximized;
|
84
|
+
if (this.boxManager.teleBoxManager.maximized !== maximized) {
|
85
|
+
this.boxManager.teleBoxManager.setMaximized(Boolean(maximized), true);
|
86
|
+
}
|
85
87
|
}
|
86
88
|
)
|
87
89
|
});
|
88
90
|
this.refresher?.add("minimized", () => {
|
89
91
|
return autorun(
|
90
92
|
() => {
|
91
|
-
const minimized = this.attributes.minimized
|
92
|
-
this.boxManager.teleBoxManager.
|
93
|
+
const minimized = this.attributes.minimized;
|
94
|
+
if (this.boxManager.teleBoxManager.minimized !== minimized) {
|
95
|
+
this.boxManager.teleBoxManager.setMinimized(Boolean(minimized), true);
|
96
|
+
}
|
93
97
|
}
|
94
98
|
)
|
95
99
|
});
|
@@ -98,7 +102,7 @@ export class AppManager {
|
|
98
102
|
if (!mainScenePath) return;
|
99
103
|
const sceneState = this.displayer.state.sceneState;
|
100
104
|
if (sceneState.scenePath !== mainScenePath) {
|
101
|
-
this.room
|
105
|
+
setScenePath(this.room, mainScenePath);
|
102
106
|
}
|
103
107
|
}
|
104
108
|
this.displayerWritableListener(!this.room?.isWritable);
|
package/src/Utils/Common.ts
CHANGED
package/src/index.ts
CHANGED
@@ -170,7 +170,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
170
170
|
public static containerSizeRatio = DEFAULT_CONTAINER_RATIO;
|
171
171
|
private static isCreated = false;
|
172
172
|
|
173
|
-
public version = "0.3.
|
173
|
+
public version = "0.3.2";
|
174
174
|
|
175
175
|
public appListeners?: AppListeners;
|
176
176
|
|
package/src/viewManager.ts
CHANGED
@@ -2,7 +2,6 @@ import { Base } from "./Base";
|
|
2
2
|
import { callbacks, WindowManager } from "./index";
|
3
3
|
import { reaction, ViewVisionMode } from "white-web-sdk";
|
4
4
|
import { SET_SCENEPATH_DELAY } from "./constants";
|
5
|
-
import { TELE_BOX_STATE } from "@netless/telebox-insider";
|
6
5
|
import {
|
7
6
|
notifyMainViewModeChange,
|
8
7
|
setScenePath,
|
@@ -15,6 +14,7 @@ import type { AppManager } from "./AppManager";
|
|
15
14
|
export class ViewManager extends Base {
|
16
15
|
private views: Map<string, View> = new Map();
|
17
16
|
private timer?: number;
|
17
|
+
private appTimer?: number;
|
18
18
|
|
19
19
|
private mainViewProxy = this.manager.mainViewProxy;
|
20
20
|
private displayer = this.manager.displayer;
|
@@ -133,13 +133,13 @@ export class ViewManager extends Base {
|
|
133
133
|
public switchAppToWriter(id: string): void {
|
134
134
|
this.freedomAllViews();
|
135
135
|
// 为了同步端不闪烁, 需要给 room setScenePath 一个延迟
|
136
|
-
|
136
|
+
if (this.appTimer) {
|
137
|
+
clearTimeout(this.appTimer);
|
138
|
+
}
|
139
|
+
this.appTimer = setTimeout(() => {
|
137
140
|
const appProxy = this.manager.appProxies.get(id);
|
138
141
|
if (appProxy) {
|
139
|
-
|
140
|
-
if (boxState && boxState === TELE_BOX_STATE.Minimized) {
|
141
|
-
return;
|
142
|
-
}
|
142
|
+
if (this.manager.boxManager.teleBoxManager.minimized) return;
|
143
143
|
appProxy.setScenePath();
|
144
144
|
appProxy.switchToWritable();
|
145
145
|
appProxy.focusBox();
|