@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
package/dist/index.d.ts
CHANGED
|
@@ -284,7 +284,9 @@ declare enum TELE_BOX_EVENT {
|
|
|
284
284
|
Readonly = "readonly",
|
|
285
285
|
Destroyed = "destroyed",
|
|
286
286
|
BoxStatus = "box_status",
|
|
287
|
-
LastNotMinimizedBoxStatus = "last_not_minimized_box_status"
|
|
287
|
+
LastNotMinimizedBoxStatus = "last_not_minimized_box_status",
|
|
288
|
+
ForceTop = "force_top",
|
|
289
|
+
ForceNormal = "force_normal"
|
|
288
290
|
}
|
|
289
291
|
declare enum TELE_BOX_DELEGATE_EVENT {
|
|
290
292
|
Close = "close",
|
|
@@ -381,6 +383,12 @@ interface TeleBoxConfig {
|
|
|
381
383
|
readonly boxStatus?: TeleBoxState;
|
|
382
384
|
/** Last not minimized box status. */
|
|
383
385
|
readonly lastNotMinimizedBoxStatus?: NotMinimizedBoxState;
|
|
386
|
+
/** Force top. */
|
|
387
|
+
readonly forceTop?: boolean;
|
|
388
|
+
/** Force normal. */
|
|
389
|
+
readonly forceNormal?: boolean;
|
|
390
|
+
/** Is drag content. */
|
|
391
|
+
readonly isDragContent?: boolean;
|
|
384
392
|
}
|
|
385
393
|
type CheckTeleBoxConfig<T extends Record<`${TELE_BOX_EVENT}`, any>> = T;
|
|
386
394
|
type TeleBoxEventConfig = CheckTeleBoxConfig<{
|
|
@@ -423,6 +431,8 @@ type TeleBoxEventConfig = CheckTeleBoxConfig<{
|
|
|
423
431
|
id: string;
|
|
424
432
|
lastNotMinimizedBoxStatus?: NotMinimizedBoxState;
|
|
425
433
|
};
|
|
434
|
+
force_normal: boolean;
|
|
435
|
+
force_top: boolean;
|
|
426
436
|
}>;
|
|
427
437
|
type TeleBoxEvent = keyof TeleBoxEventConfig;
|
|
428
438
|
interface TeleBoxEvents extends EventEmitter<TeleBoxEvent> {
|
|
@@ -460,10 +470,13 @@ interface TeleTitleBarConfig {
|
|
|
460
470
|
title?: string;
|
|
461
471
|
state?: TeleBoxState;
|
|
462
472
|
namespace?: string;
|
|
473
|
+
forceTop?: boolean;
|
|
474
|
+
forceNormal?: boolean;
|
|
463
475
|
onEvent?: (event: TeleTitleBarEvent) => void;
|
|
464
476
|
onDragStart?: (event: MouseEvent | TouchEvent) => void;
|
|
465
477
|
}
|
|
466
478
|
interface TeleTitleBar {
|
|
479
|
+
readonly $dragArea: HTMLElement;
|
|
467
480
|
setTitle(title: string): void;
|
|
468
481
|
setState(state: TeleBoxState): void;
|
|
469
482
|
setReadonly(readonly: boolean): void;
|
|
@@ -482,11 +495,13 @@ interface DefaultTitleBarConfig extends TeleTitleBarConfig {
|
|
|
482
495
|
}
|
|
483
496
|
declare class DefaultTitleBar implements TeleTitleBar {
|
|
484
497
|
protected boxStatus?: TeleBoxState;
|
|
485
|
-
|
|
498
|
+
protected forceTop?: boolean;
|
|
499
|
+
protected forceNormal?: boolean;
|
|
500
|
+
constructor({ readonly, title, buttons, onEvent, onDragStart, namespace, state, boxStatus, forceTop, forceNormal, }?: DefaultTitleBarConfig);
|
|
486
501
|
readonly namespace: string;
|
|
487
502
|
$titleBar: HTMLElement | undefined;
|
|
488
503
|
$title: HTMLElement | undefined;
|
|
489
|
-
$dragArea: HTMLElement;
|
|
504
|
+
readonly $dragArea: HTMLElement;
|
|
490
505
|
setTitle(title: string): void;
|
|
491
506
|
setState(state: TeleBoxState): void;
|
|
492
507
|
setBoxStatus(boxStatus?: TeleBoxState): void;
|
|
@@ -546,11 +561,17 @@ type ValConfig$1 = {
|
|
|
546
561
|
$userContent: Val<HTMLElement | undefined>;
|
|
547
562
|
$userFooter: Val<HTMLElement | undefined>;
|
|
548
563
|
$userStyles: Val<HTMLStyleElement | undefined>;
|
|
564
|
+
/** Force top. */
|
|
565
|
+
forceTop: Val<boolean, boolean>;
|
|
566
|
+
/** Force normal. */
|
|
567
|
+
forceNormal: Val<boolean, boolean>;
|
|
568
|
+
/** Drag content. */
|
|
569
|
+
isDragContent: Val<boolean, boolean>;
|
|
549
570
|
};
|
|
550
571
|
interface TeleBox extends ValEnhancedResult<ValConfig$1> {
|
|
551
572
|
}
|
|
552
573
|
declare class TeleBox {
|
|
553
|
-
constructor({ id, title, prefersColorScheme, darkMode, visible, width, height, minWidth, minHeight, x, y, minimized, maximized, readonly, resizable, draggable, fence, fixRatio, focus, zIndex, namespace, titleBar, content, footer, styles, containerRect, collectorRect, boxStatus, lastNotMinimizedBoxStatus }?: TeleBoxConfig);
|
|
574
|
+
constructor({ id, title, prefersColorScheme, darkMode, visible, width, height, minWidth, minHeight, x, y, minimized, maximized, readonly, resizable, draggable, fence, fixRatio, focus, zIndex, namespace, titleBar, content, footer, styles, containerRect, collectorRect, boxStatus, lastNotMinimizedBoxStatus, forceTop, forceNormal, isDragContent, }?: TeleBoxConfig);
|
|
554
575
|
readonly id: string;
|
|
555
576
|
/** ClassName Prefix. For CSS styling. Default "telebox" */
|
|
556
577
|
readonly namespace: string;
|
|
@@ -703,6 +724,7 @@ interface TeleBoxCollectorConfig {
|
|
|
703
724
|
getBoxesStatus?: () => Map<string, TeleBoxState>;
|
|
704
725
|
}
|
|
705
726
|
declare class TeleBoxCollector {
|
|
727
|
+
static readonly kind = "TeleBoxCollector";
|
|
706
728
|
getBoxesStatus?: () => Map<string, TeleBoxState>;
|
|
707
729
|
constructor({ visible, readonly, darkMode, namespace, styles, onClick, getBoxesStatus }: TeleBoxCollectorConfig);
|
|
708
730
|
get boxesStatus(): Map<string, TeleBoxState> | undefined;
|
|
@@ -722,7 +744,7 @@ declare class TeleBoxCollector {
|
|
|
722
744
|
* Unmount collector from the root element.
|
|
723
745
|
*/
|
|
724
746
|
unmount(): this;
|
|
725
|
-
|
|
747
|
+
protected hasMinimizedBox(): boolean;
|
|
726
748
|
updateBoxesStatus(): void;
|
|
727
749
|
setVisible(visible: boolean): this;
|
|
728
750
|
setReadonly(readonly: boolean): this;
|
|
@@ -765,7 +787,7 @@ interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "prefersColorScheme"
|
|
|
765
787
|
/** Whether to use boxes status. */
|
|
766
788
|
useBoxesStatus?: boolean;
|
|
767
789
|
}
|
|
768
|
-
type TeleBoxManagerBoxConfigBaseProps = "title" | "visible" | "width" | "height" | "minWidth" | "minHeight" | "x" | "y" | "resizable" | "draggable" | "fixRatio" | "zIndex" | "boxStatus" | "lastNotMinimizedBoxStatus";
|
|
790
|
+
type TeleBoxManagerBoxConfigBaseProps = "title" | "visible" | "width" | "height" | "minWidth" | "minHeight" | "x" | "y" | "resizable" | "draggable" | "fixRatio" | "zIndex" | "boxStatus" | "lastNotMinimizedBoxStatus" | "forceTop" | "forceNormal" | "isDragContent";
|
|
769
791
|
type TeleBoxManagerCreateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "footer" | "id" | "focus">;
|
|
770
792
|
type TeleBoxManagerQueryConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "id" | "focus">;
|
|
771
793
|
type TeleBoxManagerUpdateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "footer">;
|
|
@@ -803,7 +825,7 @@ interface TeleBoxManagerEvents extends EventEmitter<TeleBoxManagerEvent> {
|
|
|
803
825
|
emit<U extends TeleBoxManagerEvent>(event: U, ...value: TeleBoxManagerEventConfig[U]): boolean;
|
|
804
826
|
}
|
|
805
827
|
|
|
806
|
-
type MaxTitleBarTeleBox = Pick<TeleBox, "id" | "title" | "readonly" | "zIndex" | "$box">;
|
|
828
|
+
type MaxTitleBarTeleBox = Pick<TeleBox, "id" | "title" | "readonly" | "zIndex" | "$box" | "forceTop" | "forceNormal">;
|
|
807
829
|
interface MaxTitleBarConfig extends DefaultTitleBarConfig {
|
|
808
830
|
darkMode: boolean;
|
|
809
831
|
boxes: MaxTitleBarTeleBox[];
|
|
@@ -885,15 +907,27 @@ type ValConfig = {
|
|
|
885
907
|
interface TeleBoxManager extends ValEnhancedResult<ValConfig> {
|
|
886
908
|
}
|
|
887
909
|
declare class TeleBoxManager {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
910
|
+
static readonly kind = "TeleBoxManager";
|
|
911
|
+
protected boxesStatus$: Map<string, TeleBoxState>;
|
|
912
|
+
protected lastNotMinimizedBoxesStatus$: Map<string, NotMinimizedBoxState>;
|
|
913
|
+
protected appMenu: AppMenu | undefined;
|
|
914
|
+
protected useBoxesStatus: boolean;
|
|
915
|
+
protected effectBoxesStatusTimer?: {
|
|
916
|
+
skipUpdate: boolean;
|
|
917
|
+
timer: number | undefined;
|
|
918
|
+
resolve?: (skipUpdate: boolean) => void;
|
|
919
|
+
};
|
|
920
|
+
protected effectLastNotMinimizedBoxStatusTimer?: {
|
|
921
|
+
skipUpdate: boolean;
|
|
922
|
+
timer: number | undefined;
|
|
923
|
+
resolve?: (skipUpdate: boolean) => void;
|
|
924
|
+
};
|
|
894
925
|
constructor({ root, prefersColorScheme, minimized, maximized, fence, containerRect, collector, namespace, readonly, useBoxesStatus, }?: TeleBoxManagerConfig);
|
|
895
926
|
get boxes(): ReadonlyArray<TeleBox>;
|
|
896
927
|
get topBox(): TeleBox | undefined;
|
|
928
|
+
get forceTopBoxes(): TeleBox | undefined;
|
|
929
|
+
get maxForceTopBox(): TeleBox | undefined;
|
|
930
|
+
get forceNormalBoxes(): TeleBox | undefined;
|
|
897
931
|
readonly events: TeleBoxManagerEvents;
|
|
898
932
|
protected _sideEffect: SideEffectManager;
|
|
899
933
|
protected root: HTMLElement;
|
|
@@ -912,8 +946,8 @@ declare class TeleBoxManager {
|
|
|
912
946
|
get lastNotMinimizedBoxesStatus(): ReadonlyMap<string, NotMinimizedBoxState>;
|
|
913
947
|
setBoxesStatus(boxesStatus: Map<string, TeleBoxState>, skipUpdate?: boolean): void;
|
|
914
948
|
getBoxesStatus(): Map<string, TeleBoxState>;
|
|
915
|
-
|
|
916
|
-
|
|
949
|
+
protected effectBoxStatusChange(): void;
|
|
950
|
+
protected effectBoxesStatusTimerFunc(skipUpdate: boolean): void;
|
|
917
951
|
effectBoxesStatusChange(skipUpdate?: boolean): Promise<void>;
|
|
918
952
|
hasBoxesStatus(): boolean;
|
|
919
953
|
hasMinimizedBox(): boolean;
|
|
@@ -924,13 +958,16 @@ declare class TeleBoxManager {
|
|
|
924
958
|
getLastNotMinimizedBoxStatus(boxId: string): NotMinimizedBoxState | undefined;
|
|
925
959
|
setLastNotMinimizedBoxStatus(boxId: string, lastNotMinimizedBoxStatus?: NotMinimizedBoxState, skipUpdate?: boolean): void;
|
|
926
960
|
setLastNotMinimizedBoxesStatus(lastNotMinimizedBoxesStatus: Map<string, NotMinimizedBoxState>, skipUpdate?: boolean): void;
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
961
|
+
protected effectLastNotMinimizedBoxStatusChange(skipUpdate?: boolean): Promise<void>;
|
|
962
|
+
protected effectLastNotMinimizedBoxStatusFunc(skipUpdate?: boolean): void;
|
|
963
|
+
protected getUnabledBoxesStatusZIndex(): number;
|
|
930
964
|
/** Maximized box zIndex range: 100-299 */
|
|
931
965
|
getMaxMaximizedBoxZIndex(): number;
|
|
932
966
|
/** normal box zIndex range: 300-499 */
|
|
933
967
|
getMaxNormalBoxZIndex(): number;
|
|
968
|
+
getMaxForceTopBoxZIndex(): number;
|
|
969
|
+
isForceNormal(box: TeleBox): boolean;
|
|
970
|
+
isForceTop(box: TeleBox): boolean;
|
|
934
971
|
create(config?: TeleBoxManagerCreateConfig, smartPosition?: boolean): ReadonlyTeleBox;
|
|
935
972
|
query(config?: TeleBoxManagerQueryConfig): ReadonlyTeleBox[];
|
|
936
973
|
queryOne(config?: TeleBoxManagerQueryConfig): ReadonlyTeleBox | undefined;
|
|
@@ -957,7 +994,7 @@ declare class TeleBoxManager {
|
|
|
957
994
|
protected updateBox(box: TeleBox, config: TeleBoxManagerUpdateConfig, skipUpdate?: boolean): void;
|
|
958
995
|
protected smartPosition(config?: TeleBoxConfig): TeleBoxConfig;
|
|
959
996
|
protected makeBoxTop(box: TeleBox, skipUpdate?: boolean): void;
|
|
960
|
-
|
|
997
|
+
protected getMaximizedTopBox(): MaxTitleBarTeleBox | undefined;
|
|
961
998
|
protected makeMaximizedTopBoxFocus(): void;
|
|
962
999
|
protected getBoxIndex(boxOrID: TeleBox | string): number;
|
|
963
1000
|
getBox(boxOrID: TeleBox | string): TeleBox | undefined;
|
package/dist/style.css
CHANGED
|
@@ -1185,6 +1185,8 @@ var TELE_BOX_EVENT = /* @__PURE__ */ ((TELE_BOX_EVENT2) => {
|
|
|
1185
1185
|
TELE_BOX_EVENT2["Destroyed"] = "destroyed";
|
|
1186
1186
|
TELE_BOX_EVENT2["BoxStatus"] = "box_status";
|
|
1187
1187
|
TELE_BOX_EVENT2["LastNotMinimizedBoxStatus"] = "last_not_minimized_box_status";
|
|
1188
|
+
TELE_BOX_EVENT2["ForceTop"] = "force_top";
|
|
1189
|
+
TELE_BOX_EVENT2["ForceNormal"] = "force_normal";
|
|
1188
1190
|
return TELE_BOX_EVENT2;
|
|
1189
1191
|
})(TELE_BOX_EVENT || {});
|
|
1190
1192
|
var TELE_BOX_DELEGATE_EVENT = /* @__PURE__ */ ((TELE_BOX_DELEGATE_EVENT2) => {
|
|
@@ -1239,7 +1241,9 @@ class DefaultTitleBar {
|
|
|
1239
1241
|
onDragStart,
|
|
1240
1242
|
namespace = "telebox",
|
|
1241
1243
|
state = TELE_BOX_STATE.Normal,
|
|
1242
|
-
boxStatus
|
|
1244
|
+
boxStatus,
|
|
1245
|
+
forceTop = false,
|
|
1246
|
+
forceNormal = false
|
|
1243
1247
|
} = {}) {
|
|
1244
1248
|
this.$btns = [];
|
|
1245
1249
|
this.sideEffect = new o();
|
|
@@ -1313,7 +1317,14 @@ class DefaultTitleBar {
|
|
|
1313
1317
|
this.title = title;
|
|
1314
1318
|
this.state = state;
|
|
1315
1319
|
this.boxStatus = boxStatus;
|
|
1316
|
-
this.
|
|
1320
|
+
this.forceTop = forceTop;
|
|
1321
|
+
this.forceNormal = forceNormal;
|
|
1322
|
+
this.buttons = buttons || (forceNormal ? [
|
|
1323
|
+
{
|
|
1324
|
+
type: TELE_BOX_DELEGATE_EVENT.Close,
|
|
1325
|
+
iconClassName: this.wrapClassName("titlebar-icon-close")
|
|
1326
|
+
}
|
|
1327
|
+
] : [
|
|
1317
1328
|
{
|
|
1318
1329
|
type: TELE_BOX_DELEGATE_EVENT.Minimize,
|
|
1319
1330
|
iconClassName: this.wrapClassName("titlebar-icon-minimize")
|
|
@@ -1327,7 +1338,7 @@ class DefaultTitleBar {
|
|
|
1327
1338
|
type: TELE_BOX_DELEGATE_EVENT.Close,
|
|
1328
1339
|
iconClassName: this.wrapClassName("titlebar-icon-close")
|
|
1329
1340
|
}
|
|
1330
|
-
];
|
|
1341
|
+
]);
|
|
1331
1342
|
this.$dragArea = this.renderDragArea();
|
|
1332
1343
|
}
|
|
1333
1344
|
setTitle(title) {
|
|
@@ -1500,7 +1511,10 @@ class TeleBox {
|
|
|
1500
1511
|
},
|
|
1501
1512
|
collectorRect,
|
|
1502
1513
|
boxStatus,
|
|
1503
|
-
lastNotMinimizedBoxStatus
|
|
1514
|
+
lastNotMinimizedBoxStatus,
|
|
1515
|
+
forceTop = false,
|
|
1516
|
+
forceNormal = false,
|
|
1517
|
+
isDragContent = false
|
|
1504
1518
|
} = {}) {
|
|
1505
1519
|
this._renderSideEffect = new o();
|
|
1506
1520
|
this.handleTrackStart = (ev) => {
|
|
@@ -1567,6 +1581,19 @@ class TeleBox {
|
|
|
1567
1581
|
});
|
|
1568
1582
|
const containerRect$ = createVal(containerRect, shallowequal);
|
|
1569
1583
|
const collectorRect$ = createVal(collectorRect, shallowequal);
|
|
1584
|
+
const forceTop$ = createVal(forceTop);
|
|
1585
|
+
forceTop$.reaction((forceTop2, _, skipUpdate) => {
|
|
1586
|
+
if (!skipUpdate) {
|
|
1587
|
+
this.events.emit(TELE_BOX_EVENT.ForceTop, forceTop2 || false);
|
|
1588
|
+
}
|
|
1589
|
+
});
|
|
1590
|
+
const forceNormal$ = createVal(forceNormal);
|
|
1591
|
+
forceNormal$.reaction((forceNormal2, _, skipUpdate) => {
|
|
1592
|
+
if (!skipUpdate) {
|
|
1593
|
+
this.events.emit(TELE_BOX_EVENT.ForceNormal, forceNormal2 || false);
|
|
1594
|
+
}
|
|
1595
|
+
});
|
|
1596
|
+
const isDragContent$ = createVal(isDragContent);
|
|
1570
1597
|
const title$ = createVal(title);
|
|
1571
1598
|
title$.reaction((title2, _, skipUpdate) => {
|
|
1572
1599
|
if (!skipUpdate) {
|
|
@@ -1744,6 +1771,8 @@ class TeleBox {
|
|
|
1744
1771
|
title: title$.value,
|
|
1745
1772
|
namespace: this.namespace,
|
|
1746
1773
|
boxStatus: boxStatus$.value,
|
|
1774
|
+
forceTop: forceTop$.value,
|
|
1775
|
+
forceNormal: forceNormal$.value,
|
|
1747
1776
|
onDragStart: (event) => {
|
|
1748
1777
|
var _a;
|
|
1749
1778
|
return (_a = this._handleTrackStart) == null ? void 0 : _a.call(this, event);
|
|
@@ -1807,7 +1836,10 @@ class TeleBox {
|
|
|
1807
1836
|
maximized: maximized$,
|
|
1808
1837
|
$userContent: $userContent$,
|
|
1809
1838
|
$userFooter: $userFooter$,
|
|
1810
|
-
$userStyles: $userStyles
|
|
1839
|
+
$userStyles: $userStyles$,
|
|
1840
|
+
forceTop: forceTop$,
|
|
1841
|
+
forceNormal: forceNormal$,
|
|
1842
|
+
isDragContent: isDragContent$
|
|
1811
1843
|
};
|
|
1812
1844
|
i(this, valConfig);
|
|
1813
1845
|
this._state$ = state$;
|
|
@@ -2144,6 +2176,9 @@ class TeleBox {
|
|
|
2144
2176
|
const $content = document.createElement("div");
|
|
2145
2177
|
$content.className = this.wrapClassName("content") + " tele-fancy-scrollbar";
|
|
2146
2178
|
this.$content = $content;
|
|
2179
|
+
if (this.isDragContent) {
|
|
2180
|
+
this.$content.appendChild(this.titleBar.$dragArea);
|
|
2181
|
+
}
|
|
2147
2182
|
this._renderSideEffect.add(() => {
|
|
2148
2183
|
let last$userStyles;
|
|
2149
2184
|
return this._$userStyles$.subscribe(($userStyles) => {
|
|
@@ -2573,6 +2608,7 @@ class TeleBoxCollector {
|
|
|
2573
2608
|
return `${this.namespace}-${className}`;
|
|
2574
2609
|
}
|
|
2575
2610
|
}
|
|
2611
|
+
TeleBoxCollector.kind = "TeleBoxCollector";
|
|
2576
2612
|
var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
|
|
2577
2613
|
TELE_BOX_MANAGER_EVENT2["Focused"] = "focused";
|
|
2578
2614
|
TELE_BOX_MANAGER_EVENT2["Blurred"] = "blurred";
|
|
@@ -2621,7 +2657,7 @@ class MaxTitleBar extends DefaultTitleBar {
|
|
|
2621
2657
|
if (this.getBoxesStatus) {
|
|
2622
2658
|
const boxesStatus = this.getBoxesStatus();
|
|
2623
2659
|
if (boxesStatus) {
|
|
2624
|
-
return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized);
|
|
2660
|
+
return this.boxes.filter((box) => boxesStatus && boxesStatus.get(box.id) === TELE_BOX_STATE.Maximized && !box.forceTop);
|
|
2625
2661
|
}
|
|
2626
2662
|
}
|
|
2627
2663
|
return [];
|
|
@@ -2900,7 +2936,6 @@ class AppMenu {
|
|
|
2900
2936
|
createMinimizedItem(appId) {
|
|
2901
2937
|
const appItem = document.createElement("div");
|
|
2902
2938
|
appItem.classList.add(this.c("app-menu-item"));
|
|
2903
|
-
console.log("appId=====>", appId);
|
|
2904
2939
|
appItem.setAttribute(`data-${this.c("app-id")}`, appId);
|
|
2905
2940
|
const titleDiv = document.createElement("div");
|
|
2906
2941
|
titleDiv.classList.add(this.c("app-menu-item-title"));
|
|
@@ -2962,9 +2997,11 @@ class TeleBoxManager {
|
|
|
2962
2997
|
this.boxes$ = createVal([]);
|
|
2963
2998
|
this.topBox$ = this.boxes$.derive((boxes) => {
|
|
2964
2999
|
if (boxes.length > 0) {
|
|
2965
|
-
console.log("topBox===>topBox$===>000");
|
|
2966
3000
|
let currentTopBox = void 0;
|
|
2967
3001
|
const topBox = boxes.reduce((topBox2, box) => {
|
|
3002
|
+
if (box.forceTop) {
|
|
3003
|
+
return topBox2;
|
|
3004
|
+
}
|
|
2968
3005
|
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Minimized) {
|
|
2969
3006
|
return topBox2;
|
|
2970
3007
|
}
|
|
@@ -2974,7 +3011,6 @@ class TeleBoxManager {
|
|
|
2974
3011
|
}
|
|
2975
3012
|
return topBox2.zIndex > box.zIndex ? topBox2 : box;
|
|
2976
3013
|
}, currentTopBox);
|
|
2977
|
-
console.log("topBox===>topBox$===>end", topBox == null ? void 0 : topBox.id);
|
|
2978
3014
|
return topBox;
|
|
2979
3015
|
}
|
|
2980
3016
|
return;
|
|
@@ -3171,7 +3207,6 @@ class TeleBoxManager {
|
|
|
3171
3207
|
this.makeMaximizedTopBoxFocus();
|
|
3172
3208
|
}
|
|
3173
3209
|
}
|
|
3174
|
-
console.log("checkFocusBox===>", box.id);
|
|
3175
3210
|
this.focusBox(box);
|
|
3176
3211
|
return;
|
|
3177
3212
|
}
|
|
@@ -3317,6 +3352,21 @@ class TeleBoxManager {
|
|
|
3317
3352
|
get topBox() {
|
|
3318
3353
|
return this.topBox$.value;
|
|
3319
3354
|
}
|
|
3355
|
+
get forceTopBoxes() {
|
|
3356
|
+
return this.boxes.find((box) => box.forceTop);
|
|
3357
|
+
}
|
|
3358
|
+
get maxForceTopBox() {
|
|
3359
|
+
return this.boxes.reduce((maxTopBox, box) => {
|
|
3360
|
+
var _a;
|
|
3361
|
+
if (box.forceTop && box.zIndex > ((_a = maxTopBox == null ? void 0 : maxTopBox.zIndex) != null ? _a : 0)) {
|
|
3362
|
+
return box;
|
|
3363
|
+
}
|
|
3364
|
+
return maxTopBox;
|
|
3365
|
+
}, void 0);
|
|
3366
|
+
}
|
|
3367
|
+
get forceNormalBoxes() {
|
|
3368
|
+
return this.boxes.find((box) => box.forceNormal);
|
|
3369
|
+
}
|
|
3320
3370
|
get darkMode() {
|
|
3321
3371
|
return this._darkMode$.value;
|
|
3322
3372
|
}
|
|
@@ -3403,14 +3453,13 @@ class TeleBoxManager {
|
|
|
3403
3453
|
var _a;
|
|
3404
3454
|
const boxStatus = this.boxesStatus$.get(box.id);
|
|
3405
3455
|
if (boxStatus) {
|
|
3406
|
-
if (boxStatus !== TELE_BOX_STATE.Minimized && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
|
|
3456
|
+
if (boxStatus !== TELE_BOX_STATE.Minimized && !this.isForceTop(box) && box.zIndex > ((_a = newTopBox == null ? void 0 : newTopBox.zIndex) != null ? _a : 0)) {
|
|
3407
3457
|
newTopBox = box;
|
|
3408
3458
|
}
|
|
3409
3459
|
box.setBoxStatus(boxStatus, skipUpdate);
|
|
3410
3460
|
}
|
|
3411
3461
|
});
|
|
3412
3462
|
this.effectBoxStatusChange();
|
|
3413
|
-
console.log("effectBoxesStatusTimerFunc===>newTopBox", newTopBox, curTopBox);
|
|
3414
3463
|
if (newTopBox && curTopBox !== newTopBox) {
|
|
3415
3464
|
this.topBox$.setValue(newTopBox);
|
|
3416
3465
|
}
|
|
@@ -3419,7 +3468,7 @@ class TeleBoxManager {
|
|
|
3419
3468
|
}
|
|
3420
3469
|
}
|
|
3421
3470
|
async effectBoxesStatusChange(skipUpdate = false) {
|
|
3422
|
-
var _a, _b
|
|
3471
|
+
var _a, _b;
|
|
3423
3472
|
if (!this.useBoxesStatus) {
|
|
3424
3473
|
if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.timer) {
|
|
3425
3474
|
clearTimeout(this.effectBoxesStatusTimer.timer);
|
|
@@ -3434,11 +3483,9 @@ class TeleBoxManager {
|
|
|
3434
3483
|
if (this.effectBoxesStatusTimer.skipUpdate !== skipUpdate) {
|
|
3435
3484
|
clearTimeout(this.effectBoxesStatusTimer.timer);
|
|
3436
3485
|
if (this.effectBoxesStatusTimer.resolve) {
|
|
3437
|
-
console.log("effectBoxStatusTimerFunc===>1111", skipUpdate);
|
|
3438
3486
|
this.effectBoxesStatusTimer.resolve(!!((_b = this.effectBoxesStatusTimer) == null ? void 0 : _b.skipUpdate));
|
|
3439
3487
|
}
|
|
3440
3488
|
this.effectBoxesStatusTimer.skipUpdate = skipUpdate;
|
|
3441
|
-
console.log("effectBoxStatusTimerFunc===>2222", skipUpdate);
|
|
3442
3489
|
} else {
|
|
3443
3490
|
return;
|
|
3444
3491
|
}
|
|
@@ -3454,17 +3501,13 @@ class TeleBoxManager {
|
|
|
3454
3501
|
const _skipUpdate = await new Promise((resolve) => {
|
|
3455
3502
|
this.effectBoxesStatusTimer.resolve = resolve;
|
|
3456
3503
|
this.effectBoxesStatusTimer.timer = setTimeout(() => {
|
|
3457
|
-
var _a2, _b2;
|
|
3458
3504
|
if (this.effectBoxesStatusTimer && this.effectBoxesStatusTimer.resolve) {
|
|
3459
|
-
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 })));
|
|
3460
3505
|
this.effectBoxesStatusTimer.resolve(this.effectBoxesStatusTimer.skipUpdate);
|
|
3461
3506
|
}
|
|
3462
3507
|
}, 100);
|
|
3463
3508
|
});
|
|
3464
|
-
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 })));
|
|
3465
3509
|
this.effectBoxesStatusTimerFunc(_skipUpdate);
|
|
3466
3510
|
this.effectBoxesStatusTimer = void 0;
|
|
3467
|
-
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 })));
|
|
3468
3511
|
}
|
|
3469
3512
|
}
|
|
3470
3513
|
hasBoxesStatus() {
|
|
@@ -3548,11 +3591,9 @@ class TeleBoxManager {
|
|
|
3548
3591
|
clearTimeout(this.effectLastNotMinimizedBoxStatusTimer.timer);
|
|
3549
3592
|
if (this.effectLastNotMinimizedBoxStatusTimer.skipUpdate !== skipUpdate) {
|
|
3550
3593
|
if (this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
3551
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>1111", skipUpdate);
|
|
3552
3594
|
this.effectLastNotMinimizedBoxStatusTimer.resolve(!!((_b = this.effectLastNotMinimizedBoxStatusTimer) == null ? void 0 : _b.skipUpdate));
|
|
3553
3595
|
}
|
|
3554
3596
|
this.effectLastNotMinimizedBoxStatusTimer.skipUpdate = skipUpdate;
|
|
3555
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>2222", skipUpdate);
|
|
3556
3597
|
} else {
|
|
3557
3598
|
return;
|
|
3558
3599
|
}
|
|
@@ -3569,22 +3610,18 @@ class TeleBoxManager {
|
|
|
3569
3610
|
this.effectLastNotMinimizedBoxStatusTimer.resolve = resolve;
|
|
3570
3611
|
this.effectLastNotMinimizedBoxStatusTimer.timer = setTimeout(() => {
|
|
3571
3612
|
if (this.effectLastNotMinimizedBoxStatusTimer && this.effectLastNotMinimizedBoxStatusTimer.resolve) {
|
|
3572
|
-
console.log("effectLastNotMinimizedBoxStatusTimer===>000", skipUpdate);
|
|
3573
3613
|
this.effectLastNotMinimizedBoxStatusTimer.resolve(this.effectLastNotMinimizedBoxStatusTimer.skipUpdate);
|
|
3574
3614
|
}
|
|
3575
3615
|
}, 100);
|
|
3576
3616
|
});
|
|
3577
|
-
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 })));
|
|
3578
3617
|
this.effectLastNotMinimizedBoxStatusFunc(_skipUpdate);
|
|
3579
3618
|
this.effectLastNotMinimizedBoxStatusTimer = void 0;
|
|
3580
|
-
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 })));
|
|
3581
3619
|
}
|
|
3582
3620
|
}
|
|
3583
3621
|
effectLastNotMinimizedBoxStatusFunc(skipUpdate = false) {
|
|
3584
3622
|
if (!this.useBoxesStatus) {
|
|
3585
3623
|
return;
|
|
3586
3624
|
}
|
|
3587
|
-
console.log("effectLastNotMinimizedBoxStatusFunc===>end", skipUpdate);
|
|
3588
3625
|
this.boxes.forEach((box) => {
|
|
3589
3626
|
const boxStatus = this.lastNotMinimizedBoxesStatus$.get(box.id);
|
|
3590
3627
|
if (boxStatus) {
|
|
@@ -3600,7 +3637,7 @@ class TeleBoxManager {
|
|
|
3600
3637
|
return this.getUnabledBoxesStatusZIndex();
|
|
3601
3638
|
}
|
|
3602
3639
|
return this.boxes.reduce((maxZIndex, box) => {
|
|
3603
|
-
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3640
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Maximized && !this.isForceTop(box)) {
|
|
3604
3641
|
return Math.max(maxZIndex, box.zIndex);
|
|
3605
3642
|
}
|
|
3606
3643
|
return maxZIndex;
|
|
@@ -3611,17 +3648,32 @@ class TeleBoxManager {
|
|
|
3611
3648
|
return this.getUnabledBoxesStatusZIndex();
|
|
3612
3649
|
}
|
|
3613
3650
|
return this.boxes.reduce((maxZIndex, box) => {
|
|
3614
|
-
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal) {
|
|
3651
|
+
if (box.boxStatus && box.boxStatus === TELE_BOX_STATE.Normal && !this.isForceTop(box)) {
|
|
3615
3652
|
return Math.max(maxZIndex, box.zIndex);
|
|
3616
3653
|
}
|
|
3617
3654
|
return maxZIndex;
|
|
3618
3655
|
}, 299);
|
|
3619
3656
|
}
|
|
3657
|
+
getMaxForceTopBoxZIndex() {
|
|
3658
|
+
if (!this.useBoxesStatus) {
|
|
3659
|
+
return this.getUnabledBoxesStatusZIndex();
|
|
3660
|
+
}
|
|
3661
|
+
return this.boxes.reduce((maxZIndex, box) => {
|
|
3662
|
+
if (box.boxStatus && this.isForceTop(box)) {
|
|
3663
|
+
return Math.max(maxZIndex, box.zIndex);
|
|
3664
|
+
}
|
|
3665
|
+
return maxZIndex;
|
|
3666
|
+
}, 699);
|
|
3667
|
+
}
|
|
3668
|
+
isForceNormal(box) {
|
|
3669
|
+
return box._forceNormal$.value;
|
|
3670
|
+
}
|
|
3671
|
+
isForceTop(box) {
|
|
3672
|
+
return box._forceTop$.value;
|
|
3673
|
+
}
|
|
3620
3674
|
create(config = {}, smartPosition = true) {
|
|
3621
|
-
var _a;
|
|
3622
|
-
console.log("create===>", config, (_a = this.topBox) == null ? void 0 : _a.zIndex);
|
|
3623
3675
|
const box = new TeleBox({
|
|
3624
|
-
zIndex: this.getMaxNormalBoxZIndex() + 1,
|
|
3676
|
+
zIndex: config.forceTop ? this.getMaxForceTopBoxZIndex() + 1 : this.getMaxNormalBoxZIndex() + 1,
|
|
3625
3677
|
...smartPosition ? this.smartPosition(config) : config,
|
|
3626
3678
|
darkMode: this.darkMode,
|
|
3627
3679
|
prefersColorScheme: this.prefersColorScheme,
|
|
@@ -3649,15 +3701,17 @@ class TeleBoxManager {
|
|
|
3649
3701
|
}
|
|
3650
3702
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
|
|
3651
3703
|
if (this.useBoxesStatus && box.boxStatus) {
|
|
3704
|
+
if (box._forceNormal$.value) {
|
|
3705
|
+
return;
|
|
3706
|
+
}
|
|
3652
3707
|
if (box.boxStatus === TELE_BOX_STATE.Maximized) {
|
|
3653
3708
|
this.setBox(box.id, {
|
|
3654
3709
|
status: TELE_BOX_STATE.Normal,
|
|
3655
3710
|
zIndex: this.getMaxNormalBoxZIndex() + 1
|
|
3656
3711
|
}, false);
|
|
3657
3712
|
} else {
|
|
3658
|
-
[...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
|
|
3713
|
+
[...this.boxes].filter((box2) => box2.boxStatus === TELE_BOX_STATE.Normal && !this.isForceNormal(box2)).sort((a, b) => a.zIndex - b.zIndex).forEach((box2) => {
|
|
3659
3714
|
if (box2.boxStatus === TELE_BOX_STATE.Normal) {
|
|
3660
|
-
console.log("maximized===>", box2.id);
|
|
3661
3715
|
this.setBox(box2.id, {
|
|
3662
3716
|
status: TELE_BOX_STATE.Maximized,
|
|
3663
3717
|
zIndex: this.getMaxMaximizedBoxZIndex() + 1
|
|
@@ -3672,6 +3726,9 @@ class TeleBoxManager {
|
|
|
3672
3726
|
});
|
|
3673
3727
|
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
|
|
3674
3728
|
if (box.boxStatus && this.useBoxesStatus) {
|
|
3729
|
+
if (box._forceNormal$.value) {
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3675
3732
|
if (box.focus) {
|
|
3676
3733
|
this.blurBox(box);
|
|
3677
3734
|
}
|
|
@@ -3719,9 +3776,11 @@ class TeleBoxManager {
|
|
|
3719
3776
|
});
|
|
3720
3777
|
box._zIndex$.reaction((_, __, skipUpdate) => {
|
|
3721
3778
|
if (this.boxes.length > 0) {
|
|
3722
|
-
console.log("topBox===>_zIndex", this.boxes.map((box2) => ({ id: box2.id, zIndex: box2.zIndex, boxStatus: box2.boxStatus })));
|
|
3723
3779
|
let currentTopBox = void 0;
|
|
3724
3780
|
const topBox = this.boxes.reduce((topBox2, box2) => {
|
|
3781
|
+
if (this.isForceTop(box2)) {
|
|
3782
|
+
return topBox2;
|
|
3783
|
+
}
|
|
3725
3784
|
if (box2.boxStatus && box2.boxStatus === TELE_BOX_STATE.Minimized) {
|
|
3726
3785
|
return topBox2;
|
|
3727
3786
|
}
|
|
@@ -3731,7 +3790,6 @@ class TeleBoxManager {
|
|
|
3731
3790
|
}
|
|
3732
3791
|
return topBox2.zIndex > box2.zIndex ? topBox2 : box2;
|
|
3733
3792
|
}, currentTopBox);
|
|
3734
|
-
console.log("topBox===>_zIndex===>end", topBox == null ? void 0 : topBox.id);
|
|
3735
3793
|
this.topBox$.setValue(topBox);
|
|
3736
3794
|
}
|
|
3737
3795
|
if (!skipUpdate) {
|
|
@@ -3952,13 +4010,27 @@ class TeleBoxManager {
|
|
|
3952
4010
|
lastNotMinimizedBoxStatus: config.lastNotMinimizedBoxStatus
|
|
3953
4011
|
}, skipUpdate);
|
|
3954
4012
|
}
|
|
4013
|
+
if (config.forceTop != null) {
|
|
4014
|
+
box.setForceTop(config.forceTop, skipUpdate);
|
|
4015
|
+
}
|
|
4016
|
+
if (config.forceNormal != null) {
|
|
4017
|
+
box.setForceNormal(config.forceNormal, skipUpdate);
|
|
4018
|
+
}
|
|
3955
4019
|
}
|
|
3956
4020
|
smartPosition(config = {}) {
|
|
3957
4021
|
let { x, y } = config;
|
|
3958
4022
|
const { width = 0.5, height = 0.5 } = config;
|
|
3959
4023
|
if (x == null) {
|
|
3960
4024
|
let vx = 20;
|
|
3961
|
-
if (
|
|
4025
|
+
if (config.forceTop) {
|
|
4026
|
+
const forceTopBox = this.maxForceTopBox || this.topBox;
|
|
4027
|
+
if (forceTopBox) {
|
|
4028
|
+
vx = forceTopBox.intrinsicX * this.containerRect.width + 20;
|
|
4029
|
+
if (vx > this.containerRect.width - width * this.containerRect.width) {
|
|
4030
|
+
vx = 20;
|
|
4031
|
+
}
|
|
4032
|
+
}
|
|
4033
|
+
} else if (this.topBox) {
|
|
3962
4034
|
vx = this.topBox.intrinsicX * this.containerRect.width + 20;
|
|
3963
4035
|
if (vx > this.containerRect.width - width * this.containerRect.width) {
|
|
3964
4036
|
vx = 20;
|
|
@@ -3972,7 +4044,15 @@ class TeleBoxManager {
|
|
|
3972
4044
|
}
|
|
3973
4045
|
if (y == null) {
|
|
3974
4046
|
let vy = 20;
|
|
3975
|
-
if (
|
|
4047
|
+
if (config.forceTop) {
|
|
4048
|
+
const forceTopBox = this.maxForceTopBox || this.topBox;
|
|
4049
|
+
if (forceTopBox) {
|
|
4050
|
+
vy = forceTopBox.intrinsicY * this.containerRect.height + 20;
|
|
4051
|
+
if (vy > this.containerRect.height - height * this.containerRect.height) {
|
|
4052
|
+
vy = 20;
|
|
4053
|
+
}
|
|
4054
|
+
}
|
|
4055
|
+
} else if (this.topBox) {
|
|
3976
4056
|
vy = this.topBox.intrinsicY * this.containerRect.height + 20;
|
|
3977
4057
|
if (vy > this.containerRect.height - height * this.containerRect.height) {
|
|
3978
4058
|
vy = 20;
|
|
@@ -4014,9 +4094,7 @@ class TeleBoxManager {
|
|
|
4014
4094
|
return;
|
|
4015
4095
|
}
|
|
4016
4096
|
const maximizedBox = this.getMaximizedTopBox();
|
|
4017
|
-
console.log("makeMaximizedTopBoxFocus===>", maximizedBox == null ? void 0 : maximizedBox.id);
|
|
4018
4097
|
this.maxTitleBar.focusBox(maximizedBox);
|
|
4019
|
-
console.log("makeMaximizedTopBoxFocus===>end", maximizedBox == null ? void 0 : maximizedBox.id);
|
|
4020
4098
|
}
|
|
4021
4099
|
getBoxIndex(boxOrID) {
|
|
4022
4100
|
return typeof boxOrID === "string" ? this.boxes.findIndex((box) => box.id === boxOrID) : this.boxes.findIndex((box) => box === boxOrID);
|
|
@@ -4039,6 +4117,7 @@ class TeleBoxManager {
|
|
|
4039
4117
|
return;
|
|
4040
4118
|
}
|
|
4041
4119
|
}
|
|
4120
|
+
TeleBoxManager.kind = "TeleBoxManager";
|
|
4042
4121
|
exports.DefaultTitleBar = DefaultTitleBar;
|
|
4043
4122
|
exports.TELE_BOX_COLOR_SCHEME = TELE_BOX_COLOR_SCHEME;
|
|
4044
4123
|
exports.TELE_BOX_DELEGATE_EVENT = TELE_BOX_DELEGATE_EVENT;
|