@netless/window-manager 1.0.0-canary.72 → 1.0.0-canary.74

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.
@@ -34,6 +34,7 @@ export declare class CursorManager {
34
34
  get boxState(): any;
35
35
  get focusView(): View | undefined;
36
36
  private mouseMoveListener;
37
+ private shouldBroadcast;
37
38
  private updateCursor;
38
39
  private getPoint;
39
40
  /**
@@ -2,6 +2,7 @@ import { SideEffectManager } from "side-effect-manager";
2
2
  import type { ReadonlyVal } from "value-enhancer";
3
3
  import type { AppManager } from "../AppManager";
4
4
  import type { ScrollStorage } from "../storage";
5
+ import type { View } from "white-web-sdk";
5
6
  export declare type ScrollState = {
6
7
  scrollTop: number;
7
8
  page: number;
@@ -13,14 +14,14 @@ export declare class ScrollMode {
13
14
  private readonly _root$;
14
15
  private readonly _whiteboard$;
15
16
  private readonly _scrollTop$;
16
- readonly _page$: ReadonlyVal<number>;
17
+ private readonly _page$;
17
18
  private readonly _scale$;
18
19
  private readonly _size$;
19
- private readonly _mainView$;
20
20
  private baseWidth;
21
21
  private baseHeight;
22
- scrollStorage: ScrollStorage;
22
+ readonly scrollStorage: ScrollStorage;
23
23
  readonly scrollState$: ReadonlyVal<ScrollState>;
24
+ get mainView(): View;
24
25
  setRoot(root: HTMLElement): void;
25
26
  constructor(manager: AppManager);
26
27
  private initScroll;
@@ -28,5 +29,6 @@ export declare class ScrollMode {
28
29
  private updateBound;
29
30
  dispose(): void;
30
31
  private getWhiteboardElement;
32
+ private shouldBroadcast;
31
33
  private onWheel;
32
34
  }
package/dist/index.js CHANGED
@@ -2557,7 +2557,7 @@ class ScrollMode {
2557
2557
  this.onWheel = (ev) => {
2558
2558
  var _a2;
2559
2559
  const target = ev.target;
2560
- if (this.manager.canOperate && ((_a2 = this._whiteboard$.value) == null ? void 0 : _a2.contains(target))) {
2560
+ if (this.shouldBroadcast() && ((_a2 = this._whiteboard$.value) == null ? void 0 : _a2.contains(target))) {
2561
2561
  ev.preventDefault();
2562
2562
  ev.stopPropagation();
2563
2563
  const dy = ev.deltaY || 0;
@@ -2573,8 +2573,7 @@ class ScrollMode {
2573
2573
  }
2574
2574
  };
2575
2575
  this._root$ = new valueEnhancer.Val(null);
2576
- this._mainView$ = new valueEnhancer.Val(this.manager.mainView);
2577
- this._mainView$.value.disableCameraTransform = false;
2576
+ this.mainView.disableCameraTransform = false;
2578
2577
  if ((_a = manager.scrollBaseSize$) == null ? void 0 : _a.value) {
2579
2578
  this.baseWidth = manager.scrollBaseSize$.value.width;
2580
2579
  this.baseHeight = manager.scrollBaseSize$.value.height;
@@ -2594,9 +2593,9 @@ class ScrollMode {
2594
2593
  this._size$ = size$;
2595
2594
  this.sideEffect.add(() => {
2596
2595
  const onSizeUpdated = size$.setValue.bind(size$);
2597
- onSizeUpdated(this._mainView$.value.size);
2598
- this._mainView$.value.callbacks.on("onSizeUpdated", onSizeUpdated);
2599
- return () => this._mainView$.value.callbacks.off("onSizeUpdated", onSizeUpdated);
2596
+ onSizeUpdated(this.mainView.size);
2597
+ this.mainView.callbacks.on("onSizeUpdated", onSizeUpdated);
2598
+ return () => this.mainView.callbacks.off("onSizeUpdated", onSizeUpdated);
2600
2599
  });
2601
2600
  this.sideEffect.add(() => {
2602
2601
  const onCameraUpdated = (camera) => {
@@ -2609,8 +2608,8 @@ class ScrollMode {
2609
2608
  });
2610
2609
  callbacks.emit("userScroll");
2611
2610
  };
2612
- this._mainView$.value.callbacks.on("onCameraUpdatedByDevice", onCameraUpdated);
2613
- return () => this._mainView$.value.callbacks.off("onCameraUpdatedByDevice", onCameraUpdated);
2611
+ this.mainView.callbacks.on("onCameraUpdatedByDevice", onCameraUpdated);
2612
+ return () => this.mainView.callbacks.off("onCameraUpdatedByDevice", onCameraUpdated);
2614
2613
  });
2615
2614
  const scale$ = valueEnhancer.derive(size$, (size) => size.width / this.baseWidth);
2616
2615
  this._scale$ = scale$;
@@ -2677,25 +2676,28 @@ class ScrollMode {
2677
2676
  "initScroll"
2678
2677
  );
2679
2678
  }
2679
+ get mainView() {
2680
+ return this.manager.mainView;
2681
+ }
2680
2682
  setRoot(root) {
2681
2683
  this._root$.setValue(root);
2682
2684
  }
2683
2685
  updateScroll(scrollTop) {
2684
- this._mainView$.value.moveCamera({
2686
+ this.mainView.moveCamera({
2685
2687
  centerY: scrollTop,
2686
2688
  animationMode: whiteWebSdk.AnimationMode.Immediately
2687
2689
  });
2688
2690
  }
2689
2691
  updateBound(scrollTop, { height }, scale2) {
2690
2692
  if (scale2 > 0) {
2691
- this._mainView$.value.moveCameraToContain({
2693
+ this.mainView.moveCameraToContain({
2692
2694
  originX: 0,
2693
2695
  originY: scrollTop - height / scale2 / 2,
2694
2696
  width: this.baseWidth,
2695
2697
  height: height / scale2,
2696
2698
  animationMode: whiteWebSdk.AnimationMode.Immediately
2697
2699
  });
2698
- this._mainView$.value.setCameraBound({
2700
+ this.mainView.setCameraBound({
2699
2701
  damping: 1,
2700
2702
  maxContentMode: () => scale2,
2701
2703
  minContentMode: () => scale2,
@@ -2716,7 +2718,10 @@ class ScrollMode {
2716
2718
  this.scrollState$.destroy();
2717
2719
  this._page$.destroy();
2718
2720
  this._size$.destroy();
2719
- this._mainView$.destroy();
2721
+ }
2722
+ shouldBroadcast() {
2723
+ var _a;
2724
+ return this.manager.canOperate && ((_a = this.manager.room) == null ? void 0 : _a.disableDeviceInputs) === false;
2720
2725
  }
2721
2726
  }
2722
2727
  class AppManager {
@@ -7172,9 +7177,13 @@ class CursorManager {
7172
7177
  var _a;
7173
7178
  return (_a = this.manager.focusApp) == null ? void 0 : _a.view;
7174
7179
  }
7180
+ shouldBroadcast() {
7181
+ var _a;
7182
+ return this.manager.canOperate && ((_a = this.manager.room) == null ? void 0 : _a.disableDeviceInputs) === false;
7183
+ }
7175
7184
  updateCursor(event, clientX, clientY) {
7176
7185
  const self = findMemberByUid(this.manager.room, this.manager.uid);
7177
- if (this.wrapperRect && this.manager.canOperate && this.canMoveCursor(self)) {
7186
+ if (this.wrapperRect && this.shouldBroadcast() && this.canMoveCursor(self)) {
7178
7187
  const view = event.type === "main" ? this.manager.mainView : this.focusView;
7179
7188
  const point = this.getPoint(view, clientX, clientY);
7180
7189
  if (point) {
@@ -12313,8 +12322,8 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
12313
12322
  const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
12314
12323
  constructor(context) {
12315
12324
  super(context);
12316
- this.version = "1.0.0-canary.72";
12317
- this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.1", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12325
+ this.version = "1.0.0-canary.74";
12326
+ this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.3", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12318
12327
  this.emitter = callbacks;
12319
12328
  this.viewMode$ = new valueEnhancer.Val(whiteWebSdk.ViewMode.Broadcaster);
12320
12329
  this.playground$ = new valueEnhancer.Val(void 0);
@@ -12330,7 +12339,7 @@ const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
12330
12339
  (_b = this.appManager) == null ? void 0 : _b.dispatchInternalEvent(Events.MoveCamera, camera);
12331
12340
  };
12332
12341
  _WindowManager.displayer = context.displayer;
12333
- window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.1", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12342
+ window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.3", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12334
12343
  }
12335
12344
  static async mount(params) {
12336
12345
  var _a;
package/dist/index.mjs CHANGED
@@ -2537,7 +2537,7 @@ class ScrollMode {
2537
2537
  this.onWheel = (ev) => {
2538
2538
  var _a2;
2539
2539
  const target = ev.target;
2540
- if (this.manager.canOperate && ((_a2 = this._whiteboard$.value) == null ? void 0 : _a2.contains(target))) {
2540
+ if (this.shouldBroadcast() && ((_a2 = this._whiteboard$.value) == null ? void 0 : _a2.contains(target))) {
2541
2541
  ev.preventDefault();
2542
2542
  ev.stopPropagation();
2543
2543
  const dy = ev.deltaY || 0;
@@ -2553,8 +2553,7 @@ class ScrollMode {
2553
2553
  }
2554
2554
  };
2555
2555
  this._root$ = new Val(null);
2556
- this._mainView$ = new Val(this.manager.mainView);
2557
- this._mainView$.value.disableCameraTransform = false;
2556
+ this.mainView.disableCameraTransform = false;
2558
2557
  if ((_a = manager.scrollBaseSize$) == null ? void 0 : _a.value) {
2559
2558
  this.baseWidth = manager.scrollBaseSize$.value.width;
2560
2559
  this.baseHeight = manager.scrollBaseSize$.value.height;
@@ -2574,9 +2573,9 @@ class ScrollMode {
2574
2573
  this._size$ = size$;
2575
2574
  this.sideEffect.add(() => {
2576
2575
  const onSizeUpdated = size$.setValue.bind(size$);
2577
- onSizeUpdated(this._mainView$.value.size);
2578
- this._mainView$.value.callbacks.on("onSizeUpdated", onSizeUpdated);
2579
- return () => this._mainView$.value.callbacks.off("onSizeUpdated", onSizeUpdated);
2576
+ onSizeUpdated(this.mainView.size);
2577
+ this.mainView.callbacks.on("onSizeUpdated", onSizeUpdated);
2578
+ return () => this.mainView.callbacks.off("onSizeUpdated", onSizeUpdated);
2580
2579
  });
2581
2580
  this.sideEffect.add(() => {
2582
2581
  const onCameraUpdated = (camera) => {
@@ -2589,8 +2588,8 @@ class ScrollMode {
2589
2588
  });
2590
2589
  callbacks.emit("userScroll");
2591
2590
  };
2592
- this._mainView$.value.callbacks.on("onCameraUpdatedByDevice", onCameraUpdated);
2593
- return () => this._mainView$.value.callbacks.off("onCameraUpdatedByDevice", onCameraUpdated);
2591
+ this.mainView.callbacks.on("onCameraUpdatedByDevice", onCameraUpdated);
2592
+ return () => this.mainView.callbacks.off("onCameraUpdatedByDevice", onCameraUpdated);
2594
2593
  });
2595
2594
  const scale$ = derive(size$, (size) => size.width / this.baseWidth);
2596
2595
  this._scale$ = scale$;
@@ -2657,25 +2656,28 @@ class ScrollMode {
2657
2656
  "initScroll"
2658
2657
  );
2659
2658
  }
2659
+ get mainView() {
2660
+ return this.manager.mainView;
2661
+ }
2660
2662
  setRoot(root) {
2661
2663
  this._root$.setValue(root);
2662
2664
  }
2663
2665
  updateScroll(scrollTop) {
2664
- this._mainView$.value.moveCamera({
2666
+ this.mainView.moveCamera({
2665
2667
  centerY: scrollTop,
2666
2668
  animationMode: AnimationMode.Immediately
2667
2669
  });
2668
2670
  }
2669
2671
  updateBound(scrollTop, { height }, scale2) {
2670
2672
  if (scale2 > 0) {
2671
- this._mainView$.value.moveCameraToContain({
2673
+ this.mainView.moveCameraToContain({
2672
2674
  originX: 0,
2673
2675
  originY: scrollTop - height / scale2 / 2,
2674
2676
  width: this.baseWidth,
2675
2677
  height: height / scale2,
2676
2678
  animationMode: AnimationMode.Immediately
2677
2679
  });
2678
- this._mainView$.value.setCameraBound({
2680
+ this.mainView.setCameraBound({
2679
2681
  damping: 1,
2680
2682
  maxContentMode: () => scale2,
2681
2683
  minContentMode: () => scale2,
@@ -2696,7 +2698,10 @@ class ScrollMode {
2696
2698
  this.scrollState$.destroy();
2697
2699
  this._page$.destroy();
2698
2700
  this._size$.destroy();
2699
- this._mainView$.destroy();
2701
+ }
2702
+ shouldBroadcast() {
2703
+ var _a;
2704
+ return this.manager.canOperate && ((_a = this.manager.room) == null ? void 0 : _a.disableDeviceInputs) === false;
2700
2705
  }
2701
2706
  }
2702
2707
  class AppManager {
@@ -7152,9 +7157,13 @@ class CursorManager {
7152
7157
  var _a;
7153
7158
  return (_a = this.manager.focusApp) == null ? void 0 : _a.view;
7154
7159
  }
7160
+ shouldBroadcast() {
7161
+ var _a;
7162
+ return this.manager.canOperate && ((_a = this.manager.room) == null ? void 0 : _a.disableDeviceInputs) === false;
7163
+ }
7155
7164
  updateCursor(event, clientX, clientY) {
7156
7165
  const self = findMemberByUid(this.manager.room, this.manager.uid);
7157
- if (this.wrapperRect && this.manager.canOperate && this.canMoveCursor(self)) {
7166
+ if (this.wrapperRect && this.shouldBroadcast() && this.canMoveCursor(self)) {
7158
7167
  const view = event.type === "main" ? this.manager.mainView : this.focusView;
7159
7168
  const point = this.getPoint(view, clientX, clientY);
7160
7169
  if (point) {
@@ -12293,8 +12302,8 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
12293
12302
  const _WindowManager = class extends InvisiblePlugin {
12294
12303
  constructor(context) {
12295
12304
  super(context);
12296
- this.version = "1.0.0-canary.72";
12297
- this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.1", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12305
+ this.version = "1.0.0-canary.74";
12306
+ this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.3", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12298
12307
  this.emitter = callbacks;
12299
12308
  this.viewMode$ = new Val(ViewMode.Broadcaster);
12300
12309
  this.playground$ = new Val(void 0);
@@ -12310,7 +12319,7 @@ const _WindowManager = class extends InvisiblePlugin {
12310
12319
  (_b = this.appManager) == null ? void 0 : _b.dispatchInternalEvent(Events.MoveCamera, camera);
12311
12320
  };
12312
12321
  _WindowManager.displayer = context.displayer;
12313
- window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.1", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12322
+ window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.3", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12314
12323
  }
12315
12324
  static async mount(params) {
12316
12325
  var _a;
package/dist/index.umd.js CHANGED
@@ -2532,7 +2532,7 @@
2532
2532
  this.onWheel = (ev) => {
2533
2533
  var _a2;
2534
2534
  const target = ev.target;
2535
- if (this.manager.canOperate && ((_a2 = this._whiteboard$.value) == null ? void 0 : _a2.contains(target))) {
2535
+ if (this.shouldBroadcast() && ((_a2 = this._whiteboard$.value) == null ? void 0 : _a2.contains(target))) {
2536
2536
  ev.preventDefault();
2537
2537
  ev.stopPropagation();
2538
2538
  const dy = ev.deltaY || 0;
@@ -2548,8 +2548,7 @@
2548
2548
  }
2549
2549
  };
2550
2550
  this._root$ = new valueEnhancer.Val(null);
2551
- this._mainView$ = new valueEnhancer.Val(this.manager.mainView);
2552
- this._mainView$.value.disableCameraTransform = false;
2551
+ this.mainView.disableCameraTransform = false;
2553
2552
  if ((_a = manager.scrollBaseSize$) == null ? void 0 : _a.value) {
2554
2553
  this.baseWidth = manager.scrollBaseSize$.value.width;
2555
2554
  this.baseHeight = manager.scrollBaseSize$.value.height;
@@ -2569,9 +2568,9 @@
2569
2568
  this._size$ = size$;
2570
2569
  this.sideEffect.add(() => {
2571
2570
  const onSizeUpdated = size$.setValue.bind(size$);
2572
- onSizeUpdated(this._mainView$.value.size);
2573
- this._mainView$.value.callbacks.on("onSizeUpdated", onSizeUpdated);
2574
- return () => this._mainView$.value.callbacks.off("onSizeUpdated", onSizeUpdated);
2571
+ onSizeUpdated(this.mainView.size);
2572
+ this.mainView.callbacks.on("onSizeUpdated", onSizeUpdated);
2573
+ return () => this.mainView.callbacks.off("onSizeUpdated", onSizeUpdated);
2575
2574
  });
2576
2575
  this.sideEffect.add(() => {
2577
2576
  const onCameraUpdated = (camera) => {
@@ -2584,8 +2583,8 @@
2584
2583
  });
2585
2584
  callbacks.emit("userScroll");
2586
2585
  };
2587
- this._mainView$.value.callbacks.on("onCameraUpdatedByDevice", onCameraUpdated);
2588
- return () => this._mainView$.value.callbacks.off("onCameraUpdatedByDevice", onCameraUpdated);
2586
+ this.mainView.callbacks.on("onCameraUpdatedByDevice", onCameraUpdated);
2587
+ return () => this.mainView.callbacks.off("onCameraUpdatedByDevice", onCameraUpdated);
2589
2588
  });
2590
2589
  const scale$ = valueEnhancer.derive(size$, (size) => size.width / this.baseWidth);
2591
2590
  this._scale$ = scale$;
@@ -2652,25 +2651,28 @@
2652
2651
  "initScroll"
2653
2652
  );
2654
2653
  }
2654
+ get mainView() {
2655
+ return this.manager.mainView;
2656
+ }
2655
2657
  setRoot(root) {
2656
2658
  this._root$.setValue(root);
2657
2659
  }
2658
2660
  updateScroll(scrollTop) {
2659
- this._mainView$.value.moveCamera({
2661
+ this.mainView.moveCamera({
2660
2662
  centerY: scrollTop,
2661
2663
  animationMode: whiteWebSdk.AnimationMode.Immediately
2662
2664
  });
2663
2665
  }
2664
2666
  updateBound(scrollTop, { height }, scale2) {
2665
2667
  if (scale2 > 0) {
2666
- this._mainView$.value.moveCameraToContain({
2668
+ this.mainView.moveCameraToContain({
2667
2669
  originX: 0,
2668
2670
  originY: scrollTop - height / scale2 / 2,
2669
2671
  width: this.baseWidth,
2670
2672
  height: height / scale2,
2671
2673
  animationMode: whiteWebSdk.AnimationMode.Immediately
2672
2674
  });
2673
- this._mainView$.value.setCameraBound({
2675
+ this.mainView.setCameraBound({
2674
2676
  damping: 1,
2675
2677
  maxContentMode: () => scale2,
2676
2678
  minContentMode: () => scale2,
@@ -2691,7 +2693,10 @@
2691
2693
  this.scrollState$.destroy();
2692
2694
  this._page$.destroy();
2693
2695
  this._size$.destroy();
2694
- this._mainView$.destroy();
2696
+ }
2697
+ shouldBroadcast() {
2698
+ var _a;
2699
+ return this.manager.canOperate && ((_a = this.manager.room) == null ? void 0 : _a.disableDeviceInputs) === false;
2695
2700
  }
2696
2701
  }
2697
2702
  class AppManager {
@@ -7147,9 +7152,13 @@
7147
7152
  var _a;
7148
7153
  return (_a = this.manager.focusApp) == null ? void 0 : _a.view;
7149
7154
  }
7155
+ shouldBroadcast() {
7156
+ var _a;
7157
+ return this.manager.canOperate && ((_a = this.manager.room) == null ? void 0 : _a.disableDeviceInputs) === false;
7158
+ }
7150
7159
  updateCursor(event, clientX, clientY) {
7151
7160
  const self2 = findMemberByUid(this.manager.room, this.manager.uid);
7152
- if (this.wrapperRect && this.manager.canOperate && this.canMoveCursor(self2)) {
7161
+ if (this.wrapperRect && this.shouldBroadcast() && this.canMoveCursor(self2)) {
7153
7162
  const view = event.type === "main" ? this.manager.mainView : this.focusView;
7154
7163
  const point = this.getPoint(view, clientX, clientY);
7155
7164
  if (point) {
@@ -12288,8 +12297,8 @@
12288
12297
  const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
12289
12298
  constructor(context) {
12290
12299
  super(context);
12291
- this.version = "1.0.0-canary.72";
12292
- this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.1", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12300
+ this.version = "1.0.0-canary.74";
12301
+ this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.3", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12293
12302
  this.emitter = callbacks;
12294
12303
  this.viewMode$ = new valueEnhancer.Val(whiteWebSdk.ViewMode.Broadcaster);
12295
12304
  this.playground$ = new valueEnhancer.Val(void 0);
@@ -12305,7 +12314,7 @@
12305
12314
  (_b = this.appManager) == null ? void 0 : _b.dispatchInternalEvent(Events.MoveCamera, camera);
12306
12315
  };
12307
12316
  _WindowManager.displayer = context.displayer;
12308
- window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.1", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12317
+ window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.4.0", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "jspdf": "^2.5.1", "lodash": "^4.17.21", "p-retry": "^5.1.2", "side-effect-manager": "^1.2.1", "uuid": "^9.0.0", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "1.0.0-canary.5", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.28.1", "@rollup/plugin-commonjs": "^23.0.4", "@rollup/plugin-node-resolve": "^15.0.1", "@rollup/plugin-url": "^8.0.1", "@sveltejs/vite-plugin-svelte": "^2.0.2", "@tsconfig/svelte": "^3.0.0", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^9.0.0", "@typescript-eslint/eslint-plugin": "^5.46.1", "@typescript-eslint/parser": "^5.46.1", "@vitest/ui": "^0.25.7", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^8.29.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^4.0.0", "jsdom": "^19.0.0", "less": "^4.1.3", "prettier": "^2.8.1", "prettier-plugin-svelte": "^2.9.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^4.0.0", "svelte": "^3.54.0", "typescript": "^4.9.4", "vite": "^4.0.3", "vite-plugin-dts": "^1.7.1", "vitest": "^0.25.7", "white-web-sdk": "^2.16.40" } };
12309
12318
  }
12310
12319
  static async mount(params) {
12311
12320
  var _a;
package/dist/shim.d.ts CHANGED
@@ -1,11 +1,5 @@
1
- import type { SvelteComponent } from "svelte";
1
+ /// <reference types="svelte" />
2
+ /// <reference types="vite/client" />
2
3
 
3
- declare module "*.svelte" {
4
- const app: SvelteComponent;
5
- export default app;
6
- }
7
-
8
- declare global {
9
- const __APP_VERSION__: string;
10
- const __APP_DEPENDENCIES__: Record<string, string>;
11
- }
4
+ declare const __APP_VERSION__: string;
5
+ declare const __APP_DEPENDENCIES__: Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "1.0.0-canary.72",
3
+ "version": "1.0.0-canary.74",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
@@ -54,7 +54,7 @@
54
54
  "rollup-plugin-styles": "^4.0.0",
55
55
  "svelte": "^3.54.0",
56
56
  "typescript": "^4.9.4",
57
- "vite": "^4.0.1",
57
+ "vite": "^4.0.3",
58
58
  "vite-plugin-dts": "^1.7.1",
59
59
  "vitest": "^0.25.7",
60
60
  "white-web-sdk": "^2.16.40"
@@ -117,9 +117,13 @@ export class CursorManager {
117
117
  this.updateCursor(this.getType(event), event.clientX, event.clientY);
118
118
  }, 48);
119
119
 
120
+ private shouldBroadcast() {
121
+ return this.manager.canOperate && this.manager.room?.disableDeviceInputs === false;
122
+ }
123
+
120
124
  private updateCursor(event: EventType, clientX: number, clientY: number) {
121
125
  const self = findMemberByUid(this.manager.room, this.manager.uid);
122
- if (this.wrapperRect && this.manager.canOperate && this.canMoveCursor(self)) {
126
+ if (this.wrapperRect && this.shouldBroadcast() && this.canMoveCursor(self)) {
123
127
  const view = event.type === "main" ? this.manager.mainView : this.focusView;
124
128
  const point = this.getPoint(view, clientX, clientY);
125
129
  if (point) {
@@ -26,26 +26,28 @@ export class ScrollMode {
26
26
  private readonly _root$: Val<HTMLElement | null>;
27
27
  private readonly _whiteboard$: ReadonlyVal<HTMLElement | null>;
28
28
  private readonly _scrollTop$: Val<number>;
29
- public readonly _page$: ReadonlyVal<number>;
29
+ private readonly _page$: ReadonlyVal<number>;
30
30
  private readonly _scale$: ReadonlyVal<number>;
31
31
  private readonly _size$: Val<Size>;
32
- private readonly _mainView$: Val<View>;
33
32
 
34
33
  private baseWidth = SCROLL_MODE_BASE_WIDTH;
35
34
  private baseHeight = SCROLL_MODE_BASE_HEIGHT;
36
35
 
37
- public scrollStorage: ScrollStorage;
36
+ public readonly scrollStorage: ScrollStorage;
38
37
  public readonly scrollState$: ReadonlyVal<ScrollState>;
39
38
 
39
+ get mainView() {
40
+ return this.manager.mainView;
41
+ }
42
+
40
43
  public setRoot(root: HTMLElement): void {
41
44
  this._root$.setValue(root);
42
45
  }
43
46
 
44
47
  constructor(private manager: AppManager) {
45
48
  this._root$ = new Val<HTMLElement | null>(null);
46
- this._mainView$ = new Val<View>(this.manager.mainView);
47
49
  // 滚动模式下确保 disableCameraTransform 为 false, 否则触摸屏无法滚动
48
- this._mainView$.value.disableCameraTransform = false;
50
+ this.mainView.disableCameraTransform = false;
49
51
 
50
52
  if (manager.scrollBaseSize$?.value) {
51
53
  this.baseWidth = manager.scrollBaseSize$.value.width;
@@ -69,9 +71,9 @@ export class ScrollMode {
69
71
  this._size$ = size$;
70
72
  this.sideEffect.add(() => {
71
73
  const onSizeUpdated = size$.setValue.bind(size$);
72
- onSizeUpdated(this._mainView$.value.size);
73
- this._mainView$.value.callbacks.on("onSizeUpdated", onSizeUpdated);
74
- return () => this._mainView$.value.callbacks.off("onSizeUpdated", onSizeUpdated);
74
+ onSizeUpdated(this.mainView.size);
75
+ this.mainView.callbacks.on("onSizeUpdated", onSizeUpdated);
76
+ return () => this.mainView.callbacks.off("onSizeUpdated", onSizeUpdated);
75
77
  });
76
78
 
77
79
  this.sideEffect.add(() => {
@@ -84,9 +86,9 @@ export class ScrollMode {
84
86
  });
85
87
  callbacks.emit("userScroll");
86
88
  };
87
- this._mainView$.value.callbacks.on("onCameraUpdatedByDevice", onCameraUpdated);
89
+ this.mainView.callbacks.on("onCameraUpdatedByDevice", onCameraUpdated);
88
90
  return () =>
89
- this._mainView$.value.callbacks.off("onCameraUpdatedByDevice", onCameraUpdated);
91
+ this.mainView.callbacks.off("onCameraUpdatedByDevice", onCameraUpdated);
90
92
  });
91
93
 
92
94
  const scale$ = derive(size$, size => size.width / this.baseWidth);
@@ -174,7 +176,7 @@ export class ScrollMode {
174
176
  };
175
177
 
176
178
  private updateScroll(scrollTop: number): void {
177
- this._mainView$.value.moveCamera({
179
+ this.mainView.moveCamera({
178
180
  centerY: scrollTop,
179
181
  animationMode: AnimationMode.Immediately,
180
182
  });
@@ -182,7 +184,7 @@ export class ScrollMode {
182
184
 
183
185
  private updateBound(scrollTop: number, { height }: Size, scale: number): void {
184
186
  if (scale > 0) {
185
- this._mainView$.value.moveCameraToContain({
187
+ this.mainView.moveCameraToContain({
186
188
  originX: 0,
187
189
  originY: scrollTop - height / scale / 2,
188
190
  width: this.baseWidth,
@@ -190,7 +192,7 @@ export class ScrollMode {
190
192
  animationMode: AnimationMode.Immediately,
191
193
  });
192
194
 
193
- this._mainView$.value.setCameraBound({
195
+ this.mainView.setCameraBound({
194
196
  damping: 1,
195
197
  maxContentMode: () => scale,
196
198
  minContentMode: () => scale,
@@ -212,7 +214,6 @@ export class ScrollMode {
212
214
  this.scrollState$.destroy();
213
215
  this._page$.destroy();
214
216
  this._size$.destroy();
215
- this._mainView$.destroy();
216
217
  }
217
218
 
218
219
  private getWhiteboardElement = (root: HTMLElement | null): HTMLElement | null => {
@@ -220,9 +221,13 @@ export class ScrollMode {
220
221
  return root && root.querySelector(className);
221
222
  };
222
223
 
224
+ private shouldBroadcast() {
225
+ return this.manager.canOperate && this.manager.room?.disableDeviceInputs === false;
226
+ }
227
+
223
228
  private onWheel = (ev: WheelEvent): void => {
224
229
  const target = ev.target as HTMLElement | null;
225
- if (this.manager.canOperate && this._whiteboard$.value?.contains(target)) {
230
+ if (this.shouldBroadcast() && this._whiteboard$.value?.contains(target)) {
226
231
  ev.preventDefault();
227
232
  ev.stopPropagation();
228
233
  const dy = ev.deltaY || 0;
package/src/shim.d.ts CHANGED
@@ -1,11 +1,5 @@
1
- import type { SvelteComponent } from "svelte";
1
+ /// <reference types="svelte" />
2
+ /// <reference types="vite/client" />
2
3
 
3
- declare module "*.svelte" {
4
- const app: SvelteComponent;
5
- export default app;
6
- }
7
-
8
- declare global {
9
- const __APP_VERSION__: string;
10
- const __APP_DEPENDENCIES__: Record<string, string>;
11
- }
4
+ declare const __APP_VERSION__: string;
5
+ declare const __APP_DEPENDENCIES__: Record<string, string>;