@netless/window-manager 1.0.7-beta.2 → 1.0.7-beta.4

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,9 +1,9 @@
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, Event as Event$1, Scope, EventPhase, MagixEventListenerOptions as MagixEventListenerOptions$1, toJS, listenUpdated, unlistenUpdated, listenDisposed, unlistenDisposed, Room, RoomMember, Camera, Size, ViewMode, Displayer, MemberState, 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, 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
- import { TELE_BOX_STATE, TeleBoxRect, TeleBoxColorScheme, TeleBoxManager, TeleBoxState, NotMinimizedBoxState, ReadonlyTeleBox, TeleBoxManagerUpdateConfig, TeleBoxConfig } from '@netless/telebox-insider';
6
- export { ReadonlyTeleBox, TeleBoxRect } from '@netless/telebox-insider';
5
+ import { TELE_BOX_STATE, TeleBoxRect, TeleBoxColorScheme, TeleBoxState, NotMinimizedBoxState, TeleBoxManager, TeleBoxCollector, ReadonlyTeleBox, TeleBoxManagerUpdateConfig, TeleBoxConfig } from '@netless/telebox-insider';
6
+ export { ReadonlyTeleBox, TeleBoxCollector, TeleBoxManager, TeleBoxRect } from '@netless/telebox-insider';
7
7
  import Emittery from 'emittery';
8
8
 
