@netless/telebox-insider 0.3.0-beta.8 → 0.3.0

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.
@@ -1183,6 +1183,8 @@ var TELE_BOX_EVENT = /* @__PURE__ */ ((TELE_BOX_EVENT2) => {
1183
1183
  TELE_BOX_EVENT2["Destroyed"] = "destroyed";
1184
1184
  TELE_BOX_EVENT2["BoxStatus"] = "box_status";
1185
1185
  TELE_BOX_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
1186
+ TELE_BOX_EVENT2["ForceTop"] = "force_top";
1187
+ TELE_BOX_EVENT2["ForceNormal"] = "force_normal";
1186
1188
  return TELE_BOX_EVENT2;
1187
1189
  })(TELE_BOX_EVENT || {});
1188
1190
  var TELE_BOX_DELEGATE_EVENT = /* @__PURE__ */ ((TELE_BOX_DELEGATE_EVENT2) => {
@@ -1237,7 +1239,9 @@ class DefaultTitleBar {
1237
1239
  onDragStart,
1238
1240
  namespace = "telebox",
1239
1241
  state = TELE_BOX_STATE.Normal,
1240
- boxStatus
1242
+ boxStatus,
1243
+ forceTop = false,
1244
+ forceNormal = false
1241
1245
  } = {}) {
1242
1246
  this.$btns = [];
1243
1247
  this.sideEffect = new o();
@@ -1311,7 +1315,14 @@ class DefaultTitleBar {
1311
1315
  this.title = title;
1312
1316
  this.state = state;
1313
1317
  this.boxStatus = boxStatus;
1314
- this.buttons = buttons || [
1318
+ this.forceTop = forceTop;
1319
+ this.forceNormal = forceNormal;
1320
+ this.buttons = buttons || (forceNormal ? [
1321
+ {
1322
+ type: TELE_BOX_DELEGATE_EVENT.Close,
1323
+ iconClassName: this.wrapClassName("titlebar-icon-close")
1324
+ }
1325
+ ] : [
1315
1326
  {
1316
1327
  type: TELE_BOX_DELEGATE_EVENT.Minimize,
1317
1328
  iconClassName: this.wrapClassName("titlebar-icon-minimize")
@@ -1325,7 +1336,7 @@ class DefaultTitleBar {
1325
1336
  type: TELE_BOX_DELEGATE_EVENT.Close,
1326
1337
  iconClassName: this.wrapClassName("titlebar-icon-close")
1327
1338
  }
1328
- ];
1339
+ ]);
1329
1340
  this.$dragArea = this.renderDragArea();
1330
1341
  }
1331
1342
  setTitle(title) {
@@ -1498,7 +1509,10 @@ class TeleBox {
1498
1509
  },
1499
1510
  collectorRect,
1500
1511
  boxStatus,
1501
- lastNotMinimizedBoxStatus
1512
+ lastNotMinimizedBoxStatus,
1513
+ forceTop = false,
1514
+ forceNormal = false,
1515
+ isDragContent = false
1502
1516
  } = {}) {
1503
1517
  this._renderSideEffect = new o();
1504
1518
  this.handleTrackStart = (ev) => {
@@ -1565,6 +1579,19 @@ class TeleBox {
1565
1579
  });
1566
1580
  const containerRect$ = createVal(containerRect, shallowequal);
1567
1581
  const collectorRect$ = createVal(collectorRect, shallowequal);
1582
+ const forceTop$ = createVal(forceTop);
1583
+ forceTop$.reaction((forceTop2, _, skipUpdate) => {
1584
+ if (!skipUpdate) {
1585
+ this.events.emit(TELE_BOX_EVENT.ForceTop, forceTop2 || false);
1586
+ }
1587
+ });
1588
+ const forceNormal$ = createVal(forceNormal);
1589
+ forceNormal$.reaction((forceNormal2, _, skipUpdate) => {
1590
+ if (!skipUpdate) {
1591
+ this.events.emit(TELE_BOX_EVENT.ForceNormal, forceNormal2 || false);
1592
+ }
1593
+ });
1594
+ const isDragContent$ = createVal(isDragContent);
1568
1595
  const title$ = createVal(title);
1569
1596
  title$.reaction((title2, _, skipUpdate) => {
1570
1597
  if (!skipUpdate) {
@@ -1742,6 +1769,8 @@ class TeleBox {
1742
1769
  title: title$.value,
1743
1770
  namespace: this.namespace,
1744
1771
  boxStatus: boxStatus$.value,
1772
+ forceTop: forceTop$.value,
1773
+ forceNormal: forceNormal$.value,
1745
1774
  onDragStart: (event) => {
1746
1775
  var _a;
1747
1776
  return (_a = this._handleTrackStart) == null ? void 0 : _a.call(this, event);
@@ -1805,7 +1834,10 @@ class TeleBox {
1805
1834
  maximized: maximized$,
1806
1835
  $userContent: $userContent$,
1807
1836
  $userFooter: $userFooter$,
1808
- $userStyles: $userStyles$
1837
+ $userStyles: $userStyles$,
1838
+ forceTop: forceTop$,
1839
+ forceNormal: forceNormal$,
1840
+ isDragContent: isDragContent$
1809
1841
  };
1810
1842
  i(this, valConfig);
1811
1843
  this._state$ = state$;
@@ -2142,6 +2174,9 @@ class TeleBox {
2142
2174
  const $content = document.createElement("div");
2143
2175
  $content.className = this.wrapClassName("content") + " tele-fancy-scrollbar";
2144
2176
  this.$content = $content;
2177
+ if (this.isDragContent) {
2178
+ this.$content.appendChild(this.titleBar.$dragArea);
2179
+ }
2145
2180
  this._renderSideEffect.add(() => {
2146
2181
  let last$userStyles;
2147
2182
  return this._$userStyles$.subscribe(($userStyles) => {
@@ -2571,6 +2606,7 @@ class TeleBoxCollector {
2571
2606
  return `${this.namespace}-${className}`;
2572
2607
  }
2573
2608
  }
2609
+ TeleBoxCollector.kind = "TeleBoxCollector";
2574
2610
  var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
2575
2611
  TELE_BOX_MANAGER_EVENT2["Focused"] = "focused";
2576
2612
  TELE_BOX_MANAGER_EVENT2["Blurred"] = "blurred";
@@ -2619,7 +2655,7 @@ class MaxTitleBar extends DefaultTitleBar {
2619
2655
  if (this.getBoxesStatus) {
2620
2656
  const boxesStatus = this.getBoxesStatus();
2621
2657
  if (boxesStatus) {
2622
- return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized);
2658
+ return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized && !box.forceTop);
2623
2659
  }
2624
2660
  }
2625
2661
  return [];
@@ -2898,7 +2934,6 @@ class AppMenu {
2898
2934
  createMinimizedItem(appId) {
2899
2935
  const appItem = document.createElement("div");
2900
2936
  appItem.classList.add(this.c("app-menu-item"));
2901
- console.log("appId=====>", appId);
2902
2937
  appItem.setAttribute(`data-${this.c("app-id")}`, appId);
2903
2938
  const titleDiv = document.createElement("div");
2904
2939
  titleDiv.classList.add(this.c("app-menu-item-title"));
@@ -2960,9 +2995,11 @@ class TeleBoxManager {
2960
2995
  this.boxes$ = createVal([]);
2961
2996
  this.topBox$ = this.boxes$.derive((boxes) => {
2962
2997
  if (boxes.length > 0) {
2963
- console.log("topBox===>topBox$===>000");
2964
2998
  let currentTopBox = void 0;
2965
2999
  const topBox = boxes.reduce((topBox2, box) => {
3000
+ if (box.forceTop) {
3001
+ return topBox2;
3002
+ }
2966
3003
  if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized) {
2967
3004
  return topBox2;
2968
3005
  }
@@ -2972,7 +3009,6 @@ class TeleBoxManager {
2972
3009
  }
2973
3010
  return topBox2.zIndex > box.zIndex ? topBox2 : box;
2974
3011
  }, currentTopBox);
2975
- console.log("topBox===>topBox$===>end", topBox == null ? void 0 : topBox.id);
2976
3012
  return topBox;
2977
3013
  }
2978
3014
  return;
@@ -3169,7 +3205,6 @@ class TeleBoxManager {
3169
3205
  this.makeMaximizedTopBoxFocus();
3170
3206
  }
3171
3207
  }
3172
- console.log("checkFocusBox===>", box.id);
3173
3208
  this.focusBox(box);
3174
3209
  return;
3175
3210
  }
@@ -3232,7 +3267,7 @@ class TeleBoxManager {
3232
3267
  const box = this.getBox(targetBox.id);
3233
3268
  if (box) {
3234
3269
  let isFocusChanged = false;
3235
- if (this.topBox === box) {
3270
+ if (box.focus) {
3236
3271
  this.blurBox(box);
3237
3272
  isFocusChanged = true;
3238
3273
  }
@@ -3262,7 +3297,7 @@ class TeleBoxManager {
3262
3297
  const box = this.getBox(targetBox.id);
3263
3298
  if (box) {
3264
3299
  let isFocusChanged = false;
3265
- if (this.topBox === box) {
3300
+ if (box.focus) {
3266
3301
  this.blurBox(box);
3267
3302
  isFocusChanged = true;
3268
3303
  }
@@ -3315,6 +3350,21 @@ class TeleBoxManager {
3315
3350
  get topBox() {
3316
3351
  return this.topBox$.value;
3317
3352
  }
3353
+ get forceTopBoxes() {
3354
+ return this.boxes.find((box) => box.forceTop);
3355
+ }
3356
+ get maxForceTopBox() {
3357
+ return this.boxes.reduce((maxTopBox, box) => {
3358
+ var _a;
3359
+ if (box.forceTop && box.zIndex > ((_a = maxTopBox == null ? void 0 : maxTopBox.zIndex) != null ? _a : 0)) {
3360
+ return box;
3361
+ }
3362
+ return maxTopBox;
3363
+ }, void 0);
3364
+ }
3365
+ get forceNormalBoxes() {
3366
+ return this.boxes.find((box) => box.forceNormal);
3367
+ }
3318
3368
  get darkMode() {
3319
3369
  return this._darkMode$.value;
3320
3370
  }
@@ -3401,7 +3451,7 @@ class TeleBoxManager {
3401
3451
  var _a;
3402
3452
  const boxStatus = this.boxesStatus$.get(box.id);
3403
3453
  if (boxStatus) {
3404
- if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
3454
+ if (boxStatus !== TELE_BOX_STATE.Minimized && !this.isForceTop(box) && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
3405
3455
  newTopBox = box;
3406
3456
  }
3407
3457
  box.setBoxStatus(boxStatus, skipUpdate);
@@ -3410,15 +3460,13 @@ class TeleBoxManager {
3410
3460
  this.effectBoxStatusChange();
3411
3461
  if (newTopBox && curTopBox !== newTopBox) {
3412
3462
  this.topBox$.setValue(newTopBox);
3413
- this.focusBox(newTopBox, skipUpdate);
3414
3463
  }
3415
3464
  if (!newTopBox && curTopBox) {
3416
3465
  this.topBox$.setValue(void 0);
3417
- this.blurBox(curTopBox, skipUpdate);
3418
3466
  }
3419
3467
  }
3420
3468
  async effectBoxesStatusChange(skipUpdate = false) {
3421
- var _a, _b, _c, _d, _e, _f;
3469
+ var _a, _b;
3422
3470
  if (!this.useBoxesStatus) {
3423
3471
  if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
3424
3472
  clearTimeout(this.effectBoxesStatusTimer.timer);
@@ -3433,11 +3481,9 @@ class TeleBoxManager {
3433
3481
  if (this.effectBoxesStatusTimer.skipUpdate !== skipUpdate) {
3434
3482
  clearTimeout(this.effectBoxesStatusTimer.timer);
3435
3483
  if (this.effectBoxesStatusTimer.resolve) {
3436
- console.log("effectBoxStatusTimerFunc===>1111", skipUpdate);
3437
3484
  this.effectBoxesStatusTimer.resolve(!!((_b = this.effectBoxesStatusTimer) == null ? void 0 : _b.skipUpdate));
3438
3485
  }
3439
3486
  this.effectBoxesStatusTimer.skipUpdate = skipUpdate;
3440
- console.log("effectBoxStatusTimerFunc===>2222", skipUpdate);
3441
3487
  } else {
3442
3488
  return;
3443
3489
  }
@@ -3453,17 +3499,13 @@ class TeleBoxManager {
3453
3499
  const _skipUpdate = await new Promise((resolve) => {
3454
3500
  this.effectBoxesStatusTimer.resolve = resolve;
3455
3501
  this.effectBoxesStatusTimer.timer = setTimeout(() => {
3456
- var _a2, _b2;
3457
3502
  if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.resolve) {
3458
- console.log("effectBoxStatusTimerFunc===>000", skipUpdate, { id: (_a2 = this.topBox$.value) == null ? void 0 : _a2.id, zIndex: (_b2 = this.topBox$.value) == null ? void 0 : _b2.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
3459
3503
  this.effectBoxesStatusTimer.resolve(this.effectBoxesStatusTimer.skipUpdate);
3460
3504
  }
3461
3505
  }, 100);
3462
3506
  });
3463
- console.log("effectBoxStatusTimerFunc===>000==>00", skipUpdate, { id: (_c = this.topBox$.value) == null ? void 0 : _c.id, zIndex: (_d = this.topBox$.value) == null ? void 0 : _d.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
3464
3507
  this.effectBoxesStatusTimerFunc(_skipUpdate);
3465
3508
  this.effectBoxesStatusTimer = void 0;
3466
- console.log("effectBoxStatusTimerFunc===>000==>11", skipUpdate, { id: (_e = this.topBox$.value) == null ? void 0 : _e.id, zIndex: (_f = this.topBox$.value) == null ? void 0 : _f.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
3467
3509
  }
3468
3510
  }
3469
3511
  hasBoxesStatus() {
@@ -3547,11 +3589,9 @@ class TeleBoxManager {
3547
3589
  clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
3548
3590
  if (this.effectLastNotMinimizedBoxStatusTimer.skipUpdate !== skipUpdate) {
3549
3591
  if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
3550
- console.log("effectLastNotMinimizedBoxStatusFunc===>1111", skipUpdate);
3551
3592
  this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((_b = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _b.skipUpdate));
3552
3593
  }
3553
3594
  this.effectLastNotMinimizedBoxStatusTimer.skipUpdate = skipUpdate;
3554
- console.log("effectLastNotMinimizedBoxStatusFunc===>2222", skipUpdate);
3555
3595
  } else {
3556
3596
  return;
3557
3597
  }
@@ -3568,22 +3608,18 @@ class TeleBoxManager {
3568
3608
  this.effectLastNotMinimizedBoxStatusTimer.resolve = resolve;
3569
3609
  this.effectLastNotMinimizedBoxStatusTimer.timer = setTimeout(() => {
3570
3610
  if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.resolve) {
3571
- console.log("effectLastNotMinimizedBoxStatusTimer===>000", skipUpdate);
3572
3611
  this.effectLastNotMinimizedBoxStatusTimer.resolve(this.effectLastNotMinimizedBoxStatusTimer.skipUpdate);
3573
3612
  }
3574
3613
  }, 100);
3575
3614
  });
3576
- console.log("effectLastNotMinimizedBoxStatusFunc===>000==>00", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex, lastNotMinimizedBoxStatus: b._lastNotMinimizedBoxStatus$.value })));
3577
3615
  this.effectLastNotMinimizedBoxStatusFunc(_skipUpdate);
3578
3616
  this.effectLastNotMinimizedBoxStatusTimer = void 0;
3579
- console.log("effectLastNotMinimizedBoxStatusFunc===>000==>11", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex, lastNotMinimizedBoxStatus: b._lastNotMinimizedBoxStatus$.value })));
3580
3617
  }
3581
3618
  }
3582
3619
  effectLastNotMinimizedBoxStatusFunc(skipUpdate = false) {
3583
3620
  if (!this.useBoxesStatus) {
3584
3621
  return;
3585
3622
  }
3586
- console.log("effectLastNotMinimizedBoxStatusFunc===>end", skipUpdate);
3587
3623
  this.boxes.forEach((box) => {
3588
3624
  const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
3589
3625
  if (boxStatus) {
@@ -3599,7 +3635,7 @@ class TeleBoxManager {
3599
3635
  return this.getUnabledBoxesStatusZIndex();
3600
3636
  }
3601
3637
  return this.boxes.reduce((maxZIndex, box) => {
3602
- if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
3638
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized && !this.isForceTop(box)) {
3603
3639
  return Math.max(maxZIndex, box.zIndex);
3604
3640
  }
3605
3641
  return maxZIndex;
@@ -3610,17 +3646,32 @@ class TeleBoxManager {
3610
3646
  return this.getUnabledBoxesStatusZIndex();
3611
3647
  }
3612
3648
  return this.boxes.reduce((maxZIndex, box) => {
3613
- if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
3649
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal && !this.isForceTop(box)) {
3614
3650
  return Math.max(maxZIndex, box.zIndex);
3615
3651
  }
3616
3652
  return maxZIndex;
3617
3653
  }, 299);
3618
3654
  }
3655
+ getMaxForceTopBoxZIndex() {
3656
+ if (!this.useBoxesStatus) {
3657
+ return this.getUnabledBoxesStatusZIndex();
3658
+ }
3659
+ return this.boxes.reduce((maxZIndex, box) => {
3660
+ if (box.boxStatus && this.isForceTop(box)) {
3661
+ return Math.max(maxZIndex, box.zIndex);
3662
+ }
3663
+ return maxZIndex;
3664
+ }, 699);
3665
+ }
3666
+ isForceNormal(box) {
3667
+ return box._forceNormal$.value;
3668
+ }
3669
+ isForceTop(box) {
3670
+ return box._forceTop$.value;
3671
+ }
3619
3672
  create(config = {}, smartPosition = true) {
3620
- var _a;
3621
- console.log("create===>", config, (_a = this.topBox) == null ? void 0 : _a.zIndex);
3622
3673
  const box = new TeleBox({
3623
- zIndex: this.getMaxNormalBoxZIndex() + 1,
3674
+ zIndex: config.forceTop ? this.getMaxForceTopBoxZIndex() + 1 : this.getMaxNormalBoxZIndex() + 1,
3624
3675
  ...smartPosition ? this.smartPosition(config) : config,
3625
3676
  darkMode: this.darkMode,
3626
3677
  prefersColorScheme: this.prefersColorScheme,
@@ -3648,15 +3699,17 @@ class TeleBoxManager {
3648
3699
  }
3649
3700
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
3650
3701
  if (this.useBoxesStatus && box.boxStatus) {
3702
+ if (box._forceNormal$.value) {
3703
+ return;
3704
+ }
3651
3705
  if (box.boxStatus === TELE_BOX_STATE.Maximized) {
3652
3706
  this.setBox(box.id, {
3653
3707
  status: TELE_BOX_STATE.Normal,
3654
3708
  zIndex: this.getMaxNormalBoxZIndex() + 1
3655
3709
  }, false);
3656
3710
  } else {
3657
- [...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
3711
+ [...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal && !this.isForceNormal(box2)).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
3658
3712
  if (box2.boxStatus === TELE_BOX_STATE.Normal) {
3659
- console.log("maximized===>", box2.id);
3660
3713
  this.setBox(box2.id, {
3661
3714
  status: TELE_BOX_STATE.Maximized,
3662
3715
  zIndex: this.getMaxMaximizedBoxZIndex() + 1
@@ -3670,12 +3723,12 @@ class TeleBoxManager {
3670
3723
  }
3671
3724
  });
3672
3725
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
3673
- var _a2;
3674
3726
  if (box.boxStatus && this.useBoxesStatus) {
3675
- if (this.topBox === box) {
3676
- if ((_a2 = this.topBox) == null ? void 0 : _a2.focus) {
3677
- this.blurBox(this.topBox);
3678
- }
3727
+ if (box._forceNormal$.value) {
3728
+ return;
3729
+ }
3730
+ if (box.focus) {
3731
+ this.blurBox(box);
3679
3732
  }
3680
3733
  this.setBox(box, {
3681
3734
  status: TELE_BOX_STATE.Minimized,
@@ -3688,6 +3741,9 @@ class TeleBoxManager {
3688
3741
  }
3689
3742
  });
3690
3743
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Close, () => {
3744
+ if (this.useBoxesStatus && box.focus) {
3745
+ this.blurBox(box);
3746
+ }
3691
3747
  this.remove(box);
3692
3748
  this.focusTopBox();
3693
3749
  });
@@ -3718,9 +3774,11 @@ class TeleBoxManager {
3718
3774
  });
3719
3775
  box._zIndex$.reaction((_, __, skipUpdate) => {
3720
3776
  if (this.boxes.length > 0) {
3721
- console.log("topBox===>_zIndex", this.boxes.map((box2) => ({ id: box2.id, zIndex: box2.zIndex, boxStatus: box2.boxStatus })));
3722
3777
  let currentTopBox = void 0;
3723
3778
  const topBox = this.boxes.reduce((topBox2, box2) => {
3779
+ if (this.isForceTop(box2)) {
3780
+ return topBox2;
3781
+ }
3724
3782
  if (box2.boxStatus && box2.boxStatus === TELE_BOX_STATE.Minimized) {
3725
3783
  return topBox2;
3726
3784
  }
@@ -3730,7 +3788,6 @@ class TeleBoxManager {
3730
3788
  }
3731
3789
  return topBox2.zIndex > box2.zIndex ? topBox2 : box2;
3732
3790
  }, currentTopBox);
3733
- console.log("topBox===>_zIndex===>end", topBox == null ? void 0 : topBox.id);
3734
3791
  this.topBox$.setValue(topBox);
3735
3792
  }
3736
3793
  if (!skipUpdate) {
@@ -3951,13 +4008,27 @@ class TeleBoxManager {
3951
4008
  lastNotMinimizedBoxStatus: config.lastNotMinimizedBoxStatus
3952
4009
  }, skipUpdate);
3953
4010
  }
4011
+ if (config.forceTop != null) {
4012
+ box.setForceTop(config.forceTop, skipUpdate);
4013
+ }
4014
+ if (config.forceNormal != null) {
4015
+ box.setForceNormal(config.forceNormal, skipUpdate);
4016
+ }
3954
4017
  }
3955
4018
  smartPosition(config = {}) {
3956
4019
  let { x, y } = config;
3957
4020
  const { width = 0.5, height = 0.5 } = config;
3958
4021
  if (x == null) {
3959
4022
  let vx = 20;
3960
- if (this.topBox) {
4023
+ if (config.forceTop) {
4024
+ const forceTopBox = this.maxForceTopBox || this.topBox;
4025
+ if (forceTopBox) {
4026
+ vx = forceTopBox.intrinsicX * this.containerRect.width + 20;
4027
+ if (vx > this.containerRect.width - width * this.containerRect.width) {
4028
+ vx = 20;
4029
+ }
4030
+ }
4031
+ } else if (this.topBox) {
3961
4032
  vx = this.topBox.intrinsicX * this.containerRect.width + 20;
3962
4033
  if (vx > this.containerRect.width - width * this.containerRect.width) {
3963
4034
  vx = 20;
@@ -3971,7 +4042,15 @@ class TeleBoxManager {
3971
4042
  }
3972
4043
  if (y == null) {
3973
4044
  let vy = 20;
3974
- if (this.topBox) {
4045
+ if (config.forceTop) {
4046
+ const forceTopBox = this.maxForceTopBox || this.topBox;
4047
+ if (forceTopBox) {
4048
+ vy = forceTopBox.intrinsicY * this.containerRect.height + 20;
4049
+ if (vy > this.containerRect.height - height * this.containerRect.height) {
4050
+ vy = 20;
4051
+ }
4052
+ }
4053
+ } else if (this.topBox) {
3975
4054
  vy = this.topBox.intrinsicY * this.containerRect.height + 20;
3976
4055
  if (vy > this.containerRect.height - height * this.containerRect.height) {
3977
4056
  vy = 20;
@@ -4013,9 +4092,7 @@ class TeleBoxManager {
4013
4092
  return;
4014
4093
  }
4015
4094
  const maximizedBox = this.getMaximizedTopBox();
4016
- console.log("makeMaximizedTopBoxFocus===>", maximizedBox == null ? void 0 : maximizedBox.id);
4017
4095
  this.maxTitleBar.focusBox(maximizedBox);
4018
- console.log("makeMaximizedTopBoxFocus===>end", maximizedBox == null ? void 0 : maximizedBox.id);
4019
4096
  }
4020
4097
  getBoxIndex(boxOrID) {
4021
4098
  return typeof boxOrID === "string" ? this.boxes.findIndex((box) => box.id === boxOrID) : this.boxes.findIndex((box) => box === boxOrID);
@@ -4038,5 +4115,6 @@ class TeleBoxManager {
4038
4115
  return;
4039
4116
  }
4040
4117
  }
4118
+ TeleBoxManager.kind = "TeleBoxManager";
4041
4119
  export { DefaultTitleBar, TELE_BOX_COLOR_SCHEME, TELE_BOX_DELEGATE_EVENT, TELE_BOX_EVENT, TELE_BOX_MANAGER_EVENT, TELE_BOX_RESIZE_HANDLE, TELE_BOX_STATE, TeleBox, TeleBoxCollector, TeleBoxDragHandleType, TeleBoxManager };
4042
4120
  //# sourceMappingURL=telebox-insider.es.js.map