@netless/telebox-insider 0.3.0-beta.9 → 0.3.1-beta.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 +73 -25
- package/dist/style.css +4 -1
- package/dist/telebox-insider.cjs.js +382 -122
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +382 -122
- 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 +122 -20
- package/src/TeleBox/typings.ts +18 -2
- 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 +475 -190
- package/src/TeleBoxManager/typings.ts +10 -3
- package/src/TeleTitleBar/DefaultTitleBar/index.ts +72 -22
- package/src/TeleTitleBar/DefaultTitleBar/style.scss +5 -0
- package/src/TeleTitleBar/typings.ts +6 -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,13 @@ 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
|
+
readonly forceMaximized?: boolean;
|
|
391
|
+
/** Is drag content. */
|
|
392
|
+
readonly isDragContent?: boolean;
|
|
384
393
|
}
|
|
385
394
|
type CheckTeleBoxConfig<T extends Record<`${TELE_BOX_EVENT}`, any>> = T;
|
|
386
395
|
type TeleBoxEventConfig = CheckTeleBoxConfig<{
|
|
@@ -423,6 +432,9 @@ type TeleBoxEventConfig = CheckTeleBoxConfig<{
|
|
|
423
432
|
id: string;
|
|
424
433
|
lastNotMinimizedBoxStatus?: NotMinimizedBoxState;
|
|
425
434
|
};
|
|
435
|
+
force_normal: boolean;
|
|
436
|
+
force_maximized: boolean;
|
|
437
|
+
force_top: boolean;
|
|
426
438
|
}>;
|
|
427
439
|
type TeleBoxEvent = keyof TeleBoxEventConfig;
|
|
428
440
|
interface TeleBoxEvents extends EventEmitter<TeleBoxEvent> {
|
|
@@ -460,13 +472,18 @@ interface TeleTitleBarConfig {
|
|
|
460
472
|
title?: string;
|
|
461
473
|
state?: TeleBoxState;
|
|
462
474
|
namespace?: string;
|
|
475
|
+
forceTop?: boolean;
|
|
476
|
+
forceNormal?: boolean;
|
|
477
|
+
forceMaximized?: boolean;
|
|
463
478
|
onEvent?: (event: TeleTitleBarEvent) => void;
|
|
464
479
|
onDragStart?: (event: MouseEvent | TouchEvent) => void;
|
|
465
480
|
}
|
|
466
481
|
interface TeleTitleBar {
|
|
482
|
+
readonly $dragArea: HTMLElement;
|
|
467
483
|
setTitle(title: string): void;
|
|
468
484
|
setState(state: TeleBoxState): void;
|
|
469
485
|
setReadonly(readonly: boolean): void;
|
|
486
|
+
setForceMaximized(forceMaximized: boolean): void;
|
|
470
487
|
render(): HTMLElement;
|
|
471
488
|
destroy(): void;
|
|
472
489
|
setBoxStatus(boxStatus?: TeleBoxState): void;
|
|
@@ -482,15 +499,19 @@ interface DefaultTitleBarConfig extends TeleTitleBarConfig {
|
|
|
482
499
|
}
|
|
483
500
|
declare class DefaultTitleBar implements TeleTitleBar {
|
|
484
501
|
protected boxStatus?: TeleBoxState;
|
|
485
|
-
|
|
502
|
+
protected forceTop?: boolean;
|
|
503
|
+
protected forceNormal?: boolean;
|
|
504
|
+
protected forceMaximized?: boolean;
|
|
505
|
+
constructor({ readonly, title, buttons, onEvent, onDragStart, namespace, state, boxStatus, forceTop, forceNormal, forceMaximized, }?: DefaultTitleBarConfig);
|
|
486
506
|
readonly namespace: string;
|
|
487
507
|
$titleBar: HTMLElement | undefined;
|
|
488
508
|
$title: HTMLElement | undefined;
|
|
489
|
-
$dragArea: HTMLElement;
|
|
509
|
+
readonly $dragArea: HTMLElement;
|
|
490
510
|
setTitle(title: string): void;
|
|
491
511
|
setState(state: TeleBoxState): void;
|
|
492
512
|
setBoxStatus(boxStatus?: TeleBoxState): void;
|
|
493
513
|
setReadonly(readonly: boolean): void;
|
|
514
|
+
setForceMaximized(forceMaximized: boolean): void;
|
|
494
515
|
render(): HTMLElement;
|
|
495
516
|
renderDragArea(): HTMLElement;
|
|
496
517
|
dragHandle(): HTMLElement | undefined;
|
|
@@ -546,11 +567,19 @@ type ValConfig$1 = {
|
|
|
546
567
|
$userContent: Val<HTMLElement | undefined>;
|
|
547
568
|
$userFooter: Val<HTMLElement | undefined>;
|
|
548
569
|
$userStyles: Val<HTMLStyleElement | undefined>;
|
|
570
|
+
/** Force top. */
|
|
571
|
+
forceTop: Val<boolean, boolean>;
|
|
572
|
+
/** Force normal. */
|
|
573
|
+
forceNormal: Val<boolean, boolean>;
|
|
574
|
+
/** Force maximized room policy. */
|
|
575
|
+
forceMaximized: Val<boolean, boolean>;
|
|
576
|
+
/** Drag content. */
|
|
577
|
+
isDragContent: Val<boolean, boolean>;
|
|
549
578
|
};
|
|
550
579
|
interface TeleBox extends ValEnhancedResult<ValConfig$1> {
|
|
551
580
|
}
|
|
552
581
|
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);
|
|
582
|
+
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, forceMaximized, isDragContent, }?: TeleBoxConfig);
|
|
554
583
|
readonly id: string;
|
|
555
584
|
/** ClassName Prefix. For CSS styling. Default "telebox" */
|
|
556
585
|
readonly namespace: string;
|
|
@@ -703,6 +732,7 @@ interface TeleBoxCollectorConfig {
|
|
|
703
732
|
getBoxesStatus?: () => Map<string, TeleBoxState>;
|
|
704
733
|
}
|
|
705
734
|
declare class TeleBoxCollector {
|
|
735
|
+
static readonly kind = "TeleBoxCollector";
|
|
706
736
|
getBoxesStatus?: () => Map<string, TeleBoxState>;
|
|
707
737
|
constructor({ visible, readonly, darkMode, namespace, styles, onClick, getBoxesStatus }: TeleBoxCollectorConfig);
|
|
708
738
|
get boxesStatus(): Map<string, TeleBoxState> | undefined;
|
|
@@ -722,7 +752,7 @@ declare class TeleBoxCollector {
|
|
|
722
752
|
* Unmount collector from the root element.
|
|
723
753
|
*/
|
|
724
754
|
unmount(): this;
|
|
725
|
-
|
|
755
|
+
protected hasMinimizedBox(): boolean;
|
|
726
756
|
updateBoxesStatus(): void;
|
|
727
757
|
setVisible(visible: boolean): this;
|
|
728
758
|
setReadonly(readonly: boolean): this;
|
|
@@ -757,7 +787,7 @@ declare enum TELE_BOX_MANAGER_EVENT {
|
|
|
757
787
|
LastNotMinimizedBoxStatus = "last_not_minimized_box_status"
|
|
758
788
|
}
|
|
759
789
|
|
|
760
|
-
interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "prefersColorScheme" | "fence" | "containerRect" | "maximized" | "minimized" | "namespace" | "readonly"> {
|
|
790
|
+
interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "prefersColorScheme" | "fence" | "containerRect" | "maximized" | "minimized" | "namespace" | "readonly" | "forceMaximized"> {
|
|
761
791
|
/** Element to mount boxes. */
|
|
762
792
|
root?: HTMLElement;
|
|
763
793
|
/** Where the minimized boxes go. */
|
|
@@ -765,7 +795,7 @@ interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "prefersColorScheme"
|
|
|
765
795
|
/** Whether to use boxes status. */
|
|
766
796
|
useBoxesStatus?: boolean;
|
|
767
797
|
}
|
|
768
|
-
type TeleBoxManagerBoxConfigBaseProps = "title" | "visible" | "width" | "height" | "minWidth" | "minHeight" | "x" | "y" | "resizable" | "draggable" | "fixRatio" | "zIndex" | "boxStatus" | "lastNotMinimizedBoxStatus";
|
|
798
|
+
type TeleBoxManagerBoxConfigBaseProps = "title" | "visible" | "width" | "height" | "minWidth" | "minHeight" | "x" | "y" | "resizable" | "draggable" | "fixRatio" | "zIndex" | "boxStatus" | "lastNotMinimizedBoxStatus" | "forceTop" | "forceNormal" | "forceMaximized" | "isDragContent";
|
|
769
799
|
type TeleBoxManagerCreateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "footer" | "id" | "focus">;
|
|
770
800
|
type TeleBoxManagerQueryConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "id" | "focus">;
|
|
771
801
|
type TeleBoxManagerUpdateConfig = Pick<TeleBoxConfig, TeleBoxManagerBoxConfigBaseProps | "content" | "footer">;
|
|
@@ -790,10 +820,12 @@ type TeleBoxManagerEventConfig = CheckTeleBoxManagerConfig<{
|
|
|
790
820
|
id: string;
|
|
791
821
|
boxStatus?: TeleBoxState;
|
|
792
822
|
}];
|
|
793
|
-
last_not_minimized_box_status: [
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
823
|
+
last_not_minimized_box_status: [
|
|
824
|
+
{
|
|
825
|
+
id: string;
|
|
826
|
+
boxStatus?: NotMinimizedBoxState;
|
|
827
|
+
}
|
|
828
|
+
];
|
|
797
829
|
}>;
|
|
798
830
|
type TeleBoxManagerEvent = keyof TeleBoxManagerEventConfig;
|
|
799
831
|
interface TeleBoxManagerEvents extends EventEmitter<TeleBoxManagerEvent> {
|
|
@@ -803,7 +835,7 @@ interface TeleBoxManagerEvents extends EventEmitter<TeleBoxManagerEvent> {
|
|
|
803
835
|
emit<U extends TeleBoxManagerEvent>(event: U, ...value: TeleBoxManagerEventConfig[U]): boolean;
|
|
804
836
|
}
|
|
805
837
|
|
|
806
|
-
type MaxTitleBarTeleBox = Pick<TeleBox, "id" | "title" | "readonly" | "zIndex" | "$box">;
|
|
838
|
+
type MaxTitleBarTeleBox = Pick<TeleBox, "id" | "title" | "readonly" | "zIndex" | "$box" | "forceTop" | "forceNormal">;
|
|
807
839
|
interface MaxTitleBarConfig extends DefaultTitleBarConfig {
|
|
808
840
|
darkMode: boolean;
|
|
809
841
|
boxes: MaxTitleBarTeleBox[];
|
|
@@ -880,20 +912,33 @@ type ValConfig = {
|
|
|
880
912
|
readonly: Val<boolean, boolean>;
|
|
881
913
|
minimized: Val<boolean, boolean>;
|
|
882
914
|
maximized: Val<boolean, boolean>;
|
|
915
|
+
forceMaximized: Val<boolean, boolean>;
|
|
883
916
|
fence: Val<boolean, boolean>;
|
|
884
917
|
};
|
|
885
918
|
interface TeleBoxManager extends ValEnhancedResult<ValConfig> {
|
|
886
919
|
}
|
|
887
920
|
declare class TeleBoxManager {
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
921
|
+
static readonly kind = "TeleBoxManager";
|
|
922
|
+
protected boxesStatus$: Map<string, TeleBoxState>;
|
|
923
|
+
protected lastNotMinimizedBoxesStatus$: Map<string, NotMinimizedBoxState>;
|
|
924
|
+
protected appMenu: AppMenu | undefined;
|
|
925
|
+
protected useBoxesStatus: boolean;
|
|
926
|
+
protected effectBoxesStatusTimer?: {
|
|
927
|
+
skipUpdate: boolean;
|
|
928
|
+
timer: number | undefined;
|
|
929
|
+
resolve?: (skipUpdate: boolean) => void;
|
|
930
|
+
};
|
|
931
|
+
protected effectLastNotMinimizedBoxStatusTimer?: {
|
|
932
|
+
skipUpdate: boolean;
|
|
933
|
+
timer: number | undefined;
|
|
934
|
+
resolve?: (skipUpdate: boolean) => void;
|
|
935
|
+
};
|
|
936
|
+
constructor({ root, prefersColorScheme, minimized, maximized, fence, containerRect, collector, namespace, readonly, forceMaximized, useBoxesStatus, }?: TeleBoxManagerConfig);
|
|
895
937
|
get boxes(): ReadonlyArray<TeleBox>;
|
|
896
938
|
get topBox(): TeleBox | undefined;
|
|
939
|
+
get forceTopBoxes(): TeleBox | undefined;
|
|
940
|
+
get maxForceTopBox(): TeleBox | undefined;
|
|
941
|
+
get forceNormalBoxes(): TeleBox | undefined;
|
|
897
942
|
readonly events: TeleBoxManagerEvents;
|
|
898
943
|
protected _sideEffect: SideEffectManager;
|
|
899
944
|
protected root: HTMLElement;
|
|
@@ -912,8 +957,8 @@ declare class TeleBoxManager {
|
|
|
912
957
|
get lastNotMinimizedBoxesStatus(): ReadonlyMap<string, NotMinimizedBoxState>;
|
|
913
958
|
setBoxesStatus(boxesStatus: Map<string, TeleBoxState>, skipUpdate?: boolean): void;
|
|
914
959
|
getBoxesStatus(): Map<string, TeleBoxState>;
|
|
915
|
-
|
|
916
|
-
|
|
960
|
+
protected effectBoxStatusChange(): void;
|
|
961
|
+
protected effectBoxesStatusTimerFunc(skipUpdate: boolean): void;
|
|
917
962
|
effectBoxesStatusChange(skipUpdate?: boolean): Promise<void>;
|
|
918
963
|
hasBoxesStatus(): boolean;
|
|
919
964
|
hasMinimizedBox(): boolean;
|
|
@@ -924,13 +969,16 @@ declare class TeleBoxManager {
|
|
|
924
969
|
getLastNotMinimizedBoxStatus(boxId: string): NotMinimizedBoxState | undefined;
|
|
925
970
|
setLastNotMinimizedBoxStatus(boxId: string, lastNotMinimizedBoxStatus?: NotMinimizedBoxState, skipUpdate?: boolean): void;
|
|
926
971
|
setLastNotMinimizedBoxesStatus(lastNotMinimizedBoxesStatus: Map<string, NotMinimizedBoxState>, skipUpdate?: boolean): void;
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
972
|
+
protected effectLastNotMinimizedBoxStatusChange(skipUpdate?: boolean): Promise<void>;
|
|
973
|
+
protected effectLastNotMinimizedBoxStatusFunc(skipUpdate?: boolean): void;
|
|
974
|
+
protected getUnabledBoxesStatusZIndex(): number;
|
|
930
975
|
/** Maximized box zIndex range: 100-299 */
|
|
931
976
|
getMaxMaximizedBoxZIndex(): number;
|
|
932
977
|
/** normal box zIndex range: 300-499 */
|
|
933
978
|
getMaxNormalBoxZIndex(): number;
|
|
979
|
+
getMaxForceTopBoxZIndex(): number;
|
|
980
|
+
isForceNormal(box: TeleBox): boolean;
|
|
981
|
+
isForceTop(box: TeleBox): boolean;
|
|
934
982
|
create(config?: TeleBoxManagerCreateConfig, smartPosition?: boolean): ReadonlyTeleBox;
|
|
935
983
|
query(config?: TeleBoxManagerQueryConfig): ReadonlyTeleBox[];
|
|
936
984
|
queryOne(config?: TeleBoxManagerQueryConfig): ReadonlyTeleBox | undefined;
|
|
@@ -957,7 +1005,7 @@ declare class TeleBoxManager {
|
|
|
957
1005
|
protected updateBox(box: TeleBox, config: TeleBoxManagerUpdateConfig, skipUpdate?: boolean): void;
|
|
958
1006
|
protected smartPosition(config?: TeleBoxConfig): TeleBoxConfig;
|
|
959
1007
|
protected makeBoxTop(box: TeleBox, skipUpdate?: boolean): void;
|
|
960
|
-
|
|
1008
|
+
protected getMaximizedTopBox(): MaxTitleBarTeleBox | undefined;
|
|
961
1009
|
protected makeMaximizedTopBoxFocus(): void;
|
|
962
1010
|
protected getBoxIndex(boxOrID: TeleBox | string): number;
|
|
963
1011
|
getBox(boxOrID: TeleBox | string): TeleBox | undefined;
|
package/dist/style.css
CHANGED
|
@@ -311,6 +311,9 @@
|
|
|
311
311
|
background: transparent;
|
|
312
312
|
cursor: pointer;
|
|
313
313
|
}
|
|
314
|
+
.telebox-titlebar-btn:disabled, .telebox-titlebar-btn.telebox-disabled {
|
|
315
|
+
cursor: not-allowed;
|
|
316
|
+
}
|
|
314
317
|
.telebox-titlebar-btn ~ .telebox-titlebar-btn {
|
|
315
318
|
margin-left: 10px;
|
|
316
319
|
}
|
|
@@ -408,7 +411,7 @@
|
|
|
408
411
|
position: absolute;
|
|
409
412
|
top: 0;
|
|
410
413
|
left: 0;
|
|
411
|
-
z-index:
|
|
414
|
+
z-index: 299;
|
|
412
415
|
}
|
|
413
416
|
.telebox-max-titlebar .telebox-title {
|
|
414
417
|
display: none;
|