@netless/window-manager 0.4.69 → 0.4.71-beta.0

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.mjs CHANGED
@@ -954,6 +954,9 @@ class AppContext {
954
954
  setTimeout(() => {
955
955
  var _a;
956
956
  (_a = this.getRoom()) == null ? void 0 : _a.refreshViewSize();
957
+ if (WindowManager.supportTeachingAidsPlugin) {
958
+ callbacks$1.emit("onAppViewMounted", { appId: this.appId, view });
959
+ }
957
960
  }, 1e3);
958
961
  }
959
962
  };
@@ -1397,6 +1400,9 @@ class AppProxy {
1397
1400
  var _a2;
1398
1401
  if (this.view && fullPath && fullPath !== ((_a2 = this.view) == null ? void 0 : _a2.focusScenePath)) {
1399
1402
  setViewFocusScenePath(this.view, fullPath);
1403
+ if (WindowManager.supportTeachingAidsPlugin) {
1404
+ callbacks$1.emit("onAppScenePathChange", { appId: this.id, view: this.view });
1405
+ }
1400
1406
  }
1401
1407
  }, 50);
1402
1408
  this.notifyPageStateChange = debounce$1(() => {
@@ -1514,6 +1520,9 @@ class AppProxy {
1514
1520
  appRegister.notifyApp(this.kind, "created", { appId, result });
1515
1521
  this.afterSetupApp(boxInitState);
1516
1522
  this.fixMobileSize();
1523
+ if (WindowManager.supportTeachingAidsPlugin) {
1524
+ callbacks$1.emit("onAppSetup", appId);
1525
+ }
1517
1526
  }, SETUP_APP_DELAY);
1518
1527
  });
1519
1528
  (_a = this.boxManager) == null ? void 0 : _a.createBox({
@@ -2243,6 +2252,9 @@ class AppManager {
2243
2252
  x: payload.x,
2244
2253
  y: payload.y
2245
2254
  });
2255
+ if (WindowManager.supportTeachingAidsPlugin) {
2256
+ callbacks$1.emit("onBoxMove", payload);
2257
+ }
2246
2258
  };
2247
2259
  this.onBoxResize = (payload) => {
2248
2260
  if (payload.width && payload.height) {
@@ -2251,19 +2263,31 @@ class AppManager {
2251
2263
  width: payload.width,
2252
2264
  height: payload.height
2253
2265
  });
2266
+ if (WindowManager.supportTeachingAidsPlugin) {
2267
+ callbacks$1.emit("onBoxResize", payload);
2268
+ }
2254
2269
  }
2255
2270
  };
2256
2271
  this.onBoxFocus = (payload) => {
2257
2272
  this.windowManger.safeSetAttributes({ focus: payload.appId });
2273
+ if (WindowManager.supportTeachingAidsPlugin) {
2274
+ callbacks$1.emit("onBoxFocus", payload);
2275
+ }
2258
2276
  };
2259
2277
  this.onBoxClose = (payload) => {
2260
2278
  const appProxy = this.appProxies.get(payload.appId);
2261
2279
  if (appProxy) {
2262
2280
  appProxy.destroy(false, true, true, payload.error);
2263
2281
  }
2282
+ if (WindowManager.supportTeachingAidsPlugin) {
2283
+ callbacks$1.emit("onBoxClose", payload);
2284
+ }
2264
2285
  };
2265
2286
  this.onBoxStateChange = (payload) => {
2266
2287
  this.dispatchInternalEvent(Events.AppBoxStateChange, payload);
2288
+ if (WindowManager.supportTeachingAidsPlugin) {
2289
+ callbacks$1.emit("onBoxStateChange", payload);
2290
+ }
2267
2291
  };
2268
2292
  this.addAppsChangeListener = () => {
2269
2293
  this.refresher.add("apps", () => {
@@ -2347,16 +2371,6 @@ class AppManager {
2347
2371
  }
2348
2372
  };
2349
2373
  this.displayerStateListener = (state) => {
2350
- const sceneState = state.sceneState;
2351
- if (sceneState) {
2352
- const scenePath = sceneState.scenePath;
2353
- this.appProxies.forEach((appProxy) => {
2354
- if (appProxy.scenePath && scenePath.startsWith(appProxy.scenePath)) {
2355
- appProxy.emitAppSceneStateChange(sceneState);
2356
- appProxy.setFullPath(scenePath);
2357
- }
2358
- });
2359
- }
2360
2374
  this.appProxies.forEach((appProxy) => {
2361
2375
  appProxy.appEmitter.emit("roomStateChange", state);
2362
2376
  });
@@ -2603,6 +2617,9 @@ class AppManager {
2603
2617
  this.setMainViewFocusPath();
2604
2618
  }
2605
2619
  internalEmitter.emit("mainViewMounted");
2620
+ if (WindowManager.supportTeachingAidsPlugin) {
2621
+ callbacks$1.emit("onMainViewMounted", mainView);
2622
+ }
2606
2623
  }
2607
2624
  setMainViewFocusPath(scenePath) {
2608
2625
  var _a;
@@ -7325,6 +7342,7 @@ class CursorManager {
7325
7342
  this.sideEffectManager = new SideEffectManager$1();
7326
7343
  this.store = this.manager.store;
7327
7344
  this.applianceIcons = ApplianceMap;
7345
+ this.onceCount = true;
7328
7346
  this.onCursorMove = (payload) => {
7329
7347
  const cursorInstance = this.initCursorInstance(payload.uid);
7330
7348
  if (payload.state === CursorState.Leave) {
@@ -7357,7 +7375,18 @@ class CursorManager {
7357
7375
  const now2 = Date.now();
7358
7376
  if (now2 - this.mouseMoveTimer > 48) {
7359
7377
  this.mouseMoveTimer = now2;
7378
+ if (WindowManager.supportTeachingAidsPlugin && isRoom(WindowManager.displayer) && WindowManager.displayer.disableDeviceInputs) {
7379
+ if (this.onceCount) {
7380
+ this.manager.dispatchInternalEvent(Events.CursorMove, {
7381
+ uid: this.manager.uid,
7382
+ state: CursorState.Leave
7383
+ });
7384
+ this.onceCount = false;
7385
+ }
7386
+ return;
7387
+ }
7360
7388
  this.mouseMoveListener_(event, isTouch);
7389
+ this.onceCount = true;
7361
7390
  }
7362
7391
  };
7363
7392
  this.mouseLeaveListener = () => {
@@ -18246,7 +18275,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter: internalEmitter });
18246
18275
  const _WindowManager = class extends InvisiblePlugin {
18247
18276
  constructor(context) {
18248
18277
  super(context);
18249
- this.version = "0.4.69";
18278
+ this.version = "0.4.71-beta.0";
18250
18279
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.28", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^0.1.5", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "jspdf": "2.5.1", "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.17", "@netless/app-media-player": "0.1.0-beta.6", "@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", "jspdf": "^2.5.1", "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.43" } };
18251
18280
  this.emitter = callbacks$1;
18252
18281
  this.viewMode = ViewMode.Broadcaster;
@@ -18258,6 +18287,7 @@ const _WindowManager = class extends InvisiblePlugin {
18258
18287
  static async mount(params) {
18259
18288
  const room = params.room;
18260
18289
  _WindowManager.container = params.container;
18290
+ _WindowManager.supportTeachingAidsPlugin = params.supportTeachingAidsPlugin;
18261
18291
  const containerSizeRatio = params.containerSizeRatio;
18262
18292
  const debug2 = params.debug;
18263
18293
  const cursor = params.cursor;