@netless/window-manager 0.4.0-canary.1 → 0.4.0-canary.13
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/App/MagixEvent/index.d.ts +29 -0
- package/dist/App/Storage/StorageEvent.d.ts +8 -0
- package/dist/App/Storage/index.d.ts +38 -0
- package/dist/App/Storage/typings.d.ts +21 -0
- package/dist/App/Storage/utils.d.ts +5 -0
- package/dist/AppContext.d.ts +40 -16
- package/dist/AppListener.d.ts +0 -1
- package/dist/AppManager.d.ts +8 -7
- package/dist/AppProxy.d.ts +3 -3
- package/dist/Base/Context.d.ts +0 -1
- package/dist/BoxManager.d.ts +1 -0
- package/dist/BuiltinApps.d.ts +6 -0
- package/dist/ContainerResizeObserver.d.ts +10 -0
- package/dist/Cursor/Cursor.d.ts +2 -3
- package/dist/Cursor/index.d.ts +7 -4
- package/dist/Helper.d.ts +6 -0
- package/dist/ReconnectRefresher.d.ts +5 -2
- package/dist/Utils/Common.d.ts +3 -1
- package/dist/Utils/Reactive.d.ts +1 -1
- package/dist/{MainView.d.ts → View/MainView.d.ts} +2 -4
- package/dist/View/ViewManager.d.ts +13 -0
- package/dist/constants.d.ts +1 -6
- package/dist/index.d.ts +14 -13
- package/dist/index.es.js +1 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/typings.d.ts +3 -2
- package/package.json +6 -5
- package/src/App/MagixEvent/index.ts +68 -0
- package/src/App/Storage/StorageEvent.ts +21 -0
- package/src/App/Storage/index.ts +284 -0
- package/src/App/Storage/typings.ts +21 -0
- package/src/App/Storage/utils.ts +17 -0
- package/src/AppContext.ts +65 -20
- package/src/AppListener.ts +1 -8
- package/src/AppManager.ts +68 -35
- package/src/AppProxy.ts +37 -46
- package/src/Base/Context.ts +0 -4
- package/src/BoxManager.ts +9 -7
- package/src/BuiltinApps.ts +24 -0
- package/src/ContainerResizeObserver.ts +62 -0
- package/src/Cursor/Cursor.ts +23 -34
- package/src/Cursor/index.ts +70 -41
- package/src/Helper.ts +30 -0
- package/src/ReconnectRefresher.ts +13 -5
- package/src/Utils/Common.ts +35 -13
- package/src/Utils/Reactive.ts +9 -3
- package/src/Utils/RoomHacker.ts +16 -0
- package/src/{MainView.ts → View/MainView.ts} +9 -25
- package/src/View/ViewManager.ts +53 -0
- package/src/constants.ts +1 -3
- package/src/index.ts +47 -86
- package/src/shim.d.ts +4 -0
- package/src/style.css +6 -0
- package/src/typings.ts +3 -2
- package/vite.config.js +4 -1
- package/dist/Utils/CameraStore.d.ts +0 -15
- package/dist/ViewManager.d.ts +0 -29
- package/dist/sdk.d.ts +0 -14
- package/src/Utils/CameraStore.ts +0 -72
- package/src/sdk.ts +0 -39
- package/src/viewManager.ts +0 -177
@@ -0,0 +1,29 @@
|
|
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;
|
@@ -0,0 +1,8 @@
|
|
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
|
+
}
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import type { AppContext } from "../../AppContext";
|
2
|
+
import type { Diff } 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
|
+
ensureState(state: Partial<TState>): void;
|
21
|
+
setState(state: Partial<TState>): void;
|
22
|
+
/**
|
23
|
+
* Empty storage data.
|
24
|
+
*/
|
25
|
+
emptyStorage(): void;
|
26
|
+
/**
|
27
|
+
* Delete storage index with all of its data and destroy the Storage instance.
|
28
|
+
*/
|
29
|
+
deleteStorage(): void;
|
30
|
+
get destroyed(): boolean;
|
31
|
+
/**
|
32
|
+
* Destroy the Storage instance. The data will be kept.
|
33
|
+
*/
|
34
|
+
destroy(): void;
|
35
|
+
private _getRawState;
|
36
|
+
private _setRawState;
|
37
|
+
private _updateProperties;
|
38
|
+
}
|
@@ -0,0 +1,21 @@
|
|
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>>;
|
@@ -0,0 +1,5 @@
|
|
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/AppContext.d.ts
CHANGED
@@ -6,13 +6,15 @@ import type { BoxManager } from "./BoxManager";
|
|
6
6
|
import type { AppEmitterEvent } from "./index";
|
7
7
|
import type { AppManager } from "./AppManager";
|
8
8
|
import type { AppProxy } from "./AppProxy";
|
9
|
-
|
9
|
+
import { Storage } from './App/Storage';
|
10
|
+
import type { MagixEventAddListener, MagixEventDispatcher, MagixEventRemoveListener } from './App/MagixEvent';
|
11
|
+
export declare class AppContext<TAttributes = any, TMagixEventPayloads = any, TAppOptions = any> {
|
10
12
|
private manager;
|
11
13
|
private boxManager;
|
12
14
|
appId: string;
|
13
15
|
private appProxy;
|
14
16
|
private appOptions?;
|
15
|
-
readonly emitter: Emittery<AppEmitterEvent<
|
17
|
+
readonly emitter: Emittery<AppEmitterEvent<TAttributes>>;
|
16
18
|
readonly mobxUtils: {
|
17
19
|
autorun: typeof autorun;
|
18
20
|
reaction: typeof reaction;
|
@@ -27,18 +29,40 @@ export declare class AppContext<TAttrs extends Record<string, any>, AppOptions =
|
|
27
29
|
private store;
|
28
30
|
readonly isAddApp: boolean;
|
29
31
|
readonly isReplay: boolean;
|
30
|
-
constructor(manager: AppManager, boxManager: BoxManager, appId: string, appProxy: AppProxy, appOptions?:
|
31
|
-
getDisplayer()
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
32
|
+
constructor(manager: AppManager, boxManager: BoxManager, appId: string, appProxy: AppProxy, appOptions?: TAppOptions | (() => TAppOptions) | undefined);
|
33
|
+
getDisplayer: () => import("white-web-sdk").Displayer<import("white-web-sdk").DisplayerCallbacks>;
|
34
|
+
/** @deprecated Use context.storage.state instead. */
|
35
|
+
getAttributes: () => TAttributes | undefined;
|
36
|
+
getScenes: () => SceneDefinition[] | undefined;
|
37
|
+
getView: () => View | undefined;
|
38
|
+
getInitScenePath: () => string | undefined;
|
39
|
+
/** Get App writable status. */
|
40
|
+
getIsWritable: () => boolean;
|
41
|
+
/** Get the App Window UI box. */
|
42
|
+
getBox: () => ReadonlyTeleBox;
|
43
|
+
getRoom: () => Room | undefined;
|
44
|
+
/** @deprecated Use context.storage.setState instead. */
|
45
|
+
setAttributes: (attributes: TAttributes) => void;
|
46
|
+
/** @deprecated Use context.storage.setState instead. */
|
47
|
+
updateAttributes: (keys: string[], value: any) => void;
|
48
|
+
setScenePath: (scenePath: string) => Promise<void>;
|
49
|
+
mountView: (dom: HTMLDivElement) => void;
|
50
|
+
/** Get the local App options. */
|
51
|
+
getAppOptions: () => TAppOptions | undefined;
|
52
|
+
private _storage?;
|
53
|
+
/** Main Storage for attributes. */
|
54
|
+
get storage(): Storage<TAttributes>;
|
55
|
+
/**
|
56
|
+
* Create separated storages for flexible state management.
|
57
|
+
* @param storeId Namespace for the storage. Storages of the same namespace share the same data.
|
58
|
+
* @param defaultState Default state for initial storage creation.
|
59
|
+
* @returns
|
60
|
+
*/
|
61
|
+
createStorage: <TState>(storeId: string, defaultState?: TState | undefined) => Storage<TState>;
|
62
|
+
/** Dispatch events to other clients (and self). */
|
63
|
+
dispatchMagixEvent: MagixEventDispatcher<TMagixEventPayloads>;
|
64
|
+
/** Listen to events from others clients (and self messages). */
|
65
|
+
addMagixEventListener: MagixEventAddListener<TMagixEventPayloads>;
|
66
|
+
/** Remove a Magix event listener. */
|
67
|
+
removeMagixEventListener: MagixEventRemoveListener<TMagixEventPayloads>;
|
44
68
|
}
|
package/dist/AppListener.d.ts
CHANGED
@@ -9,7 +9,6 @@ export declare class AppListeners {
|
|
9
9
|
private mainMagixEventListener;
|
10
10
|
private appMoveHandler;
|
11
11
|
private appResizeHandler;
|
12
|
-
private switchViewsToFreedomHandler;
|
13
12
|
private boxStateChangeHandler;
|
14
13
|
private setMainViewScenePathHandler;
|
15
14
|
private moveCameraToContainHandler;
|
package/dist/AppManager.d.ts
CHANGED
@@ -1,17 +1,15 @@
|
|
1
1
|
import { AppStatus, Events } from "./constants";
|
2
2
|
import { AppProxy } from "./AppProxy";
|
3
3
|
import { WindowManager } from "./index";
|
4
|
-
import {
|
5
|
-
import {
|
6
|
-
import { ReconnectRefresher } from "./ReconnectRefresher";
|
7
|
-
import { ViewManager } from "./ViewManager";
|
4
|
+
import { MainViewProxy } from "./View/MainView";
|
5
|
+
import { ViewManager } from "./View/ViewManager";
|
6
|
+
import type { ReconnectRefresher } from "./ReconnectRefresher";
|
8
7
|
import type { BoxManager } from "./BoxManager";
|
9
8
|
import type { Displayer, Room } from "white-web-sdk";
|
10
9
|
import type { AddAppParams, TeleBoxRect } from "./index";
|
11
10
|
export declare class AppManager {
|
12
11
|
windowManger: WindowManager;
|
13
12
|
displayer: Displayer;
|
14
|
-
cameraStore: CameraStore;
|
15
13
|
viewManager: ViewManager;
|
16
14
|
appProxies: Map<string, AppProxy>;
|
17
15
|
appStatus: Map<string, AppStatus>;
|
@@ -21,6 +19,8 @@ export declare class AppManager {
|
|
21
19
|
isReplay: boolean;
|
22
20
|
private appListeners;
|
23
21
|
boxManager?: BoxManager;
|
22
|
+
private _prevSceneIndex;
|
23
|
+
private _prevFocused;
|
24
24
|
constructor(windowManger: WindowManager);
|
25
25
|
private onCreated;
|
26
26
|
/**
|
@@ -36,13 +36,14 @@ export declare class AppManager {
|
|
36
36
|
resetMinimized(): void;
|
37
37
|
private onAppDelete;
|
38
38
|
bindMainView(divElement: HTMLDivElement, disableCameraTransform: boolean): void;
|
39
|
+
setMainViewFocusPath(): void;
|
39
40
|
addApp(params: AddAppParams, isDynamicPPT: boolean): Promise<string | undefined>;
|
40
41
|
private beforeAddApp;
|
41
42
|
private afterAddApp;
|
42
43
|
closeApp(appId: string): Promise<void>;
|
43
44
|
private baseInsertApp;
|
44
45
|
private displayerStateListener;
|
45
|
-
|
46
|
+
displayerWritableListener: (isReadonly: boolean) => void;
|
46
47
|
private get eventName();
|
47
48
|
get attributes(): import("./index").WindowMangerAttributes;
|
48
49
|
get canOperate(): boolean;
|
@@ -58,7 +59,7 @@ export declare class AppManager {
|
|
58
59
|
safeDispatchMagixEvent(event: string, payload: any): void;
|
59
60
|
private boxEventListener;
|
60
61
|
focusByAttributes(apps: any): void;
|
61
|
-
|
62
|
+
onReconnected(): Promise<void>;
|
62
63
|
notifyContainerRectUpdate(rect: TeleBoxRect): void;
|
63
64
|
dispatchInternalEvent(event: Events, payload: any): void;
|
64
65
|
destroy(): void;
|
package/dist/AppProxy.d.ts
CHANGED
@@ -15,7 +15,6 @@ export declare class AppProxy extends Base {
|
|
15
15
|
private boxManager;
|
16
16
|
private appProxies;
|
17
17
|
private viewManager;
|
18
|
-
private cameraStore;
|
19
18
|
private kind;
|
20
19
|
isAddApp: boolean;
|
21
20
|
private status;
|
@@ -29,8 +28,9 @@ export declare class AppProxy extends Base {
|
|
29
28
|
get attributes(): any;
|
30
29
|
get appAttributes(): import("./index").AppSyncAttributes;
|
31
30
|
getFullScenePath(): string | undefined;
|
31
|
+
private getFullScenePathFromScenes;
|
32
32
|
setFullPath(path: string): void;
|
33
|
-
baseInsertApp(skipUpdate?: boolean
|
33
|
+
baseInsertApp(skipUpdate?: boolean): Promise<{
|
34
34
|
appId: string;
|
35
35
|
app: NetlessApp;
|
36
36
|
}>;
|
@@ -42,12 +42,12 @@ export declare class AppProxy extends Base {
|
|
42
42
|
private afterSetupApp;
|
43
43
|
onSeek(time: number): void;
|
44
44
|
onReconnected(): Promise<void>;
|
45
|
-
switchToWritable(): void;
|
46
45
|
getAppInitState: (id: string) => AppInitState | undefined;
|
47
46
|
emitAppSceneStateChange(sceneState: SceneState): void;
|
48
47
|
emitAppIsWritableChange(): void;
|
49
48
|
private makeAppEventListener;
|
50
49
|
private appAttributesUpdateListener;
|
50
|
+
private setFocusScenePathHandler;
|
51
51
|
setScenePath(): void;
|
52
52
|
setViewFocusScenePath(): void;
|
53
53
|
private createView;
|
package/dist/Base/Context.d.ts
CHANGED
@@ -8,6 +8,5 @@ export declare class Context {
|
|
8
8
|
findMemberByUid: (uid: string) => import("white-web-sdk").RoomMember | undefined;
|
9
9
|
updateManagerRect(): void;
|
10
10
|
blurFocusBox(): void;
|
11
|
-
switchAppToWriter(id: string): void;
|
12
11
|
}
|
13
12
|
export declare const createContext: (manager: AppManager) => Context;
|
package/dist/BoxManager.d.ts
CHANGED
@@ -56,6 +56,7 @@ export declare class BoxManager {
|
|
56
56
|
private createTeleBoxManagerConfig?;
|
57
57
|
teleBoxManager: TeleBoxManager;
|
58
58
|
constructor(context: BoxManagerContext, createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig | undefined);
|
59
|
+
private playgroundSizeChangeListener;
|
59
60
|
private get mainView();
|
60
61
|
private get canOperate();
|
61
62
|
get boxState(): "normal" | "minimized" | "maximized";
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import type { EmitterType } from "./index";
|
2
|
+
export declare class ContainerResizeObserver {
|
3
|
+
private emitter;
|
4
|
+
private containerResizeObserver?;
|
5
|
+
constructor(emitter: EmitterType);
|
6
|
+
static create(container: HTMLElement, sizer: HTMLElement, wrapper: HTMLDivElement, emitter: EmitterType): ContainerResizeObserver;
|
7
|
+
observePlaygroundSize(container: HTMLElement, sizer: HTMLElement, wrapper: HTMLDivElement): void;
|
8
|
+
private updateSizer;
|
9
|
+
disconnect(): void;
|
10
|
+
}
|
package/dist/Cursor/Cursor.d.ts
CHANGED
@@ -13,11 +13,10 @@ export declare class Cursor extends Base {
|
|
13
13
|
private cursorManager;
|
14
14
|
private wrapper?;
|
15
15
|
private member?;
|
16
|
-
private disposer;
|
17
16
|
private timer?;
|
18
17
|
private component?;
|
19
|
-
constructor(manager: AppManager, cursors: any, memberId: string, cursorManager: CursorManager, wrapper?: HTMLElement | undefined);
|
20
|
-
private
|
18
|
+
constructor(manager: AppManager, addCursorChangeListener: (uid: string, callback: (position: Position, state: CursorState) => void) => void, cursors: any, memberId: string, cursorManager: CursorManager, wrapper?: HTMLElement | undefined);
|
19
|
+
private onCursorChange;
|
21
20
|
private moveCursor;
|
22
21
|
get memberApplianceName(): ApplianceNames | undefined;
|
23
22
|
get memberColor(): string;
|
package/dist/Cursor/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
|
-
import { Base } from
|
2
|
-
import { Cursor } from
|
3
|
-
import
|
1
|
+
import { Base } from "../Base";
|
2
|
+
import { Cursor } from "./Cursor";
|
3
|
+
import { CursorState } from "../constants";
|
4
|
+
import type { PositionType, Position } from "../AttributesDelegate";
|
4
5
|
import type { RoomMember, View } from "white-web-sdk";
|
5
6
|
import type { AppManager } from "../AppManager";
|
6
7
|
export declare type EventType = {
|
@@ -19,6 +20,7 @@ export declare class CursorManager extends Base {
|
|
19
20
|
cursorInstances: Map<string, Cursor>;
|
20
21
|
roomMembers?: readonly RoomMember[];
|
21
22
|
private mainViewElement?;
|
23
|
+
private sideEffectManager;
|
22
24
|
constructor(appManager: AppManager);
|
23
25
|
setupWrapper(wrapper: HTMLElement): void;
|
24
26
|
setMainViewDivElement(div: HTMLDivElement): void;
|
@@ -29,7 +31,6 @@ export declare class CursorManager extends Base {
|
|
29
31
|
get boxState(): any;
|
30
32
|
get focusView(): View | undefined;
|
31
33
|
private mouseMoveListener;
|
32
|
-
private touchMoveListener;
|
33
34
|
private updateCursor;
|
34
35
|
private getPoint;
|
35
36
|
/**
|
@@ -44,5 +45,7 @@ export declare class CursorManager extends Base {
|
|
44
45
|
deleteCursor(uid: string): void;
|
45
46
|
hideCursor(uid: string): void;
|
46
47
|
cleanMemberAttributes(members: readonly RoomMember[]): void;
|
48
|
+
onReconnect(): void;
|
49
|
+
addCursorChangeListener: (uid: string, callback: (position: Position, state: CursorState) => void) => void;
|
47
50
|
destroy(): void;
|
48
51
|
}
|
package/dist/Helper.d.ts
ADDED
@@ -1,6 +1,7 @@
|
|
1
1
|
import type { Room } from "white-web-sdk";
|
2
|
+
import type { EmitterType } from "./index";
|
2
3
|
export declare type ReconnectRefresherContext = {
|
3
|
-
|
4
|
+
emitter: EmitterType;
|
4
5
|
};
|
5
6
|
export declare class ReconnectRefresher {
|
6
7
|
private ctx;
|
@@ -8,7 +9,9 @@ export declare class ReconnectRefresher {
|
|
8
9
|
private room;
|
9
10
|
private reactors;
|
10
11
|
private disposers;
|
11
|
-
constructor(
|
12
|
+
constructor(ctx: ReconnectRefresherContext);
|
13
|
+
setRoom(room: Room | undefined): void;
|
14
|
+
setContext(ctx: ReconnectRefresherContext): void;
|
12
15
|
private onPhaseChanged;
|
13
16
|
private onReconnected;
|
14
17
|
private releaseDisposers;
|
package/dist/Utils/Common.d.ts
CHANGED
@@ -4,11 +4,13 @@ import type Emittery from "emittery";
|
|
4
4
|
export declare const genAppId: (kind: string) => Promise<string>;
|
5
5
|
export declare const setViewFocusScenePath: (view: View, focusScenePath: string) => void;
|
6
6
|
export declare const setScenePath: (room: Room | undefined, scenePath: string) => void;
|
7
|
+
export declare const getScenePath: (room: Room | undefined, dir: string | undefined, index: number) => string | undefined;
|
7
8
|
export declare const setViewMode: (view: View, mode: ViewVisionMode) => void;
|
8
9
|
export declare const emitError: (error: Error) => void;
|
9
10
|
export declare const addEmitterOnceListener: (event: any, listener: any) => void;
|
10
11
|
export declare const notifyMainViewModeChange: import("lodash").DebouncedFunc<(callbacks: Emittery<PublicEvent>, mode: ViewVisionMode) => void>;
|
11
|
-
export declare const makeValidScenePath: (displayer: Displayer, scenePath: string) => string;
|
12
|
+
export declare const makeValidScenePath: (displayer: Displayer, scenePath: string, index?: number) => string | undefined;
|
13
|
+
export declare const entireScenes: (displayer: Displayer) => import("white-web-sdk").SceneMap;
|
12
14
|
export declare const isValidScenePath: (scenePath: string) => boolean;
|
13
15
|
export declare const ensureValidScenePath: (scenePath: string) => string;
|
14
16
|
export declare const getVersionNumber: (version: string) => number;
|
package/dist/Utils/Reactive.d.ts
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
import { UpdateEventKind } from "white-web-sdk";
|
2
2
|
import type { AkkoObjectUpdatedListener } from "white-web-sdk";
|
3
3
|
export declare const onObjectByEvent: (event: UpdateEventKind) => (object: any, func: () => void) => (() => void) | undefined;
|
4
|
-
export declare const safeListenPropsUpdated: <T>(getProps: () => T, callback: AkkoObjectUpdatedListener<T
|
4
|
+
export declare const safeListenPropsUpdated: <T>(getProps: () => T, callback: AkkoObjectUpdatedListener<T>, onDestroyed?: ((props: unknown) => void) | undefined) => () => void;
|
5
5
|
export declare const onObjectRemoved: (object: any, func: () => void) => (() => void) | undefined;
|
6
6
|
export declare const onObjectInserted: (object: any, func: () => void) => (() => void) | undefined;
|
@@ -1,9 +1,8 @@
|
|
1
|
-
import { Base } from "
|
1
|
+
import { Base } from "../Base";
|
2
2
|
import type { Camera, Size, View } from "white-web-sdk";
|
3
|
-
import type { AppManager } from "
|
3
|
+
import type { AppManager } from "../AppManager";
|
4
4
|
export declare class MainViewProxy extends Base {
|
5
5
|
private scale?;
|
6
|
-
private cameraStore;
|
7
6
|
private started;
|
8
7
|
private mainViewIsAddListener;
|
9
8
|
private mainView;
|
@@ -35,7 +34,6 @@ export declare class MainViewProxy extends Base {
|
|
35
34
|
private addCameraListener;
|
36
35
|
private removeCameraListener;
|
37
36
|
private onCameraOrSizeUpdated;
|
38
|
-
switchViewModeToWriter(): void;
|
39
37
|
moveCameraToContian(size: Size): void;
|
40
38
|
moveCamera(camera: Camera): void;
|
41
39
|
stop(): void;
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import type { View, Displayer } from "white-web-sdk";
|
2
|
+
export declare class ViewManager {
|
3
|
+
private displayer;
|
4
|
+
views: Map<string, View>;
|
5
|
+
constructor(displayer: Displayer);
|
6
|
+
createView(id: string): View;
|
7
|
+
getView(id: string): View | undefined;
|
8
|
+
destroyView(id: string): void;
|
9
|
+
setViewScenePath(id: string, scenePath: string): void;
|
10
|
+
destroy(): void;
|
11
|
+
}
|
12
|
+
export declare const createView: (displayer: Displayer) => View;
|
13
|
+
export declare const setDefaultCameraBound: (view: View) => void;
|
package/dist/constants.d.ts
CHANGED
@@ -31,13 +31,8 @@ export declare enum CursorState {
|
|
31
31
|
Leave = "leave",
|
32
32
|
Normal = "normal"
|
33
33
|
}
|
34
|
-
export declare const REQUIRE_VERSION = "2.
|
34
|
+
export declare const REQUIRE_VERSION = "2.16.0";
|
35
35
|
export declare const MIN_WIDTH: number;
|
36
36
|
export declare const MIN_HEIGHT: number;
|
37
37
|
export declare const SET_SCENEPATH_DELAY = 100;
|
38
|
-
export declare const DEFAULT_COLLECTOR_STYLE: {
|
39
|
-
right: string;
|
40
|
-
bottom: string;
|
41
|
-
position: string;
|
42
|
-
};
|
43
38
|
export declare const DEFAULT_CONTAINER_RATIO: number;
|
package/dist/index.d.ts
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import Emittery from "emittery";
|
2
2
|
import { AppManager } from "./AppManager";
|
3
3
|
import { CursorManager } from "./Cursor";
|
4
|
+
import { ReconnectRefresher } from "./ReconnectRefresher";
|
4
5
|
import "./style.css";
|
5
6
|
import "@netless/telebox-insider/dist/style.css";
|
6
7
|
import type { TELE_BOX_STATE } from "./BoxManager";
|
@@ -29,11 +30,11 @@ export declare type AddAppOptions = {
|
|
29
30
|
export declare type setAppOptions = AddAppOptions & {
|
30
31
|
appOptions?: any;
|
31
32
|
};
|
32
|
-
export declare type AddAppParams = {
|
33
|
+
export declare type AddAppParams<TAttributes = any> = {
|
33
34
|
kind: string;
|
34
35
|
src?: string;
|
35
36
|
options?: AddAppOptions;
|
36
|
-
attributes?:
|
37
|
+
attributes?: TAttributes;
|
37
38
|
};
|
38
39
|
export declare type BaseInsertParams = {
|
39
40
|
kind: string;
|
@@ -91,6 +92,7 @@ export declare type EmitterEvent = {
|
|
91
92
|
observerIdChange: number;
|
92
93
|
boxStateChange: string;
|
93
94
|
playgroundSizeChange: DOMRect;
|
95
|
+
onReconnected: void;
|
94
96
|
};
|
95
97
|
export declare type EmitterType = Emittery<EmitterEvent>;
|
96
98
|
export declare const emitter: EmitterType;
|
@@ -100,6 +102,9 @@ export declare type PublicEvent = {
|
|
100
102
|
darkModeChange: boolean;
|
101
103
|
prefersColorSchemeChange: TeleBoxColorScheme;
|
102
104
|
cameraStateChange: CameraState;
|
105
|
+
mainViewScenePathChange: string;
|
106
|
+
mainViewSceneIndexChange: number;
|
107
|
+
focusedChange: string | undefined;
|
103
108
|
};
|
104
109
|
export declare type MountParams = {
|
105
110
|
room: Room;
|
@@ -118,6 +123,7 @@ export declare type MountParams = {
|
|
118
123
|
};
|
119
124
|
export declare type CallbacksType = Emittery<PublicEvent>;
|
120
125
|
export declare const callbacks: CallbacksType;
|
126
|
+
export declare const reconnectRefresher: ReconnectRefresher;
|
121
127
|
export declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes> {
|
122
128
|
static kind: string;
|
123
129
|
static displayer: Displayer;
|
@@ -137,20 +143,21 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
137
143
|
isReplay: boolean;
|
138
144
|
private boxManager?;
|
139
145
|
private static params?;
|
146
|
+
private containerResizeObserver?;
|
140
147
|
constructor(context: InvisiblePluginContext);
|
141
148
|
static mount(params: MountParams): Promise<WindowManager>;
|
142
149
|
private static initManager;
|
143
150
|
private static initContainer;
|
144
|
-
bindContainer(container: HTMLElement
|
151
|
+
bindContainer(container: HTMLElement): void;
|
152
|
+
bindCollectorContainer(container: HTMLElement): void;
|
145
153
|
/**
|
146
154
|
* 注册插件
|
147
155
|
*/
|
148
156
|
static register<AppOptions = any, SetupResult = any, Attributes = any>(params: RegisterParams<AppOptions, SetupResult, Attributes>): Promise<void>;
|
149
|
-
static setCollectorContainer(container: HTMLElement): void;
|
150
157
|
/**
|
151
158
|
* 创建一个 app 至白板
|
152
159
|
*/
|
153
|
-
addApp(params: AddAppParams): Promise<string | undefined>;
|
160
|
+
addApp<T = any>(params: AddAppParams<T>): Promise<string | undefined>;
|
154
161
|
private setupScenePath;
|
155
162
|
/**
|
156
163
|
* 设置 mainView 的 ScenePath, 并且切换白板为可写状态
|
@@ -191,6 +198,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
191
198
|
get boxState(): TeleBoxState | undefined;
|
192
199
|
get darkMode(): boolean;
|
193
200
|
get prefersColorScheme(): TeleBoxColorScheme | undefined;
|
201
|
+
get focused(): string | undefined;
|
194
202
|
/**
|
195
203
|
* 查询所有的 App
|
196
204
|
*/
|
@@ -223,13 +231,6 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
223
231
|
private isDynamicPPT;
|
224
232
|
private static checkVersion;
|
225
233
|
private ensureAttributes;
|
226
|
-
private containerResizeObserver?;
|
227
|
-
private observePlaygroundSize;
|
228
|
-
private updateSizer;
|
229
234
|
}
|
230
|
-
export declare const BuiltinApps: {
|
231
|
-
DocsViewer: string;
|
232
|
-
MediaPlayer: string;
|
233
|
-
};
|
234
235
|
export * from "./typings";
|
235
|
-
export {
|
236
|
+
export { BuiltinApps } from "./BuiltinApps";
|