@netless/telebox-insider 0.2.23 → 0.2.26
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/style.css +1 -1
- package/dist/telebox-insider.cjs.js +1 -1
- package/dist/telebox-insider.cjs.js.map +1 -1
- package/dist/telebox-insider.es.js +1 -1
- package/dist/telebox-insider.es.js.map +1 -1
- package/package.json +2 -2
- package/src/TeleBox/style.scss +5 -0
- package/src/TeleBoxCollector/style.scss +3 -0
- package/src/TeleBoxManager/MaxTitleBar/index.ts +9 -13
- package/src/TeleBoxManager/MaxTitleBar/style.scss +14 -22
- package/src/TeleTitleBar/DefaultTitleBar/index.ts +4 -4
- package/src/TeleTitleBar/DefaultTitleBar/style.scss +9 -1
- package/src/scss/mixins.scss +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@netless/telebox-insider",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.26",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Window widget for Whiteboard",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"storybook": "start-storybook -p 6006 --no-version-updates",
|
|
25
25
|
"build-storybook": "build-storybook && node scripts/move-storybook.js",
|
|
26
26
|
"deploy-storybook": "yarn run build-storybook && node scripts/deploy-storybook.js",
|
|
27
|
-
"cleanup": "rimraf ./
|
|
27
|
+
"cleanup": "rimraf ./dist"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
package/src/TeleBox/style.scss
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import "../scss/variables.scss";
|
|
2
|
+
@import "../scss/mixins.scss";
|
|
2
3
|
|
|
3
4
|
.#{$namespace}-box {
|
|
4
5
|
position: absolute;
|
|
@@ -57,6 +58,8 @@
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
.#{$namespace}-resize-handle {
|
|
61
|
+
@include no-user-select;
|
|
62
|
+
|
|
60
63
|
position: absolute;
|
|
61
64
|
z-index: 2147483647;
|
|
62
65
|
}
|
|
@@ -126,6 +129,8 @@
|
|
|
126
129
|
}
|
|
127
130
|
|
|
128
131
|
.#{$namespace}-track-mask {
|
|
132
|
+
@include no-user-select;
|
|
133
|
+
|
|
129
134
|
position: fixed;
|
|
130
135
|
top: 0;
|
|
131
136
|
left: 0;
|
|
@@ -105,12 +105,6 @@ export class MaxTitleBar extends DefaultTitleBar {
|
|
|
105
105
|
|
|
106
106
|
public render(): HTMLElement {
|
|
107
107
|
const $titleBar = super.render();
|
|
108
|
-
if ($titleBar.firstElementChild?.nextElementSibling) {
|
|
109
|
-
$titleBar.insertBefore(
|
|
110
|
-
this.$dragArea,
|
|
111
|
-
$titleBar.firstElementChild.nextElementSibling
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
108
|
|
|
115
109
|
const { x, y, width } = this.containerRect;
|
|
116
110
|
$titleBar.style.transform = `translate(${x}px, ${y}px)`;
|
|
@@ -131,6 +125,10 @@ export class MaxTitleBar extends DefaultTitleBar {
|
|
|
131
125
|
)
|
|
132
126
|
);
|
|
133
127
|
|
|
128
|
+
const $titlesArea = document.createElement("div");
|
|
129
|
+
$titlesArea.classList.add(this.wrapClassName("titles-area"));
|
|
130
|
+
$titleBar.insertBefore($titlesArea, $titleBar.firstElementChild);
|
|
131
|
+
|
|
134
132
|
this.updateTitles();
|
|
135
133
|
|
|
136
134
|
return $titleBar;
|
|
@@ -145,14 +143,12 @@ export class MaxTitleBar extends DefaultTitleBar {
|
|
|
145
143
|
|
|
146
144
|
public updateTitles(): void {
|
|
147
145
|
if (this.$titleBar && this.state === TELE_BOX_STATE.Maximized) {
|
|
146
|
+
this.$titleBar.classList.toggle(
|
|
147
|
+
this.wrapClassName("max-titlebar-single-title"),
|
|
148
|
+
this.boxes.length === 1
|
|
149
|
+
);
|
|
148
150
|
if (this.boxes.length === 1) {
|
|
149
|
-
|
|
150
|
-
this.$title.textContent = this.boxes[0].title;
|
|
151
|
-
this.$titleBar.replaceChild(
|
|
152
|
-
this.$title,
|
|
153
|
-
this.$titleBar.firstElementChild as HTMLElement
|
|
154
|
-
);
|
|
155
|
-
}
|
|
151
|
+
this.setTitle(this.boxes[0].title);
|
|
156
152
|
} else {
|
|
157
153
|
this.$titleBar.replaceChild(
|
|
158
154
|
this.renderTitles(),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
@import "../../scss/variables.scss";
|
|
2
|
+
@import "../../scss/mixins.scss";
|
|
2
3
|
|
|
3
4
|
$scrollbar-size: 8px;
|
|
4
5
|
$scrollbar-ff-width: auto; // FF-only accepts auto, thin, none
|
|
@@ -9,39 +10,30 @@ $scrollbar-color-hover: rgba(238, 238, 247, 1);
|
|
|
9
10
|
$scrollbar-color-active: rgba(238, 238, 247, 1);
|
|
10
11
|
|
|
11
12
|
.#{$namespace}-max-titlebar {
|
|
13
|
+
@include no-user-select;
|
|
14
|
+
|
|
12
15
|
display: none;
|
|
13
16
|
position: absolute;
|
|
14
17
|
top: 0;
|
|
15
18
|
left: 0;
|
|
16
19
|
z-index: $base-z-index * 500;
|
|
17
|
-
user-select: none;
|
|
18
20
|
|
|
19
|
-
.#{$namespace}-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
.#{$namespace}-title {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
&.#{$namespace}-max-titlebar-single-title {
|
|
26
|
+
.#{$namespace}-titles {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
.#{$namespace}-title {
|
|
30
|
+
display: block;
|
|
31
|
+
}
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
34
|
|
|
29
35
|
.#{$namespace}-max-titlebar-maximized {
|
|
30
36
|
display: flex;
|
|
31
|
-
|
|
32
|
-
// .#{$namespace}-titlebar-btns {
|
|
33
|
-
// &::before {
|
|
34
|
-
// content: "";
|
|
35
|
-
// position: absolute;
|
|
36
|
-
// z-index: $base-z-index * 300;
|
|
37
|
-
// top: 0;
|
|
38
|
-
// height: 100%;
|
|
39
|
-
// width: 50px;
|
|
40
|
-
// transform: translateX(-100%);
|
|
41
|
-
// background: linear-gradient(to left, #fff, rgba(0, 0, 0, 0));
|
|
42
|
-
// pointer-events: none;
|
|
43
|
-
// }
|
|
44
|
-
// }
|
|
45
37
|
}
|
|
46
38
|
|
|
47
39
|
.#{$namespace}-titles {
|
|
@@ -250,8 +250,8 @@ export class DefaultTitleBar implements TeleTitleBar {
|
|
|
250
250
|
const now = Date.now();
|
|
251
251
|
if (now - this.lastTitleBarClick.timestamp <= 500) {
|
|
252
252
|
if (
|
|
253
|
-
Math.abs(ev.clientX - this.lastTitleBarClick.clientX) <=
|
|
254
|
-
Math.abs(ev.clientY - this.lastTitleBarClick.clientY) <=
|
|
253
|
+
Math.abs(ev.clientX - this.lastTitleBarClick.clientX) <= 5 &&
|
|
254
|
+
Math.abs(ev.clientY - this.lastTitleBarClick.clientY) <= 5
|
|
255
255
|
) {
|
|
256
256
|
// double click
|
|
257
257
|
if (this.onEvent) {
|
|
@@ -291,8 +291,8 @@ export class DefaultTitleBar implements TeleTitleBar {
|
|
|
291
291
|
|
|
292
292
|
if (now - this.lastTitleBarTouch.timestamp <= 500) {
|
|
293
293
|
if (
|
|
294
|
-
Math.abs(clientX - this.lastTitleBarTouch.clientX) <=
|
|
295
|
-
Math.abs(clientY - this.lastTitleBarTouch.clientY) <=
|
|
294
|
+
Math.abs(clientX - this.lastTitleBarTouch.clientX) <= 10 &&
|
|
295
|
+
Math.abs(clientY - this.lastTitleBarTouch.clientY) <= 10
|
|
296
296
|
) {
|
|
297
297
|
// double click
|
|
298
298
|
if (this.onEvent) {
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
@import "../../scss/variables.scss";
|
|
2
|
+
@import "../../scss/mixins.scss";
|
|
2
3
|
|
|
3
4
|
.#{$namespace}-titlebar {
|
|
5
|
+
@include no-user-select;
|
|
6
|
+
|
|
4
7
|
box-sizing: border-box;
|
|
5
8
|
height: 26px;
|
|
6
9
|
display: flex;
|
|
7
10
|
align-items: center;
|
|
8
|
-
padding: 0 16px;
|
|
9
11
|
background: #fff;
|
|
10
12
|
user-select: none;
|
|
11
13
|
border-bottom: 1px solid #eeeef7;
|
|
@@ -13,6 +15,7 @@
|
|
|
13
15
|
}
|
|
14
16
|
|
|
15
17
|
.#{$namespace}-title-area {
|
|
18
|
+
padding-left: 16px;
|
|
16
19
|
overflow: hidden;
|
|
17
20
|
position: relative;
|
|
18
21
|
height: 100%;
|
|
@@ -22,6 +25,8 @@
|
|
|
22
25
|
}
|
|
23
26
|
|
|
24
27
|
.#{$namespace}-title {
|
|
28
|
+
@include no-user-select;
|
|
29
|
+
|
|
25
30
|
overflow: hidden;
|
|
26
31
|
margin: 0;
|
|
27
32
|
padding: 0;
|
|
@@ -45,6 +50,7 @@
|
|
|
45
50
|
}
|
|
46
51
|
|
|
47
52
|
.#{$namespace}-titlebar-btns {
|
|
53
|
+
padding-right: 16px;
|
|
48
54
|
white-space: nowrap;
|
|
49
55
|
word-break: keep-all;
|
|
50
56
|
margin-left: auto;
|
|
@@ -52,6 +58,8 @@
|
|
|
52
58
|
}
|
|
53
59
|
|
|
54
60
|
.#{$namespace}-titlebar-btn {
|
|
61
|
+
@include no-user-select;
|
|
62
|
+
|
|
55
63
|
width: 22px;
|
|
56
64
|
height: 22px;
|
|
57
65
|
padding: 0;
|