@netless/window-manager 0.4.30 → 1.0.0-canary.0
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 +8 -0
- package/dist/App/AppProxy.d.ts +0 -1
- package/dist/AppManager.d.ts +5 -1
- package/dist/BoxEmitter.d.ts +34 -0
- package/dist/BoxManager.d.ts +8 -6
- package/dist/Cursor/index.d.ts +3 -1
- package/dist/Helper.d.ts +0 -2
- package/dist/InternalEmitter.d.ts +2 -19
- package/dist/Utils/AppCreateQueue.d.ts +2 -3
- package/dist/View/CameraSynchronizer.d.ts +17 -0
- package/dist/View/MainView.d.ts +4 -5
- package/dist/index.cjs.js +21 -22
- package/dist/index.d.ts +2 -3
- package/dist/index.es.js +2283 -1898
- package/dist/index.umd.js +21 -22
- package/dist/style.css +1 -1
- package/dist/typings.d.ts +2 -1
- package/docs/api.md +1 -1
- package/docs/app-context.md +127 -36
- package/docs/develop-app.md +1 -1
- package/package.json +5 -4
- package/pnpm-lock.yaml +150 -133
- package/src/App/AppContext.ts +1 -1
- package/src/App/AppProxy.ts +2 -10
- package/src/AppManager.ts +67 -59
- package/src/BoxEmitter.ts +19 -0
- package/src/BoxManager.ts +99 -108
- package/src/Cursor/Cursor.ts +3 -3
- package/src/Cursor/index.ts +13 -7
- package/src/Helper.ts +2 -15
- package/src/InternalEmitter.ts +6 -8
- package/src/Utils/AppCreateQueue.ts +2 -3
- package/src/View/CameraSynchronizer.ts +67 -0
- package/src/View/MainView.ts +45 -53
- package/src/index.ts +33 -57
- package/src/typings.ts +3 -0
- package/vite.config.js +0 -1
- package/dist/ContainerResizeObserver.d.ts +0 -11
- package/dist/ScenePath/index.d.ts +0 -12
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es.js.map +0 -1
- package/dist/index.umd.js.map +0 -1
- package/src/ContainerResizeObserver.ts +0 -73
- package/src/ScenePath/index.ts +0 -47
package/CHANGELOG.md
CHANGED
package/dist/App/AppProxy.d.ts
CHANGED
@@ -44,7 +44,6 @@ export declare class AppProxy implements PageRemoveService {
|
|
44
44
|
get box(): ReadonlyTeleBox | undefined;
|
45
45
|
private setupApp;
|
46
46
|
private fixMobileSize;
|
47
|
-
private afterSetupApp;
|
48
47
|
onSeek(time: number): Promise<void>;
|
49
48
|
onReconnected(): Promise<void>;
|
50
49
|
onRemoveScene(scenePath: string): Promise<void>;
|
package/dist/AppManager.d.ts
CHANGED
@@ -52,6 +52,11 @@ export declare class AppManager {
|
|
52
52
|
get uid(): string;
|
53
53
|
getMainViewSceneDir(): string;
|
54
54
|
private onCreated;
|
55
|
+
private onBoxMove;
|
56
|
+
private onBoxResize;
|
57
|
+
private onBoxFocus;
|
58
|
+
private onBoxClose;
|
59
|
+
private onBoxStateChange;
|
55
60
|
addAppsChangeListener: () => void;
|
56
61
|
addAppCloseListener: () => void;
|
57
62
|
private onMainViewIndexChange;
|
@@ -91,7 +96,6 @@ export declare class AppManager {
|
|
91
96
|
private dispatchSetMainViewScenePath;
|
92
97
|
getAppInitPath(appId: string): string | undefined;
|
93
98
|
safeDispatchMagixEvent(event: string, payload: any): void;
|
94
|
-
private boxEventListener;
|
95
99
|
focusByAttributes(apps: any): void;
|
96
100
|
onReconnected(): Promise<void>;
|
97
101
|
notifyContainerRectUpdate(rect: TeleBoxRect): void;
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import type { TELE_BOX_STATE } from "@netless/telebox-insider";
|
2
|
+
import Emittery from "emittery";
|
3
|
+
export declare type BoxMovePayload = {
|
4
|
+
appId: string;
|
5
|
+
x: number;
|
6
|
+
y: number;
|
7
|
+
};
|
8
|
+
export declare type BoxFocusPayload = {
|
9
|
+
appId: string;
|
10
|
+
};
|
11
|
+
export declare type BoxResizePayload = {
|
12
|
+
appId: string;
|
13
|
+
width: number;
|
14
|
+
height: number;
|
15
|
+
x?: number;
|
16
|
+
y?: number;
|
17
|
+
};
|
18
|
+
export declare type BoxClosePayload = {
|
19
|
+
appId: string;
|
20
|
+
error?: Error;
|
21
|
+
};
|
22
|
+
export declare type BoxStateChangePayload = {
|
23
|
+
appId: string;
|
24
|
+
state: TELE_BOX_STATE;
|
25
|
+
};
|
26
|
+
export declare type BoxEvent = {
|
27
|
+
move: BoxMovePayload;
|
28
|
+
focus: BoxFocusPayload;
|
29
|
+
resize: BoxResizePayload;
|
30
|
+
close: BoxClosePayload;
|
31
|
+
boxStateChange: BoxStateChangePayload;
|
32
|
+
};
|
33
|
+
export declare type BoxEmitterType = Emittery<BoxEvent>;
|
34
|
+
export declare const boxEmitter: BoxEmitterType;
|
package/dist/BoxManager.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import { AppAttributes } from "./constants";
|
2
2
|
import { TELE_BOX_STATE, TeleBoxManager } from "@netless/telebox-insider";
|
3
3
|
import { WindowManager } from "./index";
|
4
|
+
import type { BoxEmitterType } from "./BoxEmitter";
|
4
5
|
import type { AddAppOptions, AppInitState } from "./index";
|
5
6
|
import type { TeleBoxManagerUpdateConfig, ReadonlyTeleBox, TeleBoxColorScheme, TeleBoxRect, TeleBoxConfig } from "@netless/telebox-insider";
|
6
7
|
import type Emittery from "emittery";
|
@@ -8,6 +9,7 @@ import type { NetlessApp } from "./typings";
|
|
8
9
|
import type { View } from "white-web-sdk";
|
9
10
|
import type { CallbacksType } from "./callback";
|
10
11
|
import type { EmitterType } from "./InternalEmitter";
|
12
|
+
import { SideEffectManager } from "side-effect-manager";
|
11
13
|
export { TELE_BOX_STATE };
|
12
14
|
export declare type CreateBoxParams = {
|
13
15
|
appId: string;
|
@@ -41,24 +43,26 @@ export declare type CreateTeleBoxManagerConfig = {
|
|
41
43
|
collectorContainer?: HTMLElement;
|
42
44
|
collectorStyles?: Partial<CSSStyleDeclaration>;
|
43
45
|
prefersColorScheme?: TeleBoxColorScheme;
|
46
|
+
stageRatio?: number;
|
44
47
|
};
|
45
48
|
export declare type BoxManagerContext = {
|
46
49
|
safeSetAttributes: (attributes: any) => void;
|
47
50
|
getMainView: () => View;
|
48
51
|
updateAppState: (appId: string, field: AppAttributes, value: any) => void;
|
49
52
|
emitter: EmitterType;
|
53
|
+
boxEmitter: BoxEmitterType;
|
50
54
|
callbacks: CallbacksType;
|
51
55
|
canOperate: () => boolean;
|
52
56
|
notifyContainerRectUpdate: (rect: TeleBoxRect) => void;
|
53
57
|
cleanFocus: () => void;
|
54
58
|
setAppFocus: (appId: string) => void;
|
55
59
|
};
|
56
|
-
export declare const createBoxManager: (manager: WindowManager, callbacks: CallbacksType, emitter: EmitterType, options: CreateTeleBoxManagerConfig) => BoxManager;
|
60
|
+
export declare const createBoxManager: (manager: WindowManager, callbacks: CallbacksType, emitter: EmitterType, boxEmitter: BoxEmitterType, options: CreateTeleBoxManagerConfig) => BoxManager;
|
57
61
|
export declare class BoxManager {
|
58
62
|
private context;
|
59
|
-
private createTeleBoxManagerConfig?;
|
60
63
|
teleBoxManager: TeleBoxManager;
|
61
|
-
|
64
|
+
protected sideEffectManager: SideEffectManager;
|
65
|
+
constructor(context: BoxManagerContext, createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig);
|
62
66
|
private get mainView();
|
63
67
|
private get canOperate();
|
64
68
|
get boxState(): "normal" | "minimized" | "maximized";
|
@@ -68,16 +72,13 @@ export declare class BoxManager {
|
|
68
72
|
get prefersColorScheme(): TeleBoxColorScheme;
|
69
73
|
get boxSize(): number;
|
70
74
|
createBox(params: CreateBoxParams): void;
|
71
|
-
setBoxInitState(appId: string): void;
|
72
75
|
setupBoxManager(createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig): TeleBoxManager;
|
73
|
-
setCollectorContainer(container: HTMLElement): void;
|
74
76
|
getBox(appId: string): ReadonlyTeleBox | undefined;
|
75
77
|
closeBox(appId: string, skipUpdate?: boolean): ReadonlyTeleBox | undefined;
|
76
78
|
boxIsFocus(appId: string): boolean | undefined;
|
77
79
|
getFocusBox(): ReadonlyTeleBox | undefined;
|
78
80
|
getTopBox(): ReadonlyTeleBox | undefined;
|
79
81
|
updateBoxState(state?: AppInitState): void;
|
80
|
-
updateManagerRect(): void;
|
81
82
|
moveBox({ appId, x, y }: MoveBoxParams): void;
|
82
83
|
focusBox({ appId }: AppId, skipUpdate?: boolean): void;
|
83
84
|
resizeBox({ appId, width, height, skipUpdate }: ResizeBoxParams): void;
|
@@ -92,5 +93,6 @@ export declare class BoxManager {
|
|
92
93
|
setReadonly(readonly: boolean): void;
|
93
94
|
setPrefersColorScheme(colorScheme: TeleBoxColorScheme): void;
|
94
95
|
setZIndex(id: string, zIndex: number, skipUpdate?: boolean): void;
|
96
|
+
setRoot(root: HTMLElement): void;
|
95
97
|
destroy(): void;
|
96
98
|
}
|
package/dist/Cursor/index.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import { Cursor } from "./Cursor";
|
2
|
+
import type { ApplianceIcons } from "../index";
|
2
3
|
import type { PositionType } from "../AttributesDelegate";
|
3
4
|
import type { RoomMember, View } from "white-web-sdk";
|
4
5
|
import type { AppManager } from "../AppManager";
|
@@ -21,7 +22,8 @@ export declare class CursorManager {
|
|
21
22
|
private mainViewElement?;
|
22
23
|
private sideEffectManager;
|
23
24
|
private store;
|
24
|
-
|
25
|
+
applianceIcons: ApplianceIcons;
|
26
|
+
constructor(manager: AppManager, enableCursor: boolean, applianceIcons?: ApplianceIcons);
|
25
27
|
private onCursorMove;
|
26
28
|
private initCursorInstance;
|
27
29
|
private canMoveCursor;
|
package/dist/Helper.d.ts
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
import type { Room } from "white-web-sdk";
|
2
2
|
export declare const setupWrapper: (root: HTMLElement) => {
|
3
3
|
playground: HTMLDivElement;
|
4
|
-
wrapper: HTMLDivElement;
|
5
|
-
sizer: HTMLDivElement;
|
6
4
|
mainViewElement: HTMLDivElement;
|
7
5
|
};
|
8
6
|
export declare const checkVersion: () => void;
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import Emittery from "emittery";
|
2
|
+
import type { TeleBoxRect } from "@netless/telebox-insider";
|
2
3
|
import type { AppInitState, CursorMovePayload } from "./index";
|
3
4
|
export declare type RemoveSceneParams = {
|
4
5
|
scenePath: string;
|
@@ -7,31 +8,13 @@ export declare type RemoveSceneParams = {
|
|
7
8
|
export declare type EmitterEvent = {
|
8
9
|
onCreated: undefined;
|
9
10
|
InitReplay: AppInitState;
|
10
|
-
move: {
|
11
|
-
appId: string;
|
12
|
-
x: number;
|
13
|
-
y: number;
|
14
|
-
};
|
15
|
-
focus: {
|
16
|
-
appId: string;
|
17
|
-
};
|
18
|
-
close: {
|
19
|
-
appId: string;
|
20
|
-
};
|
21
|
-
resize: {
|
22
|
-
appId: string;
|
23
|
-
width: number;
|
24
|
-
height: number;
|
25
|
-
x?: number;
|
26
|
-
y?: number;
|
27
|
-
};
|
28
11
|
error: Error;
|
29
12
|
seekStart: undefined;
|
30
13
|
seek: number;
|
31
14
|
mainViewMounted: undefined;
|
32
15
|
observerIdChange: number;
|
33
16
|
boxStateChange: string;
|
34
|
-
playgroundSizeChange:
|
17
|
+
playgroundSizeChange: TeleBoxRect;
|
35
18
|
startReconnect: undefined;
|
36
19
|
onReconnected: undefined;
|
37
20
|
removeScenes: RemoveSceneParams;
|
@@ -1,12 +1,11 @@
|
|
1
|
-
|
2
|
-
export declare type Invoker = () => Promise<AppProxy | undefined>;
|
1
|
+
export declare type Invoker<T = any> = () => Promise<T | undefined>;
|
3
2
|
export declare class AppCreateQueue {
|
4
3
|
private list;
|
5
4
|
private currentInvoker;
|
6
5
|
private timer;
|
7
6
|
isEmit: boolean;
|
8
7
|
private initInterval;
|
9
|
-
push(item: Invoker): void;
|
8
|
+
push<T>(item: Invoker<T>): void;
|
10
9
|
invoke(): void;
|
11
10
|
private invoked;
|
12
11
|
private clear;
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import type { TeleBoxRect } from "@netless/telebox-insider";
|
2
|
+
import type { Camera, View, Size } from "white-web-sdk";
|
3
|
+
import type { MainViewSize } from "../AttributesDelegate";
|
4
|
+
export declare type SaveCamera = (camera: Camera) => void;
|
5
|
+
export declare class CameraSynchronizer {
|
6
|
+
protected saveCamera: SaveCamera;
|
7
|
+
protected remoteCamera?: Camera;
|
8
|
+
protected remoteSize?: MainViewSize;
|
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: Camera, size: MainViewSize) => void>;
|
15
|
+
onLocalCameraUpdate(camera: Camera): void;
|
16
|
+
onLocalSizeUpdate(size: Size): void;
|
17
|
+
}
|
package/dist/View/MainView.d.ts
CHANGED
@@ -1,12 +1,12 @@
|
|
1
|
-
import type {
|
1
|
+
import type { Size, View } from "white-web-sdk";
|
2
2
|
import type { AppManager } from "../AppManager";
|
3
3
|
export declare class MainViewProxy {
|
4
4
|
private manager;
|
5
|
-
private scale?;
|
6
5
|
private started;
|
7
6
|
private mainViewIsAddListener;
|
8
7
|
private mainView;
|
9
8
|
private store;
|
9
|
+
private synchronizer;
|
10
10
|
private sideEffectManager;
|
11
11
|
constructor(manager: AppManager);
|
12
12
|
private startListenWritableChange;
|
@@ -34,16 +34,15 @@ export declare class MainViewProxy {
|
|
34
34
|
setFocusScenePath(path: string | undefined): View | undefined;
|
35
35
|
rebind(): void;
|
36
36
|
private onCameraUpdatedByDevice;
|
37
|
+
private getStageSize;
|
37
38
|
addMainViewListener(): void;
|
38
39
|
removeMainViewListener(): void;
|
39
40
|
private mainViewClickListener;
|
40
41
|
mainViewClickHandler(): Promise<void>;
|
41
|
-
setMainViewSize: import("lodash").DebouncedFunc<(size:
|
42
|
+
setMainViewSize: import("lodash").DebouncedFunc<(size: Size) => void>;
|
42
43
|
private addCameraListener;
|
43
44
|
private removeCameraListener;
|
44
45
|
private onCameraOrSizeUpdated;
|
45
|
-
moveCameraToContian(size: Size): void;
|
46
|
-
moveCamera(camera: Camera): void;
|
47
46
|
stop(): void;
|
48
47
|
destroy(): void;
|
49
48
|
}
|