@netless/telebox-insider 0.2.22 → 0.2.25

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.22",
3
+ "version": "0.2.25",
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 ./build"
27
+ "cleanup": "rimraf ./dist"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@babel/plugin-proposal-class-properties": "^7.13.0",
@@ -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 {
@@ -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;