@netless/telebox-insider 1.0.0-alpha.2 → 1.0.0-alpha.22

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.
Files changed (35) hide show
  1. package/dist/TeleBox/index.d.ts +49 -34
  2. package/dist/TeleBox/typings.d.ts +22 -10
  3. package/dist/TeleBox/utils.d.ts +5 -0
  4. package/dist/TeleBoxCollector/index.d.ts +7 -6
  5. package/dist/TeleBoxManager/MaxTitleBar/index.d.ts +1 -1
  6. package/dist/TeleBoxManager/index.d.ts +8 -2
  7. package/dist/TeleBoxManager/typings.d.ts +12 -6
  8. package/dist/TeleTitleBar/DefaultTitleBar/index.d.ts +3 -5
  9. package/dist/TeleTitleBar/typings.d.ts +1 -1
  10. package/dist/style.css +1 -1
  11. package/dist/telebox-insider.cjs.js +2 -1
  12. package/dist/telebox-insider.cjs.js.map +1 -1
  13. package/dist/telebox-insider.es.js +1647 -1
  14. package/dist/telebox-insider.es.js.map +1 -1
  15. package/package.json +3 -3
  16. package/src/TeleBox/index.ts +373 -261
  17. package/src/TeleBox/style.scss +9 -29
  18. package/src/TeleBox/style.shadow.scss +87 -0
  19. package/src/TeleBox/typings.ts +22 -10
  20. package/src/TeleBox/utils.ts +32 -0
  21. package/src/TeleBoxCollector/index.ts +33 -18
  22. package/src/TeleBoxCollector/style.scss +10 -4
  23. package/src/TeleBoxManager/MaxTitleBar/index.ts +3 -28
  24. package/src/TeleBoxManager/MaxTitleBar/style.scss +38 -16
  25. package/src/TeleBoxManager/index.ts +106 -54
  26. package/src/TeleBoxManager/style.scss +56 -0
  27. package/src/TeleBoxManager/typings.ts +24 -7
  28. package/src/TeleTitleBar/DefaultTitleBar/index.ts +4 -12
  29. package/src/TeleTitleBar/DefaultTitleBar/style.scss +68 -11
  30. package/src/TeleTitleBar/typings.ts +1 -1
  31. package/src/scss/mixins.scss +5 -0
  32. package/src/scss/variables.scss +46 -0
  33. package/dist/TeleStage/index.d.ts +0 -21
  34. package/src/TeleStage/index.ts +0 -178
  35. package/src/TeleStage/style.scss +0 -49
@@ -1,3 +1,5 @@
1
+ import "./style.scss";
2
+
1
3
  import shallowequal from "shallowequal";
2
4
  import { ResizeObserver as ResizeObserverPolyfill } from "@juggle/resize-observer";
3
5
  import { SideEffectManager } from "side-effect-manager";
@@ -6,11 +8,13 @@ import type {
6
8
  ValEnhancedResult,
7
9
  ReadonlyValEnhancedResult,
8
10
  } from "value-enhancer";
11
+ import { derive } from "value-enhancer";
9
12
  import {
10
13
  combine,
11
14
  Val,
12
15
  withValueEnhancer,
13
16
  withReadonlyValueEnhancer,
17
+ ValManager,
14
18
  } from "value-enhancer";
15
19
  import Emittery from "emittery";
