@netless/window-manager 1.0.0-canary.6 → 1.0.0-canary.60
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.js +13539 -0
- package/dist/index.mjs +13536 -0
- package/dist/index.umd.js +13534 -46
- package/dist/{App → src/App}/AppContext.d.ts +16 -14
- package/dist/{App → src/App}/AppPageStateImpl.d.ts +0 -0
- package/dist/{App → src/App}/AppProxy.d.ts +30 -11
- package/dist/{App → src/App}/MagixEvent/index.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} +11 -6
- 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 +4 -3
- package/dist/{Helper.d.ts → src/Helper.d.ts} +4 -8
- package/dist/{InternalEmitter.d.ts → src/InternalEmitter.d.ts} +1 -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 +1 -1
- 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 +20 -0
- package/dist/{View → src/View}/MainView.d.ts +18 -7
- package/dist/src/View/ScrollMode.d.ts +32 -0
- package/dist/{View → src/View}/ViewManager.d.ts +0 -0
- package/dist/src/View/ViewSync.d.ts +32 -0
- package/dist/{callback.d.ts → src/callback.d.ts} +13 -1
- package/dist/{constants.d.ts → src/constants.d.ts} +12 -5
- package/dist/src/image.d.ts +19 -0
- package/dist/{index.d.ts → src/index.d.ts} +66 -17
- package/dist/src/shim.d.ts +11 -0
- package/dist/src/storage.d.ts +7 -0
- package/dist/{typings.d.ts → src/typings.d.ts} +18 -8
- package/dist/style.css +810 -1
- package/docs/api.md +10 -0
- package/docs/app-context.md +155 -27
- package/docs/mirgrate-to-1.0.md +68 -0
- package/package.json +27 -22
- package/playwright.config.ts +29 -0
- package/pnpm-lock.yaml +3141 -4483
- package/src/App/AppContext.ts +81 -46
- package/src/App/AppProxy.ts +249 -139
- package/src/App/WhiteboardView.ts +38 -14
- package/src/App/index.ts +1 -0
- package/src/App/type.ts +22 -0
- package/src/AppListener.ts +21 -21
- package/src/AppManager.ts +84 -43
- package/src/AttributesDelegate.ts +6 -3
- package/src/BoxManager.ts +76 -38
- package/src/BuiltinApps.ts +9 -8
- package/src/Cursor/Cursor.svelte +6 -2
- package/src/Cursor/Cursor.ts +16 -5
- package/src/Cursor/icons.ts +6 -0
- package/src/Cursor/index.ts +13 -10
- package/src/Helper.ts +25 -7
- package/src/InternalEmitter.ts +1 -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 +29 -27
- package/src/Utils/RoomHacker.ts +3 -0
- package/src/Utils/error.ts +2 -2
- package/src/View/CameraSynchronizer.ts +52 -37
- package/src/View/MainView.ts +118 -76
- package/src/View/ScrollMode.ts +239 -0
- package/src/View/ViewSync.ts +139 -6
- package/src/callback.ts +9 -1
- package/src/constants.ts +11 -3
- package/src/image/pencil-eraser-1.svg +3 -0
- package/src/image/pencil-eraser-2.svg +3 -0
- package/src/image/pencil-eraser-3.svg +3 -0
- package/src/index.ts +202 -58
- package/src/storage.ts +15 -0
- package/src/style.css +18 -47
- package/src/typings.ts +21 -7
- package/vite.config.js +12 -7
- package/dist/App/AppViewSync.d.ts +0 -11
- package/dist/App/Storage/StorageEvent.d.ts +0 -8
- package/dist/App/Storage/index.d.ts +0 -39
- package/dist/App/Storage/typings.d.ts +0 -22
- package/dist/App/Storage/utils.d.ts +0 -5
- package/dist/App/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/dist/index.cjs.js +0 -46
- package/dist/index.es.js +0 -16159
- package/src/App/AppViewSync.ts +0 -68
- package/src/App/Storage/StorageEvent.ts +0 -21
- package/src/App/Storage/index.ts +0 -295
- package/src/App/Storage/typings.ts +0 -23
- package/src/App/Storage/utils.ts +0 -17
@@ -0,0 +1,32 @@
|
|
1
|
+
import { SideEffectManager } from "side-effect-manager";
|
2
|
+
import type { ReadonlyVal } from "value-enhancer";
|
3
|
+
import type { AppManager } from "../AppManager";
|
4
|
+
import type { ScrollStorage } from "../storage";
|
5
|
+
export declare type ScrollState = {
|
6
|
+
scrollTop: number;
|
7
|
+
page: number;
|
8
|
+
maxScrollPage: number;
|
9
|
+
};
|
10
|
+
export declare class ScrollMode {
|
11
|
+
private manager;
|
12
|
+
readonly sideEffect: SideEffectManager;
|
13
|
+
private readonly _root$;
|
14
|
+
private readonly _whiteboard$;
|
15
|
+
private readonly _scrollTop$;
|
16
|
+
readonly _page$: ReadonlyVal<number>;
|
17
|
+
private readonly _scale$;
|
18
|
+
private readonly _size$;
|
19
|
+
private readonly _mainView$;
|
20
|
+
private baseWidth;
|
21
|
+
private baseHeight;
|
22
|
+
scrollStorage: ScrollStorage;
|
23
|
+
readonly scrollState$: ReadonlyVal<ScrollState>;
|
24
|
+
setRoot(root: HTMLElement): void;
|
25
|
+
constructor(manager: AppManager);
|
26
|
+
private initScroll;
|
27
|
+
private updateScroll;
|
28
|
+
private updateBound;
|
29
|
+
dispose(): void;
|
30
|
+
private getWhiteboardElement;
|
31
|
+
private onWheel;
|
32
|
+
}
|
File without changes
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import { Val } from "value-enhancer";
|
2
|
+
import type { View } from "white-web-sdk";
|
3
|
+
import type { ReadonlyVal } from "value-enhancer";
|
4
|
+
import type { ICamera, ISize } from "../AttributesDelegate";
|
5
|
+
import type { TeleBoxRect } from "@netless/telebox-insider";
|
6
|
+
import type { ManagerViewMode } from "../typings";
|
7
|
+
export declare type ViewSyncContext = {
|
8
|
+
uid: string;
|
9
|
+
camera$: Val<ICamera | undefined, boolean>;
|
10
|
+
size$: Val<ISize | undefined>;
|
11
|
+
stageRect$: ReadonlyVal<TeleBoxRect>;
|
12
|
+
viewMode$?: Val<ManagerViewMode>;
|
13
|
+
storeCamera: (camera: ICamera) => void;
|
14
|
+
storeSize: (size: ISize) => void;
|
15
|
+
view$: Val<View | undefined>;
|
16
|
+
};
|
17
|
+
export declare class ViewSync {
|
18
|
+
private context;
|
19
|
+
private sem;
|
20
|
+
private synchronizer;
|
21
|
+
private needRecoverCamera$?;
|
22
|
+
constructor(context: ViewSyncContext);
|
23
|
+
private get isBroadcastMode();
|
24
|
+
private createSynchronizer;
|
25
|
+
private subscribeView;
|
26
|
+
private subscribeCamera;
|
27
|
+
private subscribeSize;
|
28
|
+
private subscribeStageRect;
|
29
|
+
bindView: (view?: View | undefined) => void;
|
30
|
+
private onCameraUpdatedByDevice;
|
31
|
+
destroy(): void;
|
32
|
+
}
|
@@ -1,8 +1,10 @@
|
|
1
1
|
import Emittery from "emittery";
|
2
|
-
import type { TeleBoxColorScheme, TELE_BOX_STATE } from "@netless/telebox-insider";
|
2
|
+
import type { TeleBoxColorScheme, TeleBoxFullscreen, TELE_BOX_STATE } from "@netless/telebox-insider";
|
3
3
|
import type { CameraState, SceneState, ViewVisionMode } from "white-web-sdk";
|
4
4
|
import type { LoadAppEvent } from "./Register";
|
5
5
|
import type { PageState } from "./Page";
|
6
|
+
import type { ICamera, ISize } from "./AttributesDelegate";
|
7
|
+
import type { ScrollState } from "./View/ScrollMode";
|
6
8
|
export declare type PublicEvent = {
|
7
9
|
mainViewModeChange: ViewVisionMode;
|
8
10
|
boxStateChange: `${TELE_BOX_STATE}`;
|
@@ -19,6 +21,16 @@ export declare type PublicEvent = {
|
|
19
21
|
ready: undefined;
|
20
22
|
sceneStateChange: SceneState;
|
21
23
|
pageStateChange: PageState;
|
24
|
+
appClose: {
|
25
|
+
appId: string;
|
26
|
+
kind: string;
|
27
|
+
error?: Error;
|
28
|
+
};
|
29
|
+
baseCameraChange: ICamera;
|
30
|
+
baseSizeChange: ISize;
|
31
|
+
fullscreenChange: TeleBoxFullscreen;
|
32
|
+
userScroll: undefined;
|
33
|
+
scrollStateChange: ScrollState;
|
22
34
|
};
|
23
35
|
export declare type CallbacksType = Emittery<PublicEvent>;
|
24
36
|
export declare const callbacks: CallbacksType;
|
@@ -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",
|
@@ -47,3 +52,5 @@ export declare const ROOT_DIR = "/";
|
|
47
52
|
export declare const INIT_DIR = "/init";
|
48
53
|
export declare const SETUP_APP_DELAY = 50;
|
49
54
|
export declare const MAX_PAGE_SIZE = 500;
|
55
|
+
export declare const SCROLL_MODE_BASE_WIDTH = 1600;
|
56
|
+
export declare const SCROLL_MODE_BASE_HEIGHT: number;
|
@@ -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,25 +1,25 @@
|
|
1
1
|
import { AppManager } from "./AppManager";
|
2
2
|
import { CursorManager } from "./Cursor";
|
3
|
-
import { InvisiblePlugin
|
3
|
+
import { InvisiblePlugin } 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, AnimationMode, Rectangle } from "white-web-sdk";
|
11
9
|
import type { AppListeners } from "./AppListener";
|
12
|
-
import type { ApplianceIcons, NetlessApp, RegisterParams } from "./typings";
|
13
|
-
import type { TeleBoxColorScheme, TeleBoxState } from "@netless/telebox-insider";
|
10
|
+
import type { ApplianceIcons, ManagerViewMode, NetlessApp, RegisterParams } from "./typings";
|
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";
|
17
15
|
import type { PageController, AddPageParams, PageState } from "./Page";
|
16
|
+
import type { ScrollState } from "./View/ScrollMode";
|
18
17
|
export declare type WindowMangerAttributes = {
|
19
18
|
modelValue?: string;
|
20
19
|
boxState: TELE_BOX_STATE;
|
21
20
|
maximized?: boolean;
|
22
21
|
minimized?: boolean;
|
22
|
+
scrollTop?: number;
|
23
23
|
[key: string]: any;
|
24
24
|
};
|
25
25
|
export declare type apps = {
|
@@ -56,6 +56,7 @@ export declare type AppSyncAttributes = {
|
|
56
56
|
createdAt?: number;
|
57
57
|
camera?: ICamera;
|
58
58
|
size?: ISize;
|
59
|
+
setup: boolean;
|
59
60
|
};
|
60
61
|
export declare type AppInitState = {
|
61
62
|
id: string;
|
@@ -69,6 +70,11 @@ export declare type AppInitState = {
|
|
69
70
|
sceneIndex?: number;
|
70
71
|
boxState?: TeleBoxState;
|
71
72
|
zIndex?: number;
|
73
|
+
visible?: boolean;
|
74
|
+
stageRatio?: number;
|
75
|
+
resizable?: boolean;
|
76
|
+
draggable?: boolean;
|
77
|
+
ratio?: number;
|
72
78
|
};
|
73
79
|
export declare type CursorMovePayload = {
|
74
80
|
uid: string;
|
@@ -80,8 +86,6 @@ export declare type MountParams = {
|
|
80
86
|
container?: HTMLElement;
|
81
87
|
/** 白板高宽比例, 默认为 9 / 16 */
|
82
88
|
containerSizeRatio?: number;
|
83
|
-
/** 显示 PS 透明背景,默认 true */
|
84
|
-
chessboard?: boolean;
|
85
89
|
collectorContainer?: HTMLElement;
|
86
90
|
collectorStyles?: Partial<CSSStyleDeclaration>;
|
87
91
|
overwriteStyles?: string;
|
@@ -89,10 +93,26 @@ export declare type MountParams = {
|
|
89
93
|
debug?: boolean;
|
90
94
|
disableCameraTransform?: boolean;
|
91
95
|
prefersColorScheme?: TeleBoxColorScheme;
|
96
|
+
/** @deprecated */
|
97
|
+
chessboard?: boolean;
|
92
98
|
applianceIcons?: ApplianceIcons;
|
99
|
+
containerStyle?: string;
|
100
|
+
stageStyle?: string;
|
101
|
+
fullscreen?: TeleBoxFullscreen;
|
102
|
+
/** Custom `style` attribute value for content area of all boxes. Can be overwritten by box. */
|
103
|
+
defaultBoxBodyStyle?: string | null;
|
104
|
+
/** Custom `style` attribute value for stage area of all boxes. Can be overwritten by box. */
|
105
|
+
defaultBoxStageStyle?: string | null;
|
106
|
+
/** Theme variable */
|
107
|
+
theme?: TeleBoxManagerThemeConfig;
|
108
|
+
/** ScrollMode BaseWidth */
|
109
|
+
scrollModeWidth?: number;
|
110
|
+
/** ScrollMode BaseHeight */
|
111
|
+
scrollModeHeight?: number;
|
112
|
+
viewMode?: ManagerViewMode;
|
93
113
|
};
|
94
114
|
export declare const reconnectRefresher: ReconnectRefresher;
|
95
|
-
export declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes> implements PageController {
|
115
|
+
export declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any> implements PageController {
|
96
116
|
static kind: string;
|
97
117
|
static displayer: Displayer;
|
98
118
|
static playground?: HTMLElement;
|
@@ -100,6 +120,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
100
120
|
static debug: boolean;
|
101
121
|
static containerSizeRatio: number;
|
102
122
|
private static isCreated;
|
123
|
+
static registry: import("./Register").AppRegister;
|
103
124
|
version: string;
|
104
125
|
dependencies: Record<string, string>;
|
105
126
|
appListeners?: AppListeners;
|
@@ -107,7 +128,8 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
107
128
|
emitter: Emittery<PublicEvent>;
|
108
129
|
appManager?: AppManager;
|
109
130
|
cursorManager?: CursorManager;
|
110
|
-
viewMode
|
131
|
+
viewMode$: Val<ManagerViewMode, any>;
|
132
|
+
playground$: Val<HTMLElement | undefined, any>;
|
111
133
|
isReplay: boolean;
|
112
134
|
private _pageState?;
|
113
135
|
private boxManager?;
|
@@ -123,7 +145,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
123
145
|
/**
|
124
146
|
* 注册插件
|
125
147
|
*/
|
126
|
-
static register<AppOptions = any, SetupResult = any, Attributes = any>(params: RegisterParams<AppOptions, SetupResult, Attributes>): Promise<void>;
|
148
|
+
static register<AppOptions = any, SetupResult = any, Attributes extends Record<string, any> = any>(params: RegisterParams<AppOptions, SetupResult, Attributes>): Promise<void>;
|
127
149
|
/**
|
128
150
|
* 注销插件
|
129
151
|
*/
|
@@ -144,6 +166,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
144
166
|
setMainViewSceneIndex(index: number): Promise<void>;
|
145
167
|
nextPage(): Promise<boolean>;
|
146
168
|
prevPage(): Promise<boolean>;
|
169
|
+
jumpPage(index: number): Promise<boolean>;
|
147
170
|
addPage(params?: AddPageParams): Promise<void>;
|
148
171
|
/**
|
149
172
|
* 删除一页
|
@@ -174,17 +197,26 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
174
197
|
/**
|
175
198
|
* 设置 ViewMode
|
176
199
|
*/
|
177
|
-
setViewMode(mode:
|
200
|
+
setViewMode(mode: ManagerViewMode): void;
|
178
201
|
setBoxState(boxState: TeleBoxState): void;
|
179
202
|
setMaximized(maximized: boolean): void;
|
180
203
|
setMinimized(minimized: boolean): void;
|
181
204
|
get mainView(): View;
|
182
205
|
get camera(): Camera;
|
206
|
+
get baseCamera(): {
|
207
|
+
id: string;
|
208
|
+
centerX: number | null;
|
209
|
+
centerY: number | null;
|
210
|
+
scale: number;
|
211
|
+
} | undefined;
|
212
|
+
get baseSize(): ISize | undefined;
|
183
213
|
get cameraState(): CameraState;
|
184
214
|
get apps(): Apps | undefined;
|
185
215
|
get boxState(): TeleBoxState | undefined;
|
186
216
|
get darkMode(): boolean;
|
217
|
+
get viewMode(): ManagerViewMode;
|
187
218
|
get prefersColorScheme(): TeleBoxColorScheme | undefined;
|
219
|
+
get fullscreen(): TeleBoxFullscreen | undefined;
|
188
220
|
get focused(): string | undefined;
|
189
221
|
get focusedView(): View | undefined;
|
190
222
|
get mainViewSceneIndex(): number;
|
@@ -195,6 +227,8 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
195
227
|
get canUndoSteps(): number;
|
196
228
|
get sceneState(): SceneState;
|
197
229
|
get pageState(): PageState;
|
230
|
+
get scrollState(): ScrollState | undefined;
|
231
|
+
get teleboxManager(): TeleBoxManager;
|
198
232
|
/**
|
199
233
|
* 查询所有的 App
|
200
234
|
*/
|
@@ -207,12 +241,13 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
207
241
|
* 关闭 APP
|
208
242
|
*/
|
209
243
|
closeApp(appId: string): Promise<void>;
|
210
|
-
moveCamera(camera: Partial<Camera> & {
|
211
|
-
animationMode?: AnimationMode
|
212
|
-
})
|
244
|
+
moveCamera: (camera: Partial<Camera> & {
|
245
|
+
animationMode?: AnimationMode;
|
246
|
+
}) => void;
|
213
247
|
moveCameraToContain(rectangle: Rectangle & Readonly<{
|
214
248
|
animationMode?: AnimationMode;
|
215
249
|
}>): void;
|
250
|
+
private debouncedStoreCamera;
|
216
251
|
convertToPointInWorld(point: Point): Point;
|
217
252
|
setCameraBound(cameraBound: CameraBound): void;
|
218
253
|
onDestroy(): void;
|
@@ -224,6 +259,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
224
259
|
safeSetAttributes(attributes: any): void;
|
225
260
|
safeUpdateAttributes(keys: string[], value: any): void;
|
226
261
|
setPrefersColorScheme(scheme: TeleBoxColorScheme): void;
|
262
|
+
setFullscreen(fullscreen: TeleBoxFullscreen): void;
|
227
263
|
cleanCurrentScene(): void;
|
228
264
|
redo(): number;
|
229
265
|
undo(): number;
|
@@ -240,9 +276,22 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
240
276
|
/** @inner */
|
241
277
|
_refresh(): void;
|
242
278
|
setContainerSizeRatio(ratio: number): void;
|
279
|
+
setContainerStyle(style: string): void;
|
280
|
+
setStageStyle(style: string): void;
|
281
|
+
setBaseSize(size: Size): void;
|
282
|
+
/**
|
283
|
+
* 切换 focus 到指定的 app, 并且把这个 app 放到最前面
|
284
|
+
*/
|
285
|
+
focusApp(appId: string): void;
|
286
|
+
createPPTHandler(): {
|
287
|
+
onPageJumpTo: (_pptUUID: string, index: number) => void;
|
288
|
+
onPageToNext: () => void;
|
289
|
+
onPageToPrev: () => void;
|
290
|
+
};
|
243
291
|
private isDynamicPPT;
|
244
292
|
private ensureAttributes;
|
245
293
|
}
|
246
294
|
export * from "./typings";
|
247
|
-
export { BuiltinApps } from "./BuiltinApps";
|
295
|
+
export { BuiltinApps, BuiltinAppsMap } from "./BuiltinApps";
|
248
296
|
export type { PublicEvent } from "./callback";
|
297
|
+
export type { Member } from "./Helper";
|
@@ -0,0 +1,7 @@
|
|
1
|
+
import { Storage } from "@netless/synced-store";
|
2
|
+
import type { AppManager } from "./AppManager";
|
3
|
+
export declare type ScrollStorageState = {
|
4
|
+
scrollTop: number;
|
5
|
+
};
|
6
|
+
export declare type ScrollStorage = Storage<ScrollStorageState>;
|
7
|
+
export declare const createScrollStorage: (manager: AppManager) => Storage<ScrollStorageState>;
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import type Emittery from "emittery";
|
2
|
-
import type { AnimationMode, ApplianceNames, Displayer, DisplayerState, Player, Room, SceneDefinition, SceneState, View } from "white-web-sdk";
|
2
|
+
import type { AnimationMode, ApplianceNames, Displayer, DisplayerState, Player, Room, SceneDefinition, SceneState, View, ViewMode } 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
|
-
export interface NetlessApp<Attributes = any, MagixEventPayloads = any, AppOptions = any, SetupResult = any> {
|
7
|
+
export interface NetlessApp<Attributes extends Record<string, any> = any, MagixEventPayloads = any, AppOptions = any, SetupResult = any> {
|
8
8
|
kind: string;
|
9
9
|
config?: {
|
10
10
|
/** Box width relative to whiteboard. 0~1. Default 0.5. */
|
@@ -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
|
}
|
@@ -62,21 +64,29 @@ export declare type RegisterEvents<SetupResult = any> = {
|
|
62
64
|
destroy: RegisterEventData;
|
63
65
|
focus: RegisterEventData;
|
64
66
|
};
|
65
|
-
export declare type RegisterParams<AppOptions = any, SetupResult = any, Attributes = any> = {
|
67
|
+
export declare type RegisterParams<AppOptions = any, SetupResult = any, Attributes extends Record<string, any> = 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
|
-
export declare type ApplianceIcons = Partial<Record
|
79
|
+
export declare type ApplianceIcons = Partial<Record<`${ApplianceNames}` | string, string>>;
|
80
|
+
export declare type Writeable<T> = {
|
81
|
+
-readonly [P in keyof T]: T[P];
|
82
|
+
};
|
83
|
+
export declare type ManagerViewMode = `${ViewMode}` | "scroll";
|
75
84
|
export type { AppContext } from "./App/AppContext";
|
76
85
|
export type { WhiteBoardView } from "./App";
|
77
|
-
export type { ReadonlyTeleBox, TeleBoxRect };
|
86
|
+
export type { ReadonlyTeleBox, TeleBoxRect, TeleBoxFullscreen };
|
78
87
|
export type { SceneState, SceneDefinition, View, AnimationMode, Displayer, Room, Player };
|
79
|
-
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";
|
92
|
+
export type { Storage, StorageConfig } from "@netless/synced-store";
|