@netless/window-manager 0.4.73-beta.0 → 0.4.73-beta.1
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/index.d.ts +1087 -38
- package/dist/index.js +14 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +130 -40
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -7
- package/src/App/AppContext.ts +13 -5
- package/src/App/AppProxy.ts +2 -2
- package/src/App/MagixEvent/index.ts +38 -38
- package/src/App/Storage/StorageEvent.ts +13 -13
- package/src/App/Storage/index.ts +265 -242
- package/src/App/Storage/typings.ts +4 -2
- package/src/App/Storage/utils.ts +3 -3
- package/src/AppListener.ts +5 -5
- package/src/AttributesDelegate.ts +5 -7
- package/src/BoxEmitter.ts +12 -6
- package/src/BoxManager.ts +1 -1
- package/src/ContainerResizeObserver.ts +1 -1
- package/src/Helper.ts +67 -15
- package/src/InternalEmitter.ts +4 -3
- package/src/Page/index.ts +1 -1
- package/src/Register/index.ts +5 -7
- package/src/Register/loader.ts +1 -1
- package/src/Register/storage.ts +13 -13
- package/src/Utils/Common.ts +10 -5
- package/src/Utils/Reactive.ts +26 -25
- package/src/Utils/RoomHacker.ts +1 -1
- package/src/Utils/error.ts +0 -1
- package/src/View/IframeBridge.ts +627 -583
- package/src/View/MainView.ts +7 -2
- package/src/callback.ts +7 -1
- package/src/index.ts +8 -21
- package/src/typings.ts +11 -6
- package/dist/App/AppContext.d.ts +0 -79
- package/dist/App/AppPageStateImpl.d.ts +0 -17
- package/dist/App/AppProxy.d.ts +0 -67
- package/dist/App/MagixEvent/index.d.ts +0 -29
- package/dist/App/Storage/StorageEvent.d.ts +0 -8
- package/dist/App/Storage/index.d.ts +0 -39
- package/dist/App/Storage/typings.d.ts +0 -22
- package/dist/App/Storage/utils.d.ts +0 -5
- package/dist/App/index.d.ts +0 -2
- package/dist/AppListener.d.ts +0 -21
- package/dist/AppManager.d.ts +0 -110
- package/dist/AttributesDelegate.d.ts +0 -91
- package/dist/BoxEmitter.d.ts +0 -34
- package/dist/BoxManager.d.ts +0 -98
- package/dist/BuiltinApps.d.ts +0 -5
- package/dist/ContainerResizeObserver.d.ts +0 -11
- package/dist/Cursor/Cursor.d.ts +0 -43
- package/dist/Cursor/icons.d.ts +0 -3
- package/dist/Cursor/icons2.d.ts +0 -4
- package/dist/Cursor/index.d.ts +0 -55
- package/dist/Helper.d.ts +0 -11
- package/dist/InternalEmitter.d.ts +0 -34
- package/dist/Page/PageController.d.ts +0 -21
- package/dist/Page/index.d.ts +0 -3
- package/dist/PageState.d.ts +0 -9
- package/dist/ReconnectRefresher.d.ts +0 -24
- package/dist/RedoUndo.d.ts +0 -18
- package/dist/Register/index.d.ts +0 -28
- package/dist/Register/loader.d.ts +0 -4
- package/dist/Register/storage.d.ts +0 -8
- package/dist/Utils/AppCreateQueue.d.ts +0 -15
- package/dist/Utils/Common.d.ts +0 -22
- package/dist/Utils/Reactive.d.ts +0 -6
- package/dist/Utils/RoomHacker.d.ts +0 -3
- package/dist/Utils/error.d.ts +0 -27
- package/dist/Utils/log.d.ts +0 -1
- package/dist/View/IframeBridge.d.ts +0 -146
- package/dist/View/MainView.d.ts +0 -58
- package/dist/View/ViewManager.d.ts +0 -13
- package/dist/callback.d.ts +0 -38
- package/dist/constants.d.ts +0 -48
- package/dist/typings.d.ts +0 -84
package/src/View/MainView.ts
CHANGED
@@ -256,8 +256,13 @@ export class MainViewProxy {
|
|
256
256
|
};
|
257
257
|
|
258
258
|
private ensureMainViewSize() {
|
259
|
-
if (
|
260
|
-
this.
|
259
|
+
if (
|
260
|
+
(!this.mainViewSize ||
|
261
|
+
this.mainViewSize.width === 0 ||
|
262
|
+
this.mainViewSize.height === 0) &&
|
263
|
+
this.mainView.size.width > 0 &&
|
264
|
+
this.mainView.size.height > 0
|
265
|
+
) {
|
261
266
|
this.setMainViewSize(this.mainView.size);
|
262
267
|
}
|
263
268
|
}
|
package/src/callback.ts
CHANGED
@@ -3,7 +3,13 @@ import type { TeleBoxColorScheme, TELE_BOX_STATE } from "@netless/telebox-inside
|
|
3
3
|
import type { CameraState, SceneState, View, ViewVisionMode } from "white-web-sdk";
|
4
4
|
import type { LoadAppEvent } from "./Register";
|
5
5
|
import type { PageState } from "./Page";
|
6
|
-
import type {
|
6
|
+
import type {
|
7
|
+
BoxClosePayload,
|
8
|
+
BoxFocusPayload,
|
9
|
+
BoxMovePayload,
|
10
|
+
BoxResizePayload,
|
11
|
+
BoxStateChangePayload,
|
12
|
+
} from "./BoxEmitter";
|
7
13
|
import type { AppPayload } from "./typings";
|
8
14
|
|
9
15
|
export type PublicEvent = {
|
package/src/index.ts
CHANGED
@@ -172,6 +172,7 @@ export class WindowManager
|
|
172
172
|
public static containerSizeRatio = DEFAULT_CONTAINER_RATIO;
|
173
173
|
public static supportTeachingAidsPlugin?: boolean;
|
174
174
|
private static isCreated = false;
|
175
|
+
private static _resolve = (_manager: WindowManager) => void 0;
|
175
176
|
|
176
177
|
public version = __APP_VERSION__;
|
177
178
|
public dependencies = __APP_DEPENDENCIES__;
|
@@ -199,6 +200,10 @@ export class WindowManager
|
|
199
200
|
(window as any).NETLESS_DEPS = __APP_DEPENDENCIES__;
|
200
201
|
}
|
201
202
|
|
203
|
+
public static onCreate(manager: WindowManager) {
|
204
|
+
WindowManager._resolve(manager);
|
205
|
+
}
|
206
|
+
|
202
207
|
public static async mount(params: MountParams): Promise<WindowManager> {
|
203
208
|
const room = params.room;
|
204
209
|
WindowManager.container = params.container;
|
@@ -288,26 +293,8 @@ export class WindowManager
|
|
288
293
|
return manager;
|
289
294
|
}
|
290
295
|
|
291
|
-
private static
|
292
|
-
|
293
|
-
if (!manager) {
|
294
|
-
if (isRoom(room)) {
|
295
|
-
if (room.isWritable === false) {
|
296
|
-
try {
|
297
|
-
await room.setWritable(true);
|
298
|
-
} catch (error) {
|
299
|
-
throw new Error("[WindowManger]: room must be switched to be writable");
|
300
|
-
}
|
301
|
-
manager = await createInvisiblePlugin(room);
|
302
|
-
manager?.ensureAttributes();
|
303
|
-
await wait(500);
|
304
|
-
await room.setWritable(false);
|
305
|
-
} else {
|
306
|
-
manager = await createInvisiblePlugin(room);
|
307
|
-
}
|
308
|
-
}
|
309
|
-
}
|
310
|
-
return manager;
|
296
|
+
private static initManager(room: Room): Promise<WindowManager | undefined> {
|
297
|
+
return createInvisiblePlugin(room);
|
311
298
|
}
|
312
299
|
|
313
300
|
private static initContainer(
|
@@ -1014,7 +1001,7 @@ export class WindowManager
|
|
1014
1001
|
this.appManager?.dispatchInternalEvent(Events.Refresh);
|
1015
1002
|
}
|
1016
1003
|
|
1017
|
-
/** @
|
1004
|
+
/** @internal */
|
1018
1005
|
public _refresh() {
|
1019
1006
|
this.appManager?.mainViewProxy.rebind();
|
1020
1007
|
if (WindowManager.container) {
|
package/src/typings.ts
CHANGED
@@ -14,7 +14,12 @@ import type { AppContext } from "./App";
|
|
14
14
|
import type { ReadonlyTeleBox, TeleBoxRect } from "@netless/telebox-insider";
|
15
15
|
import type { PageState } from "./Page";
|
16
16
|
|
17
|
-
export interface NetlessApp<
|
17
|
+
export interface NetlessApp<
|
18
|
+
Attributes extends {} = any,
|
19
|
+
MagixEventPayloads = any,
|
20
|
+
AppOptions = any,
|
21
|
+
SetupResult = any
|
22
|
+
> {
|
18
23
|
kind: string;
|
19
24
|
config?: {
|
20
25
|
/** Box width relative to whiteboard. 0~1. Default 0.5. */
|
@@ -52,7 +57,7 @@ export type AppEmitterEvent<T = any> = {
|
|
52
57
|
focus: boolean;
|
53
58
|
reconnected: void;
|
54
59
|
seek: number;
|
55
|
-
pageStateChange: PageState
|
60
|
+
pageStateChange: PageState;
|
56
61
|
};
|
57
62
|
|
58
63
|
export type RegisterEventData = {
|
@@ -60,7 +65,7 @@ export type RegisterEventData = {
|
|
60
65
|
};
|
61
66
|
|
62
67
|
export type RegisterEvents<SetupResult = any> = {
|
63
|
-
created: RegisterEventData & { result: SetupResult
|
68
|
+
created: RegisterEventData & { result: SetupResult };
|
64
69
|
destroy: RegisterEventData;
|
65
70
|
focus: RegisterEventData;
|
66
71
|
};
|
@@ -90,6 +95,6 @@ export * from "./Page";
|
|
90
95
|
export * from "./Utils/error";
|
91
96
|
|
92
97
|
export type AppPayload = {
|
93
|
-
appId: string
|
94
|
-
view: View
|
95
|
-
}
|
98
|
+
appId: string;
|
99
|
+
view: View;
|
100
|
+
};
|
package/dist/App/AppContext.d.ts
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
import { Storage } from "./Storage";
|
2
|
-
import { autorun, listenDisposed, listenUpdated, reaction, unlistenDisposed, unlistenUpdated, toJS } from "white-web-sdk";
|
3
|
-
import type { Room, SceneDefinition, View } from "white-web-sdk";
|
4
|
-
import type { ReadonlyTeleBox } from "@netless/telebox-insider";
|
5
|
-
import type Emittery from "emittery";
|
6
|
-
import type { BoxManager } from "../BoxManager";
|
7
|
-
import type { AppEmitterEvent } from "../index";
|
8
|
-
import type { AppManager } from "../AppManager";
|
9
|
-
import type { AppProxy } from "./AppProxy";
|
10
|
-
import type { MagixEventAddListener, MagixEventDispatcher, MagixEventRemoveListener } from "./MagixEvent";
|
11
|
-
import type { AddPageParams, PageController, PageState } from "../Page";
|
12
|
-
export declare class AppContext<TAttributes extends {} = any, TMagixEventPayloads = any, TAppOptions = any> implements PageController {
|
13
|
-
private manager;
|
14
|
-
private boxManager;
|
15
|
-
appId: string;
|
16
|
-
private appProxy;
|
17
|
-
private appOptions?;
|
18
|
-
readonly emitter: Emittery<AppEmitterEvent<TAttributes>>;
|
19
|
-
readonly mobxUtils: {
|
20
|
-
autorun: typeof autorun;
|
21
|
-
reaction: typeof reaction;
|
22
|
-
toJS: typeof toJS;
|
23
|
-
};
|
24
|
-
readonly objectUtils: {
|
25
|
-
listenUpdated: typeof listenUpdated;
|
26
|
-
unlistenUpdated: typeof unlistenUpdated;
|
27
|
-
listenDisposed: typeof listenDisposed;
|
28
|
-
unlistenDisposed: typeof unlistenDisposed;
|
29
|
-
};
|
30
|
-
private store;
|
31
|
-
readonly isAddApp: boolean;
|
32
|
-
readonly isReplay: boolean;
|
33
|
-
constructor(manager: AppManager, boxManager: BoxManager, appId: string, appProxy: AppProxy, appOptions?: TAppOptions | (() => TAppOptions) | undefined);
|
34
|
-
getDisplayer: () => import("white-web-sdk").Displayer<import("white-web-sdk").DisplayerCallbacks>;
|
35
|
-
/** @deprecated Use context.storage.state instead. */
|
36
|
-
getAttributes: () => TAttributes | undefined;
|
37
|
-
getScenes: () => SceneDefinition[] | undefined;
|
38
|
-
getView: () => View | undefined;
|
39
|
-
mountView: (dom: HTMLElement) => void;
|
40
|
-
getInitScenePath: () => string | undefined;
|
41
|
-
/** Get App writable status. */
|
42
|
-
getIsWritable: () => boolean;
|
43
|
-
/** Get the App Window UI box. */
|
44
|
-
getBox: () => ReadonlyTeleBox;
|
45
|
-
getRoom: () => Room | undefined;
|
46
|
-
/** @deprecated Use context.storage.setState instead. */
|
47
|
-
setAttributes: (attributes: TAttributes) => void;
|
48
|
-
/** @deprecated Use context.storage.setState instead. */
|
49
|
-
updateAttributes: (keys: string[], value: any) => void;
|
50
|
-
setScenePath: (scenePath: string) => Promise<void>;
|
51
|
-
/** Get the local App options. */
|
52
|
-
getAppOptions: () => TAppOptions | undefined;
|
53
|
-
private _storage?;
|
54
|
-
/** Main Storage for attributes. */
|
55
|
-
get storage(): Storage<TAttributes>;
|
56
|
-
/**
|
57
|
-
* Create separated storages for flexible state management.
|
58
|
-
* @param storeId Namespace for the storage. Storages of the same namespace share the same data.
|
59
|
-
* @param defaultState Default state for initial storage creation.
|
60
|
-
* @returns
|
61
|
-
*/
|
62
|
-
createStorage: <TState extends {}>(storeId: string, defaultState?: TState | undefined) => Storage<TState>;
|
63
|
-
/** Dispatch events to other clients (and self). */
|
64
|
-
dispatchMagixEvent: MagixEventDispatcher<TMagixEventPayloads>;
|
65
|
-
/** Listen to events from others clients (and self messages). */
|
66
|
-
addMagixEventListener: MagixEventAddListener<TMagixEventPayloads>;
|
67
|
-
/** Remove a Magix event listener. */
|
68
|
-
removeMagixEventListener: MagixEventRemoveListener<TMagixEventPayloads>;
|
69
|
-
/** PageController */
|
70
|
-
nextPage: () => Promise<boolean>;
|
71
|
-
jumpPage: (index: number) => Promise<boolean>;
|
72
|
-
prevPage: () => Promise<boolean>;
|
73
|
-
addPage: (params?: AddPageParams | undefined) => Promise<void>;
|
74
|
-
removePage: (index?: number | undefined) => Promise<boolean>;
|
75
|
-
get pageState(): PageState;
|
76
|
-
get kind(): string;
|
77
|
-
/** Dispatch a local event to `manager.onAppEvent()`. */
|
78
|
-
dispatchAppEvent(type: string, value?: any): void;
|
79
|
-
}
|
@@ -1,17 +0,0 @@
|
|
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
|
-
}
|
package/dist/App/AppProxy.d.ts
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
import Emittery from "emittery";
|
2
|
-
import { AppContext } from "./AppContext";
|
3
|
-
import type { AppEmitterEvent, AppInitState, BaseInsertParams } from "../index";
|
4
|
-
import type { SceneState, View, SceneDefinition } from "white-web-sdk";
|
5
|
-
import type { AppManager } from "../AppManager";
|
6
|
-
import type { NetlessApp } from "../typings";
|
7
|
-
import type { ReadonlyTeleBox } from "@netless/telebox-insider";
|
8
|
-
import type { PageRemoveService, PageState } from "../Page";
|
9
|
-
export declare type AppEmitter = Emittery<AppEmitterEvent>;
|
10
|
-
export declare class AppProxy implements PageRemoveService {
|
11
|
-
private params;
|
12
|
-
private manager;
|
13
|
-
kind: string;
|
14
|
-
id: string;
|
15
|
-
scenePath?: string;
|
16
|
-
appEmitter: AppEmitter;
|
17
|
-
scenes?: SceneDefinition[];
|
18
|
-
private appListener;
|
19
|
-
private boxManager;
|
20
|
-
private appProxies;
|
21
|
-
private viewManager;
|
22
|
-
private store;
|
23
|
-
isAddApp: boolean;
|
24
|
-
private status;
|
25
|
-
private stateKey;
|
26
|
-
private _pageState;
|
27
|
-
private _prevFullPath;
|
28
|
-
appResult?: NetlessApp<any>;
|
29
|
-
appContext?: AppContext<any, any>;
|
30
|
-
constructor(params: BaseInsertParams, manager: AppManager, appId: string, isAddApp: boolean);
|
31
|
-
private initScenes;
|
32
|
-
get view(): View | undefined;
|
33
|
-
get viewIndex(): number | undefined;
|
34
|
-
get isWritable(): boolean;
|
35
|
-
get attributes(): any;
|
36
|
-
get appAttributes(): import("../index").AppSyncAttributes;
|
37
|
-
getFullScenePath(): string | undefined;
|
38
|
-
private getFullScenePathFromScenes;
|
39
|
-
setFullPath(path: string): void;
|
40
|
-
baseInsertApp(skipUpdate?: boolean): Promise<{
|
41
|
-
appId: string;
|
42
|
-
app: NetlessApp;
|
43
|
-
}>;
|
44
|
-
get box(): ReadonlyTeleBox | undefined;
|
45
|
-
private setupApp;
|
46
|
-
private fixMobileSize;
|
47
|
-
private afterSetupApp;
|
48
|
-
onSeek(time: number): Promise<void>;
|
49
|
-
onReconnected(): Promise<void>;
|
50
|
-
onRemoveScene(scenePath: string): Promise<void>;
|
51
|
-
getAppInitState: (id: string) => AppInitState | undefined;
|
52
|
-
emitAppSceneStateChange(sceneState: SceneState): void;
|
53
|
-
emitAppIsWritableChange(): void;
|
54
|
-
private makeAppEventListener;
|
55
|
-
private appAttributesUpdateListener;
|
56
|
-
private setFocusScenePathHandler;
|
57
|
-
setScenePath(): void;
|
58
|
-
setViewFocusScenePath(): string | undefined;
|
59
|
-
private createView;
|
60
|
-
notifyPageStateChange: import("lodash").DebouncedFunc<() => void>;
|
61
|
-
get pageState(): PageState;
|
62
|
-
removeSceneByIndex(index: number): Promise<boolean>;
|
63
|
-
setSceneIndexWithoutSync(index: number): void;
|
64
|
-
setSceneIndex(index: number): void;
|
65
|
-
destroy(needCloseBox: boolean, cleanAttrs: boolean, skipUpdate: boolean, error?: Error): Promise<void>;
|
66
|
-
close(): Promise<void>;
|
67
|
-
}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
import type { MagixEventListenerOptions as WhiteMagixListenerOptions, Event as WhiteEvent, EventPhase as WhiteEventPhase, Scope as WhiteScope } from "white-web-sdk";
|
2
|
-
export interface MagixEventListenerOptions extends WhiteMagixListenerOptions {
|
3
|
-
/**
|
4
|
-
* Rapid emitted callbacks will be slowed down to this interval (in ms).
|
5
|
-
*/
|
6
|
-
fireInterval?: number;
|
7
|
-
/**
|
8
|
-
* If `true`, sent events will reach self-listeners after committed to server.
|
9
|
-
* Otherwise the events will reach self-listeners immediately.
|
10
|
-
*/
|
11
|
-
fireSelfEventAfterCommit?: boolean;
|
12
|
-
}
|
13
|
-
export interface MagixEventMessage<TPayloads = any, TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>> extends Omit<WhiteEvent, "scope" | "phase"> {
|
14
|
-
/** Event name */
|
15
|
-
event: TEvent;
|
16
|
-
/** Event Payload */
|
17
|
-
payload: TPayloads[TEvent];
|
18
|
-
/** Whiteboard ID of the client who dispatched the event. It will be AdminObserverId for system events. */
|
19
|
-
authorId: number;
|
20
|
-
scope: `${WhiteScope}`;
|
21
|
-
phase: `${WhiteEventPhase}`;
|
22
|
-
}
|
23
|
-
export declare type MagixEventTypes<TPayloads = any> = Extract<keyof TPayloads, string>;
|
24
|
-
export declare type MagixEventPayload<TPayloads = any, TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>> = TPayloads[TEvent];
|
25
|
-
export declare type MagixEventDispatcher<TPayloads = any> = <TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>>(event: TEvent, payload: TPayloads[TEvent]) => void;
|
26
|
-
export declare type MagixEventHandler<TPayloads = any, TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>> = (message: MagixEventMessage<TPayloads, TEvent>) => void;
|
27
|
-
export declare type MagixEventListenerDisposer = () => void;
|
28
|
-
export declare type MagixEventAddListener<TPayloads = any> = <TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>>(event: TEvent, handler: MagixEventHandler<TPayloads, TEvent>, options?: MagixEventListenerOptions | undefined) => MagixEventListenerDisposer;
|
29
|
-
export declare type MagixEventRemoveListener<TPayloads = any> = <TEvent extends MagixEventTypes<TPayloads> = MagixEventTypes<TPayloads>>(event: TEvent, handler?: MagixEventHandler<TPayloads, TEvent>) => void;
|
@@ -1,8 +0,0 @@
|
|
1
|
-
export declare type StorageEventListener<T> = (event: T) => void;
|
2
|
-
export declare class StorageEvent<TMessage> {
|
3
|
-
listeners: Set<StorageEventListener<TMessage>>;
|
4
|
-
get length(): number;
|
5
|
-
dispatch(message: TMessage): void;
|
6
|
-
addListener(listener: StorageEventListener<TMessage>): void;
|
7
|
-
removeListener(listener: StorageEventListener<TMessage>): void;
|
8
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import type { AppContext } from "../AppContext";
|
2
|
-
import type { Diff, StorageStateChangedListener, StorageStateChangedListenerDisposer } from "./typings";
|
3
|
-
import { StorageEvent } from "./StorageEvent";
|
4
|
-
export * from './typings';
|
5
|
-
export declare const STORAGE_NS = "_WM-STORAGE_";
|
6
|
-
export declare class Storage<TState extends Record<string, any> = any> implements Storage<TState> {
|
7
|
-
readonly id: string | null;
|
8
|
-
private readonly _context;
|
9
|
-
private readonly _sideEffect;
|
10
|
-
private _state;
|
11
|
-
private _destroyed;
|
12
|
-
private _refMap;
|
13
|
-
/**
|
14
|
-
* `setState` alters local state immediately before sending to server. This will cache the old value for onStateChanged diffing.
|
15
|
-
*/
|
16
|
-
private _lastValue;
|
17
|
-
constructor(context: AppContext, id?: string, defaultState?: TState);
|
18
|
-
get state(): Readonly<TState>;
|
19
|
-
readonly onStateChanged: StorageEvent<Diff<TState>>;
|
20
|
-
addStateChangedListener(handler: StorageStateChangedListener<TState>): StorageStateChangedListenerDisposer;
|
21
|
-
ensureState(state: Partial<TState>): void;
|
22
|
-
setState(state: Partial<TState>): void;
|
23
|
-
/**
|
24
|
-
* Empty storage data.
|
25
|
-
*/
|
26
|
-
emptyStorage(): void;
|
27
|
-
/**
|
28
|
-
* Delete storage index with all of its data and destroy the Storage instance.
|
29
|
-
*/
|
30
|
-
deleteStorage(): void;
|
31
|
-
get destroyed(): boolean;
|
32
|
-
/**
|
33
|
-
* Destroy the Storage instance. The data will be kept.
|
34
|
-
*/
|
35
|
-
destroy(): void;
|
36
|
-
private _getRawState;
|
37
|
-
private _setRawState;
|
38
|
-
private _updateProperties;
|
39
|
-
}
|
@@ -1,22 +0,0 @@
|
|
1
|
-
import type { StorageEventListener } from "./StorageEvent";
|
2
|
-
export declare type RefValue<TValue = any> = {
|
3
|
-
k: string;
|
4
|
-
v: TValue;
|
5
|
-
__isRef: true;
|
6
|
-
};
|
7
|
-
export declare type ExtractRawValue<TValue> = TValue extends RefValue<infer TRefValue> ? TRefValue : TValue;
|
8
|
-
export declare type AutoRefValue<TValue> = RefValue<ExtractRawValue<TValue>>;
|
9
|
-
export declare type MaybeRefValue<TValue> = TValue | AutoRefValue<TValue>;
|
10
|
-
export declare type DiffOne<T> = {
|
11
|
-
oldValue?: T;
|
12
|
-
newValue?: T;
|
13
|
-
};
|
14
|
-
export declare type Diff<T> = {
|
15
|
-
[K in keyof T]?: DiffOne<T[K]>;
|
16
|
-
};
|
17
|
-
export declare type StorageOnSetStatePayload<TState = unknown> = {
|
18
|
-
[K in keyof TState]?: MaybeRefValue<TState[K]>;
|
19
|
-
};
|
20
|
-
export declare type StorageStateChangedEvent<TState = any> = Diff<TState>;
|
21
|
-
export declare type StorageStateChangedListener<TState = any> = StorageEventListener<StorageStateChangedEvent<TState>>;
|
22
|
-
export declare type StorageStateChangedListenerDisposer = () => void;
|
@@ -1,5 +0,0 @@
|
|
1
|
-
import type { AutoRefValue, RefValue } from "./typings";
|
2
|
-
export declare const plainObjectKeys: <T>(o: T) => Extract<keyof T, string>[];
|
3
|
-
export declare function isRef<TValue = unknown>(e: unknown): e is RefValue<TValue>;
|
4
|
-
export declare function makeRef<TValue>(v: TValue): RefValue<TValue>;
|
5
|
-
export declare function makeAutoRef<TValue>(v: TValue): AutoRefValue<TValue>;
|
package/dist/App/index.d.ts
DELETED
package/dist/AppListener.d.ts
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
import type { AppManager } from "./AppManager";
|
2
|
-
export declare class AppListeners {
|
3
|
-
private manager;
|
4
|
-
private displayer;
|
5
|
-
constructor(manager: AppManager);
|
6
|
-
private get boxManager();
|
7
|
-
addListeners(): void;
|
8
|
-
removeListeners(): void;
|
9
|
-
private mainMagixEventListener;
|
10
|
-
private appMoveHandler;
|
11
|
-
private appResizeHandler;
|
12
|
-
private boxStateChangeHandler;
|
13
|
-
private setMainViewScenePathHandler;
|
14
|
-
private moveCameraHandler;
|
15
|
-
private moveCameraToContainHandler;
|
16
|
-
private cursorMoveHandler;
|
17
|
-
private rootDirRemovedHandler;
|
18
|
-
private refreshHandler;
|
19
|
-
private initMainViewCameraHandler;
|
20
|
-
private setAppFocusViewIndexHandler;
|
21
|
-
}
|
package/dist/AppManager.d.ts
DELETED
@@ -1,110 +0,0 @@
|
|
1
|
-
import { AppStatus, Events } from "./constants";
|
2
|
-
import { AppProxy } from "./App";
|
3
|
-
import { MainViewProxy } from "./View/MainView";
|
4
|
-
import { WindowManager } from "./index";
|
5
|
-
import { ViewManager } from "./View/ViewManager";
|
6
|
-
import type { ReconnectRefresher } from "./ReconnectRefresher";
|
7
|
-
import type { BoxManager } from "./BoxManager";
|
8
|
-
import type { Displayer, Room, SceneState, MemberState } from "white-web-sdk";
|
9
|
-
import type { AddAppParams, TeleBoxRect } from "./index";
|
10
|
-
export declare class AppManager {
|
11
|
-
windowManger: WindowManager;
|
12
|
-
displayer: Displayer;
|
13
|
-
viewManager: ViewManager;
|
14
|
-
appProxies: Map<string, AppProxy>;
|
15
|
-
appStatus: Map<string, AppStatus>;
|
16
|
-
store: import("./AttributesDelegate").AttributesDelegate;
|
17
|
-
mainViewProxy: MainViewProxy;
|
18
|
-
refresher: ReconnectRefresher;
|
19
|
-
isReplay: boolean;
|
20
|
-
mainViewScenesLength: number;
|
21
|
-
private appListeners;
|
22
|
-
boxManager?: BoxManager;
|
23
|
-
private _prevSceneIndex;
|
24
|
-
private _prevFocused;
|
25
|
-
private callbacksNode;
|
26
|
-
private appCreateQueue;
|
27
|
-
private sideEffectManager;
|
28
|
-
sceneState: SceneState | null;
|
29
|
-
rootDirRemoving: boolean;
|
30
|
-
constructor(windowManger: WindowManager);
|
31
|
-
getMemberState(): MemberState;
|
32
|
-
private onRemoveScenes;
|
33
|
-
/**
|
34
|
-
* 根目录被删除时所有的 scene 都会被删除.
|
35
|
-
* 所以需要关掉所有开启了 view 的 app
|
36
|
-
*/
|
37
|
-
onRootDirRemoved(needClose?: boolean): Promise<void>;
|
38
|
-
private onReadonlyChanged;
|
39
|
-
private onPlayerSeekStart;
|
40
|
-
private onPlayerSeekDone;
|
41
|
-
createRootDirScenesCallback: () => void;
|
42
|
-
removeSceneByIndex: (index: number) => Promise<boolean>;
|
43
|
-
setSceneIndexWithoutSync: (index: number) => void;
|
44
|
-
private onSceneChange;
|
45
|
-
private emitMainViewScenesChange;
|
46
|
-
private updateSceneState;
|
47
|
-
private get eventName();
|
48
|
-
get attributes(): import("./index").WindowMangerAttributes;
|
49
|
-
get canOperate(): boolean;
|
50
|
-
get room(): Room | undefined;
|
51
|
-
get mainView(): import("white-web-sdk").View;
|
52
|
-
get polling(): boolean;
|
53
|
-
set polling(b: boolean);
|
54
|
-
get focusApp(): AppProxy | undefined;
|
55
|
-
get uid(): string;
|
56
|
-
getMainViewSceneDir(): string;
|
57
|
-
private onCreated;
|
58
|
-
private onBoxMove;
|
59
|
-
private onBoxResize;
|
60
|
-
private onBoxFocus;
|
61
|
-
private onBoxClose;
|
62
|
-
private onBoxStateChange;
|
63
|
-
addAppsChangeListener: () => void;
|
64
|
-
addAppCloseListener: () => void;
|
65
|
-
private onMainViewIndexChange;
|
66
|
-
private onFocusChange;
|
67
|
-
attributesUpdateCallback: import("lodash").DebouncedFunc<(apps: any) => Promise<void>>;
|
68
|
-
private _appIds;
|
69
|
-
notifyAppsChange(appIds: string[]): void;
|
70
|
-
/**
|
71
|
-
* 插件更新 attributes 时的回调
|
72
|
-
*
|
73
|
-
* @param {*} attributes
|
74
|
-
* @memberof WindowManager
|
75
|
-
*/
|
76
|
-
_attributesUpdateCallback(apps: any): Promise<void>;
|
77
|
-
private onRegisteredChange;
|
78
|
-
private onMinimized;
|
79
|
-
refresh(): void;
|
80
|
-
setBoxManager(boxManager: BoxManager): void;
|
81
|
-
resetMaximized(): void;
|
82
|
-
resetMinimized(): void;
|
83
|
-
private onAppDelete;
|
84
|
-
private closeAll;
|
85
|
-
bindMainView(divElement: HTMLDivElement, disableCameraTransform: boolean): void;
|
86
|
-
setMainViewFocusPath(scenePath?: string): boolean | undefined;
|
87
|
-
private resetScenePath;
|
88
|
-
addApp(params: AddAppParams, isDynamicPPT: boolean): Promise<string | undefined>;
|
89
|
-
private beforeAddApp;
|
90
|
-
private afterAddApp;
|
91
|
-
closeApp(appId: string, needClose?: boolean): Promise<void>;
|
92
|
-
private baseInsertApp;
|
93
|
-
private displayerStateListener;
|
94
|
-
displayerWritableListener: (isReadonly: boolean) => void;
|
95
|
-
safeSetAttributes(attributes: any): void;
|
96
|
-
safeUpdateAttributes(keys: string[], value: any): void;
|
97
|
-
setMainViewScenePath(scenePath: string): Promise<void>;
|
98
|
-
private _setMainViewScenePath;
|
99
|
-
private updateSceneIndex;
|
100
|
-
setMainViewSceneIndex(index: number): Promise<void>;
|
101
|
-
private dispatchSetMainViewScenePath;
|
102
|
-
getAppInitPath(appId: string): string | undefined;
|
103
|
-
safeDispatchMagixEvent(event: string, payload: any): void;
|
104
|
-
focusByAttributes(apps: any): void;
|
105
|
-
onReconnected(): Promise<void>;
|
106
|
-
notifyContainerRectUpdate(rect: TeleBoxRect): void;
|
107
|
-
updateRootDirRemoving: (removing: boolean) => void;
|
108
|
-
dispatchInternalEvent(event: Events, payload?: any): void;
|
109
|
-
destroy(): void;
|
110
|
-
}
|
@@ -1,91 +0,0 @@
|
|
1
|
-
import { AppAttributes } from "./constants";
|
2
|
-
import type { AddAppParams, AppSyncAttributes } from "./index";
|
3
|
-
import type { Camera, Size, View } from "white-web-sdk";
|
4
|
-
import type { Cursor } from "./Cursor/Cursor";
|
5
|
-
export declare enum Fields {
|
6
|
-
Apps = "apps",
|
7
|
-
Focus = "focus",
|
8
|
-
State = "state",
|
9
|
-
BoxState = "boxState",
|
10
|
-
MainViewCamera = "mainViewCamera",
|
11
|
-
MainViewSize = "mainViewSize",
|
12
|
-
Broadcaster = "broadcaster",
|
13
|
-
Cursors = "cursors",
|
14
|
-
Position = "position",
|
15
|
-
CursorState = "cursorState",
|
16
|
-
FullPath = "fullPath",
|
17
|
-
Registered = "registered",
|
18
|
-
IframeBridge = "iframeBridge"
|
19
|
-
}
|
20
|
-
export declare type Apps = {
|
21
|
-
[key: string]: AppSyncAttributes;
|
22
|
-
};
|
23
|
-
export declare type Position = {
|
24
|
-
x: number;
|
25
|
-
y: number;
|
26
|
-
type: PositionType;
|
27
|
-
id?: string;
|
28
|
-
};
|
29
|
-
export declare type PositionType = "main" | "app";
|
30
|
-
export declare type StoreContext = {
|
31
|
-
getAttributes: () => any;
|
32
|
-
safeUpdateAttributes: (keys: string[], value: any) => void;
|
33
|
-
safeSetAttributes: (attributes: any) => void;
|
34
|
-
};
|
35
|
-
export declare type ICamera = Camera & {
|
36
|
-
id: string;
|
37
|
-
};
|
38
|
-
export declare type ISize = Size & {
|
39
|
-
id: string;
|
40
|
-
};
|
41
|
-
export declare class AttributesDelegate {
|
42
|
-
private context;
|
43
|
-
constructor(context: StoreContext);
|
44
|
-
setContext(context: StoreContext): void;
|
45
|
-
get attributes(): any;
|
46
|
-
apps(): Apps;
|
47
|
-
get focus(): string | undefined;
|
48
|
-
getAppAttributes(id: string): AppSyncAttributes;
|
49
|
-
getAppState(id: string): any;
|
50
|
-
getMaximized(): any;
|
51
|
-
getMinimized(): any;
|
52
|
-
setupAppAttributes(params: AddAppParams, id: string, isDynamicPPT: boolean): void;
|
53
|
-
updateAppState(appId: string, stateName: AppAttributes, state: any): void;
|
54
|
-
cleanAppAttributes(id: string): void;
|
55
|
-
cleanFocus(): void;
|
56
|
-
getAppSceneIndex(id: string): any;
|
57
|
-
getAppScenePath(id: string): any;
|
58
|
-
getMainViewScenePath(): string | undefined;
|
59
|
-
getMainViewSceneIndex(): any;
|
60
|
-
getBoxState(): any;
|
61
|
-
setMainViewScenePath(scenePath: string): void;
|
62
|
-
setMainViewSceneIndex(index: number): void;
|
63
|
-
getMainViewCamera(): MainViewCamera;
|
64
|
-
getMainViewSize(): MainViewSize;
|
65
|
-
setMainViewCamera(camera: ICamera): void;
|
66
|
-
setMainViewSize(size: ISize): void;
|
67
|
-
setMainViewCameraAndSize(camera: ICamera, size: ISize): void;
|
68
|
-
setAppFocus: (appId: string, focus: boolean) => void;
|
69
|
-
updateCursor(uid: string, position: Position): void;
|
70
|
-
updateCursorState(uid: string, cursorState: string | undefined): void;
|
71
|
-
getCursorState(uid: string): any;
|
72
|
-
cleanCursor(uid: string): void;
|
73
|
-
setMainViewFocusPath(mainView: View): void;
|
74
|
-
getIframeBridge(): any;
|
75
|
-
setIframeBridge(data: any): void;
|
76
|
-
}
|
77
|
-
export declare type MainViewSize = {
|
78
|
-
id: string;
|
79
|
-
width: number;
|
80
|
-
height: number;
|
81
|
-
};
|
82
|
-
export declare type MainViewCamera = {
|
83
|
-
id: string;
|
84
|
-
centerX: number;
|
85
|
-
centerY: number;
|
86
|
-
scale: number;
|
87
|
-
};
|
88
|
-
export declare type Cursors = {
|
89
|
-
[key: string]: Cursor;
|
90
|
-
};
|
91
|
-
export declare const store: AttributesDelegate;
|
package/dist/BoxEmitter.d.ts
DELETED
@@ -1,34 +0,0 @@
|
|
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;
|