9
9
  declare enum Events {
@@ -324,6 +324,170 @@ type EmitterEvent = {
324
324
  };
325
325
  type EmitterType = Emittery<EmitterEvent>;
326
326
 
327
+ declare class CursorManager {
328
+ private manager;
329
+ private enableCursor;
330
+ containerRect?: DOMRect;
331
+ wrapperRect?: DOMRect;
332
+ cursorInstances: Map<string, Cursor>;
333
+ roomMembers?: readonly RoomMember[];
334
+ userApplianceIcons: ApplianceIcons;
335
+ private mainViewElement?;
336
+ private sideEffectManager;
337
+ private store;
338
+ private leaveFlag;
339
+ private _style;
340
+ constructor(manager: AppManager, enableCursor: boolean, cursorOptions?: CursorOptions, applianceIcons?: ApplianceIcons);
341
+ get applianceIcons(): ApplianceIcons;
342
+ get style(): "default" | "custom";
343
+ set style(value: "default" | "custom");
344
+ private onCursorMove;
345
+ private initCursorInstance;
346
+ private enableCustomCursor;
347
+ private canMoveCursor;
348
+ setupWrapper(wrapper: HTMLElement): void;
349
+ setMainViewDivElement(div: HTMLDivElement): void;
350
+ get boxState(): any;
351
+ get focusView(): View | undefined;
352
+ private mouseMoveListener_;
353
+ private mouseMoveTimer;
354
+ private mouseMoveListener;
355
+ private mouseLeaveListener;
356
+ private showPencilEraserIfNeeded;
357
+ private updateCursor;
358
+ private getPoint;
359
+ /**
360
+ * 因为窗口内框在不同分辨率下的大小不一样,所以这里通过来鼠标事件的 target 来判断是在主白板还是在 APP 中
361
+ */
362
+ private getType;
363
+ updateContainerRect(): void;
364
+ deleteCursor(uid: string): void;
365
+ hideCursor(uid: string): void;
366
+ destroy(): void;
367
+ }
368
+
369
+ declare class Cursor {
370
+ private manager;
371
+ private memberId;
372
+ private cursorManager;
373
+ private wrapper?;
374
+ private member?;
375
+ private timer?;
376
+ private component?;
377
+ private style;
378
+ constructor(manager: AppManager, memberId: string, cursorManager: CursorManager, wrapper?: HTMLElement | undefined);
379
+ move: (position: Position) => void;
380
+ setStyle: (style: typeof this.style) => void;
381
+ leave: () => void;
382
+ private moveCursor;
383
+ get memberApplianceName(): ApplianceNames | undefined;
384
+ get memberColor(): string;
385
+ get memberColorHex(): string;
386
+ private get payload();
387
+ get memberCursorName(): any;
388
+ private get memberTheme();
389
+ private get memberCursorTextColor();
390
+ private get memberCursorTagBackgroundColor();
391
+ private get memberAvatar();
392
+ private get memberOpacity();
393
+ private get memberTagName();
394
+ private autoHidden;
395
+ private createCursor;
396
+ private initProps;
397
+ private getIcon;
398
+ private isCustomIcon;
399
+ updateMember(): RoomMember | undefined;
400
+ private updateComponent;
401
+ destroy(): void;
402
+ hide(): void;
403
+ }
404
+
405
+ type Apps = {
406
+ [key: string]: AppSyncAttributes;
407
+ };
408
+ type Position = {
409
+ x: number;
410
+ y: number;
411
+ type: PositionType;
412
+ id?: string;
413
+ };
414
+ type PositionType = "main" | "app";
415
+ type StoreContext = {
416
+ getAttributes: () => any;
417
+ safeUpdateAttributes: (keys: string[], value: any) => void;
418
+ safeSetAttributes: (attributes: any) => void;
419
+ };
420
+ type ICamera = Camera & {
421
+ id: string;
422
+ };
423
+ type ISize = Size & {
424
+ id: string;
425
+ };
426
+ declare class AttributesDelegate {
427
+ private context;
428
+ constructor(context: StoreContext);
429
+ setContext(context: StoreContext): void;
430
+ get attributes(): any;
431
+ apps(): Apps;
432
+ get focus(): string | undefined;
433
+ getAppAttributes(id: string): AppSyncAttributes;
434
+ getAppState(id: string): any;
435
+ getMaximized(): any;
436
+ getMinimized(): any;
437
+ getBoxesStatus(): Record<string, TELE_BOX_STATE> | undefined;
438
+ getBoxStatus(id: string): TELE_BOX_STATE | undefined;
439
+ setBoxStatus(id: string, status?: TeleBoxState): void;
440
+ getLastNotMinimizedBoxesStatus(): Record<string, NotMinimizedBoxState> | undefined;
441
+ getLastNotMinimizedBoxStatus(id: string): NotMinimizedBoxState | undefined;
442
+ setLastNotMinimizedBoxStatus(id: string, status?: NotMinimizedBoxState): void;
443
+ setupAppAttributes(params: AddAppParams, id: string, isDynamicPPT: boolean): void;
444
+ updateAppState(appId: string, stateName: AppAttributes, state: any): void;
445
+ cleanAppAttributes(id: string): void;
446
+ cleanFocus(): void;
447
+ getAppSceneIndex(id: string): any;
448
+ getAppScenePath(id: string): any;
449
+ getMainViewScenePath(): string | undefined;
450
+ getMainViewSceneIndex(): any;
451
+ getBoxState(): any;
452
+ setMainViewScenePath(scenePath: string): void;
453
+ setMainViewSceneIndex(index: number): void;
454
+ getMainViewCamera(): MainViewCamera;
455
+ getMainViewSize(): MainViewSize;
456
+ setMainViewCamera(camera: ICamera): void;
457
+ setMainViewSize(size: ISize): void;
458
+ setMainViewCameraAndSize(camera: ICamera, size: ISize): void;
459
+ setAppFocus: (appId: string, focus: boolean) => void;
460
+ updateCursor(uid: string, position: Position): void;
461
+ updateCursorState(uid: string, cursorState: string | undefined): void;
462
+ getCursorState(uid: string): any;
463
+ cleanCursor(uid: string): void;
464
+ setMainViewFocusPath(mainView: View): void;
465
+ getIframeBridge(): any;
466
+ setIframeBridge(data: any): void;
467
+ }
468
+ type MainViewSize = {
469
+ id: string;
470
+ width: number;
471
+ height: number;
472
+ };
473
+ type MainViewCamera = {
474
+ id: string;
475
+ centerX: number;
476
+ centerY: number;
477
+ scale: number;
478
+ };
479
+
480
+ type ExtendClass$1 = {
481
+ AppManager?: typeof AppManager;
482
+ BoxManager?: typeof BoxManager;
483
+ AttributesDelegate?: typeof AttributesDelegate;
484
+ CursorManager?: typeof CursorManager;
485
+ AppProxy?: typeof AppProxy;
486
+ AppContext?: typeof AppContext;
487
+ TeleBoxManager?: typeof TeleBoxManager;
488
+ TeleBoxCollector?: typeof TeleBoxCollector;
489
+ };
490
+
327
491
  type CreateBoxParams = {
328
492
  appId: string;
329
493
  app: NetlessApp;
@@ -579,167 +743,6 @@ declare class AppProxy implements PageRemoveService {
579
743
  close(): Promise<void>;
580
744
  }
581
745
 
582
- declare class CursorManager {
583
- private manager;
584
- private enableCursor;
585
- containerRect?: DOMRect;
586
- wrapperRect?: DOMRect;
587
- cursorInstances: Map<string, Cursor>;
588
- roomMembers?: readonly RoomMember[];
589
- userApplianceIcons: ApplianceIcons;
590
- private mainViewElement?;
591
- private sideEffectManager;
592
- private store;
593
- private leaveFlag;
594
- private _style;
595
- constructor(manager: AppManager, enableCursor: boolean, cursorOptions?: CursorOptions, applianceIcons?: ApplianceIcons);
596
- get applianceIcons(): ApplianceIcons;
597
- get style(): "default" | "custom";
598
- set style(value: "default" | "custom");
599
- private onCursorMove;
600
- private initCursorInstance;
601
- private enableCustomCursor;
602
- private canMoveCursor;
603
- setupWrapper(wrapper: HTMLElement): void;
604
- setMainViewDivElement(div: HTMLDivElement): void;
605
- get boxState(): any;
606
- get focusView(): View | undefined;
607
- private mouseMoveListener_;
608
- private mouseMoveTimer;
609
- private mouseMoveListener;
610
- private mouseLeaveListener;
611
- private showPencilEraserIfNeeded;
612
- private updateCursor;
613
- private getPoint;
614
- /**
615
- * 因为窗口内框在不同分辨率下的大小不一样,所以这里通过来鼠标事件的 target 来判断是在主白板还是在 APP 中
616
- */
617
- private getType;
618
- updateContainerRect(): void;
619
- deleteCursor(uid: string): void;
620
- hideCursor(uid: string): void;
621
- destroy(): void;
622
- }
623
-
624
- declare class Cursor {
625
- private manager;
626
- private memberId;
627
- private cursorManager;
628
- private wrapper?;
629
- private member?;
630
- private timer?;
631
- private component?;
632
- private style;
633
- constructor(manager: AppManager, memberId: string, cursorManager: CursorManager, wrapper?: HTMLElement | undefined);
634
- move: (position: Position) => void;
635
- setStyle: (style: typeof this.style) => void;
636
- leave: () => void;
637
- private moveCursor;
638
- get memberApplianceName(): ApplianceNames | undefined;
639
- get memberColor(): string;
640
- get memberColorHex(): string;
641
- private get payload();
642
- get memberCursorName(): any;
643
- private get memberTheme();
644
- private get memberCursorTextColor();
645
- private get memberCursorTagBackgroundColor();
646
- private get memberAvatar();
647
- private get memberOpacity();
648
- private get memberTagName();
649
- private autoHidden;
650
- private createCursor;
651
- private initProps;
652
- private getIcon;
653
- private isCustomIcon;
654
- updateMember(): RoomMember | undefined;
655
- private updateComponent;
656
- destroy(): void;
657
- hide(): void;
658
- }
659
-
660
- type ExtendClass = {
661
- AppManager?: typeof AppManager;
662
- BoxManager?: typeof BoxManager;
663
- AttributesDelegate?: typeof AttributesDelegate;
664
- CursorManager?: typeof CursorManager;
665
- AppProxy?: typeof AppProxy;
666
- };
667
-
668
- type Apps = {
669
- [key: string]: AppSyncAttributes;
670
- };
671
- type Position = {
672
- x: number;
673
- y: number;
674
- type: PositionType;
675
- id?: string;
676
- };
677
- type PositionType = "main" | "app";
678
- type StoreContext = {
679
- getAttributes: () => any;
680
- safeUpdateAttributes: (keys: string[], value: any) => void;
681
- safeSetAttributes: (attributes: any) => void;
682
- };
683
- type ICamera = Camera & {
684
- id: string;
685
- };
686
- type ISize = Size & {
687
- id: string;
688
- };
689
- declare class AttributesDelegate {
690
- private context;
691
- constructor(context: StoreContext);
692
- setContext(context: StoreContext): void;
693
- get attributes(): any;
694
- apps(): Apps;
695
- get focus(): string | undefined;
696
- getAppAttributes(id: string): AppSyncAttributes;
697
- getAppState(id: string): any;
698
- getMaximized(): any;
699
- getMinimized(): any;
700
- getBoxesStatus(): Record<string, TELE_BOX_STATE> | undefined;
701
- getBoxStatus(id: string): TELE_BOX_STATE | undefined;
702
- setBoxStatus(id: string, status?: TeleBoxState): void;
703
- getLastNotMinimizedBoxesStatus(): Record<string, NotMinimizedBoxState> | undefined;
704
- getLastNotMinimizedBoxStatus(id: string): NotMinimizedBoxState | undefined;
705
- setLastNotMinimizedBoxStatus(id: string, status?: NotMinimizedBoxState): void;
706
- setupAppAttributes(params: AddAppParams, id: string, isDynamicPPT: boolean): void;
707
- updateAppState(appId: string, stateName: AppAttributes, state: any): void;
708
- cleanAppAttributes(id: string): void;
709
- cleanFocus(): void;
710
- getAppSceneIndex(id: string): any;
711
- getAppScenePath(id: string): any;
712
- getMainViewScenePath(): string | undefined;
713
- getMainViewSceneIndex(): any;
714
- getBoxState(): any;
715
- setMainViewScenePath(scenePath: string): void;
716
- setMainViewSceneIndex(index: number): void;
717
- getMainViewCamera(): MainViewCamera;
718
- getMainViewSize(): MainViewSize;
719
- setMainViewCamera(camera: ICamera): void;
720
- setMainViewSize(size: ISize): void;
721
- setMainViewCameraAndSize(camera: ICamera, size: ISize): void;
722
- setAppFocus: (appId: string, focus: boolean) => void;
723
- updateCursor(uid: string, position: Position): void;
724
- updateCursorState(uid: string, cursorState: string | undefined): void;
725
- getCursorState(uid: string): any;
726
- cleanCursor(uid: string): void;
727
- setMainViewFocusPath(mainView: View): void;
728
- getIframeBridge(): any;
729
- setIframeBridge(data: any): void;
730
- }
731
- type MainViewSize = {
732
- id: string;
733
- width: number;
734
- height: number;
735
- };
736
- type MainViewCamera = {
737
- id: string;
738
- centerX: number;
739
- centerY: number;
740
- scale: number;
741
- };
742
-
743
746
  declare class MainViewProxy {
744
747
  private manager;
745
748
  /** Refresh the view's camera in an interval of 1.5s. */
@@ -1029,9 +1032,6 @@ type InsertOptions = {
1029
1032
  readonly useClicker?: boolean;
1030
1033
  readonly useSelector?: boolean;
1031
1034
  } & BaseOption;
1032
- type OnCreateInsertOption = {
1033
- readonly displayer: Displayer;
1034
- } & BaseOption;
1035
1035
  /**
1036
1036
  * {@link https://github.com/netless-io/netless-iframe-bridge @netless/iframe-bridge}
1037
1037
  */
@@ -1129,6 +1129,19 @@ declare class ExtendPluginManager {
1129
1129
  destroy(): void;
1130
1130
  }
1131
1131
 
1132
+ type ExtendClassAble = typeof AppManager | typeof AppProxy | typeof AppContext | typeof BoxManager | typeof AttributesDelegate | typeof CursorManager | typeof TeleBoxManager | typeof TeleBoxCollector;
1133
+ type ExtendClass = {
1134
+ AppManager?: typeof AppManager;
1135
+ BoxManager?: typeof BoxManager;
1136
+ AttributesDelegate?: typeof AttributesDelegate;
1137
+ CursorManager?: typeof CursorManager;
1138
+ AppProxy?: typeof AppProxy;
1139
+ AppContext?: typeof AppContext;
1140
+ TeleBoxManager?: typeof TeleBoxManager;
1141
+ TeleBoxCollector?: typeof TeleBoxCollector;
1142
+ };
1143
+ declare function getExtendClass<T extends ExtendClassAble>(baseClass: T, extendClass?: ExtendClass): T;
1144
+
1132
1145
  declare const BuiltinApps: {
1133
1146
  DocsViewer: string;
1134
1147
  MediaPlayer: string;
@@ -1224,7 +1237,7 @@ type MountParams = {
1224
1237
  fullscreen?: boolean;
1225
1238
  polling?: boolean;
1226
1239
  supportAppliancePlugin?: boolean;
1227
- /** 是否使用 boxesStatus 状态 */
1240
+ /** 是否使用 boxesStatus 状态管理窗口 */
1228
1241
  useBoxesStatus?: boolean;
1229
1242
  };
1230
1243
  declare const reconnectRefresher: ReconnectRefresher;
@@ -1255,13 +1268,13 @@ declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
1255
1268
  private _cursorUIDsStyleDOM?;
1256
1269
  private boxManager?;
1257
1270
  private static params?;
1258
- static extendClass?: ExtendClass;
1271
+ static extendClass?: ExtendClass$1;
1259
1272
  private containerResizeObserver?;
1260
1273
  containerSizeRatio: number;
1261
1274
  private extendPluginManager?;
1262
1275
  constructor(context: InvisiblePluginContext);
1263
1276
  static onCreate(manager: WindowManager): void;
1264
- static mount(params: MountParams, extendClass?: ExtendClass): Promise<WindowManager>;
1277
+ static mount(params: MountParams, extendClass?: ExtendClass$1): Promise<WindowManager>;
1265
1278
  private static initManager;
1266
1279
  private static initContainer;
1267
1280
  static get registered(): Map<string, RegisterParams>;
@@ -1422,5 +1435,5 @@ declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
1422
1435
  useExtendPlugin(extend: ExtendPluginInstance<any>): void;
1423
1436
  }
1424
1437
 
1425
- export { AppContext, AppCreateError, AppManagerNotInitError, AppNotRegisterError, BindContainerRoomPhaseInvalidError, BoxManagerNotFoundError, BoxNotCreatedError, BuiltinApps, DomEvents, ExtendPlugin, ExtendPluginManager, IframeBridge, IframeEvents, InvalidScenePath, ParamsInvalidError, Storage, WhiteWebSDKInvalidError, WindowManager, calculateNextIndex, reconnectRefresher };
1426
- export type { AddAppOptions, AddAppParams, AddPageParams, AppEmitterEvent, AppInitState, AppListenerKeys, AppPayload, AppSyncAttributes, ApplianceIcons, BaseInsertParams, CursorMovePayload, CursorOptions, ExtendContext, ExtendManagerOptions, ExtendPluginInstance, IframeBridgeAttributes, IframeBridgeEvents, IframeSize, InsertOptions, MountParams, NetlessApp, OnCreateInsertOption, PageController, PageRemoveService, PageState, PublicEvent, RegisterEventData, RegisterEvents, RegisterParams, StorageStateChangedEvent, StorageStateChangedListener, WindowMangerAttributes, apps, setAppOptions };
1438
+ export { AppContext, AppCreateError, AppManager, AppManagerNotInitError, AppNotRegisterError, AppProxy, AttributesDelegate, BindContainerRoomPhaseInvalidError, BoxManager, BoxManagerNotFoundError, BoxNotCreatedError, BuiltinApps, CursorManager, ExtendPlugin, ExtendPluginManager, InvalidScenePath, ParamsInvalidError, Storage, WhiteWebSDKInvalidError, WindowManager, calculateNextIndex, getExtendClass, reconnectRefresher };
1439
+ 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 };