@netless/window-manager 0.4.66-beta.0 → 0.4.67-beta.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/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "0.4.66-beta.0",
4
- "description": "",
3
+ "version": "0.4.67-beta.0",
4
+ "description": "Multi-window mode for Netless Whiteboard",
5
+ "author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
6
+ "license": "MIT",
7
+ "repository": "netless-io/window-manager",
5
8
  "main": "dist/index.js",
6
9
  "module": "dist/index.mjs",
7
10
  "types": "dist/index.d.ts",
8
- "repository": "netless-io/window-manager",
9
- "author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
10
- "license": "MIT",
11
11
  "files": [
12
- "src",
13
12
  "dist",
14
- "docs"
13
+ "docs",
14
+ "src"
15
15
  ],
16
16
  "peerDependencies": {
17
17
  "jspdf": "2.5.1",
@@ -33,7 +33,7 @@
33
33
  "video.js": ">=7"
34
34
  },
35
35
  "devDependencies": {
36
- "@netless/app-docs-viewer": "^0.2.16",
36
+ "@netless/app-docs-viewer": "^0.2.17",
37
37
  "@netless/app-media-player": "0.1.0-beta.5",
38
38
  "@rollup/plugin-commonjs": "^20.0.0",
39
39
  "@rollup/plugin-node-resolve": "^13.0.4",
@@ -66,12 +66,12 @@
66
66
  "white-web-sdk": "2.16.43"
67
67
  },
68
68
  "scripts": {
69
- "prettier": "prettier --write .",
70
69
  "build": "vite build && yarn type-gen",
71
- "type-gen": "tsc --emitDeclarationOnly",
72
- "predev": "yarn type-gen",
73
70
  "build:lib:types": "tsc --emitDeclarationOnly",
74
71
  "lint": "eslint --ext .ts,.tsx,.svelte . && prettier --check .",
75
- "test": "vitest"
72
+ "predev": "yarn type-gen",
73
+ "prettier": "prettier --write .",
74
+ "test": "vitest",
75
+ "type-gen": "tsc --emitDeclarationOnly"
76
76
  }
77
77
  }
@@ -264,6 +264,6 @@ export class AppContext<TAttributes extends {} = any, TMagixEventPayloads = any,
264
264
 
265
265
  /** Dispatch a local event to `manager.onAppEvent()`. */
266
266
  public dispatchAppEvent(type: string, value?: any): void {
267
- internalEmitter.emit(`custom-${this.kind}` as any, { type, appId: this.appId, value });
267
+ internalEmitter.emit(`custom-${this.kind}` as any, { kind: this.kind, appId: this.appId, type, value });
268
268
  }
269
269
  }
@@ -163,10 +163,12 @@ export class AttributesDelegate {
163
163
  }
164
164
 
165
165
  public setMainViewSize(size: ISize) {
166
+ if (size.width === 0 || size.height === 0) return;
166
167
  this.context.safeSetAttributes({ [Fields.MainViewSize]: { ...size } });
167
168
  }
168
169
 
169
170
  public setMainViewCameraAndSize(camera: ICamera, size: ISize) {
171
+ if (size.width === 0 || size.height === 0) return;
170
172
  this.context.safeSetAttributes({
171
173
  [Fields.MainViewCamera]: { ...camera },
172
174
  [Fields.MainViewSize]: { ...size },
@@ -209,7 +209,7 @@ export class MainViewProxy {
209
209
  this.manager.boxManager?.blurAllBox();
210
210
  }
211
211
 
212
- public setMainViewSize = debounce(size => {
212
+ public setMainViewSize = debounce((size: Size) => {
213
213
  this.store.setMainViewSize({ ...size, id: this.manager.uid });
214
214
  }, 50);
215
215
 
@@ -234,6 +234,10 @@ export class MainViewProxy {
234
234
  clearTimeout(this._syncMainViewTimer);
235
235
  this._syncMainViewTimer = setTimeout(this.syncMainView, 100, this.manager.room);
236
236
  }
237
+ if ((!this.mainViewSize || this.mainViewSize.width === 0 || this.mainViewSize.height === 0) &&
238
+ this.mainView.size.width > 0 && this.mainView.size.height > 0) {
239
+ this.setMainViewSize(this.mainView.size);
240
+ }
237
241
  };
238
242
 
239
243
  private syncMainView = (room: Room) => {
package/src/index.ts CHANGED
@@ -617,7 +617,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
617
617
  *
618
618
  * 返回一个用于撤销此监听的函数
619
619
  */
620
- public onAppEvent(kind: string, listener: (args: { type: string, appId: string, value: any }) => void): () => void {
620
+ public onAppEvent(kind: string, listener: (args: { kind: string, appId: string, type: string, value: any }) => void): () => void {
621
621
  return internalEmitter.on(`custom-${kind}` as any, listener);
622
622
  }
623
623