@netless/window-manager 0.3.17 → 0.4.0-canary.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/README.md +4 -43
- package/dist/AppContext.d.ts +3 -2
- package/dist/AppListener.d.ts +2 -1
- package/dist/AppManager.d.ts +12 -9
- package/dist/AppProxy.d.ts +3 -0
- package/dist/AttributesDelegate.d.ts +19 -11
- package/dist/Base/index.d.ts +1 -2
- package/dist/BoxManager.d.ts +23 -7
- package/dist/Cursor/Cursor.d.ts +2 -3
- package/dist/Cursor/index.d.ts +9 -5
- package/dist/MainView.d.ts +1 -0
- package/dist/ReconnectRefresher.d.ts +10 -3
- package/dist/Utils/RoomHacker.d.ts +2 -2
- package/dist/Utils/error.d.ts +3 -0
- package/dist/constants.d.ts +2 -1
- package/dist/index.d.ts +17 -19
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/docs/api.md +17 -0
- package/docs/migrate.md +42 -0
- package/package.json +3 -2
- package/src/AppContext.ts +2 -2
- package/src/AppListener.ts +14 -3
- package/src/AppManager.ts +92 -72
- package/src/AppProxy.ts +36 -17
- package/src/AttributesDelegate.ts +76 -49
- package/src/Base/Context.ts +2 -2
- package/src/Base/index.ts +2 -2
- package/src/BoxManager.ts +93 -35
- package/src/Cursor/Cursor.ts +35 -39
- package/src/Cursor/index.ts +79 -43
- package/src/MainView.ts +11 -3
- package/src/ReconnectRefresher.ts +30 -10
- package/src/Utils/RoomHacker.ts +5 -5
- package/src/Utils/error.ts +6 -1
- package/src/constants.ts +1 -0
- package/src/index.ts +118 -106
- package/src/style.css +1 -1
- package/src/viewManager.ts +2 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
@@ -2,54 +2,14 @@
|
|
2
2
|
|
3
3
|
- 目录
|
4
4
|
- [references](docs/api.md)
|
5
|
+
- [从白板迁移](docs/migrate.md)
|
5
6
|
## MainView
|
6
7
|
|
7
8
|
`MainView` 也就是主白板, 是垫在所有窗口下面的主白板
|
8
9
|
|
9
10
|
因为多窗口的原因,所以抽象出来一个主白板, 并且把以前部分对 `room` 的操作, 迁移到对 `mainView` 操作
|
10
11
|
|
11
|
-
###
|
12
|
-
|
13
|
-
多窗口模式必须开启白板的 `useMultiViews` 和 `useMobXState` 选项
|
14
|
-
|
15
|
-
会造成原本以下 `room` 上的一些方法和 `state` 失效
|
16
|
-
|
17
|
-
`方法`
|
18
|
-
|
19
|
-
- `room.bindHtmlElement()` 用 `WindowManager.mount()` 代替
|
20
|
-
- `room.scalePptToFit()` 暂无代替,不再推荐调用 `scalePptToFit`
|
21
|
-
- `room.setScenePath()` 用 `manager.setMainViewScenePath()` 代替
|
22
|
-
- `room.setSceneIndex()` 用 `manager.setMainViewSceneIndex()` 代替
|
23
|
-
|
24
|
-
> 为了方便使用 `manager` 替换了 `room` 上的一些方法可以直接对 `mainView` 生效
|
25
|
-
|
26
|
-
- `room.disableCameraTransform`
|
27
|
-
- `room.moveCamera`
|
28
|
-
- `room.moveCameraToContain`
|
29
|
-
- `room.convertToPointInWorld`
|
30
|
-
- `room.setCameraBound`
|
31
|
-
|
32
|
-
`camera`
|
33
|
-
|
34
|
-
- `room.state.cameraState` 用 `manager.mainView.camera` 和 `manager.mainView.size` 代替
|
35
|
-
|
36
|
-
想要监听主白板 `camera` 的变化, 请使用如下方式代替
|
37
|
-
|
38
|
-
```javascript
|
39
|
-
manager.mainView.callbacks.on("onCameraUpdated", camera => {
|
40
|
-
console.log(camera);
|
41
|
-
});
|
42
|
-
```
|
43
|
-
|
44
|
-
监听主白板 `size` 变化
|
45
|
-
|
46
|
-
```javascript
|
47
|
-
manager.mainView.callbacks.on("onSizeUpdated", size => {
|
48
|
-
console.log(size);
|
49
|
-
});
|
50
|
-
```
|
51
|
-
|
52
|
-
### 接入
|
12
|
+
### 快速开始
|
53
13
|
|
54
14
|
```javascript
|
55
15
|
import { WhiteWebSdk } from "white-web-sdk";
|
@@ -58,7 +18,7 @@ import "@netless/window-manager/dist/style.css";
|
|
58
18
|
|
59
19
|
const sdk = new WhiteWebSdk({
|
60
20
|
appIdentifier: "appIdentifier",
|
61
|
-
useMobXState: true
|
21
|
+
useMobXState: true // 请确保打开这个选项
|
62
22
|
});
|
63
23
|
|
64
24
|
sdk.joinRoom({
|
@@ -66,6 +26,7 @@ sdk.joinRoom({
|
|
66
26
|
roomToken: "room token",
|
67
27
|
invisiblePlugins: [WindowManager],
|
68
28
|
useMultiViews: true, // 多窗口必须用开启 useMultiViews
|
29
|
+
disableMagixEventDispatchLimit: true, // 请确保打开这个选项
|
69
30
|
}).then(async room => {
|
70
31
|
const manager = await WindowManager.mount(
|
71
32
|
room,
|
package/dist/AppContext.d.ts
CHANGED
@@ -2,11 +2,13 @@ import { autorun, listenDisposed, listenUpdated, reaction, unlistenDisposed, unl
|
|
2
2
|
import type { Room, SceneDefinition, View } from "white-web-sdk";
|
3
3
|
import type { ReadonlyTeleBox } from "@netless/telebox-insider";
|
4
4
|
import type Emittery from "emittery";
|
5
|
+
import type { BoxManager } from "./BoxManager";
|
5
6
|
import type { AppEmitterEvent } from "./index";
|
6
7
|
import type { AppManager } from "./AppManager";
|
7
8
|
import type { AppProxy } from "./AppProxy";
|
8
9
|
export declare class AppContext<TAttrs extends Record<string, any>, AppOptions = any> {
|
9
10
|
private manager;
|
11
|
+
private boxManager;
|
10
12
|
appId: string;
|
11
13
|
private appProxy;
|
12
14
|
private appOptions?;
|
@@ -22,11 +24,10 @@ export declare class AppContext<TAttrs extends Record<string, any>, AppOptions =
|
|
22
24
|
listenDisposed: typeof listenDisposed;
|
23
25
|
unlistenDisposed: typeof unlistenDisposed;
|
24
26
|
};
|
25
|
-
private boxManager;
|
26
27
|
private store;
|
27
28
|
readonly isAddApp: boolean;
|
28
29
|
readonly isReplay: boolean;
|
29
|
-
constructor(manager: AppManager, appId: string, appProxy: AppProxy, appOptions?: AppOptions | (() => AppOptions) | undefined);
|
30
|
+
constructor(manager: AppManager, boxManager: BoxManager, appId: string, appProxy: AppProxy, appOptions?: AppOptions | (() => AppOptions) | undefined);
|
30
31
|
getDisplayer(): import("white-web-sdk").Displayer<import("white-web-sdk").DisplayerCallbacks>;
|
31
32
|
getAttributes(): TAttrs | undefined;
|
32
33
|
getScenes(): SceneDefinition[] | undefined;
|
package/dist/AppListener.d.ts
CHANGED
@@ -2,8 +2,8 @@ import type { AppManager } from "./AppManager";
|
|
2
2
|
export declare class AppListeners {
|
3
3
|
private manager;
|
4
4
|
private displayer;
|
5
|
-
private boxManager;
|
6
5
|
constructor(manager: AppManager);
|
6
|
+
private get boxManager();
|
7
7
|
addListeners(): void;
|
8
8
|
removeListeners(): void;
|
9
9
|
private mainMagixEventListener;
|
@@ -12,4 +12,5 @@ export declare class AppListeners {
|
|
12
12
|
private switchViewsToFreedomHandler;
|
13
13
|
private boxStateChangeHandler;
|
14
14
|
private setMainViewScenePathHandler;
|
15
|
+
private moveCameraToContainHandler;
|
15
16
|
}
|
package/dist/AppManager.d.ts
CHANGED
@@ -1,28 +1,27 @@
|
|
1
1
|
import { AppStatus, Events } from "./constants";
|
2
2
|
import { AppProxy } from "./AppProxy";
|
3
|
-
import {
|
4
|
-
import { BoxManager } from "./BoxManager";
|
3
|
+
import { WindowManager } from "./index";
|
5
4
|
import { CameraStore } from "./Utils/CameraStore";
|
6
5
|
import { MainViewProxy } from "./MainView";
|
7
|
-
import { ReconnectRefresher } from "./ReconnectRefresher";
|
8
6
|
import { ViewManager } from "./ViewManager";
|
7
|
+
import type { ReconnectRefresher } from "./ReconnectRefresher";
|
8
|
+
import type { BoxManager } from "./BoxManager";
|
9
9
|
import type { Displayer, Room } from "white-web-sdk";
|
10
|
-
import type {
|
11
|
-
import type { AddAppParams, WindowManager, TeleBoxRect } from "./index";
|
10
|
+
import type { AddAppParams, TeleBoxRect } from "./index";
|
12
11
|
export declare class AppManager {
|
13
12
|
windowManger: WindowManager;
|
14
13
|
displayer: Displayer;
|
15
|
-
boxManager: BoxManager;
|
16
14
|
cameraStore: CameraStore;
|
17
15
|
viewManager: ViewManager;
|
18
16
|
appProxies: Map<string, AppProxy>;
|
19
17
|
appStatus: Map<string, AppStatus>;
|
20
|
-
store: AttributesDelegate;
|
18
|
+
store: import("./AttributesDelegate").AttributesDelegate;
|
21
19
|
mainViewProxy: MainViewProxy;
|
22
20
|
refresher?: ReconnectRefresher;
|
23
21
|
isReplay: boolean;
|
24
22
|
private appListeners;
|
25
|
-
|
23
|
+
boxManager?: BoxManager;
|
24
|
+
constructor(windowManger: WindowManager);
|
26
25
|
private onCreated;
|
27
26
|
/**
|
28
27
|
* 插件更新 attributes 时的回调
|
@@ -31,6 +30,10 @@ export declare class AppManager {
|
|
31
30
|
* @memberof WindowManager
|
32
31
|
*/
|
33
32
|
attributesUpdateCallback(apps: any): Promise<void>;
|
33
|
+
refresh(): void;
|
34
|
+
setBoxManager(boxManager: BoxManager): void;
|
35
|
+
resetMaximized(): void;
|
36
|
+
resetMinimized(): void;
|
34
37
|
private onAppDelete;
|
35
38
|
bindMainView(divElement: HTMLDivElement, disableCameraTransform: boolean): void;
|
36
39
|
addApp(params: AddAppParams, isDynamicPPT: boolean): Promise<string | undefined>;
|
@@ -55,7 +58,7 @@ export declare class AppManager {
|
|
55
58
|
safeDispatchMagixEvent(event: string, payload: any): void;
|
56
59
|
private boxEventListener;
|
57
60
|
focusByAttributes(apps: any): void;
|
58
|
-
|
61
|
+
onReconnected(): Promise<void>;
|
59
62
|
notifyContainerRectUpdate(rect: TeleBoxRect): void;
|
60
63
|
dispatchInternalEvent(event: Events, payload: any): void;
|
61
64
|
destroy(): void;
|
package/dist/AppProxy.d.ts
CHANGED
@@ -19,6 +19,9 @@ export declare class AppProxy extends Base {
|
|
19
19
|
private kind;
|
20
20
|
isAddApp: boolean;
|
21
21
|
private status;
|
22
|
+
private stateKey;
|
23
|
+
private appResult?;
|
24
|
+
private appContext?;
|
22
25
|
constructor(params: BaseInsertParams, manager: AppManager, appId: string, isAddApp: boolean);
|
23
26
|
private initScenes;
|
24
27
|
get view(): View | undefined;
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { AppAttributes } from "./constants";
|
2
2
|
import type { AddAppParams, AppSyncAttributes } from "./index";
|
3
|
-
import type { Camera, Size } from "white-web-sdk";
|
4
|
-
import type { AppManager } from "./AppManager";
|
3
|
+
import type { Camera, Size, View } from "white-web-sdk";
|
5
4
|
import type { Cursor } from "./Cursor/Cursor";
|
6
5
|
export declare enum Fields {
|
7
6
|
Apps = "apps",
|
@@ -26,14 +25,22 @@ export declare type Position = {
|
|
26
25
|
id?: string;
|
27
26
|
};
|
28
27
|
export declare type PositionType = "main" | "app";
|
28
|
+
export declare type StoreContext = {
|
29
|
+
getAttributes: () => any;
|
30
|
+
safeUpdateAttributes: (keys: string[], value: any) => void;
|
31
|
+
safeSetAttributes: (attributes: any) => void;
|
32
|
+
};
|
29
33
|
export declare class AttributesDelegate {
|
30
|
-
private
|
31
|
-
constructor(
|
34
|
+
private context;
|
35
|
+
constructor(context: StoreContext);
|
36
|
+
setContext(context: StoreContext): void;
|
37
|
+
get attributes(): any;
|
32
38
|
apps(): Apps;
|
33
39
|
get focus(): string | undefined;
|
34
40
|
getAppAttributes(id: string): AppSyncAttributes;
|
35
41
|
getAppState(id: string): any;
|
36
|
-
getMaximized():
|
42
|
+
getMaximized(): any;
|
43
|
+
getMinimized(): any;
|
37
44
|
setupAppAttributes(params: AddAppParams, id: string, isDynamicPPT: boolean): void;
|
38
45
|
updateAppState(appId: string, stateName: AppAttributes, state: any): void;
|
39
46
|
cleanAppAttributes(id: string): void;
|
@@ -42,23 +49,23 @@ export declare class AttributesDelegate {
|
|
42
49
|
getAppScenePath(id: string): any;
|
43
50
|
getMainViewScenePath(): any;
|
44
51
|
getMainViewSceneIndex(): any;
|
45
|
-
getBoxState():
|
52
|
+
getBoxState(): any;
|
46
53
|
setMainViewScenePath(scenePath: string): void;
|
47
54
|
setMainViewSceneIndex(index: number): void;
|
48
55
|
getMainViewCamera(): MainViewCamera;
|
49
56
|
getMainViewSize(): MainViewSize;
|
50
|
-
setMainViewCamera(camera: Camera & {
|
57
|
+
setMainViewCamera(camera: (Camera & {
|
51
58
|
id: string;
|
52
|
-
} | undefined): void;
|
53
|
-
setMainViewSize(size: Size & {
|
59
|
+
}) | undefined): void;
|
60
|
+
setMainViewSize(size: (Size & {
|
54
61
|
id: string;
|
55
|
-
} | undefined): void;
|
62
|
+
}) | undefined): void;
|
56
63
|
setAppFocus(appId: string, focus: boolean): void;
|
57
64
|
updateCursor(uid: string, position: Position): void;
|
58
65
|
updateCursorState(uid: string, cursorState: string | undefined): void;
|
59
66
|
getCursorState(uid: string): any;
|
60
67
|
cleanCursor(uid: string): void;
|
61
|
-
setMainViewFocusPath(): void;
|
68
|
+
setMainViewFocusPath(mainView: View): void;
|
62
69
|
}
|
63
70
|
export declare type MainViewSize = {
|
64
71
|
id: string;
|
@@ -74,3 +81,4 @@ export declare type MainViewCamera = {
|
|
74
81
|
export declare type Cursors = {
|
75
82
|
[key: string]: Cursor;
|
76
83
|
};
|
84
|
+
export declare const store: AttributesDelegate;
|
package/dist/Base/index.d.ts
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
import type { AppManager } from "../AppManager";
|
2
|
-
import { AttributesDelegate } from "../AttributesDelegate";
|
3
2
|
export declare class Base {
|
4
3
|
manager: AppManager;
|
5
|
-
store: AttributesDelegate;
|
4
|
+
store: import("../AttributesDelegate").AttributesDelegate;
|
6
5
|
context: import("./Context").Context;
|
7
6
|
constructor(manager: AppManager);
|
8
7
|
}
|
package/dist/BoxManager.d.ts
CHANGED
@@ -1,8 +1,9 @@
|
|
1
|
+
import { AppAttributes } from "./constants";
|
1
2
|
import { TELE_BOX_STATE, TeleBoxManager } from "@netless/telebox-insider";
|
2
|
-
import
|
3
|
-
import type {
|
3
|
+
import { WindowManager } from "./index";
|
4
|
+
import type { AddAppOptions, AppInitState, EmitterType, CallbacksType } from "./index";
|
5
|
+
import type { TeleBoxManagerUpdateConfig, ReadonlyTeleBox, TeleBoxColorScheme, TeleBoxRect } from "@netless/telebox-insider";
|
4
6
|
import type Emittery from "emittery";
|
5
|
-
import type { AppManager } from "./AppManager";
|
6
7
|
import type { NetlessApp } from "./typings";
|
7
8
|
import type { View } from "white-web-sdk";
|
8
9
|
export { TELE_BOX_STATE };
|
@@ -39,20 +40,34 @@ export declare type CreateTeleBoxManagerConfig = {
|
|
39
40
|
collectorStyles?: Partial<CSSStyleDeclaration>;
|
40
41
|
prefersColorScheme?: TeleBoxColorScheme;
|
41
42
|
};
|
43
|
+
export declare type BoxManagerContext = {
|
44
|
+
safeSetAttributes: (attributes: any) => void;
|
45
|
+
getMainView: () => View;
|
46
|
+
updateAppState: (appId: string, field: AppAttributes, value: any) => void;
|
47
|
+
emitter: EmitterType;
|
48
|
+
callbacks: CallbacksType;
|
49
|
+
canOperate: () => boolean;
|
50
|
+
notifyContainerRectUpdate: (rect: TeleBoxRect) => void;
|
51
|
+
cleanFocus: () => void;
|
52
|
+
};
|
53
|
+
export declare const createBoxManager: (manager: WindowManager, callbacks: CallbacksType, emitter: EmitterType, options: CreateTeleBoxManagerConfig) => BoxManager;
|
42
54
|
export declare class BoxManager {
|
43
|
-
private
|
55
|
+
private context;
|
56
|
+
private createTeleBoxManagerConfig?;
|
44
57
|
teleBoxManager: TeleBoxManager;
|
45
|
-
|
46
|
-
private mainView;
|
47
|
-
|
58
|
+
constructor(context: BoxManagerContext, createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig | undefined);
|
59
|
+
private get mainView();
|
60
|
+
private get canOperate();
|
48
61
|
get boxState(): "normal" | "minimized" | "maximized";
|
49
62
|
get maximized(): boolean;
|
50
63
|
get minimized(): boolean;
|
51
64
|
get darkMode(): boolean;
|
52
65
|
get prefersColorScheme(): TeleBoxColorScheme;
|
66
|
+
get boxSize(): number;
|
53
67
|
createBox(params: CreateBoxParams): void;
|
54
68
|
setBoxInitState(appId: string): void;
|
55
69
|
setupBoxManager(createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig): TeleBoxManager;
|
70
|
+
setCollectorContainer(container: HTMLElement): void;
|
56
71
|
getBox(appId: string): ReadonlyTeleBox | undefined;
|
57
72
|
closeBox(appId: string, skipUpdate?: boolean): ReadonlyTeleBox | undefined;
|
58
73
|
boxIsFocus(appId: string): boolean | undefined;
|
@@ -72,5 +87,6 @@ export declare class BoxManager {
|
|
72
87
|
focusTopBox(): void;
|
73
88
|
setReadonly(readonly: boolean): void;
|
74
89
|
setPrefersColorScheme(colorScheme: TeleBoxColorScheme): void;
|
90
|
+
setZIndex(id: string, zIndex: number, skipUpdate?: boolean): void;
|
75
91
|
destroy(): void;
|
76
92
|
}
|
package/dist/Cursor/Cursor.d.ts
CHANGED
@@ -13,11 +13,10 @@ export declare class Cursor extends Base {
|
|
13
13
|
private cursorManager;
|
14
14
|
private wrapper?;
|
15
15
|
private member?;
|
16
|
-
private disposer;
|
17
16
|
private timer?;
|
18
17
|
private component?;
|
19
|
-
constructor(manager: AppManager, cursors: any, memberId: string, cursorManager: CursorManager, wrapper?: HTMLElement | undefined);
|
20
|
-
private
|
18
|
+
constructor(manager: AppManager, addCursorChangeListener: (uid: string, callback: (position: Position, state: CursorState) => void) => void, cursors: any, memberId: string, cursorManager: CursorManager, wrapper?: HTMLElement | undefined);
|
19
|
+
private onCursorChange;
|
21
20
|
private moveCursor;
|
22
21
|
get memberApplianceName(): ApplianceNames | undefined;
|
23
22
|
get memberColor(): string;
|
package/dist/Cursor/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import { Base } from
|
2
|
-
import { Cursor } from
|
3
|
-
import
|
1
|
+
import { Base } from "../Base";
|
2
|
+
import { Cursor } from "./Cursor";
|
3
|
+
import { CursorState } from "../constants";
|
4
|
+
import type { PositionType, Position } from "../AttributesDelegate";
|
4
5
|
import type { RoomMember, View } from "white-web-sdk";
|
5
6
|
import type { AppManager } from "../AppManager";
|
6
7
|
export declare type EventType = {
|
@@ -19,16 +20,17 @@ export declare class CursorManager extends Base {
|
|
19
20
|
cursorInstances: Map<string, Cursor>;
|
20
21
|
roomMembers?: readonly RoomMember[];
|
21
22
|
private mainViewElement?;
|
23
|
+
private sideEffectManager;
|
22
24
|
constructor(appManager: AppManager);
|
25
|
+
setupWrapper(wrapper: HTMLElement): void;
|
23
26
|
setMainViewDivElement(div: HTMLDivElement): void;
|
24
27
|
private startReaction;
|
25
28
|
private getUids;
|
26
29
|
private handleRoomMembersChange;
|
27
30
|
get cursors(): any;
|
28
|
-
get boxState():
|
31
|
+
get boxState(): any;
|
29
32
|
get focusView(): View | undefined;
|
30
33
|
private mouseMoveListener;
|
31
|
-
private touchMoveListener;
|
32
34
|
private updateCursor;
|
33
35
|
private getPoint;
|
34
36
|
/**
|
@@ -43,5 +45,7 @@ export declare class CursorManager extends Base {
|
|
43
45
|
deleteCursor(uid: string): void;
|
44
46
|
hideCursor(uid: string): void;
|
45
47
|
cleanMemberAttributes(members: readonly RoomMember[]): void;
|
48
|
+
onReconnect(): void;
|
49
|
+
addCursorChangeListener: (uid: string, callback: (position: Position, state: CursorState) => void) => void;
|
46
50
|
destroy(): void;
|
47
51
|
}
|
package/dist/MainView.d.ts
CHANGED
@@ -1,16 +1,23 @@
|
|
1
1
|
import type { Room } from "white-web-sdk";
|
2
|
-
import type {
|
2
|
+
import type { EmitterType } from "./index";
|
3
|
+
export declare type ReconnectRefresherContext = {
|
4
|
+
emitter: EmitterType;
|
5
|
+
};
|
3
6
|
export declare class ReconnectRefresher {
|
4
|
-
private
|
7
|
+
private ctx;
|
5
8
|
private phase?;
|
6
9
|
private room;
|
7
10
|
private reactors;
|
8
11
|
private disposers;
|
9
|
-
constructor(
|
12
|
+
constructor(ctx: ReconnectRefresherContext);
|
13
|
+
setRoom(room: Room | undefined): void;
|
14
|
+
setContext(ctx: ReconnectRefresherContext): void;
|
10
15
|
private onPhaseChanged;
|
11
16
|
private onReconnected;
|
12
17
|
private releaseDisposers;
|
13
18
|
add(id: string, func: any): void;
|
14
19
|
remove(id: string): void;
|
20
|
+
hasReactor(id: string): boolean;
|
15
21
|
destroy(): void;
|
16
22
|
}
|
23
|
+
export declare const reconnectRefresher: ReconnectRefresher;
|
@@ -1,3 +1,3 @@
|
|
1
|
+
import type { WindowManager } from '../index';
|
1
2
|
import type { Room } from "white-web-sdk";
|
2
|
-
|
3
|
-
export declare const replaceRoomFunction: (room: Room, manager: AppManager) => void;
|
3
|
+
export declare const replaceRoomFunction: (room: Room, manager: WindowManager) => void;
|
package/dist/Utils/error.d.ts
CHANGED
package/dist/constants.d.ts
CHANGED
@@ -9,7 +9,8 @@ export declare enum Events {
|
|
9
9
|
WindowCreated = "WindowCreated",
|
10
10
|
SetMainViewScenePath = "SetMainViewScenePath",
|
11
11
|
SetMainViewSceneIndex = "SetMainViewSceneIndex",
|
12
|
-
SwitchViewsToFreedom = "SwitchViewsToFreedom"
|
12
|
+
SwitchViewsToFreedom = "SwitchViewsToFreedom",
|
13
|
+
MoveCameraToContain = "MoveCameraToContain"
|
13
14
|
}
|
14
15
|
export declare const MagixEventName = "__WindowManger";
|
15
16
|
export declare enum AppAttributes {
|
package/dist/index.d.ts
CHANGED
@@ -29,11 +29,11 @@ export declare type AddAppOptions = {
|
|
29
29
|
export declare type setAppOptions = AddAppOptions & {
|
30
30
|
appOptions?: any;
|
31
31
|
};
|
32
|
-
export declare type AddAppParams = {
|
32
|
+
export declare type AddAppParams<TAttributes = any> = {
|
33
33
|
kind: string;
|
34
34
|
src?: string;
|
35
35
|
options?: AddAppOptions;
|
36
|
-
attributes?:
|
36
|
+
attributes?: TAttributes;
|
37
37
|
};
|
38
38
|
export declare type BaseInsertParams = {
|
39
39
|
kind: string;
|
@@ -49,6 +49,7 @@ export declare type AppSyncAttributes = {
|
|
49
49
|
state?: any;
|
50
50
|
isDynamicPPT?: boolean;
|
51
51
|
fullPath?: string;
|
52
|
+
createdAt?: number;
|
52
53
|
};
|
53
54
|
export declare type AppInitState = {
|
54
55
|
id: string;
|
@@ -90,8 +91,10 @@ export declare type EmitterEvent = {
|
|
90
91
|
observerIdChange: number;
|
91
92
|
boxStateChange: string;
|
92
93
|
playgroundSizeChange: DOMRect;
|
94
|
+
onReconnected: void;
|
93
95
|
};
|
94
|
-
export declare
|
96
|
+
export declare type EmitterType = Emittery<EmitterEvent>;
|
97
|
+
export declare const emitter: EmitterType;
|
95
98
|
export declare type PublicEvent = {
|
96
99
|
mainViewModeChange: ViewVisionMode;
|
97
100
|
boxStateChange: `${TELE_BOX_STATE}`;
|
@@ -101,7 +104,7 @@ export declare type PublicEvent = {
|
|
101
104
|
};
|
102
105
|
export declare type MountParams = {
|
103
106
|
room: Room;
|
104
|
-
container
|
107
|
+
container?: HTMLElement;
|
105
108
|
/** 白板高宽比例, 默认为 9 / 16 */
|
106
109
|
containerSizeRatio?: number;
|
107
110
|
/** 显示 PS 透明背景,默认 true */
|
@@ -114,7 +117,8 @@ export declare type MountParams = {
|
|
114
117
|
disableCameraTransform?: boolean;
|
115
118
|
prefersColorScheme?: TeleBoxColorScheme;
|
116
119
|
};
|
117
|
-
export declare
|
120
|
+
export declare type CallbacksType = Emittery<PublicEvent>;
|
121
|
+
export declare const callbacks: CallbacksType;
|
118
122
|
export declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
119
123
|
static kind: string;
|
120
124
|
static displayer: Displayer;
|
@@ -132,20 +136,14 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
132
136
|
cursorManager?: CursorManager;
|
133
137
|
viewMode: ViewMode;
|
134
138
|
isReplay: boolean;
|
139
|
+
private boxManager?;
|
140
|
+
private static params?;
|
135
141
|
constructor(context: InvisiblePluginContext);
|
136
|
-
/**
|
137
|
-
* 挂载 WindowManager
|
138
|
-
* @deprecated
|
139
|
-
*/
|
140
|
-
static mount(room: Room, container: HTMLElement, collectorContainer?: HTMLElement, options?: {
|
141
|
-
chessboard: boolean;
|
142
|
-
containerSizeRatio: number;
|
143
|
-
collectorStyles?: Partial<CSSStyleDeclaration>;
|
144
|
-
debug?: boolean;
|
145
|
-
overwriteStyles?: string;
|
146
|
-
}): Promise<WindowManager>;
|
147
142
|
static mount(params: MountParams): Promise<WindowManager>;
|
148
143
|
private static initManager;
|
144
|
+
private static initContainer;
|
145
|
+
bindContainer(container: HTMLElement): void;
|
146
|
+
bindCollectorContainer(container: HTMLElement): void;
|
149
147
|
/**
|
150
148
|
* 注册插件
|
151
149
|
*/
|
@@ -153,7 +151,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
153
151
|
/**
|
154
152
|
* 创建一个 app 至白板
|
155
153
|
*/
|
156
|
-
addApp(params: AddAppParams): Promise<string | undefined>;
|
154
|
+
addApp<T = any>(params: AddAppParams<T>): Promise<string | undefined>;
|
157
155
|
private setupScenePath;
|
158
156
|
/**
|
159
157
|
* 设置 mainView 的 ScenePath, 并且切换白板为可写状态
|
@@ -191,9 +189,9 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
191
189
|
get camera(): Camera;
|
192
190
|
get cameraState(): CameraState;
|
193
191
|
get apps(): Apps | undefined;
|
194
|
-
get boxState(): TeleBoxState;
|
192
|
+
get boxState(): TeleBoxState | undefined;
|
195
193
|
get darkMode(): boolean;
|
196
|
-
get prefersColorScheme(): TeleBoxColorScheme;
|
194
|
+
get prefersColorScheme(): TeleBoxColorScheme | undefined;
|
197
195
|
/**
|
198
196
|
* 查询所有的 App
|
199
197
|
*/
|