@netless/telebox-insider 1.0.0-alpha.10 → 1.0.0-alpha.11

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.10",
3
+ "version": "1.0.0-alpha.11",
4
4
  "private": false,
5
5
  "description": "Window widget for Whiteboard",
6
6
  "license": "MIT",
@@ -58,6 +58,7 @@ type ValConfig = {
58
58
  resizable: Val<RequiredTeleBoxConfig["resizable"], boolean>;
59
59
  draggable: Val<RequiredTeleBoxConfig["draggable"], boolean>;
60
60
  ratio: Val<RequiredTeleBoxConfig["ratio"], boolean>;
61
+ stageRatio: Val<number | null>;
61
62
  };
62
63
 
63
64
  type PropsValConfig = {
@@ -116,6 +117,7 @@ export class TeleBox {
116
117
  ratio = -1,
117
118
  focus = false,
118
119
  zIndex = 100,
120
+ stageRatio = null,
119
121
  titleBar,
120
122
  content,
121
123
  footer,
@@ -129,7 +131,7 @@ export class TeleBox {
129
131
  root$,
130
132
  rootRect$,
131
133
  managerStageRect$,
132
- stageRatio$,
134
+ managerStageRatio$,
133
135
  collectorRect$,
134
136
  managerHighlightStage$,
135
137
  }: TeleBoxConfig) {
@@ -239,11 +241,17 @@ export class TeleBox {
239
241
  compare: shallowequal,
240
242
  });
241
243
 
244
+ const stageRatio$ = new Val(stageRatio);
245
+
242
246
  const teleStage = new TeleStage({
243
247
  namespace,
244
248
  root$: contentRoot$,
245
249
  rootRect$: contentRect$,
246
- ratio$: stageRatio$,
250
+ ratio$: combine(
251
+ [stageRatio$, managerStageRatio$],
252
+ ([stageRatio, managerStageRatio]) =>
253
+ stageRatio ?? managerStageRatio
254
+ ),
247
255
  highlightStage$,
248
256
  });
249
257
  this._sideEffect.addDisposer(() => teleStage.destroy());
@@ -290,6 +298,7 @@ export class TeleBox {
290
298
  resizable: resizable$,
291
299
  draggable: draggable$,
292
300
  ratio: ratio$,
301
+ stageRatio: stageRatio$,
293
302
  };
294
303
 
295
304
  withValueEnhancer(this, valConfig, valManager);
@@ -56,6 +56,8 @@ export interface TeleBoxConfig {
56
56
  readonly focus?: boolean;
57
57
  /** Base z-index for box. */
58
58
  readonly zIndex?: number;
59
+ /** Box 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. */
@@ -85,7 +87,7 @@ export interface TeleBoxConfig {
85
87
  /** Position and dimension of stage area */
86
88
  readonly managerStageRect$: ReadonlyVal<TeleBoxRect>;
87
89
  /** Stage area height/with ratio. No ratio if <= 0. */
88
- readonly stageRatio$: ReadonlyVal<number, boolean>;
90
+ readonly managerStageRatio$: ReadonlyVal<number, boolean>;
89
91
  /** Position and dimension of collector */
90
92
  readonly collectorRect$: ReadonlyVal<TeleBoxRect | undefined>;
91
93
  /** highlight stage settings from manager */
@@ -394,7 +394,7 @@ export class TeleBoxManager {
394
394
  fence$: this._fence$,
395
395
  rootRect$: this._rootRect$,
396
396
  managerStageRect$: this._stageRect$,
397
- stageRatio$: this._stageRatio$,
397
+ managerStageRatio$: this._stageRatio$,
398
398
  readonly$: this._readonly$,
399
399
  collectorRect$: this.collector._rect$,
400
400
  managerHighlightStage$: this._highlightStage$,
@@ -670,6 +670,9 @@ export class TeleBoxManager {
670
670
  if (config.zIndex != null) {
671
671
  box._zIndex$.setValue(config.zIndex, skipUpdate);
672
672
  }
673
+ if (config.stageRatio !== undefined) {
674
+ box.setStageRatio(config.stageRatio, skipUpdate);
675
+ }
673
676
  if (config.content != null) {
674
677
  box.mountContent(config.content);
675
678
  }
@@ -37,7 +37,8 @@ type TeleBoxManagerBoxConfigBaseProps =
37
37
  | "resizable"
38
38
  | "draggable"
39
39
  | "ratio"
40
- | "zIndex";
40
+ | "zIndex"
41
+ | "stageRatio";
41
42
 
42
43
  export type TeleBoxManagerCreateConfig = Pick<
43
44
  TeleBoxConfig,
@@ -51,6 +52,7 @@ export type TeleBoxManagerQueryConfig = Pick<
51
52
  | "resizable"
52
53
  | "draggable"
53
54
  | "ratio"
55
+ | "stageRatio"
54
56
  | "zIndex"
55
57
  | "id"
56
58
  | "focus"