@netless/window-manager 0.4.65 → 0.4.66
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 +3 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +116 -75
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/App/AppContext.ts +10 -0
- package/src/App/AppProxy.ts +1 -0
- package/src/index.ts +11 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "0.4.
|
3
|
+
"version": "0.4.66",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.js",
|
6
6
|
"module": "dist/index.mjs",
|
@@ -33,7 +33,7 @@
|
|
33
33
|
"video.js": ">=7"
|
34
34
|
},
|
35
35
|
"devDependencies": {
|
36
|
-
"@netless/app-docs-viewer": "^0.2.
|
36
|
+
"@netless/app-docs-viewer": "^0.2.17",
|
37
37
|
"@netless/app-media-player": "0.1.0-beta.5",
|
38
38
|
"@rollup/plugin-commonjs": "^20.0.0",
|
39
39
|
"@rollup/plugin-node-resolve": "^13.0.4",
|
package/src/App/AppContext.ts
CHANGED
@@ -28,6 +28,7 @@ import type {
|
|
28
28
|
MagixEventRemoveListener,
|
29
29
|
} from "./MagixEvent";
|
30
30
|
import type { AddPageParams, PageController, PageState } from "../Page";
|
31
|
+
import { internalEmitter } from "../InternalEmitter";
|
31
32
|
|
32
33
|
export class AppContext<TAttributes extends {} = any, TMagixEventPayloads = any, TAppOptions = any>
|
33
34
|
implements PageController
|
@@ -256,4 +257,13 @@ export class AppContext<TAttributes extends {} = any, TMagixEventPayloads = any,
|
|
256
257
|
public get pageState(): PageState {
|
257
258
|
return this.appProxy.pageState;
|
258
259
|
}
|
260
|
+
|
261
|
+
public get kind(): string {
|
262
|
+
return this.appProxy.kind;
|
263
|
+
}
|
264
|
+
|
265
|
+
/** Dispatch a local event to `manager.onAppEvent()`. */
|
266
|
+
public dispatchAppEvent(type: string, value?: any): void {
|
267
|
+
internalEmitter.emit(`custom-${this.kind}` as any, { kind: this.kind, appId: this.appId, type, value });
|
268
|
+
}
|
259
269
|
}
|
package/src/App/AppProxy.ts
CHANGED
@@ -372,6 +372,7 @@ export class AppProxy implements PageRemoveService {
|
|
372
372
|
const appState = this.appAttributes?.state;
|
373
373
|
if (appState?.zIndex > 0 && appState.zIndex !== this.box?.zIndex) {
|
374
374
|
this.boxManager?.setZIndex(appId, appState.zIndex);
|
375
|
+
this.boxManager?.focusBox({ appId });
|
375
376
|
}
|
376
377
|
});
|
377
378
|
});
|
package/src/index.ts
CHANGED
@@ -450,11 +450,12 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
|
|
450
450
|
for (const appId of apps) {
|
451
451
|
const appScenePath = appManager.store.getAppScenePath(appId);
|
452
452
|
if (appScenePath && appScenePath === scenePath) {
|
453
|
-
console.warn(`[WindowManager]: ScenePath ${scenePath}
|
453
|
+
console.warn(`[WindowManager]: ScenePath "${scenePath}" already opened`);
|
454
454
|
if (this.boxManager) {
|
455
455
|
const topBox = this.boxManager.getTopBox();
|
456
456
|
if (topBox) {
|
457
457
|
this.boxManager.setZIndex(appId, topBox.zIndex + 1, false);
|
458
|
+
this.boxManager.focusBox({ appId }, false);
|
458
459
|
}
|
459
460
|
}
|
460
461
|
return;
|
@@ -611,6 +612,15 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
|
|
611
612
|
addEmitterOnceListener(`destroy-${kind}`, listener);
|
612
613
|
}
|
613
614
|
|
615
|
+
/**
|
616
|
+
* app 本地自定义事件回调
|
617
|
+
*
|
618
|
+
* 返回一个用于撤销此监听的函数
|
619
|
+
*/
|
620
|
+
public onAppEvent(kind: string, listener: (args: { kind: string, appId: string, type: string, value: any }) => void): () => void {
|
621
|
+
return internalEmitter.on(`custom-${kind}` as any, listener);
|
622
|
+
}
|
623
|
+
|
614
624
|
/**
|
615
625
|
* 设置 ViewMode
|
616
626
|
*/
|