@netless/telebox-insider 0.2.11 → 0.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/telebox-insider",
3
- "version": "0.2.11",
3
+ "version": "0.2.12",
4
4
  "private": false,
5
5
  "description": "Window widget for Whiteboard",
6
6
  "license": "MIT",
@@ -59,7 +59,6 @@ export class TeleBoxManager {
59
59
  },
60
60
  collector,
61
61
  namespace = "telebox",
62
- zIndex = 100,
63
62
  readonly = false,
64
63
  }: TeleBoxManagerConfig = {}) {
65
64
  this._sideEffect = new SideEffectManager();
@@ -67,7 +66,6 @@ export class TeleBoxManager {
67
66
 
68
67
  this.root = root;
69
68
  this.namespace = namespace;
70
- this.zIndex = zIndex;
71
69
 
72
70
  this.boxes$ = createVal<TeleBox[]>([]);
73
71
  this.topBox$ = this.boxes$.derive((boxes) => {
@@ -346,8 +344,6 @@ export class TeleBoxManager {
346
344
 
347
345
  public readonly namespace: string;
348
346
 
349
- public zIndex: number;
350
-
351
347
  public _darkMode$: Val<boolean, boolean>;
352
348
 
353
349
  public get darkMode(): boolean {
@@ -387,7 +383,7 @@ export class TeleBoxManager {
387
383
  smartPosition = true
388
384
  ): ReadonlyTeleBox {
389
385
  const box = new TeleBox({
390
- zIndex: this.zIndex,
386
+ zIndex: this.topBox ? this.topBox.zIndex + 1 : 100,
391
387
  ...(smartPosition ? this.smartPosition(config) : config),
392
388
  darkMode: this.darkMode,
393
389
  prefersColorScheme: this.prefersColorScheme,
@@ -696,15 +692,13 @@ export class TeleBoxManager {
696
692
  }
697
693
 
698
694
  protected makeBoxTop(box: TeleBox, skipUpdate = false): void {
699
- if (box !== this.topBox) {
700
- const maxIndex = this.boxes.reduce(
701
- (max, box) => Math.max(max, box.zIndex),
702
- 0
703
- );
704
- box.setZIndex(maxIndex + 1, skipUpdate);
705
- this.topBox$.setValue(box);
706
- if (!skipUpdate) {
707
- this.events.emit(TELE_BOX_MANAGER_EVENT.ZIndex, box);
695
+ if (this.topBox) {
696
+ if (box !== this.topBox) {
697
+ box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
698
+ this.topBox$.setValue(box);
699
+ if (!skipUpdate) {
700
+ this.events.emit(TELE_BOX_MANAGER_EVENT.ZIndex, box);
701
+ }
708
702
  }
709
703
  }
710
704
  }
@@ -14,7 +14,6 @@ export interface TeleBoxManagerConfig
14
14
  | "maximized"
15
15
  | "minimized"
16
16
  | "namespace"
17
- | "zIndex"
18
17
  | "readonly"
19
18
  > {
20
19
  /** Element to mount boxes. */