@netless/telebox-insider 0.3.0-beta.9 → 0.3.0
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 +56 -19
- package/dist/style.css +1 -1
- package/dist/telebox-insider.cjs.js +117 -38
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +117 -38
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +1 -1
- package/src/AppMenu/index.ts +0 -1
- package/src/TeleBox/constants.ts +2 -0
- package/src/TeleBox/index.ts +34 -1
- package/src/TeleBox/typings.ts +8 -0
- package/src/TeleBoxCollector/index.ts +2 -1
- package/src/TeleBoxManager/MaxTitleBar/index.ts +2 -2
- package/src/TeleBoxManager/MaxTitleBar/style.scss +1 -1
- package/src/TeleBoxManager/index.ts +99 -51
- package/src/TeleBoxManager/typings.ts +4 -1
- package/src/TeleTitleBar/DefaultTitleBar/index.ts +26 -17
- package/src/TeleTitleBar/typings.ts +3 -0
|
@@ -1183,6 +1183,8 @@ var TELE_BOX_EVENT = /* @__PURE__ */ ((TELE_BOX_EVENT2) => {
|
|
|
1183
1183
|
TELE_BOX_EVENT2["Destroyed"] = "destroyed";
|
|
1184
1184
|
TELE_BOX_EVENT2["BoxStatus"] = "box_status";
|
|
1185
1185
|
TELE_BOX_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
|
|
1186
|
+
TELE_BOX_EVENT2["ForceTop"] = "force_top";
|
|
1187
|
+
TELE_BOX_EVENT2["ForceNormal"] = "force_normal";
|
|
1186
1188
|
return TELE_BOX_EVENT2;
|
|
1187
1189
|
})(TELE_BOX_EVENT || {});
|
|
1188
1190
|
var TELE_BOX_DELEGATE_EVENT = /* @__PURE__ */ ((TELE_BOX_DELEGATE_EVENT2) => {
|
|
@@ -1237,7 +1239,9 @@ class DefaultTitleBar {
|
|
|
1237
1239
|
onDragStart,
|
|
1238
1240
|
namespace = "telebox",
|
|
1239
1241
|
state = TELE_BOX_STATE.Normal,
|
|
1240
|
-
boxStatus
|
|
1242
|
+
boxStatus,
|
|
1243
|
+
forceTop = false,
|
|
1244
|
+
forceNormal = false
|
|
1241
1245
|
} = {}) {
|
|
1242
1246
|
this.$btns = [];
|
|
1243
1247
|
this.sideEffect = new o();
|
|
@@ -1311,7 +1315,14 @@ class DefaultTitleBar {
|
|
|
1311
1315
|
this.title = title;
|
|
1312
1316
|
this.state = state;
|
|
1313
1317
|
this.boxStatus = boxStatus;
|
|
1314
|
-
this.
|
|
1318
|
+
this.forceTop = forceTop;
|
|
1319
|
+
this.forceNormal = forceNormal;
|
|
1320
|
+
this.buttons = buttons || (forceNormal ? [
|
|
1321
|
+
{
|
|
1322
|
+
type: TELE_BOX_DELEGATE_EVENT.Close,
|
|
1323
|
+
iconClassName: this.wrapClassName("titlebar-icon-close")
|
|
1324
|
+
}
|
|
1325
|
+
] : [
|
|
1315
1326
|
{
|
|
1316
1327
|
type: TELE_BOX_DELEGATE_EVENT.Minimize,
|
|
1317
1328
|
iconClassName: this.wrapClassName("titlebar-icon-minimize")
|
|
@@ -1325,7 +1336,7 @@ class DefaultTitleBar {
|
|
|
1325
1336
|
type: TELE_BOX_DELEGATE_EVENT.Close,
|
|
1326
1337
|
iconClassName: this.wrapClassName("titlebar-icon-close")
|
|
1327
1338
|
}
|
|
1328
|
-
];
|
|
1339
|
+
]);
|
|
1329
1340
|
this.$dragArea = this.renderDragArea();
|
|
1330
1341
|
}
|
|
1331
1342
|
setTitle(title) {
|
|
@@ -1498,7 +1509,10 @@ class TeleBox {
|
|
|
1498
1509
|
},
|
|
1499
1510
|
collectorRect,
|
|
1500
1511
|
boxStatus,
|
|
1501
|
-
lastNotMinimizedBoxStatus
|
|
1512
|
+
lastNotMinimizedBoxStatus,
|
|
1513
|
+
forceTop = false,
|
|
1514
|
+
forceNormal = false,
|
|
1515
|
+
isDragContent = false
|
|
1502
1516
|
} = {}) {
|
|
1503
1517
|
this._renderSideEffect = new o();
|
|
1504
1518
|
this.handleTrackStart = (ev) => {
|
|
@@ -1565,6 +1579,19 @@ class TeleBox {
|
|
|
1565
1579
|
});
|
|
1566
1580
|
const containerRect$ = createVal(containerRect, shallowequal);
|
|
1567
1581
|
const collectorRect$ = createVal(collectorRect, shallowequal);
|
|
1582
|
+
const forceTop$ = createVal(forceTop);
|
|
1583
|
+
forceTop$.reaction((forceTop2, _, skipUpdate) => {
|
|
1584
|
+
if (!skipUpdate) {
|
|
1585
|
+
this.events.emit(TELE_BOX_EVENT.ForceTop, forceTop2 || false);
|
|
1586
|
+
}
|
|
1587
|
+
});
|
|
1588
|
+
const forceNormal$ = createVal(forceNormal);
|
|
1589
|
+
forceNormal$.reaction((forceNormal2, _, skipUpdate) => {
|
|
1590
|
+
if (!skipUpdate) {
|
|
1591
|
+
this.events.emit(TELE_BOX_EVENT.ForceNormal, forceNormal2 || false);
|
|
1592
|
+
}
|
|
1593
|
+
});
|
|
1594
|
+
const isDragContent$ = createVal(isDragContent);
|
|
1568
1595
|
const title$ = createVal(title);
|
|
1569
1596
|
title$.reaction((title2, _, skipUpdate) => {
|
|
1570
1597
|
if (!skipUpdate) {
|
|
@@ -1742,6 +1769,8 @@ class TeleBox {
|
|
|
1742
1769
|
title: title$.value,
|
|
1743
1770
|
namespace: this.namespace,
|
|
1744
1771
|
boxStatus: boxStatus$.value,
|
|
1772
|
+
forceTop: forceTop$.value,
|
|
1773
|
+
forceNormal: forceNormal$.value,
|
|
1745
1774
|
onDragStart: (event) => {
|
|
1746
1775
|
var _a;
|
|
1747
1776
|
return (_a = this._handleTrackStart) == null ? void 0 : _a.call(this, event);
|
|
@@ -1805,7 +1834,10 @@ class TeleBox {
|
|
|
1805
1834
|
maximized: maximized$,
|
|
1806
1835
|
$userContent: $userContent$,
|
|
1807
1836
|
$userFooter: $userFooter$,
|
|
1808
|
-
$userStyles: $userStyles
|
|
1837
|
+
$userStyles: $userStyles$,
|
|
1838
|
+
forceTop: forceTop$,
|
|
1839
|
+
forceNormal: forceNormal$,
|
|
1840
|
+
isDragContent: isDragContent$
|
|
1809
1841
|
};
|
|
1810
1842
|
i(this, valConfig);
|
|
1811
1843
|
this._state$ = state$;
|
|
@@ -2142,6 +2174,9 @@ class TeleBox {
|
|
|
2142
2174
|
const $content = document.createElement("div");
|
|
2143
2175
|
$content.className = this.wrapClassName("content") + " tele-fancy-scrollbar";
|
|
2144
2176
|
this.$content = $content;
|
|
2177
|
+
if (this.isDragContent) {
|
|
2178
|
+
this.$content.appendChild(this.titleBar.$dragArea);
|
|
2179
|
+
}
|
|
2145
2180
|
this._renderSideEffect.add(() => {
|
|
2146
2181
|
let last$userStyles;
|
|
2147
2182
|
return this._$userStyles$.subscribe(($userStyles) => {
|
|
@@ -2571,6 +2606,7 @@ class TeleBoxCollector {
|
|
|
2571
2606
|
return `${this.namespace}-${className}`;
|
|
2572
2607
|
}
|
|
2573
2608
|
}
|
|
2609
|
+
TeleBoxCollector.kind = "TeleBoxCollector";
|
|
2574
2610
|
var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
|
|
2575
2611
|
TELE_BOX_MANAGER_EVENT2["Focused"] = "focused";
|
|
2576
2612
|
TELE_BOX_MANAGER_EVENT2["Blurred"] = "blurred";
|
|
@@ -2619,7 +2655,7 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2619
2655
|
if (this.getBoxesStatus) {
|
|
2620
2656
|
const boxesStatus = this.getBoxesStatus();
|
|
2621
2657
|
if (boxesStatus) {
|
|
2622
|
-
return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized);
|
|
2658
|
+
return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized && !box.forceTop);
|
|
2623
2659
|
}
|
|
2624
2660
|
}
|
|
2625
2661
|
return [];
|
|
@@ -2898,7 +2934,6 @@ class AppMenu {
|
|
|
2898
2934
|
createMinimizedItem(appId) {
|
|
2899
2935
|
const appItem = document.createElement("div");
|
|
2900
2936
|
appItem.classList.add(this.c("app-menu-item"));
|
|
2901
|
-
console.log("appId=====>", appId);
|
|
2902
2937
|
appItem.setAttribute(`data-${this.c("app-id")}`, appId);
|
|
2903
2938
|
const titleDiv = document.createElement("div");
|
|
2904
2939
|
titleDiv.classList.add(this.c("app-menu-item-title"));
|
|
@@ -2960,9 +2995,11 @@ class TeleBoxManager {
|
|
|
2960
2995
|
this.boxes$ = createVal([]);
|
|
2961
2996
|
this.topBox$ = this.boxes$.derive((boxes) => {
|
|
2962
2997
|
if (boxes.length > 0) {
|
|
2963
|
-
console.log("topBox===>topBox$===>000");
|
|
2964
2998
|
let currentTopBox = void 0;
|
|
2965
2999
|
const topBox = boxes.reduce((topBox2, box) => {
|
|
3000
|
+
if (box.forceTop) {
|
|
3001
|
+
return topBox2;
|
|
3002
|
+
}
|
|
2966
3003
|
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized) {
|
|
2967
3004
|
return topBox2;
|
|
2968
3005
|
}
|
|
@@ -2972,7 +3009,6 @@ class TeleBoxManager {
|
|
|
2972
3009
|
}
|
|
2973
3010
|
return topBox2.zIndex > box.zIndex ? topBox2 : box;
|
|
2974
3011
|
}, currentTopBox);
|
|
2975
|
-
console.log("topBox===>topBox$===>end", topBox == null ? void 0 : topBox.id);
|
|
2976
3012
|
return topBox;
|
|
2977
3013
|
}
|
|
2978
3014
|
return;
|
|
@@ -3169,7 +3205,6 @@ class TeleBoxManager {
|
|
|
3169
3205
|
this.makeMaximizedTopBoxFocus();
|
|
3170
3206
|
}
|
|
3171
3207
|
}
|
|
3172
|
-
console.log("checkFocusBox===>", box.id);
|
|
3173
3208
|
this.focusBox(box);
|
|
3174
3209
|
return;
|
|
3175
3210
|
}
|
|
@@ -3315,6 +3350,21 @@ class TeleBoxManager {
|
|
|
3315
3350
|
get topBox() {
|
|
3316
3351
|
return this.topBox$.value;
|
|
3317
3352
|
}
|
|
3353
|
+
get forceTopBoxes() {
|
|
3354
|
+
return this.boxes.find((box) => box.forceTop);
|
|
3355
|
+
}
|
|
3356
|
+
get maxForceTopBox() {
|
|
3357
|
+
return this.boxes.reduce((maxTopBox, box) => {
|
|
3358
|
+
var _a;
|
|
3359
|
+
if (box.forceTop && box.zIndex > ((_a = maxTopBox == null ? void 0 : maxTopBox.zIndex) != null ? _a : 0)) {
|
|
3360
|
+
return box;
|
|
3361
|
+
}
|
|
3362
|
+
return maxTopBox;
|
|
3363
|
+
}, void 0);
|
|
3364
|
+
}
|
|
3365
|
+
get forceNormalBoxes() {
|
|
3366
|
+
return this.boxes.find((box) => box.forceNormal);
|
|
3367
|
+
}
|
|
3318
3368
|
get darkMode() {
|
|
3319
3369
|
return this._darkMode$.value;
|
|
3320
3370
|
}
|
|
@@ -3401,14 +3451,13 @@ class TeleBoxManager {
|
|
|
3401
3451
|
var _a;
|
|
3402
3452
|
const boxStatus = this.boxesStatus$.get(box.id);
|
|
3403
3453
|
if (boxStatus) {
|
|
3404
|
-
if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
|
|
3454
|
+
if (boxStatus !== TELE_BOX_STATE.Minimized && !this.isForceTop(box) && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
|
|
3405
3455
|
newTopBox = box;
|
|
3406
3456
|
}
|
|
3407
3457
|
box.setBoxStatus(boxStatus, skipUpdate);
|
|
3408
3458
|
}
|
|
3409
3459
|
});
|
|
3410
3460
|
this.effectBoxStatusChange();
|
|
3411
|
-
console.log("effectBoxesStatusTimerFunc===>newTopBox", newTopBox, curTopBox);
|
|
3412
3461
|
if (newTopBox && curTopBox !== newTopBox) {
|
|
3413
3462
|
this.topBox$.setValue(newTopBox);
|
|
3414
3463
|
}
|
|
@@ -3417,7 +3466,7 @@ class TeleBoxManager {
|
|
|
3417
3466
|
}
|
|
3418
3467
|
}
|
|
3419
3468
|
async effectBoxesStatusChange(skipUpdate = false) {
|
|
3420
|
-
var _a, _b
|
|
3469
|
+
var _a, _b;
|
|
3421
3470
|
if (!this.useBoxesStatus) {
|
|
3422
3471
|
if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
|
|
3423
3472
|
clearTimeout(this.effectBoxesStatusTimer.timer);
|
|
@@ -3432,11 +3481,9 @@ class TeleBoxManager {
|
|
|
3432
3481
|
if (this.effectBoxesStatusTimer.skipUpdate !== skipUpdate) {
|
|
3433
3482
|
clearTimeout(this.effectBoxesStatusTimer.timer);
|
|
3434
3483
|
if (this.effectBoxesStatusTimer.resolve) {
|
|
3435
|
-
console.log("effectBoxStatusTimerFunc===>1111", skipUpdate);
|
|
3436
3484
|
this.effectBoxesStatusTimer.resolve(!!((_b = this.effectBoxesStatusTimer) == null ? void 0 : _b.skipUpdate));
|
|
3437
3485
|
}
|
|
3438
3486
|
this.effectBoxesStatusTimer.skipUpdate = skipUpdate;
|
|
3439
|
-
console.log("effectBoxStatusTimerFunc===>2222", skipUpdate);
|
|
3440
3487
|
} else {
|
|
3441
3488
|
return;
|
|
3442
3489
|
}
|
|
@@ -3452,17 +3499,13 @@ class TeleBoxManager {
|
|
|
3452
3499
|
const _skipUpdate = await new Promise((resolve) => {
|
|
3453
3500
|
this.effectBoxesStatusTimer.resolve = resolve;
|
|
3454
3501
|
this.effectBoxesStatusTimer.timer = setTimeout(() => {
|
|
3455
|
-
var _a2, _b2;
|
|
3456
3502
|
if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.resolve) {
|
|
3457
|
-
console.log("effectBoxStatusTimerFunc===>000", skipUpdate, { id: (_a2 = this.topBox$.value) == null ? void 0 : _a2.id, zIndex: (_b2 = this.topBox$.value) == null ? void 0 : _b2.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
|
|
3458
3503
|
this.effectBoxesStatusTimer.resolve(this.effectBoxesStatusTimer.skipUpdate);
|
|
3459
3504
|
}
|
|
3460
3505
|
}, 100);
|
|
3461
3506
|
});
|
|
3462
|
-
console.log("effectBoxStatusTimerFunc===>000==>00", skipUpdate, { id: (_c = this.topBox$.value) == null ? void 0 : _c.id, zIndex: (_d = this.topBox$.value) == null ? void 0 : _d.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
|
|
3463
3507
|
this.effectBoxesStatusTimerFunc(_skipUpdate);
|
|
3464
3508
|
this.effectBoxesStatusTimer = void 0;
|
|
3465
|
-
console.log("effectBoxStatusTimerFunc===>000==>11", skipUpdate, { id: (_e = this.topBox$.value) == null ? void 0 : _e.id, zIndex: (_f = this.topBox$.value) == null ? void 0 : _f.zIndex }, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex })));
|
|
3466
3509
|
}
|
|
3467
3510
|
}
|
|
3468
3511
|
hasBoxesStatus() {
|
|
@@ -3546,11 +3589,9 @@ class TeleBoxManager {
|
|
|
3546
3589
|
clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
|
|
3547
3590
|
if (this.effectLastNotMinimizedBoxStatusTimer.skipUpdate !== skipUpdate) {
|
|
3548
3591
|
if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
3549
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>1111", skipUpdate);
|
|
3550
3592
|
this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((_b = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _b.skipUpdate));
|
|
3551
3593
|
}
|
|
3552
3594
|
this.effectLastNotMinimizedBoxStatusTimer.skipUpdate = skipUpdate;
|
|
3553
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>2222", skipUpdate);
|
|
3554
3595
|
} else {
|
|
3555
3596
|
return;
|
|
3556
3597
|
}
|
|
@@ -3567,22 +3608,18 @@ class TeleBoxManager {
|
|
|
3567
3608
|
this.effectLastNotMinimizedBoxStatusTimer.resolve = resolve;
|
|
3568
3609
|
this.effectLastNotMinimizedBoxStatusTimer.timer = setTimeout(() => {
|
|
3569
3610
|
if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
3570
|
-
console.log("effectLastNotMinimizedBoxStatusTimer===>000", skipUpdate);
|
|
3571
3611
|
this.effectLastNotMinimizedBoxStatusTimer.resolve(this.effectLastNotMinimizedBoxStatusTimer.skipUpdate);
|
|
3572
3612
|
}
|
|
3573
3613
|
}, 100);
|
|
3574
3614
|
});
|
|
3575
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>000==>00", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex, lastNotMinimizedBoxStatus: b._lastNotMinimizedBoxStatus$.value })));
|
|
3576
3615
|
this.effectLastNotMinimizedBoxStatusFunc(_skipUpdate);
|
|
3577
3616
|
this.effectLastNotMinimizedBoxStatusTimer = void 0;
|
|
3578
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>000==>11", skipUpdate, this.boxes$.value.map((b) => ({ id: b.id, focus: b.focus, boxStatus: b.boxStatus, zIndex: b.zIndex, lastNotMinimizedBoxStatus: b._lastNotMinimizedBoxStatus$.value })));
|
|
3579
3617
|
}
|
|
3580
3618
|
}
|
|
3581
3619
|
effectLastNotMinimizedBoxStatusFunc(skipUpdate = false) {
|
|
3582
3620
|
if (!this.useBoxesStatus) {
|
|
3583
3621
|
return;
|
|
3584
3622
|
}
|
|
3585
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>end", skipUpdate);
|
|
3586
3623
|
this.boxes.forEach((box) => {
|
|
3587
3624
|
const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
|
|
3588
3625
|
if (boxStatus) {
|
|
@@ -3598,7 +3635,7 @@ class TeleBoxManager {
|
|
|
3598
3635
|
return this.getUnabledBoxesStatusZIndex();
|
|
3599
3636
|
}
|
|
3600
3637
|
return this.boxes.reduce((maxZIndex, box) => {
|
|
3601
|
-
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3638
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized && !this.isForceTop(box)) {
|
|
3602
3639
|
return Math.max(maxZIndex, box.zIndex);
|
|
3603
3640
|
}
|
|
3604
3641
|
return maxZIndex;
|
|
@@ -3609,17 +3646,32 @@ class TeleBoxManager {
|
|
|
3609
3646
|
return this.getUnabledBoxesStatusZIndex();
|
|
3610
3647
|
}
|
|
3611
3648
|
return this.boxes.reduce((maxZIndex, box) => {
|
|
3612
|
-
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
|
|
3649
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal && !this.isForceTop(box)) {
|
|
3613
3650
|
return Math.max(maxZIndex, box.zIndex);
|
|
3614
3651
|
}
|
|
3615
3652
|
return maxZIndex;
|
|
3616
3653
|
}, 299);
|
|
3617
3654
|
}
|
|
3655
|
+
getMaxForceTopBoxZIndex() {
|
|
3656
|
+
if (!this.useBoxesStatus) {
|
|
3657
|
+
return this.getUnabledBoxesStatusZIndex();
|
|
3658
|
+
}
|
|
3659
|
+
return this.boxes.reduce((maxZIndex, box) => {
|
|
3660
|
+
if (box.boxStatus && this.isForceTop(box)) {
|
|
3661
|
+
return Math.max(maxZIndex, box.zIndex);
|
|
3662
|
+
}
|
|
3663
|
+
return maxZIndex;
|
|
3664
|
+
}, 699);
|
|
3665
|
+
}
|
|
3666
|
+
isForceNormal(box) {
|
|
3667
|
+
return box._forceNormal$.value;
|
|
3668
|
+
}
|
|
3669
|
+
isForceTop(box) {
|
|
3670
|
+
return box._forceTop$.value;
|
|
3671
|
+
}
|
|
3618
3672
|
create(config = {}, smartPosition = true) {
|
|
3619
|
-
var _a;
|
|
3620
|
-
console.log("create===>", config, (_a = this.topBox) == null ? void 0 : _a.zIndex);
|
|
3621
3673
|
const box = new TeleBox({
|
|
3622
|
-
zIndex: this.getMaxNormalBoxZIndex() + 1,
|
|
3674
|
+
zIndex: config.forceTop ? this.getMaxForceTopBoxZIndex() + 1 : this.getMaxNormalBoxZIndex() + 1,
|
|
3623
3675
|
...smartPosition ? this.smartPosition(config) : config,
|
|
3624
3676
|
darkMode: this.darkMode,
|
|
3625
3677
|
prefersColorScheme: this.prefersColorScheme,
|
|
@@ -3647,15 +3699,17 @@ class TeleBoxManager {
|
|
|
3647
3699
|
}
|
|
3648
3700
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
|
|
3649
3701
|
if (this.useBoxesStatus && box.boxStatus) {
|
|
3702
|
+
if (box._forceNormal$.value) {
|
|
3703
|
+
return;
|
|
3704
|
+
}
|
|
3650
3705
|
if (box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3651
3706
|
this.setBox(box.id, {
|
|
3652
3707
|
status: TELE_BOX_STATE.Normal,
|
|
3653
3708
|
zIndex: this.getMaxNormalBoxZIndex() + 1
|
|
3654
3709
|
}, false);
|
|
3655
3710
|
} else {
|
|
3656
|
-
[...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
|
|
3711
|
+
[...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal && !this.isForceNormal(box2)).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
|
|
3657
3712
|
if (box2.boxStatus === TELE_BOX_STATE.Normal) {
|
|
3658
|
-
console.log("maximized===>", box2.id);
|
|
3659
3713
|
this.setBox(box2.id, {
|
|
3660
3714
|
status: TELE_BOX_STATE.Maximized,
|
|
3661
3715
|
zIndex: this.getMaxMaximizedBoxZIndex() + 1
|
|
@@ -3670,6 +3724,9 @@ class TeleBoxManager {
|
|
|
3670
3724
|
});
|
|
3671
3725
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
|
|
3672
3726
|
if (box.boxStatus && this.useBoxesStatus) {
|
|
3727
|
+
if (box._forceNormal$.value) {
|
|
3728
|
+
return;
|
|
3729
|
+
}
|
|
3673
3730
|
if (box.focus) {
|
|
3674
3731
|
this.blurBox(box);
|
|
3675
3732
|
}
|
|
@@ -3717,9 +3774,11 @@ class TeleBoxManager {
|
|
|
3717
3774
|
});
|
|
3718
3775
|
box._zIndex$.reaction((_, __, skipUpdate) => {
|
|
3719
3776
|
if (this.boxes.length > 0) {
|
|
3720
|
-
console.log("topBox===>_zIndex", this.boxes.map((box2) => ({ id: box2.id, zIndex: box2.zIndex, boxStatus: box2.boxStatus })));
|
|
3721
3777
|
let currentTopBox = void 0;
|
|
3722
3778
|
const topBox = this.boxes.reduce((topBox2, box2) => {
|
|
3779
|
+
if (this.isForceTop(box2)) {
|
|
3780
|
+
return topBox2;
|
|
3781
|
+
}
|
|
3723
3782
|
if (box2.boxStatus && box2.boxStatus === TELE_BOX_STATE.Minimized) {
|
|
3724
3783
|
return topBox2;
|
|
3725
3784
|
}
|
|
@@ -3729,7 +3788,6 @@ class TeleBoxManager {
|
|
|
3729
3788
|
}
|
|
3730
3789
|
return topBox2.zIndex > box2.zIndex ? topBox2 : box2;
|
|
3731
3790
|
}, currentTopBox);
|
|
3732
|
-
console.log("topBox===>_zIndex===>end", topBox == null ? void 0 : topBox.id);
|
|
3733
3791
|
this.topBox$.setValue(topBox);
|
|
3734
3792
|
}
|
|
3735
3793
|
if (!skipUpdate) {
|
|
@@ -3950,13 +4008,27 @@ class TeleBoxManager {
|
|
|
3950
4008
|
lastNotMinimizedBoxStatus: config.lastNotMinimizedBoxStatus
|
|
3951
4009
|
}, skipUpdate);
|
|
3952
4010
|
}
|
|
4011
|
+
if (config.forceTop != null) {
|
|
4012
|
+
box.setForceTop(config.forceTop, skipUpdate);
|
|
4013
|
+
}
|
|
4014
|
+
if (config.forceNormal != null) {
|
|
4015
|
+
box.setForceNormal(config.forceNormal, skipUpdate);
|
|
4016
|
+
}
|
|
3953
4017
|
}
|
|
3954
4018
|
smartPosition(config = {}) {
|
|
3955
4019
|
let { x, y } = config;
|
|
3956
4020
|
const { width = 0.5, height = 0.5 } = config;
|
|
3957
4021
|
if (x == null) {
|
|
3958
4022
|
let vx = 20;
|
|
3959
|
-
if (
|
|
4023
|
+
if (config.forceTop) {
|
|
4024
|
+
const forceTopBox = this.maxForceTopBox || this.topBox;
|
|
4025
|
+
if (forceTopBox) {
|
|
4026
|
+
vx = forceTopBox.intrinsicX * this.containerRect.width + 20;
|
|
4027
|
+
if (vx > this.containerRect.width - width * this.containerRect.width) {
|
|
4028
|
+
vx = 20;
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
} else if (this.topBox) {
|
|
3960
4032
|
vx = this.topBox.intrinsicX * this.containerRect.width + 20;
|
|
3961
4033
|
if (vx > this.containerRect.width - width * this.containerRect.width) {
|
|
3962
4034
|
vx = 20;
|
|
@@ -3970,7 +4042,15 @@ class TeleBoxManager {
|
|
|
3970
4042
|
}
|
|
3971
4043
|
if (y == null) {
|
|
3972
4044
|
let vy = 20;
|
|
3973
|
-
if (
|
|
4045
|
+
if (config.forceTop) {
|
|
4046
|
+
const forceTopBox = this.maxForceTopBox || this.topBox;
|
|
4047
|
+
if (forceTopBox) {
|
|
4048
|
+
vy = forceTopBox.intrinsicY * this.containerRect.height + 20;
|
|
4049
|
+
if (vy > this.containerRect.height - height * this.containerRect.height) {
|
|
4050
|
+
vy = 20;
|
|
4051
|
+
}
|
|
4052
|
+
}
|
|
4053
|
+
} else if (this.topBox) {
|
|
3974
4054
|
vy = this.topBox.intrinsicY * this.containerRect.height + 20;
|
|
3975
4055
|
if (vy > this.containerRect.height - height * this.containerRect.height) {
|
|
3976
4056
|
vy = 20;
|
|
@@ -4012,9 +4092,7 @@ class TeleBoxManager {
|
|
|
4012
4092
|
return;
|
|
4013
4093
|
}
|
|
4014
4094
|
const maximizedBox = this.getMaximizedTopBox();
|
|
4015
|
-
console.log("makeMaximizedTopBoxFocus===>", maximizedBox == null ? void 0 : maximizedBox.id);
|
|
4016
4095
|
this.maxTitleBar.focusBox(maximizedBox);
|
|
4017
|
-
console.log("makeMaximizedTopBoxFocus===>end", maximizedBox == null ? void 0 : maximizedBox.id);
|
|
4018
4096
|
}
|
|
4019
4097
|
getBoxIndex(boxOrID) {
|
|
4020
4098
|
return typeof boxOrID === "string" ? this.boxes.findIndex((box) => box.id === boxOrID) : this.boxes.findIndex((box) => box === boxOrID);
|
|
@@ -4037,5 +4115,6 @@ class TeleBoxManager {
|
|
|
4037
4115
|
return;
|
|
4038
4116
|
}
|
|
4039
4117
|
}
|
|
4118
|
+
TeleBoxManager.kind = "TeleBoxManager";
|
|
4040
4119
|
export { DefaultTitleBar, TELE_BOX_COLOR_SCHEME, TELE_BOX_DELEGATE_EVENT, TELE_BOX_EVENT, TELE_BOX_MANAGER_EVENT, TELE_BOX_RESIZE_HANDLE, TELE_BOX_STATE, TeleBox, TeleBoxCollector, TeleBoxDragHandleType, TeleBoxManager };
|
|
4041
4120
|
//# sourceMappingURL=telebox-insider.es.js.map
|