@netless/window-manager 0.4.0-canary.2 → 0.4.0-canary.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/.idea/inspectionProfiles/Project_Default.xml +7 -0
- package/.idea/modules.xml +8 -0
- package/.idea/vcs.xml +6 -0
- package/.idea/window-manager.iml +12 -0
- package/.vscode/settings.json +1 -0
- package/CHANGELOG.md +29 -1
- package/README.md +1 -0
- 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 +39 -0
- package/dist/App/Storage/typings.d.ts +22 -0
- package/dist/App/Storage/utils.d.ts +5 -0
- package/dist/AppContext.d.ts +40 -16
- package/dist/AppListener.d.ts +1 -1
- package/dist/AppManager.d.ts +15 -11
- package/dist/AppProxy.d.ts +6 -5
- package/dist/AttributesDelegate.d.ts +2 -2
- package/dist/BoxManager.d.ts +6 -3
- package/dist/BuiltinApps.d.ts +5 -0
- package/dist/ContainerResizeObserver.d.ts +10 -0
- package/dist/Cursor/Cursor.d.ts +8 -11
- package/dist/Cursor/index.d.ts +5 -16
- package/dist/Helper.d.ts +6 -0
- package/dist/ReconnectRefresher.d.ts +0 -1
- package/dist/Register/storage.d.ts +5 -1
- package/dist/Utils/Common.d.ts +7 -2
- package/dist/Utils/Reactive.d.ts +1 -1
- package/dist/Utils/RoomHacker.d.ts +1 -1
- package/dist/{MainView.d.ts → View/MainView.d.ts} +5 -6
- package/dist/View/ViewManager.d.ts +13 -0
- package/dist/constants.d.ts +3 -7
- package/dist/index.d.ts +25 -10
- package/dist/index.es.js +41 -1
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +41 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/style.css +1 -1
- package/dist/typings.d.ts +3 -2
- package/docs/api.md +36 -6
- package/docs/concept.md +9 -0
- package/package.json +7 -6
- package/src/App/MagixEvent/index.ts +68 -0
- package/src/App/Storage/StorageEvent.ts +21 -0
- package/src/App/Storage/index.ts +289 -0
- package/src/App/Storage/typings.ts +23 -0
- package/src/App/Storage/utils.ts +17 -0
- package/src/AppContext.ts +66 -24
- package/src/AppListener.ts +15 -14
- package/src/AppManager.ts +141 -63
- package/src/AppProxy.ts +50 -52
- package/src/AttributesDelegate.ts +2 -2
- package/src/BoxManager.ts +40 -24
- package/src/BuiltinApps.ts +23 -0
- package/src/ContainerResizeObserver.ts +62 -0
- package/src/Cursor/Cursor.ts +22 -36
- package/src/Cursor/index.ts +33 -139
- package/src/Helper.ts +30 -0
- package/src/ReconnectRefresher.ts +0 -5
- package/src/Register/index.ts +25 -16
- package/src/Register/loader.ts +1 -1
- package/src/Register/storage.ts +6 -1
- package/src/Utils/Common.ts +66 -13
- package/src/Utils/Reactive.ts +9 -3
- package/src/Utils/RoomHacker.ts +42 -13
- package/src/{MainView.ts → View/MainView.ts} +25 -36
- package/src/View/ViewManager.ts +52 -0
- package/src/constants.ts +3 -4
- package/src/index.ts +96 -72
- package/src/shim.d.ts +5 -0
- package/src/style.css +7 -1
- package/src/typings.ts +3 -2
- package/vite.config.js +8 -2
- package/dist/Base/Context.d.ts +0 -13
- package/dist/Base/index.d.ts +0 -7
- package/dist/Utils/CameraStore.d.ts +0 -15
- package/dist/ViewManager.d.ts +0 -29
- package/dist/sdk.d.ts +0 -14
- package/src/Base/Context.ts +0 -49
- package/src/Base/index.ts +0 -10
- package/src/Utils/CameraStore.ts +0 -72
- package/src/sdk.ts +0 -39
- package/src/viewManager.ts +0 -177
@@ -0,0 +1,7 @@
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
2
|
+
<profile version="1.0">
|
3
|
+
<option name="myName" value="Project Default" />
|
4
|
+
<inspection_tool class="ES6UnusedImports" enabled="false" level="WARNING" enabled_by_default="false" />
|
5
|
+
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
|
6
|
+
</profile>
|
7
|
+
</component>
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<project version="4">
|
3
|
+
<component name="ProjectModuleManager">
|
4
|
+
<modules>
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/window-manager.iml" filepath="$PROJECT_DIR$/.idea/window-manager.iml" />
|
6
|
+
</modules>
|
7
|
+
</component>
|
8
|
+
</project>
|
package/.idea/vcs.xml
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<module type="WEB_MODULE" version="4">
|
3
|
+
<component name="NewModuleRootManager">
|
4
|
+
<content url="file://$MODULE_DIR$">
|
5
|
+
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
6
|
+
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
7
|
+
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
8
|
+
</content>
|
9
|
+
<orderEntry type="inheritedJdk" />
|
10
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
11
|
+
</component>
|
12
|
+
</module>
|
package/.vscode/settings.json
CHANGED
package/CHANGELOG.md
CHANGED
@@ -1,9 +1,37 @@
|
|
1
|
-
## 0.4.0
|
1
|
+
## 0.4.0(canary)
|
2
2
|
|
3
3
|
1. 废弃 `WindowManager.mount` 的多参数类型
|
4
4
|
2. 添加 `bindContainer` 接口,`mount` 时 `container` 参数不再是必选
|
5
|
+
3. 关闭 `App` 会移除相关的 `Scenes`
|
6
|
+
4. 添加 `ScenePath` 相同的 `App` 会把这个 `App` 置为最上层
|
7
|
+
5. 代理 `room.putScenes` 和 `room.removeScenes`
|
5
8
|
|
6
9
|
|
10
|
+
## 0.3.25
|
11
|
+
|
12
|
+
1. 修复创建 APP 之后没有设置默认 `zIndex` 的问题
|
13
|
+
|
14
|
+
## 0.3.24
|
15
|
+
|
16
|
+
1. 修复重连之后光标不见的问题(注意: 新的光标同步方式会跟 0.3.24 之前的版本不兼容)
|
17
|
+
2. 修改打包方式, 内部依赖会默认打包
|
18
|
+
3. 确保重复 mount 之后 `WindowManger` 内部状态正确
|
19
|
+
|
20
|
+
## 0.3.23
|
21
|
+
|
22
|
+
1. 修复 ios 上 `boxState` 没有正确回调的问题
|
23
|
+
2. 添加了 `setBoxState` `setMaximized` `setMinimized` 接口
|
24
|
+
|
25
|
+
## 0.3.22
|
26
|
+
|
27
|
+
1. 升级 `@netless/app-docs-viewer` 优化移动端显存占用
|
28
|
+
2. 升级 `@netless/telebox-insider` 优化移动端显存占用
|
29
|
+
|
30
|
+
## 0.3.19-0.3.21
|
31
|
+
|
32
|
+
1. 更新 `@netless/app-docs-viewer`
|
33
|
+
2. 修复 box `zIndex` 同步的问题
|
34
|
+
|
7
35
|
## 0.3.18
|
8
36
|
|
9
37
|
1. 修复最小化时刷新页面 box 位置错误的问题
|
package/README.md
CHANGED
@@ -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,39 @@
|
|
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
|
+
}
|
@@ -0,0 +1,22 @@
|
|
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;
|
@@ -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,8 +9,8 @@ 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;
|
15
|
+
private cursorMoveHandler;
|
16
16
|
}
|
package/dist/AppManager.d.ts
CHANGED
@@ -1,9 +1,8 @@
|
|
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 { ViewManager } from "./ViewManager";
|
4
|
+
import { MainViewProxy } from "./View/MainView";
|
5
|
+
import { ViewManager } from "./View/ViewManager";
|
7
6
|
import type { ReconnectRefresher } from "./ReconnectRefresher";
|
8
7
|
import type { BoxManager } from "./BoxManager";
|
9
8
|
import type { Displayer, Room } from "white-web-sdk";
|
@@ -11,7 +10,6 @@ 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,7 +19,16 @@ 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
|
+
private get eventName();
|
26
|
+
get attributes(): import("./index").WindowMangerAttributes;
|
27
|
+
get canOperate(): boolean;
|
28
|
+
get room(): Room | undefined;
|
29
|
+
get mainView(): import("white-web-sdk").View;
|
30
|
+
get focusApp(): AppProxy | undefined;
|
31
|
+
get uid(): string;
|
25
32
|
private onCreated;
|
26
33
|
/**
|
27
34
|
* 插件更新 attributes 时的回调
|
@@ -36,23 +43,19 @@ export declare class AppManager {
|
|
36
43
|
resetMinimized(): void;
|
37
44
|
private onAppDelete;
|
38
45
|
bindMainView(divElement: HTMLDivElement, disableCameraTransform: boolean): void;
|
46
|
+
setMainViewFocusPath(scenePath?: string): boolean | undefined;
|
39
47
|
addApp(params: AddAppParams, isDynamicPPT: boolean): Promise<string | undefined>;
|
40
48
|
private beforeAddApp;
|
41
49
|
private afterAddApp;
|
42
50
|
closeApp(appId: string): Promise<void>;
|
43
51
|
private baseInsertApp;
|
44
52
|
private displayerStateListener;
|
45
|
-
|
46
|
-
private get eventName();
|
47
|
-
get attributes(): import("./index").WindowMangerAttributes;
|
48
|
-
get canOperate(): boolean;
|
49
|
-
get room(): Room | undefined;
|
50
|
-
get mainView(): import("white-web-sdk").View;
|
51
|
-
get focusApp(): AppProxy | undefined;
|
53
|
+
displayerWritableListener: (isReadonly: boolean) => void;
|
52
54
|
safeSetAttributes(attributes: any): void;
|
53
55
|
safeUpdateAttributes(keys: string[], value: any): void;
|
54
56
|
setMainViewScenePath(scenePath: string): Promise<void>;
|
55
57
|
private _setMainViewScenePath;
|
58
|
+
private updateSceneIndex;
|
56
59
|
setMainViewSceneIndex(index: number): Promise<void>;
|
57
60
|
getAppInitPath(appId: string): string | undefined;
|
58
61
|
safeDispatchMagixEvent(event: string, payload: any): void;
|
@@ -61,5 +64,6 @@ export declare class AppManager {
|
|
61
64
|
onReconnected(): Promise<void>;
|
62
65
|
notifyContainerRectUpdate(rect: TeleBoxRect): void;
|
63
66
|
dispatchInternalEvent(event: Events, payload: any): void;
|
67
|
+
findMemberByUid: (uid: string) => import("white-web-sdk").RoomMember | undefined;
|
64
68
|
destroy(): void;
|
65
69
|
}
|
package/dist/AppProxy.d.ts
CHANGED
@@ -4,9 +4,9 @@ import type { SceneState, View, SceneDefinition } from "white-web-sdk";
|
|
4
4
|
import type { AppManager } from "./AppManager";
|
5
5
|
import type { NetlessApp } from "./typings";
|
6
6
|
import type { ReadonlyTeleBox } from "@netless/telebox-insider";
|
7
|
-
|
8
|
-
export declare class AppProxy extends Base {
|
7
|
+
export declare class AppProxy {
|
9
8
|
private params;
|
9
|
+
private manager;
|
10
10
|
id: string;
|
11
11
|
scenePath?: string;
|
12
12
|
appEmitter: Emittery<AppEmitterEvent>;
|
@@ -15,7 +15,7 @@ export declare class AppProxy extends Base {
|
|
15
15
|
private boxManager;
|
16
16
|
private appProxies;
|
17
17
|
private viewManager;
|
18
|
-
private
|
18
|
+
private store;
|
19
19
|
private kind;
|
20
20
|
isAddApp: boolean;
|
21
21
|
private status;
|
@@ -29,8 +29,9 @@ export declare class AppProxy extends Base {
|
|
29
29
|
get attributes(): any;
|
30
30
|
get appAttributes(): import("./index").AppSyncAttributes;
|
31
31
|
getFullScenePath(): string | undefined;
|
32
|
+
private getFullScenePathFromScenes;
|
32
33
|
setFullPath(path: string): void;
|
33
|
-
baseInsertApp(skipUpdate?: boolean
|
34
|
+
baseInsertApp(skipUpdate?: boolean): Promise<{
|
34
35
|
appId: string;
|
35
36
|
app: NetlessApp;
|
36
37
|
}>;
|
@@ -42,12 +43,12 @@ export declare class AppProxy extends Base {
|
|
42
43
|
private afterSetupApp;
|
43
44
|
onSeek(time: number): void;
|
44
45
|
onReconnected(): Promise<void>;
|
45
|
-
switchToWritable(): void;
|
46
46
|
getAppInitState: (id: string) => AppInitState | undefined;
|
47
47
|
emitAppSceneStateChange(sceneState: SceneState): void;
|
48
48
|
emitAppIsWritableChange(): void;
|
49
49
|
private makeAppEventListener;
|
50
50
|
private appAttributesUpdateListener;
|
51
|
+
private setFocusScenePathHandler;
|
51
52
|
setScenePath(): void;
|
52
53
|
setViewFocusScenePath(): void;
|
53
54
|
private createView;
|
@@ -47,7 +47,7 @@ export declare class AttributesDelegate {
|
|
47
47
|
cleanFocus(): void;
|
48
48
|
getAppSceneIndex(id: string): any;
|
49
49
|
getAppScenePath(id: string): any;
|
50
|
-
getMainViewScenePath():
|
50
|
+
getMainViewScenePath(): string | undefined;
|
51
51
|
getMainViewSceneIndex(): any;
|
52
52
|
getBoxState(): any;
|
53
53
|
setMainViewScenePath(scenePath: string): void;
|
@@ -60,7 +60,7 @@ export declare class AttributesDelegate {
|
|
60
60
|
setMainViewSize(size: (Size & {
|
61
61
|
id: string;
|
62
62
|
}) | undefined): void;
|
63
|
-
setAppFocus(appId: string, focus: boolean)
|
63
|
+
setAppFocus: (appId: string, focus: boolean) => void;
|
64
64
|
updateCursor(uid: string, position: Position): void;
|
65
65
|
updateCursorState(uid: string, cursorState: string | undefined): void;
|
66
66
|
getCursorState(uid: string): any;
|
package/dist/BoxManager.d.ts
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { AppAttributes } from "./constants";
|
2
|
-
import { TELE_BOX_STATE, TeleBoxManager } from "@netless/telebox-insider";
|
3
2
|
import { WindowManager } from "./index";
|
3
|
+
import { TELE_BOX_STATE, TeleBoxManager } from "@netless/telebox-insider";
|
4
4
|
import type { AddAppOptions, AppInitState, EmitterType, CallbacksType } from "./index";
|
5
|
-
import type { TeleBoxManagerUpdateConfig, ReadonlyTeleBox, TeleBoxColorScheme, TeleBoxRect } from "@netless/telebox-insider";
|
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";
|
@@ -49,6 +49,7 @@ export declare type BoxManagerContext = {
|
|
49
49
|
canOperate: () => boolean;
|
50
50
|
notifyContainerRectUpdate: (rect: TeleBoxRect) => void;
|
51
51
|
cleanFocus: () => void;
|
52
|
+
setAppFocus: (appId: string) => void;
|
52
53
|
};
|
53
54
|
export declare const createBoxManager: (manager: WindowManager, callbacks: CallbacksType, emitter: EmitterType, options: CreateTeleBoxManagerConfig) => BoxManager;
|
54
55
|
export declare class BoxManager {
|
@@ -56,6 +57,7 @@ export declare class BoxManager {
|
|
56
57
|
private createTeleBoxManagerConfig?;
|
57
58
|
teleBoxManager: TeleBoxManager;
|
58
59
|
constructor(context: BoxManagerContext, createTeleBoxManagerConfig?: CreateTeleBoxManagerConfig | undefined);
|
60
|
+
private playgroundSizeChangeListener;
|
59
61
|
private get mainView();
|
60
62
|
private get canOperate();
|
61
63
|
get boxState(): "normal" | "minimized" | "maximized";
|
@@ -82,9 +84,10 @@ export declare class BoxManager {
|
|
82
84
|
setBoxTitle(params: SetBoxTitleParams): void;
|
83
85
|
blurAllBox(): void;
|
84
86
|
updateAll(config: TeleBoxManagerUpdateConfig): void;
|
85
|
-
setMaximized(maximized: boolean): void;
|
87
|
+
setMaximized(maximized: boolean, skipUpdate?: boolean): void;
|
86
88
|
setMinimized(minimized: boolean, skipUpdate?: boolean): void;
|
87
89
|
focusTopBox(): void;
|
90
|
+
updateBox(id: string, payload: TeleBoxConfig, skipUpdate?: boolean): void;
|
88
91
|
setReadonly(readonly: boolean): void;
|
89
92
|
setPrefersColorScheme(colorScheme: TeleBoxColorScheme): void;
|
90
93
|
setZIndex(id: string, zIndex: number, skipUpdate?: boolean): void;
|
@@ -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
@@ -1,22 +1,21 @@
|
|
1
|
-
import { ApplianceNames } from
|
2
|
-
import {
|
3
|
-
import type { Position } from '../AttributesDelegate';
|
1
|
+
import { ApplianceNames } from "white-web-sdk";
|
2
|
+
import type { Position } from "../AttributesDelegate";
|
4
3
|
import type { CursorManager } from "./index";
|
5
|
-
import {
|
6
|
-
import type { AppManager } from '../AppManager';
|
4
|
+
import type { AppManager } from "../AppManager";
|
7
5
|
export declare type Payload = {
|
8
6
|
[key: string]: any;
|
9
7
|
};
|
10
|
-
export declare class Cursor
|
11
|
-
private
|
8
|
+
export declare class Cursor {
|
9
|
+
private manager;
|
12
10
|
private memberId;
|
13
11
|
private cursorManager;
|
14
12
|
private wrapper?;
|
15
13
|
private member?;
|
16
14
|
private timer?;
|
17
15
|
private component?;
|
18
|
-
constructor(manager: AppManager,
|
19
|
-
|
16
|
+
constructor(manager: AppManager, memberId: string, cursorManager: CursorManager, wrapper?: HTMLElement | undefined);
|
17
|
+
move: (position: Position) => void;
|
18
|
+
leave: () => void;
|
20
19
|
private moveCursor;
|
21
20
|
get memberApplianceName(): ApplianceNames | undefined;
|
22
21
|
get memberColor(): string;
|
@@ -27,8 +26,6 @@ export declare class Cursor extends Base {
|
|
27
26
|
private get memberCursorTagBackgroundColor();
|
28
27
|
private get memberAvatar();
|
29
28
|
private get memberOpacity();
|
30
|
-
get cursorState(): CursorState | undefined;
|
31
|
-
get cursorPosition(): Position | undefined;
|
32
29
|
private autoHidden;
|
33
30
|
private createCursor;
|
34
31
|
private initProps;
|
package/dist/Cursor/index.d.ts
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
import { Base } from "../Base";
|
2
1
|
import { Cursor } from "./Cursor";
|
3
|
-
import {
|
4
|
-
import type { PositionType, Position } from "../AttributesDelegate";
|
2
|
+
import type { PositionType } from "../AttributesDelegate";
|
5
3
|
import type { RoomMember, View } from "white-web-sdk";
|
6
4
|
import type { AppManager } from "../AppManager";
|
7
5
|
export declare type EventType = {
|
@@ -13,21 +11,18 @@ export declare type MoveCursorParams = {
|
|
13
11
|
x: number;
|
14
12
|
y: number;
|
15
13
|
};
|
16
|
-
export declare class CursorManager
|
17
|
-
private
|
14
|
+
export declare class CursorManager {
|
15
|
+
private manager;
|
18
16
|
containerRect?: DOMRect;
|
19
17
|
wrapperRect?: DOMRect;
|
20
18
|
cursorInstances: Map<string, Cursor>;
|
21
19
|
roomMembers?: readonly RoomMember[];
|
22
20
|
private mainViewElement?;
|
23
21
|
private sideEffectManager;
|
24
|
-
|
22
|
+
private store;
|
23
|
+
constructor(manager: AppManager);
|
25
24
|
setupWrapper(wrapper: HTMLElement): void;
|
26
25
|
setMainViewDivElement(div: HTMLDivElement): void;
|
27
|
-
private startReaction;
|
28
|
-
private getUids;
|
29
|
-
private handleRoomMembersChange;
|
30
|
-
get cursors(): any;
|
31
26
|
get boxState(): any;
|
32
27
|
get focusView(): View | undefined;
|
33
28
|
private mouseMoveListener;
|
@@ -37,15 +32,9 @@ export declare class CursorManager extends Base {
|
|
37
32
|
* 因为窗口内框在不同分辨率下的大小不一样,所以这里通过来鼠标事件的 target 来判断是在主白板还是在 APP 中
|
38
33
|
*/
|
39
34
|
private getType;
|
40
|
-
private initCursorAttributes;
|
41
|
-
private setNormalCursorState;
|
42
35
|
private mouseLeaveListener;
|
43
36
|
updateContainerRect(): void;
|
44
|
-
setRoomMembers(members: readonly RoomMember[]): void;
|
45
37
|
deleteCursor(uid: string): void;
|
46
38
|
hideCursor(uid: string): void;
|
47
|
-
cleanMemberAttributes(members: readonly RoomMember[]): void;
|
48
|
-
onReconnect(): void;
|
49
|
-
addCursorChangeListener: (uid: string, callback: (position: Position, state: CursorState) => void) => void;
|
50
39
|
destroy(): void;
|
51
40
|
}
|
package/dist/Helper.d.ts
ADDED
@@ -1,4 +1,8 @@
|
|
1
|
+
export declare type Item = {
|
2
|
+
kind: string;
|
3
|
+
sourceCode: string;
|
4
|
+
};
|
1
5
|
export declare const initDb: () => Promise<void>;
|
2
6
|
export declare const setItem: (key: string, val: any) => Promise<void> | undefined;
|
3
|
-
export declare const getItem: (key: string) => Promise<
|
7
|
+
export declare const getItem: (key: string) => Promise<Item | null>;
|
4
8
|
export declare const removeItem: (key: string) => Promise<void> | undefined;
|
package/dist/Utils/Common.d.ts
CHANGED
@@ -2,14 +2,19 @@ import type { PublicEvent } from "../index";
|
|
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>;
|
5
|
-
export declare const setViewFocusScenePath: (view: View, focusScenePath: string) =>
|
5
|
+
export declare const setViewFocusScenePath: (view: View, focusScenePath: string) => View | undefined;
|
6
|
+
export declare const setViewSceneIndex: (view: View, index: number) => View | undefined;
|
6
7
|
export declare const setScenePath: (room: Room | undefined, scenePath: string) => void;
|
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;
|
7
10
|
export declare const setViewMode: (view: View, mode: ViewVisionMode) => void;
|
8
11
|
export declare const emitError: (error: Error) => void;
|
9
12
|
export declare const addEmitterOnceListener: (event: any, listener: any) => void;
|
10
13
|
export declare const notifyMainViewModeChange: import("lodash").DebouncedFunc<(callbacks: Emittery<PublicEvent>, mode: ViewVisionMode) => void>;
|
11
|
-
export declare const makeValidScenePath: (displayer: Displayer, scenePath: string) => string;
|
14
|
+
export declare const makeValidScenePath: (displayer: Displayer, scenePath: string, index?: number) => string | undefined;
|
15
|
+
export declare const entireScenes: (displayer: Displayer) => import("white-web-sdk").SceneMap;
|
12
16
|
export declare const isValidScenePath: (scenePath: string) => boolean;
|
17
|
+
export declare const parseSceneDir: (scenePath: string) => string;
|
13
18
|
export declare const ensureValidScenePath: (scenePath: string) => string;
|
14
19
|
export declare const getVersionNumber: (version: string) => number;
|
15
20
|
export declare const wait: (time: number) => Promise<unknown>;
|
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;
|