@netless/window-manager 1.0.0-canary.2 → 1.0.0-canary.22

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.
Files changed (50) hide show
  1. package/__mocks__/white-web-sdk.ts +10 -1
  2. package/dist/App/AppContext.d.ts +11 -7
  3. package/dist/App/AppProxy.d.ts +35 -7
  4. package/dist/App/{WhiteBoardView.d.ts → WhiteboardView.d.ts} +10 -1
  5. package/dist/App/index.d.ts +2 -1
  6. package/dist/App/type.d.ts +21 -0
  7. package/dist/AppManager.d.ts +5 -5
  8. package/dist/AttributesDelegate.d.ts +11 -16
  9. package/dist/BoxManager.d.ts +7 -6
  10. package/dist/Cursor/index.d.ts +0 -1
  11. package/dist/InternalEmitter.d.ts +3 -2
  12. package/dist/Page/PageController.d.ts +1 -0
  13. package/dist/ReconnectRefresher.d.ts +1 -1
  14. package/dist/Utils/Common.d.ts +1 -0
  15. package/dist/View/CameraSynchronizer.d.ts +9 -9
  16. package/dist/View/MainView.d.ts +18 -7
  17. package/dist/View/ViewSync.d.ts +24 -0
  18. package/dist/constants.d.ts +6 -2
  19. package/dist/index.cjs.js +12 -12
  20. package/dist/index.d.ts +19 -2
  21. package/dist/index.es.js +803 -425
  22. package/dist/index.umd.js +12 -12
  23. package/dist/style.css +1 -1
  24. package/docs/app-context.md +98 -64
  25. package/docs/develop-app.md +2 -5
  26. package/docs/mirgrate-to-1.0.md +28 -0
  27. package/package.json +3 -3
  28. package/pnpm-lock.yaml +9 -9
  29. package/src/App/AppContext.ts +43 -21
  30. package/src/App/AppProxy.ts +247 -79
  31. package/src/App/{WhiteBoardView.ts → WhiteboardView.ts} +38 -4
  32. package/src/App/index.ts +2 -1
  33. package/src/App/type.ts +22 -0
  34. package/src/AppManager.ts +38 -31
  35. package/src/AttributesDelegate.ts +18 -18
  36. package/src/BoxManager.ts +28 -22
  37. package/src/Cursor/index.ts +0 -2
  38. package/src/InternalEmitter.ts +3 -2
  39. package/src/Page/PageController.ts +1 -0
  40. package/src/PageState.ts +1 -1
  41. package/src/ReconnectRefresher.ts +7 -2
  42. package/src/Utils/Common.ts +6 -0
  43. package/src/Utils/Reactive.ts +27 -26
  44. package/src/Utils/RoomHacker.ts +3 -0
  45. package/src/View/CameraSynchronizer.ts +43 -30
  46. package/src/View/MainView.ts +106 -81
  47. package/src/View/ViewSync.ts +110 -0
  48. package/src/constants.ts +5 -1
  49. package/src/index.ts +59 -15
  50. package/src/style.css +8 -0
@@ -34,8 +34,17 @@ enum ViewMode {
34
34
  Broadcaster = "broadcaster",
35
35
  }
36
36
 
37
+ enum AnimationMode {
38
+ Immediately = "immediately",
39
+ Continuous = "continuous",
40
+ }
41
+
37
42
  const isPlayer = vi.fn(() => false);
43
+ const unlistenDisposed = vi.fn();
44
+ const unlistenUpdated = vi.fn();
45
+ const toJS = vi.fn();
38
46
 
39
47
  export {
40
- InvisiblePlugin, UpdateEventKind, ApplianceNames, ViewMode, isPlayer
48
+ InvisiblePlugin, UpdateEventKind, ApplianceNames, ViewMode, isPlayer, unlistenDisposed,
49
+ unlistenUpdated, toJS, AnimationMode
41
50
  }
