@netless/window-manager 0.4.8 → 0.4.9-canary.2

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,8 @@
1
+ ## 0.4.8
2
+
3
+ 1. 升级 `@netless/telebox-insider` 至 `0.2.25`
4
+ 2. 修复关闭 app 时可能因为 app 报错导致关闭失败的问题
5
+
1
6
  ## 0.4.7
2
7
 
3
8
  1. 修改 `addPage` 接口
package/README.md CHANGED
@@ -6,6 +6,7 @@
6
6
  - [从白板迁移](docs/migrate.md)
7
7
  - [回放](docs/replay.md)
8
8
  - [进阶使用](docs/advanced.md)
9
+ - [开发自定义 APP](docs/develop-app.md)
9
10
  ## MainView
10
11
 
11
12
  `MainView` 也就是主白板, 是垫在所有窗口下面的主白板
@@ -1,4 +1,5 @@
1
- import { autorun, listenDisposed, listenUpdated, reaction, unlistenDisposed, unlistenUpdated, toJS } from 'white-web-sdk';
1
+ import { Storage } from "./App/Storage";
2
+ import { autorun, listenDisposed, listenUpdated, reaction, unlistenDisposed, unlistenUpdated, toJS } from "white-web-sdk";
2
3
  import type { Room, SceneDefinition, View } from "white-web-sdk";
3
4
  import type { ReadonlyTeleBox } from "@netless/telebox-insider";
4
5
  import type Emittery from "emittery";
@@ -6,8 +7,7 @@ import type { BoxManager } from "./BoxManager";
6
7
  import type { AppEmitterEvent } from "./index";
7
8
  import type { AppManager } from "./AppManager";
8
9
  import type { AppProxy } from "./AppProxy";
