@netless/window-manager 1.0.7-beta.2 → 1.0.7-beta.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "1.0.7-beta.2",
3
+ "version": "1.0.7-beta.3",
4
4
  "description": "Multi-window mode for Netless Whiteboard",
5
5
  "author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
6
6
  "license": "MIT",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@juggle/resize-observer": "^3.3.1",
35
- "@netless/telebox-insider": "0.3.0-beta.9",
35
+ "@netless/telebox-insider": "0.3.0-beta.10",
36
36
  "emittery": "^0.9.2",
37
37
  "lodash": "^4.17.21",
38
38
  "p-retry": "^4.6.1",
@@ -179,7 +179,8 @@ export class AppProxy implements PageRemoveService {
179
179
  if (!this.boxManager) {
180
180
  throw new BoxManagerNotFoundError();
181
181
  }
182
- const context = new AppContext(this.manager, this.boxManager, appId, this, appOptions);
182
+ const AppContextClass = getExtendClass(AppContext, WindowManager.extendClass);
183
+ const context = new AppContextClass(this.manager, this.boxManager, appId, this, appOptions);
183
184
  this.appContext = context;
184
185
  try {
185
186
  internalEmitter.once(`${appId}${Events.WindowCreated}` as any).then(async () => {
package/src/AppManager.ts CHANGED
@@ -458,8 +458,6 @@ export class AppManager {
458
458
  return safeListenPropsUpdated(
459
459
  () => this.attributes.boxesStatus,
460
460
  () => {
461
- const currentBoxesStatus = this.boxManager?.teleBoxManager.boxesStatus;
462
- console.log("boxesStatus===>autorun", isEqual(Object.entries(this.attributes.boxesStatus), [...(currentBoxesStatus?.entries() ?? [])]), Object.entries(this.attributes.boxesStatus), [...(currentBoxesStatus?.entries() ?? [])])
463
461
  this.boxManager?.setBoxesStatus(this.attributes.boxesStatus);
464
462
  }
465
463
  );
@@ -468,8 +466,6 @@ export class AppManager {
468
466
  return safeListenPropsUpdated(
469
467
  () => this.attributes.lastNotMinimizedBoxesStatus,
470
468
  () => {
471
- const currentLastNotMinimizedBoxesStatus = this.boxManager?.teleBoxManager.lastNotMinimizedBoxesStatus;
472
- console.log("lastNotMinimizedBoxesStatus===>autorun", isEqual(Object.entries(this.attributes.lastNotMinimizedBoxesStatus), [...(currentLastNotMinimizedBoxesStatus?.entries() ?? [])]), Object.entries(this.attributes.lastNotMinimizedBoxesStatus), [...(currentLastNotMinimizedBoxesStatus?.entries() ?? [])])
473
469
  this.boxManager?.setLastNotMinimizedBoxesStatus(this.attributes.lastNotMinimizedBoxesStatus);
474
470
  }
475
471
  );
@@ -708,12 +704,6 @@ export class AppManager {
708
704
  const attrs = params.attributes ?? {};
709
705
  this.safeUpdateAttributes([appId], attrs);
710
706
  this.store.setupAppAttributes(params, appId, isDynamicPPT);
711
- // if (this.useBoxesStatus){
712
- // // todo: 这里需要优化
713
- // // if(!this.store.getLastNotMinimizedBoxesStatus()){
714
- // // this.store.setLastNotMinimizedBoxesStatus({});
715
- // // }
716
- // }
717
707
  const needFocus = !this.boxManager?.minimized;
718
708
  if (needFocus) {
719
709
  this.store.setAppFocus(appId, true);
package/src/BoxManager.ts CHANGED
@@ -179,7 +179,6 @@ export class BoxManager {
179
179
  this.teleBoxManager.events.on("focused", box => {
180
180
  if (box) {
181
181
  if (this.canOperate) {
182
- console.log("focused===>focused", box.id, box.zIndex)
183
182
  boxEmitter.emit("focus", { appId: box.id });
184
183
  } else {
185
184
  this.teleBoxManager.blurBox(box.id);
@@ -189,7 +188,6 @@ export class BoxManager {
189
188
  this.teleBoxManager.events.on("blurred", box => {
190
189
  if (box) {
191
190
  if (this.canOperate) {
192
- console.log("focused===>blurred", box.id, box.zIndex)
193
191
  boxEmitter.emit("blurred", { appId: box.id });
194
192
  }
195
193
  }
@@ -273,7 +271,6 @@ export class BoxManager {
273
271
  id: params.appId,
274
272
  boxStatus: params.boxStatus,
275
273
  };
276
- console.log("createBox===>", createBoxConfig.id, params.boxStatus)
277
274
  this.teleBoxManager.create(createBoxConfig, params.smartPosition);
278
275
  this.context.emitter.emit(`${params.appId}${Events.WindowCreated}` as any);
279
276
  }
@@ -1,15 +1,22 @@
1
- import { AppProxy } from "../App";
1
+ import { AppContext, AppProxy } from "../App";
2
2
  import { AppManager } from "../AppManager";
3
3
  import { AttributesDelegate } from "../AttributesDelegate";
4
4
  import { BoxManager } from "../BoxManager";
5
5
  import { CursorManager } from "../Cursor";
6
6
 
7
+ export { AppManager } from "../AppManager";
8
+ export { AppContext, AppProxy } from "../App";
9
+ export { BoxManager } from "../BoxManager";
10
+ export { AttributesDelegate } from "../AttributesDelegate";
11
+ export { CursorManager } from "../Cursor";
12
+
7
13
  export type ExtendClassAble =
8
14
  | typeof AppManager
15
+ | typeof AppProxy
16
+ | typeof AppContext
9
17
  | typeof BoxManager
10
18
  | typeof AttributesDelegate
11
19
  | typeof CursorManager
12
- | typeof AppProxy;
13
20
 
14
21
  export type ExtendClass = {
15
22
  AppManager?: typeof AppManager;
@@ -17,12 +24,13 @@ export type ExtendClass = {
17
24
  AttributesDelegate?: typeof AttributesDelegate;
18
25
  CursorManager?: typeof CursorManager;
19
26
  AppProxy?: typeof AppProxy;
27
+ AppContext?: typeof AppContext;
20
28
  };
21
29
  export function getExtendClass<T extends ExtendClassAble>(
22
30
  baseClass: T,
23
31
  extendClass?: ExtendClass
24
32
  ): T {
25
- switch (baseClass.constructor.name) {
33
+ switch (baseClass.name) {
26
34
  case "AppManager":
27
35
  return (extendClass?.AppManager || AppManager) as T;
28
36
  case "BoxManager":
@@ -33,6 +41,8 @@ export function getExtendClass<T extends ExtendClassAble>(
33
41
  return (extendClass?.CursorManager || CursorManager) as T;
34
42
  case "AppProxy":
35
43
  return (extendClass?.AppProxy || AppProxy) as T;
44
+ case "AppContext":
45
+ return (extendClass?.AppContext || AppContext) as T;
36
46
  default:
37
47
  return baseClass;
38
48
  }
package/src/index.ts CHANGED
@@ -64,7 +64,8 @@ import { setOptions } from "@netless/app-media-player";
64
64
  import type { ExtendPluginInstance } from "./ExtendPluginManager";
65
65
  import { ExtendPluginManager } from "./ExtendPluginManager";
66
66
  import { ExtendClass, getExtendClass } from "./Utils/extendClass";
67
- export * from "./View/IframeBridge";
67
+
68
+ export * from "./utils/extendClass";
68
69
 
69
70
  export type WindowMangerAttributes = {
70
71
  modelValue?: string;
@@ -166,7 +167,7 @@ export type MountParams = {
166
167
  fullscreen?: boolean;
167
168
  polling?: boolean;
168
169
  supportAppliancePlugin?: boolean;
169
- /** 是否使用 boxesStatus 状态 */
170
+ /** 是否使用 boxesStatus 状态管理窗口 */
170
171
  useBoxesStatus?: boolean;
171
172
  };
172
173