@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/dist/index.d.ts
CHANGED
|
@@ -861,11 +861,17 @@ declare class TeleBoxManager {
|
|
|
861
861
|
/** @deprecated use setMaximized and setMinimized instead */
|
|
862
862
|
setState(state: TeleBoxState, skipUpdate?: boolean): this;
|
|
863
863
|
setBoxStatus(boxId: string, boxStatus?: TeleBoxState, skipUpdate?: boolean): void;
|
|
864
|
+
getBoxStatus(boxId: string): TeleBoxState | undefined;
|
|
865
|
+
getLastNotMinimizedBoxStatus(boxId: string): NotMinimizedBoxState | undefined;
|
|
866
|
+
get boxesStatus(): ReadonlyMap<string, TeleBoxState>;
|
|
867
|
+
get lastNotMinimizedBoxesStatus(): ReadonlyMap<string, NotMinimizedBoxState>;
|
|
864
868
|
setBoxesStatus(boxesStatus: Map<string, TeleBoxState>, skipUpdate?: boolean): void;
|
|
869
|
+
private effectBoxStatusChange;
|
|
865
870
|
hasBoxesStatus(): boolean;
|
|
866
871
|
hasMinimizedBox(): boolean;
|
|
867
872
|
setLastNotMinimizedBoxStatus(boxId: string, lastNotMinimizedBoxStatus?: NotMinimizedBoxState, skipUpdate?: boolean): void;
|
|
868
873
|
setLastNotMinimizedBoxesStatus(lastNotMinimizedBoxesStatus: Map<string, NotMinimizedBoxState>, skipUpdate?: boolean): void;
|
|
874
|
+
private effectLastNotMinimizedBoxStatusChange;
|
|
869
875
|
private getAllMinimizedBoxes;
|
|
870
876
|
create(config?: TeleBoxManagerCreateConfig, smartPosition?: boolean): ReadonlyTeleBox;
|
|
871
877
|
query(config?: TeleBoxManagerQueryConfig): ReadonlyTeleBox[];
|
|
@@ -2691,6 +2691,7 @@ class TeleBoxManager {
|
|
|
2691
2691
|
this.setBoxStatus(box.id, exports.TELE_BOX_STATE.Normal);
|
|
2692
2692
|
}
|
|
2693
2693
|
});
|
|
2694
|
+
this.effectBoxStatusChange();
|
|
2694
2695
|
}
|
|
2695
2696
|
minimized$.setValue(false);
|
|
2696
2697
|
}
|
|
@@ -2785,6 +2786,7 @@ class TeleBoxManager {
|
|
|
2785
2786
|
case exports.TELE_BOX_DELEGATE_EVENT.Maximize: {
|
|
2786
2787
|
if (this.hasBoxesStatus() && ((_a = this.maxTitleBar.focusedBox) == null ? void 0 : _a.id)) {
|
|
2787
2788
|
this.setBoxStatus(this.maxTitleBar.focusedBox.id, exports.TELE_BOX_STATE.Normal);
|
|
2789
|
+
this.effectBoxStatusChange();
|
|
2788
2790
|
this.makeMaximizedTopBoxFocus();
|
|
2789
2791
|
} else {
|
|
2790
2792
|
maximized$.setValue(!maximized$.value);
|
|
@@ -2794,6 +2796,7 @@ class TeleBoxManager {
|
|
|
2794
2796
|
case exports.TELE_BOX_DELEGATE_EVENT.Minimize: {
|
|
2795
2797
|
if (this.hasBoxesStatus() && ((_b = this.maxTitleBar.focusedBox) == null ? void 0 : _b.id)) {
|
|
2796
2798
|
this.setBoxStatus(this.maxTitleBar.focusedBox.id, exports.TELE_BOX_STATE.Minimized);
|
|
2799
|
+
this.effectBoxStatusChange();
|
|
2797
2800
|
this.makeMaximizedTopBoxFocus();
|
|
2798
2801
|
} else {
|
|
2799
2802
|
minimized$.setValue(true);
|
|
@@ -2867,33 +2870,49 @@ class TeleBoxManager {
|
|
|
2867
2870
|
return this;
|
|
2868
2871
|
}
|
|
2869
2872
|
setBoxStatus(boxId, boxStatus, skipUpdate = false) {
|
|
2870
|
-
const boxesStatus = this.boxesStatus$;
|
|
2871
2873
|
if (boxStatus) {
|
|
2872
|
-
const oldBoxStatus = boxesStatus
|
|
2873
|
-
boxesStatus
|
|
2874
|
+
const oldBoxStatus = this.boxesStatus$.get(boxId);
|
|
2875
|
+
this.boxesStatus$.set(boxId, boxStatus);
|
|
2874
2876
|
if (boxStatus === exports.TELE_BOX_STATE.Minimized && oldBoxStatus !== exports.TELE_BOX_STATE.Minimized) {
|
|
2875
2877
|
this.setLastNotMinimizedBoxStatus(boxId, oldBoxStatus, skipUpdate);
|
|
2878
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
2876
2879
|
} else if (oldBoxStatus === exports.TELE_BOX_STATE.Minimized && boxStatus !== exports.TELE_BOX_STATE.Minimized) {
|
|
2877
2880
|
this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
|
|
2881
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
2878
2882
|
}
|
|
2879
2883
|
} else {
|
|
2880
|
-
boxesStatus
|
|
2884
|
+
this.boxesStatus$.delete(boxId);
|
|
2881
2885
|
this.setLastNotMinimizedBoxStatus(boxId, void 0, skipUpdate);
|
|
2886
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
2882
2887
|
}
|
|
2883
|
-
this.setBoxesStatus(boxesStatus, skipUpdate);
|
|
2884
2888
|
if (!skipUpdate) {
|
|
2885
2889
|
this.events.emit(exports.TELE_BOX_MANAGER_EVENT.BoxStatus, { id: boxId, boxStatus });
|
|
2886
2890
|
}
|
|
2887
2891
|
}
|
|
2892
|
+
getBoxStatus(boxId) {
|
|
2893
|
+
return this.boxesStatus$.get(boxId);
|
|
2894
|
+
}
|
|
2895
|
+
getLastNotMinimizedBoxStatus(boxId) {
|
|
2896
|
+
return this.lastNotMinimizedBoxesStatus$.get(boxId);
|
|
2897
|
+
}
|
|
2898
|
+
get boxesStatus() {
|
|
2899
|
+
return this.boxesStatus$;
|
|
2900
|
+
}
|
|
2901
|
+
get lastNotMinimizedBoxesStatus() {
|
|
2902
|
+
return this.lastNotMinimizedBoxesStatus$;
|
|
2903
|
+
}
|
|
2888
2904
|
setBoxesStatus(boxesStatus, skipUpdate = false) {
|
|
2889
|
-
var _a, _b, _c, _d;
|
|
2890
2905
|
this.boxesStatus$ = boxesStatus;
|
|
2906
|
+
this.effectBoxStatusChange(skipUpdate);
|
|
2907
|
+
}
|
|
2908
|
+
effectBoxStatusChange(skipUpdate = false) {
|
|
2909
|
+
var _a, _b, _c, _d;
|
|
2891
2910
|
let topBox;
|
|
2892
2911
|
const topBoxId = (_a = this.topBox) == null ? void 0 : _a.id;
|
|
2893
2912
|
let hasMinimizedBox = false;
|
|
2894
2913
|
this.boxes.forEach((box) => {
|
|
2895
2914
|
var _a2;
|
|
2896
|
-
const boxStatus = boxesStatus
|
|
2915
|
+
const boxStatus = this.boxesStatus$.get(box.id);
|
|
2897
2916
|
if (boxStatus) {
|
|
2898
2917
|
if (boxStatus !== exports.TELE_BOX_STATE.Minimized && box.zIndex > ((_a2 = topBox == null ? void 0 : topBox.zIndex) != null ? _a2 : 0)) {
|
|
2899
2918
|
topBox = box;
|
|
@@ -2928,24 +2947,23 @@ class TeleBoxManager {
|
|
|
2928
2947
|
return this.boxes.some((box) => box.boxStatus && box.boxStatus === exports.TELE_BOX_STATE.Minimized);
|
|
2929
2948
|
}
|
|
2930
2949
|
setLastNotMinimizedBoxStatus(boxId, lastNotMinimizedBoxStatus, skipUpdate = false) {
|
|
2931
|
-
const boxesStatus = this.lastNotMinimizedBoxesStatus$;
|
|
2932
2950
|
if (lastNotMinimizedBoxStatus) {
|
|
2933
|
-
|
|
2951
|
+
this.lastNotMinimizedBoxesStatus$.set(boxId, lastNotMinimizedBoxStatus);
|
|
2934
2952
|
} else {
|
|
2935
|
-
|
|
2953
|
+
this.lastNotMinimizedBoxesStatus$.delete(boxId);
|
|
2936
2954
|
}
|
|
2937
|
-
this.setLastNotMinimizedBoxesStatus(boxesStatus, skipUpdate);
|
|
2938
2955
|
if (!skipUpdate) {
|
|
2939
2956
|
this.events.emit(exports.TELE_BOX_MANAGER_EVENT.LastNotMinimizedBoxStatus, { id: boxId, boxStatus: lastNotMinimizedBoxStatus });
|
|
2940
2957
|
}
|
|
2941
2958
|
}
|
|
2942
2959
|
setLastNotMinimizedBoxesStatus(lastNotMinimizedBoxesStatus, skipUpdate = false) {
|
|
2943
2960
|
this.lastNotMinimizedBoxesStatus$ = lastNotMinimizedBoxesStatus;
|
|
2961
|
+
this.effectLastNotMinimizedBoxStatusChange(skipUpdate);
|
|
2962
|
+
}
|
|
2963
|
+
effectLastNotMinimizedBoxStatusChange(skipUpdate = false) {
|
|
2944
2964
|
this.boxes.forEach((box) => {
|
|
2945
|
-
const boxStatus = lastNotMinimizedBoxesStatus
|
|
2946
|
-
|
|
2947
|
-
box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
|
|
2948
|
-
}
|
|
2965
|
+
const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
|
|
2966
|
+
box.setLastNotMinimizedBoxStatus(boxStatus, skipUpdate);
|
|
2949
2967
|
});
|
|
2950
2968
|
}
|
|
2951
2969
|
getAllMinimizedBoxes() {
|
|
@@ -2975,9 +2993,11 @@ class TeleBoxManager {
|
|
|
2975
2993
|
this.boxes$.setValue([...this.boxes, box]);
|
|
2976
2994
|
if (box.boxStatus) {
|
|
2977
2995
|
this.setBoxStatus(box.id, box.boxStatus, true);
|
|
2996
|
+
this.effectBoxStatusChange(true);
|
|
2978
2997
|
}
|
|
2979
2998
|
if (box._lastNotMinimizedBoxStatus$.value) {
|
|
2980
2999
|
this.setLastNotMinimizedBoxStatus(box.id, box._lastNotMinimizedBoxStatus$.value, true);
|
|
3000
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
2981
3001
|
}
|
|
2982
3002
|
box._delegateEvents.on(exports.TELE_BOX_DELEGATE_EVENT.Maximize, () => {
|
|
2983
3003
|
if (box.boxStatus) {
|
|
@@ -2990,6 +3010,7 @@ class TeleBoxManager {
|
|
|
2990
3010
|
}
|
|
2991
3011
|
});
|
|
2992
3012
|
}
|
|
3013
|
+
this.effectBoxStatusChange();
|
|
2993
3014
|
this.makeMaximizedTopBoxFocus();
|
|
2994
3015
|
} else {
|
|
2995
3016
|
this.setMaximized(!this.maximized);
|
|
@@ -2999,6 +3020,7 @@ class TeleBoxManager {
|
|
|
2999
3020
|
if (box.boxStatus) {
|
|
3000
3021
|
const oldBoxStatus = box.boxStatus;
|
|
3001
3022
|
this.setBoxStatus(box.id, exports.TELE_BOX_STATE.Minimized);
|
|
3023
|
+
this.effectBoxStatusChange();
|
|
3002
3024
|
if (oldBoxStatus === exports.TELE_BOX_STATE.Maximized) {
|
|
3003
3025
|
this.makeMaximizedTopBoxFocus();
|
|
3004
3026
|
}
|
|
@@ -3071,10 +3093,6 @@ class TeleBoxManager {
|
|
|
3071
3093
|
}
|
|
3072
3094
|
remove(boxOrID, skipUpdate = false) {
|
|
3073
3095
|
const box = this.getBox(boxOrID);
|
|
3074
|
-
if (box) {
|
|
3075
|
-
this.setBoxStatus(box.id, void 0, skipUpdate);
|
|
3076
|
-
this.setLastNotMinimizedBoxStatus(box.id, void 0, skipUpdate);
|
|
3077
|
-
}
|
|
3078
3096
|
const index2 = this.getBoxIndex(boxOrID);
|
|
3079
3097
|
if (index2 >= 0) {
|
|
3080
3098
|
const boxes = this.boxes.slice();
|
|
@@ -3082,8 +3100,12 @@ class TeleBoxManager {
|
|
|
3082
3100
|
this.boxes$.setValue(boxes);
|
|
3083
3101
|
deletedBoxes.forEach((box2) => box2.destroy());
|
|
3084
3102
|
if (box) {
|
|
3103
|
+
this.setBoxStatus(box.id, void 0, skipUpdate);
|
|
3085
3104
|
this.boxesStatus$.delete(box.id);
|
|
3105
|
+
this.effectBoxStatusChange(skipUpdate);
|
|
3106
|
+
this.setLastNotMinimizedBoxStatus(box.id, void 0, skipUpdate);
|
|
3086
3107
|
this.lastNotMinimizedBoxesStatus$.delete(box.id);
|
|
3108
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
3087
3109
|
}
|
|
3088
3110
|
if (!skipUpdate) {
|
|
3089
3111
|
if (this.boxes.length <= 0) {
|
|
@@ -3239,9 +3261,11 @@ class TeleBoxManager {
|
|
|
3239
3261
|
}
|
|
3240
3262
|
if (config.boxStatus) {
|
|
3241
3263
|
this.setBoxStatus(box.id, config.boxStatus, skipUpdate);
|
|
3264
|
+
this.effectBoxStatusChange(skipUpdate);
|
|
3242
3265
|
}
|
|
3243
3266
|
if (config.lastNotMinimizedBoxStatus) {
|
|
3244
3267
|
this.setLastNotMinimizedBoxStatus(box.id, config.lastNotMinimizedBoxStatus, skipUpdate);
|
|
3268
|
+
this.effectLastNotMinimizedBoxStatusChange();
|
|
3245
3269
|
}
|
|
3246
3270
|
}
|
|
3247
3271
|
smartPosition(config = {}) {
|