@netless/window-manager 1.0.0-canary.5 → 1.0.0-canary.52

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.
Files changed (95) hide show
  1. package/README.md +30 -6
  2. package/dist/index.cjs.js +12477 -34
  3. package/dist/index.es.js +6842 -10498
  4. package/dist/index.umd.js +12485 -46
  5. package/dist/{App → src/App}/AppContext.d.ts +12 -7
  6. package/dist/{App → src/App}/AppPageStateImpl.d.ts +0 -0
  7. package/dist/{App → src/App}/AppProxy.d.ts +29 -11
  8. package/dist/{App → src/App}/MagixEvent/index.d.ts +0 -0
  9. package/dist/{App → src/App}/Storage/StorageEvent.d.ts +0 -0
  10. package/dist/{App → src/App}/Storage/index.d.ts +0 -0
  11. package/dist/{App → src/App}/Storage/typings.d.ts +0 -0
  12. package/dist/{App → src/App}/Storage/utils.d.ts +0 -0
  13. package/dist/src/App/WhiteboardView.d.ts +27 -0
  14. package/dist/{App → src/App}/index.d.ts +1 -0
  15. package/dist/src/App/type.d.ts +21 -0
  16. package/dist/{AppListener.d.ts → src/AppListener.d.ts} +2 -2
  17. package/dist/{AppManager.d.ts → src/AppManager.d.ts} +6 -5
  18. package/dist/{AttributesDelegate.d.ts → src/AttributesDelegate.d.ts} +5 -2
  19. package/dist/{BoxEmitter.d.ts → src/BoxEmitter.d.ts} +0 -0
  20. package/dist/{BoxManager.d.ts → src/BoxManager.d.ts} +12 -6
  21. package/dist/{BuiltinApps.d.ts → src/BuiltinApps.d.ts} +3 -0
  22. package/dist/{Cursor → src/Cursor}/Cursor.d.ts +0 -0
  23. package/dist/{Cursor → src/Cursor}/icons.d.ts +0 -0
  24. package/dist/{Cursor → src/Cursor}/index.d.ts +3 -3
  25. package/dist/{Helper.d.ts → src/Helper.d.ts} +4 -8
  26. package/dist/{InternalEmitter.d.ts → src/InternalEmitter.d.ts} +3 -4
  27. package/dist/{Page → src/Page}/PageController.d.ts +2 -1
  28. package/dist/{Page → src/Page}/index.d.ts +0 -0
  29. package/dist/{PageState.d.ts → src/PageState.d.ts} +0 -0
  30. package/dist/{ReconnectRefresher.d.ts → src/ReconnectRefresher.d.ts} +0 -0
  31. package/dist/{RedoUndo.d.ts → src/RedoUndo.d.ts} +0 -0
  32. package/dist/{Register → src/Register}/index.d.ts +4 -2
  33. package/dist/{Register → src/Register}/loader.d.ts +1 -1
  34. package/dist/src/Register/storage.d.ts +11 -0
  35. package/dist/{Utils → src/Utils}/AppCreateQueue.d.ts +0 -0
  36. package/dist/{Utils → src/Utils}/Common.d.ts +0 -0
  37. package/dist/{Utils → src/Utils}/Reactive.d.ts +0 -0
  38. package/dist/{Utils → src/Utils}/RoomHacker.d.ts +0 -0
  39. package/dist/{Utils → src/Utils}/error.d.ts +1 -1
  40. package/dist/{Utils → src/Utils}/log.d.ts +0 -0
  41. package/dist/src/View/CameraSynchronizer.d.ts +19 -0
  42. package/dist/{View → src/View}/MainView.d.ts +18 -7
  43. package/dist/{View → src/View}/ViewManager.d.ts +0 -0
  44. package/dist/src/View/ViewSync.d.ts +29 -0
  45. package/dist/{callback.d.ts → src/callback.d.ts} +10 -1
  46. package/dist/{constants.d.ts → src/constants.d.ts} +10 -5
  47. package/dist/src/image.d.ts +19 -0
  48. package/dist/{index.d.ts → src/index.d.ts} +49 -14
  49. package/dist/src/shim.d.ts +11 -0
  50. package/dist/{typings.d.ts → src/typings.d.ts} +12 -3
  51. package/dist/style.css +795 -1
  52. package/docs/app-context.md +155 -27
  53. package/docs/mirgrate-to-1.0.md +68 -0
  54. package/package.json +23 -19
  55. package/playwright.config.ts +29 -0
  56. package/pnpm-lock.yaml +3078 -4412
  57. package/src/App/AppContext.ts +62 -29
  58. package/src/App/AppProxy.ts +235 -113
  59. package/src/App/WhiteboardView.ts +34 -12
  60. package/src/App/index.ts +1 -0
  61. package/src/App/type.ts +22 -0
  62. package/src/AppListener.ts +30 -21
  63. package/src/AppManager.ts +68 -45
  64. package/src/AttributesDelegate.ts +6 -3
  65. package/src/BoxManager.ts +76 -38
  66. package/src/BuiltinApps.ts +9 -8
  67. package/src/Cursor/Cursor.ts +7 -3
  68. package/src/Cursor/index.ts +7 -8
  69. package/src/Helper.ts +25 -7
  70. package/src/InternalEmitter.ts +3 -4
  71. package/src/Page/PageController.ts +2 -1
  72. package/src/PageState.ts +1 -1
  73. package/src/ReconnectRefresher.ts +6 -2
  74. package/src/Register/index.ts +36 -14
  75. package/src/Register/loader.ts +20 -9
  76. package/src/Register/storage.ts +26 -5
  77. package/src/Utils/Common.ts +3 -0
  78. package/src/Utils/Reactive.ts +27 -26
  79. package/src/Utils/RoomHacker.ts +3 -0
  80. package/src/Utils/error.ts +2 -2
  81. package/src/View/CameraSynchronizer.ts +41 -38
  82. package/src/View/MainView.ts +117 -76
  83. package/src/View/ViewSync.ts +123 -6
  84. package/src/callback.ts +6 -1
  85. package/src/constants.ts +8 -3
  86. package/src/index.ts +201 -63
  87. package/src/style.css +3 -46
  88. package/src/typings.ts +14 -3
  89. package/vite.config.js +12 -7
  90. package/dist/App/AppViewSync.d.ts +0 -11
  91. package/dist/App/WhiteboardView.d.ts +0 -21
  92. package/dist/Register/storage.d.ts +0 -8
  93. package/dist/View/CameraSynchronizer.d.ts +0 -17
  94. package/dist/View/ViewSync.d.ts +0 -7
  95. package/src/App/AppViewSync.ts +0 -69
