@netless/telebox-insider 1.0.0-alpha.20 → 1.0.0-alpha.23
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/TeleBox/index.d.ts +6 -2
- package/dist/TeleBox/typings.d.ts +2 -0
- package/dist/TeleBoxManager/MaxTitleBar/index.d.ts +1 -1
- package/dist/TeleBoxManager/typings.d.ts +1 -1
- package/dist/TeleTitleBar/DefaultTitleBar/index.d.ts +1 -7
- package/dist/TeleTitleBar/typings.d.ts +1 -1
- package/dist/style.css +643 -1
- package/dist/telebox-insider.cjs.js +1626 -1
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +1608 -1
- package/dist/telebox-insider.es.js.map +1 -1
- package/dist/utils.d.ts +0 -1
- package/package.json +2 -2
- package/src/TeleBox/index.ts +98 -70
- package/src/TeleBox/style.scss +9 -45
- package/src/TeleBox/style.shadow.scss +88 -0
- package/src/TeleBox/typings.ts +2 -0
- package/src/TeleBoxCollector/index.ts +3 -3
- package/src/TeleBoxCollector/style.scss +9 -3
- package/src/TeleBoxManager/MaxTitleBar/index.ts +2 -20
- package/src/TeleBoxManager/MaxTitleBar/style.scss +33 -14
- package/src/TeleBoxManager/index.ts +49 -55
- package/src/TeleBoxManager/style.scss +23 -6
- package/src/TeleBoxManager/typings.ts +4 -0
- package/src/TeleTitleBar/DefaultTitleBar/index.ts +45 -51
- package/src/TeleTitleBar/DefaultTitleBar/style.scss +68 -11
- package/src/TeleTitleBar/typings.ts +1 -1
- package/src/scss/mixins.scss +5 -0
- package/src/scss/variables.scss +40 -6
- package/src/utils.ts +0 -6
package/dist/utils.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare function clamp(value: number, min: number, max: number): number;
|
|
2
2
|
export declare function preventEvent(ev: Event): void;
|
|
3
|
-
export declare function flattenEvent(ev: MouseEvent | TouchEvent): MouseEvent | Touch;
|
|
4
3
|
export declare function getRandomInt(min: number, max: number): number;
|
|
5
4
|
export declare function getBoxDefaultName(): string;
|
|
6
5
|
export declare function identity<TValue>(value: TValue): TValue;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/telebox-insider",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.23",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Window widget for Whiteboard",
|
|
6
6
|
"license": "MIT",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"sass": "^1.36.0",
|
|
55
55
|
"sass-loader": "^10.1.1",
|
|
56
56
|
"typescript": "^4.1.2",
|
|
57
|
-
"vite": "^2.
|
|
57
|
+
"vite": "^2.9.13"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@juggle/resize-observer": "^3.3.1",
|
package/src/TeleBox/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import "./style.scss";
|
|
2
|
+
import shadowStyles from "./style.shadow.scss?inline";
|
|
2
3
|
|
|
3
4
|
import Emittery from "emittery";
|
|
4
5
|
import styler from "stylefire";
|
|
@@ -19,14 +20,7 @@ import {
|
|
|
19
20
|
import type { TeleTitleBar } from "../TeleTitleBar";
|
|
20
21
|
import { DefaultTitleBar } from "../TeleTitleBar";
|
|
21
22
|
import { ResizeObserver as ResizeObserverPolyfill } from "@juggle/resize-observer";
|
|
22
|
-
import {
|
|
23
|
-
clamp,
|
|
24
|
-
flattenEvent,
|
|
25
|
-
getBoxDefaultName,
|
|
26
|
-
isFalsy,
|
|
27
|
-
isTruthy,
|
|
28
|
-
preventEvent,
|
|
29
|
-
} from "../utils";
|
|
23
|
+
import { clamp, getBoxDefaultName, preventEvent } from "../utils";
|
|
30
24
|
import {
|
|
31
25
|
TELE_BOX_EVENT,
|
|
32
26
|
TELE_BOX_STATE,
|
|
@@ -116,6 +110,7 @@ export class TeleBox {
|
|
|
116
110
|
focus = false,
|
|
117
111
|
zIndex = 100,
|
|
118
112
|
stageRatio = null,
|
|
113
|
+
enableShadowDOM = true,
|
|
119
114
|
titleBar,
|
|
120
115
|
content,
|
|
121
116
|
stage,
|
|
@@ -141,6 +136,7 @@ export class TeleBox {
|
|
|
141
136
|
|
|
142
137
|
this.id = id;
|
|
143
138
|
this.namespace = namespace;
|
|
139
|
+
this.enableShadowDOM = enableShadowDOM;
|
|
144
140
|
|
|
145
141
|
const valManager = new ValManager();
|
|
146
142
|
this._sideEffect.addDisposer(() => valManager.destroy());
|
|
@@ -368,6 +364,9 @@ export class TeleBox {
|
|
|
368
364
|
/** ClassName Prefix. For CSS styling. Default "telebox" */
|
|
369
365
|
public readonly namespace: string;
|
|
370
366
|
|
|
367
|
+
/** Enable shadow DOM for box content. Default true. */
|
|
368
|
+
public readonly enableShadowDOM: boolean;
|
|
369
|
+
|
|
371
370
|
public readonly events = new Emittery<
|
|
372
371
|
TeleBoxEventConfig,
|
|
373
372
|
TeleBoxEventConfig
|
|
@@ -614,6 +613,9 @@ export class TeleBox {
|
|
|
614
613
|
/** DOM of the box */
|
|
615
614
|
public $box: HTMLElement;
|
|
616
615
|
|
|
616
|
+
/** DOM of main area of the box. Including $body and $footer. */
|
|
617
|
+
public $main!: HTMLElement;
|
|
618
|
+
|
|
617
619
|
/** DOM of the box body */
|
|
618
620
|
public $body!: HTMLElement;
|
|
619
621
|
|
|
@@ -640,35 +642,48 @@ export class TeleBox {
|
|
|
640
642
|
return this.$box;
|
|
641
643
|
}
|
|
642
644
|
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
645
|
+
const bindBoxStates = (el: Element, disposerID?: string): string => {
|
|
646
|
+
return this._sideEffect.addDisposer(
|
|
647
|
+
[
|
|
648
|
+
this._readonly$.subscribe((readonly) =>
|
|
649
|
+
el.classList.toggle(
|
|
650
|
+
this.wrapClassName("readonly"),
|
|
651
|
+
readonly
|
|
652
|
+
)
|
|
653
|
+
),
|
|
654
|
+
this._draggable$.subscribe((draggable) =>
|
|
655
|
+
el.classList.toggle(
|
|
656
|
+
this.wrapClassName("no-drag"),
|
|
657
|
+
!draggable
|
|
658
|
+
)
|
|
659
|
+
),
|
|
660
|
+
this._resizable$.subscribe((resizable) =>
|
|
661
|
+
el.classList.toggle(
|
|
662
|
+
this.wrapClassName("no-resize"),
|
|
663
|
+
!resizable
|
|
664
|
+
)
|
|
665
|
+
),
|
|
666
|
+
this._focus$.subscribe((focus) =>
|
|
667
|
+
el.classList.toggle(this.wrapClassName("blur"), !focus)
|
|
668
|
+
),
|
|
669
|
+
this._darkMode$.subscribe((darkMode) => {
|
|
670
|
+
el.classList.toggle(
|
|
671
|
+
this.wrapClassName("color-scheme-dark"),
|
|
672
|
+
darkMode
|
|
673
|
+
);
|
|
674
|
+
el.classList.toggle(
|
|
675
|
+
this.wrapClassName("color-scheme-light"),
|
|
676
|
+
!darkMode
|
|
677
|
+
);
|
|
678
|
+
}),
|
|
679
|
+
],
|
|
680
|
+
disposerID
|
|
681
|
+
);
|
|
659
682
|
};
|
|
660
683
|
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
bindClassName(this.$box, this._focus$, "blur", isFalsy);
|
|
665
|
-
bindClassName(this.$box, this._darkMode$, "color-scheme-dark");
|
|
666
|
-
bindClassName(
|
|
667
|
-
this.$box,
|
|
668
|
-
this._darkMode$,
|
|
669
|
-
"color-scheme-light",
|
|
670
|
-
isFalsy
|
|
671
|
-
);
|
|
684
|
+
this.$box = document.createElement("div");
|
|
685
|
+
this.$box.classList.add(this.wrapClassName("box"));
|
|
686
|
+
bindBoxStates(this.$box, "bind-box-state");
|
|
672
687
|
|
|
673
688
|
this._sideEffect.add(() => {
|
|
674
689
|
const minimizedClassName = this.wrapClassName("minimized");
|
|
@@ -806,7 +821,7 @@ export class TeleBox {
|
|
|
806
821
|
this.$titleBar = $titleBar;
|
|
807
822
|
|
|
808
823
|
const $body = document.createElement("div");
|
|
809
|
-
$body.className = this.wrapClassName("
|
|
824
|
+
$body.className = this.wrapClassName("body-wrap");
|
|
810
825
|
this.$body = $body;
|
|
811
826
|
|
|
812
827
|
const $styles = document.createElement("style");
|
|
@@ -836,8 +851,27 @@ export class TeleBox {
|
|
|
836
851
|
this.$footer = $footer;
|
|
837
852
|
|
|
838
853
|
$boxMain.appendChild($titleBar);
|
|
839
|
-
|
|
840
|
-
$
|
|
854
|
+
|
|
855
|
+
const $main = document.createElement("div");
|
|
856
|
+
$main.className = this.wrapClassName("main");
|
|
857
|
+
this.$main = $main;
|
|
858
|
+
$boxMain.appendChild($main);
|
|
859
|
+
|
|
860
|
+
const $quarantine = document.createElement("div");
|
|
861
|
+
$quarantine.className = this.wrapClassName("quarantine");
|
|
862
|
+
$quarantine.appendChild($body);
|
|
863
|
+
$quarantine.appendChild($footer);
|
|
864
|
+
|
|
865
|
+
if (this.enableShadowDOM) {
|
|
866
|
+
bindBoxStates($quarantine, "bind-quarantine-state");
|
|
867
|
+
const $shadowStyle = document.createElement("style");
|
|
868
|
+
$shadowStyle.textContent = shadowStyles;
|
|
869
|
+
$quarantine.insertBefore($shadowStyle, $quarantine.firstChild);
|
|
870
|
+
const shadow = $main.attachShadow({ mode: "open" });
|
|
871
|
+
shadow.appendChild($quarantine);
|
|
872
|
+
} else {
|
|
873
|
+
$main.appendChild($quarantine);
|
|
874
|
+
}
|
|
841
875
|
|
|
842
876
|
this._renderResizeHandlers();
|
|
843
877
|
|
|
@@ -878,7 +912,7 @@ export class TeleBox {
|
|
|
878
912
|
private _renderStage(): HTMLDivElement {
|
|
879
913
|
const $stage = document.createElement("div");
|
|
880
914
|
|
|
881
|
-
$stage.className = this.wrapClassName("
|
|
915
|
+
$stage.className = this.wrapClassName("box-stage");
|
|
882
916
|
const updateStageRect = (stageRect: TeleBoxRect): void => {
|
|
883
917
|
$stage.style.top = stageRect.y + "px";
|
|
884
918
|
$stage.style.left = stageRect.x + "px";
|
|
@@ -897,14 +931,14 @@ export class TeleBox {
|
|
|
897
931
|
}),
|
|
898
932
|
this._stageRect$.subscribe(updateStageRect),
|
|
899
933
|
],
|
|
900
|
-
"
|
|
934
|
+
"box-stage-styles"
|
|
901
935
|
);
|
|
902
936
|
return $stage;
|
|
903
937
|
}
|
|
904
938
|
|
|
905
|
-
private _handleTrackStart?: (ev:
|
|
939
|
+
private _handleTrackStart?: (ev: PointerEvent) => void;
|
|
906
940
|
|
|
907
|
-
public handleTrackStart: (ev:
|
|
941
|
+
public handleTrackStart: (ev: PointerEvent) => void = (ev) => {
|
|
908
942
|
return this._handleTrackStart?.(ev);
|
|
909
943
|
};
|
|
910
944
|
|
|
@@ -941,14 +975,14 @@ export class TeleBox {
|
|
|
941
975
|
|
|
942
976
|
let trackingHandle: TeleBoxHandleType | undefined;
|
|
943
977
|
|
|
944
|
-
const handleTracking = (ev:
|
|
945
|
-
if (this.state !== TELE_BOX_STATE.Normal) {
|
|
978
|
+
const handleTracking = (ev: PointerEvent): void => {
|
|
979
|
+
if (!ev.isPrimary || this.state !== TELE_BOX_STATE.Normal) {
|
|
946
980
|
return;
|
|
947
981
|
}
|
|
948
982
|
|
|
949
983
|
preventEvent(ev);
|
|
950
984
|
|
|
951
|
-
let { pageX, pageY } =
|
|
985
|
+
let { pageX, pageY } = ev;
|
|
952
986
|
if (pageY < 0) {
|
|
953
987
|
pageY = 0;
|
|
954
988
|
}
|
|
@@ -1012,7 +1046,11 @@ export class TeleBox {
|
|
|
1012
1046
|
this.transform(newX, newY, newWidth, newHeight);
|
|
1013
1047
|
};
|
|
1014
1048
|
|
|
1015
|
-
const handleTrackEnd = (ev:
|
|
1049
|
+
const handleTrackEnd = (ev: PointerEvent): void => {
|
|
1050
|
+
if (!ev.isPrimary) {
|
|
1051
|
+
return;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1016
1054
|
trackingHandle = void 0;
|
|
1017
1055
|
|
|
1018
1056
|
if (!$trackMask) {
|
|
@@ -1028,8 +1066,8 @@ export class TeleBox {
|
|
|
1028
1066
|
$trackMask.remove();
|
|
1029
1067
|
};
|
|
1030
1068
|
|
|
1031
|
-
const handleTrackStart = (ev:
|
|
1032
|
-
if (this.readonly) {
|
|
1069
|
+
const handleTrackStart = (ev: PointerEvent): void => {
|
|
1070
|
+
if (!ev.isPrimary || this.readonly) {
|
|
1033
1071
|
return;
|
|
1034
1072
|
}
|
|
1035
1073
|
|
|
@@ -1057,8 +1095,7 @@ export class TeleBox {
|
|
|
1057
1095
|
({ width: trackStartWidth, height: trackStartHeight } =
|
|
1058
1096
|
this.pxIntrinsicSize);
|
|
1059
1097
|
|
|
1060
|
-
({ pageX: trackStartPageX, pageY: trackStartPageY } =
|
|
1061
|
-
flattenEvent(ev));
|
|
1098
|
+
({ pageX: trackStartPageX, pageY: trackStartPageY } = ev);
|
|
1062
1099
|
|
|
1063
1100
|
trackingHandle = target.dataset
|
|
1064
1101
|
.teleBoxHandle as TELE_BOX_RESIZE_HANDLE;
|
|
@@ -1080,25 +1117,24 @@ export class TeleBox {
|
|
|
1080
1117
|
this.$box.classList.add(transformingClassName);
|
|
1081
1118
|
|
|
1082
1119
|
this._sideEffect.add(() => {
|
|
1083
|
-
window.addEventListener("
|
|
1084
|
-
window.addEventListener("touchmove", handleTracking, {
|
|
1120
|
+
window.addEventListener("pointermove", handleTracking, {
|
|
1085
1121
|
passive: false,
|
|
1086
1122
|
});
|
|
1087
|
-
window.addEventListener("
|
|
1088
|
-
window.addEventListener("touchend", handleTrackEnd, {
|
|
1123
|
+
window.addEventListener("pointerup", handleTrackEnd, {
|
|
1089
1124
|
passive: false,
|
|
1090
1125
|
});
|
|
1091
|
-
window.addEventListener("
|
|
1126
|
+
window.addEventListener("pointercancel", handleTrackEnd, {
|
|
1092
1127
|
passive: false,
|
|
1093
1128
|
});
|
|
1094
1129
|
|
|
1095
1130
|
return () => {
|
|
1096
|
-
window.removeEventListener("mousemove", handleTracking);
|
|
1097
|
-
window.removeEventListener("touchmove", handleTracking);
|
|
1098
|
-
window.removeEventListener("mouseup", handleTrackEnd);
|
|
1099
|
-
window.removeEventListener("touchend", handleTrackEnd);
|
|
1100
1131
|
window.removeEventListener(
|
|
1101
|
-
"
|
|
1132
|
+
"pointermove",
|
|
1133
|
+
handleTracking
|
|
1134
|
+
);
|
|
1135
|
+
window.removeEventListener("pointerup", handleTrackEnd);
|
|
1136
|
+
window.removeEventListener(
|
|
1137
|
+
"pointercancel",
|
|
1102
1138
|
handleTrackEnd
|
|
1103
1139
|
);
|
|
1104
1140
|
};
|
|
@@ -1110,18 +1146,10 @@ export class TeleBox {
|
|
|
1110
1146
|
|
|
1111
1147
|
this._sideEffect.addEventListener(
|
|
1112
1148
|
$resizeHandles,
|
|
1113
|
-
"
|
|
1149
|
+
"pointerdown",
|
|
1114
1150
|
handleTrackStart,
|
|
1115
1151
|
{},
|
|
1116
|
-
"box-resizeHandles-
|
|
1117
|
-
);
|
|
1118
|
-
|
|
1119
|
-
this._sideEffect.addEventListener(
|
|
1120
|
-
$resizeHandles,
|
|
1121
|
-
"touchstart",
|
|
1122
|
-
handleTrackStart,
|
|
1123
|
-
{ passive: false },
|
|
1124
|
-
"box-resizeHandles-touchstart"
|
|
1152
|
+
"box-resizeHandles-pointerdown"
|
|
1125
1153
|
);
|
|
1126
1154
|
}
|
|
1127
1155
|
|
package/src/TeleBox/style.scss
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
@import "../scss/variables.scss";
|
|
2
2
|
@import "../scss/mixins.scss";
|
|
3
3
|
|
|
4
|
+
@import "./style.shadow.scss";
|
|
5
|
+
|
|
4
6
|
.#{$namespace}-box {
|
|
5
7
|
position: absolute;
|
|
6
8
|
top: 0;
|
|
@@ -12,15 +14,16 @@
|
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
.#{$namespace}-box-main {
|
|
17
|
+
@include v(border, box-border, $box-border);
|
|
18
|
+
@include v(box-shadow, box-shadow, $box-shadow);
|
|
19
|
+
|
|
15
20
|
position: relative;
|
|
16
21
|
width: 100%;
|
|
17
22
|
height: 100%;
|
|
18
23
|
display: flex;
|
|
19
24
|
flex-direction: column;
|
|
20
25
|
overflow: hidden;
|
|
21
|
-
box-shadow: 0px 4px 10px 0px rgba(47, 65, 146, 0.15);
|
|
22
26
|
border-radius: 6px;
|
|
23
|
-
border: 1px solid #e3e3ec;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
.#{$namespace}-titlebar-wrap {
|
|
@@ -29,41 +32,11 @@
|
|
|
29
32
|
z-index: 1;
|
|
30
33
|
}
|
|
31
34
|
|
|
32
|
-
.#{$namespace}-
|
|
33
|
-
flex: 1;
|
|
34
|
-
width: 100%;
|
|
35
|
-
overflow: hidden;
|
|
36
|
-
display: flex;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
align-items: center;
|
|
35
|
+
.#{$namespace}-main {
|
|
39
36
|
position: relative;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
.#{$namespace}-content {
|
|
37
|
+
flex: 1;
|
|
43
38
|
width: 100%;
|
|
44
|
-
height: 100%;
|
|
45
|
-
position: relative;
|
|
46
|
-
background: $color-container-background;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
.#{$namespace}-content-stage {
|
|
50
|
-
position: absolute;
|
|
51
|
-
z-index: 1;
|
|
52
39
|
overflow: hidden;
|
|
53
|
-
background: $color-stage-background;
|
|
54
|
-
box-shadow: $color-stage-shadow;
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
.#{$namespace}-footer-wrap {
|
|
58
|
-
flex-shrink: 0;
|
|
59
|
-
display: flex;
|
|
60
|
-
flex-direction: column;
|
|
61
|
-
|
|
62
|
-
&::before {
|
|
63
|
-
content: "";
|
|
64
|
-
display: block;
|
|
65
|
-
flex: 1;
|
|
66
|
-
}
|
|
67
40
|
}
|
|
68
41
|
|
|
69
42
|
.#{$namespace}-resize-handle {
|
|
@@ -219,16 +192,7 @@
|
|
|
219
192
|
color-scheme: dark;
|
|
220
193
|
|
|
221
194
|
.#{$namespace}-box-main {
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.#{$namespace}-content {
|
|
227
|
-
background: $color-container-background-dark;
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
.#{$namespace}-content-stage {
|
|
231
|
-
background: $color-stage-background-dark;
|
|
232
|
-
box-shadow: $color-stage-shadow-dark;
|
|
195
|
+
@include v(border, box-border-dark, $box-border-dark);
|
|
196
|
+
@include v(box-shadow, box-shadow-dark, $box-shadow-dark);
|
|
233
197
|
}
|
|
234
198
|
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
@import "../scss/variables.scss";
|
|
2
|
+
@import "../scss/mixins.scss";
|
|
3
|
+
|
|
4
|
+
.#{$namespace}-quarantine {
|
|
5
|
+
all: initial;
|
|
6
|
+
position: relative;
|
|
7
|
+
width: 100%;
|
|
8
|
+
height: 100%;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: column;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.#{$namespace}-body-wrap {
|
|
14
|
+
@include v(color, box-color, $box-color);
|
|
15
|
+
|
|
16
|
+
flex: 1;
|
|
17
|
+
width: 100%;
|
|
18
|
+
overflow: hidden;
|
|
19
|
+
display: flex;
|
|
20
|
+
justify-content: center;
|
|
21
|
+
align-items: center;
|
|
22
|
+
position: relative;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.#{$namespace}-content {
|
|
26
|
+
width: 100%;
|
|
27
|
+
height: 100%;
|
|
28
|
+
position: relative;
|
|
29
|
+
@include v(
|
|
30
|
+
background-color,
|
|
31
|
+
manager-container-background,
|
|
32
|
+
$manager-container-background
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.#{$namespace}-box-stage {
|
|
37
|
+
position: absolute;
|
|
38
|
+
z-index: 1;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
|
|
41
|
+
@include v(
|
|
42
|
+
background-color,
|
|
43
|
+
manager-stage-background,
|
|
44
|
+
$manager-stage-background
|
|
45
|
+
);
|
|
46
|
+
@include v(box-shadow, manager-stage-shadow, $manager-stage-shadow);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.#{$namespace}-footer-wrap {
|
|
50
|
+
flex-shrink: 0;
|
|
51
|
+
display: flex;
|
|
52
|
+
flex-direction: column;
|
|
53
|
+
|
|
54
|
+
&::before {
|
|
55
|
+
content: "";
|
|
56
|
+
display: block;
|
|
57
|
+
flex: 1;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.#{$namespace}-color-scheme-dark {
|
|
62
|
+
color-scheme: dark;
|
|
63
|
+
|
|
64
|
+
.#{$namespace}-body-wrap {
|
|
65
|
+
@include v(color, box-color-dark, $box-color-dark);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.#{$namespace}-content {
|
|
69
|
+
@include v(
|
|
70
|
+
background-color,
|
|
71
|
+
manager-container-background-dark,
|
|
72
|
+
$manager-container-background-dark
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.#{$namespace}-box-stage {
|
|
77
|
+
@include v(
|
|
78
|
+
background-color,
|
|
79
|
+
manager-stage-background-dark,
|
|
80
|
+
$manager-stage-background-dark
|
|
81
|
+
);
|
|
82
|
+
@include v(
|
|
83
|
+
box-shadow,
|
|
84
|
+
manager-stage-shadow-dark,
|
|
85
|
+
$manager-stage-shadow-dark
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
}
|
package/src/TeleBox/typings.ts
CHANGED
|
@@ -60,6 +60,8 @@ export interface TeleBoxConfig {
|
|
|
60
60
|
readonly stageRatio?: number | null;
|
|
61
61
|
/** Classname Prefix. For CSS styling. Default "telebox". */
|
|
62
62
|
readonly namespace?: string;
|
|
63
|
+
/** Enable shadow DOM for box content. Default true. */
|
|
64
|
+
readonly enableShadowDOM?: boolean;
|
|
63
65
|
/** TeleTitleBar Instance. */
|
|
64
66
|
readonly titleBar?: TeleTitleBar;
|
|
65
67
|
/** Box content element. */
|
|
@@ -91,9 +91,9 @@ export class TeleBoxCollector {
|
|
|
91
91
|
el$.subscribe(($collector) => {
|
|
92
92
|
this._sideEffect.addEventListener(
|
|
93
93
|
$collector,
|
|
94
|
-
"
|
|
95
|
-
() => {
|
|
96
|
-
if (!readonly$.value) {
|
|
94
|
+
"pointerup",
|
|
95
|
+
(ev) => {
|
|
96
|
+
if (ev.isPrimary && !readonly$.value) {
|
|
97
97
|
minimized$.setValue(false);
|
|
98
98
|
}
|
|
99
99
|
},
|
|
@@ -16,8 +16,6 @@
|
|
|
16
16
|
outline: none;
|
|
17
17
|
font-size: 0;
|
|
18
18
|
border-radius: 50%;
|
|
19
|
-
background: #fff;
|
|
20
|
-
box-shadow: 0px 2px 6px 0px rgba(47, 65, 146, 0.15);
|
|
21
19
|
cursor: pointer;
|
|
22
20
|
user-select: none;
|
|
23
21
|
pointer-events: none;
|
|
@@ -25,6 +23,9 @@
|
|
|
25
23
|
background-size: 18px 16px;
|
|
26
24
|
background-position: center;
|
|
27
25
|
-webkit-tap-highlight-color: transparent;
|
|
26
|
+
|
|
27
|
+
@include v(background-color, collector-background, $collector-background);
|
|
28
|
+
@include v(box-shadow, collector-shadow, $collector-shadow);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
.#{$namespace}-collector-visible {
|
|
@@ -40,6 +41,11 @@
|
|
|
40
41
|
color-scheme: dark;
|
|
41
42
|
|
|
42
43
|
&.#{$namespace}-collector {
|
|
43
|
-
|
|
44
|
+
@include v(
|
|
45
|
+
background-color,
|
|
46
|
+
collector-background-dark,
|
|
47
|
+
$collector-background-dark
|
|
48
|
+
);
|
|
49
|
+
@include v(box-shadow, collector-shadow-dark, $collector-shadow-dark);
|
|
44
50
|
}
|
|
45
51
|
}
|
|
@@ -14,7 +14,7 @@ export interface MaxTitleBarConfig extends DefaultTitleBarConfig {
|
|
|
14
14
|
darkMode$: ReadonlyVal<boolean>;
|
|
15
15
|
boxes$: ReadonlyVal<TeleBox[]>;
|
|
16
16
|
rootRect$: ReadonlyVal<TeleBoxRect>;
|
|
17
|
-
root
|
|
17
|
+
root: HTMLElement;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
export class MaxTitleBar extends DefaultTitleBar {
|
|
@@ -25,15 +25,7 @@ export class MaxTitleBar extends DefaultTitleBar {
|
|
|
25
25
|
this.rootRect$ = config.rootRect$;
|
|
26
26
|
this.darkMode$ = config.darkMode$;
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
config.root$.subscribe((root) => {
|
|
30
|
-
if (root) {
|
|
31
|
-
root.appendChild(this.render());
|
|
32
|
-
} else if (this.$titleBar?.parentNode) {
|
|
33
|
-
this.$titleBar.remove();
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
);
|
|
28
|
+
config.root.appendChild(this.render());
|
|
37
29
|
}
|
|
38
30
|
|
|
39
31
|
public focusBox(box?: TeleBox): void {
|
|
@@ -87,16 +79,6 @@ export class MaxTitleBar extends DefaultTitleBar {
|
|
|
87
79
|
readonly
|
|
88
80
|
);
|
|
89
81
|
}),
|
|
90
|
-
this.darkMode$.subscribe((darkMode) => {
|
|
91
|
-
$titleBar.classList.toggle(
|
|
92
|
-
this.wrapClassName("color-scheme-dark"),
|
|
93
|
-
darkMode
|
|
94
|
-
);
|
|
95
|
-
$titleBar.classList.toggle(
|
|
96
|
-
this.wrapClassName("color-scheme-light"),
|
|
97
|
-
!darkMode
|
|
98
|
-
);
|
|
99
|
-
}),
|
|
100
82
|
combine([this.state$, this.boxes$]).subscribe(
|
|
101
83
|
([state, titles]) => {
|
|
102
84
|
if (state === TELE_BOX_STATE.Maximized) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@import "../../scss/variables.scss";
|
|
2
2
|
@import "../../scss/mixins.scss";
|
|
3
3
|
|
|
4
|
-
$scrollbar-size:
|
|
4
|
+
$scrollbar-size: 4px;
|
|
5
5
|
$scrollbar-ff-width: auto; // FF-only accepts auto, thin, none
|
|
6
6
|
$scrollbar-minlength: 50px; // Minimum length of scrollbar thumb
|
|
7
7
|
$scrollbar-track-color: transparent;
|
|
@@ -108,15 +108,26 @@ $scrollbar-color-active: rgba(238, 238, 247, 1);
|
|
|
108
108
|
white-space: nowrap;
|
|
109
109
|
word-break: keep-all;
|
|
110
110
|
border: none;
|
|
111
|
-
border-right: 1px
|
|
112
|
-
|
|
113
|
-
background: transparent;
|
|
111
|
+
border-right-width: 1px;
|
|
112
|
+
border-right-style: solid;
|
|
114
113
|
cursor: pointer;
|
|
115
114
|
user-select: none;
|
|
115
|
+
|
|
116
|
+
@include v(color, titlebar-tab-color, $titlebar-tab-color);
|
|
117
|
+
@include v(
|
|
118
|
+
background-color,
|
|
119
|
+
titlebar-tab-background,
|
|
120
|
+
$titlebar-tab-background
|
|
121
|
+
);
|
|
122
|
+
@include v(
|
|
123
|
+
border-right-color,
|
|
124
|
+
titlebar-tab-divider-color,
|
|
125
|
+
$titlebar-tab-divider-color
|
|
126
|
+
);
|
|
116
127
|
}
|
|
117
128
|
|
|
118
129
|
.#{$namespace}-titles-tab-focus {
|
|
119
|
-
color
|
|
130
|
+
@include v(color, titlebar-tab-focus-color, $titlebar-tab-focus-color);
|
|
120
131
|
}
|
|
121
132
|
|
|
122
133
|
.#{$namespace}-readonly {
|
|
@@ -128,17 +139,25 @@ $scrollbar-color-active: rgba(238, 238, 247, 1);
|
|
|
128
139
|
.#{$namespace}-color-scheme-dark {
|
|
129
140
|
color-scheme: dark;
|
|
130
141
|
|
|
131
|
-
&.#{$namespace}-titlebar {
|
|
132
|
-
color: #e9e9e9;
|
|
133
|
-
background: #43434d;
|
|
134
|
-
border-bottom: none;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
142
|
.#{$namespace}-titles-tab {
|
|
138
|
-
|
|
143
|
+
@include v(color, titlebar-tab-color-dark, $titlebar-tab-color-dark);
|
|
144
|
+
@include v(
|
|
145
|
+
background-color,
|
|
146
|
+
titlebar-tab-background-dark,
|
|
147
|
+
$titlebar-tab-background-dark
|
|
148
|
+
);
|
|
149
|
+
@include v(
|
|
150
|
+
border-right-color,
|
|
151
|
+
titlebar-tab-divider-color-dark,
|
|
152
|
+
$titlebar-tab-divider-color-dark
|
|
153
|
+
);
|
|
139
154
|
}
|
|
140
155
|
|
|
141
|
-
.#{$namespace}-
|
|
142
|
-
|
|
156
|
+
.#{$namespace}-titles-tab-focus {
|
|
157
|
+
@include v(
|
|
158
|
+
color,
|
|
159
|
+
titlebar-tab-focus-color-dark,
|
|
160
|
+
$titlebar-tab-focus-color-dark
|
|
161
|
+
);
|
|
143
162
|
}
|
|
144
163
|
}
|