@netless/window-manager 0.4.25 → 0.4.27

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,13 @@
1
+ ## 0.4.27 (2022-06-07)
2
+
3
+ - 添加 `removePage` API
4
+ - `storage` 仅在第一次时设置默认状态
5
+
6
+ ## 0.4.26
7
+
8
+ 1. 修复 `app` 中 `pageStateChange` 事件被多次触发的问题
9
+ 2. 修复重连之后 `mainView` 显示错误的内容的问题
10
+
1
11
  ## 0.4.25
2
12
 
3
13
  1. 添加 `setContainerSizeRatio` 方法, 用于初始化后更新 `containerSizeRatio`
@@ -36,6 +36,7 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
36
36
  getAttributes: () => TAttributes | undefined;
37
37
  getScenes: () => SceneDefinition[] | undefined;
38
38
  getView: () => View | undefined;
39
+ mountView: (dom: HTMLElement) => void;
39
40
  getInitScenePath: () => string | undefined;
40
41
  /** Get App writable status. */
41
42
  getIsWritable: () => boolean;
@@ -47,7 +48,6 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
47
48
  /** @deprecated Use context.storage.setState instead. */
48
49
  updateAttributes: (keys: string[], value: any) => void;
49
50
  setScenePath: (scenePath: string) => Promise<void>;
50
- mountView: (dom: HTMLElement) => void;
51
51
  /** Get the local App options. */
52
52
  getAppOptions: () => TAppOptions | undefined;
53
53
  private _storage?;
@@ -70,5 +70,6 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
70
70
  nextPage: () => Promise<boolean>;
71
71
  prevPage: () => Promise<boolean>;
72
72
  addPage: (params?: AddPageParams | undefined) => Promise<void>;
73
+ removePage: (index: number) => Promise<boolean>;
73
74
  get pageState(): PageState;
74
75
  }
@@ -5,9 +5,9 @@ import type { SceneState, View, SceneDefinition } from "white-web-sdk";
5
5
  import type { AppManager } from "../AppManager";
6
6
  import type { NetlessApp } from "../typings";
7
7
  import type { ReadonlyTeleBox } from "@netless/telebox-insider";
8
- import type { PageState } from "../Page";
8
+ import { PageRemoveService, PageState } from "../Page";
9
9
  export declare type AppEmitter = Emittery<AppEmitterEvent>;
