@netless/window-manager 1.0.0-canary.5 → 1.0.0-canary.52
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/README.md +30 -6
- package/dist/index.cjs.js +12477 -34
- package/dist/index.es.js +6842 -10498
- package/dist/index.umd.js +12485 -46
- package/dist/{App → src/App}/AppContext.d.ts +12 -7
- package/dist/{App → src/App}/AppPageStateImpl.d.ts +0 -0
- package/dist/{App → src/App}/AppProxy.d.ts +29 -11
- package/dist/{App → src/App}/MagixEvent/index.d.ts +0 -0
- package/dist/{App → src/App}/Storage/StorageEvent.d.ts +0 -0
- package/dist/{App → src/App}/Storage/index.d.ts +0 -0
- package/dist/{App → src/App}/Storage/typings.d.ts +0 -0
- package/dist/{App → src/App}/Storage/utils.d.ts +0 -0
- package/dist/src/App/WhiteboardView.d.ts +27 -0
- package/dist/{App → src/App}/index.d.ts +1 -0
- package/dist/src/App/type.d.ts +21 -0
- package/dist/{AppListener.d.ts → src/AppListener.d.ts} +2 -2
- package/dist/{AppManager.d.ts → src/AppManager.d.ts} +6 -5
- package/dist/{AttributesDelegate.d.ts → src/AttributesDelegate.d.ts} +5 -2
- package/dist/{BoxEmitter.d.ts → src/BoxEmitter.d.ts} +0 -0
- package/dist/{BoxManager.d.ts → src/BoxManager.d.ts} +12 -6
- package/dist/{BuiltinApps.d.ts → src/BuiltinApps.d.ts} +3 -0
- package/dist/{Cursor → src/Cursor}/Cursor.d.ts +0 -0
- package/dist/{Cursor → src/Cursor}/icons.d.ts +0 -0
- package/dist/{Cursor → src/Cursor}/index.d.ts +3 -3
- package/dist/{Helper.d.ts → src/Helper.d.ts} +4 -8
- package/dist/{InternalEmitter.d.ts → src/InternalEmitter.d.ts} +3 -4
- package/dist/{Page → src/Page}/PageController.d.ts +2 -1
- package/dist/{Page → src/Page}/index.d.ts +0 -0
- package/dist/{PageState.d.ts → src/PageState.d.ts} +0 -0
- package/dist/{ReconnectRefresher.d.ts → src/ReconnectRefresher.d.ts} +0 -0
- package/dist/{RedoUndo.d.ts → src/RedoUndo.d.ts} +0 -0
- package/dist/{Register → src/Register}/index.d.ts +4 -2
- package/dist/{Register → src/Register}/loader.d.ts +1 -1
- package/dist/src/Register/storage.d.ts +11 -0
- package/dist/{Utils → src/Utils}/AppCreateQueue.d.ts +0 -0
- package/dist/{Utils → src/Utils}/Common.d.ts +0 -0
- package/dist/{Utils → src/Utils}/Reactive.d.ts +0 -0
- package/dist/{Utils → src/Utils}/RoomHacker.d.ts +0 -0
- package/dist/{Utils → src/Utils}/error.d.ts +1 -1
- package/dist/{Utils → src/Utils}/log.d.ts +0 -0
- package/dist/src/View/CameraSynchronizer.d.ts +19 -0
- package/dist/{View → src/View}/MainView.d.ts +18 -7
- package/dist/{View → src/View}/ViewManager.d.ts +0 -0
- package/dist/src/View/ViewSync.d.ts +29 -0
- package/dist/{callback.d.ts → src/callback.d.ts} +10 -1
- package/dist/{constants.d.ts → src/constants.d.ts} +10 -5
- package/dist/src/image.d.ts +19 -0
- package/dist/{index.d.ts → src/index.d.ts} +49 -14
- package/dist/src/shim.d.ts +11 -0
- package/dist/{typings.d.ts → src/typings.d.ts} +12 -3
- package/dist/style.css +795 -1
- package/docs/app-context.md +155 -27
- package/docs/mirgrate-to-1.0.md +68 -0
- package/package.json +23 -19
- package/playwright.config.ts +29 -0
- package/pnpm-lock.yaml +3078 -4412
- package/src/App/AppContext.ts +62 -29
- package/src/App/AppProxy.ts +235 -113
- package/src/App/WhiteboardView.ts +34 -12
- package/src/App/index.ts +1 -0
- package/src/App/type.ts +22 -0
- package/src/AppListener.ts +30 -21
- package/src/AppManager.ts +68 -45
- package/src/AttributesDelegate.ts +6 -3
- package/src/BoxManager.ts +76 -38
- package/src/BuiltinApps.ts +9 -8
- package/src/Cursor/Cursor.ts +7 -3
- package/src/Cursor/index.ts +7 -8
- package/src/Helper.ts +25 -7
- package/src/InternalEmitter.ts +3 -4
- package/src/Page/PageController.ts +2 -1
- package/src/PageState.ts +1 -1
- package/src/ReconnectRefresher.ts +6 -2
- package/src/Register/index.ts +36 -14
- package/src/Register/loader.ts +20 -9
- package/src/Register/storage.ts +26 -5
- package/src/Utils/Common.ts +3 -0
- package/src/Utils/Reactive.ts +27 -26
- package/src/Utils/RoomHacker.ts +3 -0
- package/src/Utils/error.ts +2 -2
- package/src/View/CameraSynchronizer.ts +41 -38
- package/src/View/MainView.ts +117 -76
- package/src/View/ViewSync.ts +123 -6
- package/src/callback.ts +6 -1
- package/src/constants.ts +8 -3
- package/src/index.ts +201 -63
- package/src/style.css +3 -46
- package/src/typings.ts +14 -3
- package/vite.config.js +12 -7
- package/dist/App/AppViewSync.d.ts +0 -11
- package/dist/App/WhiteboardView.d.ts +0 -21
- package/dist/Register/storage.d.ts +0 -8
- package/dist/View/CameraSynchronizer.d.ts +0 -17
- package/dist/View/ViewSync.d.ts +0 -7
- package/src/App/AppViewSync.ts +0 -69
@@ -5,18 +5,18 @@ export declare enum Events {
|
|
5
5
|
AppBoxStateChange = "AppBoxStateChange",
|
6
6
|
GetAttributes = "GetAttributes",
|
7
7
|
UpdateWindowManagerWrapper = "UpdateWindowManagerWrapper",
|
8
|
-
InitReplay = "InitReplay",
|
9
8
|
WindowCreated = "WindowCreated",
|
10
9
|
SetMainViewScenePath = "SetMainViewScenePath",
|
11
10
|
SetMainViewSceneIndex = "SetMainViewSceneIndex",
|
12
11
|
SetAppFocusIndex = "SetAppFocusIndex",
|
13
12
|
SwitchViewsToFreedom = "SwitchViewsToFreedom",
|
14
|
-
MoveCamera = "MoveCamera",
|
15
|
-
MoveCameraToContain = "MoveCameraToContain",
|
16
13
|
CursorMove = "CursorMove",
|
17
14
|
RootDirRemoved = "RootDirRemoved",
|
18
15
|
Refresh = "Refresh",
|
19
|
-
InitMainViewCamera = "InitMainViewCamera"
|
16
|
+
InitMainViewCamera = "InitMainViewCamera",
|
17
|
+
InvokeAttributesUpdateCallback = "InvokeAttributesUpdateCallback",
|
18
|
+
MoveCamera = "MoveCamera",
|
19
|
+
MoveCameraToContain = "moveCameraToContain"
|
20
20
|
}
|
21
21
|
export declare const MagixEventName = "__WindowManger";
|
22
22
|
export declare const EnsureReconnectEvent = "__WindowMangerEnsureReconnected__";
|
@@ -24,7 +24,12 @@ export declare enum AppAttributes {
|
|
24
24
|
Size = "size",
|
25
25
|
Position = "position",
|
26
26
|
SceneIndex = "SceneIndex",
|
27
|
-
ZIndex = "zIndex"
|
27
|
+
ZIndex = "zIndex",
|
28
|
+
Visible = "visible",
|
29
|
+
Ratio = "ratio",
|
30
|
+
StageRatio = "stageRatio",
|
31
|
+
Draggable = "draggable",
|
32
|
+
Resizable = "resizable"
|
28
33
|
}
|
29
34
|
export declare enum AppEvents {
|
30
35
|
setBoxSize = "setBoxSize",
|
@@ -0,0 +1,19 @@
|
|
1
|
+
declare module "*.svg" {
|
2
|
+
const content: string;
|
3
|
+
export default content;
|
4
|
+
}
|
5
|
+
|
6
|
+
declare module "*.jpg" {
|
7
|
+
const content: string;
|
8
|
+
export default content;
|
9
|
+
}
|
10
|
+
|
11
|
+
declare module "*.png" {
|
12
|
+
const content: string;
|
13
|
+
export default content;
|
14
|
+
}
|
15
|
+
|
16
|
+
declare module "*.gif" {
|
17
|
+
const content: string;
|
18
|
+
export default content;
|
19
|
+
}
|
@@ -1,16 +1,14 @@
|
|
1
1
|
import { AppManager } from "./AppManager";
|
2
2
|
import { CursorManager } from "./Cursor";
|
3
|
-
import { InvisiblePlugin, ViewMode } from "white-web-sdk";
|
3
|
+
import { AnimationMode, InvisiblePlugin, ViewMode } from "white-web-sdk";
|
4
4
|
import { ReconnectRefresher } from "./ReconnectRefresher";
|
5
|
-
import "
|
6
|
-
import "./style.css";
|
7
|
-
import "@netless/telebox-insider/dist/style.css";
|
5
|
+
import { Val } from "value-enhancer";
|
8
6
|
import type { TELE_BOX_STATE } from "./BoxManager";
|
9
7
|
import type { Apps, Position, ICamera, ISize } from "./AttributesDelegate";
|
10
|
-
import type { Displayer, SceneDefinition, View, Room, InvisiblePluginContext, Camera,
|
8
|
+
import type { Displayer, SceneDefinition, View, Room, InvisiblePluginContext, Camera, CameraBound, Point, CameraState, Player, ImageInformation, SceneState, Size } from "white-web-sdk";
|
11
9
|
import type { AppListeners } from "./AppListener";
|
12
10
|
import type { ApplianceIcons, NetlessApp, RegisterParams } from "./typings";
|
13
|
-
import type { TeleBoxColorScheme, TeleBoxState } from "@netless/telebox-insider";
|
11
|
+
import type { TeleBoxColorScheme, TeleBoxFullscreen, TeleBoxManager, TeleBoxManagerThemeConfig, TeleBoxState } from "@netless/telebox-insider";
|
14
12
|
import type { AppProxy } from "./App";
|
15
13
|
import type { PublicEvent } from "./callback";
|
16
14
|
import type Emittery from "emittery";
|
@@ -56,6 +54,7 @@ export declare type AppSyncAttributes = {
|
|
56
54
|
createdAt?: number;
|
57
55
|
camera?: ICamera;
|
58
56
|
size?: ISize;
|
57
|
+
setup: boolean;
|
59
58
|
};
|
60
59
|
export declare type AppInitState = {
|
61
60
|
id: string;
|
@@ -69,6 +68,11 @@ export declare type AppInitState = {
|
|
69
68
|
sceneIndex?: number;
|
70
69
|
boxState?: TeleBoxState;
|
71
70
|
zIndex?: number;
|
71
|
+
visible?: boolean;
|
72
|
+
stageRatio?: number;
|
73
|
+
resizable?: boolean;
|
74
|
+
draggable?: boolean;
|
75
|
+
ratio?: number;
|
72
76
|
};
|
73
77
|
export declare type CursorMovePayload = {
|
74
78
|
uid: string;
|
@@ -80,8 +84,6 @@ export declare type MountParams = {
|
|
80
84
|
container?: HTMLElement;
|
81
85
|
/** 白板高宽比例, 默认为 9 / 16 */
|
82
86
|
containerSizeRatio?: number;
|
83
|
-
/** 显示 PS 透明背景,默认 true */
|
84
|
-
chessboard?: boolean;
|
85
87
|
collectorContainer?: HTMLElement;
|
86
88
|
collectorStyles?: Partial<CSSStyleDeclaration>;
|
87
89
|
overwriteStyles?: string;
|
@@ -89,7 +91,18 @@ export declare type MountParams = {
|
|
89
91
|
debug?: boolean;
|
90
92
|
disableCameraTransform?: boolean;
|
91
93
|
prefersColorScheme?: TeleBoxColorScheme;
|
94
|
+
/** @deprecated */
|
95
|
+
chessboard?: boolean;
|
92
96
|
applianceIcons?: ApplianceIcons;
|
97
|
+
containerStyle?: string;
|
98
|
+
stageStyle?: string;
|
99
|
+
fullscreen?: TeleBoxFullscreen;
|
100
|
+
/** Custom `style` attribute value for content area of all boxes. Can be overwritten by box. */
|
101
|
+
defaultBoxBodyStyle?: string | null;
|
102
|
+
/** Custom `style` attribute value for stage area of all boxes. Can be overwritten by box. */
|
103
|
+
defaultBoxStageStyle?: string | null;
|
104
|
+
/** Theme variable */
|
105
|
+
theme?: TeleBoxManagerThemeConfig;
|
93
106
|
};
|
94
107
|
export declare const reconnectRefresher: ReconnectRefresher;
|
95
108
|
export declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes> implements PageController {
|
@@ -100,6 +113,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
100
113
|
static debug: boolean;
|
101
114
|
static containerSizeRatio: number;
|
102
115
|
private static isCreated;
|
116
|
+
static registry: import("./Register").AppRegister;
|
103
117
|
version: string;
|
104
118
|
dependencies: Record<string, string>;
|
105
119
|
appListeners?: AppListeners;
|
@@ -108,10 +122,13 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
108
122
|
appManager?: AppManager;
|
109
123
|
cursorManager?: CursorManager;
|
110
124
|
viewMode: ViewMode;
|
125
|
+
viewMode$: Val<ViewMode, any>;
|
111
126
|
isReplay: boolean;
|
112
127
|
private _pageState?;
|
113
128
|
private boxManager?;
|
114
129
|
private static params?;
|
130
|
+
private cameraUpdating;
|
131
|
+
private nextCamera;
|
115
132
|
containerSizeRatio: number;
|
116
133
|
constructor(context: InvisiblePluginContext);
|
117
134
|
static mount(params: MountParams): Promise<WindowManager>;
|
@@ -144,6 +161,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
144
161
|
setMainViewSceneIndex(index: number): Promise<void>;
|
145
162
|
nextPage(): Promise<boolean>;
|
146
163
|
prevPage(): Promise<boolean>;
|
164
|
+
jumpPage(index: number): Promise<boolean>;
|
147
165
|
addPage(params?: AddPageParams): Promise<void>;
|
148
166
|
/**
|
149
167
|
* 删除一页
|
@@ -180,11 +198,19 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
180
198
|
setMinimized(minimized: boolean): void;
|
181
199
|
get mainView(): View;
|
182
200
|
get camera(): Camera;
|
201
|
+
get baseCamera(): {
|
202
|
+
id: string;
|
203
|
+
centerX: number | null;
|
204
|
+
centerY: number | null;
|
205
|
+
scale: number;
|
206
|
+
} | undefined;
|
207
|
+
get baseSize(): ISize | undefined;
|
183
208
|
get cameraState(): CameraState;
|
184
209
|
get apps(): Apps | undefined;
|
185
210
|
get boxState(): TeleBoxState | undefined;
|
186
211
|
get darkMode(): boolean;
|
187
212
|
get prefersColorScheme(): TeleBoxColorScheme | undefined;
|
213
|
+
get fullscreen(): TeleBoxFullscreen | undefined;
|
188
214
|
get focused(): string | undefined;
|
189
215
|
get focusedView(): View | undefined;
|
190
216
|
get mainViewSceneIndex(): number;
|
@@ -195,6 +221,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
195
221
|
get canUndoSteps(): number;
|
196
222
|
get sceneState(): SceneState;
|
197
223
|
get pageState(): PageState;
|
224
|
+
get teleboxManager(): TeleBoxManager;
|
198
225
|
/**
|
199
226
|
* 查询所有的 App
|
200
227
|
*/
|
@@ -207,12 +234,10 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
207
234
|
* 关闭 APP
|
208
235
|
*/
|
209
236
|
closeApp(appId: string): Promise<void>;
|
210
|
-
moveCamera(camera: Partial<Camera> & {
|
211
|
-
animationMode?: AnimationMode | undefined;
|
212
|
-
}): void;
|
213
|
-
moveCameraToContain(rectangle: Rectangle & Readonly<{
|
237
|
+
moveCamera: (camera: Partial<Camera> & {
|
214
238
|
animationMode?: AnimationMode;
|
215
|
-
}
|
239
|
+
}) => void;
|
240
|
+
private onCameraUpdated;
|
216
241
|
convertToPointInWorld(point: Point): Point;
|
217
242
|
setCameraBound(cameraBound: CameraBound): void;
|
218
243
|
onDestroy(): void;
|
@@ -224,6 +249,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
224
249
|
safeSetAttributes(attributes: any): void;
|
225
250
|
safeUpdateAttributes(keys: string[], value: any): void;
|
226
251
|
setPrefersColorScheme(scheme: TeleBoxColorScheme): void;
|
252
|
+
setFullscreen(fullscreen: TeleBoxFullscreen): void;
|
227
253
|
cleanCurrentScene(): void;
|
228
254
|
redo(): number;
|
229
255
|
undo(): number;
|
@@ -240,9 +266,18 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
240
266
|
/** @inner */
|
241
267
|
_refresh(): void;
|
242
268
|
setContainerSizeRatio(ratio: number): void;
|
269
|
+
setContainerStyle(style: string): void;
|
270
|
+
setStageStyle(style: string): void;
|
271
|
+
setBaseSize(size: Size): void;
|
272
|
+
createPPTHandler(): {
|
273
|
+
onPageJumpTo: (_pptUUID: string, index: number) => void;
|
274
|
+
onPageToNext: () => void;
|
275
|
+
onPageToPrev: () => void;
|
276
|
+
};
|
243
277
|
private isDynamicPPT;
|
244
278
|
private ensureAttributes;
|
245
279
|
}
|
246
280
|
export * from "./typings";
|
247
|
-
export { BuiltinApps } from "./BuiltinApps";
|
281
|
+
export { BuiltinApps, BuiltinAppsMap } from "./BuiltinApps";
|
248
282
|
export type { PublicEvent } from "./callback";
|
283
|
+
export type { Member } from "./Helper";
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import type Emittery from "emittery";
|
2
2
|
import type { AnimationMode, ApplianceNames, Displayer, DisplayerState, Player, Room, SceneDefinition, SceneState, View } from "white-web-sdk";
|
3
3
|
import type { AppContext } from "./App";
|
4
|
-
import type { ReadonlyTeleBox, TeleBoxRect } from "@netless/telebox-insider";
|
4
|
+
import type { ReadonlyTeleBox, TeleBoxRect, TeleBoxFullscreen } from "@netless/telebox-insider";
|
5
5
|
import type { PageState } from "./Page";
|
6
6
|
import type { Member } from "./Helper";
|
7
7
|
export interface NetlessApp<Attributes = any, MagixEventPayloads = any, AppOptions = any, SetupResult = any> {
|
@@ -17,6 +17,8 @@ export interface NetlessApp<Attributes = any, MagixEventPayloads = any, AppOptio
|
|
17
17
|
minheight?: number;
|
18
18
|
/** App only single instance. */
|
19
19
|
singleton?: boolean;
|
20
|
+
/** App box enableShadowDom. Default true */
|
21
|
+
enableShadowDOM?: boolean;
|
20
22
|
};
|
21
23
|
setup: (context: AppContext<Attributes, MagixEventPayloads, AppOptions>) => SetupResult;
|
22
24
|
}
|
@@ -64,19 +66,26 @@ export declare type RegisterEvents<SetupResult = any> = {
|
|
64
66
|
};
|
65
67
|
export declare type RegisterParams<AppOptions = any, SetupResult = any, Attributes = any> = {
|
66
68
|
kind: string;
|
67
|
-
src: NetlessApp<Attributes, SetupResult> | string | (() => Promise<NetlessApp<Attributes, SetupResult>>)
|
69
|
+
src: NetlessApp<Attributes, SetupResult> | string | (() => Promise<NetlessApp<Attributes, SetupResult>>) | (() => Promise<{
|
70
|
+
default: NetlessApp<Attributes, SetupResult>;
|
71
|
+
}>);
|
68
72
|
appOptions?: AppOptions | (() => AppOptions);
|
69
73
|
addHooks?: (emitter: Emittery<RegisterEvents<SetupResult>>) => void;
|
70
74
|
/** dynamic load app package name */
|
71
75
|
name?: string;
|
76
|
+
contentStyles?: string;
|
72
77
|
};
|
73
78
|
export declare type AppListenerKeys = keyof AppEmitterEvent;
|
74
79
|
export declare type ApplianceIcons = Partial<Record<ApplianceNames, string>>;
|
80
|
+
export declare type Writeable<T> = {
|
81
|
+
-readonly [P in keyof T]: T[P];
|
82
|
+
};
|
75
83
|
export type { AppContext } from "./App/AppContext";
|
76
84
|
export type { WhiteBoardView } from "./App";
|
77
|
-
export type { ReadonlyTeleBox, TeleBoxRect };
|
85
|
+
export type { ReadonlyTeleBox, TeleBoxRect, TeleBoxFullscreen };
|
78
86
|
export type { SceneState, SceneDefinition, View, AnimationMode, Displayer, Room, Player };
|
79
87
|
export type { Storage, StorageStateChangedEvent, StorageStateChangedListener } from "./App/Storage";
|
80
88
|
export * from "./Page";
|
81
89
|
export * from "./Utils/error";
|
82
90
|
export type { Member } from "./Helper";
|
91
|
+
export type { TeleBoxManager, TeleBoxManagerQueryConfig } from "@netless/telebox-insider";
|