@netless/window-manager 0.3.18 → 0.4.0-canary.11
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 +6 -0
- package/README.md +4 -43
- package/dist/App/MagixEvent/index.d.ts +28 -0
- package/dist/App/Storage/StorageEvent.d.ts +8 -0
- package/dist/App/Storage/index.d.ts +38 -0
- package/dist/App/Storage/typings.d.ts +21 -0
- package/dist/App/Storage/utils.d.ts +5 -0
- package/dist/AppContext.d.ts +42 -17
- package/dist/AppListener.d.ts +2 -2
- package/dist/AppManager.d.ts +18 -14
- package/dist/AppProxy.d.ts +5 -3
- package/dist/AttributesDelegate.d.ts +19 -11
- package/dist/Base/Context.d.ts +0 -1
- package/dist/Base/index.d.ts +1 -2
- package/dist/BoxManager.d.ts +24 -7
- package/dist/BuiltinApps.d.ts +6 -0
- package/dist/ContainerResizeObserver.d.ts +10 -0
- package/dist/Cursor/Cursor.d.ts +2 -3
- package/dist/Cursor/index.d.ts +9 -5
- package/dist/Helper.d.ts +6 -0
- package/dist/ReconnectRefresher.d.ts +9 -3
- package/dist/Utils/Common.d.ts +3 -1
- package/dist/Utils/Reactive.d.ts +1 -1
- package/dist/Utils/RoomHacker.d.ts +2 -2
- package/dist/Utils/error.d.ts +3 -0
- package/dist/{MainView.d.ts → View/MainView.d.ts} +3 -4
- package/dist/View/ViewManager.d.ts +13 -0
- package/dist/constants.d.ts +3 -7
- package/dist/index.d.ts +25 -27
- 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/dist/typings.d.ts +3 -2
- package/docs/api.md +17 -0
- package/docs/migrate.md +42 -0
- package/package.json +6 -4
- package/src/App/MagixEvent/index.ts +66 -0
- package/src/App/Storage/StorageEvent.ts +21 -0
- package/src/App/Storage/index.ts +284 -0
- package/src/App/Storage/typings.ts +21 -0
- package/src/App/Storage/utils.ts +17 -0
- package/src/AppContext.ts +61 -21
- package/src/AppListener.ts +15 -11
- package/src/AppManager.ts +141 -95
- package/src/AppProxy.ts +49 -52
- package/src/AttributesDelegate.ts +76 -49
- package/src/Base/Context.ts +2 -6
- package/src/Base/index.ts +2 -2
- package/src/BoxManager.ts +89 -31
- package/src/BuiltinApps.ts +24 -0
- package/src/ContainerResizeObserver.ts +62 -0
- package/src/Cursor/Cursor.ts +35 -39
- package/src/Cursor/index.ts +79 -43
- package/src/Helper.ts +30 -0
- package/src/ReconnectRefresher.ts +25 -10
- package/src/Utils/Common.ts +35 -13
- package/src/Utils/Reactive.ts +9 -3
- package/src/Utils/RoomHacker.ts +20 -5
- package/src/Utils/error.ts +6 -1
- package/src/{MainView.ts → View/MainView.ts} +19 -27
- package/src/View/ViewManager.ts +53 -0
- package/src/constants.ts +2 -3
- package/src/index.ts +144 -171
- package/src/shim.d.ts +4 -0
- package/src/style.css +7 -1
- package/src/typings.ts +3 -2
- package/vite.config.js +4 -1
- package/dist/Utils/CameraStore.d.ts +0 -15
- package/dist/ViewManager.d.ts +0 -29
- package/dist/sdk.d.ts +0 -14
- package/src/Utils/CameraStore.ts +0 -72
- package/src/sdk.ts +0 -39
- package/src/viewManager.ts +0 -177
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,
|
@@ -0,0 +1,28 @@
|
|
1
|
+
import type { MagixEventListenerOptions as WhiteMagixListenerOptions, Event as WhiteEvent, EventPhase as WhiteEventPhase, Scope as WhiteScope } from "white-web-sdk";
|
2
|
+
export interface MagixEventListenerOptions extends WhiteMagixListenerOptions {
|
3
|
+
/**
|
4
|
+
* Rapid emitted callbacks will be slowed down to this interval (in ms).
|
5
|
+
*/
|
6
|
+
fireInterval?: number;
|
7
|
+
/**
|
8
|
+
* If `true`, sent events will reach self-listeners after committed to server.
|
9
|
+
* Otherwise the events will reach self-listeners immediately.
|
10
|
+
*/
|
11
|
+
fireSelfEventAfterCommit?: boolean;
|
12
|
+
}
|
13
|
+
export interface MagixEventMessage<TPayloads = any, TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>> extends Omit<WhiteEvent, "scope" | "phase"> {
|
14
|
+
/** Event name */
|
15
|
+
event: TEvent;
|
16
|
+
/** Event Payload */
|
17
|
+
payload: TPayloads[TEvent];
|
18
|
+
/** Whiteboard ID of the client who dispatched the event. It will be AdminObserverId for system events. */
|
19
|
+
authorId: number;
|
20
|
+
scope: `${WhiteScope}`;
|
21
|
+
phase: `${WhiteEventPhase}`;
|
22
|
+
}
|
23
|
+
export declare type MagixEventTypes<TPayloads = any> = Extract<keyof TPayloads, string>;
|
24
|
+
export declare type MagixEventPayload<TPayloads = any, TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>> = TPayloads[TEvent];
|
25
|
+
export declare type MagixEventDispatcher<TPayloads = any> = <TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>>(event: TEvent, payload: TPayloads[TEvent]) => void;
|
26
|
+
export declare type MagixEventHandler<TPayloads = any, TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>> = (message: MagixEventMessage<TPayloads, TEvent>) => void;
|
27
|
+
export declare type MagixEventAddListener<TPayloads = any> = <TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>>(event: TEvent, handler: MagixEventHandler<TPayloads, TEvent>, options?: MagixEventListenerOptions | undefined) => void;
|
28
|
+
export declare type MagixEventRemoveListener<TPayloads = any> = <TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>>(event: TEvent, handler?: MagixEventHandler<TPayloads, TEvent>) => void;
|
@@ -0,0 +1,8 @@
|
|
1
|
+
export declare type StorageEventListener<T> = (event: T) => void;
|
2
|
+
export declare class StorageEvent<TMessage> {
|
3
|
+
listeners: Set<StorageEventListener<TMessage>>;
|
4
|
+
get length(): number;
|
5
|
+
dispatch(message: TMessage): void;
|
6
|
+
addListener(listener: StorageEventListener<TMessage>): void;
|
7
|
+
removeListener(listener: StorageEventListener<TMessage>): void;
|
8
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { AppContext } from "../../AppContext";
|
2
|
+
import type { Diff } from "./typings";
|
3
|
+
import { StorageEvent } from "./StorageEvent";
|
4
|
+
export * from './typings';
|
5
|
+
export declare const STORAGE_NS = "_WM-STORAGE_";
|
6
|
+
export declare class Storage<TState extends Record<string, any> = any> implements Storage<TState> {
|
7
|
+
readonly id: string | null;
|
8
|
+
private readonly _context;
|
9
|
+
private readonly _sideEffect;
|
10
|
+
private _state;
|
11
|
+
private _destroyed;
|
12
|
+
private _refMap;
|
13
|
+
/**
|
14
|
+
* `setState` alters local state immediately before sending to server. This will cache the old value for onStateChanged diffing.
|
15
|
+
*/
|
16
|
+
private _lastValue;
|
17
|
+
constructor(context: AppContext, id?: string, defaultState?: TState);
|
18
|
+
get state(): Readonly<TState>;
|
19
|
+
readonly onStateChanged: StorageEvent<Diff<TState>>;
|
20
|
+
ensureState(state: Partial<TState>): void;
|
21
|
+
setState(state: Partial<TState>): void;
|
22
|
+
/**
|
23
|
+
* Empty storage data.
|
24
|
+
*/
|
25
|
+
emptyStorage(): void;
|
26
|
+
/**
|
27
|
+
* Delete storage index with all of its data and destroy the Storage instance.
|
28
|
+
*/
|
29
|
+
deleteStorage(): void;
|
30
|
+
get destroyed(): boolean;
|
31
|
+
/**
|
32
|
+
* Destroy the Storage instance. The data will be kept.
|
33
|
+
*/
|
34
|
+
destroy(): void;
|
35
|
+
private _getRawState;
|
36
|
+
private _setRawState;
|
37
|
+
private _updateProperties;
|
38
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
import type { StorageEventListener } from "./StorageEvent";
|
2
|
+
export declare type RefValue<TValue = any> = {
|
3
|
+
k: string;
|
4
|
+
v: TValue;
|
5
|
+
__isRef: true;
|
6
|
+
};
|
7
|
+
export declare type ExtractRawValue<TValue> = TValue extends RefValue<infer TRefValue> ? TRefValue : TValue;
|
8
|
+
export declare type AutoRefValue<TValue> = RefValue<ExtractRawValue<TValue>>;
|
9
|
+
export declare type MaybeRefValue<TValue> = TValue | AutoRefValue<TValue>;
|
10
|
+
export declare type DiffOne<T> = {
|
11
|
+
oldValue?: T;
|
12
|
+
newValue?: T;
|
13
|
+
};
|
14
|
+
export declare type Diff<T> = {
|
15
|
+
[K in keyof T]?: DiffOne<T[K]>;
|
16
|
+
};
|
17
|
+
export declare type StorageOnSetStatePayload<TState = unknown> = {
|
18
|
+
[K in keyof TState]?: MaybeRefValue<TState[K]>;
|
19
|
+
};
|
20
|
+
export declare type StorageStateChangedEvent<TState = any> = Diff<TState>;
|
21
|
+
export declare type StorageStateChangedListener<TState = any> = StorageEventListener<StorageStateChangedEvent<TState>>;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import type { AutoRefValue, RefValue } from "./typings";
|
2
|
+
export declare const plainObjectKeys: <T>(o: T) => Extract<keyof T, string>[];
|
3
|
+
export declare function isRef<TValue = unknown>(e: unknown): e is RefValue<TValue>;
|
4
|
+
export declare function makeRef<TValue>(v: TValue): RefValue<TValue>;
|
5
|
+
export declare function makeAutoRef<TValue>(v: TValue): AutoRefValue<TValue>;
|
package/dist/AppContext.d.ts
CHANGED
@@ -2,15 +2,19 @@ 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
|
+
import { Storage } from './App/Storage';
|
10
|
+
import type { MagixEventAddListener, MagixEventDispatcher, MagixEventRemoveListener } from './App/MagixEvent';
|
11
|
+
export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOptions = any> {
|
9
12
|
private manager;
|
13
|
+
private boxManager;
|
10
14
|
appId: string;
|
11
15
|
private appProxy;
|
12
16
|
private appOptions?;
|
13
|
-
readonly emitter: Emittery<AppEmitterEvent<
|
17
|
+
readonly emitter: Emittery<AppEmitterEvent<TAttributes>>;
|
14
18
|
readonly mobxUtils: {
|
15
19
|
autorun: typeof autorun;
|
16
20
|
reaction: typeof reaction;
|
@@ -22,22 +26,43 @@ export declare class AppContext<TAttrs extends Record<string, any>, AppOptions =
|
|
22
26
|
listenDisposed: typeof listenDisposed;
|
23
27
|
unlistenDisposed: typeof unlistenDisposed;
|
24
28
|
};
|
25
|
-
private boxManager;
|
26
29
|
private store;
|
27
30
|
readonly isAddApp: boolean;
|
28
31
|
readonly isReplay: boolean;
|
29
|
-
constructor(manager: AppManager, appId: string, appProxy: AppProxy, appOptions?:
|
30
|
-
getDisplayer()
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
32
|
+
constructor(manager: AppManager, boxManager: BoxManager, appId: string, appProxy: AppProxy, appOptions?: TAppOptions | (() => TAppOptions) | undefined);
|
33
|
+
getDisplayer: () => import("white-web-sdk").Displayer<import("white-web-sdk").DisplayerCallbacks>;
|
34
|
+
/** @deprecated Use context.storage.state instead. */
|
35
|
+
getAttributes: () => TAttributes | undefined;
|
36
|
+
getScenes: () => SceneDefinition[] | undefined;
|
37
|
+
getView: () => View | undefined;
|
38
|
+
getInitScenePath: () => string | undefined;
|
39
|
+
/** Get App writable status. */
|
40
|
+
getIsWritable: () => boolean;
|
41
|
+
/** Get the App Window UI box. */
|
42
|
+
getBox: () => ReadonlyTeleBox;
|
43
|
+
getRoom: () => Room | undefined;
|
44
|
+
/** @deprecated Use context.storage.setState instead. */
|
45
|
+
setAttributes: (attributes: TAttributes) => void;
|
46
|
+
/** @deprecated Use context.storage.setState instead. */
|
47
|
+
updateAttributes: (keys: string[], value: any) => void;
|
48
|
+
setScenePath: (scenePath: string) => Promise<void>;
|
49
|
+
mountView: (dom: HTMLDivElement) => void;
|
50
|
+
/** Get the local App options. */
|
51
|
+
getAppOptions: () => TAppOptions | undefined;
|
52
|
+
private _storage?;
|
53
|
+
/** Main Storage for attributes. */
|
54
|
+
get storage(): Storage<TAttributes>;
|
55
|
+
/**
|
56
|
+
* Create separated storages for flexible state management.
|
57
|
+
* @param storeId Namespace for the storage. Storages of the same namespace share the same data.
|
58
|
+
* @param defaultState Default state for initial storage creation.
|
59
|
+
* @returns
|
60
|
+
*/
|
61
|
+
createStorage: <TState>(storeId: string, defaultState?: TState | undefined) => Storage<TState>;
|
62
|
+
/** Dispatch events to other clients (and self). */
|
63
|
+
dispatchMagixEvent: MagixEventDispatcher<TMagixEventPayloads>;
|
64
|
+
/** Listen to events from others clients (and self messages). */
|
65
|
+
addMagixEventListener: MagixEventAddListener<TMagixEventPayloads>;
|
66
|
+
/** Remove a Magix event listener. */
|
67
|
+
removeMagixEventListener: MagixEventRemoveListener<TMagixEventPayloads>;
|
43
68
|
}
|
package/dist/AppListener.d.ts
CHANGED
@@ -2,14 +2,14 @@ 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;
|
10
10
|
private appMoveHandler;
|
11
11
|
private appResizeHandler;
|
12
|
-
private switchViewsToFreedomHandler;
|
13
12
|
private boxStateChangeHandler;
|
14
13
|
private setMainViewScenePathHandler;
|
14
|
+
private moveCameraToContainHandler;
|
15
15
|
}
|
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 {
|
5
|
-
import {
|
6
|
-
import {
|
7
|
-
import {
|
8
|
-
import { ViewManager } from "./ViewManager";
|
3
|
+
import { WindowManager } from "./index";
|
4
|
+
import { MainViewProxy } from "./View/MainView";
|
5
|
+
import { ViewManager } from "./View/ViewManager";
|
6
|
+
import type { ReconnectRefresher } from "./ReconnectRefresher";
|
7
|
+
import type { BoxManager } from "./BoxManager";
|
9
8
|
import type { Displayer, Room } from "white-web-sdk";
|
10
|
-
import type {
|
11
|
-
import type { AddAppParams, WindowManager, TeleBoxRect } from "./index";
|
9
|
+
import type { AddAppParams, TeleBoxRect } from "./index";
|
12
10
|
export declare class AppManager {
|
13
11
|
windowManger: WindowManager;
|
14
12
|
displayer: Displayer;
|
15
|
-
boxManager: BoxManager;
|
16
|
-
cameraStore: CameraStore;
|
17
13
|
viewManager: ViewManager;
|
18
14
|
appProxies: Map<string, AppProxy>;
|
19
15
|
appStatus: Map<string, AppStatus>;
|
20
|
-
store: AttributesDelegate;
|
16
|
+
store: import("./AttributesDelegate").AttributesDelegate;
|
21
17
|
mainViewProxy: MainViewProxy;
|
22
18
|
refresher?: ReconnectRefresher;
|
23
19
|
isReplay: boolean;
|
24
20
|
private appListeners;
|
25
|
-
|
21
|
+
boxManager?: BoxManager;
|
22
|
+
private _prevSceneIndex;
|
23
|
+
private _prevFocused;
|
24
|
+
constructor(windowManger: WindowManager);
|
26
25
|
private onCreated;
|
27
26
|
/**
|
28
27
|
* 插件更新 attributes 时的回调
|
@@ -31,15 +30,20 @@ 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;
|
39
|
+
setMainViewFocusPath(): void;
|
36
40
|
addApp(params: AddAppParams, isDynamicPPT: boolean): Promise<string | undefined>;
|
37
41
|
private beforeAddApp;
|
38
42
|
private afterAddApp;
|
39
43
|
closeApp(appId: string): Promise<void>;
|
40
44
|
private baseInsertApp;
|
41
45
|
private displayerStateListener;
|
42
|
-
|
46
|
+
displayerWritableListener: (isReadonly: boolean) => void;
|
43
47
|
private get eventName();
|
44
48
|
get attributes(): import("./index").WindowMangerAttributes;
|
45
49
|
get canOperate(): boolean;
|
@@ -55,7 +59,7 @@ export declare class AppManager {
|
|
55
59
|
safeDispatchMagixEvent(event: string, payload: any): void;
|
56
60
|
private boxEventListener;
|
57
61
|
focusByAttributes(apps: any): void;
|
58
|
-
|
62
|
+
onReconnected(): Promise<void>;
|
59
63
|
notifyContainerRectUpdate(rect: TeleBoxRect): void;
|
60
64
|
dispatchInternalEvent(event: Events, payload: any): void;
|
61
65
|
destroy(): void;
|
package/dist/AppProxy.d.ts
CHANGED
@@ -15,10 +15,12 @@ export declare class AppProxy extends Base {
|
|
15
15
|
private boxManager;
|
16
16
|
private appProxies;
|
17
17
|
private viewManager;
|
18
|
-
private cameraStore;
|
19
18
|
private kind;
|
20
19
|
isAddApp: boolean;
|
21
20
|
private status;
|
21
|
+
private stateKey;
|
22
|
+
private appResult?;
|
23
|
+
private appContext?;
|
22
24
|
constructor(params: BaseInsertParams, manager: AppManager, appId: string, isAddApp: boolean);
|
23
25
|
private initScenes;
|
24
26
|
get view(): View | undefined;
|
@@ -26,8 +28,9 @@ export declare class AppProxy extends Base {
|
|
26
28
|
get attributes(): any;
|
27
29
|
get appAttributes(): import("./index").AppSyncAttributes;
|
28
30
|
getFullScenePath(): string | undefined;
|
31
|
+
private getFullScenePathFromScenes;
|
29
32
|
setFullPath(path: string): void;
|
30
|
-
baseInsertApp(skipUpdate?: boolean
|
33
|
+
baseInsertApp(skipUpdate?: boolean): Promise<{
|
31
34
|
appId: string;
|
32
35
|
app: NetlessApp;
|
33
36
|
}>;
|
@@ -39,7 +42,6 @@ export declare class AppProxy extends Base {
|
|
39
42
|
private afterSetupApp;
|
40
43
|
onSeek(time: number): void;
|
41
44
|
onReconnected(): Promise<void>;
|
42
|
-
switchToWritable(): void;
|
43
45
|
getAppInitState: (id: string) => AppInitState | undefined;
|
44
46
|
emitAppSceneStateChange(sceneState: SceneState): void;
|
45
47
|
emitAppIsWritableChange(): void;
|
@@ -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/Context.d.ts
CHANGED
@@ -8,6 +8,5 @@ export declare class Context {
|
|
8
8
|
findMemberByUid: (uid: string) => import("white-web-sdk").RoomMember | undefined;
|
9
9
|
updateManagerRect(): void;
|
10
10
|
blurFocusBox(): void;
|
11
|
-
switchAppToWriter(id: string): void;
|
12
11
|
}
|
13
12
|
export declare const createContext: (manager: AppManager) => Context;
|
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,35 @@ 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
|
47
|
-
|
58
|
+
constructor(context: BoxManagerContext, createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig | undefined);
|
59
|
+
private playgroundSizeChangeListener;
|
60
|
+
private get mainView();
|
61
|
+
private get canOperate();
|
48
62
|
get boxState(): "normal" | "minimized" | "maximized";
|
49
63
|
get maximized(): boolean;
|
50
64
|
get minimized(): boolean;
|
51
65
|
get darkMode(): boolean;
|
52
66
|
get prefersColorScheme(): TeleBoxColorScheme;
|
67
|
+
get boxSize(): number;
|
53
68
|
createBox(params: CreateBoxParams): void;
|
54
69
|
setBoxInitState(appId: string): void;
|
55
70
|
setupBoxManager(createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig): TeleBoxManager;
|
71
|
+
setCollectorContainer(container: HTMLElement): void;
|
56
72
|
getBox(appId: string): ReadonlyTeleBox | undefined;
|
57
73
|
closeBox(appId: string, skipUpdate?: boolean): ReadonlyTeleBox | undefined;
|
58
74
|
boxIsFocus(appId: string): boolean | undefined;
|
@@ -72,5 +88,6 @@ export declare class BoxManager {
|
|
72
88
|
focusTopBox(): void;
|
73
89
|
setReadonly(readonly: boolean): void;
|
74
90
|
setPrefersColorScheme(colorScheme: TeleBoxColorScheme): void;
|
91
|
+
setZIndex(id: string, zIndex: number, skipUpdate?: boolean): void;
|
75
92
|
destroy(): void;
|
76
93
|
}
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { EmitterType } from "./index";
|
2
|
+
export declare class ContainerResizeObserver {
|
3
|
+
private emitter;
|
4
|
+
private containerResizeObserver?;
|
5
|
+
constructor(emitter: EmitterType);
|
6
|
+
static create(container: HTMLElement, sizer: HTMLElement, wrapper: HTMLDivElement, emitter: EmitterType): ContainerResizeObserver;
|
7
|
+
observePlaygroundSize(container: HTMLElement, sizer: HTMLElement, wrapper: HTMLDivElement): void;
|
8
|
+
private updateSizer;
|
9
|
+
disconnect(): void;
|
10
|
+
}
|
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/Helper.d.ts
ADDED
@@ -1,16 +1,22 @@
|
|
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
|
}
|