@netless/window-manager 1.0.0-canary.10 → 1.0.0-canary.13
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/AppProxy.d.ts +4 -3
- package/dist/App/WhiteboardView.d.ts +1 -1
- package/dist/index.cjs.js +10 -10
- package/dist/index.es.js +51 -42
- package/dist/index.umd.js +10 -10
- package/package.json +3 -3
- package/pnpm-lock.yaml +6 -10
- package/src/App/AppProxy.ts +8 -3
- package/src/App/WhiteboardView.ts +2 -1
- package/src/AppManager.ts +2 -0
- package/src/BoxManager.ts +11 -7
- package/src/View/CameraSynchronizer.ts +3 -2
- package/src/index.ts +7 -8
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "1.0.0-canary.
|
3
|
+
"version": "1.0.0-canary.13",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.cjs.js",
|
6
6
|
"module": "dist/index.es.js",
|
@@ -23,13 +23,13 @@
|
|
23
23
|
},
|
24
24
|
"dependencies": {
|
25
25
|
"@juggle/resize-observer": "^3.3.1",
|
26
|
-
"@netless/telebox-insider": "1.0.0-alpha.
|
26
|
+
"@netless/telebox-insider": "1.0.0-alpha.16",
|
27
27
|
"emittery": "^0.9.2",
|
28
28
|
"lodash": "^4.17.21",
|
29
29
|
"p-retry": "^4.6.1",
|
30
30
|
"side-effect-manager": "^1.1.0",
|
31
31
|
"uuid": "^7.0.3",
|
32
|
-
"value-enhancer": "^1.
|
32
|
+
"value-enhancer": "^1.3.0",
|
33
33
|
"video.js": ">=7"
|
34
34
|
},
|
35
35
|
"devDependencies": {
|
package/pnpm-lock.yaml
CHANGED
@@ -4,7 +4,7 @@ specifiers:
|
|
4
4
|
'@juggle/resize-observer': ^3.3.1
|
5
5
|
'@netless/app-docs-viewer': ^0.2.9
|
6
6
|
'@netless/app-media-player': 0.1.0-beta.5
|
7
|
-
'@netless/telebox-insider': 1.0.0-alpha.
|
7
|
+
'@netless/telebox-insider': 1.0.0-alpha.16
|
8
8
|
'@rollup/plugin-commonjs': ^20.0.0
|
9
9
|
'@rollup/plugin-node-resolve': ^13.0.4
|
10
10
|
'@rollup/plugin-url': ^6.1.0
|
@@ -35,7 +35,7 @@ specifiers:
|
|
35
35
|
svelte: ^3.42.4
|
36
36
|
typescript: ^4.5.5
|
37
37
|
uuid: ^7.0.3
|
38
|
-
value-enhancer: ^1.
|
38
|
+
value-enhancer: ^1.3.0
|
39
39
|
video.js: '>=7'
|
40
40
|
vite: ^2.5.3
|
41
41
|
vitest: ^0.14.1
|
@@ -43,13 +43,13 @@ specifiers:
|
|
43
43
|
|
44
44
|
dependencies:
|
45
45
|
'@juggle/resize-observer': registry.npmmirror.com/@juggle/resize-observer/3.3.1
|
46
|
-
'@netless/telebox-insider': 1.0.0-alpha.
|
46
|
+
'@netless/telebox-insider': 1.0.0-alpha.16
|
47
47
|
emittery: registry.npmmirror.com/emittery/0.9.2
|
48
48
|
lodash: registry.npmmirror.com/lodash/4.17.21
|
49
49
|
p-retry: registry.npmmirror.com/p-retry/4.6.1
|
50
50
|
side-effect-manager: 1.1.0
|
51
51
|
uuid: registry.npmmirror.com/uuid/7.0.3
|
52
|
-
value-enhancer: 1.
|
52
|
+
value-enhancer: 1.3.0
|
53
53
|
video.js: registry.npmmirror.com/video.js/7.18.1
|
54
54
|
|
55
55
|
devDependencies:
|
@@ -97,8 +97,8 @@ packages:
|
|
97
97
|
vanilla-lazyload: 17.6.1
|
98
98
|
dev: true
|
99
99
|
|
100
|
-
/@netless/telebox-insider/1.0.0-alpha.
|
101
|
-
resolution: {integrity: sha512-
|
100
|
+
/@netless/telebox-insider/1.0.0-alpha.16:
|
101
|
+
resolution: {integrity: sha512-WoBhBMVXKqZuTYEhcDapYOX05ScvngcdCfcrc2fXHkH5PQxtWWwOc4G2X/stK8giHdlGlAkq+HdKTpQ1Ymn7Aw==}
|
102
102
|
dependencies:
|
103
103
|
'@juggle/resize-observer': 3.3.1
|
104
104
|
'@types/shallowequal': 1.1.1
|
@@ -1002,10 +1002,6 @@ packages:
|
|
1002
1002
|
engines: {node: '>= 4.0.0'}
|
1003
1003
|
dev: true
|
1004
1004
|
|
1005
|
-
/value-enhancer/1.2.1:
|
1006
|
-
resolution: {integrity: sha512-11IrGi9xmVbr3twzuaMRrdUGzhdaE4eXvT6qYZlB5VrhK5uQzSPlYOEBlsIGH+dMvkakNkWGNIbxdZi87/MWuQ==}
|
1007
|
-
dev: false
|
1008
|
-
|
1009
1005
|
/value-enhancer/1.3.0:
|
1010
1006
|
resolution: {integrity: sha512-shI9N5ML4MGwD6bMu/My1l1+REFqhZGOuIjDN5Gf+k7gACfY2k8WtJEcqgdZMfepwivfhQxIfZp0riobUDZpDQ==}
|
1011
1007
|
dev: false
|
package/src/App/AppProxy.ts
CHANGED
@@ -58,8 +58,8 @@ export class AppProxy implements PageRemoveService {
|
|
58
58
|
private stateKey: string;
|
59
59
|
public _pageState: AppPageStateImpl;
|
60
60
|
|
61
|
-
public appResult?: NetlessApp
|
62
|
-
public appContext?: AppContext
|
61
|
+
public appResult?: NetlessApp;
|
62
|
+
public appContext?: AppContext;
|
63
63
|
|
64
64
|
private sideEffectManager = new SideEffectManager();
|
65
65
|
private valManager = new ValManager();
|
@@ -563,6 +563,7 @@ export class AppProxy implements PageRemoveService {
|
|
563
563
|
const fullPath = this._pageState.getFullPath(index);
|
564
564
|
if (fullPath) {
|
565
565
|
this.setFullPath(fullPath);
|
566
|
+
setScenePath(this.manager.room, fullPath);
|
566
567
|
}
|
567
568
|
}
|
568
569
|
}
|
@@ -584,7 +585,7 @@ export class AppProxy implements PageRemoveService {
|
|
584
585
|
this.size$.setValue(iSize);
|
585
586
|
}
|
586
587
|
|
587
|
-
public moveCamera = (camera: Camera) => {
|
588
|
+
public moveCamera = (camera: Partial<Camera>) => {
|
588
589
|
if (!this.camera$.value) {
|
589
590
|
return;
|
590
591
|
}
|
@@ -664,6 +665,10 @@ export class AppProxy implements PageRemoveService {
|
|
664
665
|
, "size");
|
665
666
|
}
|
666
667
|
|
668
|
+
public onFocus = () => {
|
669
|
+
this.setScenePath();
|
670
|
+
}
|
671
|
+
|
667
672
|
public close(): Promise<void> {
|
668
673
|
return this.destroy(true, true, false);
|
669
674
|
}
|
@@ -23,13 +23,14 @@ export class WhiteBoardView implements PageController {
|
|
23
23
|
appProxy.appEmitter.on("pageStateChange", pageState => {
|
24
24
|
pageState$.setValue(pageState);
|
25
25
|
});
|
26
|
+
view.disableCameraTransform = true;
|
26
27
|
}
|
27
28
|
|
28
29
|
public get pageState() {
|
29
30
|
return this.pageState$.value;
|
30
31
|
}
|
31
32
|
|
32
|
-
public moveCamera(camera: Camera) {
|
33
|
+
public moveCamera(camera: Partial<Camera>) {
|
33
34
|
this.appProxy.moveCamera(camera);
|
34
35
|
}
|
35
36
|
|
package/src/AppManager.ts
CHANGED
@@ -448,6 +448,7 @@ export class AppManager {
|
|
448
448
|
setTimeout(() => {
|
449
449
|
const appProxy = this.appProxies.get(focused);
|
450
450
|
if (appProxy) {
|
451
|
+
appProxy.onFocus();
|
451
452
|
appRegister.notifyApp(appProxy.kind, "focus", { appId: focused });
|
452
453
|
}
|
453
454
|
}, 0);
|
@@ -657,6 +658,7 @@ export class AppManager {
|
|
657
658
|
if (sceneState) {
|
658
659
|
const scenePath = sceneState.scenePath;
|
659
660
|
this.appProxies.forEach(appProxy => {
|
661
|
+
console.log("scenePath", scenePath, appProxy.scenePath);
|
660
662
|
if (appProxy.scenePath && scenePath.startsWith(appProxy.scenePath)) {
|
661
663
|
appProxy.emitAppSceneStateChange(sceneState);
|
662
664
|
appProxy.setFullPath(scenePath);
|
package/src/BoxManager.ts
CHANGED
@@ -80,7 +80,7 @@ export const createBoxManager = (
|
|
80
80
|
setAppFocus: (appId: string) => manager.appManager?.store.setAppFocus(appId, true),
|
81
81
|
callbacks,
|
82
82
|
emitter,
|
83
|
-
boxEmitter
|
83
|
+
boxEmitter,
|
84
84
|
},
|
85
85
|
options
|
86
86
|
);
|
@@ -99,17 +99,17 @@ export class BoxManager {
|
|
99
99
|
this.teleBoxManager = this.setupBoxManager(createTeleBoxManagerConfig);
|
100
100
|
this.sideEffectManager.add(() => [
|
101
101
|
// 使用 _xxx$.reaction 订阅修改的值, 不管有没有 skipUpdate, 修改值都会触发回调
|
102
|
-
this.teleBoxManager.
|
102
|
+
this.teleBoxManager.onValChanged("state", state => {
|
103
103
|
callbacks.emit("boxStateChange", state);
|
104
104
|
emitter.emit("boxStateChange", state);
|
105
105
|
}),
|
106
|
-
this.teleBoxManager.
|
106
|
+
this.teleBoxManager.onValChanged("darkMode", darkMode => {
|
107
107
|
callbacks.emit("darkModeChange", darkMode);
|
108
108
|
}),
|
109
|
-
this.teleBoxManager.
|
109
|
+
this.teleBoxManager.onValChanged("prefersColorScheme", colorScheme => {
|
110
110
|
callbacks.emit("prefersColorSchemeChange", colorScheme);
|
111
111
|
}),
|
112
|
-
this.teleBoxManager.
|
112
|
+
this.teleBoxManager.onValChanged("minimized", (minimized, skipUpdate) => {
|
113
113
|
if (skipUpdate) {
|
114
114
|
return;
|
115
115
|
}
|
@@ -125,7 +125,7 @@ export class BoxManager {
|
|
125
125
|
}
|
126
126
|
}
|
127
127
|
}),
|
128
|
-
this.teleBoxManager.
|
128
|
+
this.teleBoxManager.onValChanged("maximized", (maximized, skipUpdate) => {
|
129
129
|
if (skipUpdate) {
|
130
130
|
return;
|
131
131
|
}
|
@@ -139,7 +139,11 @@ export class BoxManager {
|
|
139
139
|
this.teleBoxManager.events.on(
|
140
140
|
"intrinsic_move",
|
141
141
|
debounce((box: ReadonlyTeleBox): void => {
|
142
|
-
boxEmitter.emit("move", {
|
142
|
+
boxEmitter.emit("move", {
|
143
|
+
appId: box.id,
|
144
|
+
x: box.intrinsicX,
|
145
|
+
y: box.intrinsicY,
|
146
|
+
});
|
143
147
|
}, 50)
|
144
148
|
),
|
145
149
|
this.teleBoxManager.events.on(
|
@@ -19,7 +19,7 @@ export class CameraSynchronizer {
|
|
19
19
|
if (this.remoteCamera && this.remoteSize) {
|
20
20
|
this.onRemoteUpdate(this.remoteCamera, this.remoteSize);
|
21
21
|
}
|
22
|
-
},
|
22
|
+
}, 10);
|
23
23
|
|
24
24
|
public setView(view: View) {
|
25
25
|
this.view = view;
|
@@ -46,10 +46,11 @@ export class CameraSynchronizer {
|
|
46
46
|
animationMode: AnimationMode.Immediately,
|
47
47
|
});
|
48
48
|
}
|
49
|
+
moveCamera();
|
49
50
|
// TODO 直接调用 moveCamera 依然会出现 camera 错误的情况,这里暂时加一个 delay 保证 camera 是对的, 后续需要 SDK 进行修改
|
50
51
|
delay(moveCamera, 50);
|
51
52
|
}
|
52
|
-
},
|
53
|
+
}, 10);
|
53
54
|
|
54
55
|
public onRemoteSizeUpdate(size: ISize) {
|
55
56
|
if (this.rect) {
|
package/src/index.ts
CHANGED
@@ -179,7 +179,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
179
179
|
public static async mount(params: MountParams): Promise<WindowManager> {
|
180
180
|
const room = params.room;
|
181
181
|
WindowManager.container = params.container;
|
182
|
-
|
182
|
+
|
183
183
|
const debug = params.debug;
|
184
184
|
|
185
185
|
const cursor = params.cursor;
|
@@ -225,22 +225,21 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
225
225
|
throw new Error("[WindowManager]: create manager failed");
|
226
226
|
}
|
227
227
|
|
228
|
-
if (containerSizeRatio) {
|
229
|
-
WindowManager.containerSizeRatio = containerSizeRatio;
|
228
|
+
if (params.containerSizeRatio) {
|
229
|
+
WindowManager.containerSizeRatio = params.containerSizeRatio;
|
230
230
|
}
|
231
|
+
manager.containerSizeRatio = WindowManager.containerSizeRatio;
|
231
232
|
await manager.ensureAttributes();
|
232
233
|
|
233
234
|
manager.appManager = new AppManager(manager);
|
234
235
|
manager._pageState = new PageStateImpl(manager.appManager);
|
235
236
|
manager.cursorManager = new CursorManager(manager.appManager, Boolean(cursor), params.applianceIcons);
|
236
|
-
|
237
|
-
manager.containerSizeRatio = containerSizeRatio;
|
238
|
-
}
|
237
|
+
|
239
238
|
manager.boxManager = createBoxManager(manager, callbacks, emitter, boxEmitter, {
|
240
239
|
collectorContainer: params.collectorContainer,
|
241
240
|
collectorStyles: params.collectorStyles,
|
242
241
|
prefersColorScheme: params.prefersColorScheme,
|
243
|
-
stageRatio:
|
242
|
+
stageRatio: WindowManager.containerSizeRatio,
|
244
243
|
highlightStage: params.highlightStage
|
245
244
|
});
|
246
245
|
manager.appManager?.setBoxManager(manager.boxManager);
|
@@ -907,7 +906,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
907
906
|
if (WindowManager.container) {
|
908
907
|
this.bindContainer(WindowManager.container);
|
909
908
|
}
|
910
|
-
this.appManager?.refresher
|
909
|
+
this.appManager?.refresher.refresh();
|
911
910
|
}
|
912
911
|
|
913
912
|
public setContainerSizeRatio(ratio: number) {
|