@netless/window-manager 1.0.0-canary.3 → 1.0.0-canary.30

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 (87) hide show
  1. package/__mocks__/white-web-sdk.ts +10 -1
  2. package/dist/index.cjs.js +120 -12
  3. package/dist/index.es.js +2243 -950
  4. package/dist/index.umd.js +120 -12
  5. package/dist/{App → src/App}/AppContext.d.ts +12 -8
  6. package/dist/{App → src/App}/AppPageStateImpl.d.ts +0 -0
  7. package/dist/{App → src/App}/AppProxy.d.ts +36 -7
  8. package/dist/{App → src/App}/MagixEvent/index.d.ts +0 -0
  9. package/dist/{App → src/App}/Storage/StorageEvent.d.ts +0 -0
  10. package/dist/{App → src/App}/Storage/index.d.ts +0 -0
  11. package/dist/{App → src/App}/Storage/typings.d.ts +0 -0
  12. package/dist/{App → src/App}/Storage/utils.d.ts +0 -0
  13. package/dist/src/App/WhiteboardView.d.ts +27 -0
  14. package/dist/{App → src/App}/index.d.ts +2 -1
  15. package/dist/src/App/type.d.ts +21 -0
  16. package/dist/{AppListener.d.ts → src/AppListener.d.ts} +0 -2
  17. package/dist/{AppManager.d.ts → src/AppManager.d.ts} +7 -6
  18. package/dist/{AttributesDelegate.d.ts → src/AttributesDelegate.d.ts} +11 -16
  19. package/dist/{BoxEmitter.d.ts → src/BoxEmitter.d.ts} +0 -0
  20. package/dist/{BoxManager.d.ts → src/BoxManager.d.ts} +8 -6
  21. package/dist/{BuiltinApps.d.ts → src/BuiltinApps.d.ts} +3 -0
  22. package/dist/{Cursor → src/Cursor}/Cursor.d.ts +0 -0
  23. package/dist/{Cursor → src/Cursor}/icons.d.ts +0 -0
  24. package/dist/{Cursor → src/Cursor}/index.d.ts +3 -3
  25. package/dist/{Helper.d.ts → src/Helper.d.ts} +4 -8
  26. package/dist/{InternalEmitter.d.ts → src/InternalEmitter.d.ts} +3 -4
  27. package/dist/{Page → src/Page}/PageController.d.ts +1 -0
  28. package/dist/{Page → src/Page}/index.d.ts +0 -0
  29. package/dist/{PageState.d.ts → src/PageState.d.ts} +0 -0
  30. package/dist/{ReconnectRefresher.d.ts → src/ReconnectRefresher.d.ts} +1 -1
  31. package/dist/{RedoUndo.d.ts → src/RedoUndo.d.ts} +0 -0
  32. package/dist/{Register → src/Register}/index.d.ts +0 -0
  33. package/dist/{Register → src/Register}/loader.d.ts +0 -0
  34. package/dist/{Register → src/Register}/storage.d.ts +0 -0
  35. package/dist/{Utils → src/Utils}/AppCreateQueue.d.ts +0 -0
  36. package/dist/{Utils → src/Utils}/Common.d.ts +1 -0
  37. package/dist/{Utils → src/Utils}/Reactive.d.ts +0 -0
  38. package/dist/{Utils → src/Utils}/RoomHacker.d.ts +0 -0
  39. package/dist/{Utils → src/Utils}/error.d.ts +0 -0
  40. package/dist/{Utils → src/Utils}/log.d.ts +0 -0
  41. package/dist/src/View/CameraSynchronizer.d.ts +18 -0
  42. package/dist/{View → src/View}/MainView.d.ts +18 -7
  43. package/dist/{View → src/View}/ViewManager.d.ts +0 -0
  44. package/dist/src/View/ViewSync.d.ts +24 -0
  45. package/dist/{callback.d.ts → src/callback.d.ts} +5 -0
  46. package/dist/{constants.d.ts → src/constants.d.ts} +8 -5
  47. package/dist/src/image.d.ts +19 -0
  48. package/dist/{index.d.ts → src/index.d.ts} +36 -13
  49. package/dist/src/shim.d.ts +11 -0
  50. package/dist/{typings.d.ts → src/typings.d.ts} +6 -0
  51. package/dist/style.css +1 -1
  52. package/docs/app-context.md +157 -25
  53. package/docs/mirgrate-to-1.0.md +28 -0
  54. package/package.json +12 -7
  55. package/playwright.config.ts +28 -0
  56. package/pnpm-lock.yaml +517 -35
  57. package/src/App/AppContext.ts +50 -28
  58. package/src/App/AppProxy.ts +264 -80
  59. package/src/App/{WhiteBoardView.ts → WhiteboardView.ts} +38 -7
  60. package/src/App/index.ts +2 -1
  61. package/src/App/type.ts +22 -0
  62. package/src/AppListener.ts +5 -21
  63. package/src/AppManager.ts +56 -43
  64. package/src/AttributesDelegate.ts +19 -19
  65. package/src/BoxManager.ts +54 -40
  66. package/src/BuiltinApps.ts +5 -0
  67. package/src/Cursor/Cursor.ts +6 -2
  68. package/src/Cursor/index.ts +5 -7
  69. package/src/Helper.ts +25 -7
  70. package/src/InternalEmitter.ts +3 -4
  71. package/src/Page/PageController.ts +1 -0
  72. package/src/PageState.ts +1 -1
  73. package/src/ReconnectRefresher.ts +7 -2
  74. package/src/Utils/Common.ts +9 -0
  75. package/src/Utils/Reactive.ts +27 -26
  76. package/src/Utils/RoomHacker.ts +3 -0
  77. package/src/View/CameraSynchronizer.ts +37 -34
  78. package/src/View/MainView.ts +108 -81
  79. package/src/View/ViewSync.ts +110 -0
  80. package/src/callback.ts +1 -0
  81. package/src/constants.ts +6 -3
  82. package/src/index.ts +126 -56
  83. package/src/style.css +2 -45
  84. package/src/typings.ts +6 -0
  85. package/vite.config.js +5 -3
  86. package/dist/App/WhiteBoardView.d.ts +0 -18
  87. package/dist/View/CameraSynchronizer.d.ts +0 -17
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@ import pRetry from "p-retry";
2
2
  import { AppManager } from "./AppManager";
