@netless/window-manager 1.0.0-canary.3 → 1.0.0-canary.32

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 (87) hide show
  1. package/__mocks__/white-web-sdk.ts +10 -1
  2. package/dist/index.cjs.js +120 -12
  3. package/dist/index.es.js +2284 -954
  4. package/dist/index.umd.js +120 -12
  5. package/dist/{App → src/App}/AppContext.d.ts +12 -8
  6. package/dist/{App → src/App}/AppPageStateImpl.d.ts +0 -0
  7. package/dist/{App → src/App}/AppProxy.d.ts +36 -7
  8. package/dist/{App → src/App}/MagixEvent/index.d.ts +0 -0
  9. package/dist/{App → src/App}/Storage/StorageEvent.d.ts +0 -0
  10. package/dist/{App → src/App}/Storage/index.d.ts +0 -0
  11. package/dist/{App → src/App}/Storage/typings.d.ts +0 -0
  12. package/dist/{App → src/App}/Storage/utils.d.ts +0 -0
  13. package/dist/src/App/WhiteboardView.d.ts +27 -0
  14. package/dist/{App → src/App}/index.d.ts +2 -1
  15. package/dist/src/App/type.d.ts +21 -0
  16. package/dist/{AppListener.d.ts → src/AppListener.d.ts} +0 -2
  17. package/dist/{AppManager.d.ts → src/AppManager.d.ts} +7 -6
  18. package/dist/{AttributesDelegate.d.ts → src/AttributesDelegate.d.ts} +11 -16
  19. package/dist/{BoxEmitter.d.ts → src/BoxEmitter.d.ts} +0 -0
  20. package/dist/{BoxManager.d.ts → src/BoxManager.d.ts} +10 -7
  21. package/dist/{BuiltinApps.d.ts → src/BuiltinApps.d.ts} +3 -0
  22. package/dist/{Cursor → src/Cursor}/Cursor.d.ts +0 -0
  23. package/dist/{Cursor → src/Cursor}/icons.d.ts +0 -0
  24. package/dist/{Cursor → src/Cursor}/index.d.ts +3 -3
  25. package/dist/{Helper.d.ts → src/Helper.d.ts} +4 -8
  26. package/dist/{InternalEmitter.d.ts → src/InternalEmitter.d.ts} +3 -4
  27. package/dist/{Page → src/Page}/PageController.d.ts +1 -0
  28. package/dist/{Page → src/Page}/index.d.ts +0 -0
  29. package/dist/{PageState.d.ts → src/PageState.d.ts} +0 -0
  30. package/dist/{ReconnectRefresher.d.ts → src/ReconnectRefresher.d.ts} +1 -1
  31. package/dist/{RedoUndo.d.ts → src/RedoUndo.d.ts} +0 -0
  32. package/dist/{Register → src/Register}/index.d.ts +0 -0
  33. package/dist/{Register → src/Register}/loader.d.ts +0 -0
  34. package/dist/{Register → src/Register}/storage.d.ts +0 -0
  35. package/dist/{Utils → src/Utils}/AppCreateQueue.d.ts +0 -0
  36. package/dist/{Utils → src/Utils}/Common.d.ts +1 -0
  37. package/dist/{Utils → src/Utils}/Reactive.d.ts +0 -0
  38. package/dist/{Utils → src/Utils}/RoomHacker.d.ts +0 -0
  39. package/dist/{Utils → src/Utils}/error.d.ts +0 -0
  40. package/dist/{Utils → src/Utils}/log.d.ts +0 -0
  41. package/dist/src/View/CameraSynchronizer.d.ts +18 -0
  42. package/dist/{View → src/View}/MainView.d.ts +18 -7
  43. package/dist/{View → src/View}/ViewManager.d.ts +0 -0
  44. package/dist/src/View/ViewSync.d.ts +24 -0
  45. package/dist/{callback.d.ts → src/callback.d.ts} +5 -0
  46. package/dist/{constants.d.ts → src/constants.d.ts} +8 -5
  47. package/dist/src/image.d.ts +19 -0
  48. package/dist/{index.d.ts → src/index.d.ts} +40 -14
  49. package/dist/src/shim.d.ts +11 -0
  50. package/dist/{typings.d.ts → src/typings.d.ts} +8 -2
  51. package/dist/style.css +1 -1
  52. package/docs/app-context.md +157 -25
  53. package/docs/mirgrate-to-1.0.md +28 -0
  54. package/package.json +12 -7
  55. package/playwright.config.ts +29 -0
  56. package/pnpm-lock.yaml +517 -35
  57. package/src/App/AppContext.ts +50 -28
  58. package/src/App/AppProxy.ts +266 -80
  59. package/src/App/{WhiteBoardView.ts → WhiteboardView.ts} +38 -7
  60. package/src/App/index.ts +2 -1
  61. package/src/App/type.ts +22 -0
  62. package/src/AppListener.ts +5 -21
  63. package/src/AppManager.ts +56 -43
  64. package/src/AttributesDelegate.ts +19 -19
  65. package/src/BoxManager.ts +60 -40
  66. package/src/BuiltinApps.ts +5 -0
  67. package/src/Cursor/Cursor.ts +7 -3
  68. package/src/Cursor/index.ts +7 -8
  69. package/src/Helper.ts +25 -7
  70. package/src/InternalEmitter.ts +3 -4
  71. package/src/Page/PageController.ts +1 -0
  72. package/src/PageState.ts +1 -1
  73. package/src/ReconnectRefresher.ts +7 -2
  74. package/src/Utils/Common.ts +9 -0
  75. package/src/Utils/Reactive.ts +27 -26
  76. package/src/Utils/RoomHacker.ts +3 -0
  77. package/src/View/CameraSynchronizer.ts +37 -34
  78. package/src/View/MainView.ts +108 -81
  79. package/src/View/ViewSync.ts +110 -0
  80. package/src/callback.ts +1 -0
  81. package/src/constants.ts +6 -3
  82. package/src/index.ts +141 -57
  83. package/src/style.css +3 -46
  84. package/src/typings.ts +8 -2
  85. package/vite.config.js +5 -3
  86. package/dist/App/WhiteBoardView.d.ts +0 -18
  87. package/dist/View/CameraSynchronizer.d.ts +0 -17
