@netless/window-manager 1.0.0-canary.16 → 1.0.0-canary.19

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/dist/index.d.ts CHANGED
@@ -81,6 +81,8 @@ export declare type MountParams = {
81
81
  container?: HTMLElement;
82
82
  /** 白板高宽比例, 默认为 9 / 16 */
83
83
  containerSizeRatio?: number;
84
+ /** @deprecated */
85
+ chessboard?: boolean;
84
86
  /** 是否高亮显示同步区域, 默认为 true */
85
87
  highlightStage?: boolean;
86
88
  collectorContainer?: HTMLElement;
@@ -243,6 +245,11 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
243
245
  /** @inner */
244
246
  _refresh(): void;
245
247
  setContainerSizeRatio(ratio: number): void;
248
+ createPPTHandler(): {
249
+ onPageJumpTo: (_pptUUID: string, index: number) => void;
250
+ onPageToNext: () => void;
251
+ onPageToPrev: () => void;
252
+ };
246
253
  private isDynamicPPT;
247
254
  private ensureAttributes;
248
255
  }
package/dist/index.es.js CHANGED
@@ -1070,7 +1070,7 @@ class AppContext {
1070
1070
  (_a = this.room) == null ? void 0 : _a.putScenes(this.appProxy.scenePath, scenes);
1071
1071
  };
1072
1072
  this.getInitScenePath = () => {
1073
- return this.manager.getAppInitPath(this.appId);
1073
+ return this.appProxy.scenePath;
1074
1074
  };
1075
1075
  this.setAttributes = (attributes) => {
1076
1076
  this.manager.safeSetAttributes({ [this.appId]: attributes });
@@ -1228,12 +1228,17 @@ class CameraSynchronizer {
1228
1228
  const nextScale = camera.scale * scale2;
1229
1229
  const moveCamera = () => {
1230
1230
  var _a;
1231
- (_a = this.view) == null ? void 0 : _a.moveCamera({
1232
- centerX: camera.centerX,
1233
- centerY: camera.centerY,
1231
+ const config = {
1234
1232
  scale: nextScale,
1235
1233
  animationMode: AnimationMode.Immediately
1236
- });
1234
+ };
1235
+ if (camera.centerX !== null) {
1236
+ config.centerX = camera.centerX;
1237
+ }
1238
+ if (camera.centerY !== null) {
1239
+ config.centerY = camera.centerY;
1240
+ }
1241
+ (_a = this.view) == null ? void 0 : _a.moveCamera(config);
1237
1242
  };
1238
1243
  moveCamera();
1239
1244
  delay(moveCamera, 50);
@@ -1280,7 +1285,7 @@ class ViewSync {
1280
1285
  }, "view");
1281
1286
  };
1282
1287
  this.onCameraUpdatedByDevice = (camera) => {
1283
- this.synchronizer.onLocalCameraUpdate(camera);
1288
+ this.synchronizer.onLocalCameraUpdate(Object.assign(camera, { id: this.context.uid }));
1284
1289
  const stage = this.context.stageRect$.value;
1285
1290
  if (stage) {
1286
1291
  const size2 = { width: stage.width, height: stage.height, id: this.context.uid };
@@ -1290,15 +1295,12 @@ class ViewSync {
1290
1295
  }
1291
1296
  };
1292
1297
  this.synchronizer = new CameraSynchronizer((camera) => {
1293
- const iCamera = __spreadValues({
1294
- id: this.context.uid
1295
- }, camera);
1296
- this.context.camera$.setValue(iCamera, true);
1298
+ this.context.camera$.setValue(camera, true);
1297
1299
  const notStoreCamera = this.context.viewMode$ && this.context.viewMode$.value === ViewMode.Freedom;
1298
1300
  if (notStoreCamera) {
1299
1301
  return;
1300
1302
  } else {
1301
- this.context.storeCamera(iCamera);
1303
+ this.context.storeCamera(camera);
1302
1304
  }
1303
1305
  });
1304
1306
  this.bindView(this.context.view$.value);
@@ -1324,16 +1326,13 @@ class ViewSync {
1324
1326
  this.synchronizer.onRemoteSizeUpdate(size2);
1325
1327
  }
1326
1328
  }));
1327
- if (this.context.stageRect$.value) {
1328
- this.synchronizer.setRect(this.context.stageRect$.value);
1329
- this.sem.add(() => this.context.stageRect$.subscribe((rect) => {
1330
- if (rect) {
1331
- this.synchronizer.setRect(rect);
1332
- }
1333
- }));
1334
- }
1329
+ this.sem.add(() => this.context.stageRect$.reaction((rect) => {
1330
+ if (rect) {
1331
+ this.synchronizer.setRect(rect);
1332
+ }
1333
+ }));
1335
1334
  const camera$size$ = combine([this.context.camera$, this.context.size$]);
