@netless/telebox-insider 1.0.0-alpha.19 → 1.0.0-alpha.21
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 +37 -34
- package/dist/TeleBox/typings.d.ts +12 -8
- package/dist/TeleBoxManager/MaxTitleBar/index.d.ts +1 -1
- package/dist/TeleBoxManager/index.d.ts +3 -1
- package/dist/TeleBoxManager/typings.d.ts +9 -5
- package/dist/style.css +1 -1
- package/dist/telebox-insider.cjs.js +2 -1
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +1647 -1
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +67 -67
- package/src/TeleBox/index.ts +219 -220
- package/src/TeleBox/style.scss +9 -45
- package/src/TeleBox/style.shadow.scss +87 -0
- package/src/TeleBox/typings.ts +12 -8
- 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 +58 -50
- package/src/TeleBoxManager/style.scss +23 -6
- package/src/TeleBoxManager/typings.ts +12 -4
- package/src/TeleTitleBar/DefaultTitleBar/style.scss +68 -11
- package/src/scss/mixins.scss +5 -0
- package/src/scss/variables.scss +40 -6
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}-
|
|
35
|
+
.#{$namespace}-quarantine-wrap {
|
|
36
|
+
all: initial;
|
|
33
37
|
flex: 1;
|
|
34
38
|
width: 100%;
|
|
35
39
|
overflow: hidden;
|
|
36
|
-
display: flex;
|
|
37
|
-
justify-content: center;
|
|
38
|
-
align-items: center;
|
|
39
|
-
position: relative;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.#{$namespace}-content {
|
|
43
|
-
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
|
-
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,87 @@
|
|
|
1
|
+
@import "../scss/variables.scss";
|
|
2
|
+
@import "../scss/mixins.scss";
|
|
3
|
+
|
|
4
|
+
.#{$namespace}-quarantine {
|
|
5
|
+
position: relative;
|
|
6
|
+
width: 100%;
|
|
7
|
+
height: 100%;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.#{$namespace}-body-wrap {
|
|
13
|
+
@include v(color, box-color, $box-color);
|
|
14
|
+
|
|
15
|
+
flex: 1;
|
|
16
|
+
width: 100%;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
display: flex;
|
|
19
|
+
justify-content: center;
|
|
20
|
+
align-items: center;
|
|
21
|
+
position: relative;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.#{$namespace}-content {
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 100%;
|
|
27
|
+
position: relative;
|
|
28
|
+
@include v(
|
|
29
|
+
background-color,
|
|
30
|
+
manager-container-background,
|
|
31
|
+
$manager-container-background
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.#{$namespace}-box-stage {
|
|
36
|
+
position: absolute;
|
|
37
|
+
z-index: 1;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
|
|
40
|
+
@include v(
|
|
41
|
+
background-color,
|
|
42
|
+
manager-stage-background,
|
|
43
|
+
$manager-stage-background
|
|
44
|
+
);
|
|
45
|
+
@include v(box-shadow, manager-stage-shadow, $manager-stage-shadow);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.#{$namespace}-footer-wrap {
|
|
49
|
+
flex-shrink: 0;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: column;
|
|
52
|
+
|
|
53
|
+
&::before {
|
|
54
|
+
content: "";
|
|
55
|
+
display: block;
|
|
56
|
+
flex: 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.#{$namespace}-color-scheme-dark {
|
|
61
|
+
color-scheme: dark;
|
|
62
|
+
|
|
63
|
+
.#{$namespace}-body-wrap {
|
|
64
|
+
@include v(color, box-color-dark, $box-color-dark);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.#{$namespace}-content {
|
|
68
|
+
@include v(
|
|
69
|
+
background-color,
|
|
70
|
+
manager-container-background-dark,
|
|
71
|
+
$manager-container-background-dark
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
.#{$namespace}-box-stage {
|
|
76
|
+
@include v(
|
|
77
|
+
background-color,
|
|
78
|
+
manager-stage-background-dark,
|
|
79
|
+
$manager-stage-background-dark
|
|
80
|
+
);
|
|
81
|
+
@include v(
|
|
82
|
+
box-shadow,
|
|
83
|
+
manager-stage-shadow-dark,
|
|
84
|
+
$manager-stage-shadow-dark
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
}
|
package/src/TeleBox/typings.ts
CHANGED
|
@@ -57,9 +57,11 @@ export interface TeleBoxConfig {
|
|
|
57
57
|
/** Base z-index for box. */
|
|
58
58
|
readonly zIndex?: number;
|
|
59
59
|
/** Box content stage ratio. Follow manager stage ratio if null. Default null. */
|
|
60
|
-
readonly
|
|
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. */
|
|
@@ -69,11 +71,13 @@ export interface TeleBoxConfig {
|
|
|
69
71
|
/** Box footer element. */
|
|
70
72
|
readonly footer?: HTMLElement;
|
|
71
73
|
/** Box content styles. */
|
|
72
|
-
readonly styles?:
|
|
74
|
+
readonly styles?: string;
|
|
75
|
+
/** Box content styles from end users. */
|
|
76
|
+
readonly userStyles?: string;
|
|
73
77
|
/** Custom styles for box content container. Inherit from manager container style if null. Default null. */
|
|
74
|
-
readonly
|
|
78
|
+
readonly bodyStyle?: string | null;
|
|
75
79
|
/** Custom styles for box content stage. Inherit from manager stage style if null. Default null. */
|
|
76
|
-
readonly
|
|
80
|
+
readonly stageStyle?: string | null;
|
|
77
81
|
/** Actual Box Dark Mode */
|
|
78
82
|
readonly darkMode$: ReadonlyVal<boolean, boolean>;
|
|
79
83
|
/** Restrict box to always be within the stage area. Default false. */
|
|
@@ -92,10 +96,10 @@ export interface TeleBoxConfig {
|
|
|
92
96
|
readonly managerStageRect$: ReadonlyVal<TeleBoxRect>;
|
|
93
97
|
/** Stage area height/with ratio. No ratio if <= 0. */
|
|
94
98
|
readonly managerStageRatio$: ReadonlyVal<number, boolean>;
|
|
95
|
-
/**
|
|
96
|
-
readonly
|
|
97
|
-
/**
|
|
98
|
-
readonly
|
|
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>;
|
|
99
103
|
/** Position and dimension of collector */
|
|
100
104
|
readonly collectorRect$: ReadonlyVal<TeleBoxRect | undefined>;
|
|
101
105
|
}
|
|
@@ -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
|
}
|
|
@@ -64,6 +64,8 @@ type ValConfig = {
|
|
|
64
64
|
stageRatio: Val<number, boolean>;
|
|
65
65
|
containerStyle: Val<string>;
|
|
66
66
|
stageStyle: Val<string>;
|
|
67
|
+
defaultBoxBodyStyle: Val<string | null>;
|
|
68
|
+
defaultBoxStageStyle: Val<string | null>;
|
|
67
69
|
};
|
|
68
70
|
|
|
69
71
|
type CombinedValEnhancedResult = ValEnhancedResult<ValConfig> &
|
|
@@ -84,6 +86,8 @@ export class TeleBoxManager {
|
|
|
84
86
|
stageRatio = -1,
|
|
85
87
|
containerStyle = "",
|
|
86
88
|
stageStyle = "",
|
|
89
|
+
defaultBoxBodyStyle = null,
|
|
90
|
+
defaultBoxStageStyle = null,
|
|
87
91
|
}: TeleBoxManagerConfig = {}) {
|
|
88
92
|
this._sideEffect = new SideEffectManager();
|
|
89
93
|
|
|
@@ -100,6 +104,8 @@ export class TeleBoxManager {
|
|
|
100
104
|
const containerStyle$ = new Val(containerStyle);
|
|
101
105
|
const stageStyle$ = new Val(stageStyle);
|
|
102
106
|
const stageRatio$ = new Val(stageRatio);
|
|
107
|
+
const defaultBoxBodyStyle$ = new Val(defaultBoxBodyStyle);
|
|
108
|
+
const defaultBoxStageStyle$ = new Val(defaultBoxStageStyle);
|
|
103
109
|
|
|
104
110
|
const rootRect$ = new Val<TeleBoxRect>(
|
|
105
111
|
{
|
|
@@ -225,6 +231,8 @@ export class TeleBoxManager {
|
|
|
225
231
|
stageRatio: stageRatio$,
|
|
226
232
|
containerStyle: containerStyle$,
|
|
227
233
|
stageStyle: stageStyle$,
|
|
234
|
+
defaultBoxBodyStyle: defaultBoxBodyStyle$,
|
|
235
|
+
defaultBoxStageStyle: defaultBoxStageStyle$,
|
|
228
236
|
};
|
|
229
237
|
|
|
230
238
|
withValueEnhancer(this, valConfig, valManager);
|
|
@@ -274,6 +282,51 @@ export class TeleBoxManager {
|
|
|
274
282
|
true
|
|
275
283
|
);
|
|
276
284
|
|
|
285
|
+
this.$container = document.createElement("div");
|
|
286
|
+
this.$container.className = this.wrapClassName("manager-container");
|
|
287
|
+
|
|
288
|
+
this.$stage = document.createElement("div");
|
|
289
|
+
this.$stage.className = this.wrapClassName("manager-stage");
|
|
290
|
+
this.$container.appendChild(this.$stage);
|
|
291
|
+
|
|
292
|
+
this._sideEffect.addDisposer([
|
|
293
|
+
darkMode$.subscribe((darkMode) => {
|
|
294
|
+
this.$container.classList.toggle(
|
|
295
|
+
this.wrapClassName("color-scheme-dark"),
|
|
296
|
+
darkMode
|
|
297
|
+
);
|
|
298
|
+
this.$container.classList.toggle(
|
|
299
|
+
this.wrapClassName("color-scheme-light"),
|
|
300
|
+
!darkMode
|
|
301
|
+
);
|
|
302
|
+
}),
|
|
303
|
+
maximized$.subscribe((maximized) => {
|
|
304
|
+
this.$container.classList.toggle("is-maximized", maximized);
|
|
305
|
+
}),
|
|
306
|
+
minimized$.subscribe((minimized) => {
|
|
307
|
+
this.$container.classList.toggle("is-minimized", minimized);
|
|
308
|
+
}),
|
|
309
|
+
containerStyle$.subscribe((containerStyle) => {
|
|
310
|
+
this.$container.style.cssText = containerStyle;
|
|
311
|
+
}),
|
|
312
|
+
stageStyle$.subscribe((stageStyle) => {
|
|
313
|
+
this.$stage.style.cssText = stageStyle;
|
|
314
|
+
this.$stage.style.width = stageRect$.value.width + "px";
|
|
315
|
+
this.$stage.style.height = stageRect$.value.height + "px";
|
|
316
|
+
}),
|
|
317
|
+
stageRect$.subscribe((stageRect) => {
|
|
318
|
+
this.$stage.style.width = stageRect.width + "px";
|
|
319
|
+
this.$stage.style.height = stageRect.height + "px";
|
|
320
|
+
}),
|
|
321
|
+
root$.subscribe((root) => {
|
|
322
|
+
if (root) {
|
|
323
|
+
root.appendChild(this.$container);
|
|
324
|
+
} else if (this.$container.parentElement) {
|
|
325
|
+
this.$container.remove();
|
|
326
|
+
}
|
|
327
|
+
}),
|
|
328
|
+
]);
|
|
329
|
+
|
|
277
330
|
this.titleBar = new MaxTitleBar({
|
|
278
331
|
namespace: this.namespace,
|
|
279
332
|
title$: derive(this.topBox$, (topBox) => topBox?.title || ""),
|
|
@@ -281,8 +334,8 @@ export class TeleBoxManager {
|
|
|
281
334
|
darkMode$: darkMode$,
|
|
282
335
|
readonly$: readonly$,
|
|
283
336
|
state$: state$,
|
|
284
|
-
root$,
|
|
285
337
|
rootRect$: rootRect$,
|
|
338
|
+
root: this.$container,
|
|
286
339
|
onEvent: (event): void => {
|
|
287
340
|
switch (event.type) {
|
|
288
341
|
case TELE_BOX_DELEGATE_EVENT.Maximize: {
|
|
@@ -333,51 +386,6 @@ export class TeleBoxManager {
|
|
|
333
386
|
}
|
|
334
387
|
}),
|
|
335
388
|
]);
|
|
336
|
-
|
|
337
|
-
this.$container = document.createElement("div");
|
|
338
|
-
this.$container.className = this.wrapClassName("manager-container");
|
|
339
|
-
|
|
340
|
-
this.$stage = document.createElement("div");
|
|
341
|
-
this.$stage.className = this.wrapClassName("manager-stage");
|
|
342
|
-
this.$container.appendChild(this.$stage);
|
|
343
|
-
|
|
344
|
-
this._sideEffect.addDisposer([
|
|
345
|
-
darkMode$.subscribe((darkMode) => {
|
|
346
|
-
this.$container.classList.toggle(
|
|
347
|
-
this.wrapClassName("color-scheme-dark"),
|
|
348
|
-
darkMode
|
|
349
|
-
);
|
|
350
|
-
this.$container.classList.toggle(
|
|
351
|
-
this.wrapClassName("color-scheme-light"),
|
|
352
|
-
!darkMode
|
|
353
|
-
);
|
|
354
|
-
}),
|
|
355
|
-
maximized$.subscribe((maximized) => {
|
|
356
|
-
this.$container.classList.toggle("is-maximized", maximized);
|
|
357
|
-
}),
|
|
358
|
-
minimized$.subscribe((minimized) => {
|
|
359
|
-
this.$container.classList.toggle("is-minimized", minimized);
|
|
360
|
-
}),
|
|
361
|
-
containerStyle$.subscribe((containerStyle) => {
|
|
362
|
-
this.$container.style.cssText = containerStyle;
|
|
363
|
-
}),
|
|
364
|
-
stageStyle$.subscribe((stageStyle) => {
|
|
365
|
-
this.$stage.style.cssText = stageStyle;
|
|
366
|
-
this.$stage.style.width = stageRect$.value.width + "px";
|
|
367
|
-
this.$stage.style.height = stageRect$.value.height + "px";
|
|
368
|
-
}),
|
|
369
|
-
stageRect$.subscribe((stageRect) => {
|
|
370
|
-
this.$stage.style.width = stageRect.width + "px";
|
|
371
|
-
this.$stage.style.height = stageRect.height + "px";
|
|
372
|
-
}),
|
|
373
|
-
root$.subscribe((root) => {
|
|
374
|
-
if (root) {
|
|
375
|
-
root.appendChild(this.$container);
|
|
376
|
-
} else if (this.$container.parentElement) {
|
|
377
|
-
this.$container.remove();
|
|
378
|
-
}
|
|
379
|
-
}),
|
|
380
|
-
]);
|
|
381
389
|
}
|
|
382
390
|
|
|
383
391
|
public readonly $container: HTMLDivElement;
|
|
@@ -442,8 +450,8 @@ export class TeleBoxManager {
|
|
|
442
450
|
managerStageRatio$: this._stageRatio$,
|
|
443
451
|
readonly$: this._readonly$,
|
|
444
452
|
collectorRect$: this.collector._rect$,
|
|
445
|
-
|
|
446
|
-
|
|
453
|
+
defaultBoxBodyStyle$: this._defaultBoxBodyStyle$,
|
|
454
|
+
defaultBoxStageStyle$: this._defaultBoxStageStyle$,
|
|
447
455
|
});
|
|
448
456
|
|
|
449
457
|
if (box.focus) {
|
|
@@ -716,8 +724,8 @@ export class TeleBoxManager {
|
|
|
716
724
|
if (config.zIndex != null) {
|
|
717
725
|
box._zIndex$.setValue(config.zIndex, skipUpdate);
|
|
718
726
|
}
|
|
719
|
-
if (config.
|
|
720
|
-
box.
|
|
727
|
+
if (config.stageRatio !== undefined) {
|
|
728
|
+
box.setStageRatio(config.stageRatio, skipUpdate);
|
|
721
729
|
}
|
|
722
730
|
if (config.content != null) {
|
|
723
731
|
box.mountContent(config.content);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import "../scss/variables.scss";
|
|
2
|
+
@import "../scss/mixins.scss";
|
|
2
3
|
|
|
3
4
|
.#{$namespace}-manager-container {
|
|
4
5
|
position: relative;
|
|
@@ -8,7 +9,11 @@
|
|
|
8
9
|
display: flex;
|
|
9
10
|
justify-content: center;
|
|
10
11
|
align-items: center;
|
|
11
|
-
|
|
12
|
+
@include v(
|
|
13
|
+
background,
|
|
14
|
+
manager-container-background,
|
|
15
|
+
$manager-container-background
|
|
16
|
+
);
|
|
12
17
|
|
|
13
18
|
&.is-maximized,
|
|
14
19
|
&.is-minimized {
|
|
@@ -21,19 +26,31 @@
|
|
|
21
26
|
.#{$namespace}-manager-stage {
|
|
22
27
|
position: relative;
|
|
23
28
|
overflow: hidden;
|
|
24
|
-
background
|
|
25
|
-
box-shadow
|
|
29
|
+
@include v(background, manager-stage-background, $manager-stage-background);
|
|
30
|
+
@include v(box-shadow, manager-stage-shadow, $manager-stage-shadow);
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
.#{$namespace}-color-scheme-dark {
|
|
29
34
|
color-scheme: dark;
|
|
30
35
|
|
|
31
36
|
&.#{$namespace}-manager-container {
|
|
32
|
-
|
|
37
|
+
@include v(
|
|
38
|
+
background,
|
|
39
|
+
manager-container-background-dark,
|
|
40
|
+
$manager-container-background-dark
|
|
41
|
+
);
|
|
33
42
|
|
|
34
43
|
& > .#{$namespace}-manager-stage {
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
@include v(
|
|
45
|
+
background,
|
|
46
|
+
manager-stage-background-dark,
|
|
47
|
+
$manager-stage-background-dark
|
|
48
|
+
);
|
|
49
|
+
@include v(
|
|
50
|
+
box-shadow,
|
|
51
|
+
manager-stage-shadow-dark,
|
|
52
|
+
$manager-stage-shadow-dark
|
|
53
|
+
);
|
|
37
54
|
}
|
|
38
55
|
}
|
|
39
56
|
}
|
|
@@ -21,10 +21,14 @@ export interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "namespace"> {
|
|
|
21
21
|
readonly minimized?: boolean;
|
|
22
22
|
/** Is box readonly */
|
|
23
23
|
readonly readonly?: boolean;
|
|
24
|
-
/**
|
|
24
|
+
/** Custom styles for telebox manager container */
|
|
25
25
|
readonly containerStyle?: string;
|
|
26
|
-
/**
|
|
26
|
+
/** Custom styles for telebox manager stage */
|
|
27
27
|
readonly stageStyle?: string;
|
|
28
|
+
/** Custom `style` attribute value for content area of all boxes. Can be overwritten by box. */
|
|
29
|
+
readonly defaultBoxBodyStyle?: string | null;
|
|
30
|
+
/** Custom `style` attribute value for stage area of all boxes. Can be overwritten by box. */
|
|
31
|
+
readonly defaultBoxStageStyle?: string | null;
|
|
28
32
|
}
|
|
29
33
|
|
|
30
34
|
type TeleBoxManagerBoxConfigBaseProps =
|
|
@@ -40,7 +44,7 @@ type TeleBoxManagerBoxConfigBaseProps =
|
|
|
40
44
|
| "draggable"
|
|
41
45
|
| "boxRatio"
|
|
42
46
|
| "zIndex"
|
|
43
|
-
| "
|
|
47
|
+
| "stageRatio";
|
|
44
48
|
|
|
45
49
|
export type TeleBoxManagerCreateConfig = Pick<
|
|
46
50
|
TeleBoxConfig,
|
|
@@ -48,8 +52,12 @@ export type TeleBoxManagerCreateConfig = Pick<
|
|
|
48
52
|
| "content"
|
|
49
53
|
| "stage"
|
|
50
54
|
| "footer"
|
|
55
|
+
| "styles"
|
|
56
|
+
| "bodyStyle"
|
|
57
|
+
| "stageStyle"
|
|
51
58
|
| "id"
|
|
52
59
|
| "focus"
|
|
60
|
+
| "enableShadowDOM"
|
|
53
61
|
>;
|
|
54
62
|
|
|
55
63
|
export type TeleBoxManagerQueryConfig = Pick<
|
|
@@ -59,7 +67,7 @@ export type TeleBoxManagerQueryConfig = Pick<
|
|
|
59
67
|
| "resizable"
|
|
60
68
|
| "draggable"
|
|
61
69
|
| "boxRatio"
|
|
62
|
-
| "
|
|
70
|
+
| "stageRatio"
|
|
63
71
|
| "zIndex"
|
|
64
72
|
| "id"
|
|
65
73
|
| "focus"
|