@netless/window-manager 0.4.0-canary.6 → 0.4.0
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 +39 -2
- package/README.md +3 -0
- package/dist/App/MagixEvent/index.d.ts +29 -0
- package/dist/App/Storage/index.d.ts +19 -6
- package/dist/App/Storage/typings.d.ts +4 -0
- package/dist/AppContext.d.ts +39 -17
- package/dist/AppListener.d.ts +2 -1
- package/dist/AppManager.d.ts +25 -11
- package/dist/AppProxy.d.ts +7 -8
- 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 +10 -12
- package/dist/Cursor/index.d.ts +6 -16
- package/dist/Helper.d.ts +7 -0
- package/dist/Register/storage.d.ts +5 -1
- package/dist/Utils/AppCreateQueue.d.ts +11 -0
- package/dist/Utils/Common.d.ts +7 -2
- package/dist/Utils/RoomHacker.d.ts +3 -3
- package/dist/{MainView.d.ts → View/MainView.d.ts} +5 -6
- package/dist/View/ViewManager.d.ts +13 -0
- package/dist/constants.d.ts +5 -7
- package/dist/index.d.ts +35 -16
- 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/advanced.md +39 -0
- package/docs/api.md +69 -6
- package/docs/concept.md +9 -0
- package/docs/replay.md +40 -0
- package/package.json +7 -6
- package/src/App/MagixEvent/index.ts +68 -0
- package/src/App/Storage/index.ts +90 -44
- package/src/App/Storage/typings.ts +8 -0
- package/src/AppContext.ts +61 -25
- package/src/AppListener.ts +28 -16
- package/src/AppManager.ts +260 -81
- package/src/AppProxy.ts +53 -64
- 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.svelte +25 -21
- package/src/Cursor/Cursor.ts +25 -38
- package/src/Cursor/icons.ts +2 -0
- package/src/Cursor/index.ts +45 -139
- package/src/Helper.ts +41 -0
- package/src/Register/index.ts +25 -16
- package/src/Register/loader.ts +2 -2
- package/src/Register/storage.ts +6 -1
- package/src/Utils/AppCreateQueue.ts +54 -0
- package/src/Utils/Common.ts +69 -14
- package/src/Utils/RoomHacker.ts +44 -14
- package/src/{MainView.ts → View/MainView.ts} +25 -36
- package/src/View/ViewManager.ts +52 -0
- package/src/constants.ts +6 -4
- package/src/image/laser-pointer-cursor.svg +17 -0
- package/src/index.ts +164 -99
- package/src/shim.d.ts +5 -0
- package/src/style.css +12 -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
@@ -1,3 +1,3 @@
|
|
1
|
-
import type { WindowManager } from
|
2
|
-
import type { Room } from "white-web-sdk";
|
3
|
-
export declare const replaceRoomFunction: (room: Room, manager: WindowManager) => void;
|
1
|
+
import type { WindowManager } from "../index";
|
2
|
+
import type { Room, Player } from "white-web-sdk";
|
3
|
+
export declare const replaceRoomFunction: (room: Room | Player, manager: WindowManager) => void;
|
@@ -1,13 +1,12 @@
|
|
1
|
-
import { Base } from "./Base";
|
2
1
|
import type { Camera, Size, View } from "white-web-sdk";
|
3
|
-
import type { AppManager } from "
|
4
|
-
export declare class MainViewProxy
|
2
|
+
import type { AppManager } from "../AppManager";
|
3
|
+
export declare class MainViewProxy {
|
4
|
+
private manager;
|
5
5
|
private scale?;
|
6
|
-
private cameraStore;
|
7
6
|
private started;
|
8
7
|
private mainViewIsAddListener;
|
9
8
|
private mainView;
|
10
|
-
private
|
9
|
+
private store;
|
11
10
|
private sideEffectManager;
|
12
11
|
constructor(manager: AppManager);
|
13
12
|
private get mainViewCamera();
|
@@ -26,6 +25,7 @@ export declare class MainViewProxy extends Base {
|
|
26
25
|
scale: number;
|
27
26
|
};
|
28
27
|
createMainView(): View;
|
28
|
+
onReconnect(): void;
|
29
29
|
private onCameraUpdatedByDevice;
|
30
30
|
addMainViewListener(): void;
|
31
31
|
removeMainViewListener(): void;
|
@@ -35,7 +35,6 @@ export declare class MainViewProxy extends Base {
|
|
35
35
|
private addCameraListener;
|
36
36
|
private removeCameraListener;
|
37
37
|
private onCameraOrSizeUpdated;
|
38
|
-
switchViewModeToWriter(): void;
|
39
38
|
moveCameraToContian(size: Size): void;
|
40
39
|
moveCamera(camera: Camera): void;
|
41
40
|
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
@@ -10,7 +10,9 @@ export declare enum Events {
|
|
10
10
|
SetMainViewScenePath = "SetMainViewScenePath",
|
11
11
|
SetMainViewSceneIndex = "SetMainViewSceneIndex",
|
12
12
|
SwitchViewsToFreedom = "SwitchViewsToFreedom",
|
13
|
-
|
13
|
+
MoveCamera = "MoveCamera",
|
14
|
+
MoveCameraToContain = "MoveCameraToContain",
|
15
|
+
CursorMove = "CursorMove"
|
14
16
|
}
|
15
17
|
export declare const MagixEventName = "__WindowManger";
|
16
18
|
export declare enum AppAttributes {
|
@@ -31,13 +33,9 @@ export declare enum CursorState {
|
|
31
33
|
Leave = "leave",
|
32
34
|
Normal = "normal"
|
33
35
|
}
|
34
|
-
export declare const REQUIRE_VERSION = "2.
|
36
|
+
export declare const REQUIRE_VERSION = "2.16.1";
|
35
37
|
export declare const MIN_WIDTH: number;
|
36
38
|
export declare const MIN_HEIGHT: number;
|
37
39
|
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
40
|
export declare const DEFAULT_CONTAINER_RATIO: number;
|
41
|
+
export declare const ROOT_DIR = "/";
|
package/dist/index.d.ts
CHANGED
@@ -1,18 +1,17 @@
|
|
1
1
|
import Emittery from "emittery";
|
2
2
|
import { AppManager } from "./AppManager";
|
3
3
|
import { CursorManager } from "./Cursor";
|
4
|
+
import { InvisiblePlugin, ViewMode } from "white-web-sdk";
|
5
|
+
import { ReconnectRefresher } from "./ReconnectRefresher";
|
4
6
|
import "./style.css";
|
5
7
|
import "@netless/telebox-insider/dist/style.css";
|
6
|
-
import "@netless/app-docs-viewer/dist/style.css";
|
7
8
|
import type { TELE_BOX_STATE } from "./BoxManager";
|
8
|
-
import type { Apps } from "./AttributesDelegate";
|
9
|
-
import {
|
10
|
-
import type { Displayer, SceneDefinition, View, Room, InvisiblePluginContext, Camera, AnimationMode, CameraBound, Point, Rectangle, ViewVisionMode, CameraState } from "white-web-sdk";
|
9
|
+
import type { Apps, Position } from "./AttributesDelegate";
|
10
|
+
import type { Displayer, SceneDefinition, View, Room, InvisiblePluginContext, Camera, AnimationMode, CameraBound, Point, Rectangle, ViewVisionMode, CameraState, Player } from "white-web-sdk";
|
11
11
|
import type { AppListeners } from "./AppListener";
|
12
12
|
import type { NetlessApp, RegisterParams } from "./typings";
|
13
13
|
import type { TeleBoxColorScheme, TeleBoxState } from "@netless/telebox-insider";
|
14
14
|
import type { AppProxy } from "./AppProxy";
|
15
|
-
import { ReconnectRefresher } from "./ReconnectRefresher";
|
16
15
|
export declare type WindowMangerAttributes = {
|
17
16
|
modelValue?: string;
|
18
17
|
boxState: TELE_BOX_STATE;
|
@@ -66,6 +65,11 @@ export declare type AppInitState = {
|
|
66
65
|
boxState?: TeleBoxState;
|
67
66
|
zIndex?: number;
|
68
67
|
};
|
68
|
+
export declare type CursorMovePayload = {
|
69
|
+
uid: string;
|
70
|
+
state?: "leave";
|
71
|
+
position: Position;
|
72
|
+
};
|
69
73
|
export declare type EmitterEvent = {
|
70
74
|
onCreated: undefined;
|
71
75
|
InitReplay: AppInitState;
|
@@ -94,6 +98,8 @@ export declare type EmitterEvent = {
|
|
94
98
|
boxStateChange: string;
|
95
99
|
playgroundSizeChange: DOMRect;
|
96
100
|
onReconnected: void;
|
101
|
+
removeScenes: string;
|
102
|
+
cursorMove: CursorMovePayload;
|
97
103
|
};
|
98
104
|
export declare type EmitterType = Emittery<EmitterEvent>;
|
99
105
|
export declare const emitter: EmitterType;
|
@@ -103,9 +109,15 @@ export declare type PublicEvent = {
|
|
103
109
|
darkModeChange: boolean;
|
104
110
|
prefersColorSchemeChange: TeleBoxColorScheme;
|
105
111
|
cameraStateChange: CameraState;
|
112
|
+
mainViewScenePathChange: string;
|
113
|
+
mainViewSceneIndexChange: number;
|
114
|
+
focusedChange: string | undefined;
|
115
|
+
mainViewScenesLengthChange: number;
|
116
|
+
canRedoStepsChange: number;
|
117
|
+
canUndoStepsChange: number;
|
106
118
|
};
|
107
119
|
export declare type MountParams = {
|
108
|
-
room: Room;
|
120
|
+
room: Room | Player;
|
109
121
|
container?: HTMLElement;
|
110
122
|
/** 白板高宽比例, 默认为 9 / 16 */
|
111
123
|
containerSizeRatio?: number;
|
@@ -132,6 +144,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
132
144
|
static containerSizeRatio: number;
|
133
145
|
private static isCreated;
|
134
146
|
version: string;
|
147
|
+
dependencies: Record<string, string>;
|
135
148
|
appListeners?: AppListeners;
|
136
149
|
readonly?: boolean;
|
137
150
|
emitter: Emittery<PublicEvent>;
|
@@ -141,6 +154,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
141
154
|
isReplay: boolean;
|
142
155
|
private boxManager?;
|
143
156
|
private static params?;
|
157
|
+
private containerResizeObserver?;
|
144
158
|
constructor(context: InvisiblePluginContext);
|
145
159
|
static mount(params: MountParams): Promise<WindowManager>;
|
146
160
|
private static initManager;
|
@@ -167,7 +181,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
167
181
|
/**
|
168
182
|
* 返回 mainView 的 ScenePath
|
169
183
|
*/
|
170
|
-
getMainViewScenePath(): string;
|
184
|
+
getMainViewScenePath(): string | undefined;
|
171
185
|
/**
|
172
186
|
* 返回 mainView 的 SceneIndex
|
173
187
|
*/
|
@@ -188,6 +202,9 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
188
202
|
* 设置 ViewMode
|
189
203
|
*/
|
190
204
|
setViewMode(mode: ViewMode): void;
|
205
|
+
setBoxState(boxState: TeleBoxState): void;
|
206
|
+
setMaximized(maximized: boolean): void;
|
207
|
+
setMinimized(minimized: boolean): void;
|
191
208
|
get mainView(): View;
|
192
209
|
get camera(): Camera;
|
193
210
|
get cameraState(): CameraState;
|
@@ -195,6 +212,13 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
195
212
|
get boxState(): TeleBoxState | undefined;
|
196
213
|
get darkMode(): boolean;
|
197
214
|
get prefersColorScheme(): TeleBoxColorScheme | undefined;
|
215
|
+
get focused(): string | undefined;
|
216
|
+
get mainViewSceneIndex(): number;
|
217
|
+
get mainViewSceneDir(): string;
|
218
|
+
get topApp(): string | undefined;
|
219
|
+
get mainViewScenesLength(): number;
|
220
|
+
get canRedoSteps(): number;
|
221
|
+
get canUndoSteps(): number;
|
198
222
|
/**
|
199
223
|
* 查询所有的 App
|
200
224
|
*/
|
@@ -224,16 +248,11 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
224
248
|
safeSetAttributes(attributes: any): void;
|
225
249
|
safeUpdateAttributes(keys: string[], value: any): void;
|
226
250
|
setPrefersColorScheme(scheme: TeleBoxColorScheme): void;
|
251
|
+
cleanCurrentScene(): void;
|
252
|
+
redo(): number;
|
253
|
+
undo(): number;
|
227
254
|
private isDynamicPPT;
|
228
|
-
private static checkVersion;
|
229
255
|
private ensureAttributes;
|
230
|
-
private containerResizeObserver?;
|
231
|
-
private observePlaygroundSize;
|
232
|
-
private updateSizer;
|
233
256
|
}
|
234
|
-
export declare const BuiltinApps: {
|
235
|
-
DocsViewer: string;
|
236
|
-
MediaPlayer: string;
|
237
|
-
};
|
238
257
|
export * from "./typings";
|
239
|
-
export {
|
258
|
+
export { BuiltinApps } from "./BuiltinApps";
|