3
3
  import { appRegister } from "./Register";
4
4
  import { callbacks } from "./callback";
5
- import { checkVersion, setupWrapper } from "./Helper";
5
+ import { checkVersion, createInvisiblePlugin, setupWrapper } from "./Helper";
6
6
  import { createBoxManager } from "./BoxManager";
7
7
  import { CursorManager } from "./Cursor";
8
8
  import { DEFAULT_CONTAINER_RATIO, Events, INIT_DIR, ROOT_DIR } from "./constants";
@@ -10,7 +10,7 @@ import { emitter } from "./InternalEmitter";
10
10
  import { Fields } from "./AttributesDelegate";
11
11
  import { initDb } from "./Register/storage";
12
12
  import { InvisiblePlugin, isPlayer, isRoom, RoomPhase, ViewMode } from "white-web-sdk";
13
- import { isEqual, isNull, isObject, omit, isNumber } from "lodash";
13
+ import { isEqual, isNull, isObject, isNumber } from "lodash";
14
14
  import { log } from "./Utils/log";
15
15
  import { PageStateImpl } from "./PageState";
16
16
  import { ReconnectRefresher } from "./ReconnectRefresher";
@@ -27,9 +27,11 @@ import {
27
27
  putScenes,
28
28
  wait,
29
29
  } from "./Utils/Common";
30
+ import { boxEmitter } from "./BoxEmitter";
31
+ import { Val } from "value-enhancer";
30
32
  import type { TELE_BOX_STATE, BoxManager } from "./BoxManager";
31
33
  import * as Errors from "./Utils/error";
32
- import type { Apps, Position } from "./AttributesDelegate";
34
+ import type { Apps, Position , ICamera, ISize } from "./AttributesDelegate";
33
35
  import type {
34
36
  Displayer,
35
37
  SceneDefinition,
@@ -37,15 +39,13 @@ import type {
37
39
  Room,
38
40
  InvisiblePluginContext,
39
41
  Camera,
40
- AnimationMode,
41
42
  CameraBound,
42
43
  Point,
43
- Rectangle,
44
44
  CameraState,
45
45
  Player,
46
46
  ImageInformation,
47
47
  SceneState,
48
- } from "white-web-sdk";
48
+ Rectangle} from "white-web-sdk";
49
49
  import type { AppListeners } from "./AppListener";
