@netless/telebox-insider 0.3.0-beta.8 → 0.3.0

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.
@@ -27,6 +27,8 @@ export interface DefaultTitleBarConfig extends TeleTitleBarConfig {
27
27
 
28
28
  export class DefaultTitleBar implements TeleTitleBar {
29
29
  protected boxStatus?: TeleBoxState;
30
+ protected forceTop?: boolean;
31
+ protected forceNormal?: boolean;
30
32
  public constructor({
31
33
  readonly = false,
32
34
  title,
@@ -36,7 +38,9 @@ export class DefaultTitleBar implements TeleTitleBar {
36
38
  namespace = "telebox",
37
39
  state = TELE_BOX_STATE.Normal,
38
40
  boxStatus,
39
- }: DefaultTitleBarConfig = {}) {
41
+ forceTop = false,
42
+ forceNormal = false,
43
+ }: DefaultTitleBarConfig = {}) {
40
44
  this.readonly = readonly;
41
45
  this.onEvent = onEvent;
42
46
  this.onDragStart = onDragStart;
@@ -44,23 +48,29 @@ export class DefaultTitleBar implements TeleTitleBar {
44
48
  this.title = title;
45
49
  this.state = state;
46
50
  this.boxStatus = boxStatus;
51
+ this.forceTop = forceTop;
52
+ this.forceNormal = forceNormal;
47
53
 
48
- this.buttons = buttons || [
49
- {
50
- type: TELE_BOX_DELEGATE_EVENT.Minimize,
51
- iconClassName: this.wrapClassName("titlebar-icon-minimize"),
52
- },
53
- {
54
- type: TELE_BOX_DELEGATE_EVENT.Maximize,
55
- iconClassName: this.wrapClassName("titlebar-icon-maximize"),
56
- isActive: (state) => state === TELE_BOX_STATE.Maximized,
57
- },
58
- {
54
+ this.buttons = buttons || (
55
+ forceNormal ? [
56
+ {
59
57
  type: TELE_BOX_DELEGATE_EVENT.Close,
60
58
  iconClassName: this.wrapClassName("titlebar-icon-close"),
61
- },
62
- ];
63
-
59
+ }] : [
60
+ {
61
+ type: TELE_BOX_DELEGATE_EVENT.Minimize,
62
+ iconClassName: this.wrapClassName("titlebar-icon-minimize"),
63
+ },
64
+ {
65
+ type: TELE_BOX_DELEGATE_EVENT.Maximize,
66
+ iconClassName: this.wrapClassName("titlebar-icon-maximize"),
67
+ isActive: (state) => state === TELE_BOX_STATE.Maximized,
68
+ },
69
+ {
70
+ type: TELE_BOX_DELEGATE_EVENT.Close,
71
+ iconClassName: this.wrapClassName("titlebar-icon-close"),
72
+ },
73
+ ]);
64
74
  this.$dragArea = this.renderDragArea();
65
75
  }
66
76
 
@@ -70,7 +80,7 @@ export class DefaultTitleBar implements TeleTitleBar {
70
80
 
71
81
  public $title: HTMLElement | undefined;
72
82
 
73
- public $dragArea: HTMLElement;
83
+ public readonly $dragArea: HTMLElement;
74
84
 
75
85
  public setTitle(title: string): void {
76
86
  this.title = title;
@@ -137,7 +147,6 @@ export class DefaultTitleBar implements TeleTitleBar {
137
147
 
138
148
  $titleArea.appendChild(this.$title);
139
149
  $titleArea.appendChild(this.$dragArea);
140
-
141
150
  const $buttonsContainer = document.createElement("div");
142
151
  $buttonsContainer.className = this.wrapClassName("titlebar-btns");
143
152
 
@@ -12,11 +12,14 @@ export interface TeleTitleBarConfig {
12
12
  title?: string;
13
13
  state?: TeleBoxState;
14
14
  namespace?: string;
15
+ forceTop?: boolean;
16
+ forceNormal?: boolean;
15
17
  onEvent?: (event: TeleTitleBarEvent) => void;
16
18
  onDragStart?: (event: MouseEvent | TouchEvent) => void;
17
19
  }
18
20
 
19
21
  export interface TeleTitleBar {
22
+ readonly $dragArea: HTMLElement;
20
23
  setTitle(title: string): void;
21
24
 
22
25
  setState(state: TeleBoxState): void;