@netless/telebox-insider 1.0.0-alpha.3 → 1.0.0-alpha.32
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 +62 -38
- package/dist/TeleBox/typings.d.ts +28 -16
- package/dist/TeleBox/utils.d.ts +5 -0
- package/dist/TeleBoxCollector/index.d.ts +7 -8
- package/dist/TeleBoxManager/MaxTitleBar/index.d.ts +1 -1
- package/dist/TeleBoxManager/index.d.ts +15 -5
- package/dist/TeleBoxManager/typings.d.ts +50 -6
- package/dist/TeleTitleBar/DefaultTitleBar/index.d.ts +4 -12
- package/dist/TeleTitleBar/typings.d.ts +2 -2
- package/dist/index.d.ts +0 -1
- package/dist/style.css +650 -1
- package/dist/telebox-insider.cjs.js +1659 -1
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +1641 -1
- package/dist/telebox-insider.es.js.map +1 -1
- package/dist/utils.d.ts +0 -1
- package/package.json +67 -67
- package/src/TeleBox/index.ts +443 -300
- package/src/TeleBox/style.scss +13 -25
- package/src/TeleBox/style.shadow.scss +77 -0
- package/src/TeleBox/typings.ts +28 -16
- package/src/TeleBox/utils.ts +32 -0
- package/src/TeleBoxCollector/index.ts +41 -38
- package/src/TeleBoxCollector/style.scss +6 -4
- package/src/TeleBoxManager/MaxTitleBar/index.ts +3 -28
- package/src/TeleBoxManager/MaxTitleBar/style.scss +18 -16
- package/src/TeleBoxManager/index.ts +187 -80
- package/src/TeleBoxManager/style.scss +55 -0
- package/src/TeleBoxManager/typings.ts +69 -7
- package/src/TeleTitleBar/DefaultTitleBar/index.ts +47 -61
- package/src/TeleTitleBar/DefaultTitleBar/style.scss +30 -10
- package/src/TeleTitleBar/typings.ts +2 -2
- package/src/index.ts +0 -2
- package/src/scss/variables.scss +72 -0
- package/src/utils.ts +0 -6
- package/dist/TeleStage/index.d.ts +0 -21
- package/src/TeleStage/index.ts +0 -178
- package/src/TeleStage/style.scss +0 -49
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,16 +14,16 @@
|
|
|
12
14
|
}
|
|
13
15
|
|
|
14
16
|
.#{$namespace}-box-main {
|
|
17
|
+
@include clr(border, boxBorder);
|
|
18
|
+
@include clr(box-shadow, boxShadow);
|
|
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
|
-
background: #f9f9fc;
|
|
22
|
-
box-shadow: 0px 4px 10px 0px rgba(47, 65, 146, 0.15);
|
|
23
26
|
border-radius: 6px;
|
|
24
|
-
border: 1px solid #e3e3ec;
|
|
25
27
|
}
|
|
26
28
|
|
|
27
29
|
.#{$namespace}-titlebar-wrap {
|
|
@@ -30,32 +32,17 @@
|
|
|
30
32
|
z-index: 1;
|
|
31
33
|
}
|
|
32
34
|
|
|
33
|
-
.#{$namespace}-
|
|
35
|
+
.#{$namespace}-main {
|
|
36
|
+
position: relative;
|
|
34
37
|
flex: 1;
|
|
35
38
|
width: 100%;
|
|
36
39
|
overflow: hidden;
|
|
37
|
-
display: flex;
|
|
38
|
-
justify-content: center;
|
|
39
|
-
align-items: center;
|
|
40
|
-
position: relative;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
.#{$namespace}-
|
|
42
|
+
.#{$namespace}-quarantine-outer {
|
|
44
43
|
width: 100%;
|
|
45
44
|
height: 100%;
|
|
46
|
-
|
|
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
|
-
}
|
|
45
|
+
overflow: hidden;
|
|
59
46
|
}
|
|
60
47
|
|
|
61
48
|
.#{$namespace}-resize-handle {
|
|
@@ -63,6 +50,8 @@
|
|
|
63
50
|
|
|
64
51
|
position: absolute;
|
|
65
52
|
z-index: 2147483647;
|
|
53
|
+
// enable pointermove event on touch devices
|
|
54
|
+
touch-action: none;
|
|
66
55
|
}
|
|
67
56
|
|
|
68
57
|
.#{$namespace}-n {
|
|
@@ -211,8 +200,7 @@
|
|
|
211
200
|
color-scheme: dark;
|
|
212
201
|
|
|
213
202
|
.#{$namespace}-box-main {
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
border-color: #43434d;
|
|
203
|
+
@include clr-dark(border, boxBorder);
|
|
204
|
+
@include clr-dark(box-shadow, boxShadow);
|
|
217
205
|
}
|
|
218
206
|
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
@import "../scss/variables.scss";
|
|
2
|
+
@import "../scss/mixins.scss";
|
|
3
|
+
@import "../scss/fancy-scrollbar.scss";
|
|
4
|
+
|
|
5
|
+
.#{$namespace}-quarantine {
|
|
6
|
+
all: initial;
|
|
7
|
+
position: relative;
|
|
8
|
+
width: 100%;
|
|
9
|
+
height: 100%;
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
.#{$namespace}-body-wrap {
|
|
15
|
+
@include clr(color, boxColor);
|
|
16
|
+
|
|
17
|
+
flex: 1;
|
|
18
|
+
width: 100%;
|
|
19
|
+
overflow: hidden;
|
|
20
|
+
display: flex;
|
|
21
|
+
justify-content: center;
|
|
22
|
+
align-items: center;
|
|
23
|
+
position: relative;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.#{$namespace}-content {
|
|
27
|
+
width: 100%;
|
|
28
|
+
height: 100%;
|
|
29
|
+
position: relative;
|
|
30
|
+
@include clr(background-color, boxContainerBackground);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.#{$namespace}-box-stage {
|
|
34
|
+
position: absolute;
|
|
35
|
+
z-index: 1;
|
|
36
|
+
overflow: hidden;
|
|
37
|
+
|
|
38
|
+
@include clr(background-color, boxStageBackground);
|
|
39
|
+
@include clr(box-shadow, boxStageShadow);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
.#{$namespace}-footer-wrap {
|
|
43
|
+
flex-shrink: 0;
|
|
44
|
+
display: flex;
|
|
45
|
+
flex-direction: column;
|
|
46
|
+
|
|
47
|
+
@include clr(color, boxFooterColor);
|
|
48
|
+
@include clr(background-color, boxFooterBackground);
|
|
49
|
+
|
|
50
|
+
&::before {
|
|
51
|
+
content: "";
|
|
52
|
+
display: block;
|
|
53
|
+
flex: 1;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.#{$namespace}-color-scheme-dark {
|
|
58
|
+
color-scheme: dark;
|
|
59
|
+
|
|
60
|
+
.#{$namespace}-body-wrap {
|
|
61
|
+
@include clr-dark(color, boxColor);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.#{$namespace}-content {
|
|
65
|
+
@include clr-dark(background-color, boxContainerBackground);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.#{$namespace}-box-stage {
|
|
69
|
+
@include clr-dark(background-color, boxStageBackground);
|
|
70
|
+
@include clr-dark(box-shadow, boxStageShadow);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.#{$namespace}-footer-wrap {
|
|
74
|
+
@include clr-dark(color, boxFooterColor);
|
|
75
|
+
@include clr-dark(background-color, boxFooterBackground);
|
|
76
|
+
}
|
|
77
|
+
}
|
package/src/TeleBox/typings.ts
CHANGED
|
@@ -51,45 +51,57 @@ export interface TeleBoxConfig {
|
|
|
51
51
|
/** Able to drag box window Default true. */
|
|
52
52
|
readonly draggable?: boolean;
|
|
53
53
|
/** Fixed height/width ratio for box window. No ratio limit if <= 0. Default -1. */
|
|
54
|
-
readonly
|
|
54
|
+
readonly boxRatio?: number;
|
|
55
55
|
/** Box focused. */
|
|
56
56
|
readonly focus?: boolean;
|
|
57
57
|
/** Base z-index for box. */
|
|
58
58
|
readonly zIndex?: number;
|
|
59
|
+
/** Box content stage ratio. Follow manager stage ratio if null. Default null. */
|
|
60
|
+
readonly stageRatio?: number | null;
|
|
59
61
|
/** Classname Prefix. For CSS styling. Default "telebox". */
|
|
60
62
|
readonly namespace?: string;
|
|
63
|
+
/** Enable shadow DOM for box content. Default true. */
|
|
64
|
+
readonly enableShadowDOM?: boolean;
|
|
61
65
|
/** TeleTitleBar Instance. */
|
|
62
66
|
readonly titleBar?: TeleTitleBar;
|
|
63
|
-
/** Box content. */
|
|
67
|
+
/** Box content element. */
|
|
64
68
|
readonly content?: HTMLElement;
|
|
65
|
-
/**
|
|
69
|
+
/** Stage element. */
|
|
70
|
+
readonly stage?: HTMLElement;
|
|
71
|
+
/** Box footer element. */
|
|
66
72
|
readonly footer?: HTMLElement;
|
|
67
73
|
/** Box content styles. */
|
|
68
|
-
readonly styles?:
|
|
69
|
-
/**
|
|
70
|
-
readonly
|
|
74
|
+
readonly styles?: string;
|
|
75
|
+
/** Box content styles from end users. */
|
|
76
|
+
readonly userStyles?: string;
|
|
77
|
+
/** Custom styles for box content container. Inherit from manager container style if null. Default null. */
|
|
78
|
+
readonly bodyStyle?: string | null;
|
|
79
|
+
/** Custom styles for box content stage. Inherit from manager stage style if null. Default null. */
|
|
80
|
+
readonly stageStyle?: string | null;
|
|
71
81
|
/** Actual Box Dark Mode */
|
|
72
82
|
readonly darkMode$: ReadonlyVal<boolean, boolean>;
|
|
73
83
|
/** Restrict box to always be within the stage area. Default false. */
|
|
74
84
|
readonly fence$: ReadonlyVal<boolean, boolean>;
|
|
75
|
-
/** Maximize box. Default false. */
|
|
76
|
-
readonly maximized$: ReadonlyVal<boolean, boolean>;
|
|
77
|
-
/** Minimize box. Overwrites maximized state. Default false. */
|
|
78
|
-
readonly minimized$: ReadonlyVal<boolean, boolean>;
|
|
79
|
-
/** Is box readonly */
|
|
80
|
-
readonly readonly$: ReadonlyVal<boolean, boolean>;
|
|
81
85
|
/** Root element to mount boxes */
|
|
82
|
-
readonly root
|
|
86
|
+
readonly root: HTMLElement;
|
|
83
87
|
/** Position and dimension of root element */
|
|
84
88
|
readonly rootRect$: ReadonlyVal<TeleBoxRect>;
|
|
89
|
+
/** Maximize state from manager. Default false. */
|
|
90
|
+
readonly managerMaximized$: ReadonlyVal<boolean, boolean>;
|
|
91
|
+
/** Minimize state from manager. Overwrites maximized state. Default false. */
|
|
92
|
+
readonly managerMinimized$: ReadonlyVal<boolean, boolean>;
|
|
93
|
+
/** Manager readonly state. */
|
|
94
|
+
readonly managerReadonly$: ReadonlyVal<boolean, boolean>;
|
|
85
95
|
/** Position and dimension of stage area */
|
|
86
96
|
readonly managerStageRect$: ReadonlyVal<TeleBoxRect>;
|
|
87
97
|
/** Stage area height/with ratio. No ratio if <= 0. */
|
|
88
|
-
readonly
|
|
98
|
+
readonly managerStageRatio$: ReadonlyVal<number, boolean>;
|
|
99
|
+
/** Default content styles for all boxes */
|
|
100
|
+
readonly defaultBoxBodyStyle$: ReadonlyVal<string | null>;
|
|
101
|
+
/** Default stage styles for all boxes */
|
|
102
|
+
readonly defaultBoxStageStyle$: ReadonlyVal<string | null>;
|
|
89
103
|
/** Position and dimension of collector */
|
|
90
104
|
readonly collectorRect$: ReadonlyVal<TeleBoxRect | undefined>;
|
|
91
|
-
/** highlight stage settings from manager */
|
|
92
|
-
readonly managerHighlightStage$: ReadonlyVal<boolean>;
|
|
93
105
|
}
|
|
94
106
|
|
|
95
107
|
type CheckTeleBoxConfig<T extends Record<`${TELE_BOX_EVENT}`, any>> = T;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { TeleBoxRect } from "./typings";
|
|
2
|
+
|
|
3
|
+
export function calcStageRect([rootRect, ratio]: [
|
|
4
|
+
TeleBoxRect,
|
|
5
|
+
number
|
|
6
|
+
]): TeleBoxRect {
|
|
7
|
+
if (ratio <= 0 || rootRect.width <= 0 || rootRect.height <= 0) {
|
|
8
|
+
return rootRect;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const preferredHeight = rootRect.width * ratio;
|
|
12
|
+
if (preferredHeight === rootRect.height) {
|
|
13
|
+
return rootRect;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (preferredHeight < rootRect.height) {
|
|
17
|
+
return {
|
|
18
|
+
x: 0,
|
|
19
|
+
y: (rootRect.height - preferredHeight) / 2,
|
|
20
|
+
width: rootRect.width,
|
|
21
|
+
height: preferredHeight,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const preferredWidth = rootRect.height / ratio;
|
|
26
|
+
return {
|
|
27
|
+
x: (rootRect.width - preferredWidth) / 2,
|
|
28
|
+
y: 0,
|
|
29
|
+
width: preferredWidth,
|
|
30
|
+
height: rootRect.height,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
@@ -6,36 +6,38 @@ import type {
|
|
|
6
6
|
ReadonlyValEnhancedResult,
|
|
7
7
|
ValEnhancedResult,
|
|
8
8
|
} from "value-enhancer";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
import { derive } from "value-enhancer";
|
|
10
|
+
import {
|
|
11
|
+
withValueEnhancer,
|
|
12
|
+
Val,
|
|
13
|
+
withReadonlyValueEnhancer,
|
|
14
|
+
ValManager,
|
|
15
|
+
} from "value-enhancer";
|
|
13
16
|
import { SideEffectManager } from "side-effect-manager";
|
|
14
17
|
import type { TeleBoxRect } from "../TeleBox/typings";
|
|
15
18
|
|
|
16
19
|
export interface TeleBoxCollectorConfig {
|
|
17
20
|
namespace?: string;
|
|
18
21
|
styles?: TeleStyles;
|
|
19
|
-
root
|
|
20
|
-
minimized$:
|
|
22
|
+
root: HTMLElement;
|
|
23
|
+
minimized$: ReadonlyVal<boolean>;
|
|
21
24
|
readonly$: ReadonlyVal<boolean>;
|
|
22
25
|
darkMode$: ReadonlyVal<boolean>;
|
|
23
|
-
|
|
26
|
+
onClick?: () => void;
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
type ValConfig = {
|
|
27
30
|
styles: Val<TeleStyles>;
|
|
28
|
-
|
|
31
|
+
$collector: Val<HTMLElement>;
|
|
29
32
|
};
|
|
30
33
|
|
|
31
|
-
type
|
|
34
|
+
type MyReadonlyValConfig = {
|
|
32
35
|
rect: ReadonlyVal<TeleBoxRect | undefined>;
|
|
33
36
|
visible: ReadonlyVal<boolean>;
|
|
34
|
-
root: ReadonlyVal<HTMLElement | null>;
|
|
35
37
|
};
|
|
36
38
|
|
|
37
39
|
type CombinedValEnhancedResult = ValEnhancedResult<ValConfig> &
|
|
38
|
-
ReadonlyValEnhancedResult<
|
|
40
|
+
ReadonlyValEnhancedResult<MyReadonlyValConfig>;
|
|
39
41
|
|
|
40
42
|
export interface TeleBoxCollector extends CombinedValEnhancedResult {}
|
|
41
43
|
|
|
@@ -44,44 +46,51 @@ export class TeleBoxCollector {
|
|
|
44
46
|
minimized$,
|
|
45
47
|
readonly$,
|
|
46
48
|
darkMode$,
|
|
47
|
-
rootRect$,
|
|
48
49
|
namespace = "telebox",
|
|
49
50
|
styles = {},
|
|
50
|
-
root
|
|
51
|
+
root,
|
|
52
|
+
onClick,
|
|
51
53
|
}: TeleBoxCollectorConfig) {
|
|
52
54
|
this.namespace = namespace;
|
|
53
55
|
|
|
56
|
+
const valManager = new ValManager();
|
|
57
|
+
this._sideEffect.addDisposer(() => valManager.destroy());
|
|
58
|
+
|
|
54
59
|
const rect$ = new Val<TeleBoxRect | undefined>(void 0);
|
|
55
|
-
const visible$ = minimized
|
|
60
|
+
const visible$ = derive(minimized$);
|
|
56
61
|
const styles$ = new Val(styles);
|
|
57
62
|
const el$ = new Val<HTMLElement>(document.createElement("button"));
|
|
58
63
|
|
|
59
64
|
const valConfig: ValConfig = {
|
|
60
65
|
styles: styles$,
|
|
61
|
-
|
|
66
|
+
$collector: el$,
|
|
62
67
|
};
|
|
63
68
|
|
|
64
|
-
withValueEnhancer(this, valConfig);
|
|
69
|
+
withValueEnhancer(this, valConfig, valManager);
|
|
65
70
|
|
|
66
|
-
const
|
|
71
|
+
const myReadonlyValConfig: MyReadonlyValConfig = {
|
|
67
72
|
rect: rect$,
|
|
68
73
|
visible: visible$,
|
|
69
|
-
root: root$,
|
|
70
74
|
};
|
|
71
75
|
|
|
72
|
-
withReadonlyValueEnhancer(this,
|
|
76
|
+
withReadonlyValueEnhancer(this, myReadonlyValConfig, valManager);
|
|
73
77
|
|
|
74
78
|
el$.value.className = this.wrapClassName("collector");
|
|
75
79
|
el$.value.style.backgroundImage = `url('${collectorSVG}')`;
|
|
76
80
|
|
|
77
81
|
this._sideEffect.addDisposer(
|
|
78
82
|
el$.subscribe(($collector) => {
|
|
83
|
+
this._sideEffect.add(() => {
|
|
84
|
+
root.appendChild($collector);
|
|
85
|
+
return () => $collector.remove();
|
|
86
|
+
}, "telebox-collector-mount");
|
|
87
|
+
|
|
79
88
|
this._sideEffect.addEventListener(
|
|
80
89
|
$collector,
|
|
81
90
|
"click",
|
|
82
91
|
() => {
|
|
83
92
|
if (!readonly$.value) {
|
|
84
|
-
|
|
93
|
+
onClick?.();
|
|
85
94
|
}
|
|
86
95
|
},
|
|
87
96
|
{},
|
|
@@ -123,26 +132,20 @@ export class TeleBoxCollector {
|
|
|
123
132
|
}
|
|
124
133
|
});
|
|
125
134
|
}),
|
|
126
|
-
root$.subscribe((root) => {
|
|
127
|
-
if (root) {
|
|
128
|
-
root.appendChild($collector);
|
|
129
|
-
}
|
|
130
|
-
}),
|
|
131
135
|
// Place after $collector appended to the DOM so that rect calc works
|
|
132
|
-
|
|
133
|
-
(
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
}
|
|
136
|
+
minimized$.subscribe((minimized) => {
|
|
137
|
+
if (minimized) {
|
|
138
|
+
const { x, y, width, height } =
|
|
139
|
+
$collector.getBoundingClientRect();
|
|
140
|
+
const rootRect = root.getBoundingClientRect();
|
|
141
|
+
rect$.setValue({
|
|
142
|
+
x: x - rootRect.x,
|
|
143
|
+
y: y - rootRect.y,
|
|
144
|
+
width,
|
|
145
|
+
height,
|
|
146
|
+
});
|
|
144
147
|
}
|
|
145
|
-
),
|
|
148
|
+
}),
|
|
146
149
|
],
|
|
147
150
|
"telebox-collector-el"
|
|
148
151
|
);
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
visibility: hidden;
|
|
8
8
|
display: block;
|
|
9
9
|
position: absolute;
|
|
10
|
-
z-index: $
|
|
10
|
+
z-index: $collector-z-index;
|
|
11
11
|
width: 40px;
|
|
12
12
|
height: 40px;
|
|
13
13
|
margin: 0;
|
|
@@ -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 clr(background-color, collectorBackground);
|
|
28
|
+
@include clr(box-shadow, collectorShadow);
|
|
28
29
|
}
|
|
29
30
|
|
|
30
31
|
.#{$namespace}-collector-visible {
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
color-scheme: dark;
|
|
41
42
|
|
|
42
43
|
&.#{$namespace}-collector {
|
|
43
|
-
background-color
|
|
44
|
+
@include clr-dark(background-color, collectorBackground);
|
|
45
|
+
@include clr-dark(box-shadow, collectorShadow);
|
|
44
46
|
}
|
|
45
47
|
}
|
|
@@ -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 {
|
|
@@ -75,11 +67,6 @@ export class MaxTitleBar extends DefaultTitleBar {
|
|
|
75
67
|
|
|
76
68
|
this.sideEffect.addDisposer(
|
|
77
69
|
[
|
|
78
|
-
this.rootRect$.subscribe((rootRect) => {
|
|
79
|
-
const { x, y, width } = rootRect;
|
|
80
|
-
$titleBar.style.transform = `translate(${x}px, ${y}px)`;
|
|
81
|
-
$titleBar.style.width = width + "px";
|
|
82
|
-
}),
|
|
83
70
|
this.state$.subscribe((state) => {
|
|
84
71
|
$titleBar.classList.toggle(
|
|
85
72
|
this.wrapClassName("max-titlebar-maximized"),
|
|
@@ -92,16 +79,6 @@ export class MaxTitleBar extends DefaultTitleBar {
|
|
|
92
79
|
readonly
|
|
93
80
|
);
|
|
94
81
|
}),
|
|
95
|
-
this.darkMode$.subscribe((darkMode) => {
|
|
96
|
-
$titleBar.classList.toggle(
|
|
97
|
-
this.wrapClassName("color-scheme-dark"),
|
|
98
|
-
darkMode
|
|
99
|
-
);
|
|
100
|
-
$titleBar.classList.toggle(
|
|
101
|
-
this.wrapClassName("color-scheme-light"),
|
|
102
|
-
!darkMode
|
|
103
|
-
);
|
|
104
|
-
}),
|
|
105
82
|
combine([this.state$, this.boxes$]).subscribe(
|
|
106
83
|
([state, titles]) => {
|
|
107
84
|
if (state === TELE_BOX_STATE.Maximized) {
|
|
@@ -109,9 +86,7 @@ export class MaxTitleBar extends DefaultTitleBar {
|
|
|
109
86
|
this.wrapClassName("max-titlebar-single-title"),
|
|
110
87
|
titles.length === 1
|
|
111
88
|
);
|
|
112
|
-
if (titles.length
|
|
113
|
-
this.setTitle(titles[0].title);
|
|
114
|
-
} else {
|
|
89
|
+
if (titles.length !== 1) {
|
|
115
90
|
$titleBar.replaceChild(
|
|
116
91
|
this.renderTitles(),
|
|
117
92
|
$titleBar.firstElementChild as HTMLElement
|
|
@@ -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;
|
|
@@ -16,7 +16,10 @@ $scrollbar-color-active: rgba(238, 238, 247, 1);
|
|
|
16
16
|
position: absolute;
|
|
17
17
|
top: 0;
|
|
18
18
|
left: 0;
|
|
19
|
-
|
|
19
|
+
width: 100%;
|
|
20
|
+
z-index: $max-titlebar-z-index;
|
|
21
|
+
border-top-left-radius: 6px;
|
|
22
|
+
border-top-right-radius: 6px;
|
|
20
23
|
|
|
21
24
|
.#{$namespace}-title {
|
|
22
25
|
display: none;
|
|
@@ -95,7 +98,7 @@ $scrollbar-color-active: rgba(238, 238, 247, 1);
|
|
|
95
98
|
height: 100%;
|
|
96
99
|
overflow: hidden;
|
|
97
100
|
max-width: 182px;
|
|
98
|
-
min-width:
|
|
101
|
+
min-width: 150px;
|
|
99
102
|
padding: 0 26px 0 16px;
|
|
100
103
|
outline: none;
|
|
101
104
|
font-size: 13px;
|
|
@@ -105,15 +108,18 @@ $scrollbar-color-active: rgba(238, 238, 247, 1);
|
|
|
105
108
|
white-space: nowrap;
|
|
106
109
|
word-break: keep-all;
|
|
107
110
|
border: none;
|
|
108
|
-
border-right: 1px
|
|
109
|
-
|
|
110
|
-
background: transparent;
|
|
111
|
+
border-right-width: 1px;
|
|
112
|
+
border-right-style: solid;
|
|
111
113
|
cursor: pointer;
|
|
112
114
|
user-select: none;
|
|
115
|
+
|
|
116
|
+
@include clr(color, titlebarTabColor);
|
|
117
|
+
@include clr(background-color, titlebarTabBackground);
|
|
118
|
+
@include clr(border-right-color, titlebarTabDividerColor);
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
.#{$namespace}-titles-tab-focus {
|
|
116
|
-
color
|
|
122
|
+
@include clr(color, titlebarTabFocusColor);
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
.#{$namespace}-readonly {
|
|
@@ -125,17 +131,13 @@ $scrollbar-color-active: rgba(238, 238, 247, 1);
|
|
|
125
131
|
.#{$namespace}-color-scheme-dark {
|
|
126
132
|
color-scheme: dark;
|
|
127
133
|
|
|
128
|
-
&.#{$namespace}-titlebar {
|
|
129
|
-
color: #e9e9e9;
|
|
130
|
-
background: #43434d;
|
|
131
|
-
border-bottom: none;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
134
|
.#{$namespace}-titles-tab {
|
|
135
|
-
|
|
135
|
+
@include clr-dark(color, titlebarTabColor);
|
|
136
|
+
@include clr-dark(background-color, titlebarTabBackground);
|
|
137
|
+
@include clr-dark(border-right-color, titlebarTabDividerColor);
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
.#{$namespace}-
|
|
139
|
-
color
|
|
140
|
+
.#{$namespace}-titles-tab-focus {
|
|
141
|
+
@include clr-dark(color, titlebarTabFocusColor);
|
|
140
142
|
}
|
|
141
143
|
}
|