@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/dist/index.d.ts CHANGED
@@ -849,7 +849,7 @@ interface AppMenuProps {
849
849
  }
850
850
  declare class AppMenu {
851
851
  private readonly namespace;
852
- readonly container: HTMLDivElement;
852
+ private container;
853
853
  private readonly badge;
854
854
  private readonly menuView;
855
855
  private readonly manager;
@@ -861,6 +861,7 @@ declare class AppMenu {
861
861
  private c;
862
862
  containerClickHandler: () => void;
863
863
  private menuViewClickHandler;
864
+ setContainer(container: HTMLDivElement): void;
864
865
  private createDefaultAppMenu;
865
866
  private init;
866
867
  updatePrefersColorSchemeHandler: () => void;
@@ -2879,6 +2879,13 @@ class AppMenu {
2879
2879
  c(className) {
2880
2880
  return `${this.namespace}-${className}`;
2881
2881
  }
2882
+ setContainer(container) {
2883
+ if (this.container) {
2884
+ this.container.remove();
2885
+ }
2886
+ this.container = container;
2887
+ this.init();
2888
+ }
2882
2889
  createDefaultAppMenu() {
2883
2890
  this.badge.classList.add(this.c("app-menu-badge"));
2884
2891
  this.menuView.classList.add(this.c("app-menu-tooltip"));
@@ -3055,6 +3062,9 @@ class TeleBoxManager {
3055
3062
  collector2.setVisible(minimized$.value);
3056
3063
  collector2.setReadonly(readonly$.value);
3057
3064
  collector2.setDarkMode(this._darkMode$.value);
3065
+ if (this.useBoxesStatus && this.appMenu) {
3066
+ this.appMenu.setContainer(collector2.$appMenuContainer);
3067
+ }
3058
3068
  this._sideEffect.add(() => {
3059
3069
  collector2.getBoxesStatus = () => {
3060
3070
  return this.boxesStatus$;
@@ -3224,7 +3234,7 @@ class TeleBoxManager {
3224
3234
  const box = this.getBox(targetBox.id);
3225
3235
  if (box) {
3226
3236
  let isFocusChanged = false;
3227
- if (this.topBox === box) {
3237
+ if (box.focus) {
3228
3238
  this.blurBox(box);
3229
3239
  isFocusChanged = true;
3230
3240
  }
@@ -3254,7 +3264,7 @@ class TeleBoxManager {
3254
3264
  const box = this.getBox(targetBox.id);
3255
3265
  if (box) {
3256
3266
  let isFocusChanged = false;
3257
- if (this.topBox === box) {
3267
+ if (box.focus) {
3258
3268
  this.blurBox(box);
3259
3269
  isFocusChanged = true;
3260
3270
  }
@@ -3400,13 +3410,12 @@ class TeleBoxManager {
3400
3410
  }
3401
3411
  });
3402
3412
  this.effectBoxStatusChange();
3413
+ console.log("effectBoxesStatusTimerFunc===>newTopBox", newTopBox, curTopBox);
3403
3414
  if (newTopBox && curTopBox !== newTopBox) {
3404
3415
  this.topBox$.setValue(newTopBox);
3405
- this.focusBox(newTopBox, skipUpdate);
3406
3416
  }
3407
3417
  if (!newTopBox && curTopBox) {
3408
3418
  this.topBox$.setValue(void 0);
3409
- this.blurBox(curTopBox, skipUpdate);
3410
3419
  }
3411
3420
  }
3412
3421
  async effectBoxesStatusChange(skipUpdate = false) {
@@ -3662,12 +3671,9 @@ class TeleBoxManager {
3662
3671
  }
3663
3672
  });
3664
3673
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
3665
- var _a2;
3666
3674
  if (box.boxStatus && this.useBoxesStatus) {
3667
- if (this.topBox === box) {
3668
- if ((_a2 = this.topBox) == null ? void 0 : _a2.focus) {
3669
- this.blurBox(this.topBox);
3670
- }
3675
+ if (box.focus) {
3676
+ this.blurBox(box);
3671
3677
  }
3672
3678
  this.setBox(box, {
3673
3679
  status: TELE_BOX_STATE.Minimized,
@@ -3680,6 +3686,9 @@ class TeleBoxManager {
3680
3686
  }
3681
3687
  });
3682
3688
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Close, () => {
3689
+ if (this.useBoxesStatus && box.focus) {
3690
+ this.blurBox(box);
3691
+ }
3683
3692
  this.remove(box);
3684
3693
  this.focusTopBox();
3685
3694
  });