@netless/window-manager 0.3.5-canary.1 → 0.3.6
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 +1 -0
- package/dist/constants.d.ts +0 -2
- package/dist/index.d.ts +2 -4
- 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/AppListener.ts +11 -1
- package/src/AppManager.ts +13 -9
- package/src/BoxManager.ts +1 -1
- package/src/constants.ts +0 -2
- package/src/index.ts +3 -5
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "0.3.
|
3
|
+
"version": "0.3.6",
|
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.6",
|
28
28
|
"emittery": "^0.9.2",
|
29
29
|
"lodash": "^4.17.21",
|
30
30
|
"p-retry": "^4.6.1",
|
package/src/AppListener.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
|
-
import {
|
1
|
+
import { callbacks } from './index';
|
2
|
+
import { Events, MagixEventName } from './constants';
|
2
3
|
import type { Event } from "white-web-sdk";
|
3
4
|
import type { AppManager } from "./AppManager";
|
5
|
+
import type { TeleBoxState } from "@netless/telebox-insider";
|
4
6
|
|
5
7
|
export class AppListeners {
|
6
8
|
private displayer = this.manager.displayer;
|
@@ -32,6 +34,10 @@ export class AppListeners {
|
|
32
34
|
this.switchViewsToFreedomHandler();
|
33
35
|
break;
|
34
36
|
}
|
37
|
+
case Events.AppBoxStateChange: {
|
38
|
+
this.boxStateChangeHandler(data.payload);
|
39
|
+
break;
|
40
|
+
}
|
35
41
|
default:
|
36
42
|
break;
|
37
43
|
}
|
@@ -50,4 +56,8 @@ export class AppListeners {
|
|
50
56
|
private switchViewsToFreedomHandler = () => {
|
51
57
|
this.manager.viewManager.freedomAllViews();
|
52
58
|
};
|
59
|
+
|
60
|
+
private boxStateChangeHandler = (state: TeleBoxState) => {
|
61
|
+
callbacks.emit("boxStateChange", state);
|
62
|
+
}
|
53
63
|
}
|
package/src/AppManager.ts
CHANGED
@@ -2,7 +2,7 @@ import { AppAttributes, AppStatus, Events, MagixEventName } from "./constants";
|
|
2
2
|
import { AppListeners } from "./AppListener";
|
3
3
|
import { AppProxy } from "./AppProxy";
|
4
4
|
import { AttributesDelegate } from "./AttributesDelegate";
|
5
|
-
import { BoxManager
|
5
|
+
import { BoxManager } from "./BoxManager";
|
6
6
|
import { callbacks, emitter } from "./index";
|
7
7
|
import { CameraStore } from "./Utils/CameraStore";
|
8
8
|
import { genAppId, makeValidScenePath, setScenePath } from "./Utils/Common";
|
@@ -14,7 +14,13 @@ import { ReconnectRefresher } from "./ReconnectRefresher";
|
|
14
14
|
import { ViewManager } from "./ViewManager";
|
15
15
|
import type { Displayer, DisplayerState, Room } from "white-web-sdk";
|
16
16
|
import type { CreateCollectorConfig } from "./BoxManager";
|
17
|
-
import type {
|
17
|
+
import type {
|
18
|
+
AddAppParams,
|
19
|
+
BaseInsertParams,
|
20
|
+
WindowManager,
|
21
|
+
TeleBoxRect,
|
22
|
+
EmitterEvent,
|
23
|
+
} from "./index";
|
18
24
|
export class AppManager {
|
19
25
|
public displayer: Displayer;
|
20
26
|
public boxManager: BoxManager;
|
@@ -69,12 +75,6 @@ export class AppManager {
|
|
69
75
|
return autorun(() => {
|
70
76
|
const maximized = this.attributes.maximized;
|
71
77
|
if (this.boxManager.maximized !== maximized) {
|
72
|
-
if (maximized === true && this.boxManager.minimized === false) {
|
73
|
-
const topBox = this.boxManager.getTopBox();
|
74
|
-
if (topBox) {
|
75
|
-
emitter.emit("focus", { appId: topBox.id });
|
76
|
-
}
|
77
|
-
}
|
78
78
|
this.boxManager.setMaximized(Boolean(maximized));
|
79
79
|
}
|
80
80
|
});
|
@@ -336,7 +336,7 @@ export class AppManager {
|
|
336
336
|
}
|
337
337
|
}
|
338
338
|
|
339
|
-
private boxEventListener = (eventName:
|
339
|
+
private boxEventListener = (eventName: keyof EmitterEvent, payload: any) => {
|
340
340
|
switch (eventName) {
|
341
341
|
case "move": {
|
342
342
|
this.dispatchInternalEvent(Events.AppMove, payload);
|
@@ -367,6 +367,10 @@ export class AppManager {
|
|
367
367
|
}
|
368
368
|
break;
|
369
369
|
}
|
370
|
+
case "boxStateChange": {
|
371
|
+
this.dispatchInternalEvent(Events.AppBoxStateChange, payload);
|
372
|
+
break;
|
373
|
+
}
|
370
374
|
default:
|
371
375
|
break;
|
372
376
|
}
|
package/src/BoxManager.ts
CHANGED
@@ -63,7 +63,7 @@ export class BoxManager {
|
|
63
63
|
this.teleBoxManager.events.on(TELE_BOX_MANAGER_EVENT.State, state => {
|
64
64
|
if (state) {
|
65
65
|
callbacks.emit("boxStateChange", state);
|
66
|
-
emitter.emit(
|
66
|
+
emitter.emit("boxStateChange", state);
|
67
67
|
}
|
68
68
|
});
|
69
69
|
this.teleBoxManager.events.on("minimized", minimized => {
|
package/src/constants.ts
CHANGED
@@ -2,9 +2,7 @@ export enum Events {
|
|
2
2
|
AppMove = "AppMove",
|
3
3
|
AppFocus = "AppFocus",
|
4
4
|
AppResize = "AppResize",
|
5
|
-
AppBlur = "AppBlur",
|
6
5
|
AppBoxStateChange = "AppBoxStateChange",
|
7
|
-
AppSnapshot = "AppSnapshot",
|
8
6
|
GetAttributes = "GetAttributes",
|
9
7
|
UpdateWindowManagerWrapper = "UpdateWindowManagerWrapper",
|
10
8
|
InitReplay = "InitReplay",
|
package/src/index.ts
CHANGED
@@ -120,7 +120,7 @@ export type AppInitState = {
|
|
120
120
|
boxState?: TeleBoxState; // 兼容旧版 telebox
|
121
121
|
};
|
122
122
|
|
123
|
-
type EmitterEvent = {
|
123
|
+
export type EmitterEvent = {
|
124
124
|
onCreated: undefined,
|
125
125
|
InitReplay: AppInitState,
|
126
126
|
move: { appId: string, x: number, y: number },
|
@@ -131,9 +131,7 @@ type EmitterEvent = {
|
|
131
131
|
seek: number,
|
132
132
|
mainViewMounted: undefined,
|
133
133
|
observerIdChange: number;
|
134
|
-
|
135
|
-
[TELE_BOX_STATE.Maximized]: undefined,
|
136
|
-
[TELE_BOX_STATE.Minimized]: undefined,
|
134
|
+
boxStateChange: string;
|
137
135
|
}
|
138
136
|
|
139
137
|
export const emitter: Emittery<EmitterEvent> = new Emittery();
|
@@ -170,7 +168,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
|
170
168
|
public static containerSizeRatio = DEFAULT_CONTAINER_RATIO;
|
171
169
|
private static isCreated = false;
|
172
170
|
|
173
|
-
public version = "0.3.
|
171
|
+
public version = "0.3.6";
|
174
172
|
|
175
173
|
public appListeners?: AppListeners;
|
176
174
|
|