50
50
  import type { ApplianceIcons, NetlessApp, RegisterParams } from "./typings";
51
51
  import type { TeleBoxColorScheme, TeleBoxState } from "@netless/telebox-insider";
@@ -53,7 +53,6 @@ import type { AppProxy } from "./App";
53
53
  import type { PublicEvent } from "./callback";
54
54
  import type Emittery from "emittery";
55
55
  import type { PageController, AddPageParams, PageState } from "./Page";
56
- import { boxEmitter } from "./BoxEmitter";
57
56
 
58
57
  export type WindowMangerAttributes = {
59
58
  modelValue?: string;
@@ -104,6 +103,9 @@ export type AppSyncAttributes = {
104
103
  isDynamicPPT?: boolean;
105
104
  fullPath?: string;
106
105
  createdAt?: number;
106
+ camera?: ICamera;
107
+ size?: ISize;
108
+ setup: boolean;
107
109
  };
108
110
 
109
111
  export type AppInitState = {
@@ -118,6 +120,11 @@ export type AppInitState = {
118
120
  sceneIndex?: number;
119
121
  boxState?: TeleBoxState; // 兼容旧版 telebox
120
122
  zIndex?: number;
123
+ visible?: boolean;
124
+ stageRatio?: number;
125
+ resizable?: boolean;
126
+ draggable?: boolean;
127
+ ratio?: number;
121
128
  };
122
129
 
123
130
  export type CursorMovePayload = { uid: string; state?: "leave"; position: Position };
@@ -127,11 +134,15 @@ export type MountParams = {
127
134
  container?: HTMLElement;
128
135
  /** 白板高宽比例, 默认为 9 / 16 */
129
136
  containerSizeRatio?: number;
130
- /** 显示 PS 透明背景,默认 true */
137
+ /** @deprecated */
131
138
  chessboard?: boolean;
139
+ /** 是否高亮显示同步区域, 默认为 true */
140
+ highlightStage?: boolean;
132
141
  collectorContainer?: HTMLElement;
133
142
  collectorStyles?: Partial<CSSStyleDeclaration>;
134
143
  overwriteStyles?: string;
144
+ containerStyle?: string;
145
+ stageStyle?: string;
135
146
  cursor?: boolean;
136
147
  debug?: boolean;
137
148
  disableCameraTransform?: boolean;
@@ -160,6 +171,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
160
171
  public appManager?: AppManager;
161
172
  public cursorManager?: CursorManager;
162
173
  public viewMode = ViewMode.Broadcaster;
174
+ public viewMode$ = new Val<ViewMode>(ViewMode.Broadcaster);
163
175
  public isReplay = isPlayer(this.displayer);
164
176
  private _pageState?: PageStateImpl;
165
177
 
@@ -177,7 +189,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
177
189
  public static async mount(params: MountParams): Promise<WindowManager> {
178
190
  const room = params.room;
179
191
  WindowManager.container = params.container;
180
- const containerSizeRatio = params.containerSizeRatio;
192
+
181
193
  const debug = params.debug;
182
194
 
183
195
  const cursor = params.cursor;
@@ -223,22 +235,23 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
223
235
  throw new Error("[WindowManager]: create manager failed");
224
236
  }
225
237
 
226
- if (containerSizeRatio) {
227
- WindowManager.containerSizeRatio = containerSizeRatio;
238
+ if (params.containerSizeRatio) {
239
+ WindowManager.containerSizeRatio = params.containerSizeRatio;
228
240
  }
241
+ manager.containerSizeRatio = WindowManager.containerSizeRatio;
229
242
  await manager.ensureAttributes();
230
243
 
231
244
  manager.appManager = new AppManager(manager);
232
245
  manager._pageState = new PageStateImpl(manager.appManager);
233
246
  manager.cursorManager = new CursorManager(manager.appManager, Boolean(cursor), params.applianceIcons);
234
- if (containerSizeRatio) {
235
- manager.containerSizeRatio = containerSizeRatio;
236
- }
247
+
237
248
  manager.boxManager = createBoxManager(manager, callbacks, emitter, boxEmitter, {
238
249
  collectorContainer: params.collectorContainer,
239
250
  collectorStyles: params.collectorStyles,
240
251
  prefersColorScheme: params.prefersColorScheme,
241
- stageRatio: params.containerSizeRatio,
252
+ stageRatio: WindowManager.containerSizeRatio,
253
+ containerStyle: params.containerStyle,
254
+ stageStyle: params.stageStyle,
242
255
  });
243
256
  manager.appManager?.setBoxManager(manager.boxManager);
244
257
  if (params.container) {
@@ -257,8 +270,8 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
257
270
  return manager;
258
271
  }
259
272
 
260
- private static async initManager(room: Room): Promise<WindowManager> {
261
- let manager = room.getInvisiblePlugin(WindowManager.kind) as WindowManager;
273
+ private static async initManager(room: Room): Promise<WindowManager | undefined> {
274
+ let manager = room.getInvisiblePlugin(WindowManager.kind) as WindowManager | undefined;
262
275
  if (!manager) {
263
276
  if (isRoom(room)) {
264
277
  if (room.isWritable === false) {
@@ -267,18 +280,12 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
267
280
  } catch (error) {
268
281
  throw new Error("[WindowManger]: room must be switched to be writable");
269
282
  }
270
- manager = (await room.createInvisiblePlugin(
271
- WindowManager,
272
- {}
273
- )) as WindowManager;
274
- manager.ensureAttributes();
283
+ manager = await createInvisiblePlugin(room);
284
+ manager?.ensureAttributes();
275
285
  await wait(500);
276
286
  await room.setWritable(false);
277
287
  } else {
278
- manager = (await room.createInvisiblePlugin(
279
- WindowManager,
280
- {}
281
- )) as WindowManager;
288
+ manager = await createInvisiblePlugin(room);
282
289
  }
283
290
  }
284
291
  }
@@ -287,12 +294,13 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
287
294
 
288
295
  private static initContainer(
289
296
  container: HTMLElement,
297
+ target: HTMLElement,
290
298
  overwriteStyles: string | undefined
291
299
  ) {
292
300
  if (!WindowManager.container) {
293
301
  WindowManager.container = container;
294
302
  }
295
- const { playground, mainViewElement } = setupWrapper(container);
303
+ const { playground, mainViewElement } = setupWrapper(container, target);
296
304
  WindowManager.playground = playground;
297
305
  if (overwriteStyles) {
298
306
  const style = document.createElement("style");
@@ -315,10 +323,12 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
315
323
  container.appendChild(WindowManager.container.firstChild);
316
324
  }
317
325
  } else {
318
- if (WindowManager.params) {
326
+ const teleboxContainer = this.boxManager?.teleBoxManager.$stage;
327
+ if (WindowManager.params && teleboxContainer) {
319
328
  const params = WindowManager.params;
320
329
  const mainViewElement = WindowManager.initContainer(
321
330
  container,
331
+ teleboxContainer,
322
332
  params.overwriteStyles
323
333
  );
324
334
  if (this.boxManager && WindowManager.playground) {
@@ -328,6 +338,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
328
338
  if (WindowManager.playground) {
329
339
  this.cursorManager?.setupWrapper(WindowManager.playground);
330
340
  }
341
+
331
342
  }
332
343
  }
333
344
  emitter.emit("updateManagerRect");
@@ -502,6 +513,18 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
502
513
  }
503
514
  }
504
515
 
516
+ public async jumpPage(index: number): Promise<boolean> {
517
+ if (!this.appManager) {
518
+ return false;
519
+ }
520
+ if (index < 0 || index >= this.pageState.length) {
521
+ console.warn(`[WindowManager]: index ${index} out of range`);
522
+ return false;
523
+ }
524
+ await this.appManager.setMainViewSceneIndex(index);
525
+ return true;
526
+ }
527
+
505
528
  public async addPage(params?: AddPageParams): Promise<void> {
506
529
  if (this.appManager) {
507
530
  const after = params?.after;
@@ -578,16 +601,19 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
578
601
  * 设置 ViewMode
579
602
  */
580
603
  public setViewMode(mode: ViewMode): void {
604
+ log("setViewMode", mode);
605
+ const mainViewProxy = this.appManager?.mainViewProxy;
581
606
  if (mode === ViewMode.Broadcaster) {
582
607
  if (this.canOperate) {
583
- this.appManager?.mainViewProxy.setCameraAndSize();
608
+ mainViewProxy?.storeCurrentCamera();
584
609
  }
585
- this.appManager?.mainViewProxy.start();
610
+ mainViewProxy?.start();
586
611
  }
587
612
  if (mode === ViewMode.Freedom) {
588
- this.appManager?.mainViewProxy.stop();
613
+ mainViewProxy?.stop();
589
614
  }
590
615
  this.viewMode = mode;
616
+ this.viewMode$.setValue(mode);
591
617
  }
592
618
 
593
619
  public setBoxState(boxState: TeleBoxState): void {
@@ -635,6 +661,22 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
635
661
  }
636
662
  }
637
663
 
664
+ public get baseCamera$() {
665
+ if (this.appManager) {
666
+ return this.appManager.mainViewProxy.camera$;
667
+ } else {
668
+ throw new Errors.AppManagerNotInitError();
669
+ }
670
+ }
671
+
672
+ public get baseSize$() {
673
+ if (this.appManager) {
674
+ return this.appManager.mainViewProxy.size$;
675
+ } else {
676
+ throw new Errors.AppManagerNotInitError();
677
+ }
678
+ }
679
+
638
680
  public get cameraState(): CameraState {
639
681
  if (this.appManager) {
640
682
  return this.appManager.mainViewProxy.cameraState;
@@ -741,30 +783,31 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
741
783
  return this.appManager?.closeApp(appId);
742
784
  }
743
785
 
744
- public moveCamera(
745
- camera: Partial<Camera> & { animationMode?: AnimationMode | undefined }
746
- ): void {
747
- const pureCamera = omit(camera, ["animationMode"]);
786
+ public moveCamera(camera: Partial<Camera> ): void {
748
787
  const mainViewCamera = { ...this.mainView.camera };
749
- if (isEqual({ ...mainViewCamera, ...pureCamera }, mainViewCamera)) return;
750
- this.mainView.moveCamera(camera);
751
- this.appManager?.dispatchInternalEvent(Events.MoveCamera, camera);
752
- setTimeout(() => {
753
- this.appManager?.mainViewProxy.setCameraAndSize();
754
- }, 500);
755
- }
756
-
757
- public moveCameraToContain(
758
- rectangle: Rectangle &
759
- Readonly<{
760
- animationMode?: AnimationMode;
761
- }>
762
- ): void {
763
- this.mainView.moveCameraToContain(rectangle);
764
- this.appManager?.dispatchInternalEvent(Events.MoveCameraToContain, rectangle);
765
- setTimeout(() => {
766
- this.appManager?.mainViewProxy.setCameraAndSize();
767
- }, 500);
788
+ const nextCamera = { ...mainViewCamera, ...camera };
789
+ if (isEqual(nextCamera, mainViewCamera)) return;
790
+ if (!this.appManager) return;
791
+ this.appManager.mainViewProxy.storeCamera({
792
+ id: this.appManager.uid,
793
+ ...nextCamera
794
+ });
795
+ }
796
+
797
+ public moveCameraToContain(rectangle: Rectangle): void {
798
+ if (!this.appManager) return;
799
+ const mainViewSize = this.appManager.mainViewProxy.size$.value;
800
+ if (mainViewSize) {
801
+ const wScale = mainViewSize.width / rectangle.width;
802
+ const hScale = mainViewSize.height / rectangle.height;
803
+ const nextScale = Math.min(wScale, hScale);
804
+ this.appManager.mainViewProxy.storeCamera({
805
+ id: this.appManager.uid,
806
+ scale: nextScale,
807
+ centerX: rectangle.originX,
808
+ centerY: rectangle.originY,
809
+ });
810
+ }
768
811
  }
769
812
 
770
813
  public convertToPointInWorld(point: Point): Point {
@@ -892,7 +935,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
892
935
  if (WindowManager.container) {
893
936
  this.bindContainer(WindowManager.container);
894
937
  }
895
- this.appManager?.refresher?.refresh();
938
+ this.appManager?.refresher.refresh();
896
939
  }
897
940
 
898
941
  public setContainerSizeRatio(ratio: number) {
@@ -904,6 +947,32 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
904
947
  emitter.emit("containerSizeRatioUpdate", ratio);
905
948
  }
906
949
 
950
+ public setContainerStyle(style: string) {
951
+ this.boxManager?.teleBoxManager.setContainerStyle(style);
952
+ }
953
+
954
+ public setStageStyle(style: string) {
955
+ this.boxManager?.teleBoxManager.setStageStyle(style);
956
+ }
957
+
958
+ public createPPTHandler() {
959
+ return {
960
+ onPageJumpTo: (_pptUUID: string, index: number) => {
961
+ this.appManager?.focusApp?.appContext?.whiteBoardView?.jumpPage(index);
962
+ },
963
+ onPageToNext: () => {
964
+ if (this.focused) {
965
+ this.appManager?.focusApp?.appContext?.whiteBoardView?.nextPage();
966
+ }
967
+ },
968
+ onPageToPrev: () => {
969
+ if (this.focused) {
970
+ this.appManager?.focusApp?.appContext?.whiteBoardView?.prevPage();
971
+ }
972
+ }
973
+ }
974
+ }
975
+
907
976
  private isDynamicPPT(scenes: SceneDefinition[]) {
908
977
  const sceneSrc = scenes[0]?.ppt?.src;
909
978
  return sceneSrc?.startsWith("pptx://");
@@ -937,5 +1006,6 @@ setupBuiltin();
937
1006
 
938
1007
  export * from "./typings";
939
1008
 
940
- export { BuiltinApps } from "./BuiltinApps";
1009
+ export { BuiltinApps, BuiltinAppsMap } from "./BuiltinApps";
941
1010
  export type { PublicEvent } from "./callback";
1011
+ export type { Member } from "./Helper";
package/src/style.css CHANGED
@@ -7,48 +7,9 @@
7
7
  user-select: none;
8
8
  }
9
9
 
10
- .netless-window-manager-sizer {
11
- position: absolute;
12
- top: 0;
13
- left: 0;
14
- width: 100%;
15
- height: 100%;
16
- z-index: 1;
17
- overflow: hidden;
18
- display: flex;
19
- }
20
-
21
- .netless-window-manager-sizer-horizontal {
22
- flex-direction: column;
23
- }
24
-
25
- .netless-window-manager-sizer::before,
26
- .netless-window-manager-sizer::after {
27
- flex: 1;
28
- content: "";
29
- display: block;
30
- }
31
-
32
- .netless-window-manager-chess-sizer::before,
33
- .netless-window-manager-chess-sizer::after {
34
- background-image: linear-gradient(45deg, #b0b0b0 25%, transparent 25%),
35
- linear-gradient(-45deg, #b0b0b0 25%, transparent 25%),
36
- linear-gradient(45deg, transparent 75%, #b0b0b0 75%),
37
- linear-gradient(-45deg, transparent 75%, #b0b0b0 75%);
38
- background-color: #fff;
39
- background-size: 20px 20px;
40
- background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
41
- }
42
-
43
- .netless-window-manager-wrapper {
44
- position: relative;
45
- z-index: 1;
46
- width: 100%;
47
- height: 100%;
48
- overflow: hidden;
49
- }
50
10
 
51
11
  .netless-window-manager-main-view {
12
+ position: absolute;
52
13
  width: 100%;
53
14
  height: 100%;
54
15
  }
@@ -180,10 +141,6 @@
180
141
  }
181
142
 
182
143
  .window-manager-view-wrapper {
183
- z-index: 5000;
184
- width: 100%;
185
- height: 100%;
186
144
  position: absolute;
187
- left: 0;
188
- top: 0;
145
+ z-index: 10;
189
146
  }
package/src/typings.ts CHANGED
@@ -30,6 +30,9 @@ export interface NetlessApp<Attributes = any, MagixEventPayloads = any, AppOptio
30
30
 
31
31
  /** App only single instance. */
32
32
  singleton?: boolean;
33
+
34
+ /** App box enableShadowDom. Default true */
35
+ enableShadowDOM?: boolean;
33
36
  };
34
37
  setup: (context: AppContext<Attributes, MagixEventPayloads, AppOptions>) => SetupResult;
35
38
  }
@@ -74,12 +77,15 @@ export type RegisterParams<AppOptions = any, SetupResult = any, Attributes = any
74
77
  addHooks?: (emitter: Emittery<RegisterEvents<SetupResult>>) => void;
75
78
  /** dynamic load app package name */
76
79
  name?: string;
80
+ contentStyles?: string;
77
81
  };
78
82
 
79
83
  export type AppListenerKeys = keyof AppEmitterEvent;
80
84
 
81
85
  export type ApplianceIcons = Partial<Record<ApplianceNames, string>>;
82
86
 
87
+ export type Writeable<T> = { -readonly [P in keyof T]: T[P] };
88
+
83
89
  export type { AppContext } from "./App/AppContext";
84
90
  export type { WhiteBoardView } from "./App";
85
91
  export type { ReadonlyTeleBox, TeleBoxRect };
package/vite.config.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import path from "path";
2
+ import dts from 'vite-plugin-dts'
2
3
  import { defineConfig } from 'vitest/config'
3
4
  import { svelte } from "@sveltejs/vite-plugin-svelte";
4
5
  import { dependencies, peerDependencies, version, devDependencies } from "./package.json"
@@ -28,7 +29,8 @@ export default defineConfig(({ mode }) => {
28
29
  experimental: {
29
30
  useVitePreprocess: true,
30
31
  },
31
- })
32
+ }),
33
+ dts()
32
34
  ],
33
35
  build: {
34
36
  lib: {
@@ -45,7 +47,7 @@ export default defineConfig(({ mode }) => {
45
47
  ...peerDependencies,
46
48
  }),
47
49
  },
48
- minify: isProd,
50
+ minify: isProd
49
51
  },
50
52
  };
51
- });
53
+ })
@@ -1,18 +0,0 @@
1
- import type { ReadonlyVal } from "value-enhancer";
2
- import type { AddPageParams, PageController, PageState } from "../Page";
3
- import type { AppProxy } from "./AppProxy";
4
- import type { AppContext } from "./AppContext";
5
- export declare class WhiteBoardView implements PageController {
6
- protected appContext: AppContext;
7
- protected appProxy: AppProxy;
8
- private removeViewWrapper;
9
- readonly pageState$: ReadonlyVal<PageState>;
10
- constructor(appContext: AppContext, appProxy: AppProxy, removeViewWrapper: () => void);
11
- get pageState(): PageState;
12
- nextPage: () => Promise<boolean>;
13
- prevPage: () => Promise<boolean>;
14
- jumpPage: (index: number) => Promise<boolean>;
15
- addPage: (params?: AddPageParams | undefined) => Promise<void>;
16
- removePage: (index?: number | undefined) => Promise<boolean>;
17
- destroy(): void;
18
- }
@@ -1,17 +0,0 @@
1
- import type { TeleBoxRect } from "@netless/telebox-insider";
2
- import type { Camera, View, Size } from "white-web-sdk";
3
- import type { MainViewSize } from "../AttributesDelegate";
4
- export declare type SaveCamera = (camera: Camera) => void;
5
- export declare class CameraSynchronizer {
6
- protected saveCamera: SaveCamera;
7
- protected remoteCamera?: Camera;
8
- protected remoteSize?: MainViewSize;
9
- protected rect?: TeleBoxRect;
10
- protected view?: View;
11
- constructor(saveCamera: SaveCamera);
12
- setRect(rect: TeleBoxRect): void;
13
- setView(view: View): void;
14
- onRemoteUpdate: import("lodash").DebouncedFunc<(camera: Camera, size: MainViewSize) => void>;
15
- onLocalCameraUpdate(camera: Camera): void;
16
- onLocalSizeUpdate(size: Size): void;
17
- }