@netless/window-manager 1.0.12 → 1.0.13-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/dist/index.d.ts +5 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/App/AppProxy.ts +7 -1
- package/src/AppManager.ts +11 -6
- package/src/index.ts +11 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/window-manager",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.13-beta.0",
|
|
4
4
|
"description": "Multi-window mode for Netless Whiteboard",
|
|
5
5
|
"author": "l1shen <lishen1635@gmail.com> (https://github.com/l1shen)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
25
|
"jspdf": "2.5.1",
|
|
26
|
-
"white-web-sdk": "^2.16.
|
|
26
|
+
"white-web-sdk": "^2.16.53"
|
|
27
27
|
},
|
|
28
28
|
"peerDependenciesMeta": {
|
|
29
29
|
"jspdf": {
|
|
@@ -72,6 +72,6 @@
|
|
|
72
72
|
"typescript": "^4.5.5",
|
|
73
73
|
"vite": "^2.9.9",
|
|
74
74
|
"vitest": "^0.14.1",
|
|
75
|
-
"white-web-sdk": "^2.16.
|
|
75
|
+
"white-web-sdk": "^2.16.53"
|
|
76
76
|
}
|
|
77
77
|
}
|
package/src/App/AppProxy.ts
CHANGED
|
@@ -120,6 +120,10 @@ export class AppProxy implements PageRemoveService {
|
|
|
120
120
|
return this.store.getAppAttributes(this.id);
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
public get Logger() {
|
|
124
|
+
return this.manager.windowManger.Logger;
|
|
125
|
+
}
|
|
126
|
+
|
|
123
127
|
public getFullScenePath(): string | undefined {
|
|
124
128
|
if (this.scenePath) {
|
|
125
129
|
return get(this.appAttributes, [Fields.FullPath]) || this.getFullScenePathFromScenes();
|
|
@@ -145,6 +149,7 @@ export class AppProxy implements PageRemoveService {
|
|
|
145
149
|
): Promise<{ appId: string; app: NetlessApp }> {
|
|
146
150
|
const params = this.params;
|
|
147
151
|
if (!params.kind) {
|
|
152
|
+
this.Logger?.error(`[WindowManager]: kind require`);
|
|
148
153
|
throw new Error("[WindowManager]: kind require");
|
|
149
154
|
}
|
|
150
155
|
const appImpl = await appRegister.appClasses.get(params.kind)?.();
|
|
@@ -162,6 +167,7 @@ export class AppProxy implements PageRemoveService {
|
|
|
162
167
|
params.isDragContent
|
|
163
168
|
);
|
|
164
169
|
} else {
|
|
170
|
+
this.Logger?.error(`[WindowManager]: app load failed ${params.kind} ${params.src}`);
|
|
165
171
|
throw new Error(`[WindowManager]: app load failed ${params.kind} ${params.src}`);
|
|
166
172
|
}
|
|
167
173
|
internalEmitter.emit("updateManagerRect");
|
|
@@ -245,7 +251,7 @@ export class AppProxy implements PageRemoveService {
|
|
|
245
251
|
this.boxManager.focusBox({ appId }, false);
|
|
246
252
|
}
|
|
247
253
|
} catch (error: any) {
|
|
248
|
-
|
|
254
|
+
this.Logger?.error(`[WindowManager]: app setup error: ${error.message}`);
|
|
249
255
|
throw new Error(`[WindowManager]: app setup error: ${error.message}`);
|
|
250
256
|
}
|
|
251
257
|
}
|
package/src/AppManager.ts
CHANGED
|
@@ -94,11 +94,6 @@ export class AppManager {
|
|
|
94
94
|
|
|
95
95
|
constructor(public windowManger: WindowManager) {
|
|
96
96
|
this.displayer = windowManger.displayer;
|
|
97
|
-
// this.store.setContext({
|
|
98
|
-
// getAttributes: () => this.attributes,
|
|
99
|
-
// safeSetAttributes: attributes => this.safeSetAttributes(attributes),
|
|
100
|
-
// safeUpdateAttributes: (keys, val) => this.safeUpdateAttributes(keys, val),
|
|
101
|
-
// });
|
|
102
97
|
this.store = createAttributesDelegate(WindowManager.extendClass, {
|
|
103
98
|
getAttributes: () => this.attributes,
|
|
104
99
|
safeSetAttributes: attributes => this.safeSetAttributes(attributes),
|
|
@@ -333,6 +328,10 @@ export class AppManager {
|
|
|
333
328
|
return this.room?.uid || "";
|
|
334
329
|
}
|
|
335
330
|
|
|
331
|
+
public get Logger() {
|
|
332
|
+
return this.windowManger.Logger;
|
|
333
|
+
}
|
|
334
|
+
|
|
336
335
|
public getMainViewSceneDir() {
|
|
337
336
|
const scenePath = this.store.getMainViewScenePath();
|
|
338
337
|
if (scenePath) {
|
|
@@ -603,6 +602,7 @@ export class AppManager {
|
|
|
603
602
|
try {
|
|
604
603
|
const appAttributes = this.attributes[id];
|
|
605
604
|
if (!appAttributes) {
|
|
605
|
+
this.Logger?.error(`[WindowManager]: appAttributes is undefined, appId: ${id}`);
|
|
606
606
|
throw new Error("appAttributes is undefined");
|
|
607
607
|
}
|
|
608
608
|
|
|
@@ -725,6 +725,7 @@ export class AppManager {
|
|
|
725
725
|
|
|
726
726
|
public async addApp(params: AddAppParams, isDynamicPPT: boolean): Promise<string | undefined> {
|
|
727
727
|
log("addApp", params);
|
|
728
|
+
this.windowManger.Logger?.info(`[WindowManager]: addApp ${params.kind}, isDynamicPPT: ${isDynamicPPT}`);
|
|
728
729
|
const { appId, needFocus } = await this.beforeAddApp(params, isDynamicPPT);
|
|
729
730
|
const appProxy = await this.baseInsertApp(params, appId, true, needFocus);
|
|
730
731
|
this.afterAddApp(appProxy);
|
|
@@ -773,7 +774,7 @@ export class AppManager {
|
|
|
773
774
|
focus?: boolean
|
|
774
775
|
) {
|
|
775
776
|
if (this.appProxies.has(appId)) {
|
|
776
|
-
|
|
777
|
+
this.windowManger.Logger?.warn(`[WindowManager]: app duplicate exists and cannot be created again, appId: ${appId}`);
|
|
777
778
|
return;
|
|
778
779
|
}
|
|
779
780
|
const AppProxyClass = getExtendClass(AppProxy, WindowManager.extendClass);
|
|
@@ -784,6 +785,7 @@ export class AppManager {
|
|
|
784
785
|
return appProxy;
|
|
785
786
|
} else {
|
|
786
787
|
this.appStatus.delete(appId);
|
|
788
|
+
this.Logger?.error(`[WindowManager]: initialize AppProxy failed, appId: ${appId}`);
|
|
787
789
|
throw new Error("[WindowManger]: initialize AppProxy failed");
|
|
788
790
|
}
|
|
789
791
|
}
|
|
@@ -823,9 +825,11 @@ export class AppManager {
|
|
|
823
825
|
const scenePathType = this.displayer.scenePathType(scenePath);
|
|
824
826
|
const sceneDir = parseSceneDir(scenePath);
|
|
825
827
|
if (sceneDir !== ROOT_DIR) {
|
|
828
|
+
this.Logger?.error(`[WindowManager]: main view scenePath must in root dir "/"`);
|
|
826
829
|
throw new Error(`[WindowManager]: main view scenePath must in root dir "/"`);
|
|
827
830
|
}
|
|
828
831
|
if (scenePathType === ScenePathType.None) {
|
|
832
|
+
this.Logger?.error(`[WindowManager]: ${scenePath} not valid scene`);
|
|
829
833
|
throw new Error(`[WindowManager]: ${scenePath} not valid scene`);
|
|
830
834
|
} else if (scenePathType === ScenePathType.Page) {
|
|
831
835
|
await this._setMainViewScenePath(scenePath);
|
|
@@ -875,6 +879,7 @@ export class AppManager {
|
|
|
875
879
|
this.dispatchSetMainViewScenePath(scenePath);
|
|
876
880
|
}
|
|
877
881
|
} else {
|
|
882
|
+
this.Logger?.error(`[WindowManager]: ${index} not valid index`);
|
|
878
883
|
throw new Error(`[WindowManager]: ${index} not valid index`);
|
|
879
884
|
}
|
|
880
885
|
}
|
package/src/index.ts
CHANGED
|
@@ -47,6 +47,7 @@ import type {
|
|
|
47
47
|
Player,
|
|
48
48
|
ImageInformation,
|
|
49
49
|
SceneState,
|
|
50
|
+
Logger,
|
|
50
51
|
} from "white-web-sdk";
|
|
51
52
|
import type { AppListeners } from "./AppListener";
|
|
52
53
|
import type { ApplianceIcons, NetlessApp, RegisterParams } from "./typings";
|
|
@@ -242,6 +243,12 @@ export class WindowManager
|
|
|
242
243
|
|
|
243
244
|
private extendPluginManager?: ExtendPluginManager;
|
|
244
245
|
|
|
246
|
+
private _roomLogger?: Logger;
|
|
247
|
+
|
|
248
|
+
get Logger(): Logger | undefined {
|
|
249
|
+
return this._roomLogger;
|
|
250
|
+
}
|
|
251
|
+
|
|
245
252
|
constructor(context: InvisiblePluginContext) {
|
|
246
253
|
super(context);
|
|
247
254
|
WindowManager.displayer = context.displayer;
|
|
@@ -277,6 +284,10 @@ export class WindowManager
|
|
|
277
284
|
room.disableSerialization = false;
|
|
278
285
|
}
|
|
279
286
|
manager = await this.initManager(room);
|
|
287
|
+
if (manager) {
|
|
288
|
+
manager._roomLogger = (room as unknown as { logger: Logger }).logger;
|
|
289
|
+
}
|
|
290
|
+
|
|
280
291
|
}
|
|
281
292
|
if (WindowManager.isCreated) {
|
|
282
293
|
throw new Error("[WindowManager]: Already created cannot be created again");
|