@netless/window-manager 0.4.30 → 0.4.31

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.4.31 (2022-06-09)
2
+
3
+ - 修复: `bindContainer` 在回放模式下直接抛出错误的问题
4
+
1
5
  ## 0.4.30 (2022-06-08)
2
6
 
3
7
  - 重构: removePage 在 resolve 之后可以立即查询到正确的状态
@@ -52,6 +52,11 @@ export declare class AppManager {
52
52
  get uid(): string;
53
53
  getMainViewSceneDir(): string;
54
54
  private onCreated;
55
+ private onBoxMove;
56
+ private onBoxResize;
57
+ private onBoxFocus;
58
+ private onBoxClose;
59
+ private onBoxStateChange;
55
60
  addAppsChangeListener: () => void;
56
61
  addAppCloseListener: () => void;
57
62
  private onMainViewIndexChange;
@@ -91,7 +96,6 @@ export declare class AppManager {
91
96
  private dispatchSetMainViewScenePath;
92
97
  getAppInitPath(appId: string): string | undefined;
93
98
  safeDispatchMagixEvent(event: string, payload: any): void;
94
- private boxEventListener;
95
99
  focusByAttributes(apps: any): void;
96
100
  onReconnected(): Promise<void>;
97
101
  notifyContainerRectUpdate(rect: TeleBoxRect): void;
@@ -0,0 +1,34 @@
1
+ import type { TELE_BOX_STATE } from "@netless/telebox-insider";
2
+ import Emittery from "emittery";
3
+ export declare type BoxMovePayload = {
4
+ appId: string;
5
+ x: number;
6
+ y: number;
7
+ };
8
+ export declare type BoxFocusPayload = {
9
+ appId: string;
10
+ };
11
+ export declare type BoxResizePayload = {
12
+ appId: string;
13
+ width: number;
14
+ height: number;
15
+ x?: number;
16
+ y?: number;
17
+ };
18
+ export declare type BoxClosePayload = {
19
+ appId: string;
20
+ error?: Error;
21
+ };
22
+ export declare type BoxStateChangePayload = {
23
+ appId: string;
24
+ state: TELE_BOX_STATE;
25
+ };
26
+ export declare type BoxEvent = {
27
+ move: BoxMovePayload;
28
+ focus: BoxFocusPayload;
29
+ resize: BoxResizePayload;
30
+ close: BoxClosePayload;
31
+ boxStateChange: BoxStateChangePayload;
32
+ };
33
+ export declare type BoxEmitterType = Emittery<BoxEvent>;
34
+ export declare const boxEmitter: BoxEmitterType;
@@ -1,6 +1,7 @@
1
1
  import { AppAttributes } from "./constants";
2
2
  import { TELE_BOX_STATE, TeleBoxManager } from "@netless/telebox-insider";
3
3
  import { WindowManager } from "./index";
4
+ import type { BoxEmitterType } from "./BoxEmitter";
4
5
  import type { AddAppOptions, AppInitState } from "./index";
5
6
  import type { TeleBoxManagerUpdateConfig, ReadonlyTeleBox, TeleBoxColorScheme, TeleBoxRect, TeleBoxConfig } from "@netless/telebox-insider";
6
7
  import type Emittery from "emittery";
@@ -47,13 +48,14 @@ export declare type BoxManagerContext = {
47
48
  getMainView: () => View;
48
49
  updateAppState: (appId: string, field: AppAttributes, value: any) => void;
49
50
  emitter: EmitterType;
51
+ boxEmitter: BoxEmitterType;
50
52
  callbacks: CallbacksType;
51
53
  canOperate: () => boolean;
52
54
  notifyContainerRectUpdate: (rect: TeleBoxRect) => void;
53
55
  cleanFocus: () => void;
54
56
  setAppFocus: (appId: string) => void;
55
57
  };
56
- export declare const createBoxManager: (manager: WindowManager, callbacks: CallbacksType, emitter: EmitterType, options: CreateTeleBoxManagerConfig) => BoxManager;
58
+ export declare const createBoxManager: (manager: WindowManager, callbacks: CallbacksType, emitter: EmitterType, boxEmitter: BoxEmitterType, options: CreateTeleBoxManagerConfig) => BoxManager;
57
59
  export declare class BoxManager {
58
60
  private context;
59
61
  private createTeleBoxManagerConfig?;
@@ -7,24 +7,6 @@ export declare type RemoveSceneParams = {
7
7
  export declare type EmitterEvent = {
8
8
  onCreated: undefined;
9
9
  InitReplay: AppInitState;
10
- move: {
11
- appId: string;
12
- x: number;
13
- y: number;
14
- };
15
- focus: {
16
- appId: string;
17
- };
18
- close: {
19
- appId: string;
20
- };
21
- resize: {
22
- appId: string;
23
- width: number;
24
- height: number;
25
- x?: number;
26
- y?: number;
27
- };
28
10
  error: Error;
29
11
  seekStart: undefined;
30
12
  seek: number;
@@ -1,12 +1,11 @@
1
- import type { AppProxy } from "../App";
2
- export declare type Invoker = () => Promise<AppProxy | undefined>;
1
+ export declare type Invoker<T = any> = () => Promise<T | undefined>;
3
2
  export declare class AppCreateQueue {
4
3
  private list;
5
4
  private currentInvoker;
6
5
  private timer;
7
6
  isEmit: boolean;
8
7
  private initInterval;
9
- push(item: Invoker): void;
8
+ push<T>(item: Invoker<T>): void;
10
9
  invoke(): void;
11
10
  private invoked;
12
11
  private clear;