@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
@@ -1,11 +0,0 @@
|
|
1
|
-
import type { View } from "white-web-sdk";
|
2
|
-
import type { AppProxy } from "./AppProxy";
|
3
|
-
export declare class AppViewSync {
|
4
|
-
private appProxy;
|
5
|
-
private sem;
|
6
|
-
private synchronizer;
|
7
|
-
constructor(appProxy: AppProxy);
|
8
|
-
bindView: (view?: View | undefined) => void;
|
9
|
-
private onCameraUpdatedByDevice;
|
10
|
-
destroy(): void;
|
11
|
-
}
|
@@ -1,21 +0,0 @@
|
|
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 { Camera } from "white-web-sdk";
|
6
|
-
export declare class WhiteBoardView implements PageController {
|
7
|
-
protected appContext: AppContext;
|
8
|
-
protected appProxy: AppProxy;
|
9
|
-
private removeViewWrapper;
|
10
|
-
readonly pageState$: ReadonlyVal<PageState>;
|
11
|
-
constructor(appContext: AppContext, appProxy: AppProxy, removeViewWrapper: () => void);
|
12
|
-
get view(): import("white-web-sdk").View | undefined;
|
13
|
-
get pageState(): PageState;
|
14
|
-
moveCamera(camera: Camera): void;
|
15
|
-
nextPage: () => Promise<boolean>;
|
16
|
-
prevPage: () => Promise<boolean>;
|
17
|
-
jumpPage: (index: number) => Promise<boolean>;
|
18
|
-
addPage: (params?: AddPageParams | undefined) => Promise<void>;
|
19
|
-
removePage: (index?: number | undefined) => Promise<boolean>;
|
20
|
-
destroy(): void;
|
21
|
-
}
|
@@ -1,8 +0,0 @@
|
|
1
|
-
export declare type Item = {
|
2
|
-
kind: string;
|
3
|
-
sourceCode: string;
|
4
|
-
};
|
5
|
-
export declare const initDb: () => Promise<void>;
|
6
|
-
export declare const setItem: (key: string, val: any) => Promise<void> | undefined;
|
7
|
-
export declare const getItem: (key: string) => Promise<Item | null>;
|
8
|
-
export declare const removeItem: (key: string) => Promise<void> | undefined;
|
@@ -1,17 +0,0 @@
|
|
1
|
-
import type { TeleBoxRect } from "@netless/telebox-insider";
|
2
|
-
import type { Camera, View, Size } from "white-web-sdk";
|
3
|
-
import type { ISize } 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?: 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: Camera, size: ISize) => void>;
|
15
|
-
onLocalCameraUpdate(camera: Camera): void;
|
16
|
-
onLocalSizeUpdate: (size: Size) => void;
|
17
|
-
}
|
package/dist/View/ViewSync.d.ts
DELETED
package/src/App/AppViewSync.ts
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
import { CameraSynchronizer } from "../View/CameraSynchronizer";
|
2
|
-
import { SideEffectManager } from "side-effect-manager";
|
3
|
-
import type { Camera, View } from "white-web-sdk";
|
4
|
-
import type { AppProxy } from "./AppProxy";
|
5
|
-
import { isEqual } from "lodash";
|
6
|
-
|
7
|
-
export class AppViewSync {
|
8
|
-
private sem = new SideEffectManager();
|
9
|
-
private synchronizer: CameraSynchronizer;
|
10
|
-
|
11
|
-
constructor(private appProxy: AppProxy) {
|
12
|
-
this.synchronizer = new CameraSynchronizer((camera: Camera) => {
|
13
|
-
this.appProxy.storeCamera({
|
14
|
-
id: this.appProxy.uid,
|
15
|
-
...camera,
|
16
|
-
});
|
17
|
-
});
|
18
|
-
this.bindView(appProxy.view);
|
19
|
-
this.sem.add(() => this.appProxy.camera$.subscribe(camera => {
|
20
|
-
const size = this.appProxy.size$.value;
|
21
|
-
if (camera && size) {
|
22
|
-
this.synchronizer.onRemoteUpdate(camera, size);
|
23
|
-
}
|
24
|
-
}));
|
25
|
-
const box = this.appProxy.box;
|
26
|
-
if (box && box.contentStageRect) {
|
27
|
-
this.synchronizer.setRect(box.contentStageRect);
|
28
|
-
this.sem.add(() =>
|
29
|
-
box._contentStageRect$.subscribe(rect => {
|
30
|
-
if (rect) {
|
31
|
-
this.synchronizer.setRect(rect);
|
32
|
-
}
|
33
|
-
}),
|
34
|
-
);
|
35
|
-
if (!this.appProxy.size$.value) {
|
36
|
-
this.appProxy.storeSize({
|
37
|
-
id: this.appProxy.uid,
|
38
|
-
width: box.contentStageRect.width,
|
39
|
-
height: box.contentStageRect.height,
|
40
|
-
});
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
|
-
public bindView = (view?: View) => {
|
46
|
-
if (!view) return;
|
47
|
-
this.synchronizer.setView(view);
|
48
|
-
this.sem.add(() => {
|
49
|
-
view.callbacks.on("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
|
50
|
-
return () =>
|
51
|
-
view.callbacks.off("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
|
52
|
-
});
|
53
|
-
};
|
54
|
-
|
55
|
-
private onCameraUpdatedByDevice = (camera: Camera) => {
|
56
|
-
this.synchronizer.onLocalCameraUpdate(camera);
|
57
|
-
const stage = this.appProxy.box?.contentStageRect;
|
58
|
-
if (stage) {
|
59
|
-
const size = { width: stage.width, height: stage.height, id: this.appProxy.uid };
|
60
|
-
if (!isEqual(size, this.appProxy.size$.value)) {
|
61
|
-
this.appProxy.storeSize(size);
|
62
|
-
}
|
63
|
-
}
|
64
|
-
};
|
65
|
-
|
66
|
-
public destroy() {
|
67
|
-
this.sem.flushAll();
|
68
|
-
}
|
69
|
-
}
|