@netless/window-manager 1.0.0-canary.7 → 1.0.0-canary.71

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 (112) hide show
  1. package/README.md +30 -6
  2. package/dist/index.js +13625 -0
  3. package/dist/index.mjs +13622 -0
  4. package/dist/index.umd.js +13620 -46
  5. package/dist/{App → src/App}/AppContext.d.ts +16 -14
  6. package/dist/{App → src/App}/AppPageStateImpl.d.ts +0 -0
  7. package/dist/{App → src/App}/AppProxy.d.ts +30 -11
  8. package/dist/{App → src/App}/MagixEvent/index.d.ts +0 -0
  9. package/dist/src/App/WhiteboardView.d.ts +27 -0
  10. package/dist/{App → src/App}/index.d.ts +1 -0
  11. package/dist/src/App/type.d.ts +21 -0
  12. package/dist/{AppListener.d.ts → src/AppListener.d.ts} +2 -2
  13. package/dist/{AppManager.d.ts → src/AppManager.d.ts} +12 -7
  14. package/dist/{AttributesDelegate.d.ts → src/AttributesDelegate.d.ts} +5 -2
  15. package/dist/{BoxEmitter.d.ts → src/BoxEmitter.d.ts} +0 -0
  16. package/dist/{BoxManager.d.ts → src/BoxManager.d.ts} +12 -6
  17. package/dist/{BuiltinApps.d.ts → src/BuiltinApps.d.ts} +3 -0
  18. package/dist/{Cursor → src/Cursor}/Cursor.d.ts +0 -0
  19. package/dist/{Cursor → src/Cursor}/icons.d.ts +0 -0
  20. package/dist/{Cursor → src/Cursor}/index.d.ts +4 -3
  21. package/dist/{Helper.d.ts → src/Helper.d.ts} +4 -8
  22. package/dist/{InternalEmitter.d.ts → src/InternalEmitter.d.ts} +1 -4
  23. package/dist/{Page → src/Page}/PageController.d.ts +3 -1
  24. package/dist/{Page → src/Page}/index.d.ts +0 -0
  25. package/dist/{PageState.d.ts → src/PageState.d.ts} +1 -0
  26. package/dist/{ReconnectRefresher.d.ts → src/ReconnectRefresher.d.ts} +0 -0
  27. package/dist/{RedoUndo.d.ts → src/RedoUndo.d.ts} +0 -0
  28. package/dist/{Register → src/Register}/index.d.ts +4 -2
  29. package/dist/{Register → src/Register}/loader.d.ts +1 -1
  30. package/dist/src/Register/storage.d.ts +11 -0
  31. package/dist/{Utils → src/Utils}/AppCreateQueue.d.ts +0 -0
  32. package/dist/{Utils → src/Utils}/Common.d.ts +0 -0
  33. package/dist/{Utils → src/Utils}/Reactive.d.ts +1 -1
  34. package/dist/{Utils → src/Utils}/RoomHacker.d.ts +0 -0
  35. package/dist/{Utils → src/Utils}/error.d.ts +4 -1
  36. package/dist/{Utils → src/Utils}/log.d.ts +0 -0
  37. package/dist/src/View/CameraSynchronizer.d.ts +21 -0
  38. package/dist/{View → src/View}/MainView.d.ts +25 -7
  39. package/dist/src/View/ScrollMode.d.ts +32 -0
  40. package/dist/{View → src/View}/ViewManager.d.ts +0 -0
  41. package/dist/src/View/ViewSync.d.ts +32 -0
  42. package/dist/{callback.d.ts → src/callback.d.ts} +12 -1
  43. package/dist/{constants.d.ts → src/constants.d.ts} +12 -5
  44. package/dist/src/image.d.ts +19 -0
  45. package/dist/{index.d.ts → src/index.d.ts} +63 -17
  46. package/dist/src/shim.d.ts +11 -0
  47. package/dist/src/storage.d.ts +7 -0
  48. package/dist/{typings.d.ts → src/typings.d.ts} +21 -8
  49. package/dist/style.css +810 -1
  50. package/docs/api.md +10 -0
  51. package/docs/app-context.md +155 -27
  52. package/docs/mirgrate-to-1.0.md +68 -0
  53. package/package.json +27 -22
  54. package/playwright.config.ts +29 -0
  55. package/src/App/AppContext.ts +81 -46
  56. package/src/App/AppPageStateImpl.ts +3 -0
  57. package/src/App/AppProxy.ts +249 -141
  58. package/src/App/WhiteboardView.ts +37 -14
  59. package/src/App/index.ts +1 -0
  60. package/src/App/type.ts +22 -0
  61. package/src/AppListener.ts +27 -21
  62. package/src/AppManager.ts +96 -50
  63. package/src/AttributesDelegate.ts +6 -3
  64. package/src/BoxManager.ts +76 -38
  65. package/src/BuiltinApps.ts +9 -8
  66. package/src/Cursor/Cursor.svelte +6 -2
  67. package/src/Cursor/Cursor.ts +15 -4
  68. package/src/Cursor/icons.ts +6 -0
  69. package/src/Cursor/index.ts +16 -11
  70. package/src/Helper.ts +25 -7
  71. package/src/InternalEmitter.ts +1 -4
  72. package/src/Page/PageController.ts +3 -1
  73. package/src/PageState.ts +8 -1
  74. package/src/ReconnectRefresher.ts +7 -3
  75. package/src/Register/index.ts +36 -14
  76. package/src/Register/loader.ts +20 -9
  77. package/src/Register/storage.ts +26 -5
  78. package/src/Utils/Common.ts +3 -0
  79. package/src/Utils/Reactive.ts +29 -27
  80. package/src/Utils/RoomHacker.ts +3 -0
  81. package/src/Utils/error.ts +6 -2
  82. package/src/View/CameraSynchronizer.ts +55 -36
  83. package/src/View/MainView.ts +163 -77
  84. package/src/View/ScrollMode.ts +240 -0
  85. package/src/View/ViewSync.ts +138 -6
  86. package/src/callback.ts +8 -1
  87. package/src/constants.ts +11 -3
  88. package/src/image/pencil-eraser-1.svg +3 -0
  89. package/src/image/pencil-eraser-2.svg +3 -0
  90. package/src/image/pencil-eraser-3.svg +3 -0
  91. package/src/index.ts +197 -60
  92. package/src/storage.ts +15 -0
  93. package/src/style.css +18 -47
  94. package/src/typings.ts +24 -7
  95. package/vite.config.js +12 -7
  96. package/dist/App/AppViewSync.d.ts +0 -11
  97. package/dist/App/Storage/StorageEvent.d.ts +0 -8
  98. package/dist/App/Storage/index.d.ts +0 -39
  99. package/dist/App/Storage/typings.d.ts +0 -22
  100. package/dist/App/Storage/utils.d.ts +0 -5
  101. package/dist/App/WhiteboardView.d.ts +0 -21
  102. package/dist/Register/storage.d.ts +0 -8
  103. package/dist/View/CameraSynchronizer.d.ts +0 -17
  104. package/dist/View/ViewSync.d.ts +0 -7
  105. package/dist/index.cjs.js +0 -46
  106. package/dist/index.es.js +0 -16161
  107. package/pnpm-lock.yaml +0 -6302
  108. package/src/App/AppViewSync.ts +0 -68
  109. package/src/App/Storage/StorageEvent.ts +0 -21
  110. package/src/App/Storage/index.ts +0 -295
  111. package/src/App/Storage/typings.ts +0 -23
  112. package/src/App/Storage/utils.ts +0 -17