16
20
  import type {
@@ -36,7 +40,7 @@ import type {
36
40
  TeleBoxManagerUpdateConfig,
37
41
  } from "./typings";
38
42
  import { MaxTitleBar } from "./MaxTitleBar";
39
- import { TeleStage } from "../TeleStage";
43
+ import { calcStageRect } from "../TeleBox/utils";
40
44
 
41
45
  export * from "./typings";
42
46
  export * from "./constants";
@@ -58,7 +62,10 @@ type ValConfig = {
58
62
  maximized: Val<boolean, boolean>;
59
63
  fence: Val<boolean, boolean>;
60
64
  stageRatio: Val<number, boolean>;
61
- highlightStage: Val<boolean, boolean>;
65
+ containerStyle: Val<string>;
66
+ stageStyle: Val<string>;
67
+ defaultBoxBodyStyle: Val<string | null>;
68
+ defaultBoxStageStyle: Val<string | null>;
62
69
  };
63
70
 
64
71
  type CombinedValEnhancedResult = ValEnhancedResult<ValConfig> &
@@ -72,24 +79,33 @@ export class TeleBoxManager {
72
79
  prefersColorScheme = TELE_BOX_COLOR_SCHEME.Light,
73
80
  minimized = false,
74
81
  maximized = false,
75
- fence = false,
82
+ fence = true,
76
83
  collector,
77
84
  namespace = "telebox",
78
85
  readonly = false,
79
86
  stageRatio = -1,
80
- highlightStage = true,
87
+ containerStyle = "",
88
+ stageStyle = "",
89
+ defaultBoxBodyStyle = null,
90
+ defaultBoxStageStyle = null,
81
91
  }: TeleBoxManagerConfig = {}) {
82
92
  this._sideEffect = new SideEffectManager();
83
93
 
84
94
  this.namespace = namespace;
85
95
 
96
+ const valManager = new ValManager();
97
+ this._sideEffect.addDisposer(() => valManager.destroy());
98
+
86
99
  const root$ = new Val(root);
87
100
  const readonly$ = new Val(readonly);
88
101
  const minimized$ = new Val(minimized);
89
102
  const maximized$ = new Val(maximized);
90
103
  const fence$ = new Val(fence);
104
+ const containerStyle$ = new Val(containerStyle);
105
+ const stageStyle$ = new Val(stageStyle);
91
106
  const stageRatio$ = new Val(stageRatio);
92
- const highlightStage$ = new Val(highlightStage);
107
+ const defaultBoxBodyStyle$ = new Val(defaultBoxBodyStyle);
108
+ const defaultBoxStageStyle$ = new Val(defaultBoxStageStyle);
93
109
 
94
110
  const rootRect$ = new Val<TeleBoxRect>(
95
111
  {
@@ -106,23 +122,14 @@ export class TeleBoxManager {
106
122
  if (!root) {
107
123
  return () => void 0;
108
124
  }
109
- const observer = new ResizeObserver((entries) => {
110
- this._sideEffect.setTimeout(
111
- // debounce
112
- () => {
113
- const rect = entries[0]?.contentRect;
114
- if (rect) {
115
- rootRect$.setValue({
116
- x: rect.x,
117
- y: rect.y,
118
- width: rect.width,
119
- height: rect.height,
120
- });
121
- }
122
- },
123
- 50,
124
- "root-resize-observer"
125
- );
125
+ const observer = new ResizeObserver(() => {
126
+ const rect = root.getBoundingClientRect();
127
+ rootRect$.setValue({
128
+ x: 0,
129
+ y: 0,
130
+ width: rect.width,
131
+ height: rect.height,
132
+ });
126
133
  });
127
134
  observer.observe(root);
128
135
  return () => observer.disconnect();
@@ -130,6 +137,10 @@ export class TeleBoxManager {
130
137
  })
131
138
  );
132
139
 
140
+ const stageRect$ = combine([rootRect$, stageRatio$], calcStageRect, {
141
+ compare: shallowequal,
142
+ });
143
+
133
144
  this.boxes$ = new Val<TeleBox[]>([]);
134
145
  this.topBox$ = new Val<TeleBox | undefined>(undefined);
135
146
  this._sideEffect.addDisposer(
@@ -199,27 +210,17 @@ export class TeleBoxManager {
199
210
  darkMode$: darkMode$,
200
211
  namespace,
201
212
  root$,
202
- rootRect$,
203
213
  });
204
214
 
205
- const teleStage = new TeleStage({
206
- namespace,
207
- rootRect$,
208
- ratio$: stageRatio$,
209
- root$,
210
- highlightStage$,
211
- });
212
- this._sideEffect.addDisposer(() => teleStage.destroy());
213
-
214
215
  const readonlyValConfig: ReadonlyValConfig = {
215
216
  darkMode: darkMode$,
216
217
  state: state$,
217
218
  root: root$,
218
219
  rootRect: rootRect$,
219
- stageRect: teleStage.stageRect$,
220
+ stageRect: stageRect$,
220
221
  };
221
222
 
222
- withReadonlyValueEnhancer(this, readonlyValConfig);
223
+ withReadonlyValueEnhancer(this, readonlyValConfig, valManager);
223
224
 
224
225
  const valConfig: ValConfig = {
225
226
  prefersColorScheme: prefersColorScheme$,
@@ -228,10 +229,13 @@ export class TeleBoxManager {
228
229
  minimized: minimized$,
229
230
  maximized: maximized$,
230
231
  stageRatio: stageRatio$,
231
- highlightStage: highlightStage$,
232
+ containerStyle: containerStyle$,
233
+ stageStyle: stageStyle$,
234
+ defaultBoxBodyStyle: defaultBoxBodyStyle$,
235
+ defaultBoxStageStyle: defaultBoxStageStyle$,
232
236
  };
233
237
 
234
- withValueEnhancer(this, valConfig);
238
+ withValueEnhancer(this, valConfig, valManager);
235
239
 
236
240
  const closeBtnClassName = this.wrapClassName("titlebar-icon-close");
237
241
 
@@ -278,14 +282,60 @@ export class TeleBoxManager {
278
282
  true
279
283
  );
280
284
 
285
+ this.$container = document.createElement("div");
286
+ this.$container.className = this.wrapClassName("manager-container");
287
+
288
+ this.$stage = document.createElement("div");
289
+ this.$stage.className = this.wrapClassName("manager-stage");
290
+ this.$container.appendChild(this.$stage);
291
+
292
+ this._sideEffect.addDisposer([
293
+ darkMode$.subscribe((darkMode) => {
294
+ this.$container.classList.toggle(
295
+ this.wrapClassName("color-scheme-dark"),
296
+ darkMode
297
+ );
298
+ this.$container.classList.toggle(
299
+ this.wrapClassName("color-scheme-light"),
300
+ !darkMode
301
+ );
302
+ }),
303
+ maximized$.subscribe((maximized) => {
304
+ this.$container.classList.toggle("is-maximized", maximized);
305
+ }),
306
+ minimized$.subscribe((minimized) => {
307
+ this.$container.classList.toggle("is-minimized", minimized);
308
+ }),
309
+ containerStyle$.subscribe((containerStyle) => {
310
+ this.$container.style.cssText = containerStyle;
311
+ }),
312
+ stageStyle$.subscribe((stageStyle) => {
313
+ this.$stage.style.cssText = stageStyle;
314
+ this.$stage.style.width = stageRect$.value.width + "px";
315
+ this.$stage.style.height = stageRect$.value.height + "px";
316
+ }),
317
+ stageRect$.subscribe((stageRect) => {
318
+ this.$stage.style.width = stageRect.width + "px";
319
+ this.$stage.style.height = stageRect.height + "px";
320
+ }),
321
+ root$.subscribe((root) => {
322
+ if (root) {
323
+ root.appendChild(this.$container);
324
+ } else if (this.$container.parentElement) {
325
+ this.$container.remove();
326
+ }
327
+ }),
328
+ ]);
329
+
281
330
  this.titleBar = new MaxTitleBar({
282
331
  namespace: this.namespace,
332
+ title$: derive(this.topBox$, (topBox) => topBox?.title || ""),
283
333
  boxes$: this.boxes$,
284
334
  darkMode$: darkMode$,
285
335
  readonly$: readonly$,
286
336
  state$: state$,
287
- root$,
288
337
  rootRect$: rootRect$,
338
+ root: this.$container,
289
339
  onEvent: (event): void => {
290
340
  switch (event.type) {
291
341
  case TELE_BOX_DELEGATE_EVENT.Maximize: {
@@ -338,6 +388,10 @@ export class TeleBoxManager {
338
388
  ]);
339
389
  }
340
390
 
391
+ public readonly $container: HTMLDivElement;
392
+
393
+ public readonly $stage: HTMLDivElement;
394
+
341
395
  public get boxes(): ReadonlyArray<TeleBox> {
342
396
  return this.boxes$.value;
343
397
  }
@@ -386,17 +440,18 @@ export class TeleBoxManager {
386
440
  ...config,
387
441
  ...(smartPosition ? this.smartPosition(config) : {}),
388
442
  namespace: this.namespace,
389
- root$: this._root$,
443
+ root: this.$stage,
390
444
  darkMode$: this._darkMode$,
391
445
  maximized$: this._maximized$,
392
446
  minimized$: this._minimized$,
393
447
  fence$: this._fence$,
394
448
  rootRect$: this._rootRect$,
395
449
  managerStageRect$: this._stageRect$,
396
- stageRatio$: this._stageRatio$,
450
+ managerStageRatio$: this._stageRatio$,
397
451
  readonly$: this._readonly$,
398
452
  collectorRect$: this.collector._rect$,
399
- managerHighlightStage$: this._highlightStage$,
453
+ defaultBoxBodyStyle$: this._defaultBoxBodyStyle$,
454
+ defaultBoxStageStyle$: this._defaultBoxStageStyle$,
400
455
  });
401
456
 
402
457
  if (box.focus) {
@@ -663,12 +718,15 @@ export class TeleBoxManager {
663
718
  if (config.draggable != null) {
664
719
  box._draggable$.setValue(config.draggable, skipUpdate);
665
720
  }
666
- if (config.ratio != null) {
667
- box._ratio$.setValue(config.ratio, skipUpdate);
721
+ if (config.boxRatio != null) {
722
+ box._boxRatio$.setValue(config.boxRatio, skipUpdate);
668
723
  }
669
724
  if (config.zIndex != null) {
670
725
  box._zIndex$.setValue(config.zIndex, skipUpdate);
671
726
  }
727
+ if (config.stageRatio !== undefined) {
728
+ box.setStageRatio(config.stageRatio, skipUpdate);
729
+ }
672
730
  if (config.content != null) {
673
731
  box.mountContent(config.content);
674
732
  }
@@ -694,33 +752,27 @@ export class TeleBoxManager {
694
752
  const topBox = this.topBox;
695
753
 
696
754
  if (x == null) {
697
- let pxX = stageRect.x + 20;
755
+ let pxX = 20;
698
756
  if (topBox) {
699
757
  const pxPreferredX = topBox.pxIntrinsicCoord.x + 20;
700
758
  const pxIntrinsicWidth = width * stageRect.width;
701
- if (
702
- pxPreferredX + pxIntrinsicWidth <=
703
- stageRect.x + stageRect.width
704
- ) {
759
+ if (pxPreferredX + pxIntrinsicWidth <= stageRect.width) {
705
760
  pxX = pxPreferredX;
706
761
  }
707
762
  }
708
- x = (pxX - stageRect.x) / stageRect.width;
763
+ x = pxX / stageRect.width;
709
764
  }
710
765
 
711
766
  if (y == null) {
712
- let pxY = stageRect.y + 20;
767
+ let pxY = 20;
713
768
  if (topBox) {
714
769
  const pxPreferredY = topBox.pxIntrinsicCoord.y + 20;
715
770
  const pxIntrinsicHeight = height * stageRect.height;
716
- if (
717
- pxPreferredY + pxIntrinsicHeight <=
718
- stageRect.y + stageRect.height
719
- ) {
771
+ if (pxPreferredY + pxIntrinsicHeight <= stageRect.height) {
720
772
  pxY = pxPreferredY;
721
773
  }
722
774
  }
723
- y = (pxY - stageRect.y) / stageRect.height;
775
+ y = pxY / stageRect.height;
724
776
  }
725
777
 
726
778
  return { x, y, width, height };
@@ -0,0 +1,56 @@
1
+ @import "../scss/variables.scss";
2
+ @import "../scss/mixins.scss";
3
+
4
+ .#{$namespace}-manager-container {
5
+ position: relative;
6
+ overflow: hidden;
7
+ width: 100%;
8
+ height: 100%;
9
+ display: flex;
10
+ justify-content: center;
11
+ align-items: center;
12
+ @include v(
13
+ background,
14
+ manager-container-background,
15
+ $manager-container-background
16
+ );
17
+
18
+ &.is-maximized,
19
+ &.is-minimized {
20
+ & > .#{$namespace}-manager-stage {
21
+ overflow: visible;
22
+ }
23
+ }
24
+ }
25
+
26
+ .#{$namespace}-manager-stage {
27
+ position: relative;
28
+ overflow: hidden;
29
+ @include v(background, manager-stage-background, $manager-stage-background);
30
+ @include v(box-shadow, manager-stage-shadow, $manager-stage-shadow);
31
+ }
32
+
33
+ .#{$namespace}-color-scheme-dark {
34
+ color-scheme: dark;
35
+
36
+ &.#{$namespace}-manager-container {
37
+ @include v(
38
+ background,
39
+ manager-container-background-dark,
40
+ $manager-container-background-dark
41
+ );
42
+
43
+ & > .#{$namespace}-manager-stage {
44
+ @include v(
45
+ background,
46
+ manager-stage-background-dark,
47
+ $manager-stage-background-dark
48
+ );
49
+ @include v(
50
+ box-shadow,
51
+ manager-stage-shadow-dark,
52
+ $manager-stage-shadow-dark
53
+ );
54
+ }
55
+ }
56
+ }
@@ -21,8 +21,14 @@ export interface TeleBoxManagerConfig extends Pick<TeleBoxConfig, "namespace"> {
21
21
  readonly minimized?: boolean;
22
22
  /** Is box readonly */
23
23
  readonly readonly?: boolean;
24
- /** Show stage frame and grey-out the non-stage area. Default true. */
25
- readonly highlightStage?: boolean;
24
+ /** Custom styles for telebox manager container */
25
+ readonly containerStyle?: string;
26
+ /** Custom styles for telebox manager stage */
27
+ readonly stageStyle?: string;
28
+ /** Custom `style` attribute value for content area of all boxes. Can be overwritten by box. */
29
+ readonly defaultBoxBodyStyle?: string | null;
30
+ /** Custom `style` attribute value for stage area of all boxes. Can be overwritten by box. */
31
+ readonly defaultBoxStageStyle?: string | null;
26
32
  }
27
33
 
28
34
  type TeleBoxManagerBoxConfigBaseProps =
@@ -36,12 +42,22 @@ type TeleBoxManagerBoxConfigBaseProps =
36
42
  | "y"
37
43
  | "resizable"
38
44
  | "draggable"
39
- | "ratio"
40
- | "zIndex";
45
+ | "boxRatio"
46
+ | "zIndex"
47
+ | "stageRatio";
41
48
 
42
49
  export type TeleBoxManagerCreateConfig = Pick<
43
50
  TeleBoxConfig,
44
- TeleBoxManagerBoxConfigBaseProps | "content" | "footer" | "id" | "focus"
51
+ | TeleBoxManagerBoxConfigBaseProps
52
+ | "content"
53
+ | "stage"
54
+ | "footer"
55
+ | "styles"
56
+ | "bodyStyle"
57
+ | "stageStyle"
58
+ | "id"
59
+ | "focus"
60
+ | "enableShadowDOM"
45
61
  >;
46
62
 
47
63
  export type TeleBoxManagerQueryConfig = Pick<
@@ -50,7 +66,8 @@ export type TeleBoxManagerQueryConfig = Pick<
50
66
  | "visible"
51
67
  | "resizable"
52
68
  | "draggable"
53
- | "ratio"
69
+ | "boxRatio"
70
+ | "stageRatio"
54
71
  | "zIndex"
55
72
  | "id"
56
73
  | "focus"
@@ -58,7 +75,7 @@ export type TeleBoxManagerQueryConfig = Pick<
58
75
 
59
76
  export type TeleBoxManagerUpdateConfig = Pick<
60
77
  TeleBoxConfig,
61
- TeleBoxManagerBoxConfigBaseProps | "content" | "footer"
78
+ TeleBoxManagerBoxConfigBaseProps | "content" | "stage" | "footer"
62
79
  >;
63
80
 
64
81
  type CheckTeleBoxManagerConfig<
@@ -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
 
@@ -8,10 +8,12 @@
8
8
  height: 26px;
9
9
  display: flex;
10
10
  align-items: center;
11
- background: #fff;
12
11
  user-select: none;
13
- border-bottom: 1px solid #eeeef7;
14
12
  touch-action: manipulation;
13
+
14
+ @include v(color, titlebar-color, $titlebar-color);
15
+ @include v(background-color, titlebar-background, $titlebar-background);
16
+ @include v(border-bottom, titlebar-border-bottom, $titlebar-border-bottom);
15
17
  }
16
18
 
17
19
  .#{$namespace}-title-area {
@@ -26,6 +28,7 @@
26
28
 
27
29
  .#{$namespace}-title {
28
30
  @include no-user-select;
31
+ @include v(color, titlebar-color, $titlebar-color);
29
32
 
30
33
  overflow: hidden;
31
34
  margin: 0;
@@ -36,7 +39,6 @@
36
39
  white-space: nowrap;
37
40
  word-break: keep-all;
38
41
  text-overflow: ellipsis;
39
- color: #191919;
40
42
  }
41
43
 
42
44
  .#{$namespace}-drag-area {
@@ -85,31 +87,86 @@
85
87
  }
86
88
 
87
89
  .#{$namespace}-titlebar-icon-minimize {
88
- background: center / cover no-repeat url("./icons/minimize.svg");
90
+ background: center / cover no-repeat;
91
+ @include v(
92
+ background-image,
93
+ titlebar-icon-minimize,
94
+ url("./icons/minimize.svg")
95
+ );
89
96
  }
90
97
 
91
98
  .#{$namespace}-titlebar-icon-maximize {
92
- background: center / cover no-repeat url("./icons/maximize.svg");
99
+ background: center / cover no-repeat;
100
+ @include v(
101
+ background-image,
102
+ titlebar-icon-maximize,
103
+ url("./icons/maximize.svg")
104
+ );
93
105
 
94
106
  &.is-active {
95
- background-image: url("./icons/maximize-active.svg");
107
+ @include v(
108
+ background-image,
109
+ titlebar-icon-maximize-active,
110
+ url("./icons/maximize-active.svg")
111
+ );
96
112
  }
97
113
  }
98
114
 
99
115
  .#{$namespace}-titlebar-icon-close {
100
- background: center / cover no-repeat url("./icons/close.svg");
116
+ background: center / cover no-repeat;
117
+ @include v(background-image, titlebar-icon-close, url("./icons/close.svg"));
101
118
  }
102
119
 
103
120
  .#{$namespace}-color-scheme-dark {
104
121
  color-scheme: dark;
105
122
 
106
123
  .#{$namespace}-title {
107
- color: #e9e9e9;
124
+ @include v(color, titlebar-color-dark, $titlebar-color-dark);
108
125
  }
