@netless/window-manager 1.0.0-canary.4 → 1.0.0-canary.40
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/dist/index.cjs.js +115 -34
- package/dist/index.es.js +7269 -9721
- package/dist/index.umd.js +115 -34
- 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 +1 -0
- 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 +0 -0
- package/dist/{Register → src/Register}/loader.d.ts +0 -0
- package/dist/{Register → src/Register}/storage.d.ts +0 -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 +24 -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} +44 -13
- package/dist/src/shim.d.ts +11 -0
- package/dist/{typings.d.ts → src/typings.d.ts} +8 -2
- package/dist/style.css +1 -1
- package/docs/app-context.md +155 -27
- package/docs/mirgrate-to-1.0.md +39 -0
- package/package.json +23 -19
- package/playwright.config.ts +29 -0
- package/pnpm-lock.yaml +3078 -4412
- package/src/App/AppContext.ts +60 -28
- 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 +65 -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 +1 -0
- package/src/PageState.ts +1 -1
- package/src/ReconnectRefresher.ts +6 -2
- 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 -39
- package/src/View/MainView.ts +116 -75
- package/src/View/ViewSync.ts +103 -6
- package/src/callback.ts +6 -1
- package/src/constants.ts +8 -3
- package/src/index.ts +173 -58
- package/src/style.css +3 -46
- package/src/typings.ts +8 -2
- package/vite.config.js +8 -4
- package/dist/App/AppViewSync.d.ts +0 -11
- package/dist/App/WhiteboardView.d.ts +0 -21
- package/dist/View/CameraSynchronizer.d.ts +0 -17
- package/dist/View/ViewSync.d.ts +0 -7
- package/src/App/AppViewSync.ts +0 -69
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
|
-
}
|