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

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.
@@ -18,7 +18,6 @@
18
18
  display: flex;
19
19
  flex-direction: column;
20
20
  overflow: hidden;
21
- background: #f9f9fc;
22
21
  box-shadow: 0px 4px 10px 0px rgba(47, 65, 146, 0.15);
23
22
  border-radius: 6px;
24
23
  border: 1px solid #e3e3ec;
@@ -44,6 +43,15 @@
44
43
  width: 100%;
45
44
  height: 100%;
46
45
  position: relative;
46
+ background: $color-container-background;
47
+ }
48
+
49
+ .#{$namespace}-content-stage {
50
+ position: absolute;
51
+ z-index: 1;
52
+ overflow: hidden;
53
+ background: $color-stage-background;
54
+ box-shadow: $color-stage-shadow;
47
55
  }
48
56
 
49
57
  .#{$namespace}-footer-wrap {
@@ -212,7 +220,15 @@
212
220
 
213
221
  .#{$namespace}-box-main {
214
222
  color: #e9e9e9;
215
- background: #212126;
216
223
  border-color: #43434d;
217
224
  }
225
+
226
+ .#{$namespace}-content {
227
+ background: $color-container-background-dark;
228
+ }
229
+
230
+ .#{$namespace}-content-stage {
231
+ background: $color-stage-background-dark;
232
+ box-shadow: $color-stage-shadow-dark;
233
+ }
218
234
  }