@@ -1,17 +1,19 @@
1
- import { Storage } from "./Storage";
2
1
  import { autorun, listenDisposed, listenUpdated, reaction, unlistenDisposed, unlistenUpdated, toJS } from "white-web-sdk";
2
+ import { Storage } from "@netless/synced-store";
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
10
  import { WhiteBoardView } from "./WhiteboardView";
12
- export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOptions = any> {
11
+ export declare type CreateWhiteBoardViewParams = {
12
+ size?: number;
13
+ syncCamera?: boolean;
14
+ };
15
+ export declare class AppContext<TAttributes extends Record<string, any> = 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,16 +32,19 @@ 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?;
35
+ whiteBoardView?: WhiteBoardView;
34
36
  _viewWrapper?: HTMLElement;
35
- constructor(manager: AppManager, boxManager: BoxManager, appId: string, appProxy: AppProxy, appOptions?: TAppOptions | (() => TAppOptions) | undefined);
37
+ constructor(manager: AppManager, appId: string, appProxy: AppProxy, appOptions?: TAppOptions | (() => TAppOptions) | undefined);
36
38
  get displayer(): import("white-web-sdk").Displayer<import("white-web-sdk").DisplayerCallbacks>;
39
+ get destroyed(): boolean;
40
+ get attributes(): TAttributes;
37
41
  /** @deprecated Use context.storage.state instead. */
38
42
  getAttributes: () => TAttributes | undefined;
39
43
  getScenes: () => SceneDefinition[] | undefined;
40
44
  get view(): View | undefined;
41
- createWhiteBoardView: (size?: number | undefined) => WhiteBoardView;
42
- private initPageSize;
45
+ get now(): number;
46
+ createWhiteBoardView: (params?: CreateWhiteBoardViewParams | undefined) => WhiteBoardView;
47
+ private ensurePageSize;
43
48
  getInitScenePath: () => string | undefined;
44
49
  /** Get App writable status. */
45
50
  get isWritable(): boolean;
@@ -47,7 +52,7 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
47
52
  get box(): ReadonlyTeleBox;
48
53
  get room(): Room | undefined;
49
54
  get members(): Member[];
50
- get memberState(): Member;
55
+ get currentMember(): Member | undefined;
51
56
  /** @deprecated Use context.storage.setState instead. */
52
57
  setAttributes: (attributes: TAttributes) => void;
53
58
  /** @deprecated Use context.storage.setState instead. */
@@ -56,16 +61,13 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
56
61
  setScenePath: (scenePath: string) => Promise<void>;
57
62
  /** Get the local App options. */
58
63
  getAppOptions: () => TAppOptions | undefined;
59
- private _storage?;
60
- /** Main Storage for attributes. */
61
- get storage(): Storage<TAttributes>;
62
64
  /**
63
65
  * Create separated storages for flexible state management.
64
- * @param storeId Namespace for the storage. Storages of the same namespace share the same data.
66
+ * @param namespace Namespace for the storage. Storages of the same namespace share the same data.
65
67
  * @param defaultState Default state for initial storage creation.
66
68
  * @returns
67
69
  */
68
- createStorage: <TState>(storeId: string, defaultState?: TState | undefined) => Storage<TState>;
70
+ createStorage: <TState extends Record<string, any>>(namespace: string, defaultState?: TState | undefined) => Storage<TState>;
69
71
  /** Dispatch events to other clients (and self). */
70
72
  dispatchMagixEvent: MagixEventDispatcher<TMagixEventPayloads>;
71
73
  /** Listen to events from others clients (and self messages). */
File without changes
@@ -2,13 +2,15 @@ import Emittery from "emittery";
2
2
  import { AppContext } from "./AppContext";
3
3
  import { AppPageStateImpl } from "./AppPageStateImpl";
4
4
  import { Val } from "value-enhancer";
5
+ import { SideEffectManager } from "side-effect-manager";
5
6
  import type { ICamera, ISize } from "../AttributesDelegate";
6
- import type { AppEmitterEvent, AppInitState, BaseInsertParams } from "../index";
7
- import type { SceneState, View, SceneDefinition, Camera } from "white-web-sdk";
7
+ import type { AppEmitterEvent, BaseInsertParams } from "../index";
8
+ import type { SceneState, View, SceneDefinition } from "white-web-sdk";
8
9
  import type { AppManager } from "../AppManager";
9
10
  import type { NetlessApp } from "../typings";
10
11
  import type { ReadonlyTeleBox } from "@netless/telebox-insider";
11
12
  import type { PageRemoveService, PageState } from "../Page";
13
+ import type { AppState } from "./type";
12
14
  export declare type AppEmitter = Emittery<AppEmitterEvent>;
13
15
  export declare class AppProxy implements PageRemoveService {
14
16
  private params;
@@ -26,19 +28,30 @@ export declare class AppProxy implements PageRemoveService {
26
28
  private store;
27
29
  uid: string;
28
30
  isAddApp: boolean;
29
- private status;
31
+ status: "normal" | "destroyed";
30
32
  private stateKey;
31
33
  _pageState: AppPageStateImpl;
32
- private _prevFullPath;
33
- appResult?: NetlessApp<any>;
34
- appContext?: AppContext<any, any>;
35
- private sideEffectManager;
36
- camera$: Val<ICamera | undefined, any>;
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>;
37
46
  size$: Val<ISize | undefined, any>;
38
- private appViewSync?;
39
47
  box$: Val<ReadonlyTeleBox | undefined, any>;
40
48
  view$: Val<View | undefined, any>;
49
+ syncCamera$: Val<boolean, any>;
50
+ whiteBoardViewCreated$: Val<boolean, any>;
41
51
  constructor(params: BaseInsertParams, manager: AppManager, appId: string, isAddApp: boolean);
52
+ fireMemberStateChange: () => void;
53
+ private onMemberStateChange;
54
+ private computedInitialRect;
42
55
  createAppDir(): View;
43
56
  private initScenes;
44
57
  get view(): View | undefined;
@@ -59,7 +72,7 @@ export declare class AppProxy implements PageRemoveService {
59
72
  onSeek(time: number): Promise<void>;
60
73
  onReconnected(): Promise<void>;
61
74
  onRemoveScene(scenePath: string): Promise<void>;
62
- getAppInitState: (id: string) => AppInitState | undefined;
75
+ getAppInitState: (id: string) => AppState | undefined;
63
76
  emitAppSceneStateChange(sceneState: SceneState): void;
64
77
  emitAppIsWritableChange(): void;
65
78
  private makeAppEventListener;
@@ -75,7 +88,13 @@ export declare class AppProxy implements PageRemoveService {
75
88
  setSceneIndex(index: number): void;
76
89
  storeCamera: (camera: ICamera) => void;
77
90
  storeSize: (size: ISize) => void;
78
- moveCamera: (camera: Camera) => void;
91
+ updateSize: (width: number, height: number) => void;
92
+ moveCamera: (camera: Partial<ICamera>) => void;
79
93
  destroy(needCloseBox: boolean, cleanAttrs: boolean, skipUpdate: boolean, error?: Error): Promise<void>;
94
+ private addCameraReaction;
95
+ private addSizeReaction;
96
+ onFocus: () => void;
97
+ private setupDone;
98
+ private setupFailed;
80
99
  close(): Promise<void>;
81
100
  }
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 camera$: 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
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,11 +11,11 @@ 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;
19
17
  private initMainViewCameraHandler;
20
18
  private setAppFocusViewIndexHandler;
19
+ private moveCameraHandler;
20
+ private moveCameraToContainHandler;
21
21
  }
@@ -3,11 +3,13 @@ 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
- import type { Displayer, Room, SceneState } from "white-web-sdk";
9
+ import type { Displayer, Room, ScenesCallbacksNode, SceneState, Size } from "white-web-sdk";
9
10
  import type { AddAppParams, TeleBoxRect } from "./index";
10
11
  import type { Member } from "./Helper";
12
+ import { ScrollMode } from "./View/ScrollMode";
11
13
  export declare class AppManager {
12
14
  windowManger: WindowManager;
13
15
  displayer: Displayer;
@@ -21,10 +23,14 @@ export declare class AppManager {
21
23
  mainViewScenesLength: number;
22
24
  private appListeners;
23
25
  boxManager?: BoxManager;
24
- private _prevSceneIndex;
25
- private _prevFocused;
26
- private callbacksNode;
26
+ scrollMode?: ScrollMode;
27
+ scrollBaseSize$: Val<Size | null, any>;
28
+ callbacksNode: ScenesCallbacksNode | null;
27
29
  private appCreateQueue;
30
+ private sceneIndex$;
31
+ private focused$;
32
+ members$: Val<Member[], any>;
33
+ isWritable$: Val<boolean, any>;
28
34
  private sideEffectManager;
29
35
  sceneState: SceneState | null;
30
36
  rootDirRemoving: boolean;
@@ -51,7 +57,6 @@ export declare class AppManager {
51
57
  get mainView(): import("white-web-sdk").View;
52
58
  get focusApp(): AppProxy | undefined;
53
59
  get uid(): string;
54
- get members(): Member[];
55
60
  getMainViewSceneDir(): string;
56
61
  private onCreated;
57
62
  private onBoxMove;
@@ -65,9 +70,9 @@ export declare class AppManager {
65
70
  private onFocusChange;
66
71
  attributesUpdateCallback: import("lodash").DebouncedFunc<(apps: any) => Promise<void>>;
67
72
  /**
68
- * 插件更新 attributes 时的回调
73
+ * 插件更新 apps 时的回调
69
74
  *
70
- * @param {*} attributes
75
+ * @param {*} apps
71
76
  * @memberof WindowManager
72
77
  */
73
78
  _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",
@@ -33,8 +33,11 @@ export declare type StoreContext = {
33
33
  safeUpdateAttributes: (keys: string[], value: any) => void;
34
34
  safeSetAttributes: (attributes: any) => void;
35
35
  };
36
- export declare type ICamera = Camera & {
36
+ export declare type ICamera = {
37
37
  id: string;
38
+ centerX: number | null;
39
+ centerY: number | null;
40
+ scale: number;
38
41
  };
39
42
  export declare type ISize = Size & {
40
43
  id: string;
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, TeleBoxManagerThemeConfig } 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,15 @@ 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;
51
+ defaultBoxBodyStyle?: string | null;
52
+ defaultBoxStageStyle?: string | null;
53
+ theme?: TeleBoxManagerThemeConfig;
47
54
  };
48
55
  export declare type BoxManagerContext = {
49
56
  safeSetAttributes: (attributes: any) => void;
50
- getMainView: () => View;
51
57
  updateAppState: (appId: string, field: AppAttributes, value: any) => void;
52
58
  emitter: EmitterType;
53
59
  boxEmitter: BoxEmitterType;
@@ -63,7 +69,6 @@ export declare class BoxManager {
63
69
  teleBoxManager: TeleBoxManager;
64
70
  protected sideEffectManager: SideEffectManager;
65
71
  constructor(context: BoxManagerContext, createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig);
66
- private get mainView();
67
72
  private get canOperate();
68
73
  get boxState(): "normal" | "minimized" | "maximized";
69
74
  get maximized(): boolean;
@@ -72,6 +77,7 @@ export declare class BoxManager {
72
77
  get prefersColorScheme(): TeleBoxColorScheme;
73
78
  get boxSize(): number;
74
79
  get stageRect(): TeleBoxRect;
80
+ get stageRect$(): import("value-enhancer").ReadonlyVal<TeleBoxRect, any>;
75
81
  createBox(params: CreateBoxParams): ReadonlyTeleBox | undefined;
76
82
  setupBoxManager(createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig): TeleBoxManager;
77
83
  getBox(appId: string): ReadonlyTeleBox | undefined;
@@ -79,7 +85,7 @@ export declare class BoxManager {
79
85
  boxIsFocus(appId: string): boolean | undefined;
80
86
  getFocusBox(): ReadonlyTeleBox | undefined;
81
87
  getTopBox(): ReadonlyTeleBox | undefined;
82
- updateBoxState(state?: AppInitState): void;
88
+ updateBoxState(state?: AppState): void;
83
89
  moveBox({ appId, x, y }: MoveBoxParams): void;
84
90
  focusBox({ appId }: AppId, skipUpdate?: boolean): void;
85
91
  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,14 +15,15 @@ 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?;
23
23
  private sideEffectManager;
24
24
  private store;
25
25
  applianceIcons: ApplianceIcons;
26
+ get playground$(): import("value-enhancer").Val<HTMLElement | undefined, any>;
26
27
  constructor(manager: AppManager, enableCursor: boolean, applianceIcons?: ApplianceIcons);
27
28
  private onCursorMove;
28
29
  private initCursorInstance;
@@ -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,7 +1,6 @@
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";
5
4
  import type { MemberState } from "white-web-sdk";
6
5
  export declare type RemoveSceneParams = {
7
6
  scenePath: string;
@@ -9,7 +8,6 @@ export declare type RemoveSceneParams = {
9
8
  };
10
9
  export declare type EmitterEvent = {
11
10
  onCreated: undefined;
12
- InitReplay: AppInitState;
13
11
  error: Error;
14
12
  seekStart: undefined;
15
13
  seek: number;
@@ -32,7 +30,6 @@ export declare type EmitterEvent = {
32
30
  changePageState: undefined;
33
31
  writableChange: boolean;
34
32
  containerSizeRatioUpdate: number;
35
- roomMembersChange: Member[];
36
33
  memberStateChange: MemberState;
37
34
  };
38
35
  export declare type EmitterType = Emittery<EmitterEvent>;
@@ -1,15 +1,17 @@
1
1
  import type { SceneDefinition } from "white-web-sdk";
2
2
  export declare type AddPageParams = {
3
3
  after?: boolean;
4
- scene?: SceneDefinition;
4
+ scene?: SceneDefinition | SceneDefinition[];
5
5
  };
6
6
  export declare type PageState = {
7
7
  index: number;
8
8
  length: number;
9
+ pages: string[];
9
10
  };
10
11
  export interface PageController {
11
12
  nextPage: () => Promise<boolean>;
12
13
  prevPage: () => Promise<boolean>;
14
+ jumpPage: (index: number) => Promise<boolean>;
13
15
  addPage: (params?: AddPageParams) => Promise<void>;
14
16
  removePage: (index: number) => Promise<boolean>;
15
17
  pageState: PageState;
File without changes
@@ -5,5 +5,6 @@ export declare class PageStateImpl {
5
5
  constructor(manager: AppManager);
6
6
  get index(): number;
7
7
  get length(): number;
8
+ getPages(): string[];
8
9
  toObject(): PageState;
9
10
  }
File without changes
@@ -11,18 +11,20 @@ export declare type SyncRegisterAppPayload = {
11
11
  name: string | undefined;
12
12
  };
13
13
  export declare type SyncRegisterApp = (payload: SyncRegisterAppPayload) => void;
14
- declare class AppRegister {
14
+ export declare class AppRegister {
15
15
  kindEmitters: Map<string, Emittery<RegisterEvents>>;
16
16
  registered: Map<string, RegisterParams>;
17
17
  appClassesCache: Map<string, Promise<NetlessApp>>;
18
18
  appClasses: Map<string, () => Promise<NetlessApp>>;
19
+ downloaded: Map<string, string>;
19
20
  private syncRegisterApp;
20
21
  setSyncRegisterApp(fn: SyncRegisterApp): void;
21
22
  onSyncRegisterAppChange: (payload: SyncRegisterAppPayload) => void;
22
23
  register(params: RegisterParams): Promise<void>;
24
+ downloadApp(kind: string): Promise<NetlessApp<any, any, any, any> | undefined> | undefined;
25
+ removeDownloaded(kind: string): Promise<void>;
23
26
  unregister(kind: string): void;
24
27
  notifyApp<T extends keyof RegisterEvents>(kind: string, event: T, payload: RegisterEvents[T]): Promise<void>;
25
28
  private createKindEmitter;
26
29
  }
27
30
  export declare const appRegister: AppRegister;
28
- export {};
@@ -1,4 +1,4 @@
1
1
  import type { NetlessApp } from "../typings";
2
- export declare const getScript: (url: string) => Promise<string>;
2
+ export declare const getScript: (kind: string, url: string) => Promise<string>;
3
3
  export declare const executeScript: (text: string, appName: string) => NetlessApp;
4
4
  export declare const loadApp: (url: string, key: string, name?: string | undefined) => Promise<NetlessApp | undefined>;
@@ -0,0 +1,11 @@
1
+ import type { AppRegister } from "./index";
2
+ export declare type Item = {
3
+ kind: string;
4
+ url: string;
5
+ sourceCode: string;
6
+ };
7
+ export declare const initDb: (appRegister: AppRegister) => Promise<void>;
8
+ export declare const setItem: (kind: string, url: string, val: any) => Promise<void> | undefined;
9
+ export declare const getItem: (kind: string) => Promise<Item | null>;
10
+ export declare const removeItem: (key: string) => Promise<void> | undefined;
11
+ export declare const getAll: () => Promise<Item[]> | undefined;
File without changes
File without changes
@@ -1,6 +1,6 @@
1
1
  import { UpdateEventKind } from "white-web-sdk";
2
2
  import type { AkkoObjectUpdatedListener } from "white-web-sdk";
3
3
  export declare const onObjectByEvent: (event: UpdateEventKind) => (object: any, func: () => void) => (() => void) | undefined;
4
- export declare const safeListenPropsUpdated: <T>(getProps: () => T, callback: AkkoObjectUpdatedListener<T>, onDestroyed?: ((props: unknown) => void) | undefined) => () => void;
4
+ export declare const safeListenPropsUpdated: <T extends Object>(getProps: () => T, callback: AkkoObjectUpdatedListener<T>, onDestroyed?: ((props: unknown) => void) | undefined) => () => void;
5
5
  export declare const onObjectRemoved: (object: any, func: () => void) => (() => void) | undefined;
6
6
  export declare const onObjectInserted: (object: any, func: () => void) => (() => void) | undefined;
File without changes
@@ -19,9 +19,12 @@ export declare class BoxNotCreatedError extends Error {
19
19
  export declare class InvalidScenePath extends Error {
20
20
  message: string;
21
21
  }
22
- export declare class BoxManagerNotFoundError extends Error {
22
+ export declare class BoxManagerNotInitializeError extends Error {
23
23
  message: string;
24
24
  }
25
25
  export declare class BindContainerRoomPhaseInvalidError extends Error {
26
26
  message: string;
27
27
  }
28
+ export declare class InvalidViewModeError extends Error {
29
+ message: string;
30
+ }
File without changes
@@ -0,0 +1,21 @@
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
+ protected scale: number;
12
+ protected cameraUpdating: boolean;
13
+ constructor(saveCamera: SaveCamera);
14
+ setRect: (rect: TeleBoxRect, updateCamera?: boolean) => void;
15
+ setView(view: View): void;
16
+ onRemoteUpdate: import("lodash").DebouncedFunc<(camera: ICamera, size: ISize, skipUpdate?: any) => void>;
17
+ onRemoteSizeUpdate(size: ISize): void;
18
+ onLocalCameraUpdate(camera: ICamera): void;
19
+ private moveCameraToContian;
20
+ private moveCamera;
21
+ }
@@ -1,26 +1,46 @@
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";
6
+ import type { MoveCameraParams } from "../typings";
3
7
  export declare class MainViewProxy {
4
8
  private manager;
5
9
  private started;
6
10
  private mainViewIsAddListener;
7
11
  private mainView;
8
12
  private store;
9
- private synchronizer;
10
13
  private sideEffectManager;
14
+ camera$: Val<{
15
+ id: string;
16
+ centerX: number | null;
17
+ centerY: number | null;
18
+ scale: number;
19
+ } | undefined, any>;
20
+ size$: Val<ISize | undefined, any>;
21
+ view$: Val<View | undefined, any>;
22
+ private cameraUpdatePromise?;
23
+ viewSync?: ViewSync;
11
24
  constructor(manager: AppManager);
25
+ createViewSync: () => void;
12
26
  private startListenWritableChange;
13
27
  ensureCameraAndSize(): void;
28
+ moveCamera: (camera: MoveCameraParams) => void;
29
+ moveCameraToPromise: (camera: MoveCameraParams) => Promise<boolean>;
30
+ private debouncedStoreCamera;
31
+ private storeCurrentCameraSize;
14
32
  private get mainViewCamera();
15
33
  private get mainViewSize();
16
34
  private get didRelease();
17
- private moveCameraSizeByAttributes;
18
35
  start(): void;
19
36
  addCameraReaction: () => void;
20
- setCameraAndSize(): void;
37
+ saveToCamera$: () => void;
38
+ storeCurrentCamera: () => void;
39
+ storeCurrentSize: () => void;
40
+ storeCamera: (camera: ICamera) => void;
41
+ storeSize: (size: ISize) => void;
21
42
  private cameraReaction;
22
- sizeChangeHandler: import("lodash").DebouncedFunc<(size: Size) => void>;
23
- onUpdateContainerSizeRatio: () => void;
43
+ private sizeReaction;
24
44
  get view(): View;
25
45
  get cameraState(): {
26
46
  width: number;
@@ -33,8 +53,6 @@ export declare class MainViewProxy {
33
53
  onReconnect(): void;
34
54
  setFocusScenePath(path: string | undefined): View | undefined;
35
55
  rebind(): void;
36
- private onCameraUpdatedByDevice;
37
- private getStageSize;
38
56
  addMainViewListener(): void;
39
57
  removeMainViewListener(): void;
40
58
  private mainViewClickListener;