@netless/telebox-insider 0.3.0-beta.10 → 0.3.0-beta.12

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
@@ -284,7 +284,9 @@ declare enum TELE_BOX_EVENT {
284
284
  Readonly = "readonly",
285
285
  Destroyed = "destroyed",
286
286
  BoxStatus = "box_status",
287
- LastNotMinimizedBoxStatus = "last_not_minimized_box_status"
287
+ LastNotMinimizedBoxStatus = "last_not_minimized_box_status",
288
+ ForceTop = "force_top",
289
+ ForceNormal = "force_normal"
288
290
  }
289
291
  declare enum TELE_BOX_DELEGATE_EVENT {
290
292
  Close = "close",
@@ -381,6 +383,12 @@ interface TeleBoxConfig {
381
383
  readonly boxStatus?: TeleBoxState;
382
384
  /** Last not minimized box status. */
383
385
  readonly lastNotMinimizedBoxStatus?: NotMinimizedBoxState;
386
+ /** Force top. */
387
+ readonly forceTop?: boolean;
388
+ /** Force normal. */
389
+ readonly forceNormal?: boolean;
390
+ /** Is drag content. */
391
+ readonly isDragContent?: boolean;
384
392
  }
385
393
  type CheckTeleBoxConfig<T extends Record<`${TELE_BOX_EVENT}`, any>> = T;
386
394
  type TeleBoxEventConfig = CheckTeleBoxConfig<{
@@ -423,6 +431,8 @@ type TeleBoxEventConfig = CheckTeleBoxConfig<{
423
431
  id: string;
424
432
  lastNotMinimizedBoxStatus?: NotMinimizedBoxState;
425
433
  };
434
+ force_normal: boolean;
435
+ force_top: boolean;
426
436
  }>;
427
437
  type TeleBoxEvent = keyof TeleBoxEventConfig;
428
438
  interface TeleBoxEvents extends EventEmitter<TeleBoxEvent> {
@@ -460,10 +470,13 @@ interface TeleTitleBarConfig {
460
470
  title?: string;
461
471
  state?: TeleBoxState;
462
472
  namespace?: string;
473
+ forceTop?: boolean;
474
+ forceNormal?: boolean;
463
475
  onEvent?: (event: TeleTitleBarEvent) => void;
464
476
  onDragStart?: (event: MouseEvent | TouchEvent) => void;
465
477
  }
466
478
  interface TeleTitleBar {
479
+ readonly $dragArea: HTMLElement;
467
480
  setTitle(title: string): void;
468
481
  setState(state: TeleBoxState): void;
469
482
  setReadonly(readonly: boolean): void;
@@ -482,11 +495,13 @@ interface DefaultTitleBarConfig extends TeleTitleBarConfig {
482
495
  }
483
496
  declare class DefaultTitleBar implements TeleTitleBar {
484
497
  protected boxStatus?: TeleBoxState;
485
- constructor({ readonly, title, buttons, onEvent, onDragStart, namespace, state, boxStatus, }?: DefaultTitleBarConfig);
498
+ protected forceTop?: boolean;
499
+ protected forceNormal?: boolean;
500
+ constructor({ readonly, title, buttons, onEvent, onDragStart, namespace, state, boxStatus, forceTop, forceNormal, }?: DefaultTitleBarConfig);
486
501
  readonly namespace: string;
487
502
  $titleBar: HTMLElement | undefined;
488
503
  $title: HTMLElement | undefined;
489
- $dragArea: HTMLElement;
504
+ readonly $dragArea: HTMLElement;
490
505
  setTitle(title: string): void;
491
506
  setState(state: TeleBoxState): void;
492
507
  setBoxStatus(boxStatus?: TeleBoxState): void;
@@ -546,11 +561,17 @@ type ValConfig$1 = {
546
561
  $userContent: Val<HTMLElement | undefined>;
547
562
  $userFooter: Val<HTMLElement | undefined>;
548
563
  $userStyles: Val<HTMLStyleElement | undefined>;
564
+ /** Force top. */
565
+ forceTop: Val<boolean, boolean>;
566
+ /** Force normal. */
567
+ forceNormal: Val<boolean, boolean>;
568
+ /** Drag content. */
569
+ isDragContent: Val<boolean, boolean>;
549
570
  };
550
571
  interface TeleBox extends ValEnhancedResult<ValConfig$1> {
551
572
  }
552
573
  declare class TeleBox {
553
- constructor({ id, title, prefersColorScheme, darkMode, visible, width, height, minWidth, minHeight, x, y, minimized, maximized, readonly, resizable, draggable, fence, fixRatio, focus, zIndex, namespace, titleBar, content, footer, styles, containerRect, collectorRect, boxStatus, lastNotMinimizedBoxStatus }?: TeleBoxConfig);
574
+ constructor({ id, title, prefersColorScheme, darkMode, visible, width, height, minWidth, minHeight, x, y, minimized, maximized, readonly, resizable, draggable, fence, fixRatio, focus, zIndex, namespace, titleBar, content, footer, styles, containerRect, collectorRect, boxStatus, lastNotMinimizedBoxStatus, forceTop, forceNormal, isDragContent, }?: TeleBoxConfig);
554
575
  readonly id: string;
555
576
  /** ClassName Prefix. For CSS styling. Default "telebox" */
556
577
  readonly namespace: string;
@@ -722,7 +743,7 @@ declare class TeleBoxCollector {
722
743
  * Unmount collector from the root element.
723
744
  */
724
745
  unmount(): this;
725
- private hasMinimizedBox;
746
+ protected hasMinimizedBox(): boolean;
726
747
  updateBoxesStatus(): void;
727
748
  setVisible(visible: boolean): this;
728
749
  setReadonly(readonly: boolean): this;
@@ -765,7 +786,7 @@ interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "prefersColorScheme"
765
786
  /** Whether to use boxes status. */
766
787
  useBoxesStatus?: boolean;
767
788
  }
768
- type TeleBoxManagerBoxConfigBaseProps = "title" | "visible" | "width" | "height" | "minWidth" | "minHeight" | "x" | "y" | "resizable" | "draggable" | "fixRatio" | "zIndex" | "boxStatus" | "lastNotMinimizedBoxStatus";
789
+ type TeleBoxManagerBoxConfigBaseProps = "title" | "visible" | "width" | "height" | "minWidth" | "minHeight" | "x" | "y" | "resizable" | "draggable" | "fixRatio" | "zIndex" | "boxStatus" | "lastNotMinimizedBoxStatus" | "forceTop" | "forceNormal" | "isDragContent";
769
790
  type TeleBoxManagerCreateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "footer" | "id" | "focus">;
770
791
  type TeleBoxManagerQueryConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "id" | "focus">;
771
792
  type TeleBoxManagerUpdateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "footer">;
@@ -803,7 +824,7 @@ interface TeleBoxManagerEvents extends EventEmitter<TeleBoxManagerEvent> {
803
824
  emit<U extends TeleBoxManagerEvent>(event: U, ...value: TeleBoxManagerEventConfig[U]): boolean;
804
825
  }
805
826
 
806
- type MaxTitleBarTeleBox = Pick<TeleBox, "id" | "title" | "readonly" | "zIndex" | "$box">;
827
+ type MaxTitleBarTeleBox = Pick<TeleBox, "id" | "title" | "readonly" | "zIndex" | "$box" | "forceTop" | "forceNormal">;
807
828
  interface MaxTitleBarConfig extends DefaultTitleBarConfig {
808
829
  darkMode: boolean;
809
830
  boxes: MaxTitleBarTeleBox[];
@@ -885,15 +906,26 @@ type ValConfig = {
885
906
  interface TeleBoxManager extends ValEnhancedResult<ValConfig> {
886
907
  }
887
908
  declare class TeleBoxManager {
888
- private boxesStatus$;
889
- private lastNotMinimizedBoxesStatus$;
890
- private appMenu;
891
- private useBoxesStatus;
892
- private effectBoxesStatusTimer?;
893
- private effectLastNotMinimizedBoxStatusTimer?;
909
+ protected boxesStatus$: Map<string, TeleBoxState>;
910
+ protected lastNotMinimizedBoxesStatus$: Map<string, NotMinimizedBoxState>;
911
+ protected appMenu: AppMenu | undefined;
912
+ protected useBoxesStatus: boolean;
913
+ protected effectBoxesStatusTimer?: {
914
+ skipUpdate: boolean;
915
+ timer: number | undefined;
916
+ resolve?: (skipUpdate: boolean) => void;
917
+ };
918
+ protected effectLastNotMinimizedBoxStatusTimer?: {
919
+ skipUpdate: boolean;
920
+ timer: number | undefined;
921
+ resolve?: (skipUpdate: boolean) => void;
922
+ };
894
923
  constructor({ root, prefersColorScheme, minimized, maximized, fence, containerRect, collector, namespace, readonly, useBoxesStatus, }?: TeleBoxManagerConfig);
895
924
  get boxes(): ReadonlyArray<TeleBox>;
896
925
  get topBox(): TeleBox | undefined;
926
+ get forceTopBoxes(): TeleBox | undefined;
927
+ get maxForceTopBox(): TeleBox | undefined;
928
+ get forceNormalBoxes(): TeleBox | undefined;
897
929
  readonly events: TeleBoxManagerEvents;
898
930
  protected _sideEffect: SideEffectManager;
899
931
  protected root: HTMLElement;
@@ -912,8 +944,8 @@ declare class TeleBoxManager {
912
944
  get lastNotMinimizedBoxesStatus(): ReadonlyMap<string, NotMinimizedBoxState>;
913
945
  setBoxesStatus(boxesStatus: Map<string, TeleBoxState>, skipUpdate?: boolean): void;
914
946
  getBoxesStatus(): Map<string, TeleBoxState>;
915
- private effectBoxStatusChange;
916
- private effectBoxesStatusTimerFunc;
947
+ protected effectBoxStatusChange(): void;
948
+ protected effectBoxesStatusTimerFunc(skipUpdate: boolean): void;
917
949
  effectBoxesStatusChange(skipUpdate?: boolean): Promise<void>;
918
950
  hasBoxesStatus(): boolean;
919
951
  hasMinimizedBox(): boolean;
@@ -924,13 +956,16 @@ declare class TeleBoxManager {
924
956
  getLastNotMinimizedBoxStatus(boxId: string): NotMinimizedBoxState | undefined;
925
957
  setLastNotMinimizedBoxStatus(boxId: string, lastNotMinimizedBoxStatus?: NotMinimizedBoxState, skipUpdate?: boolean): void;
926
958
  setLastNotMinimizedBoxesStatus(lastNotMinimizedBoxesStatus: Map<string, NotMinimizedBoxState>, skipUpdate?: boolean): void;
927
- private effectLastNotMinimizedBoxStatusChange;
928
- private effectLastNotMinimizedBoxStatusFunc;
929
- private getUnabledBoxesStatusZIndex;
959
+ protected effectLastNotMinimizedBoxStatusChange(skipUpdate?: boolean): Promise<void>;
960
+ protected effectLastNotMinimizedBoxStatusFunc(skipUpdate?: boolean): void;
961
+ protected getUnabledBoxesStatusZIndex(): number;
930
962
  /** Maximized box zIndex range: 100-299 */
931
963
  getMaxMaximizedBoxZIndex(): number;
932
964
  /** normal box zIndex range: 300-499 */
933
965
  getMaxNormalBoxZIndex(): number;
966
+ getMaxForceTopBoxZIndex(): number;
967
+ isForceNormal(box: TeleBox): boolean;
968
+ isForceTop(box: TeleBox): boolean;
934
969
  create(config?: TeleBoxManagerCreateConfig, smartPosition?: boolean): ReadonlyTeleBox;
935
970
  query(config?: TeleBoxManagerQueryConfig): ReadonlyTeleBox[];
936
971
  queryOne(config?: TeleBoxManagerQueryConfig): ReadonlyTeleBox | undefined;
@@ -957,7 +992,7 @@ declare class TeleBoxManager {
957
992
  protected updateBox(box: TeleBox, config: TeleBoxManagerUpdateConfig, skipUpdate?: boolean): void;
958
993
  protected smartPosition(config?: TeleBoxConfig): TeleBoxConfig;
959
994
  protected makeBoxTop(box: TeleBox, skipUpdate?: boolean): void;
960
- private getMaximizedTopBox;
995
+ protected getMaximizedTopBox(): MaxTitleBarTeleBox | undefined;
961
996
  protected makeMaximizedTopBoxFocus(): void;
962
997
  protected getBoxIndex(boxOrID: TeleBox | string): number;
963
998
  getBox(boxOrID: TeleBox | string): TeleBox | undefined;
@@ -1185,6 +1185,8 @@ var TELE_BOX_EVENT = /* @__PURE__ */ ((TELE_BOX_EVENT2) => {
1185
1185
  TELE_BOX_EVENT2["Destroyed"] = "destroyed";
1186
1186
  TELE_BOX_EVENT2["BoxStatus"] = "box_status";
1187
1187
  TELE_BOX_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
1188
+ TELE_BOX_EVENT2["ForceTop"] = "force_top";
1189
+ TELE_BOX_EVENT2["ForceNormal"] = "force_normal";
1188
1190
  return TELE_BOX_EVENT2;
1189
1191
  })(TELE_BOX_EVENT || {});
1190
1192
  var TELE_BOX_DELEGATE_EVENT = /* @__PURE__ */ ((TELE_BOX_DELEGATE_EVENT2) => {
@@ -1239,7 +1241,9 @@ class DefaultTitleBar {
1239
1241
  onDragStart,
1240
1242
  namespace = "telebox",
1241
1243
  state = TELE_BOX_STATE.Normal,
1242
- boxStatus
1244
+ boxStatus,
1245
+ forceTop = false,
1246
+ forceNormal = false
1243
1247
  } = {}) {
1244
1248
  this.$btns = [];
1245
1249
  this.sideEffect = new o();
@@ -1313,7 +1317,14 @@ class DefaultTitleBar {
1313
1317
  this.title = title;
1314
1318
  this.state = state;
1315
1319
  this.boxStatus = boxStatus;
1316
- this.buttons = buttons || [
1320
+ this.forceTop = forceTop;
1321
+ this.forceNormal = forceNormal;
1322
+ this.buttons = buttons || (forceNormal ? [
1323
+ {
1324
+ type: TELE_BOX_DELEGATE_EVENT.Close,
1325
+ iconClassName: this.wrapClassName("titlebar-icon-close")
1326
+ }
1327
+ ] : [
1317
1328
  {
1318
1329
  type: TELE_BOX_DELEGATE_EVENT.Minimize,
1319
1330
  iconClassName: this.wrapClassName("titlebar-icon-minimize")
@@ -1327,7 +1338,7 @@ class DefaultTitleBar {
1327
1338
  type: TELE_BOX_DELEGATE_EVENT.Close,
1328
1339
  iconClassName: this.wrapClassName("titlebar-icon-close")
1329
1340
  }
1330
- ];
1341
+ ]);
1331
1342
  this.$dragArea = this.renderDragArea();
1332
1343
  }
1333
1344
  setTitle(title) {
@@ -1500,7 +1511,10 @@ class TeleBox {
1500
1511
  },
1501
1512
  collectorRect,
1502
1513
  boxStatus,
1503
- lastNotMinimizedBoxStatus
1514
+ lastNotMinimizedBoxStatus,
1515
+ forceTop = false,
1516
+ forceNormal = false,
1517
+ isDragContent = false
1504
1518
  } = {}) {
1505
1519
  this._renderSideEffect = new o();
1506
1520
  this.handleTrackStart = (ev) => {
@@ -1567,6 +1581,19 @@ class TeleBox {
1567
1581
  });
1568
1582
  const containerRect$ = createVal(containerRect, shallowequal);
1569
1583
  const collectorRect$ = createVal(collectorRect, shallowequal);
1584
+ const forceTop$ = createVal(forceTop);
1585
+ forceTop$.reaction((forceTop2, _, skipUpdate) => {
1586
+ if (!skipUpdate) {
1587
+ this.events.emit(TELE_BOX_EVENT.ForceTop, forceTop2 || false);
1588
+ }
1589
+ });
1590
+ const forceNormal$ = createVal(forceNormal);
1591
+ forceNormal$.reaction((forceNormal2, _, skipUpdate) => {
1592
+ if (!skipUpdate) {
1593
+ this.events.emit(TELE_BOX_EVENT.ForceNormal, forceNormal2 || false);
1594
+ }
1595
+ });
1596
+ const isDragContent$ = createVal(isDragContent);
1570
1597
  const title$ = createVal(title);
1571
1598
  title$.reaction((title2, _, skipUpdate) => {
1572
1599
  if (!skipUpdate) {
@@ -1744,6 +1771,8 @@ class TeleBox {
1744
1771
  title: title$.value,
1745
1772
  namespace: this.namespace,
1746
1773
  boxStatus: boxStatus$.value,
1774
+ forceTop: forceTop$.value,
1775
+ forceNormal: forceNormal$.value,
1747
1776
  onDragStart: (event) => {
1748
1777
  var _a;
1749
1778
  return (_a = this._handleTrackStart) == null ? void 0 : _a.call(this, event);
@@ -1807,7 +1836,10 @@ class TeleBox {
1807
1836
  maximized: maximized$,
1808
1837
  $userContent: $userContent$,
1809
1838
  $userFooter: $userFooter$,
1810
- $userStyles: $userStyles$
1839
+ $userStyles: $userStyles$,
1840
+ forceTop: forceTop$,
1841
+ forceNormal: forceNormal$,
1842
+ isDragContent: isDragContent$
1811
1843
  };
1812
1844
  i(this, valConfig);
1813
1845
  this._state$ = state$;
@@ -2144,6 +2176,9 @@ class TeleBox {
2144
2176
  const $content = document.createElement("div");
2145
2177
  $content.className = this.wrapClassName("content") + " tele-fancy-scrollbar";
2146
2178
  this.$content = $content;
2179
+ if (this.isDragContent) {
2180
+ this.$content.appendChild(this.titleBar.$dragArea);
2181
+ }
2147
2182
  this._renderSideEffect.add(() => {
2148
2183
  let last$userStyles;
2149
2184
  return this._$userStyles$.subscribe(($userStyles) => {
@@ -2621,7 +2656,7 @@ class MaxTitleBar extends DefaultTitleBar {
2621
2656
  if (this.getBoxesStatus) {
2622
2657
  const boxesStatus = this.getBoxesStatus();
2623
2658
  if (boxesStatus) {
2624
- return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized);
2659
+ return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized && !box.forceTop);
2625
2660
  }
2626
2661
  }
2627
2662
  return [];
@@ -2963,6 +2998,9 @@ class TeleBoxManager {
2963
2998
  if (boxes.length > 0) {
2964
2999
  let currentTopBox = void 0;
2965
3000
  const topBox = boxes.reduce((topBox2, box) => {
3001
+ if (box.forceTop) {
3002
+ return topBox2;
3003
+ }
2966
3004
  if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized) {
2967
3005
  return topBox2;
2968
3006
  }
@@ -3313,6 +3351,21 @@ class TeleBoxManager {
3313
3351
  get topBox() {
3314
3352
  return this.topBox$.value;
3315
3353
  }
3354
+ get forceTopBoxes() {
3355
+ return this.boxes.find((box) => box.forceTop);
3356
+ }
3357
+ get maxForceTopBox() {
3358
+ return this.boxes.reduce((maxTopBox, box) => {
3359
+ var _a;
3360
+ if (box.forceTop && box.zIndex > ((_a = maxTopBox == null ? void 0 : maxTopBox.zIndex) != null ? _a : 0)) {
3361
+ return box;
3362
+ }
3363
+ return maxTopBox;
3364
+ });
3365
+ }
3366
+ get forceNormalBoxes() {
3367
+ return this.boxes.find((box) => box.forceNormal);
3368
+ }
3316
3369
  get darkMode() {
3317
3370
  return this._darkMode$.value;
3318
3371
  }
@@ -3399,7 +3452,7 @@ class TeleBoxManager {
3399
3452
  var _a;
3400
3453
  const boxStatus = this.boxesStatus$.get(box.id);
3401
3454
  if (boxStatus) {
3402
- if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
3455
+ if (boxStatus !== TELE_BOX_STATE.Minimized && !this.isForceTop(box) && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
3403
3456
  newTopBox = box;
3404
3457
  }
3405
3458
  box.setBoxStatus(boxStatus, skipUpdate);
@@ -3583,7 +3636,7 @@ class TeleBoxManager {
3583
3636
  return this.getUnabledBoxesStatusZIndex();
3584
3637
  }
3585
3638
  return this.boxes.reduce((maxZIndex, box) => {
3586
- if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
3639
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized && !this.isForceTop(box)) {
3587
3640
  return Math.max(maxZIndex, box.zIndex);
3588
3641
  }
3589
3642
  return maxZIndex;
@@ -3594,15 +3647,32 @@ class TeleBoxManager {
3594
3647
  return this.getUnabledBoxesStatusZIndex();
3595
3648
  }
3596
3649
  return this.boxes.reduce((maxZIndex, box) => {
3597
- if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
3650
+ if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal && !this.isForceTop(box)) {
3598
3651
  return Math.max(maxZIndex, box.zIndex);
3599
3652
  }
3600
3653
  return maxZIndex;
3601
3654
  }, 299);
3602
3655
  }
3656
+ getMaxForceTopBoxZIndex() {
3657
+ if (!this.useBoxesStatus) {
3658
+ return this.getUnabledBoxesStatusZIndex();
3659
+ }
3660
+ return this.boxes.reduce((maxZIndex, box) => {
3661
+ if (box.boxStatus && this.isForceTop(box)) {
3662
+ return Math.max(maxZIndex, box.zIndex);
3663
+ }
3664
+ return maxZIndex;
3665
+ }, 699);
3666
+ }
3667
+ isForceNormal(box) {
3668
+ return box._forceNormal$.value;
3669
+ }
3670
+ isForceTop(box) {
3671
+ return box._forceTop$.value;
3672
+ }
3603
3673
  create(config = {}, smartPosition = true) {
3604
3674
  const box = new TeleBox({
3605
- zIndex: this.getMaxNormalBoxZIndex() + 1,
3675
+ zIndex: config.forceTop ? this.getMaxForceTopBoxZIndex() + 1 : this.getMaxNormalBoxZIndex() + 1,
3606
3676
  ...smartPosition ? this.smartPosition(config) : config,
3607
3677
  darkMode: this.darkMode,
3608
3678
  prefersColorScheme: this.prefersColorScheme,
@@ -3630,13 +3700,16 @@ class TeleBoxManager {
3630
3700
  }
3631
3701
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
3632
3702
  if (this.useBoxesStatus && box.boxStatus) {
3703
+ if (box._forceNormal$.value) {
3704
+ return;
3705
+ }
3633
3706
  if (box.boxStatus === TELE_BOX_STATE.Maximized) {
3634
3707
  this.setBox(box.id, {
3635
3708
  status: TELE_BOX_STATE.Normal,
3636
3709
  zIndex: this.getMaxNormalBoxZIndex() + 1
3637
3710
  }, false);
3638
3711
  } else {
3639
- [...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
3712
+ [...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal && !this.isForceNormal(box2)).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
3640
3713
  if (box2.boxStatus === TELE_BOX_STATE.Normal) {
3641
3714
  this.setBox(box2.id, {
3642
3715
  status: TELE_BOX_STATE.Maximized,
@@ -3652,6 +3725,9 @@ class TeleBoxManager {
3652
3725
  });
3653
3726
  box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
3654
3727
  if (box.boxStatus && this.useBoxesStatus) {
3728
+ if (box._forceNormal$.value) {
3729
+ return;
3730
+ }
3655
3731
  if (box.focus) {
3656
3732
  this.blurBox(box);
3657
3733
  }
@@ -3701,6 +3777,9 @@ class TeleBoxManager {
3701
3777
  if (this.boxes.length > 0) {
3702
3778
  let currentTopBox = void 0;
3703
3779
  const topBox = this.boxes.reduce((topBox2, box2) => {
3780
+ if (this.isForceTop(box2)) {
3781
+ return topBox2;
3782
+ }
3704
3783
  if (box2.boxStatus && box2.boxStatus === TELE_BOX_STATE.Minimized) {
3705
3784
  return topBox2;
3706
3785
  }
@@ -3930,13 +4009,27 @@ class TeleBoxManager {
3930
4009
  lastNotMinimizedBoxStatus: config.lastNotMinimizedBoxStatus
3931
4010
  }, skipUpdate);
3932
4011
  }
4012
+ if (config.forceTop != null) {
4013
+ box.setForceTop(config.forceTop, skipUpdate);
4014
+ }
4015
+ if (config.forceNormal != null) {
4016
+ box.setForceNormal(config.forceNormal, skipUpdate);
4017
+ }
3933
4018
  }
3934
4019
  smartPosition(config = {}) {
3935
4020
  let { x, y } = config;
3936
4021
  const { width = 0.5, height = 0.5 } = config;
3937
4022
  if (x == null) {
3938
4023
  let vx = 20;
3939
- if (this.topBox) {
4024
+ if (config.forceTop) {
4025
+ const forceTopBox = this.maxForceTopBox || this.topBox;
4026
+ if (forceTopBox) {
4027
+ vx = forceTopBox.intrinsicX * this.containerRect.width + 20;
4028
+ if (vx > this.containerRect.width - width * this.containerRect.width) {
4029
+ vx = 20;
4030
+ }
4031
+ }
4032
+ } else if (this.topBox) {
3940
4033
  vx = this.topBox.intrinsicX * this.containerRect.width + 20;
3941
4034
  if (vx > this.containerRect.width - width * this.containerRect.width) {
3942
4035
  vx = 20;
@@ -3950,7 +4043,15 @@ class TeleBoxManager {
3950
4043
  }
3951
4044
  if (y == null) {
3952
4045
  let vy = 20;
3953
- if (this.topBox) {
4046
+ if (config.forceTop) {
4047
+ const forceTopBox = this.maxForceTopBox || this.topBox;
4048
+ if (forceTopBox) {
4049
+ vy = forceTopBox.intrinsicY * this.containerRect.height + 20;
4050
+ if (vy > this.containerRect.height - height * this.containerRect.height) {
4051
+ vy = 20;
4052
+ }
4053
+ }
4054
+ } else if (this.topBox) {
3954
4055
  vy = this.topBox.intrinsicY * this.containerRect.height + 20;
3955
4056
  if (vy > this.containerRect.height - height * this.containerRect.height) {
3956
4057
  vy = 20;