@netless/telebox-insider 1.0.0-alpha.14 → 1.0.0-alpha.17

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": "1.0.0-alpha.14",
3
+ "version": "1.0.0-alpha.17",
4
4
  "private": false,
5
5
  "description": "Window widget for Whiteboard",
6
6
  "license": "MIT",
@@ -91,7 +91,7 @@ type MyReadonlyValConfig = {
91
91
  highlightStage: ReadonlyVal<boolean, boolean>;
92
92
  boxHighlightStage: Val<boolean | null, boolean>;
93
93
  contentRect: Val<TeleBoxRect>;
94
- contentStageRect: ReadonlyVal<TeleBoxRect | null>;
94
+ contentStageRect: ReadonlyVal<TeleBoxRect>;
95
95
  };
96
96
 
97
97
  type CombinedValEnhancedResult = ReadonlyValEnhancedResult<
@@ -744,7 +744,14 @@ export class TeleBox {
744
744
  pxIntrinsicCoord,
745
745
  collectorRect,
746
746
  ]) => {
747
- const styles = maximized
747
+ const styles: {
748
+ x: number;
749
+ y: number;
750
+ width: string;
751
+ height: string;
752
+ scaleX: number;
753
+ scaleY: number;
754
+ } = maximized
748
755
  ? {
749
756
  x: 0,
750
757
  y: 0,
@@ -867,12 +874,10 @@ export class TeleBox {
867
874
  $stage.className = this.wrapClassName("content-stage");
868
875
  this._sideEffect.addDisposer(
869
876
  this._contentStageRect$.subscribe((rect) => {
870
- if (rect) {
871
- $stage.style.top = rect.y + "px";
872
- $stage.style.left = rect.x + "px";
873
- $stage.style.width = rect.width + "px";
874
- $stage.style.height = rect.height + "px";
875
- }
877
+ $stage.style.top = rect.y + "px";
878
+ $stage.style.left = rect.x + "px";
879
+ $stage.style.width = rect.width + "px";
880
+ $stage.style.height = rect.height + "px";
876
881
  }),
877
882
  "content-stage-rect"
878
883
  );
@@ -1184,4 +1189,5 @@ export type ReadonlyTeleBox = Pick<
1184
1189
  | "setRatio"
1185
1190
  | "setVisible"
1186
1191
  | "handleTrackStart"
1192
+ | "onValChanged"
1187
1193
  >;
@@ -24,7 +24,6 @@ export interface TeleBoxCollectorConfig {
24
24
  minimized$: Val<boolean>;
25
25
  readonly$: ReadonlyVal<boolean>;
26
26
  darkMode$: ReadonlyVal<boolean>;
27
- rootRect$: ReadonlyVal<TeleBoxRect>;
28
27
  }
29
28
 
30
29
  type ValConfig = {
@@ -51,7 +50,6 @@ export class TeleBoxCollector {
51
50
  minimized$,
52
51
  readonly$,
53
52
  darkMode$,
54
- rootRect$,
55
53
  namespace = "telebox",
56
54
  styles = {},
57
55
  root$,
@@ -144,11 +142,13 @@ export class TeleBoxCollector {
144
142
  }
145
143
  }),
146
144
  // Place after $collector appended to the DOM so that rect calc works
147
- combine([minimized$, rootRect$, root$]).subscribe(
148
- ([minimized, rootRect, root]) => {
145
+ combine([minimized$, root$]).subscribe(
146
+ ([minimized, root]) => {
149
147
  if (minimized && root) {
150
148
  const { x, y, width, height } =
151
149
  $collector.getBoundingClientRect();
150
+ const rootRect =
151
+ root.getBoundingClientRect();
152
152
  rect$.setValue({
153
153
  x: x - rootRect.x,
154
154
  y: y - rootRect.y,
@@ -195,7 +195,6 @@ export class TeleBoxManager {
195
195
  darkMode$: darkMode$,
196
196
  namespace,
197
197
  root$,
198
- rootRect$,
199
198
  });
200
199
 
201
200
  const teleStage = new TeleStage({