9
- import { Storage } from './App/Storage';
10
- import type { MagixEventAddListener, MagixEventDispatcher, MagixEventRemoveListener } from './App/MagixEvent';
10
+ import type { MagixEventAddListener, MagixEventDispatcher, MagixEventRemoveListener } from "./App/MagixEvent";
11
11
  export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOptions = any> {
12
12
  private manager;
13
13
  private boxManager;
@@ -46,7 +46,7 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
46
46
  /** @deprecated Use context.storage.setState instead. */
47
47
  updateAttributes: (keys: string[], value: any) => void;
48
48
  setScenePath: (scenePath: string) => Promise<void>;
49
- mountView: (dom: HTMLDivElement) => void;
49
+ mountView: (dom: HTMLElement) => void;
50
50
  /** Get the local App options. */
51
51
  getAppOptions: () => TAppOptions | undefined;
52
52
  private _storage?;
@@ -1,11 +1,11 @@
1
1
  import { AppStatus, Events } from "./constants";
2
2
  import { AppProxy } from "./AppProxy";
3
- import { WindowManager } from "./index";
4
3
  import { MainViewProxy } from "./View/MainView";
4
+ import { WindowManager } from "./index";
5
5
  import { ViewManager } from "./View/ViewManager";
6
6
  import type { ReconnectRefresher } from "./ReconnectRefresher";
7
7
  import type { BoxManager } from "./BoxManager";
8
- import type { Displayer, Room } from "white-web-sdk";
8
+ import type { Displayer, Room, SceneState } from "white-web-sdk";
9
9
  import type { AddAppParams, TeleBoxRect } from "./index";
10
10
  export declare class AppManager {
11
11
  windowManger: WindowManager;
@@ -25,6 +25,7 @@ export declare class AppManager {
25
25
  private callbacksNode;
26
26
  private appCreateQueue;
27
27
  private sideEffectManager;
28
+ sceneState: SceneState | null;
28
29
  constructor(windowManger: WindowManager);
29
30
  /**
30
31
  * 根目录被删除时所有的 scene 都会被删除.
@@ -32,6 +33,8 @@ export declare class AppManager {
32
33
  */
33
34
  private onRootDirRemoved;
34
35
  private createRootDirScenesCallback;
36
+ private onSceneChange;
37
+ private updateSceneState;
35
38
  private get eventName();
36
39
  get attributes(): import("./index").WindowMangerAttributes;
37
40
  get canOperate(): boolean;
@@ -1,11 +1,13 @@
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 { AddAppOptions, AppInitState, EmitterType, CallbacksType } from "./index";
4
+ import type { AddAppOptions, AppInitState } from "./index";
5
5
  import type { TeleBoxManagerUpdateConfig, ReadonlyTeleBox, TeleBoxColorScheme, TeleBoxRect, TeleBoxConfig } from "@netless/telebox-insider";
6
6
  import type Emittery from "emittery";
7
7
  import type { NetlessApp } from "./typings";
8
8
  import type { View } from "white-web-sdk";
9
+ import type { CallbacksType } from "./callback";
10
+ import type { EmitterType } from "./InternalEmitter";
9
11
  export { TELE_BOX_STATE };
10
12
  export declare type CreateBoxParams = {
11
13
  appId: string;
@@ -1,4 +1,4 @@
1
- import type { EmitterType } from "./index";
1
+ import type { EmitterType } from "./InternalEmitter";
2
2
  export declare class ContainerResizeObserver {
3
3
  private emitter;
4
4
  private containerResizeObserver?;
@@ -0,0 +1,41 @@
1
+ import Emittery from "emittery";
2
+ import type { AppInitState, CursorMovePayload } from "./index";
3
+ export declare type EmitterEvent = {
4
+ onCreated: undefined;
5
+ InitReplay: AppInitState;
6
+ move: {
7
+ appId: string;
8
+ x: number;
9
+ y: number;
10
+ };
11
+ focus: {
12
+ appId: string;
13
+ };
14
+ close: {
15
+ appId: string;
16
+ };
17
+ resize: {
18
+ appId: string;
19
+ width: number;
20
+ height: number;
21
+ x?: number;
22
+ y?: number;
23
+ };
24
+ error: Error;
25
+ seek: number;
26
+ mainViewMounted: undefined;
27
+ observerIdChange: number;
28
+ boxStateChange: string;
29
+ playgroundSizeChange: DOMRect;
30
+ onReconnected: void;
31
+ removeScenes: string;
32
+ cursorMove: CursorMovePayload;
33
+ updateManagerRect: undefined;
34
+ focusedChange: {
35
+ focused: string | undefined;
36
+ prev: string | undefined;
37
+ };
38
+ rootDirRemoved: undefined;
39
+ };
40
+ export declare type EmitterType = Emittery<EmitterEvent>;
41
+ export declare const emitter: EmitterType;
@@ -1,5 +1,5 @@
1
1
  import type { Room } from "white-web-sdk";
2
- import type { EmitterType } from "./index";
2
+ import type { EmitterType } from "./InternalEmitter";
3
3
  export declare type ReconnectRefresherContext = {
4
4
  emitter: EmitterType;
5
5
  };
@@ -4,8 +4,10 @@ export declare class AppCreateQueue {
4
4
  private list;
5
5
  private currentInvoker;
6
6
  private timer;
7
+ isEmit: boolean;
7
8
  private initInterval;
8
9
  push(item: Invoker): void;
9
10
  invoke(): void;
11
+ emitReady(): void;
10
12
  destroy(): void;
11
13
  }
@@ -1,4 +1,4 @@
1
- import type { PublicEvent } from "../index";
1
+ import type { PublicEvent } from "../callback";
2
2
  import type { Displayer, ViewVisionMode, Room, View } from "white-web-sdk";
3
3
  import type Emittery from "emittery";
4
4
  export declare const genAppId: (kind: string) => Promise<string>;
@@ -0,0 +1,22 @@
1
+ import Emittery from "emittery";
2
+ import type { TeleBoxColorScheme, TELE_BOX_STATE } from "@netless/telebox-insider";
3
+ import type { CameraState, SceneState, ViewVisionMode } from "white-web-sdk";
4
+ import type { LoadAppEvent } from "./Register";
5
+ export declare type PublicEvent = {
6
+ mainViewModeChange: ViewVisionMode;
7
+ boxStateChange: `${TELE_BOX_STATE}`;
8
+ darkModeChange: boolean;
9
+ prefersColorSchemeChange: TeleBoxColorScheme;
10
+ cameraStateChange: CameraState;
11
+ mainViewScenePathChange: string;
12
+ mainViewSceneIndexChange: number;
13
+ focusedChange: string | undefined;
14
+ mainViewScenesLengthChange: number;
15
+ canRedoStepsChange: number;
16
+ canUndoStepsChange: number;
17
+ loadApp: LoadAppEvent;
18
+ ready: undefined;
19
+ sceneStateChange: SceneState;
20
+ };
21
+ export declare type CallbacksType = Emittery<PublicEvent>;
22
+ export declare const callbacks: CallbacksType;
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
- import Emittery from "emittery";
2
1
  import { AppManager } from "./AppManager";
3
2
  import { CursorManager } from "./Cursor";
4
3
  import { InvisiblePlugin, ViewMode } from "white-web-sdk";
@@ -6,14 +5,15 @@ import { ReconnectRefresher } from "./ReconnectRefresher";
6
5
  import "video.js/dist/video-js.css";
7
6
  import "./style.css";
8
7
  import "@netless/telebox-insider/dist/style.css";
9
- import type { LoadAppEvent } from "./Register";
10
8
  import type { TELE_BOX_STATE } from "./BoxManager";
11
9
  import type { Apps, Position } from "./AttributesDelegate";
12
- import type { Displayer, SceneDefinition, View, Room, InvisiblePluginContext, Camera, AnimationMode, CameraBound, Point, Rectangle, ViewVisionMode, CameraState, Player, ImageInformation } from "white-web-sdk";
10
+ import type { Displayer, SceneDefinition, View, Room, InvisiblePluginContext, Camera, AnimationMode, CameraBound, Point, Rectangle, CameraState, Player, ImageInformation, SceneState } from "white-web-sdk";
13
11
  import type { AppListeners } from "./AppListener";
14
12
  import type { NetlessApp, RegisterParams } from "./typings";
15
13
  import type { TeleBoxColorScheme, TeleBoxState } from "@netless/telebox-insider";
16
14
  import type { AppProxy } from "./AppProxy";
15
+ import type { PublicEvent } from "./Callback";
16
+ import type Emittery from "emittery";
17
17
  export declare type WindowMangerAttributes = {
18
18
  modelValue?: string;
19
19
  boxState: TELE_BOX_STATE;
@@ -72,59 +72,6 @@ export declare type CursorMovePayload = {
72
72
  state?: "leave";
73
73
  position: Position;
74
74
  };
75
- export declare type EmitterEvent = {
76
- onCreated: undefined;
77
- InitReplay: AppInitState;
78
- move: {
79
- appId: string;
80
- x: number;
81
- y: number;
82
- };
83
- focus: {
84
- appId: string;
85
- };
86
- close: {
87
- appId: string;
88
- };
89
- resize: {
90
- appId: string;
91
- width: number;
92
- height: number;
93
- x?: number;
94
- y?: number;
95
- };
96
- error: Error;
97
- seek: number;
98
- mainViewMounted: undefined;
99
- observerIdChange: number;
100
- boxStateChange: string;
101
- playgroundSizeChange: DOMRect;
102
- onReconnected: void;
103
- removeScenes: string;
104
- cursorMove: CursorMovePayload;
105
- updateManagerRect: undefined;
106
- focusedChange: {
107
- focused: string | undefined;
108
- prev: string | undefined;
109
- };
110
- rootDirRemoved: undefined;
111
- };
112
- export declare type EmitterType = Emittery<EmitterEvent>;
113
- export declare const emitter: EmitterType;
114
- export declare type PublicEvent = {
115
- mainViewModeChange: ViewVisionMode;
116
- boxStateChange: `${TELE_BOX_STATE}`;
117
- darkModeChange: boolean;
118
- prefersColorSchemeChange: TeleBoxColorScheme;
119
- cameraStateChange: CameraState;
120
- mainViewScenePathChange: string;
121
- mainViewSceneIndexChange: number;
122
- focusedChange: string | undefined;
123
- mainViewScenesLengthChange: number;
124
- canRedoStepsChange: number;
125
- canUndoStepsChange: number;
126
- loadApp: LoadAppEvent;
127
- };
128
75
  export declare type MountParams = {
129
76
  room: Room | Player;
130
77
  container?: HTMLElement;
@@ -140,8 +87,6 @@ export declare type MountParams = {
140
87
  disableCameraTransform?: boolean;
141
88
  prefersColorScheme?: TeleBoxColorScheme;
142
89
  };
143
- export declare type CallbacksType = Emittery<PublicEvent>;
144
- export declare const callbacks: CallbacksType;
145
90
  export declare const reconnectRefresher: ReconnectRefresher;
146
91
  export declare type AddPageParams = {
147
92
  after?: boolean;
@@ -172,6 +117,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
172
117
  static mount(params: MountParams): Promise<WindowManager>;
173
118
  private static initManager;
174
119
  private static initContainer;
120
+ static get registered(): Map<string, RegisterParams<any, any, any>>;
175
121
  bindContainer(container: HTMLElement): void;
176
122
  bindCollectorContainer(container: HTMLElement): void;
177
123
  /**
@@ -236,6 +182,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
236
182
  get mainViewScenesLength(): number;
237
183
  get canRedoSteps(): number;
238
184
  get canUndoSteps(): number;
185
+ get sceneState(): SceneState;
239
186
  /**
240
187
  * 查询所有的 App
241
188
  */