@netless/telebox-insider 0.3.1-beta.0 → 0.3.1
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 +6 -1
- package/dist/telebox-insider.cjs.js +54 -7
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +54 -7
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +1 -1
- package/src/TeleBox/index.ts +7 -2
- package/src/TeleBoxManager/index.ts +49 -3
- package/src/TeleTitleBar/typings.ts +1 -1
|
@@ -1672,7 +1672,10 @@ class TeleBox {
|
|
|
1672
1672
|
this.events.emit(TELE_BOX_EVENT.Minimized, minimized2);
|
|
1673
1673
|
}
|
|
1674
1674
|
});
|
|
1675
|
-
const maximized$ = createVal(
|
|
1675
|
+
const maximized$ = createVal(
|
|
1676
|
+
maximized || forceMaximized,
|
|
1677
|
+
(next, previous) => next === previous || forceMaximized$.value && !next
|
|
1678
|
+
);
|
|
1676
1679
|
maximized$.reaction((maximized2, _, skipUpdate) => {
|
|
1677
1680
|
if (!skipUpdate) {
|
|
1678
1681
|
this.events.emit(TELE_BOX_EVENT.Maximized, maximized2);
|
|
@@ -1850,7 +1853,10 @@ class TeleBox {
|
|
|
1850
1853
|
this.titleBar.setReadonly(readonly2);
|
|
1851
1854
|
});
|
|
1852
1855
|
forceMaximized$.reaction((forceMaximized2) => {
|
|
1853
|
-
|
|
1856
|
+
var _a, _b;
|
|
1857
|
+
if (forceMaximized2)
|
|
1858
|
+
maximized$.setValue(true);
|
|
1859
|
+
(_b = (_a = this.titleBar).setForceMaximized) == null ? void 0 : _b.call(_a, forceMaximized2);
|
|
1854
1860
|
});
|
|
1855
1861
|
boxStatus$.reaction((boxStatus2) => {
|
|
1856
1862
|
this.titleBar.setBoxStatus(boxStatus2);
|
|
@@ -3050,6 +3056,7 @@ class TeleBoxManager {
|
|
|
3050
3056
|
useBoxesStatus = false
|
|
3051
3057
|
} = {}) {
|
|
3052
3058
|
this.events = new EventEmitter();
|
|
3059
|
+
this.committedFocusDepth = 0;
|
|
3053
3060
|
this._sideEffect = new o();
|
|
3054
3061
|
this.useBoxesStatus = useBoxesStatus;
|
|
3055
3062
|
const { combine, createVal } = c(this._sideEffect);
|
|
@@ -3117,14 +3124,19 @@ class TeleBoxManager {
|
|
|
3117
3124
|
this.boxes.forEach((box) => box.setReadonly(readonly2, skipUpdate));
|
|
3118
3125
|
});
|
|
3119
3126
|
const minimized$ = createVal(minimized);
|
|
3120
|
-
const maximized$ = createVal(maximized);
|
|
3121
3127
|
const forceMaximized$ = createVal(forceMaximized);
|
|
3128
|
+
const maximized$ = createVal(
|
|
3129
|
+
maximized || forceMaximized,
|
|
3130
|
+
(next, previous) => next === previous || forceMaximized$.value && !next
|
|
3131
|
+
);
|
|
3122
3132
|
forceMaximized$.reaction((forceMaximized2, _, skipUpdate) => {
|
|
3123
|
-
var _a;
|
|
3133
|
+
var _a, _b;
|
|
3134
|
+
if (forceMaximized2)
|
|
3135
|
+
maximized$.setValue(true, skipUpdate);
|
|
3124
3136
|
this.boxes.forEach(
|
|
3125
3137
|
(box) => box.setForceMaximized(forceMaximized2, skipUpdate)
|
|
3126
3138
|
);
|
|
3127
|
-
(_a = this.maxTitleBar) == null ? void 0 : _a.setForceMaximized(forceMaximized2);
|
|
3139
|
+
(_b = (_a = this.maxTitleBar) == null ? void 0 : _a.setForceMaximized) == null ? void 0 : _b.call(_a, forceMaximized2);
|
|
3128
3140
|
});
|
|
3129
3141
|
maximized$.reaction((maximized2, _, skipUpdate) => {
|
|
3130
3142
|
this.boxes.forEach(
|
|
@@ -3240,7 +3252,7 @@ class TeleBoxManager {
|
|
|
3240
3252
|
});
|
|
3241
3253
|
const closeBtnClassName = this.wrapClassName("titlebar-icon-close");
|
|
3242
3254
|
const checkFocusBox = (ev) => {
|
|
3243
|
-
var _a;
|
|
3255
|
+
var _a, _b;
|
|
3244
3256
|
if (readonly$.value) {
|
|
3245
3257
|
return;
|
|
3246
3258
|
}
|
|
@@ -3256,6 +3268,8 @@ class TeleBoxManager {
|
|
|
3256
3268
|
if (id) {
|
|
3257
3269
|
const box = this.getBox(id);
|
|
3258
3270
|
if (box) {
|
|
3271
|
+
if ((_b = this.lazyFocusRequestHandler) == null ? void 0 : _b.call(this, box.id))
|
|
3272
|
+
return;
|
|
3259
3273
|
if (!this.useBoxesStatus) {
|
|
3260
3274
|
this.makeBoxTop(box);
|
|
3261
3275
|
} else {
|
|
@@ -3284,7 +3298,7 @@ class TeleBoxManager {
|
|
|
3284
3298
|
this.makeMaximizedTopBoxFocus();
|
|
3285
3299
|
}
|
|
3286
3300
|
}
|
|
3287
|
-
this.
|
|
3301
|
+
this.focusBoxCommitted(box);
|
|
3288
3302
|
return;
|
|
3289
3303
|
}
|
|
3290
3304
|
}
|
|
@@ -3464,6 +3478,23 @@ class TeleBoxManager {
|
|
|
3464
3478
|
get state() {
|
|
3465
3479
|
return this._state$.value;
|
|
3466
3480
|
}
|
|
3481
|
+
setUseBoxesStatus(useBoxesStatus) {
|
|
3482
|
+
var _a, _b;
|
|
3483
|
+
if (this.useBoxesStatus === useBoxesStatus)
|
|
3484
|
+
return;
|
|
3485
|
+
this.useBoxesStatus = useBoxesStatus;
|
|
3486
|
+
this.boxes.forEach(
|
|
3487
|
+
(box) => box.setBoxStatus(useBoxesStatus ? this.boxesStatus$.get(box.id) : void 0, true)
|
|
3488
|
+
);
|
|
3489
|
+
this.boxes$.setValue([...this.boxes]);
|
|
3490
|
+
if (useBoxesStatus) {
|
|
3491
|
+
this.appMenu || (this.appMenu = this.createMinimizedAppMenu());
|
|
3492
|
+
this.effectBoxStatusChange();
|
|
3493
|
+
} else {
|
|
3494
|
+
(_a = this.appMenu) == null ? void 0 : _a.render(/* @__PURE__ */ new Map());
|
|
3495
|
+
(_b = this.collector) == null ? void 0 : _b.setVisible(false);
|
|
3496
|
+
}
|
|
3497
|
+
}
|
|
3467
3498
|
setState(state, skipUpdate = false) {
|
|
3468
3499
|
if (state === TELE_BOX_STATE.Normal && this.forceMaximized) {
|
|
3469
3500
|
return this;
|
|
@@ -3805,6 +3836,7 @@ class TeleBoxManager {
|
|
|
3805
3836
|
const box = new TeleBox({
|
|
3806
3837
|
zIndex: config.forceTop ? this.getMaxForceTopBoxZIndex() + 1 : this.getMaxNormalBoxZIndex() + 1,
|
|
3807
3838
|
...smartPosition ? this.smartPosition(config) : config,
|
|
3839
|
+
...!this.useBoxesStatus ? { boxStatus: void 0, lastNotMinimizedBoxStatus: void 0 } : {},
|
|
3808
3840
|
darkMode: this.darkMode,
|
|
3809
3841
|
prefersColorScheme: this.prefersColorScheme,
|
|
3810
3842
|
maximized: this.maximized,
|
|
@@ -4058,9 +4090,15 @@ class TeleBoxManager {
|
|
|
4058
4090
|
wrapClassName(className) {
|
|
4059
4091
|
return `${this.namespace}-${className}`;
|
|
4060
4092
|
}
|
|
4093
|
+
setLazyFocusRequestHandler(handler) {
|
|
4094
|
+
this.lazyFocusRequestHandler = handler;
|
|
4095
|
+
}
|
|
4061
4096
|
focusBox(boxOrID, skipUpdate = false) {
|
|
4097
|
+
var _a;
|
|
4062
4098
|
const targetBox = this.getBox(boxOrID);
|
|
4063
4099
|
if (targetBox) {
|
|
4100
|
+
if (!skipUpdate && !this.committedFocusDepth && ((_a = this.lazyFocusRequestHandler) == null ? void 0 : _a.call(this, targetBox.id)))
|
|
4101
|
+
return;
|
|
4064
4102
|
this.boxes.forEach((box) => {
|
|
4065
4103
|
if (targetBox === box) {
|
|
4066
4104
|
let focusChanged = false;
|
|
@@ -4085,6 +4123,15 @@ class TeleBoxManager {
|
|
|
4085
4123
|
}
|
|
4086
4124
|
}
|
|
4087
4125
|
}
|
|
4126
|
+
focusBoxCommitted(boxOrID, skipUpdate = false) {
|
|
4127
|
+
var _a;
|
|
4128
|
+
this.committedFocusDepth = ((_a = this.committedFocusDepth) != null ? _a : 0) + 1;
|
|
4129
|
+
try {
|
|
4130
|
+
this.focusBox(boxOrID, skipUpdate);
|
|
4131
|
+
} finally {
|
|
4132
|
+
this.committedFocusDepth -= 1;
|
|
4133
|
+
}
|
|
4134
|
+
}
|
|
4088
4135
|
focusTopBox() {
|
|
4089
4136
|
if (this.topBox && !this.topBox.focus) {
|
|
4090
4137
|
return this.focusBox(this.topBox);
|