@netless/window-manager 0.4.0-canary.0 → 0.4.0-canary.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 0.4.0
2
+
3
+ 1. 废弃 `WindowManager.mount` 的多参数类型
4
+ 2. 添加 `bindContainer` 接口,`mount` 时 `container` 参数不再是必选
5
+
6
+
1
7
  ## 0.3.18
2
8
 
3
9
  1. 修复最小化时刷新页面 box 位置错误的问题
@@ -12,4 +12,5 @@ export declare class AppListeners {
12
12
  private switchViewsToFreedomHandler;
13
13
  private boxStateChangeHandler;
14
14
  private setMainViewScenePathHandler;
15
+ private moveCameraToContainHandler;
15
16
  }
@@ -3,8 +3,8 @@ import { AppProxy } from "./AppProxy";
3
3
  import { WindowManager } from "./index";
4
4
  import { CameraStore } from "./Utils/CameraStore";
5
5
  import { MainViewProxy } from "./MainView";
6
- import { ReconnectRefresher } from "./ReconnectRefresher";
7
6
  import { ViewManager } from "./ViewManager";
7
+ import type { ReconnectRefresher } from "./ReconnectRefresher";
8
8
  import type { BoxManager } from "./BoxManager";
9
9
  import type { Displayer, Room } from "white-web-sdk";
10
10
  import type { AddAppParams, TeleBoxRect } from "./index";
