@netless/telebox-insider 0.3.0-beta.7 → 0.3.0-beta.9

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/telebox-insider",
3
- "version": "0.3.0-beta.7",
3
+ "version": "0.3.0-beta.9",
4
4
  "private": false,
5
5
  "description": "Window widget for Whiteboard",
6
6
  "author": "CRIMX <straybugs@gmail.com> (https://github.com/crimx/)",
@@ -13,7 +13,7 @@ export interface AppMenuProps {
13
13
 
14
14
  export class AppMenu {
15
15
  private readonly namespace: string = 'telebox-app-menu';
16
- public readonly container: HTMLDivElement;
16
+ private container: HTMLDivElement;
17
17
  private readonly badge: HTMLDivElement = document.createElement('div');
18
18
  private readonly menuView: HTMLDivElement = document.createElement('div');
19
19
  private readonly manager: TeleBoxManager;
@@ -76,6 +76,14 @@ export class AppMenu {
76
76
  }
77
77
  };
78
78
 
79
+ public setContainer(container: HTMLDivElement){
80
+ if(this.container) {
81
+ this.container.remove();
82
+ }
83
+ this.container = container;
84
+ this.init();
85
+ }
86
+
79
87
  private createDefaultAppMenu(){
80
88
  this.badge.classList.add(this.c('app-menu-badge'));
81
89
  this.menuView.classList.add(this.c('app-menu-tooltip'));
@@ -211,6 +211,9 @@ export class TeleBoxManager {
211
211
  collector.setVisible(minimized$.value);
212
212
  collector.setReadonly(readonly$.value);
213
213
  collector.setDarkMode(this._darkMode$.value);
214
+ if (this.useBoxesStatus && this.appMenu) {
215
+ this.appMenu.setContainer(collector.$appMenuContainer);
216
+ }
214
217
  this._sideEffect.add(() => {
215
218
  collector.getBoxesStatus = () => {
216
219
  return this.boxesStatus$;
@@ -393,7 +396,7 @@ export class TeleBoxManager {
393
396
  const box = this.getBox(targetBox.id);
394
397
  if (box) {
395
398
  let isFocusChanged = false;
396
- if (this.topBox === box) {
399
+ if (box.focus) {
397
400
  this.blurBox(box);
398
401
  isFocusChanged = true;
399
402
  }
@@ -423,7 +426,7 @@ export class TeleBoxManager {
423
426
  const box = this.getBox(targetBox.id);
424
427
  if (box) {
425
428
  let isFocusChanged = false;
426
- if (this.topBox === box) {
429
+ if (box.focus) {
427
430
  this.blurBox(box);
428
431
  isFocusChanged = true;
429
432
  }
@@ -606,13 +609,13 @@ export class TeleBoxManager {
606
609
  }
607
610
  });
608
611
  this.effectBoxStatusChange();
612
+ console.log("effectBoxesStatusTimerFunc===>newTopBox", newTopBox, curTopBox);
609
613
  if (newTopBox && curTopBox !== newTopBox) {
610
614
  this.topBox$.setValue(newTopBox);
611
- this.focusBox(newTopBox, skipUpdate);
612
615
  }
613
616
  if (!newTopBox && curTopBox) {
614
617
  this.topBox$.setValue(undefined);
615
- this.blurBox(curTopBox, skipUpdate);
618
+ // this.blurBox(curTopBox, skipUpdate);
616
619
  }
617
620
  }
618
621
 
@@ -909,10 +912,8 @@ export class TeleBoxManager {
909
912
  });
910
913
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
911
914
  if (box.boxStatus && this.useBoxesStatus) {
912
- if (this.topBox === box) {
913
- if (this.topBox?.focus) {
914
- this.blurBox(this.topBox);
915
- }
915
+ if(box.focus) {
916
+ this.blurBox(box);
916
917
  }
917
918
  this.setBox(box, {
918
919
  status: TELE_BOX_STATE.Minimized,
@@ -926,6 +927,9 @@ export class TeleBoxManager {
926
927
  }
927
928
  });
928
929
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Close, () => {
930
+ if (this.useBoxesStatus && box.focus) {
931
+ this.blurBox(box);
932
+ }
929
933
  this.remove(box);
930
934
  this.focusTopBox();
931
935
  });