@netless/telebox-insider 0.2.11 → 0.2.15
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/TeleBoxManager/index.d.ts +1 -2
- package/dist/TeleBoxManager/typings.d.ts +1 -1
- package/dist/telebox-insider.cjs.js +1 -1
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +1 -1
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +1 -1
- package/src/TeleBoxManager/index.ts +15 -18
- package/src/TeleBoxManager/typings.ts +0 -1
package/package.json
CHANGED
|
@@ -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,
|
|
@@ -477,18 +473,18 @@ export class TeleBoxManager {
|
|
|
477
473
|
const index = this.getBoxIndex(boxOrID);
|
|
478
474
|
if (index >= 0) {
|
|
479
475
|
const boxes = this.boxes.slice();
|
|
480
|
-
const
|
|
476
|
+
const deletedBoxes = boxes.splice(index, 1);
|
|
481
477
|
this.boxes$.setValue(boxes);
|
|
482
478
|
this.focusTopBox();
|
|
483
|
-
|
|
479
|
+
deletedBoxes.forEach((box) => box.destroy());
|
|
484
480
|
if (!skipUpdate) {
|
|
485
481
|
if (this.boxes.length <= 0) {
|
|
486
482
|
this.setMaximized(false);
|
|
487
483
|
this.setMinimized(false);
|
|
488
484
|
}
|
|
489
|
-
this.events.emit(TELE_BOX_MANAGER_EVENT.Removed,
|
|
485
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.Removed, deletedBoxes);
|
|
490
486
|
}
|
|
491
|
-
return
|
|
487
|
+
return deletedBoxes[0];
|
|
492
488
|
}
|
|
493
489
|
return;
|
|
494
490
|
}
|
|
@@ -647,6 +643,9 @@ export class TeleBoxManager {
|
|
|
647
643
|
if (config.fixRatio != null) {
|
|
648
644
|
box.setFixRatio(config.fixRatio, skipUpdate);
|
|
649
645
|
}
|
|
646
|
+
if (config.zIndex != null) {
|
|
647
|
+
box.setZIndex(config.zIndex);
|
|
648
|
+
}
|
|
650
649
|
if (config.content != null) {
|
|
651
650
|
box.mountContent(config.content);
|
|
652
651
|
}
|
|
@@ -696,15 +695,13 @@ export class TeleBoxManager {
|
|
|
696
695
|
}
|
|
697
696
|
|
|
698
697
|
protected makeBoxTop(box: TeleBox, skipUpdate = false): void {
|
|
699
|
-
if (
|
|
700
|
-
|
|
701
|
-
(
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
if (!skipUpdate) {
|
|
707
|
-
this.events.emit(TELE_BOX_MANAGER_EVENT.ZIndex, box);
|
|
698
|
+
if (this.topBox) {
|
|
699
|
+
if (box !== this.topBox) {
|
|
700
|
+
box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
|
|
701
|
+
this.topBox$.setValue(box);
|
|
702
|
+
if (!skipUpdate) {
|
|
703
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.ZIndex, box);
|
|
704
|
+
}
|
|
708
705
|
}
|
|
709
706
|
}
|
|
710
707
|
}
|