@@ -58,7 +58,7 @@ export declare class AppManager {
58
58
  safeDispatchMagixEvent(event: string, payload: any): void;
59
59
  private boxEventListener;
60
60
  focusByAttributes(apps: any): void;
61
- notifyReconnected(): Promise<void>;
61
+ onReconnected(): Promise<void>;
62
62
  notifyContainerRectUpdate(rect: TeleBoxRect): void;
63
63
  dispatchInternalEvent(event: Events, payload: any): void;
64
64
  destroy(): void;
@@ -20,7 +20,7 @@ export declare class AppProxy extends Base {
20
20
  isAddApp: boolean;
21
21
  private status;
22
22
  private stateKey;
23
- private setupResult?;
23
+ private appResult?;
24
24
  private appContext?;
25
25
  constructor(params: BaseInsertParams, manager: AppManager, appId: string, isAddApp: boolean);
26
26
  private initScenes;
@@ -13,11 +13,10 @@ export declare class Cursor extends Base {
13
13
  private cursorManager;
14
14
  private wrapper?;
15
15
  private member?;
16
- private disposer;
17
16
  private timer?;
18
17
  private component?;
19
- constructor(manager: AppManager, cursors: any, memberId: string, cursorManager: CursorManager, wrapper?: HTMLElement | undefined);
20
- private startReaction;
18
+ constructor(manager: AppManager, addCursorChangeListener: (uid: string, callback: (position: Position, state: CursorState) => void) => void, cursors: any, memberId: string, cursorManager: CursorManager, wrapper?: HTMLElement | undefined);
19
+ private onCursorChange;
21
20
  private moveCursor;
22
21
  get memberApplianceName(): ApplianceNames | undefined;
23
22
  get memberColor(): string;
@@ -1,6 +1,7 @@
1
- import { Base } from '../Base';
2
- import { Cursor } from './Cursor';
3
- import type { PositionType } from "../AttributesDelegate";
1
+ import { Base } from "../Base";
2
+ import { Cursor } from "./Cursor";
3
+ import { CursorState } from "../constants";
4
+ import type { PositionType, Position } from "../AttributesDelegate";
4
5
  import type { RoomMember, View } from "white-web-sdk";
5
6
  import type { AppManager } from "../AppManager";
6
7
  export declare type EventType = {
@@ -19,6 +20,7 @@ export declare class CursorManager extends Base {
19
20
  cursorInstances: Map<string, Cursor>;
20
21
  roomMembers?: readonly RoomMember[];
21
22
  private mainViewElement?;
23
+ private sideEffectManager;
22
24
  constructor(appManager: AppManager);
23
25
  setupWrapper(wrapper: HTMLElement): void;
24
26
  setMainViewDivElement(div: HTMLDivElement): void;
@@ -29,7 +31,6 @@ export declare class CursorManager extends Base {
29
31
  get boxState(): any;
30
32
  get focusView(): View | undefined;
31
33
  private mouseMoveListener;
32
- private touchMoveListener;
33
34
  private updateCursor;
34
35
  private getPoint;
35
36
  /**
@@ -44,5 +45,7 @@ export declare class CursorManager extends Base {
44
45
  deleteCursor(uid: string): void;
45
46
  hideCursor(uid: string): void;
46
47
  cleanMemberAttributes(members: readonly RoomMember[]): void;
48
+ onReconnect(): void;
49
+ addCursorChangeListener: (uid: string, callback: (position: Position, state: CursorState) => void) => void;
47
50
  destroy(): void;
48
51
  }
@@ -8,6 +8,7 @@ export declare class MainViewProxy extends Base {
8
8
  private mainViewIsAddListener;
9
9
  private mainView;
10
10
  private viewId;
11
+ private sideEffectManager;
11
12
  constructor(manager: AppManager);
12
13
  private get mainViewCamera();
13
14
  private get mainViewSize();
@@ -1,12 +1,17 @@
1
1
  import type { Room } from "white-web-sdk";
2
- import type { AppManager } from "./AppManager";
2
+ import type { EmitterType } from "./index";
3
+ export declare type ReconnectRefresherContext = {
4
+ emitter: EmitterType;
5
+ };
3
6
  export declare class ReconnectRefresher {
4
- private manager;
7
+ private ctx;
5
8
  private phase?;
6
9
  private room;
7
10
  private reactors;
8
11
  private disposers;
9
- constructor(room: Room | undefined, manager: AppManager);
12
+ constructor(ctx: ReconnectRefresherContext);
13
+ setRoom(room: Room | undefined): void;
14
+ setContext(ctx: ReconnectRefresherContext): void;
10
15
  private onPhaseChanged;
11
16
  private onReconnected;
12
17
  private releaseDisposers;
@@ -9,7 +9,8 @@ export declare enum Events {
9
9
  WindowCreated = "WindowCreated",
10
10
  SetMainViewScenePath = "SetMainViewScenePath",
11
11
  SetMainViewSceneIndex = "SetMainViewSceneIndex",
12
- SwitchViewsToFreedom = "SwitchViewsToFreedom"
12
+ SwitchViewsToFreedom = "SwitchViewsToFreedom",
13
+ MoveCameraToContain = "MoveCameraToContain"
13
14
  }
14
15
  export declare const MagixEventName = "__WindowManger";
15
16
  export declare enum AppAttributes {
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ import type { AppListeners } from "./AppListener";
11
11
  import type { NetlessApp, RegisterParams } from "./typings";
12
12
  import type { TeleBoxColorScheme, TeleBoxState } from "@netless/telebox-insider";
13
13
  import type { AppProxy } from "./AppProxy";
14
+ import { ReconnectRefresher } from "./ReconnectRefresher";
14
15
  export declare type WindowMangerAttributes = {
15
16
  modelValue?: string;
16
17
  boxState: TELE_BOX_STATE;
@@ -29,11 +30,11 @@ export declare type AddAppOptions = {
29
30
  export declare type setAppOptions = AddAppOptions & {
30
31
  appOptions?: any;
31
32
  };
32
- export declare type AddAppParams = {
33
+ export declare type AddAppParams<TAttributes = any> = {
33
34
  kind: string;
34
35
  src?: string;
35
36
  options?: AddAppOptions;
36
- attributes?: any;
37
+ attributes?: TAttributes;
37
38
  };
38
39
  export declare type BaseInsertParams = {
39
40
  kind: string;
@@ -91,6 +92,7 @@ export declare type EmitterEvent = {
91
92
  observerIdChange: number;
92
93
  boxStateChange: string;
93
94
  playgroundSizeChange: DOMRect;
95
+ onReconnected: void;
94
96
  };
95
97
  export declare type EmitterType = Emittery<EmitterEvent>;
96
98
  export declare const emitter: EmitterType;
@@ -118,6 +120,7 @@ export declare type MountParams = {
118
120
  };
119
121
  export declare type CallbacksType = Emittery<PublicEvent>;
120
122
  export declare const callbacks: CallbacksType;
123
+ export declare const reconnectRefresher: ReconnectRefresher;
121
124
  export declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
122
125
  static kind: string;
123
126
  static displayer: Displayer;
@@ -141,17 +144,16 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
141
144
  static mount(params: MountParams): Promise<WindowManager>;
142
145
  private static initManager;
143
146
  private static initContainer;
144
- bindContainer(container: HTMLElement, collectorContainer?: HTMLElement): void;
147
+ bindContainer(container: HTMLElement): void;
148
+ bindCollectorContainer(container: HTMLElement): void;
145
149
  /**
146
150
  * 注册插件
147
151
  */
148
152
  static register<AppOptions = any, SetupResult = any, Attributes = any>(params: RegisterParams<AppOptions, SetupResult, Attributes>): Promise<void>;
149
- static setContainer(container: HTMLElement): void;
150
- static setCollectorContainer(container: HTMLElement): void;
151
153
  /**
152
154
  * 创建一个 app 至白板
153
155
  */
154
- addApp(params: AddAppParams): Promise<string | undefined>;
156
+ addApp<T = any>(params: AddAppParams<T>): Promise<string | undefined>;
155
157
  private setupScenePath;
156
158
  /**
157
159
  * 设置 mainView 的 ScenePath, 并且切换白板为可写状态