@netless/window-manager 1.0.0-canary.76 → 1.0.0-canary.78
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/App/AppContext.d.ts +1 -1
- package/dist/App/AppPageStateImpl.d.ts +1 -1
- package/dist/App/AppProxy.d.ts +1 -1
- package/dist/App/MagixEvent/index.d.ts +7 -7
- package/dist/App/WhiteboardView.d.ts +2 -2
- package/dist/App/type.d.ts +1 -1
- package/dist/AttributesDelegate.d.ts +7 -7
- package/dist/BoxEmitter.d.ts +7 -7
- package/dist/BoxManager.d.ts +8 -8
- package/dist/Cursor/Cursor.d.ts +1 -1
- package/dist/Cursor/Cursor.svelte.d.ts +1 -0
- package/dist/Cursor/index.d.ts +2 -2
- package/dist/Helper.d.ts +1 -1
- package/dist/InternalEmitter.d.ts +3 -3
- package/dist/Page/PageController.d.ts +2 -2
- package/dist/ReconnectRefresher.d.ts +1 -1
- package/dist/RedoUndo.d.ts +1 -1
- package/dist/Register/index.d.ts +3 -3
- package/dist/Register/storage.d.ts +1 -1
- package/dist/Utils/AppCreateQueue.d.ts +1 -1
- package/dist/View/CameraSynchronizer.d.ts +1 -1
- package/dist/View/ScrollMode.d.ts +1 -1
- package/dist/View/ViewSync.d.ts +1 -1
- package/dist/callback.d.ts +2 -2
- package/dist/index.d.ts +11 -11
- package/dist/index.js +674 -294
- package/dist/index.mjs +670 -294
- package/dist/index.umd.js +672 -296
- package/dist/storage.d.ts +2 -2
- package/dist/typings.d.ts +9 -9
- package/package.json +38 -38
- package/src/AppListener.ts +16 -4
- package/src/BoxManager.ts +3 -0
- package/src/Helper.ts +10 -2
- package/dist/image.d.ts +0 -19
- package/dist/shim.d.ts +0 -5
package/dist/storage.d.ts
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Storage } from "@netless/synced-store";
|
2
2
|
import type { AppManager } from "./AppManager";
|
3
|
-
export
|
3
|
+
export type ScrollStorageState = {
|
4
4
|
scrollTop: number;
|
5
5
|
};
|
6
|
-
export
|
6
|
+
export type ScrollStorage = Storage<ScrollStorageState>;
|
7
7
|
export declare const createScrollStorage: (manager: AppManager) => Storage<ScrollStorageState>;
|
package/dist/typings.d.ts
CHANGED
@@ -22,7 +22,7 @@ export interface NetlessApp<Attributes extends Record<string, any> = any, MagixE
|
|
22
22
|
};
|
23
23
|
setup: (context: AppContext<Attributes, MagixEventPayloads, AppOptions>) => SetupResult;
|
24
24
|
}
|
25
|
-
export
|
25
|
+
export type AppEmitterEvent<T = any> = {
|
26
26
|
/**
|
27
27
|
* before plugin destroyed
|
28
28
|
*/
|
@@ -54,17 +54,17 @@ export declare type AppEmitterEvent<T = any> = {
|
|
54
54
|
pageStateChange: PageState;
|
55
55
|
roomMembersChange: Member[];
|
56
56
|
};
|
57
|
-
export
|
57
|
+
export type RegisterEventData = {
|
58
58
|
appId: string;
|
59
59
|
};
|
60
|
-
export
|
60
|
+
export type RegisterEvents<SetupResult = any> = {
|
61
61
|
created: RegisterEventData & {
|
62
62
|
result: SetupResult;
|
63
63
|
};
|
64
64
|
destroy: RegisterEventData;
|
65
65
|
focus: RegisterEventData;
|
66
66
|
};
|
67
|
-
export
|
67
|
+
export type RegisterParams<AppOptions = any, SetupResult = any, Attributes extends Record<string, any> = any> = {
|
68
68
|
kind: string;
|
69
69
|
src: NetlessApp<Attributes, SetupResult> | string | (() => Promise<NetlessApp<Attributes, SetupResult>>) | (() => Promise<{
|
70
70
|
default: NetlessApp<Attributes, SetupResult>;
|
@@ -75,13 +75,13 @@ export declare type RegisterParams<AppOptions = any, SetupResult = any, Attribut
|
|
75
75
|
name?: string;
|
76
76
|
contentStyles?: string;
|
77
77
|
};
|
78
|
-
export
|
79
|
-
export
|
80
|
-
export
|
78
|
+
export type AppListenerKeys = keyof AppEmitterEvent;
|
79
|
+
export type ApplianceIcons = Partial<Record<`${ApplianceNames}` | string, string>>;
|
80
|
+
export type Writeable<T> = {
|
81
81
|
-readonly [P in keyof T]: T[P];
|
82
82
|
};
|
83
|
-
export
|
84
|
-
export
|
83
|
+
export type ManagerViewMode = `${ViewMode}` | "scroll";
|
84
|
+
export type MoveCameraParams = Partial<Camera> & {
|
85
85
|
animationMode?: AnimationMode;
|
86
86
|
};
|
87
87
|
export type { AppContext } from "./App/AppContext";
|
package/package.json
CHANGED
@@ -1,11 +1,22 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "1.0.0-canary.
|
3
|
+
"version": "1.0.0-canary.78",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"module": "dist/index.mjs",
|
7
7
|
"types": "dist/index.d.ts",
|
8
8
|
"repository": "netless-io/window-manager",
|
9
|
+
"scripts": {
|
10
|
+
"prettier": "prettier --write .",
|
11
|
+
"dev": "vite build --watch",
|
12
|
+
"build": "vite build",
|
13
|
+
"type-gen": "tsc --emitDeclarationOnly",
|
14
|
+
"predev": "yarn type-gen",
|
15
|
+
"build:lib:types": "tsc --emitDeclarationOnly",
|
16
|
+
"lint": "eslint --ext .ts,.tsx,.svelte . && prettier --check .",
|
17
|
+
"test": "vitest",
|
18
|
+
"e2e": "playwright test"
|
19
|
+
},
|
9
20
|
"keywords": [],
|
10
21
|
"author": "",
|
11
22
|
"license": "ISC",
|
@@ -25,49 +36,38 @@
|
|
25
36
|
"value-enhancer": "^1.3.2"
|
26
37
|
},
|
27
38
|
"devDependencies": {
|
28
|
-
"@netless/app-docs-viewer": "1.0.0-canary.
|
39
|
+
"@netless/app-docs-viewer": "1.0.0-canary.6",
|
29
40
|
"@netless/app-plyr": "^0.2.4",
|
30
|
-
"@playwright/test": "^1.
|
31
|
-
"@rollup/plugin-commonjs": "^
|
32
|
-
"@rollup/plugin-node-resolve": "^15.0.
|
41
|
+
"@playwright/test": "^1.33.0",
|
42
|
+
"@rollup/plugin-commonjs": "^24.1.0",
|
43
|
+
"@rollup/plugin-node-resolve": "^15.0.2",
|
33
44
|
"@rollup/plugin-url": "^8.0.1",
|
34
|
-
"@sveltejs/vite-plugin-svelte": "^2.0
|
35
|
-
"@tsconfig/svelte": "^
|
45
|
+
"@sveltejs/vite-plugin-svelte": "^2.2.0",
|
46
|
+
"@tsconfig/svelte": "^4.0.1",
|
36
47
|
"@types/debug": "^4.1.7",
|
37
|
-
"@types/lodash": "^4.14.182",
|
38
|
-
"@types/lodash-es": "^4.17.6",
|
39
48
|
"@types/node": "^18.0.3",
|
40
|
-
"@types/
|
41
|
-
"@
|
42
|
-
"@
|
43
|
-
"@
|
44
|
-
"
|
45
|
-
"
|
46
|
-
"
|
47
|
-
"
|
49
|
+
"@types/lodash": "^4.14.194",
|
50
|
+
"@types/lodash-es": "^4.17.7",
|
51
|
+
"@types/uuid": "^9.0.1",
|
52
|
+
"@typescript-eslint/eslint-plugin": "^5.59.5",
|
53
|
+
"@typescript-eslint/parser": "^5.59.5",
|
54
|
+
"@vitest/ui": "^0.31.0",
|
55
|
+
"cypress": "^12.12.0",
|
56
|
+
"dotenv": "^16.0.3",
|
57
|
+
"eslint": "^8.40.0",
|
58
|
+
"eslint-config-prettier": "^8.8.0",
|
48
59
|
"eslint-plugin-svelte3": "^4.0.0",
|
49
|
-
"jsdom": "^
|
60
|
+
"jsdom": "^22.0.0",
|
50
61
|
"less": "^4.1.3",
|
51
|
-
"prettier": "^2.8.
|
52
|
-
"prettier-plugin-svelte": "^2.
|
62
|
+
"prettier": "^2.8.8",
|
63
|
+
"prettier-plugin-svelte": "^2.10.0",
|
53
64
|
"rollup-plugin-analyzer": "^4.0.0",
|
54
65
|
"rollup-plugin-styles": "^4.0.0",
|
55
|
-
"svelte": "^3.
|
56
|
-
"typescript": "^
|
57
|
-
"vite": "^4.
|
58
|
-
"vite-plugin-dts": "^
|
59
|
-
"vitest": "^0.
|
60
|
-
"white-web-sdk": "^2.16.
|
61
|
-
},
|
62
|
-
"scripts": {
|
63
|
-
"prettier": "prettier --write .",
|
64
|
-
"dev": "vite build --watch",
|
65
|
-
"build": "vite build",
|
66
|
-
"type-gen": "tsc --emitDeclarationOnly",
|
67
|
-
"predev": "yarn type-gen",
|
68
|
-
"build:lib:types": "tsc --emitDeclarationOnly",
|
69
|
-
"lint": "eslint --ext .ts,.tsx,.svelte . && prettier --check .",
|
70
|
-
"test": "vitest",
|
71
|
-
"e2e": "playwright test"
|
66
|
+
"svelte": "^3.59.1",
|
67
|
+
"typescript": "^5.0.4",
|
68
|
+
"vite": "^4.3.5",
|
69
|
+
"vite-plugin-dts": "^2.3.0",
|
70
|
+
"vitest": "^0.31.0",
|
71
|
+
"white-web-sdk": "^2.16.42"
|
72
72
|
}
|
73
|
-
}
|
73
|
+
}
|
package/src/AppListener.ts
CHANGED
@@ -134,12 +134,24 @@ export class AppListeners {
|
|
134
134
|
}
|
135
135
|
}
|
136
136
|
|
137
|
-
private moveCameraHandler = (payload: Camera) => {
|
137
|
+
private moveCameraHandler = (payload: Partial<Camera>) => {
|
138
138
|
const size$ = this.manager.mainViewProxy.size$;
|
139
|
+
// 'size' 存在表示白板已经可见,此时 moveCamera 才有意义
|
139
140
|
if (size$.value) {
|
140
|
-
const
|
141
|
-
|
142
|
-
|
141
|
+
const nextCamera = { ...payload };
|
142
|
+
|
143
|
+
// 如果远端移动视角带有缩放,调整以符合本地视角
|
144
|
+
if (nextCamera.scale) {
|
145
|
+
const size = this.manager.mainView.size;
|
146
|
+
const diff = Math.max(size.height / size$.value.height, size.width / size$.value.width);
|
147
|
+
nextCamera.scale *= diff;
|
148
|
+
}
|
149
|
+
|
150
|
+
// 有可能传了个 scale = 0, 规避这些无效值
|
151
|
+
else {
|
152
|
+
delete nextCamera.scale;
|
153
|
+
}
|
154
|
+
|
143
155
|
this.manager.mainView.moveCamera(nextCamera);
|
144
156
|
}
|
145
157
|
}
|
package/src/BoxManager.ts
CHANGED
@@ -108,6 +108,9 @@ export class BoxManager {
|
|
108
108
|
const { emitter, callbacks, boxEmitter } = context;
|
109
109
|
this.teleBoxManager = this.setupBoxManager(createTeleBoxManagerConfig);
|
110
110
|
this.sideEffectManager.add(() => [
|
111
|
+
this.teleBoxManager.onValChanged("rootRect", rect => {
|
112
|
+
emitter.emit("playgroundSizeChange", rect);
|
113
|
+
}),
|
111
114
|
// 使用 _xxx$.reaction 订阅修改的值, 不管有没有 skipUpdate, 修改值都会触发回调
|
112
115
|
this.teleBoxManager.onValChanged("state", state => {
|
113
116
|
callbacks.emit("boxStateChange", state);
|
package/src/Helper.ts
CHANGED
@@ -32,8 +32,16 @@ export const checkVersion = () => {
|
|
32
32
|
};
|
33
33
|
|
34
34
|
export const findMemberByUid = (room: Room | undefined, uid: string) => {
|
35
|
-
const roomMembers = room?.state.roomMembers;
|
36
|
-
|
35
|
+
const roomMembers = room?.state.roomMembers || [];
|
36
|
+
let maxMemberId = -1; // 第一个进入房间的用户 memberId 是 0
|
37
|
+
let result: RoomMember | undefined = undefined;
|
38
|
+
for (const member of roomMembers) {
|
39
|
+
if (member.payload?.uid === uid && maxMemberId < member.memberId) {
|
40
|
+
maxMemberId = member.memberId;
|
41
|
+
result = member;
|
42
|
+
}
|
43
|
+
}
|
44
|
+
return result;
|
37
45
|
};
|
38
46
|
|
39
47
|
export type Member = RoomMember & { uid: string };
|
package/dist/image.d.ts
DELETED
@@ -1,19 +0,0 @@
|
|
1
|
-
declare module "*.svg" {
|
2
|
-
const content: string;
|
3
|
-
export default content;
|
4
|
-
}
|
5
|
-
|
6
|
-
declare module "*.jpg" {
|
7
|
-
const content: string;
|
8
|
-
export default content;
|
9
|
-
}
|
10
|
-
|
11
|
-
declare module "*.png" {
|
12
|
-
const content: string;
|
13
|
-
export default content;
|
14
|
-
}
|
15
|
-
|
16
|
-
declare module "*.gif" {
|
17
|
-
const content: string;
|
18
|
-
export default content;
|
19
|
-
}
|