@netless/window-manager 1.0.0-canary.67 → 1.0.0-canary.69

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.js CHANGED
@@ -2777,7 +2777,7 @@ const safeListenPropsUpdated = (getProps, callback, onDestroyed) => {
2777
2777
  disposeReaction();
2778
2778
  };
2779
2779
  };
2780
- const onObjectRemoved = onObjectByEvent(whiteWebSdk.UpdateEventKind.Removed);
2780
+ onObjectByEvent(whiteWebSdk.UpdateEventKind.Removed);
2781
2781
  onObjectByEvent(whiteWebSdk.UpdateEventKind.Inserted);
2782
2782
  class RedoUndo {
2783
2783
  constructor(context) {
@@ -3201,8 +3201,8 @@ class AppManager {
3201
3201
  this.onBoxMove = (payload) => {
3202
3202
  this.dispatchInternalEvent(Events.AppMove, payload);
3203
3203
  this.store.updateAppState(payload.appId, AppAttributes.Position, {
3204
- x: isNaN(payload.x) ? 0 : payload.x,
3205
- y: isNaN(payload.y) ? 0 : payload.y
3204
+ x: payload.x || 0,
3205
+ y: payload.y || 0
3206
3206
  });
3207
3207
  };
3208
3208
  this.onBoxResize = (payload) => {
@@ -3239,9 +3239,14 @@ class AppManager {
3239
3239
  this.addAppCloseListener = () => {
3240
3240
  var _a2;
3241
3241
  (_a2 = this.refresher) == null ? void 0 : _a2.add("appsClose", () => {
3242
- return onObjectRemoved(this.attributes.apps, () => {
3243
- this.onAppDelete(this.attributes.apps);
3244
- });
3242
+ return safeListenPropsUpdated(
3243
+ () => this.attributes.apps,
3244
+ (events) => {
3245
+ if (events.some((e) => e.kind === whiteWebSdk.UpdateEventKind.Removed)) {
3246
+ this.onAppDelete(this.attributes.apps);
3247
+ }
3248
+ }
3249
+ );
3245
3250
  });
3246
3251
  };
3247
3252
  this.onMainViewIndexChange = (index2) => {
@@ -3656,8 +3661,8 @@ class AppManager {
3656
3661
  const box = appProxy.box;
3657
3662
  boxEmitter.emit("move", {
3658
3663
  appId: appProxy.id,
3659
- x: box == null ? void 0 : box.intrinsicX,
3660
- y: box == null ? void 0 : box.intrinsicY
3664
+ x: box.intrinsicX || 0,
3665
+ y: box.intrinsicY || 0
3661
3666
  });
3662
3667
  this.store.updateAppState(appProxy.id, AppAttributes.ZIndex, box.zIndex);
3663
3668
  }
@@ -6540,8 +6545,8 @@ class BoxManager {
6540
6545
  if (state.size) {
6541
6546
  box._intrinsicSize$.setValue(state.size, true);
6542
6547
  }
6543
- if (state.position) {
6544
- box._intrinsicCoord$.setValue(state.position, true);
6548
+ if (state.position && state.position.x !== void 0 && state.position.y !== void 0) {
6549
+ box._intrinsicCoord$.setValue({ x: state.position.x, y: state.position.y }, true);
6545
6550
  }
6546
6551
  if (state.zIndex) {
6547
6552
  box._zIndex$.setValue(state.zIndex, true);
@@ -12793,7 +12798,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
12793
12798
  const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
12794
12799
  constructor(context) {
12795
12800
  super(context);
12796
- this.version = "1.0.0-canary.67";
12801
+ this.version = "1.0.0-canary.69";
12797
12802
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^1.0.0-canary.3", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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.3", "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": "^3.1.3", "vite-plugin-dts": "^1.5.0", "vitest": "^0.23.4", "white-web-sdk": "^2.16.35" } };
12798
12803
  this.emitter = callbacks;
12799
12804
  this.viewMode$ = new valueEnhancer.Val(whiteWebSdk.ViewMode.Broadcaster);
package/dist/index.mjs CHANGED
@@ -2772,7 +2772,7 @@ const safeListenPropsUpdated = (getProps, callback, onDestroyed) => {
2772
2772
  disposeReaction();
2773
2773
  };
2774
2774
  };
2775
- const onObjectRemoved = onObjectByEvent(UpdateEventKind.Removed);
2775
+ onObjectByEvent(UpdateEventKind.Removed);
2776
2776
  onObjectByEvent(UpdateEventKind.Inserted);
2777
2777
  class RedoUndo {
2778
2778
  constructor(context) {
@@ -3196,8 +3196,8 @@ class AppManager {
3196
3196
  this.onBoxMove = (payload) => {
3197
3197
  this.dispatchInternalEvent(Events.AppMove, payload);
3198
3198
  this.store.updateAppState(payload.appId, AppAttributes.Position, {
3199
- x: isNaN(payload.x) ? 0 : payload.x,
3200
- y: isNaN(payload.y) ? 0 : payload.y
3199
+ x: payload.x || 0,
3200
+ y: payload.y || 0
3201
3201
  });
3202
3202
  };
3203
3203
  this.onBoxResize = (payload) => {
@@ -3234,9 +3234,14 @@ class AppManager {
3234
3234
  this.addAppCloseListener = () => {
3235
3235
  var _a2;
3236
3236
  (_a2 = this.refresher) == null ? void 0 : _a2.add("appsClose", () => {
3237
- return onObjectRemoved(this.attributes.apps, () => {
3238
- this.onAppDelete(this.attributes.apps);
3239
- });
3237
+ return safeListenPropsUpdated(
3238
+ () => this.attributes.apps,
3239
+ (events) => {
3240
+ if (events.some((e) => e.kind === UpdateEventKind.Removed)) {
3241
+ this.onAppDelete(this.attributes.apps);
3242
+ }
3243
+ }
3244
+ );
3240
3245
  });
3241
3246
  };
3242
3247
  this.onMainViewIndexChange = (index2) => {
@@ -3651,8 +3656,8 @@ class AppManager {
3651
3656
  const box = appProxy.box;
3652
3657
  boxEmitter.emit("move", {
3653
3658
  appId: appProxy.id,
3654
- x: box == null ? void 0 : box.intrinsicX,
3655
- y: box == null ? void 0 : box.intrinsicY
3659
+ x: box.intrinsicX || 0,
3660
+ y: box.intrinsicY || 0
3656
3661
  });
3657
3662
  this.store.updateAppState(appProxy.id, AppAttributes.ZIndex, box.zIndex);
3658
3663
  }
@@ -6535,8 +6540,8 @@ class BoxManager {
6535
6540
  if (state.size) {
6536
6541
  box._intrinsicSize$.setValue(state.size, true);
6537
6542
  }
6538
- if (state.position) {
6539
- box._intrinsicCoord$.setValue(state.position, true);
6543
+ if (state.position && state.position.x !== void 0 && state.position.y !== void 0) {
6544
+ box._intrinsicCoord$.setValue({ x: state.position.x, y: state.position.y }, true);
6540
6545
  }
6541
6546
  if (state.zIndex) {
6542
6547
  box._zIndex$.setValue(state.zIndex, true);
@@ -12788,7 +12793,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
12788
12793
  const _WindowManager = class extends InvisiblePlugin {
12789
12794
  constructor(context) {
12790
12795
  super(context);
12791
- this.version = "1.0.0-canary.67";
12796
+ this.version = "1.0.0-canary.69";
12792
12797
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^1.0.0-canary.3", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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.3", "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": "^3.1.3", "vite-plugin-dts": "^1.5.0", "vitest": "^0.23.4", "white-web-sdk": "^2.16.35" } };
12793
12798
  this.emitter = callbacks;
12794
12799
  this.viewMode$ = new Val(ViewMode.Broadcaster);
package/dist/index.umd.js CHANGED
@@ -2770,7 +2770,7 @@
2770
2770
  disposeReaction();
2771
2771
  };
2772
2772
  };
2773
- const onObjectRemoved = onObjectByEvent(whiteWebSdk.UpdateEventKind.Removed);
2773
+ onObjectByEvent(whiteWebSdk.UpdateEventKind.Removed);
2774
2774
  onObjectByEvent(whiteWebSdk.UpdateEventKind.Inserted);
2775
2775
  class RedoUndo {
2776
2776
  constructor(context) {
@@ -3194,8 +3194,8 @@
3194
3194
  this.onBoxMove = (payload) => {
3195
3195
  this.dispatchInternalEvent(Events.AppMove, payload);
3196
3196
  this.store.updateAppState(payload.appId, AppAttributes.Position, {
3197
- x: isNaN(payload.x) ? 0 : payload.x,
3198
- y: isNaN(payload.y) ? 0 : payload.y
3197
+ x: payload.x || 0,
3198
+ y: payload.y || 0
3199
3199
  });
3200
3200
  };
3201
3201
  this.onBoxResize = (payload) => {
@@ -3232,9 +3232,14 @@
3232
3232
  this.addAppCloseListener = () => {
3233
3233
  var _a2;
3234
3234
  (_a2 = this.refresher) == null ? void 0 : _a2.add("appsClose", () => {
3235
- return onObjectRemoved(this.attributes.apps, () => {
3236
- this.onAppDelete(this.attributes.apps);
3237
- });
3235
+ return safeListenPropsUpdated(
3236
+ () => this.attributes.apps,
3237
+ (events) => {
3238
+ if (events.some((e) => e.kind === whiteWebSdk.UpdateEventKind.Removed)) {
3239
+ this.onAppDelete(this.attributes.apps);
3240
+ }
3241
+ }
3242
+ );
3238
3243
  });
3239
3244
  };
3240
3245
  this.onMainViewIndexChange = (index2) => {
@@ -3649,8 +3654,8 @@
3649
3654
  const box = appProxy.box;
3650
3655
  boxEmitter.emit("move", {
3651
3656
  appId: appProxy.id,
3652
- x: box == null ? void 0 : box.intrinsicX,
3653
- y: box == null ? void 0 : box.intrinsicY
3657
+ x: box.intrinsicX || 0,
3658
+ y: box.intrinsicY || 0
3654
3659
  });
3655
3660
  this.store.updateAppState(appProxy.id, AppAttributes.ZIndex, box.zIndex);
3656
3661
  }
@@ -6533,8 +6538,8 @@
6533
6538
  if (state.size) {
6534
6539
  box._intrinsicSize$.setValue(state.size, true);
6535
6540
  }
6536
- if (state.position) {
6537
- box._intrinsicCoord$.setValue(state.position, true);
6541
+ if (state.position && state.position.x !== void 0 && state.position.y !== void 0) {
6542
+ box._intrinsicCoord$.setValue({ x: state.position.x, y: state.position.y }, true);
6538
6543
  }
6539
6544
  if (state.zIndex) {
6540
6545
  box._zIndex$.setValue(state.zIndex, true);
@@ -12786,7 +12791,7 @@
12786
12791
  const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
12787
12792
  constructor(context) {
12788
12793
  super(context);
12789
- this.version = "1.0.0-canary.67";
12794
+ this.version = "1.0.0-canary.69";
12790
12795
  this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^1.0.0-canary.3", "@netless/app-plyr": "^0.2.4", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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.3", "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": "^3.1.3", "vite-plugin-dts": "^1.5.0", "vitest": "^0.23.4", "white-web-sdk": "^2.16.35" } };
12791
12796
  this.emitter = callbacks;
12792
12797
  this.viewMode$ = new valueEnhancer.Val(whiteWebSdk.ViewMode.Broadcaster);
package/package.json CHANGED
@@ -1,22 +1,11 @@
1
1
  {
2
2
  "name": "@netless/window-manager",
3
- "version": "1.0.0-canary.67",
3
+ "version": "1.0.0-canary.69",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/src/index.d.ts",
8
8
  "repository": "netless-io/window-manager",
9
- "scripts": {
10
- "prettier": "prettier --write .",
11
- "dev": "vite build --watch",
12
- "build": "vite build",
13
- "type-gen": "tsc --emitDeclarationOnly",
14
- "predev": "yarn type-gen",
15
- "build:lib:types": "tsc --emitDeclarationOnly",
16
- "lint": "eslint --ext .ts,.tsx,.svelte . && prettier --check .",
17
- "test": "vitest",
18
- "e2e": "playwright test"
19
- },
20
9
  "keywords": [],
21
10
  "author": "",
22
11
  "license": "ISC",
@@ -68,5 +57,16 @@
68
57
  "vite-plugin-dts": "^1.5.0",
69
58
  "vitest": "^0.23.4",
70
59
  "white-web-sdk": "^2.16.35"
60
+ },
61
+ "scripts": {
62
+ "prettier": "prettier --write .",
63
+ "dev": "vite build --watch",
64
+ "build": "vite build",
65
+ "type-gen": "tsc --emitDeclarationOnly",
66
+ "predev": "yarn type-gen",
67
+ "build:lib:types": "tsc --emitDeclarationOnly",
68
+ "lint": "eslint --ext .ts,.tsx,.svelte . && prettier --check .",
69
+ "test": "vitest",
70
+ "e2e": "playwright test"
71
71
  }
72
- }
72
+ }
package/src/AppManager.ts CHANGED
@@ -3,7 +3,7 @@ import { AppCreateQueue } from "./Utils/AppCreateQueue";
3
3
  import { AppListeners } from "./AppListener";
4
4
  import { AppProxy } from "./App";
5
5
  import { appRegister } from "./Register";
6
- import { autorun, isPlayer, isRoom, ScenePathType, toJS } from "white-web-sdk";
6
+ import { autorun, isPlayer, isRoom, ScenePathType, toJS, UpdateEventKind } from "white-web-sdk";
7
7
  import { boxEmitter } from "./BoxEmitter";
8
8
  import { calculateNextIndex } from "./Page";
9
9
  import { callbacks } from "./callback";
@@ -12,7 +12,7 @@ import { emitter } from "./InternalEmitter";
12
12
  import { Fields, store } from "./AttributesDelegate";
13
13
  import { log } from "./Utils/log";
14
14
  import { MainViewProxy } from "./View/MainView";
15
- import { onObjectRemoved, safeListenPropsUpdated } from "./Utils/Reactive";
15
+ import { safeListenPropsUpdated } from "./Utils/Reactive";
16
16
  import { reconnectRefresher, WindowManager } from "./index";
17
17
  import { RedoUndo } from "./RedoUndo";
18
18
  import { serializeRoomMembers } from "./Helper";
@@ -40,7 +40,8 @@ import type {
40
40
  ScenesCallbacksNode,
41
41
  SceneState,
42
42
  RoomState,
43
- Size} from "white-web-sdk";
43
+ Size,
44
+ } from "white-web-sdk";
44
45
  import type { AddAppParams, BaseInsertParams, TeleBoxRect } from "./index";
45
46
  import type {
46
47
  BoxClosePayload,
@@ -81,7 +82,6 @@ export class AppManager {
81
82
 
82
83
  public rootDirRemoving = false;
83
84
 
84
-
85
85
  constructor(public windowManger: WindowManager) {
86
86
  this.displayer = windowManger.displayer;
87
87
  this.store.setContext({
@@ -395,8 +395,8 @@ export class AppManager {
395
395
  private onBoxMove = (payload: BoxMovePayload) => {
396
396
  this.dispatchInternalEvent(Events.AppMove, payload);
397
397
  this.store.updateAppState(payload.appId, AppAttributes.Position, {
398
- x: isNaN(payload.x) ? 0 : payload.x,
399
- y: isNaN(payload.y) ? 0 : payload.y,
398
+ x: payload.x || 0,
399
+ y: payload.y || 0,
400
400
  });
401
401
  };
402
402
 
@@ -438,9 +438,14 @@ export class AppManager {
438
438
 
439
439
  public addAppCloseListener = () => {
440
440
  this.refresher?.add("appsClose", () => {
441
- return onObjectRemoved(this.attributes.apps, () => {
442
- this.onAppDelete(this.attributes.apps);
443
- });
441
+ return safeListenPropsUpdated(
442
+ () => this.attributes.apps,
443
+ events => {
444
+ if (events.some(e => e.kind === UpdateEventKind.Removed)) {
445
+ this.onAppDelete(this.attributes.apps);
446
+ }
447
+ }
448
+ );
444
449
  });
445
450
  };
446
451
 
@@ -653,8 +658,8 @@ export class AppManager {
653
658
  const box = appProxy.box;
654
659
  boxEmitter.emit("move", {
655
660
  appId: appProxy.id,
656
- x: box?.intrinsicX,
657
- y: box?.intrinsicY,
661
+ x: box.intrinsicX || 0,
662
+ y: box.intrinsicY || 0,
658
663
  });
659
664
  this.store.updateAppState(appProxy.id, AppAttributes.ZIndex, box.zIndex);
660
665
  }
package/src/BoxManager.ts CHANGED
@@ -331,8 +331,8 @@ export class BoxManager {
331
331
  if (state.size) {
332
332
  box._intrinsicSize$.setValue(state.size, true);
333
333
  }
334
- if (state.position) {
335
- box._intrinsicCoord$.setValue(state.position, true);
334
+ if (state.position && state.position.x !== undefined && state.position.y !== undefined) {
335
+ box._intrinsicCoord$.setValue({ x: state.position.x, y: state.position.y }, true);
336
336
  }
337
337
  if (state.zIndex) {
338
338
  box._zIndex$.setValue(state.zIndex, true);