@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.
|
@@ -2688,6 +2688,7 @@ class TeleBoxManager {
|
|
|
2688
2688
|
this.setBoxStatus(box.id, TELE_BOX_STATE.Normal);
|
|
2689
2689
|
}
|
|
2690
2690
|
});
|
|
2691
|
+
this.effectBoxStatusChange();
|
|
2691
2692
|
}
|
|
2692
2693
|
minimized$.setValue(false);
|
|
2693
2694
|
}
|
|
@@ -2782,6 +2783,7 @@ class TeleBoxManager {
|
|
|
2782
2783
|
case TELE_BOX_DELEGATE_EVENT.Maximize: {
|
|
2783
2784
|
if (this.hasBoxesStatus() && ((_a = this.maxTitleBar.focusedBox) == null ? void 0 : _a.id)) {
|
|
2784
2785
|
this.setBoxStatus(this.maxTitleBar.focusedBox.id, TELE_BOX_STATE.Normal);
|
|
2786
|
+
this.effectBoxStatusChange();
|
|
2785
2787
|
this.makeMaximizedTopBoxFocus();
|
|
2786
2788
|
} else {
|
|
2787
2789
|
maximized$.setValue(!maximized$.value);
|
|
@@ -2791,6 +2793,7 @@ class TeleBoxManager {
|
|
|
2791
2793
|
case TELE_BOX_DELEGATE_EVENT.Minimize: {
|
|
2792
2794
|
if (this.hasBoxesStatus() && ((_b = this.maxTitleBar.focusedBox) == null ? void 0 : _b.id)) {
|
|
2793
2795
|
this.setBoxStatus(this.maxTitleBar.focusedBox.id, TELE_BOX_STATE.Minimized);
|
|
2796
|
+
this.effectBoxStatusChange();
|
|
2794
2797
|
this.makeMaximizedTopBoxFocus();
|
|
2795
2798
|
} else {
|
|
2796
2799
|
minimized$.setValue(true);
|
|
@@ -2864,33 +2867,49 @@ class TeleBoxManager {
|
|
|
2864
2867
|
return this;
|
|
2865
2868
|
}
|
|
2866
2869
|
setBoxStatus(boxId, boxStatus, skipUpdate = false) {
|
|
2867
|
-
const boxesStatus = this.boxesStatus$;
|
|
2868
2870
|
if (boxStatus) {
|
|
2869
|
-
const oldBoxStatus = boxesStatus
|
|
2870
|
-
boxesStatus
|
|
2871
|
+
const oldBoxStatus = this.boxesStatus$.get(boxId);
|
|
2872
|
+
this.boxesStatus$.set(boxId, boxStatus);
|
|
2871
2873
|
if (boxStatus === TELE_BOX_STATE.Minimized && oldBoxStatus !== TELE_BOX_STATE.Minimized) {
|
|
2872
2874
|
this.setLastNotMinimizedBoxStatus(boxId, oldBoxStatus, skipUpdate);
|
|
2875
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
2873
2876
|
} else if (oldBoxStatus === TELE_BOX_STATE.Minimized && boxStatus !== TELE_BOX_STATE.Minimized) {
|
|
2874
2877
|
this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
|
|
2878
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
2875
2879
|
}
|
|
2876
2880
|
} else {
|
|
2877
|
-
boxesStatus
|
|
2881
|
+
this.boxesStatus$.delete(boxId);
|
|
2878
2882
|
this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
|
|
2883
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
2879
2884
|
}
|
|
2880
|
-
this.setBoxesStatus(boxesStatus, skipUpdate);
|
|
2881
2885
|
if (!skipUpdate) {
|
|
2882
2886
|
this.events.emit(TELE_BOX_MANAGER_EVENT.BoxStatus, { id: boxId, boxStatus });
|
|
2883
2887
|
}
|
|
2884
2888
|
}
|
|
2889
|
+
getBoxStatus(boxId) {
|
|
2890
|
+
return this.boxesStatus$.get(boxId);
|
|
2891
|
+
}
|
|
2892
|
+
getLastNotMinimizedBoxStatus(boxId) {
|
|
2893
|
+
return this.lastNotMinimizedBoxesStatus$.get(boxId);
|
|
2894
|
+
}
|
|
2895
|
+
get boxesStatus() {
|
|
2896
|
+
return this.boxesStatus$;
|
|
2897
|
+
}
|
|
2898
|
+
get lastNotMinimizedBoxesStatus() {
|
|
2899
|
+
return this.lastNotMinimizedBoxesStatus$;
|
|
2900
|
+
}
|
|
2885
2901
|
setBoxesStatus(boxesStatus, skipUpdate = false) {
|
|
2886
|
-
var _a, _b, _c, _d;
|
|
2887
2902
|
this.boxesStatus$ = boxesStatus;
|
|
2903
|
+
this.effectBoxStatusChange(skipUpdate);
|
|
2904
|
+
}
|
|
2905
|
+
effectBoxStatusChange(skipUpdate = false) {
|
|
2906
|
+
var _a, _b, _c, _d;
|
|
2888
2907
|
let topBox;
|
|
2889
2908
|
const topBoxId = (_a = this.topBox) == null ? void 0 : _a.id;
|
|
2890
2909
|
let hasMinimizedBox = false;
|
|
2891
2910
|
this.boxes.forEach((box) => {
|
|
2892
2911
|
var _a2;
|
|
2893
|
-
const boxStatus = boxesStatus
|
|
2912
|
+
const boxStatus = this.boxesStatus$.get(box.id);
|
|
2894
2913
|
if (boxStatus) {
|
|
2895
2914
|
if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((_a2 = topBox == null ? void 0 : topBox.zIndex) != null ? _a2 : 0)) {
|
|
2896
2915
|
topBox = box;
|
|
@@ -2925,24 +2944,23 @@ class TeleBoxManager {
|
|
|
2925
2944
|
return this.boxes.some((box) => box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized);
|
|
2926
2945
|
}
|
|
2927
2946
|
setLastNotMinimizedBoxStatus(boxId, lastNotMinimizedBoxStatus, skipUpdate = false) {
|
|
2928
|
-
const boxesStatus = this.lastNotMinimizedBoxesStatus$;
|
|
2929
2947
|
if (lastNotMinimizedBoxStatus) {
|
|
2930
|
-
|
|
2948
|
+
this.lastNotMinimizedBoxesStatus$.set(boxId, lastNotMinimizedBoxStatus);
|
|
2931
2949
|
} else {
|
|
2932
|
-
|
|
2950
|
+
this.lastNotMinimizedBoxesStatus$.delete(boxId);
|
|
2933
2951
|
}
|
|
2934
|
-
this.setLastNotMinimizedBoxesStatus(boxesStatus, skipUpdate);
|
|
2935
2952
|
if (!skipUpdate) {
|
|
2936
2953
|
this.events.emit(TELE_BOX_MANAGER_EVENT.LastNotMinimizedBoxStatus, { id: boxId, boxStatus: lastNotMinimizedBoxStatus });
|
|
2937
2954
|
}
|
|
2938
2955
|
}
|
|
2939
2956
|
setLastNotMinimizedBoxesStatus(lastNotMinimizedBoxesStatus, skipUpdate = false) {
|
|
2940
2957
|
this.lastNotMinimizedBoxesStatus$ = lastNotMinimizedBoxesStatus;
|
|
2958
|
+
this.effectLastNotMinimizedBoxStatusChange(skipUpdate);
|
|
2959
|
+
}
|
|
2960
|
+
effectLastNotMinimizedBoxStatusChange(skipUpdate = false) {
|
|
2941
2961
|
this.boxes.forEach((box) => {
|
|
2942
|
-
const boxStatus = lastNotMinimizedBoxesStatus
|
|
2943
|
-
|
|
2944
|
-
box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
|
|
2945
|
-
}
|
|
2962
|
+
const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
|
|
2963
|
+
box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
|
|
2946
2964
|
});
|
|
2947
2965
|
}
|
|
2948
2966
|
getAllMinimizedBoxes() {
|
|
@@ -2972,9 +2990,11 @@ class TeleBoxManager {
|
|
|
2972
2990
|
this.boxes$.setValue([...this.boxes, box]);
|
|
2973
2991
|
if (box.boxStatus) {
|
|
2974
2992
|
this.setBoxStatus(box.id, box.boxStatus, true);
|
|
2993
|
+
this.effectBoxStatusChange(true);
|
|
2975
2994
|
}
|
|
2976
2995
|
if (box._lastNotMinimizedBoxStatus$.value) {
|
|
2977
2996
|
this.setLastNotMinimizedBoxStatus(box.id, box._lastNotMinimizedBoxStatus$.value, true);
|
|
2997
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
2978
2998
|
}
|
|
2979
2999
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
|
|
2980
3000
|
if (box.boxStatus) {
|
|
@@ -2987,6 +3007,7 @@ class TeleBoxManager {
|
|
|
2987
3007
|
}
|
|
2988
3008
|
});
|
|
2989
3009
|
}
|
|
3010
|
+
this.effectBoxStatusChange();
|
|
2990
3011
|
this.makeMaximizedTopBoxFocus();
|
|
2991
3012
|
} else {
|
|
2992
3013
|
this.setMaximized(!this.maximized);
|
|
@@ -2996,6 +3017,7 @@ class TeleBoxManager {
|
|
|
2996
3017
|
if (box.boxStatus) {
|
|
2997
3018
|
const oldBoxStatus = box.boxStatus;
|
|
2998
3019
|
this.setBoxStatus(box.id, TELE_BOX_STATE.Minimized);
|
|
3020
|
+
this.effectBoxStatusChange();
|
|
2999
3021
|
if (oldBoxStatus === TELE_BOX_STATE.Maximized) {
|
|
3000
3022
|
this.makeMaximizedTopBoxFocus();
|
|
3001
3023
|
}
|
|
@@ -3068,10 +3090,6 @@ class TeleBoxManager {
|
|
|
3068
3090
|
}
|
|
3069
3091
|
remove(boxOrID, skipUpdate = false) {
|
|
3070
3092
|
const box = this.getBox(boxOrID);
|
|
3071
|
-
if (box) {
|
|
3072
|
-
this.setBoxStatus(box.id, void 0, skipUpdate);
|
|
3073
|
-
this.setLastNotMinimizedBoxStatus(box.id, void 0, skipUpdate);
|
|
3074
|
-
}
|
|
3075
3093
|
const index2 = this.getBoxIndex(boxOrID);
|
|
3076
3094
|
if (index2 >= 0) {
|
|
3077
3095
|
const boxes = this.boxes.slice();
|
|
@@ -3079,8 +3097,12 @@ class TeleBoxManager {
|
|
|
3079
3097
|
this.boxes$.setValue(boxes);
|
|
3080
3098
|
deletedBoxes.forEach((box2) => box2.destroy());
|
|
3081
3099
|
if (box) {
|
|
3100
|
+
this.setBoxStatus(box.id, void 0, skipUpdate);
|
|
3082
3101
|
this.boxesStatus$.delete(box.id);
|
|
3102
|
+
this.effectBoxStatusChange(skipUpdate);
|
|
3103
|
+
this.setLastNotMinimizedBoxStatus(box.id, void 0, skipUpdate);
|
|
3083
3104
|
this.lastNotMinimizedBoxesStatus$.delete(box.id);
|
|
3105
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
3084
3106
|
}
|
|
3085
3107
|
if (!skipUpdate) {
|
|
3086
3108
|
if (this.boxes.length <= 0) {
|
|
@@ -3236,9 +3258,11 @@ class TeleBoxManager {
|
|
|
3236
3258
|
}
|
|
3237
3259
|
if (config.boxStatus) {
|
|
3238
3260
|
this.setBoxStatus(box.id, config.boxStatus, skipUpdate);
|
|
3261
|
+
this.effectBoxStatusChange(skipUpdate);
|
|
3239
3262
|
}
|
|
3240
3263
|
if (config.lastNotMinimizedBoxStatus) {
|
|
3241
3264
|
this.setLastNotMinimizedBoxStatus(box.id, config.lastNotMinimizedBoxStatus, skipUpdate);
|
|
3265
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
3242
3266
|
}
|
|
3243
3267
|
}
|
|
3244
3268
|
smartPosition(config = {}) {
|