@netless/window-manager 1.0.7-beta.3 → 1.0.7-beta.5

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, TeleBoxState, TeleBoxColorScheme, 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 {
@@ -225,6 +225,10 @@ type AppEmitterEvent<T = any> = {
225
225
  reconnected: void;
226
226
  seek: number;
227
227
  pageStateChange: PageState;
228
+ boxStatusChange: {
229
+ appId: string;
230
+ status: TeleBoxState;
231
+ };
228
232
  };
229
233
  type RegisterEventData = {
230
234
  appId: string;
@@ -289,6 +293,8 @@ type PublicEvent = {
289
293
  onAppViewMounted: AppPayload;
290
294
  onAppSetup: string;
291
295
  onAppScenePathChange: AppPayload;
296
+ onBoxesStatusChange: Map<string, TeleBoxState>;
297
+ onLastNotMinimizedBoxesStatusChange: Map<string, NotMinimizedBoxState>;
292
298
  };
293
299
  type CallbacksType = Emittery<PublicEvent>;
294
300
 
@@ -321,9 +327,175 @@ type EmitterEvent = {
321
327
  changePageState: undefined;
322
328
  writableChange: boolean;
323
329
  containerSizeRatioUpdate: number;
330
+ boxesStatusChange: Map<string, TeleBoxState>;
331
+ lastNotMinimizedBoxesStatusChange: Map<string, NotMinimizedBoxState>;
324
332
  };
325
333
  type EmitterType = Emittery<EmitterEvent>;
326
334
 
335
+ declare class CursorManager {
336
+ private manager;
337
+ private enableCursor;
338
+ containerRect?: DOMRect;
339
+ wrapperRect?: DOMRect;
340
+ cursorInstances: Map<string, Cursor>;
341
+ roomMembers?: readonly RoomMember[];
342
+ userApplianceIcons: ApplianceIcons;
343
+ private mainViewElement?;
344
+ private sideEffectManager;
345
+ private store;
346
+ private leaveFlag;
347
+ private _style;
348
+ constructor(manager: AppManager, enableCursor: boolean, cursorOptions?: CursorOptions, applianceIcons?: ApplianceIcons);
349
+ get applianceIcons(): ApplianceIcons;
350
+ get style(): "default" | "custom";
351
+ set style(value: "default" | "custom");
352
+ private onCursorMove;
353
+ private initCursorInstance;
354
+ private enableCustomCursor;
355
+ private canMoveCursor;
356
+ setupWrapper(wrapper: HTMLElement): void;
357
+ setMainViewDivElement(div: HTMLDivElement): void;
358
+ get boxState(): any;
359
+ get focusView(): View | undefined;
360
+ private mouseMoveListener_;
361
+ private mouseMoveTimer;
362
+ private mouseMoveListener;
363
+ private mouseLeaveListener;
364
+ private showPencilEraserIfNeeded;
365
+ private updateCursor;
366
+ private getPoint;
367
+ /**
368
+ * 因为窗口内框在不同分辨率下的大小不一样,所以这里通过来鼠标事件的 target 来判断是在主白板还是在 APP 中
369
+ */
370
+ private getType;
371
+ updateContainerRect(): void;
372
+ deleteCursor(uid: string): void;
373
+ hideCursor(uid: string): void;
374
+ destroy(): void;
375
+ }
376
+
377
+ declare class Cursor {
378
+ private manager;
379
+ private memberId;
380
+ private cursorManager;
381
+ private wrapper?;
382
+ private member?;
383
+ private timer?;
384
+ private component?;
385
+ private style;
386
+ constructor(manager: AppManager, memberId: string, cursorManager: CursorManager, wrapper?: HTMLElement | undefined);
387
+ move: (position: Position) => void;
388
+ setStyle: (style: typeof this.style) => void;
389
+ leave: () => void;
390
+ private moveCursor;
391
+ get memberApplianceName(): ApplianceNames | undefined;
392
+ get memberColor(): string;
393
+ get memberColorHex(): string;
394
+ private get payload();
395
+ get memberCursorName(): any;
396
+ private get memberTheme();
397
+ private get memberCursorTextColor();
398
+ private get memberCursorTagBackgroundColor();
399
+ private get memberAvatar();
400
+ private get memberOpacity();
401
+ private get memberTagName();
402
+ private autoHidden;
403
+ private createCursor;
404
+ private initProps;
405
+ private getIcon;
406
+ private isCustomIcon;
407
+ updateMember(): RoomMember | undefined;
408
+ private updateComponent;
409
+ destroy(): void;
410
+ hide(): void;
411
+ }
412
+
413
+ type Apps = {
414
+ [key: string]: AppSyncAttributes;
415
+ };
416
+ type Position = {
417
+ x: number;
418
+ y: number;
419
+ type: PositionType;
420
+ id?: string;
421
+ };
422
+ type PositionType = "main" | "app";
423
+ type StoreContext = {
424
+ getAttributes: () => any;
425
+ safeUpdateAttributes: (keys: string[], value: any) => void;
426
+ safeSetAttributes: (attributes: any) => void;
427
+ };
428
+ type ICamera = Camera & {
429
+ id: string;
430
+ };
431
+ type ISize = Size & {
432
+ id: string;
433
+ };
434
+ declare class AttributesDelegate {
435
+ private context;
436
+ constructor(context: StoreContext);
437
+ setContext(context: StoreContext): void;
438
+ get attributes(): any;
439
+ apps(): Apps;
440
+ get focus(): string | undefined;
441
+ getAppAttributes(id: string): AppSyncAttributes;
442
+ getAppState(id: string): any;
443
+ getMaximized(): any;
444
+ getMinimized(): any;
445
+ getBoxesStatus(): Record<string, TeleBoxState> | undefined;
446
+ getBoxStatus(id: string): TeleBoxState | undefined;
447
+ setBoxStatus(id: string, status?: TeleBoxState): void;
448
+ getLastNotMinimizedBoxesStatus(): Record<string, NotMinimizedBoxState> | undefined;
449
+ getLastNotMinimizedBoxStatus(id: string): NotMinimizedBoxState | undefined;
450
+ setLastNotMinimizedBoxStatus(id: string, status?: NotMinimizedBoxState): void;
451
+ setupAppAttributes(params: AddAppParams, id: string, isDynamicPPT: boolean): void;
452
+ updateAppState(appId: string, stateName: AppAttributes, state: any): void;
453
+ cleanAppAttributes(id: string): void;
454
+ cleanFocus(): void;
455
+ getAppSceneIndex(id: string): any;
456
+ getAppScenePath(id: string): any;
457
+ getMainViewScenePath(): string | undefined;
458
+ getMainViewSceneIndex(): any;
459
+ getBoxState(): any;
460
+ setMainViewScenePath(scenePath: string): void;
461
+ setMainViewSceneIndex(index: number): void;
462
+ getMainViewCamera(): MainViewCamera;
463
+ getMainViewSize(): MainViewSize;
464
+ setMainViewCamera(camera: ICamera): void;
465
+ setMainViewSize(size: ISize): void;
466
+ setMainViewCameraAndSize(camera: ICamera, size: ISize): void;
467
+ setAppFocus: (appId: string, focus: boolean) => void;
468
+ updateCursor(uid: string, position: Position): void;
469
+ updateCursorState(uid: string, cursorState: string | undefined): void;
470
+ getCursorState(uid: string): any;
471
+ cleanCursor(uid: string): void;
472
+ setMainViewFocusPath(mainView: View): void;
473
+ getIframeBridge(): any;
474
+ setIframeBridge(data: any): void;
475
+ }
476
+ type MainViewSize = {
477
+ id: string;
478
+ width: number;
479
+ height: number;
480
+ };
481
+ type MainViewCamera = {
482
+ id: string;
483
+ centerX: number;
484
+ centerY: number;
485
+ scale: number;
486
+ };
487
+
488
+ type ExtendClass$1 = {
489
+ AppManager?: typeof AppManager;
490
+ BoxManager?: typeof BoxManager;
491
+ AttributesDelegate?: typeof AttributesDelegate;
492
+ CursorManager?: typeof CursorManager;
493
+ AppProxy?: typeof AppProxy;
494
+ AppContext?: typeof AppContext;
495
+ TeleBoxManager?: typeof TeleBoxManager;
496
+ TeleBoxCollector?: typeof TeleBoxCollector;
497
+ };
498
+
327
499
  type CreateBoxParams = {
328
500
  appId: string;
329
501
  app: NetlessApp;
@@ -471,6 +643,8 @@ declare class AppContext<TAttributes extends {} = any, TMagixEventPayloads = any
471
643
  getManager: () => AppManager;
472
644
  getBoxManager: () => BoxManager;
473
645
  getWindowManager: () => WindowManager;
646
+ getBoxStatus: () => TeleBoxState | undefined;
647
+ getLastNotMinimizedBoxStatus: () => NotMinimizedBoxState | undefined;
474
648
  getDisplayer: () => white_web_sdk.Displayer<white_web_sdk.DisplayerCallbacks>;
475
649
  getAppProxy: () => AppProxy;
476
650
  /** @deprecated Use context.storage.state instead. */
@@ -571,6 +745,7 @@ declare class AppProxy implements PageRemoveService {
571
745
  setViewFocusScenePath(): string | undefined;
572
746
  private createView;
573
747
  notifyPageStateChange: lodash.DebouncedFunc<() => void>;
748
+ notifyBoxStatusChange: (status: TeleBoxState) => void;
574
749
  get pageState(): PageState;
575
750
  removeSceneByIndex(index: number): Promise<boolean>;
576
751
  setSceneIndexWithoutSync(index: number): void;
@@ -579,168 +754,6 @@ declare class AppProxy implements PageRemoveService {
579
754
  close(): Promise<void>;
580
755
  }
581
756
 
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$1 = {
661
- AppManager?: typeof AppManager;
662
- BoxManager?: typeof BoxManager;
663
- AttributesDelegate?: typeof AttributesDelegate;
664
- CursorManager?: typeof CursorManager;
665
- AppProxy?: typeof AppProxy;
666
- AppContext?: typeof AppContext;
667
- };
668
-
669
- type Apps = {
670
- [key: string]: AppSyncAttributes;
671
- };
672
- type Position = {
673
- x: number;
674
- y: number;
675
- type: PositionType;
676
- id?: string;
677
- };
678
- type PositionType = "main" | "app";
679
- type StoreContext = {
680
- getAttributes: () => any;
681
- safeUpdateAttributes: (keys: string[], value: any) => void;
682
- safeSetAttributes: (attributes: any) => void;
683
- };
684
- type ICamera = Camera & {
685
- id: string;
686
- };
687
- type ISize = Size & {
688
- id: string;
689
- };
690
- declare class AttributesDelegate {
691
- private context;
692
- constructor(context: StoreContext);
693
- setContext(context: StoreContext): void;
694
- get attributes(): any;
695
- apps(): Apps;
696
- get focus(): string | undefined;
697
- getAppAttributes(id: string): AppSyncAttributes;
698
- getAppState(id: string): any;
699
- getMaximized(): any;
700
- getMinimized(): any;
701
- getBoxesStatus(): Record<string, TELE_BOX_STATE> | undefined;
702
- getBoxStatus(id: string): TELE_BOX_STATE | undefined;
703
- setBoxStatus(id: string, status?: TeleBoxState): void;
704
- getLastNotMinimizedBoxesStatus(): Record<string, NotMinimizedBoxState> | undefined;
705
- getLastNotMinimizedBoxStatus(id: string): NotMinimizedBoxState | undefined;
706
- setLastNotMinimizedBoxStatus(id: string, status?: NotMinimizedBoxState): void;
707
- setupAppAttributes(params: AddAppParams, id: string, isDynamicPPT: boolean): void;
708
- updateAppState(appId: string, stateName: AppAttributes, state: any): void;
709
- cleanAppAttributes(id: string): void;
710
- cleanFocus(): void;
711
- getAppSceneIndex(id: string): any;
712
- getAppScenePath(id: string): any;
713
- getMainViewScenePath(): string | undefined;
714
- getMainViewSceneIndex(): any;
715
- getBoxState(): any;
716
- setMainViewScenePath(scenePath: string): void;
717
- setMainViewSceneIndex(index: number): void;
718
- getMainViewCamera(): MainViewCamera;
719
- getMainViewSize(): MainViewSize;
720
- setMainViewCamera(camera: ICamera): void;
721
- setMainViewSize(size: ISize): void;
722
- setMainViewCameraAndSize(camera: ICamera, size: ISize): void;
723
- setAppFocus: (appId: string, focus: boolean) => void;
724
- updateCursor(uid: string, position: Position): void;
725
- updateCursorState(uid: string, cursorState: string | undefined): void;
726
- getCursorState(uid: string): any;
727
- cleanCursor(uid: string): void;
728
- setMainViewFocusPath(mainView: View): void;
729
- getIframeBridge(): any;
730
- setIframeBridge(data: any): void;
731
- }
732
- type MainViewSize = {
733
- id: string;
734
- width: number;
735
- height: number;
736
- };
737
- type MainViewCamera = {
738
- id: string;
739
- centerX: number;
740
- centerY: number;
741
- scale: number;
742
- };
743
-
744
757
  declare class MainViewProxy {
745
758
  private manager;
746
759
  /** Refresh the view's camera in an interval of 1.5s. */
@@ -889,6 +902,7 @@ declare class AppManager {
889
902
  private onBoxBlurred;
890
903
  private onBoxClose;
891
904
  private onBoxStateChange;
905
+ private notifyBoxesStatusChange;
892
906
  addBoxesStatusChangeListener: () => void;
893
907
  addAppsChangeListener: () => void;
894
908
  addAppCloseListener: () => void;
@@ -1127,7 +1141,7 @@ declare class ExtendPluginManager {
1127
1141
  destroy(): void;
1128
1142
  }
1129
1143
 
1130
- type ExtendClassAble = typeof AppManager | typeof AppProxy | typeof AppContext | typeof BoxManager | typeof AttributesDelegate | typeof CursorManager;
1144
+ type ExtendClassAble = typeof AppManager | typeof AppProxy | typeof AppContext | typeof BoxManager | typeof AttributesDelegate | typeof CursorManager | typeof TeleBoxManager | typeof TeleBoxCollector;
1131
1145
  type ExtendClass = {
1132
1146
  AppManager?: typeof AppManager;
1133
1147
  BoxManager?: typeof BoxManager;
@@ -1135,6 +1149,8 @@ type ExtendClass = {
1135
1149
  CursorManager?: typeof CursorManager;
1136
1150
  AppProxy?: typeof AppProxy;
1137
1151
  AppContext?: typeof AppContext;
1152
+ TeleBoxManager?: typeof TeleBoxManager;
1153
+ TeleBoxCollector?: typeof TeleBoxCollector;
1138
1154
  };
1139
1155
  declare function getExtendClass<T extends ExtendClassAble>(baseClass: T, extendClass?: ExtendClass): T;
1140
1156
 
@@ -1358,7 +1374,7 @@ declare class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
1358
1374
  get cameraState(): CameraState;
1359
1375
  get apps(): Apps | undefined;
1360
1376
  get boxState(): TeleBoxState | undefined;
1361
- get boxStatus(): Record<string, TELE_BOX_STATE> | undefined;
1377
+ get boxStatus(): Record<string, TeleBoxState> | undefined;
1362
1378
  get lastNotMinimizedBoxStatus(): Record<string, NotMinimizedBoxState> | undefined;
1363
1379
  get darkMode(): boolean;
1364
1380
  get prefersColorScheme(): TeleBoxColorScheme | undefined;