@@ -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;
@@ -46,7 +50,7 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
46
50
  get box(): ReadonlyTeleBox;
47
51
  get room(): Room | undefined;
48
52
  get members(): Member[];
49
- get memberState(): Member;
53
+ get currentMember(): Member;
50
54
  /** @deprecated Use context.storage.setState instead. */
51
55
  setAttributes: (attributes: TAttributes) => void;
52
56
  /** @deprecated Use context.storage.setState instead. */
File without changes
@@ -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,14 @@ 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;
97
+ private setupDone;
69
98
  close(): Promise<void>;
70
99
  }
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,27 @@
1
+ import type { ReadonlyVal } from "value-enhancer";
2
+ import type { AddPageParams, PageController, PageState } from "../Page";
3
+ import type { AppProxy } from "./AppProxy";
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, ISize } from "../AttributesDelegate";
8
+ export declare type WhiteBoardViewCamera = Omit<ICamera, "id">;
9
+ export declare type WhiteBoardViewRect = Omit<ISize, "id">;
10
+ export declare class WhiteBoardView implements PageController {
11
+ view: View;
12
+ protected appContext: AppContext;
13
+ protected appProxy: AppProxy;
14
+ ensureSize: (size: number) => void;
15
+ readonly pageState$: ReadonlyVal<PageState>;
16
+ readonly baseCamera$: ReadonlyVal<WhiteBoardViewCamera>;
17
+ readonly baseRect$: ReadonlyVal<WhiteBoardViewRect | undefined>;
18
+ constructor(view: View, appContext: AppContext, appProxy: AppProxy, ensureSize: (size: number) => void);
19
+ get pageState(): PageState;
20
+ moveCamera(camera: Partial<WhiteBoardViewCamera>): void;
21
+ nextPage: () => Promise<boolean>;
22
+ prevPage: () => Promise<boolean>;
23
+ jumpPage: (index: number) => Promise<boolean>;
24
+ addPage: (params?: AddPageParams | undefined) => Promise<void>;
25
+ removePage: (index?: number | undefined) => Promise<boolean>;
26
+ setBaseRect(rect: Omit<TeleBoxRect, "x" | "y">): void;
27
+ }
@@ -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
+ };
@@ -11,8 +11,6 @@ export declare class AppListeners {
11
11
  private appResizeHandler;
12
12
  private boxStateChangeHandler;
13
13
  private setMainViewScenePathHandler;
14
- private moveCameraHandler;
15
- private moveCameraToContainHandler;
16
14
  private cursorMoveHandler;
17
15
  private rootDirRemovedHandler;
18
16
  private refreshHandler;
@@ -3,6 +3,7 @@ import { AppProxy } from "./App";
3
3
  import { MainViewProxy } from "./View/MainView";
4
4
  import { WindowManager } from "./index";
5
5
  import { ViewManager } from "./View/ViewManager";
6
+ import { Val } from "value-enhancer";
6
7
  import type { ReconnectRefresher } from "./ReconnectRefresher";
7
8
  import type { BoxManager } from "./BoxManager";
8
9
  import type { Displayer, Room, SceneState } from "white-web-sdk";
@@ -16,15 +17,16 @@ export declare class AppManager {
16
17
  appStatus: Map<string, AppStatus>;
17
18
  store: import("./AttributesDelegate").AttributesDelegate;
18
19
  mainViewProxy: MainViewProxy;
19
- refresher?: ReconnectRefresher;
20
+ refresher: ReconnectRefresher;
20
21
  isReplay: boolean;
21
22
  mainViewScenesLength: number;
22
23
  private appListeners;
23
24
  boxManager?: BoxManager;
24
- private _prevSceneIndex;
25
- private _prevFocused;
26
25
  private callbacksNode;
27
26
  private appCreateQueue;
27
+ private sceneIndex$;
28
+ private focused$;
29
+ members$: Val<Member[], any>;
28
30
  private sideEffectManager;
29
31
  sceneState: SceneState | null;
30
32
  rootDirRemoving: boolean;
@@ -51,7 +53,6 @@ export declare class AppManager {
51
53
  get mainView(): import("white-web-sdk").View;
52
54
  get focusApp(): AppProxy | undefined;
53
55
  get uid(): string;
54
- get members(): Member[];
55
56
  getMainViewSceneDir(): string;
56
57
  private onCreated;
57
58
  private onBoxMove;
@@ -65,9 +66,9 @@ export declare class AppManager {
65
66
  private onFocusChange;
66
67
  attributesUpdateCallback: import("lodash").DebouncedFunc<(apps: any) => Promise<void>>;
67
68
  /**
68
- * 插件更新 attributes 时的回调
69
+ * 插件更新 apps 时的回调
69
70
  *
70
- * @param {*} attributes
71
+ * @param {*} apps
71
72
  * @memberof WindowManager
72
73
  */
73
74
  _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
  };
File without changes
@@ -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 { TeleBoxManagerUpdateConfig, ReadonlyTeleBox, TeleBoxColorScheme, TeleBoxRect, TeleBoxConfig } from "@netless/telebox-insider";
6
+ import type { AddAppOptions } from "./index";
7
+ import type { TeleBoxManagerUpdateConfig, ReadonlyTeleBox, TeleBoxColorScheme, TeleBoxRect, TeleBoxConfig, TeleBoxFullscreen } 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,12 @@ export declare type CreateTeleBoxManagerConfig = {
44
45
  collectorStyles?: Partial<CSSStyleDeclaration>;
45
46
  prefersColorScheme?: TeleBoxColorScheme;
46
47
  stageRatio?: number;
48
+ containerStyle?: string;
49
+ stageStyle?: string;
50
+ fullscreen?: TeleBoxFullscreen;
47
51
  };
48
52
  export declare type BoxManagerContext = {
49
53
  safeSetAttributes: (attributes: any) => void;
50
- getMainView: () => View;
51
54
  updateAppState: (appId: string, field: AppAttributes, value: any) => void;
52
55
  emitter: EmitterType;
53
56
  boxEmitter: BoxEmitterType;
@@ -63,7 +66,6 @@ export declare class BoxManager {
63
66
  teleBoxManager: TeleBoxManager;
64
67
  protected sideEffectManager: SideEffectManager;
65
68
  constructor(context: BoxManagerContext, createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig);
66
- private get mainView();
67
69
  private get canOperate();
68
70
  get boxState(): "normal" | "minimized" | "maximized";
69
71
  get maximized(): boolean;
@@ -72,14 +74,15 @@ export declare class BoxManager {
72
74
  get prefersColorScheme(): TeleBoxColorScheme;
73
75
  get boxSize(): number;
74
76
  get stageRect(): TeleBoxRect;
75
- createBox(params: CreateBoxParams): void;
77
+ get stageRect$(): import("value-enhancer").ReadonlyVal<TeleBoxRect, any>;
78
+ createBox(params: CreateBoxParams): ReadonlyTeleBox | undefined;
76
79
  setupBoxManager(createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig): TeleBoxManager;
77
80
  getBox(appId: string): ReadonlyTeleBox | undefined;
78
81
  closeBox(appId: string, skipUpdate?: boolean): ReadonlyTeleBox | undefined;
79
82
  boxIsFocus(appId: string): boolean | undefined;
80
83
  getFocusBox(): ReadonlyTeleBox | undefined;
81
84
  getTopBox(): ReadonlyTeleBox | undefined;
82
- updateBoxState(state?: AppInitState): void;
85
+ updateBoxState(state?: AppState): void;
83
86
  moveBox({ appId, x, y }: MoveBoxParams): void;
84
87
  focusBox({ appId }: AppId, skipUpdate?: boolean): void;
85
88
  resizeBox({ appId, width, height, skipUpdate }: ResizeBoxParams): void;
@@ -3,3 +3,6 @@ export declare const BuiltinApps: {
3
3
  DocsViewer: string;
4
4
  MediaPlayer: string;
5
5
  };
6
+ export declare const BuiltinAppsMap: {
7
+ [x: string]: any;
8
+ };
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
  import { Cursor } from "./Cursor";
2
- import type { ApplianceIcons } from "../index";
2
+ import type { ApplianceIcons, TeleBoxRect } from "../index";
3
3
  import type { PositionType } from "../AttributesDelegate";
4
4
  import type { RoomMember, View } from "white-web-sdk";
5
5
  import type { AppManager } from "../AppManager";
@@ -15,8 +15,8 @@ export declare type MoveCursorParams = {
15
15
  export declare class CursorManager {
16
16
  private manager;
17
17
  private enableCursor;
18
- containerRect?: DOMRect;
19
- wrapperRect?: DOMRect;
18
+ wrapperRect?: TeleBoxRect;
19
+ playgroundRect?: DOMRect;
20
20
  cursorInstances: Map<string, Cursor>;
21
21
  roomMembers?: readonly RoomMember[];
22
22
  private mainViewElement?;
@@ -1,5 +1,6 @@
1
+ import { WindowManager } from "./index";
1
2
  import type { Room, RoomMember } from "white-web-sdk";
2
- export declare const setupWrapper: (root: HTMLElement) => {
3
+ export declare const setupWrapper: (root: HTMLElement, target: HTMLElement) => {
3
4
  playground: HTMLDivElement;
4
5
  mainViewElement: HTMLDivElement;
5
6
  };
@@ -8,10 +9,5 @@ export declare const findMemberByUid: (room: Room | undefined, uid: string) => R
8
9
  export declare type Member = RoomMember & {
9
10
  uid: string;
10
11
  };
11
- export declare const serializeRoomMembers: (members: readonly RoomMember[]) => {
12
- memberId: number;
13
- memberState: import("white-web-sdk").MemberState;
14
- session: string;
15
- payload?: import("white-web-sdk").UserPayload | undefined;
16
- uid: string;
17
- }[];
12
+ export declare const serializeRoomMembers: (members: readonly RoomMember[]) => any[];
13
+ export declare const createInvisiblePlugin: (room: Room) => Promise<WindowManager | undefined>;
@@ -1,14 +1,13 @@
1
1
  import Emittery from "emittery";
2
2
  import type { TeleBoxRect } from "@netless/telebox-insider";
3
- import type { AppInitState, CursorMovePayload } from "./index";
4
- import type { Member } from "./Helper";
3
+ import type { CursorMovePayload } from "./index";
4
+ import type { MemberState } from "white-web-sdk";
5
5
  export declare type RemoveSceneParams = {
6
6
  scenePath: string;
7
7
  index?: number;
8
8
  };
9
9
  export declare type EmitterEvent = {
10
10
  onCreated: undefined;
11
- InitReplay: AppInitState;
12
11
  error: Error;
13
12
  seekStart: undefined;
14
13
  seek: number;
@@ -31,7 +30,7 @@ export declare type EmitterEvent = {
31
30
  changePageState: undefined;
32
31
  writableChange: boolean;
33
32
  containerSizeRatioUpdate: number;
34
- roomMembersChange: Member[];
33
+ memberStateChange: MemberState;
35
34
  };
36
35
  export declare type EmitterType = Emittery<EmitterEvent>;
37
36
  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;
File without changes
File without changes
@@ -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;
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -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;
File without changes
File without changes
File without changes
File without changes
@@ -0,0 +1,18 @@
1
+ import type { TeleBoxRect } from "@netless/telebox-insider";
2
+ import type { View } from "white-web-sdk";
3
+ import type { ICamera, ISize } from "../AttributesDelegate";
4
+ export declare type SaveCamera = (camera: ICamera) => void;
5
+ export declare class CameraSynchronizer {
6
+ protected saveCamera: SaveCamera;
7
+ remoteCamera?: ICamera;
8
+ remoteSize?: ISize;
9
+ protected rect?: TeleBoxRect;
10
+ protected view?: View;
11
+ constructor(saveCamera: SaveCamera);
12
+ setRect: (rect: TeleBoxRect) => void;
13
+ setView(view: View): void;
14
+ onRemoteUpdate: import("lodash").DebouncedFunc<(camera: ICamera, size: ISize) => void>;
15
+ onRemoteSizeUpdate(size: ISize): void;
16
+ onLocalCameraUpdate(camera: ICamera): void;
17
+ private moveCamera;
18
+ }
@@ -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;
File without changes
@@ -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
+ }
@@ -19,6 +19,11 @@ export declare type PublicEvent = {
19
19
  ready: undefined;
20
20
  sceneStateChange: SceneState;
21
21
  pageStateChange: PageState;
22
+ appClose: {
23
+ appId: string;
24
+ kind: string;
25
+ error?: Error;
26
+ };
22
27
  };
23
28
  export declare type CallbacksType = Emittery<PublicEvent>;
24
29
  export declare const callbacks: CallbacksType;