@netless/window-manager 1.0.14 → 1.0.16

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/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as lodash from 'lodash';
2
2
  import * as white_web_sdk from 'white-web-sdk';
3
- import { SceneDefinition, SceneState, DisplayerState, View, ApplianceNames, ViewVisionMode, CameraState, RoomMember, Camera, Size, Event as Event$1, Scope, EventPhase, MagixEventListenerOptions as MagixEventListenerOptions$1, toJS, listenUpdated, unlistenUpdated, listenDisposed, unlistenDisposed, Room, ViewMode, Displayer, MemberState, Logger, AnimationMode, InvisiblePlugin, InvisiblePluginContext, Player, Rectangle, Point, CameraBound, ImageInformation } from 'white-web-sdk';
3
+ import { SceneDefinition, SceneState, DisplayerState, View, ApplianceNames, ViewVisionMode, CameraState, RoomMember, Camera, Size, Event as Event$1, Scope, EventPhase, MagixEventListenerOptions as MagixEventListenerOptions$1, toJS, listenUpdated, unlistenUpdated, listenDisposed, unlistenDisposed, Room, ViewMode, Displayer, MemberState, Logger as Logger$1, AnimationMode, InvisiblePlugin, InvisiblePluginContext, Player, Rectangle, Point, CameraBound, ImageInformation } from 'white-web-sdk';
4
4
  export { AnimationMode, Displayer, Player, Room, SceneDefinition, SceneState, View } from 'white-web-sdk';
5
5
  import { TELE_BOX_STATE, TeleBoxRect, TeleBoxState, TeleBoxColorScheme, NotMinimizedBoxState, TeleBoxManager, TeleBoxCollector, ReadonlyTeleBox, TeleBoxManagerUpdateConfig, TeleBoxConfig } from '@netless/telebox-insider';
6
6
  export { ReadonlyTeleBox, TeleBoxCollector, TeleBoxManager, TeleBoxRect } from '@netless/telebox-insider';
