@netless/window-manager 1.0.0-canary.9 → 1.0.1
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/LICENSE.txt +21 -0
- package/README.md +90 -64
- package/README.zh-cn.md +224 -0
- package/dist/index.d.ts +1133 -40
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/{index.es.js → index.mjs} +7954 -5445
- package/dist/index.mjs.map +1 -0
- package/dist/style.css +1 -1
- package/docs/advanced.md +55 -55
- package/docs/api.md +126 -113
- package/docs/app-context.md +248 -209
- package/docs/basic.md +25 -26
- package/docs/camera.md +21 -21
- package/docs/cn/advanced.md +137 -0
- package/docs/cn/api.md +311 -0
- package/docs/cn/app-context.md +369 -0
- package/docs/cn/basic.md +64 -0
- package/docs/cn/camera.md +53 -0
- package/docs/cn/concept.md +9 -0
- package/docs/cn/custom-max-bar.md +31 -0
- package/docs/cn/develop-app.md +94 -0
- package/docs/cn/export-pdf.md +48 -0
- package/docs/cn/migrate.md +60 -0
- package/docs/cn/replay.md +40 -0
- package/docs/concept.md +6 -5
- package/docs/custom-max-bar.md +31 -0
- package/docs/develop-app.md +22 -19
- package/docs/export-pdf.md +48 -0
- package/docs/migrate.md +25 -27
- package/docs/quickstart.md +50 -0
- package/docs/replay.md +20 -20
- package/package.json +32 -22
- package/src/App/AppContext.ts +105 -73
- package/src/App/AppPageStateImpl.ts +6 -25
- package/src/App/AppProxy.ts +41 -166
- package/src/App/MagixEvent/index.ts +38 -38
- package/src/App/Storage/StorageEvent.ts +13 -13
- package/src/App/Storage/index.ts +269 -245
- package/src/App/Storage/typings.ts +4 -2
- package/src/App/Storage/utils.ts +3 -3
- package/src/App/index.ts +0 -1
- package/src/AppListener.ts +8 -8
- package/src/AppManager.ts +88 -77
- package/src/AttributesDelegate.ts +42 -22
- package/src/BoxEmitter.ts +12 -6
- package/src/BoxManager.ts +128 -108
- package/src/ContainerResizeObserver.ts +75 -0
- package/src/Cursor/Cursor.svelte +16 -5
- package/src/Cursor/Cursor.svelte.d.ts +21 -0
- package/src/Cursor/Cursor.ts +77 -13
- package/src/Cursor/icons.ts +6 -0
- package/src/Cursor/icons2.ts +66 -0
- package/src/Cursor/index.ts +127 -26
- package/src/Helper.ts +94 -14
- package/src/InternalEmitter.ts +2 -7
- package/src/Page/index.ts +1 -1
- package/src/PageState.ts +6 -5
- package/src/ReconnectRefresher.ts +9 -4
- package/src/RedoUndo.ts +3 -3
- package/src/Register/index.ts +22 -17
- package/src/Register/loader.ts +26 -22
- package/src/Register/storage.ts +13 -13
- package/src/Utils/Common.ts +18 -14
- package/src/Utils/Reactive.ts +26 -25
- package/src/Utils/RoomHacker.ts +4 -4
- package/src/Utils/error.ts +0 -1
- package/src/View/IframeBridge.ts +680 -0
- package/src/View/MainView.ts +127 -53
- package/src/callback.ts +21 -1
- package/src/constants.ts +0 -2
- package/src/image/pencil-eraser-1.svg +3 -0
- package/src/image/pencil-eraser-2.svg +3 -0
- package/src/image/pencil-eraser-3.svg +3 -0
- package/src/index.ts +220 -83
- package/src/style.css +27 -10
- package/src/typings.ts +20 -10
- package/.prettierignore +0 -7
- package/.prettierrc.json +0 -9
- package/CHANGELOG.md +0 -196
- package/__mocks__/white-web-sdk.ts +0 -50
- package/dist/App/AppContext.d.ts +0 -76
- package/dist/App/AppPageStateImpl.d.ts +0 -21
- package/dist/App/AppProxy.d.ts +0 -86
- package/dist/App/AppViewSync.d.ts +0 -11
- package/dist/App/MagixEvent/index.d.ts +0 -29
- package/dist/App/Storage/StorageEvent.d.ts +0 -8
- package/dist/App/Storage/index.d.ts +0 -39
- package/dist/App/Storage/typings.d.ts +0 -22
- package/dist/App/Storage/utils.d.ts +0 -5
- package/dist/App/WhiteboardView.d.ts +0 -22
- package/dist/App/index.d.ts +0 -3
- package/dist/AppListener.d.ts +0 -21
- package/dist/AppManager.d.ts +0 -107
- package/dist/AttributesDelegate.d.ts +0 -80
- package/dist/BoxEmitter.d.ts +0 -34
- package/dist/BoxManager.d.ts +0 -99
- package/dist/BuiltinApps.d.ts +0 -5
- package/dist/Cursor/Cursor.d.ts +0 -39
- package/dist/Cursor/icons.d.ts +0 -3
- package/dist/Cursor/index.d.ts +0 -46
- package/dist/Helper.d.ts +0 -17
- package/dist/InternalEmitter.d.ts +0 -39
- package/dist/Page/PageController.d.ts +0 -21
- package/dist/Page/index.d.ts +0 -3
- package/dist/PageState.d.ts +0 -9
- package/dist/ReconnectRefresher.d.ts +0 -24
- package/dist/RedoUndo.d.ts +0 -18
- package/dist/Register/index.d.ts +0 -28
- package/dist/Register/loader.d.ts +0 -4
- package/dist/Register/storage.d.ts +0 -8
- package/dist/Utils/AppCreateQueue.d.ts +0 -15
- package/dist/Utils/Common.d.ts +0 -23
- package/dist/Utils/Reactive.d.ts +0 -6
- package/dist/Utils/RoomHacker.d.ts +0 -3
- package/dist/Utils/error.d.ts +0 -27
- package/dist/Utils/log.d.ts +0 -1
- package/dist/View/CameraSynchronizer.d.ts +0 -16
- package/dist/View/MainView.d.ts +0 -47
- package/dist/View/ViewManager.d.ts +0 -13
- package/dist/callback.d.ts +0 -24
- package/dist/constants.d.ts +0 -49
- package/dist/index.cjs.js +0 -46
- package/dist/index.umd.js +0 -46
- package/dist/typings.d.ts +0 -82
- package/jest.config.js +0 -27
- package/pnpm-lock.yaml +0 -6302
- package/src/App/AppViewSync.ts +0 -68
- package/src/App/WhiteboardView.ts +0 -83
- package/src/View/CameraSynchronizer.ts +0 -56
- package/vite.config.js +0 -51
- /package/docs/{qickstart.md → cn/quickstart.md} +0 -0
package/src/typings.ts
CHANGED
@@ -13,9 +13,13 @@ import type {
|
|
13
13
|
import type { AppContext } from "./App";
|
14
14
|
import type { ReadonlyTeleBox, TeleBoxRect } from "@netless/telebox-insider";
|
15
15
|
import type { PageState } from "./Page";
|
16
|
-
import type { Member } from "./Helper";
|
17
16
|
|
18
|
-
export interface NetlessApp<
|
17
|
+
export interface NetlessApp<
|
18
|
+
Attributes extends {} = any,
|
19
|
+
MagixEventPayloads = any,
|
20
|
+
AppOptions = any,
|
21
|
+
SetupResult = any
|
22
|
+
> {
|
19
23
|
kind: string;
|
20
24
|
config?: {
|
21
25
|
/** Box width relative to whiteboard. 0~1. Default 0.5. */
|
@@ -53,8 +57,7 @@ export type AppEmitterEvent<T = any> = {
|
|
53
57
|
focus: boolean;
|
54
58
|
reconnected: void;
|
55
59
|
seek: number;
|
56
|
-
pageStateChange: PageState
|
57
|
-
roomMembersChange: Member[];
|
60
|
+
pageStateChange: PageState;
|
58
61
|
};
|
59
62
|
|
60
63
|
export type RegisterEventData = {
|
@@ -62,14 +65,18 @@ export type RegisterEventData = {
|
|
62
65
|
};
|
63
66
|
|
64
67
|
export type RegisterEvents<SetupResult = any> = {
|
65
|
-
created: RegisterEventData & { result: SetupResult
|
68
|
+
created: RegisterEventData & { result: SetupResult };
|
66
69
|
destroy: RegisterEventData;
|
67
70
|
focus: RegisterEventData;
|
68
71
|
};
|
69
72
|
|
70
|
-
export type RegisterParams<AppOptions = any, SetupResult = any, Attributes = any> = {
|
73
|
+
export type RegisterParams<AppOptions = any, SetupResult = any, Attributes extends {} = any> = {
|
71
74
|
kind: string;
|
72
|
-
src:
|
75
|
+
src:
|
76
|
+
| NetlessApp<Attributes, SetupResult>
|
77
|
+
| string
|
78
|
+
| (() => Promise<NetlessApp<Attributes, SetupResult>>)
|
79
|
+
| (() => Promise<{ default: NetlessApp<Attributes, SetupResult> }>);
|
73
80
|
appOptions?: AppOptions | (() => AppOptions);
|
74
81
|
addHooks?: (emitter: Emittery<RegisterEvents<SetupResult>>) => void;
|
75
82
|
/** dynamic load app package name */
|
@@ -78,13 +85,16 @@ export type RegisterParams<AppOptions = any, SetupResult = any, Attributes = any
|
|
78
85
|
|
79
86
|
export type AppListenerKeys = keyof AppEmitterEvent;
|
80
87
|
|
81
|
-
export type ApplianceIcons = Partial<Record
|
88
|
+
export type ApplianceIcons = Partial<Record<`${ApplianceNames}` | string, string>>;
|
82
89
|
|
83
90
|
export type { AppContext } from "./App/AppContext";
|
84
|
-
export type { WhiteBoardView } from "./App";
|
85
91
|
export type { ReadonlyTeleBox, TeleBoxRect };
|
86
92
|
export type { SceneState, SceneDefinition, View, AnimationMode, Displayer, Room, Player };
|
87
93
|
export type { Storage, StorageStateChangedEvent, StorageStateChangedListener } from "./App/Storage";
|
88
94
|
export * from "./Page";
|
89
95
|
export * from "./Utils/error";
|
90
|
-
|
96
|
+
|
97
|
+
export type AppPayload = {
|
98
|
+
appId: string;
|
99
|
+
view: View;
|
100
|
+
};
|
package/.prettierignore
DELETED
package/.prettierrc.json
DELETED
package/CHANGELOG.md
DELETED
@@ -1,196 +0,0 @@
|
|
1
|
-
## 0.4.32 (2022-06-10)
|
2
|
-
|
3
|
-
- 功能: `WindowManager.mount` 添加 `applianceIcons` 选项配置光标使用的图片
|
4
|
-
|
5
|
-
## 0.4.31 (2022-06-09)
|
6
|
-
|
7
|
-
- 修复: `bindContainer` 在回放模式下直接抛出错误的问题
|
8
|
-
|
9
|
-
## 0.4.30 (2022-06-08)
|
10
|
-
|
11
|
-
- 重构: removePage 在 resolve 之后可以立即查询到正确的状态
|
12
|
-
- 修复: 重连后 app 创建错误
|
13
|
-
|
14
|
-
## 0.4.28-0.4.29 (2022-06-08)
|
15
|
-
|
16
|
-
- 修复: `removePage` 可以删除最后一页的问题
|
17
|
-
- 重构: `removePage` `index` 参数变为可选,默认删除当前页
|
18
|
-
|
19
|
-
## 0.4.27 (2022-06-07)
|
20
|
-
|
21
|
-
- 添加 `removePage` API
|
22
|
-
- `storage` 仅在第一次时设置默认状态
|
23
|
-
- `bindContainer` 在 `room` 非 `Connected` 状态下调用会直接抛出错误
|
24
|
-
|
25
|
-
## 0.4.26
|
26
|
-
|
27
|
-
1. 修复 `app` 中 `pageStateChange` 事件被多次触发的问题
|
28
|
-
2. 修复重连之后 `mainView` 显示错误的内容的问题
|
29
|
-
|
30
|
-
## 0.4.25
|
31
|
-
|
32
|
-
1. 添加 `setContainerSizeRatio` 方法, 用于初始化后更新 `containerSizeRatio`
|
33
|
-
|
34
|
-
## 0.4.24
|
35
|
-
|
36
|
-
1. `package.json` `main` 指定为 `cjs` 格式
|
37
|
-
|
38
|
-
## 0.4.23
|
39
|
-
|
40
|
-
1. 修复可写进入立即切换成只读造成初始化 camera 失败的问题
|
41
|
-
|
42
|
-
## 0.4.22
|
43
|
-
|
44
|
-
1. 修复只读端先加入时视角跟随失败的问题
|
45
|
-
|
46
|
-
## 0.4.21
|
47
|
-
|
48
|
-
1. 添加 `manager.refresh()` 方法用于从其他房间 `copy` `attributes`
|
49
|
-
## 0.4.20
|
50
|
-
|
51
|
-
1. 导出 Page 相关类型
|
52
|
-
|
53
|
-
## 0.4.19
|
54
|
-
|
55
|
-
1. 升级 @netless/app-docs-viewer@0.2.9
|
56
|
-
|
57
|
-
## 0.4.18
|
58
|
-
|
59
|
-
1. 修复设置 viewMode freedom 时, 不能 focus 到主白板的问题
|
60
|
-
|
61
|
-
## 0.4.17
|
62
|
-
|
63
|
-
1. 修复 safari 浏览器下 removeScenes 为 "/" 没有清理完成完成时可以 addApp
|
64
|
-
|
65
|
-
## 0.4.16
|
66
|
-
|
67
|
-
1. 修复 removeScenes 为 "/" 没有清理完成完成时 addApp 造成的状态错误
|
68
|
-
|
69
|
-
## 0.4.15
|
70
|
-
|
71
|
-
1. 修复 removeScenes 为 "/" 时, 切换主白板和 app focus 失效的问题
|
72
|
-
|
73
|
-
## 0.4.14
|
74
|
-
|
75
|
-
1. 修复 removeScenes 为 "/" 时, 同步端笔迹依旧存在的问题
|
76
|
-
|
77
|
-
## 0.4.13
|
78
|
-
|
79
|
-
1. 在只读状态时可以切换 `viewMode`
|
80
|
-
|
81
|
-
## 0.4.12
|
82
|
-
|
83
|
-
1. 升级 `@netless/telebox-insider` 到 `0.2.26`
|
84
|
-
2. 修复回放时 `seek` app 状态错误的问题
|
85
|
-
|
86
|
-
## 0.4.11
|
87
|
-
|
88
|
-
1. 升级 `@netless/app-docs-viewer` 到 `0.2.8`
|
89
|
-
2. 同步注册的 url 的 src 到远端
|
90
|
-
3. 添加 `pageState` 和 `pageStateChange` 事件
|
91
|
-
4. 修复 manager 设置初始化 scenePath 错误的问题
|
92
|
-
5. 添加 `containerSizeRatio` 到 `manager` 实例
|
93
|
-
|
94
|
-
## 0.3.27
|
95
|
-
|
96
|
-
1. 修复在同时调用多次 `addApp` 时, 先添加的课件不显示的问题
|
97
|
-
|
98
|
-
## 0.4.10
|
99
|
-
|
100
|
-
1. 修复 `PublicEvent` 类型没有导出的问题
|
101
|
-
|
102
|
-
## 0.3.26
|
103
|
-
|
104
|
-
1. 修复多次调用 `setWritable` 和 `setReadonly` 导致的状态错误
|
105
|
-
|
106
|
-
## 0.4.9
|
107
|
-
|
108
|
-
1. 添加 `sceneState` 属性和 `sceneStateChange` 事件
|
109
|
-
2. 修复刷新后 `dynamic DocsViewer` 页数会切换错误的问题
|
110
|
-
|
111
|
-
## 0.4.8
|
112
|
-
|
113
|
-
1. 升级 `@netless/telebox-insider` 至 `0.2.25`
|
114
|
-
2. 修复关闭 app 时可能因为 app 报错导致关闭失败的问题
|
115
|
-
|
116
|
-
## 0.4.7
|
117
|
-
|
118
|
-
1. 修改 `addPage` 接口
|
119
|
-
|
120
|
-
## 0.4.6
|
121
|
-
|
122
|
-
1. 升级 `@netless/telebox-insider` 至 `0.2.24`
|
123
|
-
2. 内置 `video.js` 的 css, 使用视频插件时不再需要手动引入
|
124
|
-
3. 添加 `addPage` `nextPage` `prevPage`
|
125
|
-
|
126
|
-
## 0.4.5
|
127
|
-
1. 修复 manager 的 `insertText` `insertImage` `completeImageUpload` `lockImage` `lockImages` 没有代理到 `room` 的问题
|
128
|
-
2. 升级 `@netless/telebox-insider` 至 `0.2.23`
|
129
|
-
3. 优化双指缩放时光标的位置
|
130
|
-
|
131
|
-
## 0.4.4
|
132
|
-
|
133
|
-
1. 代理 `room` 的 `insertText` `insertImage` `completeImageUpload` `lockImage` `lockImages` 方法
|
134
|
-
2. 修复回放时 view didRelease 的报错问题
|
135
|
-
|
136
|
-
## 0.4.3
|
137
|
-
|
138
|
-
1. 代理 `room` 的 `delete` `copy` `paste` `duplicate` 方法
|
139
|
-
|
140
|
-
## 0.4.1
|
141
|
-
|
142
|
-
1. 添加 `loadApp` 事件
|
143
|
-
|
144
|
-
## 0.4.0
|
145
|
-
|
146
|
-
### 功能
|
147
|
-
1. 在不同窗口中书写不再需要点击窗口进行切换
|
148
|
-
2. 实现了激光笔教具
|
149
|
-
3. 添加 `bindContainer` 接口,`mount` 时 `container` 参数不再是必选
|
150
|
-
4. 添加 `bindCollector` 接口
|
151
|
-
5. 关闭 `App` 会移除相关的 `Scenes`
|
152
|
-
6. 添加 `ScenePath` 相同的 `App` 会把这个 `App` 置为最上层
|
153
|
-
7. `manager.moveCamera` 和 `manager.moveCameraToContain` 会同步到所有端
|
154
|
-
8. 代理 `room.redo()` `room.undo()` `room.canRedoSteps` `room.canUndoSteps` 以及添加 `canRedoStepsChange` `canUndoStepsChange` 事件
|
155
|
-
9. 添加 `mainViewScenesLength` 属性和 `mainViewScenesLengthChange` 事件
|
156
|
-
10. 添加 `manager.cleanCurrentScene()` 方法自动清除当前 `focus` 白板的笔迹
|
157
|
-
|
158
|
-
### BreakChange
|
159
|
-
1. 移除 `WindowManager.mount` 的多参数类型
|
160
|
-
|
161
|
-
|
162
|
-
## 0.3.25
|
163
|
-
|
164
|
-
1. 修复创建 APP 之后没有设置默认 `zIndex` 的问题
|
165
|
-
|
166
|
-
## 0.3.24
|
167
|
-
|
168
|
-
1. 修复重连之后光标不见的问题(注意: 新的光标同步方式会跟 0.3.24 之前的版本不兼容)
|
169
|
-
2. 修改打包方式, 内部依赖会默认打包
|
170
|
-
3. 确保重复 mount 之后 `WindowManger` 内部状态正确
|
171
|
-
|
172
|
-
## 0.3.23
|
173
|
-
|
174
|
-
1. 修复 ios 上 `boxState` 没有正确回调的问题
|
175
|
-
2. 添加了 `setBoxState` `setMaximized` `setMinimized` 接口
|
176
|
-
|
177
|
-
## 0.3.22
|
178
|
-
|
179
|
-
1. 升级 `@netless/app-docs-viewer` 优化移动端显存占用
|
180
|
-
2. 升级 `@netless/telebox-insider` 优化移动端显存占用
|
181
|
-
|
182
|
-
## 0.3.19-0.3.21
|
183
|
-
|
184
|
-
1. 更新 `@netless/app-docs-viewer`
|
185
|
-
2. 修复 box `zIndex` 同步的问题
|
186
|
-
|
187
|
-
## 0.3.18
|
188
|
-
|
189
|
-
1. 修复最小化时刷新页面 box 位置错误的问题
|
190
|
-
|
191
|
-
## 0.3.17
|
192
|
-
|
193
|
-
1. 同步 box 的 `z-index` 以保持顺序
|
194
|
-
2. 更新 `telebox-insider` 使用新的 `focus` 和 `blur` api 以保持状态的正确
|
195
|
-
3. 更新 `@netless/app-docs-viewer@0.1.26` 减少滚动同步频率
|
196
|
-
4. 修复最小化时没有清理 `focus` 状态的问题
|
@@ -1,50 +0,0 @@
|
|
1
|
-
import { vi } from "vitest";
|
2
|
-
|
3
|
-
class InvisiblePlugin {
|
4
|
-
attributes: any = {};
|
5
|
-
setAttributes (attrs: any) {
|
6
|
-
this.attributes = { ...this.attributes, ...attrs };
|
7
|
-
}
|
8
|
-
}
|
9
|
-
|
10
|
-
const UpdateEventKind = {
|
11
|
-
Inserted: 0,
|
12
|
-
Updated: 1,
|
13
|
-
Removed: 2,
|
14
|
-
}
|
15
|
-
|
16
|
-
enum ApplianceNames {
|
17
|
-
selector = "selector",
|
18
|
-
clicker = "clicker",
|
19
|
-
laserPointer = "laserPointer",
|
20
|
-
pencil = "pencil",
|
21
|
-
rectangle = "rectangle",
|
22
|
-
ellipse = "ellipse",
|
23
|
-
shape = "shape",
|
24
|
-
eraser = "eraser",
|
25
|
-
text = "text",
|
26
|
-
straight = "straight",
|
27
|
-
arrow = "arrow",
|
28
|
-
hand = "hand",
|
29
|
-
}
|
30
|
-
|
31
|
-
enum ViewMode {
|
32
|
-
Freedom = "freedom",
|
33
|
-
Follower = "follower",
|
34
|
-
Broadcaster = "broadcaster",
|
35
|
-
}
|
36
|
-
|
37
|
-
enum AnimationMode {
|
38
|
-
Immediately = "immediately",
|
39
|
-
Continuous = "continuous",
|
40
|
-
}
|
41
|
-
|
42
|
-
const isPlayer = vi.fn(() => false);
|
43
|
-
const unlistenDisposed = vi.fn();
|
44
|
-
const unlistenUpdated = vi.fn();
|
45
|
-
const toJS = vi.fn();
|
46
|
-
|
47
|
-
export {
|
48
|
-
InvisiblePlugin, UpdateEventKind, ApplianceNames, ViewMode, isPlayer, unlistenDisposed,
|
49
|
-
unlistenUpdated, toJS, AnimationMode
|
50
|
-
}
|
package/dist/App/AppContext.d.ts
DELETED
@@ -1,76 +0,0 @@
|
|
1
|
-
import { Storage } from "./Storage";
|
2
|
-
import { autorun, listenDisposed, listenUpdated, reaction, unlistenDisposed, unlistenUpdated, toJS } from "white-web-sdk";
|
3
|
-
import type { Room, SceneDefinition, View } from "white-web-sdk";
|
4
|
-
import type { ReadonlyTeleBox } from "@netless/telebox-insider";
|
5
|
-
import type Emittery from "emittery";
|
6
|
-
import type { BoxManager } from "../BoxManager";
|
7
|
-
import type { AppEmitterEvent, Member } from "../index";
|
8
|
-
import type { AppManager } from "../AppManager";
|
9
|
-
import type { AppProxy } from "./AppProxy";
|
10
|
-
import type { MagixEventAddListener, MagixEventDispatcher, MagixEventRemoveListener } from "./MagixEvent";
|
11
|
-
import { WhiteBoardView } from "./WhiteboardView";
|
12
|
-
export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOptions = any> {
|
13
|
-
private manager;
|
14
|
-
private boxManager;
|
15
|
-
appId: string;
|
16
|
-
private appProxy;
|
17
|
-
private appOptions?;
|
18
|
-
readonly emitter: Emittery<AppEmitterEvent<TAttributes>>;
|
19
|
-
readonly mobxUtils: {
|
20
|
-
autorun: typeof autorun;
|
21
|
-
reaction: typeof reaction;
|
22
|
-
toJS: typeof toJS;
|
23
|
-
};
|
24
|
-
readonly objectUtils: {
|
25
|
-
listenUpdated: typeof listenUpdated;
|
26
|
-
unlistenUpdated: typeof unlistenUpdated;
|
27
|
-
listenDisposed: typeof listenDisposed;
|
28
|
-
unlistenDisposed: typeof unlistenDisposed;
|
29
|
-
};
|
30
|
-
private store;
|
31
|
-
readonly isAddApp: boolean;
|
32
|
-
readonly isReplay: boolean;
|
33
|
-
private whiteBoardView?;
|
34
|
-
_viewWrapper?: HTMLElement;
|
35
|
-
constructor(manager: AppManager, boxManager: BoxManager, appId: string, appProxy: AppProxy, appOptions?: TAppOptions | (() => TAppOptions) | undefined);
|
36
|
-
get displayer(): import("white-web-sdk").Displayer<import("white-web-sdk").DisplayerCallbacks>;
|
37
|
-
get destroyed(): boolean;
|
38
|
-
/** @deprecated Use context.storage.state instead. */
|
39
|
-
getAttributes: () => TAttributes | undefined;
|
40
|
-
getScenes: () => SceneDefinition[] | undefined;
|
41
|
-
get view(): View | undefined;
|
42
|
-
createWhiteBoardView: (size?: number | undefined) => WhiteBoardView;
|
43
|
-
private ensurePageSize;
|
44
|
-
getInitScenePath: () => string | undefined;
|
45
|
-
/** Get App writable status. */
|
46
|
-
get isWritable(): boolean;
|
47
|
-
/** Get the App Window UI box. */
|
48
|
-
get box(): ReadonlyTeleBox;
|
49
|
-
get room(): Room | undefined;
|
50
|
-
get members(): Member[];
|
51
|
-
get memberState(): Member;
|
52
|
-
/** @deprecated Use context.storage.setState instead. */
|
53
|
-
setAttributes: (attributes: TAttributes) => void;
|
54
|
-
/** @deprecated Use context.storage.setState instead. */
|
55
|
-
updateAttributes: (keys: string[], value: any) => void;
|
56
|
-
/** @deprecated Use Pages api instead. */
|
57
|
-
setScenePath: (scenePath: string) => Promise<void>;
|
58
|
-
/** Get the local App options. */
|
59
|
-
getAppOptions: () => TAppOptions | undefined;
|
60
|
-
private _storage?;
|
61
|
-
/** Main Storage for attributes. */
|
62
|
-
get storage(): Storage<TAttributes>;
|
63
|
-
/**
|
64
|
-
* Create separated storages for flexible state management.
|
65
|
-
* @param storeId Namespace for the storage. Storages of the same namespace share the same data.
|
66
|
-
* @param defaultState Default state for initial storage creation.
|
67
|
-
* @returns
|
68
|
-
*/
|
69
|
-
createStorage: <TState>(storeId: string, defaultState?: TState | undefined) => Storage<TState>;
|
70
|
-
/** Dispatch events to other clients (and self). */
|
71
|
-
dispatchMagixEvent: MagixEventDispatcher<TMagixEventPayloads>;
|
72
|
-
/** Listen to events from others clients (and self messages). */
|
73
|
-
addMagixEventListener: MagixEventAddListener<TMagixEventPayloads>;
|
74
|
-
/** Remove a Magix event listener. */
|
75
|
-
removeMagixEventListener: MagixEventRemoveListener<TMagixEventPayloads>;
|
76
|
-
}
|
@@ -1,21 +0,0 @@
|
|
1
|
-
import type { Displayer, ScenesCallbacksNode, View } from "white-web-sdk";
|
2
|
-
import type { PageState } from "../Page";
|
3
|
-
export declare type AppPageStateParams = {
|
4
|
-
displayer: Displayer;
|
5
|
-
scenePath: string | undefined;
|
6
|
-
view: View | undefined;
|
7
|
-
notifyPageStateChange: () => void;
|
8
|
-
};
|
9
|
-
export declare class AppPageStateImpl {
|
10
|
-
private params;
|
11
|
-
sceneNode: ScenesCallbacksNode | null;
|
12
|
-
private scenePath?;
|
13
|
-
private view?;
|
14
|
-
constructor(params: AppPageStateParams);
|
15
|
-
createSceneNode: (scenePath: string) => ScenesCallbacksNode | null;
|
16
|
-
setView(view: View): void;
|
17
|
-
private onSceneChange;
|
18
|
-
getFullPath(index: number): string | undefined;
|
19
|
-
toObject(): PageState;
|
20
|
-
destroy(): void;
|
21
|
-
}
|
package/dist/App/AppProxy.d.ts
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
import Emittery from "emittery";
|
2
|
-
import { AppContext } from "./AppContext";
|
3
|
-
import { AppPageStateImpl } from "./AppPageStateImpl";
|
4
|
-
import { Val } from "value-enhancer";
|
5
|
-
import type { ICamera, ISize } from "../AttributesDelegate";
|
6
|
-
import type { AppEmitterEvent, AppInitState, BaseInsertParams } from "../index";
|
7
|
-
import type { SceneState, View, SceneDefinition, Camera } from "white-web-sdk";
|
8
|
-
import type { AppManager } from "../AppManager";
|
9
|
-
import type { NetlessApp } from "../typings";
|
10
|
-
import type { ReadonlyTeleBox } from "@netless/telebox-insider";
|
11
|
-
import type { PageRemoveService, PageState } from "../Page";
|
12
|
-
export declare type AppEmitter = Emittery<AppEmitterEvent>;
|
13
|
-
export declare class AppProxy implements PageRemoveService {
|
14
|
-
private params;
|
15
|
-
private manager;
|
16
|
-
kind: string;
|
17
|
-
id: string;
|
18
|
-
scenePath?: string;
|
19
|
-
private appScenePath;
|
20
|
-
appEmitter: AppEmitter;
|
21
|
-
scenes?: SceneDefinition[];
|
22
|
-
private appListener;
|
23
|
-
private boxManager;
|
24
|
-
private appProxies;
|
25
|
-
private viewManager;
|
26
|
-
private store;
|
27
|
-
uid: string;
|
28
|
-
isAddApp: boolean;
|
29
|
-
status: "normal" | "destroyed";
|
30
|
-
private stateKey;
|
31
|
-
_pageState: AppPageStateImpl;
|
32
|
-
appResult?: NetlessApp<any>;
|
33
|
-
appContext?: AppContext<any, any>;
|
34
|
-
private sideEffectManager;
|
35
|
-
private valManager;
|
36
|
-
private fullPath$;
|
37
|
-
private appViewSync?;
|
38
|
-
camera$: Val<ICamera | undefined, any>;
|
39
|
-
size$: Val<ISize | undefined, any>;
|
40
|
-
box$: Val<ReadonlyTeleBox | undefined, any>;
|
41
|
-
view$: Val<View | undefined, any>;
|
42
|
-
constructor(params: BaseInsertParams, manager: AppManager, appId: string, isAddApp: boolean);
|
43
|
-
fireMemberStateChange: () => void;
|
44
|
-
private onMemberStateChange;
|
45
|
-
createAppDir(): View;
|
46
|
-
private initScenes;
|
47
|
-
get view(): View | undefined;
|
48
|
-
get viewIndex(): number | undefined;
|
49
|
-
get isWritable(): boolean;
|
50
|
-
get attributes(): any;
|
51
|
-
get appAttributes(): import("../index").AppSyncAttributes;
|
52
|
-
getFullScenePath(): string | undefined;
|
53
|
-
private getFullScenePathFromScenes;
|
54
|
-
setFullPath(path: string): void;
|
55
|
-
baseInsertApp(skipUpdate?: boolean): Promise<{
|
56
|
-
appId: string;
|
57
|
-
app: NetlessApp;
|
58
|
-
}>;
|
59
|
-
get box(): ReadonlyTeleBox | undefined;
|
60
|
-
private setupApp;
|
61
|
-
private fixMobileSize;
|
62
|
-
onSeek(time: number): Promise<void>;
|
63
|
-
onReconnected(): Promise<void>;
|
64
|
-
onRemoveScene(scenePath: string): Promise<void>;
|
65
|
-
getAppInitState: (id: string) => AppInitState | undefined;
|
66
|
-
emitAppSceneStateChange(sceneState: SceneState): void;
|
67
|
-
emitAppIsWritableChange(): void;
|
68
|
-
private makeAppEventListener;
|
69
|
-
private appAttributesUpdateListener;
|
70
|
-
private setFocusScenePathHandler;
|
71
|
-
setScenePath(): void;
|
72
|
-
setViewFocusScenePath(): string | undefined;
|
73
|
-
private createView;
|
74
|
-
notifyPageStateChange: import("lodash").DebouncedFunc<() => void>;
|
75
|
-
get pageState(): PageState;
|
76
|
-
removeSceneByIndex(index: number): Promise<boolean>;
|
77
|
-
setSceneIndexWithoutSync(index: number): void;
|
78
|
-
setSceneIndex(index: number): void;
|
79
|
-
storeCamera: (camera: ICamera) => void;
|
80
|
-
storeSize: (size: ISize) => void;
|
81
|
-
moveCamera: (camera: Camera) => void;
|
82
|
-
destroy(needCloseBox: boolean, cleanAttrs: boolean, skipUpdate: boolean, error?: Error): Promise<void>;
|
83
|
-
private addCameraReaction;
|
84
|
-
private addSizeReaction;
|
85
|
-
close(): Promise<void>;
|
86
|
-
}
|
@@ -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,29 +0,0 @@
|
|
1
|
-
import type { MagixEventListenerOptions as WhiteMagixListenerOptions, Event as WhiteEvent, EventPhase as WhiteEventPhase, Scope as WhiteScope } from "white-web-sdk";
|
2
|
-
export interface MagixEventListenerOptions extends WhiteMagixListenerOptions {
|
3
|
-
/**
|
4
|
-
* Rapid emitted callbacks will be slowed down to this interval (in ms).
|
5
|
-
*/
|
6
|
-
fireInterval?: number;
|
7
|
-
/**
|
8
|
-
* If `true`, sent events will reach self-listeners after committed to server.
|
9
|
-
* Otherwise the events will reach self-listeners immediately.
|
10
|
-
*/
|
11
|
-
fireSelfEventAfterCommit?: boolean;
|
12
|
-
}
|
13
|
-
export interface MagixEventMessage<TPayloads = any, TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>> extends Omit<WhiteEvent, "scope" | "phase"> {
|
14
|
-
/** Event name */
|
15
|
-
event: TEvent;
|
16
|
-
/** Event Payload */
|
17
|
-
payload: TPayloads[TEvent];
|
18
|
-
/** Whiteboard ID of the client who dispatched the event. It will be AdminObserverId for system events. */
|
19
|
-
authorId: number;
|
20
|
-
scope: `${WhiteScope}`;
|
21
|
-
phase: `${WhiteEventPhase}`;
|
22
|
-
}
|
23
|
-
export declare type MagixEventTypes<TPayloads = any> = Extract<keyof TPayloads, string>;
|
24
|
-
export declare type MagixEventPayload<TPayloads = any, TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>> = TPayloads[TEvent];
|
25
|
-
export declare type MagixEventDispatcher<TPayloads = any> = <TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>>(event: TEvent, payload: TPayloads[TEvent]) => void;
|
26
|
-
export declare type MagixEventHandler<TPayloads = any, TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>> = (message: MagixEventMessage<TPayloads, TEvent>) => void;
|
27
|
-
export declare type MagixEventListenerDisposer = () => void;
|
28
|
-
export declare type MagixEventAddListener<TPayloads = any> = <TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>>(event: TEvent, handler: MagixEventHandler<TPayloads, TEvent>, options?: MagixEventListenerOptions | undefined) => MagixEventListenerDisposer;
|
29
|
-
export declare type MagixEventRemoveListener<TPayloads = any> = <TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>>(event: TEvent, handler?: MagixEventHandler<TPayloads, TEvent>) => void;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
export declare type StorageEventListener<T> = (event: T) => void;
|
2
|
-
export declare class StorageEvent<TMessage> {
|
3
|
-
listeners: Set<StorageEventListener<TMessage>>;
|
4
|
-
get length(): number;
|
5
|
-
dispatch(message: TMessage): void;
|
6
|
-
addListener(listener: StorageEventListener<TMessage>): void;
|
7
|
-
removeListener(listener: StorageEventListener<TMessage>): void;
|
8
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import type { AppContext } from "../AppContext";
|
2
|
-
import type { Diff, StorageStateChangedListener, StorageStateChangedListenerDisposer } from "./typings";
|
3
|
-
import { StorageEvent } from "./StorageEvent";
|
4
|
-
export * from './typings';
|
5
|
-
export declare const STORAGE_NS = "_WM-STORAGE_";
|
6
|
-
export declare class Storage<TState extends Record<string, any> = any> implements Storage<TState> {
|
7
|
-
readonly id: string | null;
|
8
|
-
private readonly _context;
|
9
|
-
private readonly _sideEffect;
|
10
|
-
private _state;
|
11
|
-
private _destroyed;
|
12
|
-
private _refMap;
|
13
|
-
/**
|
14
|
-
* `setState` alters local state immediately before sending to server. This will cache the old value for onStateChanged diffing.
|
15
|
-
*/
|
16
|
-
private _lastValue;
|
17
|
-
constructor(context: AppContext, id?: string, defaultState?: TState);
|
18
|
-
get state(): Readonly<TState>;
|
19
|
-
readonly onStateChanged: StorageEvent<Diff<TState>>;
|
20
|
-
addStateChangedListener(handler: StorageStateChangedListener<TState>): StorageStateChangedListenerDisposer;
|
21
|
-
ensureState(state: Partial<TState>): void;
|
22
|
-
setState(state: Partial<TState>): void;
|
23
|
-
/**
|
24
|
-
* Empty storage data.
|
25
|
-
*/
|
26
|
-
emptyStorage(): void;
|
27
|
-
/**
|
28
|
-
* Delete storage index with all of its data and destroy the Storage instance.
|
29
|
-
*/
|
30
|
-
deleteStorage(): void;
|
31
|
-
get destroyed(): boolean;
|
32
|
-
/**
|
33
|
-
* Destroy the Storage instance. The data will be kept.
|
34
|
-
*/
|
35
|
-
destroy(): void;
|
36
|
-
private _getRawState;
|
37
|
-
private _setRawState;
|
38
|
-
private _updateProperties;
|
39
|
-
}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import type { StorageEventListener } from "./StorageEvent";
|
2
|
-
export declare type RefValue<TValue = any> = {
|
3
|
-
k: string;
|
4
|
-
v: TValue;
|
5
|
-
__isRef: true;
|
6
|
-
};
|
7
|
-
export declare type ExtractRawValue<TValue> = TValue extends RefValue<infer TRefValue> ? TRefValue : TValue;
|
8
|
-
export declare type AutoRefValue<TValue> = RefValue<ExtractRawValue<TValue>>;
|
9
|
-
export declare type MaybeRefValue<TValue> = TValue | AutoRefValue<TValue>;
|
10
|
-
export declare type DiffOne<T> = {
|
11
|
-
oldValue?: T;
|
12
|
-
newValue?: T;
|
13
|
-
};
|
14
|
-
export declare type Diff<T> = {
|
15
|
-
[K in keyof T]?: DiffOne<T[K]>;
|
16
|
-
};
|
17
|
-
export declare type StorageOnSetStatePayload<TState = unknown> = {
|
18
|
-
[K in keyof TState]?: MaybeRefValue<TState[K]>;
|
19
|
-
};
|
20
|
-
export declare type StorageStateChangedEvent<TState = any> = Diff<TState>;
|
21
|
-
export declare type StorageStateChangedListener<TState = any> = StorageEventListener<StorageStateChangedEvent<TState>>;
|
22
|
-
export declare type StorageStateChangedListenerDisposer = () => void;
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { AutoRefValue, RefValue } from "./typings";
|
2
|
-
export declare const plainObjectKeys: <T>(o: T) => Extract<keyof T, string>[];
|
3
|
-
export declare function isRef<TValue = unknown>(e: unknown): e is RefValue<TValue>;
|
4
|
-
export declare function makeRef<TValue>(v: TValue): RefValue<TValue>;
|
5
|
-
export declare function makeAutoRef<TValue>(v: TValue): AutoRefValue<TValue>;
|
@@ -1,22 +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, View } from "white-web-sdk";
|
6
|
-
export declare class WhiteBoardView implements PageController {
|
7
|
-
view: View;
|
8
|
-
protected appContext: AppContext;
|
9
|
-
protected appProxy: AppProxy;
|
10
|
-
private removeViewWrapper;
|
11
|
-
ensureSize: (size: number) => void;
|
12
|
-
readonly pageState$: ReadonlyVal<PageState>;
|
13
|
-
constructor(view: View, appContext: AppContext, appProxy: AppProxy, removeViewWrapper: () => void, ensureSize: (size: number) => void);
|
14
|
-
get pageState(): PageState;
|
15
|
-
moveCamera(camera: Camera): void;
|
16
|
-
nextPage: () => Promise<boolean>;
|
17
|
-
prevPage: () => Promise<boolean>;
|
18
|
-
jumpPage: (index: number) => Promise<boolean>;
|
19
|
-
addPage: (params?: AddPageParams | undefined) => Promise<void>;
|
20
|
-
removePage: (index?: number | undefined) => Promise<boolean>;
|
21
|
-
destroy(): void;
|
22
|
-
}
|
package/dist/App/index.d.ts
DELETED