@netless/window-manager 1.0.7-beta.9 → 1.0.9-beta.0
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 -2
- package/dist/index.js +10 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -37
- package/dist/index.mjs.map +1 -1
- package/docs/api.md +3 -2
- package/docs/cn/api.md +1 -0
- package/package.json +1 -1
- package/src/AppListener.ts +19 -19
- package/src/AppManager.ts +11 -13
- package/src/index.ts +5 -2
package/docs/api.md
CHANGED
|
@@ -67,6 +67,7 @@ parameter
|
|
|
67
67
|
| prefersColorScheme | [optional] string | light | auto, light, dark |
|
|
68
68
|
| debug | [optional] boolean | false | print log information |
|
|
69
69
|
| applianceIcons | [optional] {ApplianceNames, string} | | Configure the teaching aid picture used by the cursor |
|
|
70
|
+
| useBoxesStatus | [optional] boolean | false | Whether to use the boxesStatus status management window, after it is enabled, the status of each window can be managed separately |
|
|
70
71
|
|
|
71
72
|
|
|
72
73
|
<h3 id="register">WindowManager. register</h3>
|
|
@@ -294,8 +295,8 @@ manager.emitter.on(events, listener)
|
|
|
294
295
|
| ready | undefined | | Triggered when all apps are created |
|
|
295
296
|
| sceneStateChange | SceneState | | Fired when sceneState is modified |
|
|
296
297
|
| pageStateChange | PageState | | |
|
|
297
|
-
| fullscreenChange
|
|
298
|
-
| appsChange
|
|
298
|
+
| fullscreenChange | boolean | | Triggered when the full-screen status changes |
|
|
299
|
+
| appsChange | string[] | | Triggered when the list of opened apps changes |
|
|
299
300
|
|
|
300
301
|
```ts
|
|
301
302
|
type LoadAppEvent = {
|
package/docs/cn/api.md
CHANGED
|
@@ -66,6 +66,7 @@ const manager = await WindowManager.mount(
|
|
|
66
66
|
| prefersColorScheme | [optional] string | light | auto, light, dark |
|
|
67
67
|
| debug | [optional] boolean | false | 打印日志信息
|
|
68
68
|
| applianceIcons | [optional] {ApplianceNames, string} | | 配置光标使用的教具图片 |
|
|
69
|
+
| useBoxesStatus | [optional] boolean | false | 是否使用 boxesStatus 状态管理窗口, 开启后可以单独管理每个窗口的状态 |
|
|
69
70
|
|
|
70
71
|
<h3 id="register">WindowManager.register</h3>
|
|
71
72
|
|
package/package.json
CHANGED
package/src/AppListener.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { callbacks } from "./callback";
|
|
2
2
|
import { internalEmitter } from "./InternalEmitter";
|
|
3
3
|
import { Events, MagixEventName } from "./constants";
|
|
4
|
-
import { isEqual, omit } from "lodash";
|
|
4
|
+
// import { isEqual, omit } from "lodash";
|
|
5
5
|
import { setViewFocusScenePath } from "./Utils/Common";
|
|
6
|
-
import type {
|
|
6
|
+
import type { Event } from "white-web-sdk";
|
|
7
7
|
import type { AppManager } from "./AppManager";
|
|
8
8
|
import type { TeleBoxState } from "@netless/telebox-insider";
|
|
9
9
|
|
|
@@ -50,14 +50,14 @@ export class AppListeners {
|
|
|
50
50
|
this.setMainViewScenePathHandler(data.payload);
|
|
51
51
|
break;
|
|
52
52
|
}
|
|
53
|
-
case Events.MoveCamera: {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
}
|
|
57
|
-
case Events.MoveCameraToContain: {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
53
|
+
// case Events.MoveCamera: {
|
|
54
|
+
// this.moveCameraHandler(data.payload);
|
|
55
|
+
// break;
|
|
56
|
+
// }
|
|
57
|
+
// case Events.MoveCameraToContain: {
|
|
58
|
+
// this.moveCameraToContainHandler(data.payload);
|
|
59
|
+
// break;
|
|
60
|
+
// }
|
|
61
61
|
case Events.CursorMove: {
|
|
62
62
|
this.cursorMoveHandler(data.payload);
|
|
63
63
|
break;
|
|
@@ -102,16 +102,16 @@ export class AppListeners {
|
|
|
102
102
|
callbacks.emit("mainViewScenePathChange", nextScenePath);
|
|
103
103
|
};
|
|
104
104
|
|
|
105
|
-
private moveCameraHandler = (
|
|
106
|
-
|
|
107
|
-
) => {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
};
|
|
105
|
+
// private moveCameraHandler = (
|
|
106
|
+
// payload: Camera & { animationMode?: AnimationMode | undefined }
|
|
107
|
+
// ) => {
|
|
108
|
+
// if (isEqual(omit(payload, ["animationMode"]), { ...this.manager.mainView.camera })) return;
|
|
109
|
+
// this.manager.mainView.moveCamera(payload);
|
|
110
|
+
// };
|
|
111
111
|
|
|
112
|
-
private moveCameraToContainHandler = (payload: any) => {
|
|
113
|
-
|
|
114
|
-
};
|
|
112
|
+
// private moveCameraToContainHandler = (payload: any) => {
|
|
113
|
+
// this.manager.mainView.moveCameraToContain(payload);
|
|
114
|
+
// };
|
|
115
115
|
|
|
116
116
|
private cursorMoveHandler = (payload: any) => {
|
|
117
117
|
internalEmitter.emit("cursorMove", payload);
|
package/src/AppManager.ts
CHANGED
|
@@ -345,15 +345,12 @@ export class AppManager {
|
|
|
345
345
|
private async onCreated() {
|
|
346
346
|
if (Object.keys(this.attributes.apps).length && this.store.focus) {
|
|
347
347
|
this._focusAppId = this.store.focus;
|
|
348
|
-
console.log("onCreated===>", this._focusAppId);
|
|
349
348
|
await new Promise<AppProxy | undefined>(resolve => {
|
|
350
349
|
this._focusAppCreatedResolve = resolve;
|
|
351
350
|
this._resolveTimer = setTimeout(() => {
|
|
352
|
-
|
|
353
|
-
resolve(this.appProxies.get(this._focusAppId || ''));
|
|
351
|
+
resolve(this.appProxies.get(this._focusAppId || ""));
|
|
354
352
|
}, 500);
|
|
355
353
|
}).then(() => {
|
|
356
|
-
console.log("onCreated===>2222", this._focusAppId);
|
|
357
354
|
this.focusByAttributes(this.attributes.apps);
|
|
358
355
|
});
|
|
359
356
|
}
|
|
@@ -409,14 +406,16 @@ export class AppManager {
|
|
|
409
406
|
this.displayer.callbacks.on("onEnableWriteNowChanged", this.displayerWritableListener);
|
|
410
407
|
this._prevFocused = this.attributes.focus;
|
|
411
408
|
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
409
|
+
if (!WindowManager.supportAppliancePlugin) {
|
|
410
|
+
this.sideEffectManager.add(() => {
|
|
411
|
+
const redoUndo = new RedoUndo({
|
|
412
|
+
mainView: () => this.mainViewProxy.view,
|
|
413
|
+
focus: () => this.attributes.focus,
|
|
414
|
+
getAppProxy: id => this.appProxies.get(id),
|
|
415
|
+
});
|
|
416
|
+
return () => redoUndo.destroy();
|
|
417
417
|
});
|
|
418
|
-
|
|
419
|
-
});
|
|
418
|
+
}
|
|
420
419
|
}
|
|
421
420
|
|
|
422
421
|
private onBoxMove = (payload: BoxMovePayload) => {
|
|
@@ -604,7 +603,7 @@ export class AppManager {
|
|
|
604
603
|
if (!appAttributes) {
|
|
605
604
|
throw new Error("appAttributes is undefined");
|
|
606
605
|
}
|
|
607
|
-
|
|
606
|
+
|
|
608
607
|
this.appCreateQueue.push<AppProxy>(async () => {
|
|
609
608
|
this.appStatus.set(id, AppStatus.StartCreate);
|
|
610
609
|
const appProxy = await this.baseInsertApp(
|
|
@@ -624,7 +623,6 @@ export class AppManager {
|
|
|
624
623
|
this._focusAppId === id &&
|
|
625
624
|
this._focusAppCreatedResolve
|
|
626
625
|
) {
|
|
627
|
-
console.log("onCreated===>4444", this._focusAppId);
|
|
628
626
|
if (this._resolveTimer) {
|
|
629
627
|
clearTimeout(this._resolveTimer);
|
|
630
628
|
}
|
package/src/index.ts
CHANGED
|
@@ -66,6 +66,7 @@ import type { ExtendPluginInstance } from "./ExtendPluginManager";
|
|
|
66
66
|
import { ExtendPluginManager } from "./ExtendPluginManager";
|
|
67
67
|
import { getExtendClass } from "./Utils/extendClass";
|
|
68
68
|
import type { ExtendClass } from "./Utils/extendClass";
|
|
69
|
+
// import type { AppliancePluginInstance } from "@netless/appliance-plugin/dist/plugin/types";
|
|
69
70
|
|
|
70
71
|
export * from "./utils/extendClass";
|
|
71
72
|
|
|
@@ -230,6 +231,8 @@ export class WindowManager
|
|
|
230
231
|
private _cursorUIDs: string[] = [];
|
|
231
232
|
private _cursorUIDsStyleDOM?: HTMLStyleElement;
|
|
232
233
|
|
|
234
|
+
public _appliancePlugin?: any;
|
|
235
|
+
|
|
233
236
|
private boxManager?: BoxManager;
|
|
234
237
|
private static params?: MountParams;
|
|
235
238
|
static extendClass?: ExtendClass;
|
|
@@ -972,7 +975,7 @@ export class WindowManager
|
|
|
972
975
|
const mainViewCamera = { ...this.mainView.camera };
|
|
973
976
|
if (isEqual({ ...mainViewCamera, ...pureCamera }, mainViewCamera)) return;
|
|
974
977
|
this.mainView.moveCamera(camera);
|
|
975
|
-
this.appManager?.dispatchInternalEvent(Events.MoveCamera, camera);
|
|
978
|
+
// this.appManager?.dispatchInternalEvent(Events.MoveCamera, camera);
|
|
976
979
|
setTimeout(() => {
|
|
977
980
|
this.appManager?.mainViewProxy.setCameraAndSize();
|
|
978
981
|
}, 500);
|
|
@@ -985,7 +988,7 @@ export class WindowManager
|
|
|
985
988
|
}>
|
|
986
989
|
): void {
|
|
987
990
|
this.mainView.moveCameraToContain(rectangle);
|
|
988
|
-
this.appManager?.dispatchInternalEvent(Events.MoveCameraToContain, rectangle);
|
|
991
|
+
// this.appManager?.dispatchInternalEvent(Events.MoveCameraToContain, rectangle);
|
|
989
992
|
setTimeout(() => {
|
|
990
993
|
this.appManager?.mainViewProxy.setCameraAndSize();
|
|
991
994
|
}, 500);
|