@netless/window-manager 0.3.15 → 0.3.16-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/docs/api.md ADDED
@@ -0,0 +1,113 @@
1
+ # API
2
+
3
+ ## 目录
4
+ - [静态方法](#static-methods)
5
+ - [`mount`](#mount)
6
+ - [`register`](#register)
7
+ - [实例方法](#instance-methods)
8
+ - [`addApp`](#addApp)
9
+ - [`closeApp`](#closeApp)
10
+ - [实例属性](#prototypes)
11
+ - [事件回调](#events)
12
+
13
+ <h2 id="static-methods">静态方法</h2>
14
+
15
+ <h3 id="mount">WindowManager.mount</h3>
16
+
17
+ > 挂载 WindowManager
18
+
19
+ ```typescript
20
+ const manager = await WindowManager.mount(
21
+ room: room,
22
+ container: document.getElementById("container")
23
+ // 完整配置见下方
24
+ );
25
+ ```
26
+
27
+ 参数
28
+
29
+ | name | type | default | desc |
30
+ | ---------------------- | --------------------------------------- | ------- | ---------------------------- |
31
+ | room | [require] Room | | 房间实例 |
32
+ | container | [require] HTMLElement | | 房间挂载容器 |
33
+ | containerSizeRatio | [optional] number | 9 / 16 | 多窗口区域的高宽比,默认为 9 : 16 |
34
+ | chessboard | [optional] boolean | true | 多窗口区域以外的空间显示 PS 棋盘背景,默认 true |
35
+ | collectorContainer | [optional] HTMLElement | | 用于多窗口最小化图标挂载的 dom |
36
+ | collectorStyles | [optional] Partial{CSSStyleDeclaration} | | 配置 collector 的样式 |
37
+ | overwriteStyles | [optional] string | | 用于覆盖窗口的样式 |
38
+ | cursor | [optional] boolean | false | 开启光标同步 |
39
+ | disableCameraTransform | [optional] boolean | | 禁用主白板的相机移动 |
40
+ | prefersColorScheme | [optional] string | light | auto, light, dark |
41
+ | debug | [optional] boolean | false | 打印日志信息
42
+
43
+ <h3 id="register">WindowManager.register</h3>
44
+
45
+ > 注册 `APP` 到 `WindowManager`
46
+
47
+ ```typescript
48
+ WindowManager.register({
49
+ kind: "helloWorld",
50
+ src: NetlessApp,
51
+ appOptions: () => "appOptions",
52
+ addHooks: (emitter) => {
53
+ emitter.on("created", result => {
54
+ console.log("HelloWordResult", result);
55
+ });
56
+ emitter.on("focus", result => {
57
+ console.log("HelloWorld focus", result);
58
+ })
59
+ emitter.on("destroy", result => {
60
+ console.log("HelloWorld destroy", result);
61
+ })
62
+ }
63
+ })
64
+ ```
65
+
66
+
67
+ <h2 id="instance-methods">实例方法</h2>
68
+
69
+ <h3 id="addApp">addApp</h3>
70
+
71
+ > 添加 `app` 至白板
72
+
73
+ ```typescript
74
+ const appId = await manager.addApp({
75
+ kind: "helloWorld"
76
+ options: { // 可选配置
77
+ scenePath: "/hello-world"
78
+ }
79
+ })
80
+ ```
81
+ 具体参数请参考 `APP` 本身的要求
82
+
83
+ <h3 id="closeApp">closeApp</h3>
84
+
85
+ > 关闭已经打开的 `APP`
86
+
87
+ ```typescript
88
+ manager.closeApp(appId)
89
+ ```
90
+
91
+ <h2 id="prototypes">实例属性</h2>
92
+
93
+ | name | type | default | desc |
94
+ | ------------------ | ------- | ------- | ------ |
95
+ | mainView | View | | 主白板 |
96
+ | boxState | string | | 当前窗口状态 |
97
+ | darkMode | boolean | | 黑夜模式 |
98
+ | prefersColorScheme | string | | 颜色主题 |
99
+
100
+
101
+ <h2 id="events">事件回调</h2>
102
+
103
+ ```typescript
104
+ manager.callbacks.on(events, listener)
105
+ ```
106
+
107
+ | name | type | default | desc |
108
+ | ------------------------ | -------------- | ------- | -------------------------- |
109
+ | mainViewModeChange | ViewVisionMode | | |
110
+ | boxStateChange | string | | normal,minimized,maximized |
111
+ | darkModeChange | boolean | | |
112
+ | prefersColorSchemeChange | string | | auto,light,dark |
113
+ | cameraStateChange | CameraState | | |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "0.3.15",
3
+ "version": "0.3.16-canary.0",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",
package/src/MainView.ts CHANGED
@@ -94,9 +94,6 @@ export class MainViewProxy extends Base {
94
94
 
95
95
  public createMainView(): View {
96
96
  const mainView = createView(this.manager.displayer);
97
- mainView.callbacks.on("onSizeUpdated", () => {
98
- this.context.updateManagerRect();
99
- });
100
97
  const mainViewScenePath = this.store.getMainViewScenePath();
101
98
  if (mainViewScenePath) {
102
99
  setViewFocusScenePath(mainView, mainViewScenePath);
package/src/index.ts CHANGED
@@ -175,7 +175,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
175
175
  public static containerSizeRatio = DEFAULT_CONTAINER_RATIO;
176
176
  private static isCreated = false;
177
177
 
178
- public version = "0.3.15";
178
+ public version = "0.3.16-canary.0";
179
179
 
180
180
  public appListeners?: AppListeners;
181
181
 
@@ -699,6 +699,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
699
699
  if (containerRect) {
700
700
  this.updateSizer(containerRect, sizer, wrapper);
701
701
  this.cursorManager?.updateContainerRect();
702
+ this.appManager?.boxManager.updateManagerRect();
702
703
  }
703
704
  });
704
705