10
- export declare class AppProxy {
10
+ export declare class AppProxy implements PageRemoveService {
11
11
  private params;
12
12
  private manager;
13
13
  kind: string;
@@ -24,6 +24,7 @@ export declare class AppProxy {
24
24
  private status;
25
25
  private stateKey;
26
26
  private _pageState;
27
+ private _prevFullPath;
27
28
  appResult?: NetlessApp<any>;
28
29
  appContext?: AppContext<any, any>;
29
30
  constructor(params: BaseInsertParams, manager: AppManager, appId: string, isAddApp: boolean);
@@ -46,6 +47,7 @@ export declare class AppProxy {
46
47
  private afterSetupApp;
47
48
  onSeek(time: number): Promise<void>;
48
49
  onReconnected(): Promise<void>;
50
+ onRemoveScene(scenePath: string): Promise<void>;
49
51
  getAppInitState: (id: string) => AppInitState | undefined;
50
52
  emitAppSceneStateChange(sceneState: SceneState): void;
51
53
  emitAppIsWritableChange(): void;
@@ -55,8 +57,10 @@ export declare class AppProxy {
55
57
  setScenePath(): void;
56
58
  setViewFocusScenePath(): string | undefined;
57
59
  private createView;
58
- notifyPageStateChange: () => void;
60
+ notifyPageStateChange: import("lodash").DebouncedFunc<() => void>;
59
61
  get pageState(): PageState;
62
+ removeSceneByIndex(index: number): Promise<boolean>;
63
+ setSceneIndexWithoutSync(index: number): void;
60
64
  setSceneIndex(index: number): void;
61
65
  destroy(needCloseBox: boolean, cleanAttrs: boolean, skipUpdate: boolean, error?: Error): Promise<void>;
62
66
  close(): Promise<void>;
@@ -17,4 +17,5 @@ export declare class AppListeners {
17
17
  private rootDirRemovedHandler;
18
18
  private refreshHandler;
19
19
  private initMainViewCameraHandler;
20
+ private setAppFocusViewIndexHandler;
20
21
  }
@@ -38,6 +38,8 @@ export declare class AppManager {
38
38
  private onPlayerSeekStart;
39
39
  private onPlayerSeekDone;
40
40
  createRootDirScenesCallback: () => void;
41
+ removeSceneByIndex: (index: number) => Promise<boolean>;
42
+ setSceneIndexWithoutSync: (index: number) => void;
41
43
  private onSceneChange;
42
44
  private emitMainViewScenesChange;
43
45
  private updateSceneState;
@@ -1,5 +1,9 @@
1
1
  import Emittery from "emittery";
2
2
  import type { AppInitState, CursorMovePayload } from "./index";
3
+ export declare type RemoveSceneParams = {
4
+ scenePath: string;
5
+ index?: number;
6
+ };
3
7
  export declare type EmitterEvent = {
4
8
  onCreated: undefined;
5
9
  InitReplay: AppInitState;
@@ -28,8 +32,9 @@ export declare type EmitterEvent = {
28
32
  observerIdChange: number;
29
33
  boxStateChange: string;
30
34
  playgroundSizeChange: DOMRect;
31
- onReconnected: void;
32
- removeScenes: string;
35
+ startReconnect: undefined;
36
+ onReconnected: undefined;
37
+ removeScenes: RemoveSceneParams;
33
38
  cursorMove: CursorMovePayload;
34
39
  updateManagerRect: undefined;
35
40
  focusedChange: {
@@ -11,5 +11,10 @@ export interface PageController {
11
11
  nextPage: () => Promise<boolean>;
12
12
  prevPage: () => Promise<boolean>;
13
13
  addPage: (params?: AddPageParams) => Promise<void>;
14
+ removePage: (index: number) => Promise<boolean>;
14
15
  pageState: PageState;
15
16
  }
17
+ export interface PageRemoveService {
18
+ removeSceneByIndex: (index: number) => Promise<boolean>;
19
+ setSceneIndexWithoutSync: (index: number) => void;
20
+ }
@@ -1 +1,3 @@
1
+ import type { PageState } from "./PageController";
1
2
  export * from "./PageController";
3
+ export declare const calculateNextIndex: (index: number, pageState: PageState) => number;
@@ -6,7 +6,7 @@ export declare const setViewFocusScenePath: (view: View, focusScenePath: string)
6
6
  export declare const setViewSceneIndex: (view: View, index: number) => View | undefined;
7
7
  export declare const setScenePath: (room: Room | undefined, scenePath: string) => void;
8
8
  export declare const getScenePath: (room: Room | undefined, dir: string | undefined, index: number) => string | undefined;
9
- export declare const removeScenes: (room: Room | undefined, scenePath: string) => void;
9
+ export declare const removeScenes: (room: Room | undefined, scenePath: string, index?: number | undefined) => void;
10
10
  export declare const setViewMode: (view: View, mode: ViewVisionMode) => void;
11
11
  export declare const emitError: (error: Error) => void;
12
12
  export declare const addEmitterOnceListener: (event: any, listener: any) => void;
@@ -19,3 +19,4 @@ export declare const parseSceneDir: (scenePath: string) => string;
19
19
  export declare const ensureValidScenePath: (scenePath: string) => string;
20
20
  export declare const getVersionNumber: (version: string) => number;
21
21
  export declare const wait: (time: number) => Promise<unknown>;
22
+ export declare const isRootDirPage: (scenePath: string) => boolean;
@@ -22,3 +22,6 @@ export declare class InvalidScenePath extends Error {
22
22
  export declare class BoxManagerNotFoundError extends Error {
23
23
  message: string;
24
24
  }
25
+ export declare class BindContainerRoomPhaseInvalidError extends Error {
26
+ message: string;
27
+ }
@@ -13,6 +13,7 @@ export declare class MainViewProxy {
13
13
  ensureCameraAndSize(): void;
14
14
  private get mainViewCamera();
15
15
  private get mainViewSize();
16
+ private get didRelease();
16
17
  private moveCameraSizeByAttributes;
17
18
  start(): void;
18
19
  addCameraReaction: () => void;
@@ -30,6 +31,7 @@ export declare class MainViewProxy {
30
31
  };
31
32
  createMainView(): View;
32
33
  onReconnect(): void;
34
+ setFocusScenePath(path: string | undefined): View | undefined;
33
35
  rebind(): void;
34
36
  private onCameraUpdatedByDevice;
35
37
  addMainViewListener(): void;
@@ -9,6 +9,7 @@ export declare enum Events {
9
9
  WindowCreated = "WindowCreated",
10
10
  SetMainViewScenePath = "SetMainViewScenePath",
11
11
  SetMainViewSceneIndex = "SetMainViewSceneIndex",
12
+ SetAppFocusIndex = "SetAppFocusIndex",
12
13
  SwitchViewsToFreedom = "SwitchViewsToFreedom",
13
14
  MoveCamera = "MoveCamera",
14
15
  MoveCameraToContain = "MoveCameraToContain",