@netless/telebox-insider 0.3.0-beta.4 → 0.3.0-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.
@@ -2902,8 +2902,9 @@ class TeleBoxManager {
2902
2902
  this.boxesStatus$ = boxesStatus;
2903
2903
  this.effectBoxStatusChange(skipUpdate);
2904
2904
  }
2905
- effectBoxStatusChange(skipUpdate = false) {
2905
+ effectBoxStatusTimerFunc(skipUpdate) {
2906
2906
  var _a, _b, _c, _d;
2907
+ this.effectBoxStatusTimer = void 0;
2907
2908
  let topBox;
2908
2909
  const topBoxId = (_a = this.topBox) == null ? void 0 : _a.id;
2909
2910
  let hasMinimizedBox = false;
@@ -2936,6 +2937,28 @@ class TeleBoxManager {
2936
2937
  if (this.maxTitleBar) {
2937
2938
  this.maxTitleBar.updateBoxesStatus();
2938
2939
  }
2940
+ console.log("effectBoxStatusTimerFunc===>end", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
2941
+ }
2942
+ effectBoxStatusChange(skipUpdate = false) {
2943
+ var _a, _b;
2944
+ if (this.effectBoxStatusTimer && this.effectBoxStatusTimer.timer) {
2945
+ clearTimeout(this.effectBoxStatusTimer.timer);
2946
+ if (this.effectBoxStatusTimer.skipUpdate !== skipUpdate) {
2947
+ this.effectBoxStatusTimer.skipUpdate = skipUpdate;
2948
+ console.log("effectBoxStatusTimerFunc===>1111", skipUpdate);
2949
+ this.effectBoxStatusTimerFunc(this.effectBoxStatusTimer.skipUpdate);
2950
+ }
2951
+ }
2952
+ if (!this.effectBoxStatusTimer) {
2953
+ this.effectBoxStatusTimer = {
2954
+ skipUpdate,
2955
+ timer: void 0
2956
+ };
2957
+ }
2958
+ console.log("effectBoxStatusTimerFunc===>000", skipUpdate, { id: (_a = this.topBox$.value) == null ? void 0 : _a.id, zIndex: (_b = this.topBox$.value) == null ? void 0 : _b.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
2959
+ this.effectBoxStatusTimer.timer = setTimeout(() => {
2960
+ this.effectBoxStatusTimerFunc(skipUpdate);
2961
+ }, 100);
2939
2962
  }
2940
2963
  hasBoxesStatus() {
2941
2964
  return this.boxesStatus$.size > 0;
@@ -3293,10 +3316,25 @@ class TeleBoxManager {
3293
3316
  makeBoxTop(box, skipUpdate = false) {
3294
3317
  if (this.topBox) {
3295
3318
  if (box !== this.topBox) {
3296
- const currentBoxZIndex = box.zIndex;
3297
- const addZIndex = this.topBox.zIndex + 1 - box.zIndex;
3298
- box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
3299
- this.makeTopBoxEffect(box.id, addZIndex, currentBoxZIndex, skipUpdate);
3319
+ if (!this.hasBoxesStatus()) {
3320
+ box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
3321
+ return;
3322
+ }
3323
+ const maxZIndex = this.boxes.reduce((maxZIndex2, box2) => {
3324
+ return Math.max(maxZIndex2, box2.zIndex);
3325
+ }, 0);
3326
+ const currentTopBoxZIndex = Math.min(this.topBox.zIndex, box.zIndex);
3327
+ const addZIndex = maxZIndex + 1 - currentTopBoxZIndex;
3328
+ box.setZIndex(maxZIndex + 1, skipUpdate);
3329
+ console.log("makeBoxTop===>", box.id, maxZIndex + 1, addZIndex, this.topBox.id, currentTopBoxZIndex);
3330
+ if (box.boxStatus !== TELE_BOX_STATE.Minimized) {
3331
+ this.boxes.forEach((b) => {
3332
+ if (b.boxStatus === TELE_BOX_STATE.Minimized && b.zIndex >= currentTopBoxZIndex) {
3333
+ console.log("makeBoxTop===>111", b.id, b.zIndex + addZIndex);
3334
+ b.setZIndex(b.zIndex + addZIndex, skipUpdate);
3335
+ }
3336
+ });
3337
+ }
3300
3338
  }
3301
3339
  }
3302
3340
  }
@@ -3314,15 +3352,6 @@ class TeleBoxManager {
3314
3352
  }
3315
3353
  }
3316
3354
  }
3317
- makeTopBoxEffect(boxId, addZIndex, currentZIndex, skipUpdate = false) {
3318
- if (this.hasBoxesStatus() && this.hasMinimizedBox()) {
3319
- this.boxes.forEach((b) => {
3320
- if (b.boxStatus && b.id !== boxId && b.zIndex >= currentZIndex) {
3321
- b.setZIndex(b.zIndex + addZIndex, skipUpdate);
3322
- }
3323
- });
3324
- }
3325
- }
3326
3355
  makeMaximizedBoxFocus(maximizedBox, skipUpdate = false) {
3327
3356
  if (this.maxTitleBar.hasMaximizedBoxInStatus() && this.maxTitleBar.MaximizedBoxes.find((box) => box.id === maximizedBox.id)) {
3328
3357
  const currentZIndex = maximizedBox.zIndex;