@netless/window-manager 1.0.0-canary.3 → 1.0.0-canary.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.
@@ -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
  }
@@ -8,7 +8,7 @@ import type { AppEmitterEvent, Member } from "../index";
8
8
  import type { AppManager } from "../AppManager";
9
9
  import type { AppProxy } from "./AppProxy";
10
10
  import type { MagixEventAddListener, MagixEventDispatcher, MagixEventRemoveListener } from "./MagixEvent";
11
- import { WhiteBoardView } from "./WhiteBoardView";
11
+ import { WhiteBoardView } from "./WhiteboardView";
12
12
  export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOptions = any> {
13
13
  private manager;
14
14
  private boxManager;
@@ -31,6 +31,7 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
31
31
  readonly isAddApp: boolean;
32
32
  readonly isReplay: boolean;
33
33
  private whiteBoardView?;
34
+ _viewWrapper?: HTMLElement;
34
35
  constructor(manager: AppManager, boxManager: BoxManager, appId: string, appProxy: AppProxy, appOptions?: TAppOptions | (() => TAppOptions) | undefined);
35
36
  get displayer(): import("white-web-sdk").Displayer<import("white-web-sdk").DisplayerCallbacks>;
36
37
  /** @deprecated Use context.storage.state instead. */
@@ -1,8 +1,10 @@
1
1
  import Emittery from "emittery";
2
2
  import { AppContext } from "./AppContext";
3
3
  import { AppPageStateImpl } from "./AppPageStateImpl";
4
+ import { Val } from "value-enhancer";
5
+ import type { ICamera, ISize } from "../AttributesDelegate";
4
6
  import type { AppEmitterEvent, AppInitState, BaseInsertParams } from "../index";
5
- import type { SceneState, View, SceneDefinition } from "white-web-sdk";
7
+ import type { SceneState, View, SceneDefinition, Camera } from "white-web-sdk";
6
8
  import type { AppManager } from "../AppManager";
7
9
  import type { NetlessApp } from "../typings";
8
10
  import type { ReadonlyTeleBox } from "@netless/telebox-insider";
@@ -22,6 +24,7 @@ export declare class AppProxy implements PageRemoveService {
22
24
  private appProxies;
23
25
  private viewManager;
24
26
  private store;
27
+ uid: string;
25
28
  isAddApp: boolean;
26
29
  private status;
27
30
  private stateKey;
@@ -30,6 +33,11 @@ export declare class AppProxy implements PageRemoveService {
30
33
  appResult?: NetlessApp<any>;
31
34
  appContext?: AppContext<any, any>;
32
35
  private sideEffectManager;
36
+ camera$: Val<ICamera | undefined, any>;
37
+ size$: Val<ISize | undefined, any>;
38
+ private appViewSync?;
39
+ box$: Val<ReadonlyTeleBox | undefined, any>;
40
+ view$: Val<View | undefined, any>;
33
41
  constructor(params: BaseInsertParams, manager: AppManager, appId: string, isAddApp: boolean);
34
42
  createAppDir(): View;
35
43
  private initScenes;
@@ -65,6 +73,9 @@ export declare class AppProxy implements PageRemoveService {
65
73
  removeSceneByIndex(index: number): Promise<boolean>;
66
74
  setSceneIndexWithoutSync(index: number): void;
67
75
  setSceneIndex(index: number): void;
76
+ storeCamera: (camera: ICamera) => void;
77
+ storeSize: (size: ISize) => void;
78
+ moveCamera: (camera: Camera) => void;
68
79
  destroy(needCloseBox: boolean, cleanAttrs: boolean, skipUpdate: boolean, error?: Error): Promise<void>;
69
80
  close(): Promise<void>;
70
81
  }
@@ -0,0 +1,11 @@
1
+ import type { View } from "white-web-sdk";
2
+ import type { AppProxy } from "./AppProxy";
3
+ export declare class AppViewSync {
4
+ private appProxy;
5
+ private sem;
6
+ private synchronizer;
7
+ constructor(appProxy: AppProxy);
8
+ bindView: (view?: View | undefined) => void;
9
+ private onCameraUpdatedByDevice;
10
+ destroy(): void;
11
+ }
@@ -2,13 +2,16 @@ 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 { Camera } from "white-web-sdk";
5
6
  export declare class WhiteBoardView implements PageController {
6
7
  protected appContext: AppContext;
7
8
  protected appProxy: AppProxy;
8
9
  private removeViewWrapper;
9
10
  readonly pageState$: ReadonlyVal<PageState>;
10
11
  constructor(appContext: AppContext, appProxy: AppProxy, removeViewWrapper: () => void);
12
+ get view(): import("white-web-sdk").View | undefined;
11
13
  get pageState(): PageState;
14
+ moveCamera(camera: Camera): void;
12
15
  nextPage: () => Promise<boolean>;
13
16
  prevPage: () => Promise<boolean>;
14
17
  jumpPage: (index: number) => Promise<boolean>;
@@ -1,3 +1,3 @@
1
1
  export * from "./AppProxy";
2
2
  export * from "./AppContext";
3
- export * from "./WhiteBoardView";
3
+ export * from "./WhiteboardView";
@@ -16,7 +16,7 @@ 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;
@@ -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;
@@ -50,6 +52,7 @@ export declare class AttributesDelegate {
50
52
  getMinimized(): any;
51
53
  setupAppAttributes(params: AddAppParams, id: string, isDynamicPPT: boolean): void;
52
54
  updateAppState(appId: string, stateName: AppAttributes, state: any): void;
55
+ updateAppAttributes(appId: string, key: string, value: any): void;
53
56
  cleanAppAttributes(id: string): void;
54
57
  cleanFocus(): void;
55
58
  getAppSceneIndex(id: string): any;
@@ -59,8 +62,8 @@ export declare class AttributesDelegate {
59
62
  getBoxState(): any;
60
63
  setMainViewScenePath(scenePath: string): void;
61
64
  setMainViewSceneIndex(index: number): void;
62
- getMainViewCamera(): MainViewCamera;
63
- getMainViewSize(): MainViewSize;
65
+ getMainViewCamera(): ICamera;
66
+ getMainViewSize(): ISize;
64
67
  setMainViewCamera(camera: ICamera): void;
65
68
  setMainViewSize(size: ISize): void;
66
69
  setMainViewCameraAndSize(camera: ICamera, size: ISize): void;
@@ -71,17 +74,6 @@ export declare class AttributesDelegate {
71
74
  cleanCursor(uid: string): void;
72
75
  setMainViewFocusPath(mainView: View): void;
73
76
  }
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
77
  export declare type Cursors = {
86
78
  [key: string]: Cursor;
87
79
  };
@@ -72,7 +72,7 @@ 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
+ createBox(params: CreateBoxParams): ReadonlyTeleBox | undefined;
76
76
  setupBoxManager(createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig): TeleBoxManager;
77
77
  getBox(appId: string): ReadonlyTeleBox | undefined;
78
78
  closeBox(appId: string, skipUpdate?: boolean): ReadonlyTeleBox | undefined;
@@ -2,6 +2,7 @@ import Emittery from "emittery";
2
2
  import type { TeleBoxRect } from "@netless/telebox-insider";
3
3
  import type { AppInitState, 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;
@@ -32,6 +33,7 @@ export declare type EmitterEvent = {
32
33
  writableChange: boolean;
33
34
  containerSizeRatioUpdate: number;
34
35
  roomMembersChange: Member[];
36
+ memberStateChange: MemberState;
35
37
  };
36
38
  export declare type EmitterType = Emittery<EmitterEvent>;
37
39
  export declare const emitter: EmitterType;
@@ -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
2
  import type { Camera, View, Size } from "white-web-sdk";
3
- import type { MainViewSize } from "../AttributesDelegate";
3
+ import type { ISize } from "../AttributesDelegate";
4
4
  export declare type SaveCamera = (camera: Camera) => void;
5
5
  export declare class CameraSynchronizer {
6
6
  protected saveCamera: SaveCamera;
7
7
  protected remoteCamera?: Camera;
8
- protected remoteSize?: MainViewSize;
8
+ protected remoteSize?: ISize;
9
9
  protected rect?: TeleBoxRect;
10
10
  protected view?: View;
11
11
  constructor(saveCamera: SaveCamera);
12
12
  setRect(rect: TeleBoxRect): void;
13
13
  setView(view: View): void;
14
- onRemoteUpdate: import("lodash").DebouncedFunc<(camera: Camera, size: MainViewSize) => void>;
14
+ onRemoteUpdate: import("lodash").DebouncedFunc<(camera: Camera, size: ISize) => void>;
15
15
  onLocalCameraUpdate(camera: Camera): void;
16
- onLocalSizeUpdate(size: Size): void;
16
+ onLocalSizeUpdate: (size: Size) => void;
17
17
  }
@@ -0,0 +1,7 @@
1
+ import type { Camera, Size } from "white-web-sdk";
2
+ export interface ViewSync {
3
+ readonly camera: Camera;
4
+ readonly size: Size;
5
+ setCamera: (camera: Camera) => void;
6
+ setSize: (size: Size) => void;
7
+ }