1336
- camera$size$.subscribe(([camera, size2]) => {
1335
+ camera$size$.reaction(([camera, size2]) => {
1337
1336
  if (camera && size2) {
1338
1337
  this.synchronizer.onRemoteUpdate(camera, size2);
1339
1338
  camera$size$.destroy();
@@ -1745,8 +1744,8 @@ class AppProxy {
1745
1744
  if (box && view) {
1746
1745
  if (!this.camera$.value) {
1747
1746
  this.storeCamera({
1748
- centerX: 0,
1749
- centerY: 0,
1747
+ centerX: null,
1748
+ centerY: null,
1750
1749
  scale: 1,
1751
1750
  id: this.uid
1752
1751
  });
@@ -1907,12 +1906,14 @@ class AppProxy {
1907
1906
  var _a, _b;
1908
1907
  const box = (_a = this.boxManager) == null ? void 0 : _a.getBox(this.id);
1909
1908
  if (box) {
1910
- (_b = this.boxManager) == null ? void 0 : _b.resizeBox({
1911
- appId: this.id,
1912
- width: box.intrinsicWidth + 1e-3,
1913
- height: box.intrinsicHeight + 1e-3,
1914
- skipUpdate: true
1915
- });
1909
+ if (!box.minimized) {
1910
+ (_b = this.boxManager) == null ? void 0 : _b.resizeBox({
1911
+ appId: this.id,
1912
+ width: box.intrinsicWidth + 1e-3,
1913
+ height: box.intrinsicHeight + 1e-3,
1914
+ skipUpdate: true
1915
+ });
1916
+ }
1916
1917
  }
1917
1918
  }
1918
1919
  async onSeek(time2) {
@@ -2091,6 +2092,8 @@ class AppProxy {
2091
2092
  this.manager.refresher.remove(this.id);
2092
2093
  this.manager.refresher.remove(this.stateKey);
2093
2094
  this.manager.refresher.remove(`${this.id}-fullPath`);
2095
+ this.manager.refresher.remove(`${this.id}-camera`);
2096
+ this.manager.refresher.remove(`${this.id}-size`);
2094
2097
  this.valManager.destroy();
2095
2098
  }
2096
2099
  close() {
@@ -2248,6 +2251,14 @@ class MainViewProxy {
2248
2251
  })
2249
2252
  ]);
2250
2253
  this.createViewSync();
2254
+ this.sideEffectManager.add(() => emitter.on("focusedChange", ({ focused }) => {
2255
+ if (focused === void 0) {
2256
+ const scenePath = this.store.getMainViewScenePath();
2257
+ if (scenePath) {
2258
+ setScenePath(this.manager.room, scenePath);
2259
+ }
2260
+ }
2261
+ }));
2251
2262
  }
2252
2263
  ensureCameraAndSize() {
2253
2264
  var _a;
@@ -2677,7 +2688,6 @@ class AppManager {
2677
2688
  if (sceneState) {
2678
2689
  const scenePath = sceneState.scenePath;
2679
2690
  this.appProxies.forEach((appProxy) => {
2680
- console.log("scenePath", scenePath, appProxy.scenePath);
2681
2691
  if (appProxy.scenePath && scenePath.startsWith(appProxy.scenePath)) {
2682
2692
  appProxy.emitAppSceneStateChange(sceneState);
2683
2693
  appProxy.setFullPath(scenePath);
@@ -4262,13 +4272,19 @@ class Y$3 {
4262
4272
  const o2 = document.createElement("div");
4263
4273
  o2.className = this.wrapClassName("content-wrap");
4264
4274
  const r2 = document.createElement("div");
4265
- r2.className = this.wrapClassName("content") + " tele-fancy-scrollbar", this.$content = r2, this._sideEffect.add(() => {
4275
+ r2.className = this.wrapClassName("content") + " tele-fancy-scrollbar", this.$content = r2;
4276
+ const h = () => {
4277
+ const e3 = r2.getBoundingClientRect();
4278
+ this._contentRect$.setValue({ x: 0, y: 0, width: e3.width, height: e3.height });
4279
+ };
4280
+ this._sideEffect.add(() => {
4266
4281
  const e3 = new W$3(() => {
4267
- const e4 = r2.getBoundingClientRect();
4268
- this._contentRect$.setValue({ x: 0, y: 0, width: e4.width, height: e4.height });
4282
+ this.minimized || h();
4269
4283
  });
4270
4284
  return e3.observe(r2), () => e3.disconnect();
4271
- }), this._sideEffect.add(() => {
4285
+ }), this._sideEffect.addDisposer(this._minimized$.reaction((e3) => {
4286
+ e3 || this._sideEffect.setTimeout(h, 400, "minimized-content-rect-fix");
4287
+ })), this._sideEffect.add(() => {
4272
4288
  let e3;
4273
4289
  return this._$userStyles$.subscribe((t3) => {
4274
4290
  e3 && e3.remove(), e3 = t3, t3 && o2.appendChild(t3);
@@ -4294,13 +4310,13 @@ class Y$3 {
4294
4310
  ((i3 = this.$stage) == null ? void 0 : i3.parentElement) && this.$stage.remove();
4295
4311
  });
4296
4312
  }), o2.appendChild(r2);
4297
- const h = document.createElement("div");
4298
- return h.className = this.wrapClassName("footer-wrap"), this.$footer = h, this._sideEffect.add(() => {
4313
+ const c = document.createElement("div");
4314
+ return c.className = this.wrapClassName("footer-wrap"), this.$footer = c, this._sideEffect.add(() => {
4299
4315
  let e3;
4300
4316
  return this._$userFooter$.subscribe((t3) => {
4301
- e3 && e3.remove(), e3 = t3, t3 && h.appendChild(t3);
4317
+ e3 && e3.remove(), e3 = t3, t3 && c.appendChild(t3);
4302
4318
  });
4303
- }), a2.appendChild(n2), a2.appendChild(o2), a2.appendChild(h), this._renderResizeHandlers(), this.$box;
4319
+ }), a2.appendChild(n2), a2.appendChild(o2), a2.appendChild(c), this._renderResizeHandlers(), this.$box;
4304
4320
  }
4305
4321
  _renderResizeHandlers() {
4306
4322
  const e2 = document.createElement("div");
@@ -5928,7 +5944,7 @@ class ReconnectRefresher {
5928
5944
  };
5929
5945
  this.onReconnected = debounce(() => {
5930
5946
  this._onReconnected();
5931
- }, 3e3);
5947
+ }, 1e3);
5932
5948
  this._onReconnected = () => {
5933
5949
  log("onReconnected refresh reactors");
5934
5950
  this.releaseDisposers();
@@ -6048,6 +6064,9 @@ const replaceRoomFunction = (room, manager) => {
6048
6064
  room.lockImage = (...args) => manager.lockImage(...args);
6049
6065
  room.lockImages = (...args) => manager.lockImages(...args);
6050
6066
  delegateRemoveScenes(room, manager);
6067
+ if (!room.dynamicPpt.slideStateAdapter.pptHandler) {
6068
+ room.dynamicPpt.slideStateAdapter.pptHandler = manager.createPPTHandler();
6069
+ }
6051
6070
  }
6052
6071
  };
6053
6072
  const delegateRemoveScenes = (room, manager) => {
@@ -15602,15 +15621,15 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
15602
15621
  const _WindowManager = class extends InvisiblePlugin {
15603
15622
  constructor(context) {
15604
15623
  super(context);
15605
- this.version = "1.0.0-canary.16";
15606
- this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.17", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "video.js": ">=7" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.9", "@netless/app-media-player": "0.1.0-beta.5", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.22", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
15624
+ this.version = "1.0.0-canary.19";
15625
+ this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.18", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "video.js": ">=7" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.9", "@netless/app-media-player": "0.1.0-beta.5", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.22", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
15607
15626
  this.emitter = callbacks$1;
15608
15627
  this.viewMode = ViewMode.Broadcaster;
15609
15628
  this.viewMode$ = new Val(ViewMode.Broadcaster);
15610
15629
  this.isReplay = isPlayer(this.displayer);
15611
15630
  this.containerSizeRatio = _WindowManager.containerSizeRatio;
15612
15631
  _WindowManager.displayer = context.displayer;
15613
- window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.17", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "video.js": ">=7" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.9", "@netless/app-media-player": "0.1.0-beta.5", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.22", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
15632
+ window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.18", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "video.js": ">=7" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.9", "@netless/app-media-player": "0.1.0-beta.5", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.22", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.1", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
15614
15633
  }
15615
15634
  static async mount(params) {
15616
15635
  var _a;
@@ -16242,6 +16261,26 @@ const _WindowManager = class extends InvisiblePlugin {
16242
16261
  this.containerSizeRatio = ratio;
16243
16262
  emitter.emit("containerSizeRatioUpdate", ratio);
16244
16263
  }
16264
+ createPPTHandler() {
16265
+ return {
16266
+ onPageJumpTo: (_pptUUID, index2) => {
16267
+ var _a, _b, _c, _d;
16268
+ (_d = (_c = (_b = (_a = this.appManager) == null ? void 0 : _a.focusApp) == null ? void 0 : _b.appContext) == null ? void 0 : _c.whiteBoardView) == null ? void 0 : _d.jumpPage(index2);
16269
+ },
16270
+ onPageToNext: () => {
16271
+ var _a, _b, _c, _d;
16272
+ if (this.focused) {
16273
+ (_d = (_c = (_b = (_a = this.appManager) == null ? void 0 : _a.focusApp) == null ? void 0 : _b.appContext) == null ? void 0 : _c.whiteBoardView) == null ? void 0 : _d.nextPage();
16274
+ }
16275
+ },
16276
+ onPageToPrev: () => {
16277
+ var _a, _b, _c, _d;
16278
+ if (this.focused) {
16279
+ (_d = (_c = (_b = (_a = this.appManager) == null ? void 0 : _a.focusApp) == null ? void 0 : _b.appContext) == null ? void 0 : _c.whiteBoardView) == null ? void 0 : _d.prevPage();
16280
+ }
16281
+ }
16282
+ };
16283
+ }
16245
16284
  isDynamicPPT(scenes) {
16246
16285
  var _a, _b;
16247
16286
  const sceneSrc = (_b = (_a = scenes[0]) == null ? void 0 : _a.ppt) == null ? void 0 : _b.src;