109
126
 
110
127
  .#{$namespace}-titlebar {
111
- color: #e9e9e9;
112
- background: #43434d;
113
- border-bottom: none;
128
+ @include v(color, titlebar-color-dark, $titlebar-color-dark);
129
+ @include v(
130
+ background-color,
131
+ titlebar-background-dark,
132
+ $titlebar-background-dark
133
+ );
134
+ @include v(
135
+ border-bottom,
136
+ titlebar-border-bottom-dark,
137
+ $titlebar-border-bottom-dark
138
+ );
139
+ }
140
+
141
+ .#{$namespace}-titlebar-icon-minimize {
142
+ @include v(
143
+ background-image,
144
+ titlebar-icon-minimize-dark,
145
+ url("./icons/minimize.svg")
146
+ );
147
+ }
148
+
149
+ .#{$namespace}-titlebar-icon-maximize {
150
+ @include v(
151
+ background-image,
152
+ titlebar-icon-maximize-dark,
153
+ url("./icons/maximize.svg")
154
+ );
155
+
156
+ &.is-active {
157
+ @include v(
158
+ background-image,
159
+ titlebar-icon-maximize-active-dark,
160
+ url("./icons/maximize-active.svg")
161
+ );
162
+ }
163
+ }
164
+
165
+ .#{$namespace}-titlebar-icon-close {
166
+ @include v(
167
+ background-image,
168
+ titlebar-icon-close-dark,
169
+ url("./icons/close.svg")
170
+ );
114
171
  }
