@netless/telebox-insider 1.0.0-alpha.1 → 1.0.0-alpha.4

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.
@@ -14,7 +14,7 @@ import type {
14
14
  TeleTitleBarEvent,
15
15
  } from "../typings";
16
16
  import { preventEvent } from "../../utils";
17
- import { Val } from "value-enhancer";
17
+ import type { ReadonlyVal } from "value-enhancer";
18
18
 
19
19
  export type DefaultTitleBarButton = TeleTitleBarEvent & {
20
20
  readonly iconClassName: string;
@@ -29,7 +29,7 @@ export class DefaultTitleBar implements TeleTitleBar {
29
29
  public constructor({
30
30
  readonly$,
31
31
  state$,
32
- title = "",
32
+ title$,
33
33
  buttons,
34
34
  onEvent,
35
35
  onDragStart,
@@ -37,7 +37,7 @@ export class DefaultTitleBar implements TeleTitleBar {
37
37
  }: DefaultTitleBarConfig) {
38
38
  this.readonly$ = readonly$;
39
39
  this.state$ = state$;
40
- this.title$ = new Val(title);
40
+ this.title$ = title$;
41
41
  this.onEvent = onEvent;
42
42
  this.onDragStart = onDragStart;
43
43
  this.namespace = namespace;
@@ -67,14 +67,6 @@ export class DefaultTitleBar implements TeleTitleBar {
67
67
 
68
68
  public $dragArea: HTMLElement;
69
69
 
70
- public get title(): string {
71
- return this.title$.value;
72
- }
73
-
74
- public setTitle(title: string): void {
75
- this.title$.setValue(title);
76
- }
77
-
78
70
  public render(): HTMLElement {
79
71
  if (!this.$titleBar) {
80
72
  this.$titleBar = document.createElement("div");
@@ -205,7 +197,7 @@ export class DefaultTitleBar implements TeleTitleBar {
205
197
 
206
198
  protected readonly$: TeleTitleBarConfig["readonly$"];
207
199
 
208
- protected title$: Val<string>;
200
+ protected title$: ReadonlyVal<string>;
209
201
 
210
202
  protected buttons: ReadonlyArray<DefaultTitleBarButton>;
211
203
 
@@ -10,7 +10,7 @@ export type TeleTitleBarEvent<U = keyof TeleBoxDelegateEventConfig> =
10
10
 
11
11
  export interface TeleTitleBarConfig {
12
12
  readonly$: ReadonlyVal<boolean, boolean>;
13
- title?: string;
13
+ title$: ReadonlyVal<string, boolean>;
14
14
  state$: ReadonlyVal<TeleBoxState, boolean>;
15
15
  namespace?: string;
16
16
  onEvent?: (event: TeleTitleBarEvent) => void;