@@ -1,14 +1,16 @@
1
1
  import { callbacks } from "../callback";
2
- import { CameraSynchronizer } from "./CameraSynchronizer";
3
2
  import { createView } from "./ViewManager";
4
3
  import { debounce, get, isEqual } from "lodash";
5
4
  import { emitter } from "../InternalEmitter";
6
5
  import { Events } from "../constants";
7
6
  import { Fields } from "../AttributesDelegate";
8
- import { reaction } from "white-web-sdk";
9
- import { releaseView, setViewFocusScenePath } from "../Utils/Common";
7
+ import { AnimationMode, reaction, toJS } from "white-web-sdk";
8
+ import { releaseView, setScenePath, setViewFocusScenePath } from "../Utils/Common";
10
9
  import { SideEffectManager } from "side-effect-manager";
11
- import type { Camera, Size, View } from "white-web-sdk";
10
+ import { Val } from "value-enhancer";
11
+ import { ViewSync } from "./ViewSync";
12
+ import type { ICamera, ISize } from "../AttributesDelegate";
13
+ import type { Size, View } from "white-web-sdk";
12
14
  import type { AppManager } from "../AppManager";
13
15
 
14
16
  export class MainViewProxy {
@@ -16,56 +18,89 @@ export class MainViewProxy {
16
18
  private mainViewIsAddListener = false;
17
19
  private mainView: View;
18
20
  private store = this.manager.store;
19
- private synchronizer: CameraSynchronizer;
20
21
 
21
22
  private sideEffectManager = new SideEffectManager();
22
23
 
24
+ public camera$ = new Val<ICamera | undefined>(undefined);
25
+ public size$ = new Val<ISize | undefined>(undefined);
26
+ public view$ = new Val<View | undefined>(undefined);
27
+
28
+ public viewSync?: ViewSync;
29
+
23
30
  constructor(private manager: AppManager) {
24
- this.synchronizer = new CameraSynchronizer(camera =>
25
- this.store.setMainViewCamera({ ...camera, id: this.manager.uid })
26
- );
27
31
  this.mainView = this.createMainView();
28
- this.moveCameraSizeByAttributes();
29
32
  emitter.once("mainViewMounted").then(() => {
30
33
  this.addMainViewListener();
31
34
  this.start();
32
35
  this.ensureCameraAndSize();
33
36
  this.startListenWritableChange();
34
37
  });
35
- this.sideEffectManager.add(() => {
36
- return emitter.on("containerSizeRatioUpdate", this.onUpdateContainerSizeRatio);
37
- });
38
- this.sideEffectManager.add(() => {
39
- return emitter.on("startReconnect", () => {
38
+ this.sideEffectManager.add(() => [
39
+ emitter.on("startReconnect", () => {
40
40
  releaseView(this.mainView);
41
- });
41
+ }),
42
+ ]);
43
+ this.createViewSync();
44
+ this.sideEffectManager.add(() => emitter.on("focusedChange", ({ focused }) => {
45
+ if (focused === undefined) {
46
+ const scenePath = this.store.getMainViewScenePath();
47
+ if (scenePath) {
48
+ setScenePath(this.manager.room, scenePath);
49
+ }
50
+ }
51
+ }));
52
+ this.camera$.reaction(camera => {
53
+ if (camera) {
54
+ callbacks.emit("baseCameraChange", camera);
55
+ }
42
56
  });
43
- const rect = this.manager.boxManager?.stageRect;
44
- if (rect) {
45
- this.synchronizer.setRect(rect);
46
- }
47
- this.sideEffectManager.add(() => {
48
- return emitter.on("playgroundSizeChange", rect => {
49
- this.synchronizer.setRect(rect);
50
- // this.synchronizer.onLocalSizeUpdate(rect);
51
- });
57
+ this.size$.reaction(size => {
58
+ if (size) {
59
+ callbacks.emit("baseSizeChange", size);
60
+ }
52
61
  });
53
62
  }
54
63
 
64
+ public createViewSync = () => {
65
+ if (this.manager.boxManager && !this.viewSync) {
66
+ this.viewSync = new ViewSync({
67
+ uid: this.manager.uid,
68
+ view$: this.view$,
69
+ camera$: this.camera$,
70
+ size$: this.size$,
71
+ stageRect$: this.manager.boxManager?.stageRect$,
72
+ viewMode$: this.manager.windowManger.viewMode$,
73
+ storeCamera: this.storeCamera,
74
+ storeSize: this.storeSize,
75
+ });
76
+ }
77
+ };
78
+
55
79
  private startListenWritableChange = () => {
56
- this.sideEffectManager.add(() => {
57
- return emitter.on("writableChange", isWritable => {
80
+ this.sideEffectManager.add(() =>
81
+ emitter.on("writableChange", isWritable => {
58
82
  if (isWritable) {
59
83
  this.ensureCameraAndSize();
60
84
  }
61
- });
62
- });
85
+ })
86
+ );
63
87
  };
64
88
 
65
89
  public ensureCameraAndSize() {
66
90
  if (!this.mainViewCamera || !this.mainViewSize) {
67
91
  this.manager.dispatchInternalEvent(Events.InitMainViewCamera);
68
- this.setCameraAndSize();
92
+ this.storeCamera({
93
+ id: this.manager.uid,
94
+ ...this.view.camera
95
+ });
96
+ const stageRect = this.manager.boxManager?.stageRect;
97
+ if (stageRect && !this.mainViewSize) {
98
+ this.storeSize({
99
+ id: this.manager.uid,
100
+ width: stageRect.width,
101
+ height: stageRect.height
102
+ });
103
+ }
69
104
  }
70
105
  }
71
106
 
@@ -81,55 +116,74 @@ export class MainViewProxy {
81
116
  return get(this.view, ["didRelease"]);
82
117
  }
83
118
 
84
- private moveCameraSizeByAttributes() {
85
- this.synchronizer.onRemoteUpdate(this.mainViewCamera, this.mainViewSize);
86
- }
87
-
88
119
  public start() {
89
120
  if (this.started) return;
90
- this.sizeChangeHandler(this.mainViewSize);
121
+ this.removeCameraListener();
91
122
  this.addCameraListener();
92
123
  this.addCameraReaction();
93
124
  this.started = true;
94
125
  }
95
126
 
96
127
  public addCameraReaction = () => {
97
- this.manager.refresher?.add(Fields.MainViewCamera, this.cameraReaction);
128
+ this.manager.refresher.add(Fields.MainViewCamera, this.cameraReaction);
129
+ this.manager.refresher.add(Fields.MainViewSize, this.sizeReaction);
98
130
  };
99
131
 
100
- public setCameraAndSize(): void {
101
- const stageSize = this.getStageSize();
102
- if (stageSize) {
103
- const camera = { ...this.mainView.camera, id: this.manager.uid };
104
- const size = { ...stageSize, id: this.manager.uid };
105
- this.store.setMainViewCameraAndSize(camera, size);
132
+ public storeCurrentCamera = () => {
133
+ const iCamera = this.view.camera;
134
+ this.storeCamera({
135
+ id: this.manager.uid,
136
+ ...iCamera
137
+ });
138
+ }
139
+
140
+ public storeCurrentSize = () => {
141
+ const rect = this.manager.boxManager?.stageRect;
142
+ if (rect) {
143
+ this.storeSize({
144
+ id: this.manager.uid,
145
+ width: rect.width,
146
+ height: rect.height
147
+ });
106
148
  }
107
149
  }
108
150
 
151
+ public storeCamera = (camera: ICamera) => {
152
+ this.store.setMainViewCamera(camera);
153
+ };
154
+
155
+ public storeSize = (size: ISize) => {
156
+ this.store.setMainViewSize(size);
157
+ };
158
+
109
159
  private cameraReaction = () => {
110
160
  return reaction(
111
161
  () => this.mainViewCamera,
112
162
  camera => {
113
- if (camera && camera.id !== this.manager.uid) {
114
- this.synchronizer.onRemoteUpdate(camera, this.mainViewSize);
163
+ if (camera) {
164
+ const rawCamera = toJS(camera);
165
+ if (!isEqual(rawCamera, this.camera$.value)) {
166
+ this.camera$.setValue(rawCamera);
167
+ }
115
168
  }
116
169
  },
117
170
  { fireImmediately: true }
118
171
  );
119
172
  };
120
173
 
121
- public sizeChangeHandler = debounce((size: Size) => {
122
- if (size) {
123
- // this.synchronizer.onLocalSizeUpdate(size);
124
- }
125
- }, 30);
126
-
127
- public onUpdateContainerSizeRatio = () => {
128
- const size = this.store.getMainViewSize();
129
- this.sizeChangeHandler(size);
130
- if (size.id === this.manager.uid) {
131
- this.setCameraAndSize();
132
- }
174
+ private sizeReaction = () => {
175
+ return reaction(
176
+ () => this.mainViewSize,
177
+ size => {
178
+ if (size) {
179
+ const rawSize = toJS(size);
180
+ if (!isEqual(rawSize, this.size$.value)) {
181
+ this.size$.setValue(rawSize);
182
+ }
183
+ }
184
+ },
185
+ { fireImmediately: true }
186
+ );
133
187
  };
134
188
 
135
189
  public get view(): View {
@@ -146,7 +200,7 @@ export class MainViewProxy {
146
200
  if (mainViewScenePath) {
147
201
  setViewFocusScenePath(mainView, mainViewScenePath);
148
202
  }
149
- this.synchronizer.setView(mainView);
203
+ this.view$.setValue(mainView);
150
204
  return mainView;
151
205
  }
152
206
 
@@ -168,31 +222,18 @@ export class MainViewProxy {
168
222
  public rebind(): void {
169
223
  const divElement = this.mainView.divElement;
170
224
  const disableCameraTransform = this.mainView.disableCameraTransform;
225
+ const camera = { ...this.mainView.camera };
171
226
  this.stop();
172
227
  releaseView(this.mainView);
173
228
  this.removeMainViewListener();
174
229
  this.mainView = this.createMainView();
175
230
  this.mainView.disableCameraTransform = disableCameraTransform;
176
231
  this.mainView.divElement = divElement;
232
+ this.mainView.moveCamera({ ...camera, animationMode: AnimationMode.Immediately });
177
233
  this.addMainViewListener();
178
234
  this.start();
179
235
  }
180
236
 
181
- private onCameraUpdatedByDevice = (camera: Camera) => {
182
- this.synchronizer.onLocalCameraUpdate(camera);
183
- const size = this.getStageSize();
184
- if (size && !isEqual(size, this.mainViewSize)) {
185
- this.setMainViewSize(size);
186
- }
187
- };
188
-
189
- private getStageSize(): Size | undefined {
190
- const stage = this.manager.boxManager?.stageRect;
191
- if (stage) {
192
- return { width: stage.width, height: stage.height };
193
- }
194
- }
195
-
196
237
  public addMainViewListener(): void {
197
238
  if (this.mainViewIsAddListener) return;
198
239
  if (this.view.divElement) {
@@ -225,13 +266,11 @@ export class MainViewProxy {
225
266
  }, 50);
226
267
 
227
268
  private addCameraListener() {
228
- this.view.callbacks.on("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
229
269
  this.view.callbacks.on("onCameraUpdated", this.onCameraOrSizeUpdated);
230
270
  this.view.callbacks.on("onSizeUpdated", this.onCameraOrSizeUpdated);
231
271
  }
232
272
 
233
273
  private removeCameraListener() {
234
- this.view.callbacks.off("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
235
274
  this.view.callbacks.off("onCameraUpdated", this.onCameraOrSizeUpdated);
236
275
  this.view.callbacks.off("onSizeUpdated", this.onCameraOrSizeUpdated);
237
276
  }
@@ -241,13 +280,15 @@ export class MainViewProxy {
241
280
  };
242
281
 
243
282
  public stop() {
244
- this.removeCameraListener();
245
- this.manager.refresher?.remove(Fields.MainViewCamera);
246
- this.manager.refresher?.remove(Fields.MainViewSize);
283
+ this.manager.refresher.remove(Fields.MainViewCamera);
284
+ this.manager.refresher.remove(Fields.MainViewSize);
247
285
  this.started = false;
248
286
  }
249
287
 
250
288
  public destroy() {
289
+ this.camera$.destroy();
290
+ this.size$.destroy();
291
+ this.view$.destroy();
251
292
  this.removeMainViewListener();
252
293
  this.stop();
253
294
  this.sideEffectManager.flushAll();
@@ -1,10 +1,127 @@
1
- import type { Camera, Size } from "white-web-sdk";
1
+ import { ViewMode, AnimationMode } from "white-web-sdk";
2
+ import { CameraSynchronizer, computedMinScale } from "./CameraSynchronizer";
3
+ import { combine } from "value-enhancer";
4
+ import { SideEffectManager } from "side-effect-manager";
5
+ import type { Camera, View } from "white-web-sdk";
6
+ import type { Val, ReadonlyVal } from "value-enhancer";
7
+ import type { ICamera, ISize } from "../AttributesDelegate";
8
+ import type { TeleBoxRect } from "@netless/telebox-insider";
2
9
 
10
+ export type ViewSyncContext = {
11
+ uid: string;
12
+ // 远端 camera
13
+ camera$: Val<ICamera | undefined, boolean>;
14
+ // 远端 size
15
+ size$: Val<ISize | undefined>;
3
16
 
4
- export interface ViewSync {
5
- readonly camera: Camera;
6
- readonly size: Size;
17
+ stageRect$: ReadonlyVal<TeleBoxRect>;
7
18
 
8
- setCamera: (camera: Camera) => void;
9
- setSize: (size: Size) => void;
19
+ viewMode$?: Val<ViewMode>;
20
+
21
+ storeCamera: (camera: ICamera) => void;
22
+
23
+ storeSize: (size: ISize) => void;
24
+
25
+ view$: Val<View | undefined>;
26
+ };
27
+
28
+ export class ViewSync {
29
+ private sem = new SideEffectManager();
30
+ private synchronizer: CameraSynchronizer;
31
+
32
+ constructor(private context: ViewSyncContext) {
33
+ this.synchronizer = this.createSynchronizer();
34
+ this.bindView(this.context.view$.value);
35
+ this.sem.add(() => [
36
+ this.subscribeView(),
37
+ this.subscribeCamera(),
38
+ this.subscribeSize(),
39
+ this.subscribeStageRect(),
40
+ ]);
41
+ const camera$size$ = combine([this.context.camera$, this.context.size$]);
42
+ camera$size$.reaction(([camera, size]) => {
43
+ if (camera && size) {
44
+ this.synchronizer.onRemoteUpdate(camera, size);
45
+ camera$size$.destroy();
46
+ }
47
+ });
48
+ }
49
+
50
+ private createSynchronizer = () => {
51
+ return new CameraSynchronizer((camera: ICamera) => {
52
+ this.context.camera$.setValue(camera, true);
53
+ const notStoreCamera =
54
+ this.context.viewMode$ && this.context.viewMode$.value === ViewMode.Freedom;
55
+ if (notStoreCamera) {
56
+ return;
57
+ } else {
58
+ this.context.storeCamera(camera);
59
+ }
60
+ });
61
+ }
62
+
63
+ private subscribeView = () => {
64
+ return this.context.view$.subscribe(view => {
65
+ const currentCamera = this.context.camera$.value;
66
+ if (currentCamera && this.context.size$.value) {
67
+ view?.moveCamera({
68
+ scale: 1,
69
+ animationMode: AnimationMode.Immediately,
70
+ });
71
+ this.synchronizer.onRemoteUpdate(currentCamera, this.context.size$.value);
72
+ }
73
+ this.bindView(view);
74
+ });
75
+ }
76
+
77
+ private subscribeCamera = () => {
78
+ return this.context.camera$.subscribe((camera, skipUpdate) => {
79
+ if (skipUpdate) return;
80
+ const size = this.context.size$.value;
81
+ if (camera && size) {
82
+ this.synchronizer.onRemoteUpdate(camera, size);
83
+ }
84
+ });
85
+ }
86
+
87
+ private subscribeSize = () => {
88
+ return this.context.size$.subscribe(size => {
89
+ if (size) {
90
+ this.synchronizer.onRemoteSizeUpdate(size);
91
+ }
92
+ });
93
+ }
94
+
95
+ private subscribeStageRect = () => {
96
+ return this.context.stageRect$.subscribe(rect => {
97
+ if (rect) {
98
+ this.synchronizer.setRect(rect);
99
+ }
100
+ });
101
+ }
102
+
103
+ public bindView = (view?: View) => {
104
+ if (!view) return;
105
+ this.synchronizer.setView(view);
106
+ this.sem.flush("view");
107
+ this.sem.add(() => {
108
+ view.callbacks.on("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
109
+ return () =>
110
+ view.callbacks.off("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
111
+ }, "view");
112
+ };
113
+
114
+ private onCameraUpdatedByDevice = (camera: Camera) => {
115
+ if (!camera) return;
116
+ if (this.context.size$.value && this.context.stageRect$.value) {
117
+ // 始终以远端的 size 为标准, 设置到 attributes 时根据尺寸的大小还原回去
118
+ const diffScale = computedMinScale(this.context.size$.value, this.context.stageRect$.value);
119
+ const remoteScale = camera.scale / diffScale;
120
+ this.synchronizer.onLocalCameraUpdate({ ...camera, scale: remoteScale, id: this.context.uid });
121
+ }
122
+ };
123
+
124
+ public destroy() {
125
+ this.sem.flushAll();
126
+ }
10
127
  }
package/src/callback.ts CHANGED
@@ -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
 
7
8
  export type PublicEvent = {
8
9
  mainViewModeChange: ViewVisionMode;
@@ -20,6 +21,10 @@ export type PublicEvent = {
20
21
  ready: undefined; // 所有 APP 创建完毕时触发
21
22
  sceneStateChange: SceneState;
22
23
  pageStateChange: PageState;
24
+ appClose: { appId: string; kind: string, error?: Error };
25
+ baseCameraChange: ICamera;
26
+ baseSizeChange: ISize;
27
+ fullscreenChange: TeleBoxFullscreen;
23
28
  };
24
29
 
25
30
  export type CallbacksType = Emittery<PublicEvent>;
package/src/constants.ts CHANGED
@@ -5,18 +5,18 @@ export enum Events {
5
5
  AppBoxStateChange = "AppBoxStateChange",
6
6
  GetAttributes = "GetAttributes",
7
7
  UpdateWindowManagerWrapper = "UpdateWindowManagerWrapper",
8
- InitReplay = "InitReplay",
9
8
  WindowCreated = "WindowCreated",
10
9
  SetMainViewScenePath = "SetMainViewScenePath",
11
10
  SetMainViewSceneIndex = "SetMainViewSceneIndex",
12
11
  SetAppFocusIndex = "SetAppFocusIndex",
13
12
  SwitchViewsToFreedom = "SwitchViewsToFreedom",
14
- MoveCamera = "MoveCamera",
15
- MoveCameraToContain = "MoveCameraToContain",
16
13
  CursorMove = "CursorMove",
17
14
  RootDirRemoved = "RootDirRemoved",
18
15
  Refresh = "Refresh",
19
16
  InitMainViewCamera = "InitMainViewCamera",
17
+ InvokeAttributesUpdateCallback = "InvokeAttributesUpdateCallback",
18
+ MoveCamera = "MoveCamera",
19
+ MoveCameraToContain = "moveCameraToContain",
20
20
  }
21
21
 
22
22
  export const MagixEventName = "__WindowManger";
@@ -27,6 +27,11 @@ export enum AppAttributes {
27
27
  Position = "position",
28
28
  SceneIndex = "SceneIndex",
29
29
  ZIndex = "zIndex",
30
+ Visible = "visible",
31
+ Ratio = "ratio",
32
+ StageRatio = "stageRatio",
33
+ Draggable = "draggable",
34
+ Resizable = "resizable",
30
35
  }
31
36
 
32
37
  export enum AppEvents {