115
172
  }
@@ -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;
@@ -5,3 +5,8 @@
5
5
  // iOS Safari
6
6
  -webkit-user-select: none;
7
7
  }
8
+
9
+ @mixin v($property, $varName, $val) {
10
+ #{$property}: $val;
11
+ #{$property}: var(--tele-#{$varName}, $val);
12
+ }
@@ -1,2 +1,48 @@
1
1
  $namespace: "telebox";
2
+
2
3
  $base-z-index: 100;
4
+ $max-titlebar-z-index: $base-z-index + 5000;
5
+ $stage-z-index: $max-titlebar-z-index + 10;
6
+ $collector-z-index: $stage-z-index + 10;
7
+
8
+ $manager-container-background: #f9f9f9;
9
+ $manager-container-background-dark: #25282e;
10
+ $manager-stage-background: #fff;
11
+ $manager-stage-background-dark: #272a30;
12
+ $manager-stage-shadow: 0px 0px 16px rgba(0, 0, 0, 0.08);
13
+ $manager-stage-shadow-dark: 0px 0px 16px rgba(0, 0, 0, 0.24);
14
+
15
+ $box-container-background: $manager-container-background;
16
+ $box-container-background-dark: $manager-container-background-dark;
17
+ $box-stage-background: $manager-stage-background;
18
+ $box-stage-background-dark: $manager-stage-background-dark;
19
+ $box-stage-shadow: $manager-stage-shadow;
20
+ $box-stage-shadow-dark: $manager-stage-shadow-dark;
21
+
22
+ $box-color: #191919;
23
+ $box-color-dark: #e9e9e9;
24
+ $box-border: 1px solid #e3e3ec;
25
+ $box-border-dark: 1px solid #383b42;
26
+ $box-shadow: 0px 4px 10px 0px rgba(47, 65, 146, 0.15);
27
+ $box-shadow-dark: 0px 4px 10px 0px rgba(56, 59, 66, 0.15);
28
+
29
+ $titlebar-color: #191919;
30
+ $titlebar-color-dark: #e9e9e9;
31
+ $titlebar-background: #fff;
32
+ $titlebar-background-dark: #383b42;
33
+ $titlebar-border-bottom: 1px solid #eeeef7;
34
+ $titlebar-border-bottom-dark: none;
35
+
36
+ $titlebar-tab-color: #7b88a0;
37
+ $titlebar-tab-color-dark: #e9e9e9;
38
+ $titlebar-tab-focus-color: #357bf6;
39
+ $titlebar-tab-focus-color-dark: #357bf6;
40
+ $titlebar-tab-background: transparent;
41
+ $titlebar-tab-background-dark: transparent;
42
+ $titlebar-tab-divider-color: #e5e5f0;
43
+ $titlebar-tab-divider-color-dark: #7b88a0;
44
+
45
+ $collector-background: #fff;
46
+ $collector-background-dark: #383b42;
47
+ $collector-shadow: 0px 2px 6px 0px rgba(47, 65, 146, 0.15);
48
+ $collector-shadow-dark: $collector-shadow;