@netless/window-manager 0.4.17 → 0.4.20
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 +12 -0
- package/README.md +9 -3
- package/dist/{AppContext.d.ts → App/AppContext.d.ts} +12 -6
- package/dist/App/AppPageStateImpl.d.ts +17 -0
- package/dist/{AppProxy.d.ts → App/AppProxy.d.ts} +15 -7
- package/dist/App/Storage/index.d.ts +1 -1
- package/dist/App/index.d.ts +2 -0
- package/dist/AppManager.d.ts +1 -1
- package/dist/Page/PageController.d.ts +15 -0
- package/dist/Page/index.d.ts +1 -0
- package/dist/PageState.d.ts +1 -4
- package/dist/RedoUndo.d.ts +1 -1
- package/dist/Utils/AppCreateQueue.d.ts +1 -1
- package/dist/Utils/Common.d.ts +1 -1
- package/dist/callback.d.ts +1 -1
- package/dist/index.d.ts +4 -8
- package/dist/index.es.js +15403 -5
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +46 -41
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/typings.d.ts +5 -2
- package/docs/app-context.md +46 -1
- package/docs/develop-app.md +4 -0
- package/jest.config.js +27 -0
- package/package.json +11 -3
- package/pnpm-lock.yaml +8176 -0
- package/src/{AppContext.ts → App/AppContext.ts} +49 -7
- package/src/App/AppPageStateImpl.ts +49 -0
- package/src/{AppProxy.ts → App/AppProxy.ts} +57 -17
- package/src/App/Storage/index.ts +1 -1
- package/src/App/index.ts +2 -0
- package/src/AppManager.ts +1 -1
- package/src/Page/PageController.ts +18 -0
- package/src/Page/index.ts +1 -0
- package/src/PageState.ts +2 -6
- package/src/RedoUndo.ts +1 -1
- package/src/Utils/AppCreateQueue.ts +3 -3
- package/src/Utils/Common.ts +2 -2
- package/src/View/MainView.ts +4 -2
- package/src/callback.ts +1 -1
- package/src/index.ts +4 -9
- package/src/typings.ts +5 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
@@ -1,14 +1,15 @@
|
|
1
|
-
import { Storage } from "./
|
1
|
+
import { Storage } from "./Storage";
|
2
2
|
import { autorun, listenDisposed, listenUpdated, reaction, unlistenDisposed, unlistenUpdated, toJS } from "white-web-sdk";
|
3
3
|
import type { Room, SceneDefinition, View } from "white-web-sdk";
|
4
4
|
import type { ReadonlyTeleBox } from "@netless/telebox-insider";
|
5
5
|
import type Emittery from "emittery";
|
6
|
-
import type { BoxManager } from "
|
7
|
-
import type { AppEmitterEvent } from "
|
8
|
-
import type { AppManager } from "
|
6
|
+
import type { BoxManager } from "../BoxManager";
|
7
|
+
import type { AppEmitterEvent } from "../index";
|
8
|
+
import type { AppManager } from "../AppManager";
|
9
9
|
import type { AppProxy } from "./AppProxy";
|
10
|
-
import type { MagixEventAddListener, MagixEventDispatcher, MagixEventRemoveListener } from "./
|
11
|
-
|
10
|
+
import type { MagixEventAddListener, MagixEventDispatcher, MagixEventRemoveListener } from "./MagixEvent";
|
11
|
+
import type { AddPageParams, PageController, PageState } from "../Page";
|
12
|
+
export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOptions = any> implements PageController {
|
12
13
|
private manager;
|
13
14
|
private boxManager;
|
14
15
|
appId: string;
|
@@ -65,4 +66,9 @@ export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TA
|
|
65
66
|
addMagixEventListener: MagixEventAddListener<TMagixEventPayloads>;
|
66
67
|
/** Remove a Magix event listener. */
|
67
68
|
removeMagixEventListener: MagixEventRemoveListener<TMagixEventPayloads>;
|
69
|
+
/** PageController */
|
70
|
+
nextPage: () => Promise<boolean>;
|
71
|
+
prevPage: () => Promise<boolean>;
|
72
|
+
addPage: (params?: AddPageParams | undefined) => Promise<void>;
|
73
|
+
get pageState(): PageState;
|
68
74
|
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import type { Displayer, View } from "white-web-sdk";
|
2
|
+
import type { PageState } from "../Page";
|
3
|
+
export declare type AppPageStateParams = {
|
4
|
+
displayer: Displayer;
|
5
|
+
scenePath: string | undefined;
|
6
|
+
view: View | undefined;
|
7
|
+
notifyPageStateChange: () => void;
|
8
|
+
};
|
9
|
+
export declare class AppPageStateImpl {
|
10
|
+
private params;
|
11
|
+
private sceneNode;
|
12
|
+
constructor(params: AppPageStateParams);
|
13
|
+
private onSceneChange;
|
14
|
+
getFullPath(index: number): string | undefined;
|
15
|
+
toObject(): PageState;
|
16
|
+
destroy(): void;
|
17
|
+
}
|
@@ -1,16 +1,19 @@
|
|
1
1
|
import Emittery from "emittery";
|
2
|
-
import
|
2
|
+
import { AppContext } from "./AppContext";
|
3
|
+
import type { AppEmitterEvent, AppInitState, BaseInsertParams } from "../index";
|
3
4
|
import type { SceneState, View, SceneDefinition } from "white-web-sdk";
|
4
|
-
import type { AppManager } from "
|
5
|
-
import type { NetlessApp } from "
|
5
|
+
import type { AppManager } from "../AppManager";
|
6
|
+
import type { NetlessApp } from "../typings";
|
6
7
|
import type { ReadonlyTeleBox } from "@netless/telebox-insider";
|
8
|
+
import type { PageState } from "../Page";
|
9
|
+
export declare type AppEmitter = Emittery<AppEmitterEvent>;
|
7
10
|
export declare class AppProxy {
|
8
11
|
private params;
|
9
12
|
private manager;
|
10
13
|
kind: string;
|
11
14
|
id: string;
|
12
15
|
scenePath?: string;
|
13
|
-
appEmitter:
|
16
|
+
appEmitter: AppEmitter;
|
14
17
|
scenes?: SceneDefinition[];
|
15
18
|
private appListener;
|
16
19
|
private boxManager;
|
@@ -20,14 +23,16 @@ export declare class AppProxy {
|
|
20
23
|
isAddApp: boolean;
|
21
24
|
private status;
|
22
25
|
private stateKey;
|
23
|
-
private
|
24
|
-
|
26
|
+
private _pageState;
|
27
|
+
appResult?: NetlessApp<any>;
|
28
|
+
appContext?: AppContext<any, any>;
|
25
29
|
constructor(params: BaseInsertParams, manager: AppManager, appId: string, isAddApp: boolean);
|
26
30
|
private initScenes;
|
27
31
|
get view(): View | undefined;
|
32
|
+
get viewIndex(): number | undefined;
|
28
33
|
get isWritable(): boolean;
|
29
34
|
get attributes(): any;
|
30
|
-
get appAttributes(): import("
|
35
|
+
get appAttributes(): import("../index").AppSyncAttributes;
|
31
36
|
getFullScenePath(): string | undefined;
|
32
37
|
private getFullScenePathFromScenes;
|
33
38
|
setFullPath(path: string): void;
|
@@ -50,6 +55,9 @@ export declare class AppProxy {
|
|
50
55
|
setScenePath(): void;
|
51
56
|
setViewFocusScenePath(): string | undefined;
|
52
57
|
private createView;
|
58
|
+
notifyPageStateChange: () => void;
|
59
|
+
get pageState(): PageState;
|
60
|
+
setSceneIndex(index: number): void;
|
53
61
|
destroy(needCloseBox: boolean, cleanAttrs: boolean, skipUpdate: boolean, error?: Error): Promise<void>;
|
54
62
|
close(): Promise<void>;
|
55
63
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import type { AppContext } from "
|
1
|
+
import type { AppContext } from "../AppContext";
|
2
2
|
import type { Diff, StorageStateChangedListener, StorageStateChangedListenerDisposer } from "./typings";
|
3
3
|
import { StorageEvent } from "./StorageEvent";
|
4
4
|
export * from './typings';
|
package/dist/AppManager.d.ts
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
import { AppStatus, Events } from "./constants";
|
2
|
-
import { AppProxy } from "./
|
2
|
+
import { AppProxy } from "./App";
|
3
3
|
import { MainViewProxy } from "./View/MainView";
|
4
4
|
import { WindowManager } from "./index";
|
5
5
|
import { ViewManager } from "./View/ViewManager";
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import type { SceneDefinition } from "white-web-sdk";
|
2
|
+
export declare type AddPageParams = {
|
3
|
+
after?: boolean;
|
4
|
+
scene?: SceneDefinition;
|
5
|
+
};
|
6
|
+
export declare type PageState = {
|
7
|
+
index: number;
|
8
|
+
length: number;
|
9
|
+
};
|
10
|
+
export interface PageController {
|
11
|
+
nextPage: () => Promise<boolean>;
|
12
|
+
prevPage: () => Promise<boolean>;
|
13
|
+
addPage: (params?: AddPageParams) => Promise<void>;
|
14
|
+
pageState: PageState;
|
15
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
export * from "./PageController";
|
package/dist/PageState.d.ts
CHANGED
package/dist/RedoUndo.d.ts
CHANGED
package/dist/Utils/Common.d.ts
CHANGED
@@ -13,7 +13,7 @@ export declare const addEmitterOnceListener: (event: any, listener: any) => void
|
|
13
13
|
export declare const notifyMainViewModeChange: import("lodash").DebouncedFunc<(callbacks: Emittery<PublicEvent>, mode: ViewVisionMode) => void>;
|
14
14
|
export declare const makeValidScenePath: (displayer: Displayer, scenePath: string, index?: number) => string | undefined;
|
15
15
|
export declare const entireScenes: (displayer: Displayer) => import("white-web-sdk").SceneMap;
|
16
|
-
export declare const putScenes: (room: Room | undefined, path: string, scenes: SceneDefinition[]) => void | undefined;
|
16
|
+
export declare const putScenes: (room: Room | undefined, path: string, scenes: SceneDefinition[], index?: number | undefined) => void | undefined;
|
17
17
|
export declare const isValidScenePath: (scenePath: string) => boolean;
|
18
18
|
export declare const parseSceneDir: (scenePath: string) => string;
|
19
19
|
export declare const ensureValidScenePath: (scenePath: string) => string;
|
package/dist/callback.d.ts
CHANGED
@@ -2,7 +2,7 @@ import Emittery from "emittery";
|
|
2
2
|
import type { TeleBoxColorScheme, TELE_BOX_STATE } from "@netless/telebox-insider";
|
3
3
|
import type { CameraState, SceneState, ViewVisionMode } from "white-web-sdk";
|
4
4
|
import type { LoadAppEvent } from "./Register";
|
5
|
-
import type { PageState } from "./
|
5
|
+
import type { PageState } from "./Page";
|
6
6
|
export declare type PublicEvent = {
|
7
7
|
mainViewModeChange: ViewVisionMode;
|
8
8
|
boxStateChange: `${TELE_BOX_STATE}`;
|
package/dist/index.d.ts
CHANGED
@@ -11,10 +11,10 @@ import type { Displayer, SceneDefinition, View, Room, InvisiblePluginContext, Ca
|
|
11
11
|
import type { AppListeners } from "./AppListener";
|
12
12
|
import type { NetlessApp, RegisterParams } from "./typings";
|
13
13
|
import type { TeleBoxColorScheme, TeleBoxState } from "@netless/telebox-insider";
|
14
|
-
import type { AppProxy } from "./
|
15
|
-
import type { PublicEvent } from "./
|
14
|
+
import type { AppProxy } from "./App";
|
15
|
+
import type { PublicEvent } from "./callback";
|
16
16
|
import type Emittery from "emittery";
|
17
|
-
import type { PageState } from "./
|
17
|
+
import type { PageController, AddPageParams, PageState } from "./Page";
|
18
18
|
export declare type WindowMangerAttributes = {
|
19
19
|
modelValue?: string;
|
20
20
|
boxState: TELE_BOX_STATE;
|
@@ -89,11 +89,7 @@ export declare type MountParams = {
|
|
89
89
|
prefersColorScheme?: TeleBoxColorScheme;
|
90
90
|
};
|
91
91
|
export declare const reconnectRefresher: ReconnectRefresher;
|
92
|
-
export declare
|
93
|
-
after?: boolean;
|
94
|
-
scene?: SceneDefinition;
|
95
|
-
};
|
96
|
-
export declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
92
|
+
export declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes> implements PageController {
|
97
93
|
static kind: string;
|
98
94
|
static displayer: Displayer;
|
99
95
|
static wrapper?: HTMLElement;
|