@@ -51,23 +51,31 @@ export interface TeleBoxConfig {
51
51
  /** Able to drag box window Default true. */
52
52
  readonly draggable?: boolean;
53
53
  /** Fixed height/width ratio for box window. No ratio limit if <= 0. Default -1. */
54
- readonly ratio?: number;
54
+ readonly boxRatio?: number;
55
55
  /** Box focused. */
56
56
  readonly focus?: boolean;
57
57
  /** Base z-index for box. */
58
58
  readonly zIndex?: number;
59
+ /** Box content stage ratio. Follow manager stage ratio if null. Default null. */
60
+ readonly stageRatio?: number | null;
59
61
  /** Classname Prefix. For CSS styling. Default "telebox". */
60
62
  readonly namespace?: string;
61
63
  /** TeleTitleBar Instance. */
62
64
  readonly titleBar?: TeleTitleBar;
63
- /** Box content. */
65
+ /** Box content element. */
64
66
  readonly content?: HTMLElement;
65
- /** Box footer. */
67
+ /** Stage element. */
68
+ readonly stage?: HTMLElement;
69
+ /** Box footer element. */
66
70
  readonly footer?: HTMLElement;
67
71
  /** Box content styles. */
68
- readonly styles?: HTMLStyleElement;
69
- /** Show stage frame and grey-out the non-stage area. Inherit setting from manager if null. Default null. */
70
- readonly highlightStage?: boolean | null;
72
+ readonly styles?: string;
73
+ /** Box content styles from end users. */
74
+ readonly userStyles?: string;
75
+ /** Custom styles for box content container. Inherit from manager container style if null. Default null. */
76
+ readonly bodyStyle?: string | null;
77
+ /** Custom styles for box content stage. Inherit from manager stage style if null. Default null. */
78
+ readonly stageStyle?: string | null;
71
79
  /** Actual Box Dark Mode */
72
80
  readonly darkMode$: ReadonlyVal<boolean, boolean>;
73
81
  /** Restrict box to always be within the stage area. Default false. */
@@ -79,17 +87,19 @@ export interface TeleBoxConfig {
79
87
  /** Is box readonly */
80
88
  readonly readonly$: ReadonlyVal<boolean, boolean>;
81
89
  /** Root element to mount boxes */
82
- readonly root$: ReadonlyVal<HTMLElement | null>;
90
+ readonly root: HTMLElement;
83
91
  /** Position and dimension of root element */
84
92
  readonly rootRect$: ReadonlyVal<TeleBoxRect>;
85
93
  /** Position and dimension of stage area */
86
94
  readonly managerStageRect$: ReadonlyVal<TeleBoxRect>;
87
95
  /** Stage area height/with ratio. No ratio if <= 0. */
88
- readonly stageRatio$: ReadonlyVal<number, boolean>;
96
+ readonly managerStageRatio$: ReadonlyVal<number, boolean>;
97
+ /** Default content styles for all boxes */
98
+ readonly defaultBoxBodyStyle$: ReadonlyVal<string | null>;
99
+ /** Default stage styles for all boxes */
100
+ readonly defaultBoxStageStyle$: ReadonlyVal<string | null>;
89
101
  /** Position and dimension of collector */
90
102
  readonly collectorRect$: ReadonlyVal<TeleBoxRect | undefined>;
91
- /** highlight stage settings from manager */
92
- readonly managerHighlightStage$: ReadonlyVal<boolean>;
93
103
  }
94
104
 
95
105
  type CheckTeleBoxConfig<T extends Record<`${TELE_BOX_EVENT}`, any>> = T;
@@ -0,0 +1,32 @@
1
+ import type { TeleBoxRect } from "./typings";
2
+
3
+ export function calcStageRect([rootRect, ratio]: [
4
+ TeleBoxRect,
5
+ number
6
+ ]): TeleBoxRect {
7
+ if (ratio <= 0 || rootRect.width <= 0 || rootRect.height <= 0) {
8
+ return rootRect;
9
+ }
10
+
11
+ const preferredHeight = rootRect.width * ratio;
12
+ if (preferredHeight === rootRect.height) {
13
+ return rootRect;
14
+ }
15
+
16
+ if (preferredHeight < rootRect.height) {
17
+ return {
18
+ x: 0,
19
+ y: (rootRect.height - preferredHeight) / 2,
20
+ width: rootRect.width,
21
+ height: preferredHeight,
22
+ };
23
+ }
24
+
25
+ const preferredWidth = rootRect.height / ratio;
26
+ return {
27
+ x: (rootRect.width - preferredWidth) / 2,
28
+ y: 0,
29
+ width: preferredWidth,
30
+ height: rootRect.height,
31
+ };
32
+ }
@@ -6,10 +6,14 @@ import type {
6
6
  ReadonlyValEnhancedResult,
7
7
  ValEnhancedResult,
8
8
  } from "value-enhancer";
9
- import { withValueEnhancer } from "value-enhancer";
10
- import { combine } from "value-enhancer";
11
- import { Val } from "value-enhancer";
12
- import { withReadonlyValueEnhancer } from "value-enhancer";
9
+ import { derive } from "value-enhancer";
10
+ import {
11
+ withValueEnhancer,
12
+ combine,
13
+ Val,
14
+ withReadonlyValueEnhancer,
15
+ ValManager,
16
+ } from "value-enhancer";
13
17
  import { SideEffectManager } from "side-effect-manager";
14
18
  import type { TeleBoxRect } from "../TeleBox/typings";
15
19
 
@@ -20,22 +24,24 @@ export interface TeleBoxCollectorConfig {
20
24
  minimized$: Val<boolean>;
21
25
  readonly$: ReadonlyVal<boolean>;
22
26
  darkMode$: ReadonlyVal<boolean>;
23
- rootRect$: ReadonlyVal<TeleBoxRect>;
24
27
  }
25
28
 
26
29
  type ValConfig = {
27
30
  styles: Val<TeleStyles>;
28
- el: Val<HTMLElement>;
31
+ $collector: Val<HTMLElement>;
32
+ };
33
+
34
+ type PropsValConfig = {
35
+ root: TeleBoxCollectorConfig["root$"];
29
36
  };
30
37
 
31
- type ReadonlyValConfig = {
38
+ type MyReadonlyValConfig = {
32
39
  rect: ReadonlyVal<TeleBoxRect | undefined>;
33
40
  visible: ReadonlyVal<boolean>;
34
- root: ReadonlyVal<HTMLElement | null>;
35
41
  };
36
42
 
37
43
  type CombinedValEnhancedResult = ValEnhancedResult<ValConfig> &
38
- ReadonlyValEnhancedResult<ReadonlyValConfig>;
44
+ ReadonlyValEnhancedResult<PropsValConfig & MyReadonlyValConfig>;
39
45
 
40
46
  export interface TeleBoxCollector extends CombinedValEnhancedResult {}
41
47
 
@@ -44,32 +50,39 @@ export class TeleBoxCollector {
44
50
  minimized$,
45
51
  readonly$,
46
52
  darkMode$,
47
- rootRect$,
48
53
  namespace = "telebox",
49
54
  styles = {},
50
55
  root$,
51
56
  }: TeleBoxCollectorConfig) {
52
57
  this.namespace = namespace;
53
58
 
59
+ const valManager = new ValManager();
60
+ this._sideEffect.addDisposer(() => valManager.destroy());
61
+
54
62
  const rect$ = new Val<TeleBoxRect | undefined>(void 0);
55
- const visible$ = minimized$;
63
+ const visible$ = derive(minimized$);
56
64
  const styles$ = new Val(styles);
57
65
  const el$ = new Val<HTMLElement>(document.createElement("button"));
58
66
 
59
67
  const valConfig: ValConfig = {
60
68
  styles: styles$,
61
- el: el$,
69
+ $collector: el$,
62
70
  };
63
71
 
64
- withValueEnhancer(this, valConfig);
72
+ withValueEnhancer(this, valConfig, valManager);
65
73
 
66
- const readonlyValConfig: ReadonlyValConfig = {
74
+ const propsValConfig: PropsValConfig = {
75
+ root: root$,
76
+ };
77
+
78
+ withReadonlyValueEnhancer(this, propsValConfig);
79
+
80
+ const myReadonlyValConfig: MyReadonlyValConfig = {
67
81
  rect: rect$,
68
82
  visible: visible$,
69
- root: root$,
70
83
  };
71
84
 
72
- withReadonlyValueEnhancer(this, readonlyValConfig);
85
+ withReadonlyValueEnhancer(this, myReadonlyValConfig, valManager);
73
86
 
74
87
  el$.value.className = this.wrapClassName("collector");
75
88
  el$.value.style.backgroundImage = `url('${collectorSVG}')`;
@@ -129,11 +142,13 @@ export class TeleBoxCollector {
129
142
  }
130
143
  }),
131
144
  // Place after $collector appended to the DOM so that rect calc works
132
- combine([minimized$, rootRect$, root$]).subscribe(
133
- ([minimized, rootRect, root]) => {
145
+ combine([minimized$, root$]).subscribe(
146
+ ([minimized, root]) => {
134
147
  if (minimized && root) {
135
148
  const { x, y, width, height } =
136
149
  $collector.getBoundingClientRect();
150
+ const rootRect =
151
+ root.getBoundingClientRect();
137
152
  rect$.setValue({
138
153
  x: x - rootRect.x,
139
154
  y: y - rootRect.y,
@@ -7,7 +7,7 @@
7
7
  visibility: hidden;
8
8
  display: block;
9
9
  position: absolute;
10
- z-index: $base-z-index * 2;
10
+ z-index: $collector-z-index;
11
11
  width: 40px;
12
12
  height: 40px;
13
13
  margin: 0;
@@ -75,11 +75,6 @@ export class MaxTitleBar extends DefaultTitleBar {
75
75
 
76
76
  this.sideEffect.addDisposer(
77
77
  [
78
- this.rootRect$.subscribe((rootRect) => {
79
- const { x, y, width } = rootRect;
80
- $titleBar.style.transform = `translate(${x}px, ${y}px)`;
81
- $titleBar.style.width = width + "px";
82
- }),
83
78
  this.state$.subscribe((state) => {
84
79
  $titleBar.classList.toggle(
85
80
  this.wrapClassName("max-titlebar-maximized"),
@@ -109,9 +104,7 @@ export class MaxTitleBar extends DefaultTitleBar {
109
104
  this.wrapClassName("max-titlebar-single-title"),
110
105
  titles.length === 1
111
106
  );
112
- if (titles.length === 1) {
113
- this.setTitle(titles[0].title);
114
- } else {
107
+ if (titles.length !== 1) {
115
108
  $titleBar.replaceChild(
116
109
  this.renderTitles(),
117
110
  $titleBar.firstElementChild as HTMLElement
@@ -16,7 +16,10 @@ $scrollbar-color-active: rgba(238, 238, 247, 1);
16
16
  position: absolute;
17
17
  top: 0;
18
18
  left: 0;
19
- z-index: $base-z-index * 500;
19
+ width: 100%;
20
+ z-index: $max-titlebar-z-index;
21
+ border-top-left-radius: 6px;
22
+ border-top-right-radius: 6px;
20
23
 
21
24
  .#{$namespace}-title {
22
25
  display: none;
@@ -95,7 +98,7 @@ $scrollbar-color-active: rgba(238, 238, 247, 1);
95
98
  height: 100%;
96
99
  overflow: hidden;
97
100
  max-width: 182px;
98
- min-width: 50px;
101
+ min-width: 150px;
99
102
  padding: 0 26px 0 16px;
100
103
  outline: none;
101
104
  font-size: 13px;
@@ -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
 
@@ -280,6 +284,7 @@ export class TeleBoxManager {
280
284
 
281
285
  this.titleBar = new MaxTitleBar({
282
286
  namespace: this.namespace,
287
+ title$: derive(this.topBox$, (topBox) => topBox?.title || ""),
283
288
  boxes$: this.boxes$,
284
289
  darkMode$: darkMode$,
285
290
  readonly$: readonly$,
@@ -336,8 +341,57 @@ export class TeleBoxManager {
336
341
  }
337
342
  }),
338
343
  ]);
344
+
345
+ this.$container = document.createElement("div");
346
+ this.$container.className = this.wrapClassName("manager-container");
347
+
348
+ this.$stage = document.createElement("div");
349
+ this.$stage.className = this.wrapClassName("manager-stage");
350
+ this.$container.appendChild(this.$stage);
351
+
352
+ this._sideEffect.addDisposer([
353
+ darkMode$.subscribe((darkMode) => {
354
+ this.$container.classList.toggle(
355
+ this.wrapClassName("color-scheme-dark"),
356
+ darkMode
357
+ );
358
+ this.$container.classList.toggle(
359
+ this.wrapClassName("color-scheme-light"),
360
+ !darkMode
361
+ );
362
+ }),
363
+ maximized$.subscribe((maximized) => {
364
+ this.$container.classList.toggle("is-maximized", maximized);
365
+ }),
366
+ minimized$.subscribe((minimized) => {
367
+ this.$container.classList.toggle("is-minimized", minimized);
368
+ }),
369
+ containerStyle$.subscribe((containerStyle) => {
370
+ this.$container.style.cssText = containerStyle;
371
+ }),
372
+ stageStyle$.subscribe((stageStyle) => {
373
+ this.$stage.style.cssText = stageStyle;
374
+ this.$stage.style.width = stageRect$.value.width + "px";
375
+ this.$stage.style.height = stageRect$.value.height + "px";
376
+ }),
377
+ stageRect$.subscribe((stageRect) => {
378
+ this.$stage.style.width = stageRect.width + "px";
379
+ this.$stage.style.height = stageRect.height + "px";
380
+ }),
381
+ root$.subscribe((root) => {
382
+ if (root) {
383
+ root.appendChild(this.$container);
384
+ } else if (this.$container.parentElement) {
385
+ this.$container.remove();
386
+ }
387
+ }),
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,39 @@
1
+ @import "../scss/variables.scss";
2
+
3
+ .#{$namespace}-manager-container {
4
+ position: relative;
5
+ overflow: hidden;
6
+ width: 100%;
7
+ height: 100%;
8
+ display: flex;
9
+ justify-content: center;
10
+ align-items: center;
11
+ background: $color-container-background;
12
+
13
+ &.is-maximized,
14
+ &.is-minimized {
15
+ & > .#{$namespace}-manager-stage {
16
+ overflow: visible;
17
+ }
18
+ }
19
+ }
20
+
21
+ .#{$namespace}-manager-stage {
22
+ position: relative;
23
+ overflow: hidden;
24
+ background: $color-stage-background;
25
+ box-shadow: $color-stage-shadow;
26
+ }
27
+
28
+ .#{$namespace}-color-scheme-dark {
29
+ color-scheme: dark;
30
+
31
+ &.#{$namespace}-manager-container {
32
+ background: $color-container-background-dark;
33
+
34
+ & > .#{$namespace}-manager-stage {
35
+ background: $color-stage-background-dark;
36
+ box-shadow: $color-stage-shadow-dark;
37
+ }
38
+ }
39
+ }