@netless/telebox-insider 0.3.0-beta.3 → 0.3.0-beta.4
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
|
@@ -201,6 +201,7 @@ export class TeleBoxManager {
|
|
|
201
201
|
this.setBoxStatus(box.id, TELE_BOX_STATE.Normal);
|
|
202
202
|
}
|
|
203
203
|
});
|
|
204
|
+
this.effectBoxStatusChange();
|
|
204
205
|
}
|
|
205
206
|
minimized$.setValue(false);
|
|
206
207
|
}
|
|
@@ -323,6 +324,7 @@ export class TeleBoxManager {
|
|
|
323
324
|
case TELE_BOX_DELEGATE_EVENT.Maximize: {
|
|
324
325
|
if (this.hasBoxesStatus() && this.maxTitleBar.focusedBox?.id) {
|
|
325
326
|
this.setBoxStatus(this.maxTitleBar.focusedBox.id, TELE_BOX_STATE.Normal);
|
|
327
|
+
this.effectBoxStatusChange();
|
|
326
328
|
this.makeMaximizedTopBoxFocus();
|
|
327
329
|
} else {
|
|
328
330
|
maximized$.setValue(!maximized$.value);
|
|
@@ -332,6 +334,7 @@ export class TeleBoxManager {
|
|
|
332
334
|
case TELE_BOX_DELEGATE_EVENT.Minimize: {
|
|
333
335
|
if (this.hasBoxesStatus() && this.maxTitleBar.focusedBox?.id) {
|
|
334
336
|
this.setBoxStatus(this.maxTitleBar.focusedBox.id, TELE_BOX_STATE.Minimized);
|
|
337
|
+
this.effectBoxStatusChange();
|
|
335
338
|
this.makeMaximizedTopBoxFocus();
|
|
336
339
|
} else {
|
|
337
340
|
minimized$.setValue(true);
|
|
@@ -435,32 +438,53 @@ export class TeleBoxManager {
|
|
|
435
438
|
}
|
|
436
439
|
|
|
437
440
|
public setBoxStatus(boxId: string, boxStatus?: TeleBoxState, skipUpdate = false): void {
|
|
438
|
-
const boxesStatus = this.boxesStatus$;
|
|
439
441
|
if (boxStatus) {
|
|
440
|
-
const oldBoxStatus = boxesStatus
|
|
441
|
-
boxesStatus
|
|
442
|
+
const oldBoxStatus = this.boxesStatus$.get(boxId);
|
|
443
|
+
this.boxesStatus$.set(boxId, boxStatus);
|
|
442
444
|
if (boxStatus === TELE_BOX_STATE.Minimized && oldBoxStatus !== TELE_BOX_STATE.Minimized) {
|
|
443
445
|
this.setLastNotMinimizedBoxStatus(boxId, oldBoxStatus, skipUpdate);
|
|
446
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
444
447
|
} else if (oldBoxStatus === TELE_BOX_STATE.Minimized && boxStatus !== TELE_BOX_STATE.Minimized) {
|
|
445
448
|
this.setLastNotMinimizedBoxStatus(boxId, undefined, skipUpdate);
|
|
449
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
446
450
|
}
|
|
447
451
|
} else {
|
|
448
|
-
boxesStatus
|
|
452
|
+
this.boxesStatus$.delete(boxId);
|
|
449
453
|
this.setLastNotMinimizedBoxStatus(boxId, undefined, skipUpdate);
|
|
454
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
450
455
|
}
|
|
451
|
-
this.setBoxesStatus(boxesStatus, skipUpdate);
|
|
452
456
|
if (!skipUpdate) {
|
|
453
457
|
this.events.emit(TELE_BOX_MANAGER_EVENT.BoxStatus, { id: boxId, boxStatus});
|
|
454
458
|
}
|
|
455
459
|
}
|
|
456
460
|
|
|
461
|
+
public getBoxStatus(boxId: string): TeleBoxState | undefined {
|
|
462
|
+
return this.boxesStatus$.get(boxId);
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
public getLastNotMinimizedBoxStatus(boxId: string): NotMinimizedBoxState | undefined {
|
|
466
|
+
return this.lastNotMinimizedBoxesStatus$.get(boxId);
|
|
467
|
+
}
|
|
468
|
+
|
|
469
|
+
public get boxesStatus(): ReadonlyMap<string, TeleBoxState> {
|
|
470
|
+
return this.boxesStatus$;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
public get lastNotMinimizedBoxesStatus(): ReadonlyMap<string, NotMinimizedBoxState> {
|
|
474
|
+
return this.lastNotMinimizedBoxesStatus$;
|
|
475
|
+
}
|
|
476
|
+
|
|
457
477
|
public setBoxesStatus(boxesStatus: Map<string, TeleBoxState>, skipUpdate = false): void {
|
|
458
478
|
this.boxesStatus$ = boxesStatus;
|
|
479
|
+
this.effectBoxStatusChange(skipUpdate);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
private effectBoxStatusChange(skipUpdate = false){
|
|
459
483
|
let topBox:TeleBox | undefined;
|
|
460
484
|
const topBoxId = this.topBox?.id;
|
|
461
485
|
let hasMinimizedBox = false;
|
|
462
486
|
this.boxes.forEach((box) => {
|
|
463
|
-
const boxStatus = boxesStatus
|
|
487
|
+
const boxStatus = this.boxesStatus$.get(box.id);
|
|
464
488
|
if (boxStatus) {
|
|
465
489
|
if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > (topBox?.zIndex ?? 0)) {
|
|
466
490
|
topBox = box;
|
|
@@ -500,13 +524,11 @@ export class TeleBoxManager {
|
|
|
500
524
|
}
|
|
501
525
|
|
|
502
526
|
public setLastNotMinimizedBoxStatus(boxId: string, lastNotMinimizedBoxStatus?: NotMinimizedBoxState, skipUpdate = false): void {
|
|
503
|
-
const boxesStatus = this.lastNotMinimizedBoxesStatus$;
|
|
504
527
|
if (lastNotMinimizedBoxStatus) {
|
|
505
|
-
|
|
528
|
+
this.lastNotMinimizedBoxesStatus$.set(boxId, lastNotMinimizedBoxStatus);
|
|
506
529
|
} else {
|
|
507
|
-
|
|
530
|
+
this.lastNotMinimizedBoxesStatus$.delete(boxId);
|
|
508
531
|
}
|
|
509
|
-
this.setLastNotMinimizedBoxesStatus(boxesStatus, skipUpdate);
|
|
510
532
|
if (!skipUpdate) {
|
|
511
533
|
this.events.emit(TELE_BOX_MANAGER_EVENT.LastNotMinimizedBoxStatus, { id: boxId, boxStatus:lastNotMinimizedBoxStatus});
|
|
512
534
|
}
|
|
@@ -514,11 +536,13 @@ export class TeleBoxManager {
|
|
|
514
536
|
|
|
515
537
|
public setLastNotMinimizedBoxesStatus(lastNotMinimizedBoxesStatus: Map<string, NotMinimizedBoxState>, skipUpdate = false): void {
|
|
516
538
|
this.lastNotMinimizedBoxesStatus$ = lastNotMinimizedBoxesStatus;
|
|
539
|
+
this.effectLastNotMinimizedBoxStatusChange(skipUpdate);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
private effectLastNotMinimizedBoxStatusChange(skipUpdate = false){
|
|
517
543
|
this.boxes.forEach((box) => {
|
|
518
|
-
const boxStatus = lastNotMinimizedBoxesStatus
|
|
519
|
-
|
|
520
|
-
box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
|
|
521
|
-
}
|
|
544
|
+
const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
|
|
545
|
+
box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
|
|
522
546
|
});
|
|
523
547
|
}
|
|
524
548
|
|
|
@@ -557,10 +581,12 @@ export class TeleBoxManager {
|
|
|
557
581
|
|
|
558
582
|
if (box.boxStatus) {
|
|
559
583
|
this.setBoxStatus(box.id, box.boxStatus, true);
|
|
584
|
+
this.effectBoxStatusChange(true);
|
|
560
585
|
}
|
|
561
586
|
|
|
562
587
|
if (box._lastNotMinimizedBoxStatus$.value) {
|
|
563
588
|
this.setLastNotMinimizedBoxStatus(box.id, box._lastNotMinimizedBoxStatus$.value, true);
|
|
589
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
564
590
|
}
|
|
565
591
|
|
|
566
592
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
|
|
@@ -574,6 +600,7 @@ export class TeleBoxManager {
|
|
|
574
600
|
}
|
|
575
601
|
});
|
|
576
602
|
}
|
|
603
|
+
this.effectBoxStatusChange();
|
|
577
604
|
this.makeMaximizedTopBoxFocus();
|
|
578
605
|
} else {
|
|
579
606
|
this.setMaximized(!this.maximized);
|
|
@@ -584,6 +611,7 @@ export class TeleBoxManager {
|
|
|
584
611
|
if (box.boxStatus) {
|
|
585
612
|
const oldBoxStatus = box.boxStatus;
|
|
586
613
|
this.setBoxStatus(box.id, TELE_BOX_STATE.Minimized);
|
|
614
|
+
this.effectBoxStatusChange();
|
|
587
615
|
if (oldBoxStatus === TELE_BOX_STATE.Maximized) {
|
|
588
616
|
this.makeMaximizedTopBoxFocus();
|
|
589
617
|
}
|
|
@@ -678,10 +706,6 @@ export class TeleBoxManager {
|
|
|
678
706
|
skipUpdate = false
|
|
679
707
|
): ReadonlyTeleBox | undefined {
|
|
680
708
|
const box = this.getBox(boxOrID);
|
|
681
|
-
if (box) {
|
|
682
|
-
this.setBoxStatus(box.id, undefined, skipUpdate);
|
|
683
|
-
this.setLastNotMinimizedBoxStatus(box.id, undefined, skipUpdate);
|
|
684
|
-
}
|
|
685
709
|
const index = this.getBoxIndex(boxOrID);
|
|
686
710
|
if (index >= 0) {
|
|
687
711
|
const boxes = this.boxes.slice();
|
|
@@ -689,8 +713,12 @@ export class TeleBoxManager {
|
|
|
689
713
|
this.boxes$.setValue(boxes);
|
|
690
714
|
deletedBoxes.forEach((box) => box.destroy());
|
|
691
715
|
if (box) {
|
|
716
|
+
this.setBoxStatus(box.id, undefined, skipUpdate);
|
|
692
717
|
this.boxesStatus$.delete(box.id);
|
|
718
|
+
this.effectBoxStatusChange(skipUpdate);
|
|
719
|
+
this.setLastNotMinimizedBoxStatus(box.id, undefined, skipUpdate);
|
|
693
720
|
this.lastNotMinimizedBoxesStatus$.delete(box.id);
|
|
721
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
694
722
|
}
|
|
695
723
|
if (!skipUpdate) {
|
|
696
724
|
if (this.boxes.length <= 0) {
|
|
@@ -882,9 +910,11 @@ export class TeleBoxManager {
|
|
|
882
910
|
}
|
|
883
911
|
if (config.boxStatus) {
|
|
884
912
|
this.setBoxStatus(box.id, config.boxStatus, skipUpdate);
|
|
913
|
+
this.effectBoxStatusChange(skipUpdate);
|
|
885
914
|
}
|
|
886
915
|
if (config.lastNotMinimizedBoxStatus) {
|
|
887
916
|
this.setLastNotMinimizedBoxStatus(box.id, config.lastNotMinimizedBoxStatus, skipUpdate);
|
|
917
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
888
918
|
}
|
|
889
919
|
}
|
|
890
920
|
|