@@ -3,15 +3,17 @@ import { autorun, listenDisposed, listenUpdated, reaction, unlistenDisposed, unl
3
3
  import type { Room, SceneDefinition, View } from "white-web-sdk";
4
4
  import type { ReadonlyTeleBox } from "@netless/telebox-insider";
5
5
  import type Emittery from "emittery";
6
- import type { BoxManager } from "../BoxManager";
7
6
  import type { AppEmitterEvent, Member } from "../index";
8
7
  import type { AppManager } from "../AppManager";
9
8
  import type { AppProxy } from "./AppProxy";
10
9
  import type { MagixEventAddListener, MagixEventDispatcher, MagixEventRemoveListener } from "./MagixEvent";
11
- import { WhiteBoardView } from "./WhiteBoardView";
10
+ import { WhiteBoardView } from "./WhiteboardView";
11
+ export declare type CreateWhiteBoardViewParams = {
12
+ size?: number;
13
+ syncCamera?: boolean;
14
+ };
12
15
  export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOptions = any> {
13
16
  private manager;
14
- private boxManager;
15
17
  appId: string;
16
18
  private appProxy;
17
19
  private appOptions?;
@@ -30,15 +32,17 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
30
32
  private store;
31
33
  readonly isAddApp: boolean;
32
34
  readonly isReplay: boolean;
33
- private whiteBoardView?;
34
- constructor(manager: AppManager, boxManager: BoxManager, appId: string, appProxy: AppProxy, appOptions?: TAppOptions | (() => TAppOptions) | undefined);
35
+ whiteBoardView?: WhiteBoardView;
36
+ _viewWrapper?: HTMLElement;
37
+ constructor(manager: AppManager, appId: string, appProxy: AppProxy, appOptions?: TAppOptions | (() => TAppOptions) | undefined);
35
38
  get displayer(): import("white-web-sdk").Displayer<import("white-web-sdk").DisplayerCallbacks>;
39
+ get destroyed(): boolean;
36
40
  /** @deprecated Use context.storage.state instead. */
37
41
  getAttributes: () => TAttributes | undefined;
38
42
  getScenes: () => SceneDefinition[] | undefined;
39
43
  get view(): View | undefined;
40
- createWhiteBoardView: (size?: number | undefined) => WhiteBoardView;
41
- private initPageSize;
44
+ createWhiteBoardView: (params?: CreateWhiteBoardViewParams | undefined) => WhiteBoardView;
45
+ private ensurePageSize;
42
46
  getInitScenePath: () => string | undefined;
43
47
  /** Get App writable status. */
44
48
  get isWritable(): boolean;
@@ -1,12 +1,16 @@
1
1
  import Emittery from "emittery";
2
2
  import { AppContext } from "./AppContext";
3
3
  import { AppPageStateImpl } from "./AppPageStateImpl";
4
- import type { AppEmitterEvent, AppInitState, BaseInsertParams } from "../index";
4
+ import { Val } from "value-enhancer";
5
+ import { SideEffectManager } from "side-effect-manager";
6
+ import type { ICamera, ISize } from "../AttributesDelegate";
7
+ import type { AppEmitterEvent, BaseInsertParams } from "../index";
5
8
  import type { SceneState, View, SceneDefinition } from "white-web-sdk";
6
9
  import type { AppManager } from "../AppManager";
7
10
  import type { NetlessApp } from "../typings";
8
11
  import type { ReadonlyTeleBox } from "@netless/telebox-insider";
9
12
  import type { PageRemoveService, PageState } from "../Page";
13
+ import type { AppState } from "./type";
10
14
  export declare type AppEmitter = Emittery<AppEmitterEvent>;
11
15
  export declare class AppProxy implements PageRemoveService {
12
16
  private params;
@@ -22,15 +26,32 @@ export declare class AppProxy implements PageRemoveService {
22
26
  private appProxies;
23
27
  private viewManager;
24
28
  private store;
29
+ uid: string;
25
30
  isAddApp: boolean;
26
- private status;
31
+ status: "normal" | "destroyed";
27
32
  private stateKey;
28
33
  _pageState: AppPageStateImpl;
29
- private _prevFullPath;
30
- appResult?: NetlessApp<any>;
31
- appContext?: AppContext<any, any>;
32
- private sideEffectManager;
34
+ appResult?: NetlessApp;
35
+ appContext?: AppContext;
36
+ sideEffectManager: SideEffectManager;
37
+ private valManager;
38
+ private fullPath$;
39
+ private viewSync?;
40
+ camera$: Val<{
41
+ id: string;
42
+ centerX: number | null;
43
+ centerY: number | null;
44
+ scale: number;
45
+ } | undefined, any>;
46
+ size$: Val<ISize | undefined, any>;
47
+ box$: Val<ReadonlyTeleBox | undefined, any>;
48
+ view$: Val<View | undefined, any>;
49
+ syncCamera$: Val<boolean, any>;
50
+ whiteBoardViewCreated$: Val<boolean, any>;
33
51
  constructor(params: BaseInsertParams, manager: AppManager, appId: string, isAddApp: boolean);
52
+ fireMemberStateChange: () => void;
53
+ private onMemberStateChange;
54
+ private computedInitialRect;
34
55
  createAppDir(): View;
35
56
  private initScenes;
36
57
  get view(): View | undefined;
@@ -51,7 +72,7 @@ export declare class AppProxy implements PageRemoveService {
51
72
  onSeek(time: number): Promise<void>;
52
73
  onReconnected(): Promise<void>;
53
74
  onRemoveScene(scenePath: string): Promise<void>;
54
- getAppInitState: (id: string) => AppInitState | undefined;
75
+ getAppInitState: (id: string) => AppState | undefined;
55
76
  emitAppSceneStateChange(sceneState: SceneState): void;
56
77
  emitAppIsWritableChange(): void;
57
78
  private makeAppEventListener;
@@ -65,6 +86,13 @@ export declare class AppProxy implements PageRemoveService {
65
86
  removeSceneByIndex(index: number): Promise<boolean>;
66
87
  setSceneIndexWithoutSync(index: number): void;
67
88
  setSceneIndex(index: number): void;
89
+ storeCamera: (camera: ICamera) => void;
90
+ storeSize: (size: ISize) => void;
91
+ updateSize: (width: number, height: number) => void;
92
+ moveCamera: (camera: Partial<ICamera>) => void;
68
93
  destroy(needCloseBox: boolean, cleanAttrs: boolean, skipUpdate: boolean, error?: Error): Promise<void>;
94
+ private addCameraReaction;
95
+ private addSizeReaction;
96
+ onFocus: () => void;
69
97
  close(): Promise<void>;
70
98
  }
@@ -2,15 +2,24 @@ import type { ReadonlyVal } from "value-enhancer";
2
2
  import type { AddPageParams, PageController, PageState } from "../Page";
3
3
  import type { AppProxy } from "./AppProxy";
4
4
  import type { AppContext } from "./AppContext";
5
+ import type { View } from "white-web-sdk";
6
+ import type { TeleBoxRect } from "@netless/telebox-insider";
7
+ import type { ICamera } from "../AttributesDelegate";
8
+ export declare type WhiteBoardViewCamera = Omit<ICamera, "scale" | "id">;
5
9
  export declare class WhiteBoardView implements PageController {
10
+ view: View;
6
11
  protected appContext: AppContext;
7
12
  protected appProxy: AppProxy;
13
+ ensureSize: (size: number) => void;
8
14
  readonly pageState$: ReadonlyVal<PageState>;
9
- constructor(appContext: AppContext, appProxy: AppProxy);
15
+ readonly camera$: ReadonlyVal<WhiteBoardViewCamera>;
16
+ constructor(view: View, appContext: AppContext, appProxy: AppProxy, ensureSize: (size: number) => void);
10
17
  get pageState(): PageState;
18
+ moveCamera(camera: Partial<WhiteBoardViewCamera>): void;
11
19
  nextPage: () => Promise<boolean>;
12
20
  prevPage: () => Promise<boolean>;
13
21
  jumpPage: (index: number) => Promise<boolean>;
14
22
  addPage: (params?: AddPageParams | undefined) => Promise<void>;
15
23
  removePage: (index?: number | undefined) => Promise<boolean>;
24
+ setRect(rect: Omit<TeleBoxRect, "x" | "y">): void;
16
25
  }
@@ -1,3 +1,4 @@
1
1
  export * from "./AppProxy";
2
2
  export * from "./AppContext";
3
- export * from "./WhiteBoardView";
3
+ export * from "./WhiteboardView";
4
+ export * from "./type";
@@ -0,0 +1,21 @@
1
+ export declare type AppState = {
2
+ id: string;
3
+ focus?: boolean;
4
+ SceneIndex?: number;
5
+ draggable?: boolean;
6
+ position?: {
7
+ x: number;
8
+ y: number;
9
+ };
10
+ ratio?: number;
11
+ resizable?: boolean;
12
+ size?: {
13
+ width: number;
14
+ height: number;
15
+ };
16
+ stageRatio?: number;
17
+ visible?: boolean;
18
+ zIndex?: number;
19
+ maximized: boolean | null;
20
+ minimized: boolean | null;
21
+ };
@@ -16,15 +16,15 @@ export declare class AppManager {
16
16
  appStatus: Map<string, AppStatus>;
17
17
  store: import("./AttributesDelegate").AttributesDelegate;
18
18
  mainViewProxy: MainViewProxy;
19
- refresher?: ReconnectRefresher;
19
+ refresher: ReconnectRefresher;
20
20
  isReplay: boolean;
21
21
  mainViewScenesLength: number;
22
22
  private appListeners;
23
23
  boxManager?: BoxManager;
24
- private _prevSceneIndex;
25
- private _prevFocused;
26
24
  private callbacksNode;
27
25
  private appCreateQueue;
26
+ private sceneIndex$;
27
+ private focused$;
28
28
  private sideEffectManager;
29
29
  sceneState: SceneState | null;
30
30
  rootDirRemoving: boolean;
@@ -65,9 +65,9 @@ export declare class AppManager {
65
65
  private onFocusChange;
66
66
  attributesUpdateCallback: import("lodash").DebouncedFunc<(apps: any) => Promise<void>>;
67
67
  /**
68
- * 插件更新 attributes 时的回调
68
+ * 插件更新 apps 时的回调
69
69
  *
70
- * @param {*} attributes
70
+ * @param {*} apps
71
71
  * @memberof WindowManager
72
72
  */
73
73
  _attributesUpdateCallback(apps: any): Promise<void>;
@@ -1,6 +1,6 @@
1
1
  import { AppAttributes } from "./constants";
2
2
  import type { AddAppParams, AppSyncAttributes } from "./index";
3
- import type { Camera, Size, View } from "white-web-sdk";
3
+ import type { Size, View } from "white-web-sdk";
4
4
  import type { Cursor } from "./Cursor/Cursor";
5
5
  export declare enum Fields {
6
6
  Apps = "apps",
@@ -14,7 +14,9 @@ export declare enum Fields {
14
14
  Position = "position",
15
15
  CursorState = "cursorState",
16
16
  FullPath = "fullPath",
17
- Registered = "registered"
17
+ Registered = "registered",
18
+ Camera = "camera",
19
+ Size = "size"
18
20
  }
19
21
  export declare type Apps = {
20
22
  [key: string]: AppSyncAttributes;
@@ -31,8 +33,11 @@ export declare type StoreContext = {
31
33
  safeUpdateAttributes: (keys: string[], value: any) => void;
32
34
  safeSetAttributes: (attributes: any) => void;
33
35
  };
34
- export declare type ICamera = Camera & {
36
+ export declare type ICamera = {
35
37
  id: string;
38
+ centerX: number | null;
39
+ centerY: number | null;
40
+ scale: number;
36
41
  };
37
42
  export declare type ISize = Size & {
38
43
  id: string;
@@ -50,6 +55,7 @@ export declare class AttributesDelegate {
50
55
  getMinimized(): any;
51
56
  setupAppAttributes(params: AddAppParams, id: string, isDynamicPPT: boolean): void;
52
57
  updateAppState(appId: string, stateName: AppAttributes, state: any): void;
58
+ updateAppAttributes(appId: string, key: string, value: any): void;
53
59
  cleanAppAttributes(id: string): void;
54
60
  cleanFocus(): void;
55
61
  getAppSceneIndex(id: string): any;
@@ -59,8 +65,8 @@ export declare class AttributesDelegate {
59
65
  getBoxState(): any;
60
66
  setMainViewScenePath(scenePath: string): void;
61
67
  setMainViewSceneIndex(index: number): void;
62
- getMainViewCamera(): MainViewCamera;
63
- getMainViewSize(): MainViewSize;
68
+ getMainViewCamera(): ICamera;
69
+ getMainViewSize(): ISize;
64
70
  setMainViewCamera(camera: ICamera): void;
65
71
  setMainViewSize(size: ISize): void;
66
72
  setMainViewCameraAndSize(camera: ICamera, size: ISize): void;
@@ -71,17 +77,6 @@ export declare class AttributesDelegate {
71
77
  cleanCursor(uid: string): void;
72
78
  setMainViewFocusPath(mainView: View): void;
73
79
  }
74
- export declare type MainViewSize = {
75
- id: string;
76
- width: number;
77
- height: number;
78
- };
79
- export declare type MainViewCamera = {
80
- id: string;
81
- centerX: number;
82
- centerY: number;
83
- scale: number;
84
- };
85
80
  export declare type Cursors = {
86
81
  [key: string]: Cursor;
87
82
  };
@@ -1,15 +1,16 @@
1
1
  import { AppAttributes } from "./constants";
2
+ import { SideEffectManager } from "side-effect-manager";
2
3
  import { TELE_BOX_STATE, TeleBoxManager } from "@netless/telebox-insider";
3
4
  import { WindowManager } from "./index";
4
5
  import type { BoxEmitterType } from "./BoxEmitter";
5
- import type { AddAppOptions, AppInitState } from "./index";
6
+ import type { AddAppOptions } from "./index";
6
7
  import type { TeleBoxManagerUpdateConfig, ReadonlyTeleBox, TeleBoxColorScheme, TeleBoxRect, TeleBoxConfig } from "@netless/telebox-insider";
7
8
  import type Emittery from "emittery";
8
9
  import type { NetlessApp } from "./typings";
9
10
  import type { View } from "white-web-sdk";
10
11
  import type { CallbacksType } from "./callback";
11
12
  import type { EmitterType } from "./InternalEmitter";
12
- import { SideEffectManager } from "side-effect-manager";
13
+ import type { AppState } from "./App/type";
13
14
  export { TELE_BOX_STATE };
14
15
  export declare type CreateBoxParams = {
15
16
  appId: string;
@@ -44,10 +45,10 @@ export declare type CreateTeleBoxManagerConfig = {
44
45
  collectorStyles?: Partial<CSSStyleDeclaration>;
45
46
  prefersColorScheme?: TeleBoxColorScheme;
46
47
  stageRatio?: number;
48
+ highlightStage?: boolean;
47
49
  };
48
50
  export declare type BoxManagerContext = {
49
51
  safeSetAttributes: (attributes: any) => void;
50
- getMainView: () => View;
51
52
  updateAppState: (appId: string, field: AppAttributes, value: any) => void;
52
53
  emitter: EmitterType;
53
54
  boxEmitter: BoxEmitterType;
@@ -63,7 +64,6 @@ export declare class BoxManager {
63
64
  teleBoxManager: TeleBoxManager;
64
65
  protected sideEffectManager: SideEffectManager;
65
66
  constructor(context: BoxManagerContext, createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig);
66
- private get mainView();
67
67
  private get canOperate();
68
68
  get boxState(): "normal" | "minimized" | "maximized";
69
69
  get maximized(): boolean;
@@ -72,14 +72,15 @@ export declare class BoxManager {
72
72
  get prefersColorScheme(): TeleBoxColorScheme;
73
73
  get boxSize(): number;
74
74
  get stageRect(): TeleBoxRect;
75
- createBox(params: CreateBoxParams): void;
75
+ get stageRect$(): import("value-enhancer").ReadonlyVal<TeleBoxRect, any>;
76
+ createBox(params: CreateBoxParams): ReadonlyTeleBox | undefined;
76
77
  setupBoxManager(createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig): TeleBoxManager;
77
78
  getBox(appId: string): ReadonlyTeleBox | undefined;
78
79
  closeBox(appId: string, skipUpdate?: boolean): ReadonlyTeleBox | undefined;
79
80
  boxIsFocus(appId: string): boolean | undefined;
80
81
  getFocusBox(): ReadonlyTeleBox | undefined;
81
82
  getTopBox(): ReadonlyTeleBox | undefined;
82
- updateBoxState(state?: AppInitState): void;
83
+ updateBoxState(state?: AppState): void;
83
84
  moveBox({ appId, x, y }: MoveBoxParams): void;
84
85
  focusBox({ appId }: AppId, skipUpdate?: boolean): void;
85
86
  resizeBox({ appId, width, height, skipUpdate }: ResizeBoxParams): void;
@@ -15,7 +15,6 @@ export declare type MoveCursorParams = {
15
15
  export declare class CursorManager {
16
16
  private manager;
17
17
  private enableCursor;
18
- containerRect?: DOMRect;
19
18
  wrapperRect?: DOMRect;
20
19
  cursorInstances: Map<string, Cursor>;
21
20
  roomMembers?: readonly RoomMember[];
@@ -1,14 +1,14 @@
1
1
  import Emittery from "emittery";
2
2
  import type { TeleBoxRect } from "@netless/telebox-insider";
3
- import type { AppInitState, CursorMovePayload } from "./index";
3
+ import type { CursorMovePayload } from "./index";
4
4
  import type { Member } from "./Helper";
5
+ import type { MemberState } from "white-web-sdk";
5
6
  export declare type RemoveSceneParams = {
6
7
  scenePath: string;
7
8
  index?: number;
8
9
  };
9
10
  export declare type EmitterEvent = {
10
11
  onCreated: undefined;
11
- InitReplay: AppInitState;
12
12
  error: Error;
13
13
  seekStart: undefined;
14
14
  seek: number;
@@ -32,6 +32,7 @@ export declare type EmitterEvent = {
32
32
  writableChange: boolean;
33
33
  containerSizeRatioUpdate: number;
34
34
  roomMembersChange: Member[];
35
+ memberStateChange: MemberState;
35
36
  };
36
37
  export declare type EmitterType = Emittery<EmitterEvent>;
37
38
  export declare const emitter: EmitterType;
@@ -10,6 +10,7 @@ export declare type PageState = {
10
10
  export interface PageController {
11
11
  nextPage: () => Promise<boolean>;
12
12
  prevPage: () => Promise<boolean>;
13
+ jumpPage: (index: number) => Promise<boolean>;
13
14
  addPage: (params?: AddPageParams) => Promise<void>;
14
15
  removePage: (index: number) => Promise<boolean>;
15
16
  pageState: PageState;
@@ -17,7 +17,7 @@ export declare class ReconnectRefresher {
17
17
  private _onReconnected;
18
18
  private releaseDisposers;
19
19
  refresh(): void;
20
- add(id: string, func: any): void;
20
+ add(id: string, func: any): () => void;
21
21
  remove(id: string): void;
22
22
  hasReactor(id: string): boolean;
23
23
  destroy(): void;
@@ -4,6 +4,7 @@ import type Emittery from "emittery";
4
4
  export declare const genAppId: (kind: string) => Promise<string>;
5
5
  export declare const setViewFocusScenePath: (view: View, focusScenePath: string) => View | undefined;
6
6
  export declare const setViewSceneIndex: (view: View, index: number) => View | undefined;
7
+ export declare const releaseView: (view: View) => void;
7
8
  export declare const setScenePath: (room: Room | undefined, scenePath: string) => void;
8
9
  export declare const getScenePath: (room: Room | undefined, dir: string | undefined, index: number) => string | undefined;
9
10
  export declare const removeScenes: (room: Room | undefined, scenePath: string, index?: number | undefined) => void;
@@ -1,17 +1,17 @@
1
1
  import type { TeleBoxRect } from "@netless/telebox-insider";
2
- import type { Camera, View, Size } from "white-web-sdk";
3
- import type { MainViewSize } from "../AttributesDelegate";
4
- export declare type SaveCamera = (camera: Camera) => void;
2
+ import type { View } from "white-web-sdk";
3
+ import type { ICamera, ISize } from "../AttributesDelegate";
4
+ export declare type SaveCamera = (camera: ICamera) => void;
5
5
  export declare class CameraSynchronizer {
6
6
  protected saveCamera: SaveCamera;
7
- protected remoteCamera?: Camera;
8
- protected remoteSize?: MainViewSize;
7
+ remoteCamera?: ICamera;
8
+ remoteSize?: ISize;
9
9
  protected rect?: TeleBoxRect;
10
10
  protected view?: View;
11
11
  constructor(saveCamera: SaveCamera);
12
- setRect(rect: TeleBoxRect): void;
12
+ setRect: import("lodash").DebouncedFunc<(rect: TeleBoxRect) => void>;
13
13
  setView(view: View): void;
14
- onRemoteUpdate: import("lodash").DebouncedFunc<(camera: Camera, size: MainViewSize) => void>;
15
- onLocalCameraUpdate(camera: Camera): void;
16
- onLocalSizeUpdate(size: Size): void;
14
+ onRemoteUpdate: import("lodash").DebouncedFunc<(camera: ICamera, size: ISize) => void>;
15
+ onRemoteSizeUpdate(size: ISize): void;
16
+ onLocalCameraUpdate(camera: ICamera): void;
17
17
  }
@@ -1,3 +1,6 @@
1
+ import { Val } from "value-enhancer";
2
+ import { ViewSync } from "./ViewSync";
3
+ import type { ICamera, ISize } from "../AttributesDelegate";
1
4
  import type { Size, View } from "white-web-sdk";
2
5
  import type { AppManager } from "../AppManager";
3
6
  export declare class MainViewProxy {
@@ -6,21 +9,31 @@ export declare class MainViewProxy {
6
9
  private mainViewIsAddListener;
7
10
  private mainView;
8
11
  private store;
9
- private synchronizer;
10
12
  private sideEffectManager;
13
+ camera$: Val<{
14
+ id: string;
15
+ centerX: number | null;
16
+ centerY: number | null;
17
+ scale: number;
18
+ } | undefined, any>;
19
+ size$: Val<ISize | undefined, any>;
20
+ view$: Val<View | undefined, any>;
21
+ viewSync?: ViewSync;
11
22
  constructor(manager: AppManager);
23
+ createViewSync: () => void;
12
24
  private startListenWritableChange;
13
25
  ensureCameraAndSize(): void;
14
26
  private get mainViewCamera();
15
27
  private get mainViewSize();
16
28
  private get didRelease();
17
- private moveCameraSizeByAttributes;
18
29
  start(): void;
19
30
  addCameraReaction: () => void;
20
- setCameraAndSize(): void;
31
+ storeCurrentCamera: () => void;
32
+ storeCurrentSize: () => void;
33
+ storeCamera: (camera: ICamera) => void;
34
+ storeSize: (size: ISize) => void;
21
35
  private cameraReaction;
22
- sizeChangeHandler: import("lodash").DebouncedFunc<(size: Size) => void>;
23
- onUpdateContainerSizeRatio: () => void;
36
+ private sizeReaction;
24
37
  get view(): View;
25
38
  get cameraState(): {
26
39
  width: number;
@@ -33,8 +46,6 @@ export declare class MainViewProxy {
33
46
  onReconnect(): void;
34
47
  setFocusScenePath(path: string | undefined): View | undefined;
35
48
  rebind(): void;
36
- private onCameraUpdatedByDevice;
37
- private getStageSize;
38
49
  addMainViewListener(): void;
39
50
  removeMainViewListener(): void;
40
51
  private mainViewClickListener;
@@ -0,0 +1,24 @@
1
+ import { ViewMode } from "white-web-sdk";
2
+ import type { View } from "white-web-sdk";
3
+ import type { Val, ReadonlyVal } from "value-enhancer";
4
+ import type { ICamera, ISize } from "../AttributesDelegate";
5
+ import type { TeleBoxRect } from "@netless/telebox-insider";
6
+ export declare type ViewSyncContext = {
7
+ uid: string;
8
+ camera$: Val<ICamera | undefined, boolean>;
9
+ size$: Val<ISize | undefined>;
10
+ stageRect$: ReadonlyVal<TeleBoxRect>;
11
+ viewMode$?: Val<ViewMode>;
12
+ storeCamera: (camera: ICamera) => void;
13
+ storeSize: (size: ISize) => void;
14
+ view$: Val<View | undefined>;
15
+ };
16
+ export declare class ViewSync {
17
+ private context;
18
+ private sem;
19
+ private synchronizer;
20
+ constructor(context: ViewSyncContext);
21
+ bindView: (view?: View | undefined) => void;
22
+ private onCameraUpdatedByDevice;
23
+ destroy(): void;
24
+ }
@@ -5,7 +5,6 @@ export declare enum Events {
5
5
  AppBoxStateChange = "AppBoxStateChange",
6
6
  GetAttributes = "GetAttributes",
7
7
  UpdateWindowManagerWrapper = "UpdateWindowManagerWrapper",
8
- InitReplay = "InitReplay",
9
8
  WindowCreated = "WindowCreated",
10
9
  SetMainViewScenePath = "SetMainViewScenePath",
11
10
  SetMainViewSceneIndex = "SetMainViewSceneIndex",
@@ -24,7 +23,12 @@ export declare enum AppAttributes {
24
23
  Size = "size",
25
24
  Position = "position",
26
25
  SceneIndex = "SceneIndex",
27
- ZIndex = "zIndex"
26
+ ZIndex = "zIndex",
27
+ Visible = "visible",
28
+ Ratio = "ratio",
29
+ StageRatio = "stageRatio",
30
+ Draggable = "draggable",
31
+ Resizable = "resizable"
28
32
  }
29
33
  export declare enum AppEvents {
30
34
  setBoxSize = "setBoxSize",