@netless/window-manager 1.0.0-canary.5 → 1.0.0-canary.50
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/README.md +30 -6
- package/dist/index.cjs.js +12477 -34
- package/dist/index.es.js +6839 -10495
- package/dist/index.umd.js +12485 -46
- package/dist/{App → src/App}/AppContext.d.ts +12 -7
- package/dist/{App → src/App}/AppPageStateImpl.d.ts +0 -0
- package/dist/{App → src/App}/AppProxy.d.ts +29 -11
- package/dist/{App → src/App}/MagixEvent/index.d.ts +0 -0
- package/dist/{App → src/App}/Storage/StorageEvent.d.ts +0 -0
- package/dist/{App → src/App}/Storage/index.d.ts +0 -0
- package/dist/{App → src/App}/Storage/typings.d.ts +0 -0
- package/dist/{App → src/App}/Storage/utils.d.ts +0 -0
- package/dist/src/App/WhiteboardView.d.ts +27 -0
- package/dist/{App → src/App}/index.d.ts +1 -0
- package/dist/src/App/type.d.ts +21 -0
- package/dist/{AppListener.d.ts → src/AppListener.d.ts} +2 -2
- package/dist/{AppManager.d.ts → src/AppManager.d.ts} +6 -5
- package/dist/{AttributesDelegate.d.ts → src/AttributesDelegate.d.ts} +5 -2
- package/dist/{BoxEmitter.d.ts → src/BoxEmitter.d.ts} +0 -0
- package/dist/{BoxManager.d.ts → src/BoxManager.d.ts} +12 -6
- package/dist/{BuiltinApps.d.ts → src/BuiltinApps.d.ts} +3 -0
- package/dist/{Cursor → src/Cursor}/Cursor.d.ts +0 -0
- package/dist/{Cursor → src/Cursor}/icons.d.ts +0 -0
- package/dist/{Cursor → src/Cursor}/index.d.ts +3 -3
- package/dist/{Helper.d.ts → src/Helper.d.ts} +4 -8
- package/dist/{InternalEmitter.d.ts → src/InternalEmitter.d.ts} +3 -4
- package/dist/{Page → src/Page}/PageController.d.ts +2 -1
- package/dist/{Page → src/Page}/index.d.ts +0 -0
- package/dist/{PageState.d.ts → src/PageState.d.ts} +0 -0
- package/dist/{ReconnectRefresher.d.ts → src/ReconnectRefresher.d.ts} +0 -0
- package/dist/{RedoUndo.d.ts → src/RedoUndo.d.ts} +0 -0
- package/dist/{Register → src/Register}/index.d.ts +4 -2
- package/dist/{Register → src/Register}/loader.d.ts +1 -1
- package/dist/src/Register/storage.d.ts +11 -0
- package/dist/{Utils → src/Utils}/AppCreateQueue.d.ts +0 -0
- package/dist/{Utils → src/Utils}/Common.d.ts +0 -0
- package/dist/{Utils → src/Utils}/Reactive.d.ts +0 -0
- package/dist/{Utils → src/Utils}/RoomHacker.d.ts +0 -0
- package/dist/{Utils → src/Utils}/error.d.ts +1 -1
- package/dist/{Utils → src/Utils}/log.d.ts +0 -0
- package/dist/src/View/CameraSynchronizer.d.ts +19 -0
- package/dist/{View → src/View}/MainView.d.ts +18 -7
- package/dist/{View → src/View}/ViewManager.d.ts +0 -0
- package/dist/src/View/ViewSync.d.ts +29 -0
- package/dist/{callback.d.ts → src/callback.d.ts} +10 -1
- package/dist/{constants.d.ts → src/constants.d.ts} +10 -5
- package/dist/src/image.d.ts +19 -0
- package/dist/{index.d.ts → src/index.d.ts} +49 -14
- package/dist/src/shim.d.ts +11 -0
- package/dist/{typings.d.ts → src/typings.d.ts} +12 -3
- package/dist/style.css +795 -1
- package/docs/app-context.md +155 -27
- package/docs/mirgrate-to-1.0.md +68 -0
- package/package.json +23 -19
- package/playwright.config.ts +29 -0
- package/pnpm-lock.yaml +3078 -4412
- package/src/App/AppContext.ts +62 -29
- package/src/App/AppProxy.ts +235 -113
- package/src/App/WhiteboardView.ts +34 -12
- package/src/App/index.ts +1 -0
- package/src/App/type.ts +22 -0
- package/src/AppListener.ts +30 -21
- package/src/AppManager.ts +66 -43
- package/src/AttributesDelegate.ts +6 -3
- package/src/BoxManager.ts +76 -38
- package/src/BuiltinApps.ts +9 -8
- package/src/Cursor/Cursor.ts +7 -3
- package/src/Cursor/index.ts +7 -8
- package/src/Helper.ts +25 -7
- package/src/InternalEmitter.ts +3 -4
- package/src/Page/PageController.ts +2 -1
- package/src/PageState.ts +1 -1
- package/src/ReconnectRefresher.ts +6 -2
- package/src/Register/index.ts +36 -14
- package/src/Register/loader.ts +20 -9
- package/src/Register/storage.ts +26 -5
- package/src/Utils/Common.ts +3 -0
- package/src/Utils/Reactive.ts +27 -26
- package/src/Utils/RoomHacker.ts +3 -0
- package/src/Utils/error.ts +2 -2
- package/src/View/CameraSynchronizer.ts +41 -38
- package/src/View/MainView.ts +116 -75
- package/src/View/ViewSync.ts +123 -6
- package/src/callback.ts +6 -1
- package/src/constants.ts +8 -3
- package/src/index.ts +201 -63
- package/src/style.css +3 -46
- package/src/typings.ts +14 -3
- package/vite.config.js +12 -7
- package/dist/App/AppViewSync.d.ts +0 -11
- package/dist/App/WhiteboardView.d.ts +0 -21
- package/dist/Register/storage.d.ts +0 -8
- package/dist/View/CameraSynchronizer.d.ts +0 -17
- package/dist/View/ViewSync.d.ts +0 -7
- package/src/App/AppViewSync.ts +0 -69
@@ -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
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,18 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
|
|
30
32
|
private store;
|
31
33
|
readonly isAddApp: boolean;
|
32
34
|
readonly isReplay: boolean;
|
33
|
-
|
34
|
-
|
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
|
-
|
41
|
-
|
44
|
+
get now(): number;
|
45
|
+
createWhiteBoardView: (params?: CreateWhiteBoardViewParams | undefined) => WhiteBoardView;
|
46
|
+
private ensurePageSize;
|
42
47
|
getInitScenePath: () => string | undefined;
|
43
48
|
/** Get App writable status. */
|
44
49
|
get isWritable(): boolean;
|
@@ -46,7 +51,7 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
|
|
46
51
|
get box(): ReadonlyTeleBox;
|
47
52
|
get room(): Room | undefined;
|
48
53
|
get members(): Member[];
|
49
|
-
get
|
54
|
+
get currentMember(): Member | undefined;
|
50
55
|
/** @deprecated Use context.storage.setState instead. */
|
51
56
|
setAttributes: (attributes: TAttributes) => void;
|
52
57
|
/** @deprecated Use context.storage.setState instead. */
|
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,
|
7
|
-
import type { SceneState, View, SceneDefinition
|
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
|
-
|
31
|
+
status: "normal" | "destroyed";
|
30
32
|
private stateKey;
|
31
33
|
_pageState: AppPageStateImpl;
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
private
|
36
|
-
|
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) =>
|
75
|
+
getAppInitState: (id: string) => AppState | undefined;
|
63
76
|
emitAppSceneStateChange(sceneState: SceneState): void;
|
64
77
|
emitAppIsWritableChange(): void;
|
65
78
|
private makeAppEventListener;
|
@@ -75,7 +88,12 @@ 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
|
-
|
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;
|
80
98
|
close(): Promise<void>;
|
81
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
|
+
}
|
@@ -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,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";
|
@@ -21,10 +22,11 @@ export declare class AppManager {
|
|
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
|
-
* 插件更新
|
69
|
+
* 插件更新 apps 时的回调
|
69
70
|
*
|
70
|
-
* @param {*}
|
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 {
|
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 =
|
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
|
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 {
|
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?:
|
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;
|
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
|
-
|
19
|
-
|
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
|
-
|
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 {
|
4
|
-
import type {
|
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
|
-
|
33
|
+
memberStateChange: MemberState;
|
35
34
|
};
|
36
35
|
export declare type EmitterType = Emittery<EmitterEvent>;
|
37
36
|
export declare const emitter: EmitterType;
|
@@ -1,7 +1,7 @@
|
|
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;
|
@@ -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
|
File without changes
|
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
|
File without changes
|
File without changes
|
@@ -19,7 +19,7 @@ export declare class BoxNotCreatedError extends Error {
|
|
19
19
|
export declare class InvalidScenePath extends Error {
|
20
20
|
message: string;
|
21
21
|
}
|
22
|
-
export declare class
|
22
|
+
export declare class BoxManagerNotInitializeError extends Error {
|
23
23
|
message: string;
|
24
24
|
}
|
25
25
|
export declare class BindContainerRoomPhaseInvalidError extends Error {
|
File without changes
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import type { TeleBoxRect } from "@netless/telebox-insider";
|
2
|
+
import type { View, Size } 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
|
+
}
|
19
|
+
export declare const computedMinScale: (remoteSize: Size, currentSize: Size) => number;
|
@@ -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
|
-
|
31
|
+
storeCurrentCamera: () => void;
|
32
|
+
storeCurrentSize: () => void;
|
33
|
+
storeCamera: (camera: ICamera) => void;
|
34
|
+
storeSize: (size: ISize) => void;
|
21
35
|
private cameraReaction;
|
22
|
-
|
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,29 @@
|
|
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
|
+
private createSynchronizer;
|
22
|
+
private subscribeView;
|
23
|
+
private subscribeCamera;
|
24
|
+
private subscribeSize;
|
25
|
+
private subscribeStageRect;
|
26
|
+
bindView: (view?: View | undefined) => void;
|
27
|
+
private onCameraUpdatedByDevice;
|
28
|
+
destroy(): void;
|
29
|
+
}
|
@@ -1,8 +1,9 @@
|
|
1
1
|
import Emittery from "emittery";
|
2
|
-
import type { TeleBoxColorScheme, TELE_BOX_STATE } from "@netless/telebox-insider";
|
2
|
+
import type { TeleBoxColorScheme, TeleBoxFullscreen, TELE_BOX_STATE } from "@netless/telebox-insider";
|
3
3
|
import type { CameraState, SceneState, ViewVisionMode } from "white-web-sdk";
|
4
4
|
import type { LoadAppEvent } from "./Register";
|
5
5
|
import type { PageState } from "./Page";
|
6
|
+
import type { ICamera, ISize } from "./AttributesDelegate";
|
6
7
|
export declare type PublicEvent = {
|
7
8
|
mainViewModeChange: ViewVisionMode;
|
8
9
|
boxStateChange: `${TELE_BOX_STATE}`;
|
@@ -19,6 +20,14 @@ export declare type PublicEvent = {
|
|
19
20
|
ready: undefined;
|
20
21
|
sceneStateChange: SceneState;
|
21
22
|
pageStateChange: PageState;
|
23
|
+
appClose: {
|
24
|
+
appId: string;
|
25
|
+
kind: string;
|
26
|
+
error?: Error;
|
27
|
+
};
|
28
|
+
baseCameraChange: ICamera;
|
29
|
+
baseSizeChange: ISize;
|
30
|
+
fullscreenChange: TeleBoxFullscreen;
|
22
31
|
};
|
23
32
|
export declare type CallbacksType = Emittery<PublicEvent>;
|
24
33
|
export declare const callbacks: CallbacksType;
|