@netless/telebox-insider 0.2.20 → 0.2.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/telebox-insider",
3
- "version": "0.2.20",
3
+ "version": "0.2.24",
4
4
  "private": false,
5
5
  "description": "Window widget for Whiteboard",
6
6
  "license": "MIT",
@@ -5,7 +5,6 @@
5
5
  top: 0;
6
6
  left: 0;
7
7
  z-index: $base-z-index;
8
- will-change: transform;
9
8
  transition: width 0.4s cubic-bezier(0.4, 0.9, 0.71, 1.02),
10
9
  height 0.4s cubic-bezier(0.55, 0.82, 0.63, 0.95),
11
10
  opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0), transform 0.4s ease;
@@ -182,7 +181,6 @@
182
181
  }
183
182
 
184
183
  .#{$namespace}-minimized {
185
- will-change: transform;
186
184
  transition: width 0.05s cubic-bezier(0.4, 0.9, 0.71, 1.02),
187
185
  height 0.05s cubic-bezier(0.55, 0.82, 0.63, 0.95),
188
186
  opacity 0.6s cubic-bezier(0.7, 0, 0.84, 0), transform 0.6s ease;
@@ -21,6 +21,7 @@
21
21
  background-repeat: no-repeat;
22
22
  background-size: 18px 16px;
23
23
  background-position: center;
24
+ -webkit-tap-highlight-color: transparent;
24
25
  }
25
26
 
26
27
  .#{$namespace}-collector-visible {
@@ -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
- if (this.$title) {
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(),
@@ -16,32 +16,22 @@ $scrollbar-color-active: rgba(238, 238, 247, 1);
16
16
  z-index: $base-z-index * 500;
17
17
  user-select: none;
18
18
 
19
- .#{$namespace}-drag-area {
20
- height: 100%;
21
- min-width: 16px;
22
- position: static;
23
- margin: 0;
24
- flex-grow: 1;
25
- flex-shrink: 0;
19
+ .#{$namespace}-title {
20
+ display: none;
21
+ }
22
+
23
+ &.#{$namespace}-max-titlebar-single-title {
24
+ .#{$namespace}-titles {
25
+ display: none;
26
+ }
27
+ .#{$namespace}-title {
28
+ display: block;
29
+ }
26
30
  }
27
31
  }
28
32
 
29
33
  .#{$namespace}-max-titlebar-maximized {
30
34
  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
35
  }
46
36
 
47
37
  .#{$namespace}-titles {
@@ -458,8 +458,11 @@ export class TeleBoxManager {
458
458
  }
459
459
  });
460
460
  box._zIndex$.reaction((_, __, skipUpdate) => {
461
- if (this.topBox && box.zIndex > this.topBox.zIndex) {
462
- this.topBox$.setValue(box);
461
+ if (this.boxes.length > 0) {
462
+ const topBox = this.boxes.reduce((topBox, box) =>
463
+ topBox.zIndex > box.zIndex ? topBox : box
464
+ );
465
+ this.topBox$.setValue(topBox);
463
466
  }
464
467
  if (!skipUpdate) {
465
468
  this.events.emit(TELE_BOX_MANAGER_EVENT.ZIndex, box);
@@ -734,7 +737,6 @@ export class TeleBoxManager {
734
737
  if (this.topBox) {
735
738
  if (box !== this.topBox) {
736
739
  box.setZIndex(this.topBox.zIndex + 1, skipUpdate);
737
- this.topBox$.setValue(box);
738
740
  }
739
741
  }
740
742
  }
@@ -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) <= 3 &&
254
- Math.abs(ev.clientY - this.lastTitleBarClick.clientY) <= 3
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) <= 3 &&
295
- Math.abs(clientY - this.lastTitleBarTouch.clientY) <= 3
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) {
@@ -5,7 +5,6 @@
5
5
  height: 26px;
6
6
  display: flex;
7
7
  align-items: center;
8
- padding: 0 16px;
9
8
  background: #fff;
10
9
  user-select: none;
11
10
  border-bottom: 1px solid #eeeef7;
@@ -13,6 +12,7 @@
13
12
  }
14
13
 
15
14
  .#{$namespace}-title-area {
15
+ padding-left: 16px;
16
16
  overflow: hidden;
17
17
  position: relative;
18
18
  height: 100%;
@@ -45,6 +45,7 @@
45
45
  }
46
46
 
47
47
  .#{$namespace}-titlebar-btns {
48
+ padding-right: 16px;
48
49
  white-space: nowrap;
49
50
  word-break: keep-all;
50
51
  margin-left: auto;