@@ -999,7 +999,7 @@ declare class ArgusLog {
999
999
  /** debounce 窗口内 safeUpdateAttributes:同 keys 数组则只更新 value,否则追加一段,flush 时拼成一条 */
1000
1000
  private pendingUpdateSegments;
1001
1001
  private updateMergeTimer;
1002
- constructor(logger: Logger, name: string, debounceTime?: number | undefined);
1002
+ constructor(logger: Logger$1, name: string, debounceTime?: number | undefined);
1003
1003
  private emitInfo;
1004
1004
  private flush;
1005
1005
  private flushShallowMerge;
@@ -1025,6 +1025,69 @@ declare class ArgusLog {
1025
1025
  dispose(): void;
1026
1026
  }
1027
1027
 
1028
+ interface PresentationPage {
1029
+ src: string;
1030
+ width: number;
1031
+ height: number;
1032
+ thumbnail?: string | undefined;
1033
+ name?: string;
1034
+ }
1035
+ interface ScrollbarEventCallback {
1036
+ onScrollbarDragStart?: () => void;
1037
+ onScrollbarDragEnd?: () => void;
1038
+ onScrollbarDragX?: (x: number) => void;
1039
+ onScrollbarDragY?: (y: number) => void;
1040
+ onScrollCameraUpdated?: (appid: string, originScale: number, scale: number) => void;
1041
+ }
1042
+
1043
+ type Logger = (...data: any[]) => void;
1044
+ interface Viewport {
1045
+ readonly x: number;
1046
+ readonly y: number;
1047
+ readonly width: number;
1048
+ readonly height: number;
1049
+ }
1050
+ interface PresentationAppOptions {
1051
+ /** Disables user move / scale the image and whiteboard. */
1052
+ disableCameraTransform?: boolean;
1053
+ /** Max scale = `maxCameraScale` * default scale. Not working when `disableCameraTransform` is true. Default: 3 */
1054
+ maxCameraScale?: number;
1055
+ /** Custom logger. Default: a logger that reports to the whiteboard server. */
1056
+ log?: Logger;
1057
+ /** Custom thumbnail generator. Default is appending `"?x-oss-process=image/resize,l_50"` to `src`. */
1058
+ thumbnail?: (src: string) => string;
1059
+ /**
1060
+ * Custom viewport to set on the first time the presentation was added. Default is full page.
1061
+ * Numbers range in 0 to 1 is considered a ratio to multiply the real page size.
1062
+ * Example settings:
1063
+ *
1064
+ * - Full page: `{ x: 0, y: 0, width: 1, height: 1 }`
1065
+ * - Half page: `{ x: 0, y: 0, width: 1, height: 0.5 }`
1066
+ * - Absolute top-left area of the page: `{ x: 0, y: 0, width: 100, height: 100 }`
1067
+ */
1068
+ viewport?: Viewport | ((page: PresentationPage) => Viewport);
1069
+ /** justDocsViewReadonly is used to set the presentation readonly, it will be used in the presentation, and the presentation will be readonly when the app is initialized */
1070
+ justDocsViewReadonly?: true;
1071
+ /** useScrollbar is used to set the presentation use scrollbar, it will be used in the presentation, and the presentation will be use scrollbar when the app is initialized */
1072
+ useScrollbar?: boolean;
1073
+ /** debounceSync is used to set the presentation debounce sync, it will be used in the presentation, and the presentation will be debounce sync when the app is initialized */
1074
+ debounceSync?: boolean;
1075
+ scrollbarEventCallback?: ScrollbarEventCallback;
1076
+ /** goToPageByClick is used to set the presentation go to page by click, it will be used in the presentation, and the presentation will be go to page by click when the app is initialized */
1077
+ goToPageByClick?: boolean;
1078
+ /** useClipView is used to set the presentation use clip view, it will be used in the presentation, and the presentation will be use clip view when the app is initialized */
1079
+ useClipView?: boolean;
1080
+ }
1081
+
1082
+ interface BuiltinAppOptions {
1083
+ Presentation?: PresentationAppOptions;
1084
+ }
1085
+ declare const BuiltinApps: {
1086
+ DocsViewer: string;
1087
+ MediaPlayer: string;
1088
+ Presentation: string;
1089
+ };
1090
+
1028
1091
  declare class AppListeners {
1029
1092
  private manager;
1030
1093
  private displayer;
@@ -1224,11 +1287,6 @@ type ExtendClass = {
1224
1287
  };
1225
1288
  declare function getExtendClass<T extends ExtendClassAble>(baseClass: T, extendClass?: ExtendClass): T;
1226
1289
 
1227
- declare const BuiltinApps: {
1228
- DocsViewer: string;
1229
- MediaPlayer: string;
1230
- };
1231
-
1232
1290
  type WindowMangerAttributes = {
1233
1291
  modelValue?: string;
1234
1292
  boxState: TELE_BOX_STATE;
@@ -1247,6 +1305,15 @@ type AddAppOptions = {
1247
1305
  type setAppOptions = AddAppOptions & {
1248
1306
  appOptions?: any;
1249
1307
  };
1308
+ type DocsEvent = "prevPage" | "nextPage" | "prevStep" | "nextStep" | "jumpToPage" | "scalePage";
1309
+ type DocsEventOptions = {
1310
+ /** If provided, will dispatch to the specific app. Default to the focused app. */
1311
+ appId?: string;
1312
+ /** Used by `jumpToPage` event, range from 1 to total pages count. */
1313
+ page?: number;
1314
+ /** Used by `scalePage` event. Range from 1 to 4, decimals allowed. `1` means default fitted size. */
1315
+ scale?: number;
1316
+ };
1250
1317
  type AddAppParams<TAttributes = any> = {
1251
1318
  kind: string;
1252
1319
  src?: string;
@@ -1334,6 +1401,8 @@ type MountParams = {
1334
1401
  supportAppliancePlugin?: boolean;
1335
1402
  /** 是否使用 boxesStatus 状态管理窗口 */
1336
1403
  useBoxesStatus?: boolean;
1404
+ /** Local Presentation options applied before restoring apps. Not synchronized. */
1405
+ builtinAppOptions?: BuiltinAppOptions;
1337
1406
  };
1338
1407
  declare const reconnectRefresher: ReconnectRefresher;
1339
1408
  declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any> implements PageController {
@@ -1362,6 +1431,7 @@ declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
1362
1431
  private _cursorUIDs;
1363
1432
  private _cursorUIDsStyleDOM?;
1364
1433
  _appliancePlugin?: any;
1434
+ builtinAppOptions?: BuiltinAppOptions;
1365
1435
  private boxManager?;
1366
1436
  private static params?;
1367
1437
  static extendClass?: ExtendClass$1;
@@ -1370,7 +1440,7 @@ declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
1370
1440
  private extendPluginManager?;
1371
1441
  private _roomLogger?;
1372
1442
  attributesDeboundceLog?: ArgusLog;
1373
- get Logger(): Logger | undefined;
1443
+ get Logger(): Logger$1 | undefined;
1374
1444
  constructor(context: InvisiblePluginContext);
1375
1445
  static onCreate(manager: WindowManager): void;
1376
1446
  static mount(params: MountParams, extendClass?: ExtendClass$1): Promise<WindowManager>;
@@ -1388,6 +1458,7 @@ declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
1388
1458
  * 注销插件
1389
1459
  */
1390
1460
  static unregister(kind: string): void;
1461
+ resolveAppOptions(kind: string, registeredOptions?: any | (() => any)): any | (() => any);
1391
1462
  /**
1392
1463
  * 创建一个 app 至白板
1393
1464
  */
@@ -1489,6 +1560,13 @@ declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
1489
1560
  * 查询单个 App
1490
1561
  */
1491
1562
  queryOne(appId: string): AppProxy | undefined;
1563
+ /**
1564
+ * Send specific command to DocsViewer / Presentation / Slide app.
1565
+ *
1566
+ * Static docs and Presentation do not have animation steps, so `prevStep` / `nextStep`
1567
+ * are treated as `prevPage` / `nextPage`.
1568
+ */
1569
+ dispatchDocsEvent(event: DocsEvent, options?: DocsEventOptions): boolean;
1492
1570
  /**
1493
1571
  * 关闭 APP
1494
1572
  */
@@ -1536,4 +1614,4 @@ declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
1536
1614
  }
1537
1615
 
1538
1616
  export { AppContext, AppCreateError, AppManager, AppManagerNotInitError, AppNotRegisterError, AppProxy, AttributesDelegate, BindContainerRoomPhaseInvalidError, BoxManager, BoxManagerNotFoundError, BoxNotCreatedError, BuiltinApps, CursorManager, ExtendPlugin, ExtendPluginManager, InvalidScenePath, ParamsInvalidError, Storage, WhiteWebSDKInvalidError, WindowManager, calculateNextIndex, getExtendClass, reconnectRefresher };
1539
- export type { AddAppOptions, AddAppParams, AddPageParams, AppEmitterEvent, AppInitState, AppListenerKeys, AppPayload, AppSyncAttributes, ApplianceIcons, BaseInsertParams, CursorMovePayload, CursorOptions, ExtendClass, ExtendClassAble, ExtendContext, ExtendManagerOptions, ExtendPluginInstance, MountParams, NetlessApp, PageController, PageRemoveService, PageState, PublicEvent, RegisterEventData, RegisterEvents, RegisterParams, StorageStateChangedEvent, StorageStateChangedListener, WindowMangerAttributes, apps, setAppOptions };
1617
+ export type { AddAppOptions, AddAppParams, AddPageParams, AppEmitterEvent, AppInitState, AppListenerKeys, AppPayload, AppSyncAttributes, ApplianceIcons, BaseInsertParams, BuiltinAppOptions, CursorMovePayload, CursorOptions, DocsEvent, DocsEventOptions, ExtendClass, ExtendClassAble, ExtendContext, ExtendManagerOptions, ExtendPluginInstance, MountParams, NetlessApp, PageController, PageRemoveService, PageState, PublicEvent, RegisterEventData, RegisterEvents, RegisterParams, StorageStateChangedEvent, StorageStateChangedListener, WindowMangerAttributes, apps, setAppOptions };