@netless/window-manager 0.4.30 → 0.4.31
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/CHANGELOG.md +4 -0
- package/dist/AppManager.d.ts +5 -1
- package/dist/BoxEmitter.d.ts +34 -0
- package/dist/BoxManager.d.ts +3 -1
- package/dist/InternalEmitter.d.ts +0 -18
- package/dist/Utils/AppCreateQueue.d.ts +2 -3
- package/dist/index.cjs.js +12 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +51 -54
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +12 -12
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -2
- package/pnpm-lock.yaml +66 -36
- package/src/App/AppProxy.ts +2 -1
- package/src/AppManager.ts +67 -59
- package/src/BoxEmitter.ts +19 -0
- package/src/BoxManager.ts +10 -6
- package/src/InternalEmitter.ts +0 -4
- package/src/Utils/AppCreateQueue.ts +2 -3
- package/src/index.ts +3 -2
- package/dist/ScenePath/index.d.ts +0 -12
- package/src/ScenePath/index.ts +0 -47
package/dist/index.es.js
CHANGED
@@ -1271,6 +1271,7 @@ const calculateNextIndex = (index, pageState) => {
|
|
1271
1271
|
}
|
1272
1272
|
return nextIndex;
|
1273
1273
|
};
|
1274
|
+
const boxEmitter = new Emittery();
|
1274
1275
|
class AppProxy {
|
1275
1276
|
constructor(params, manager, appId, isAddApp) {
|
1276
1277
|
var _a;
|
@@ -1581,7 +1582,7 @@ class AppProxy {
|
|
1581
1582
|
}
|
1582
1583
|
case "focus": {
|
1583
1584
|
(_d = this.boxManager) == null ? void 0 : _d.focusBox({ appId: this.id });
|
1584
|
-
|
1585
|
+
boxEmitter.emit("focus", { appId: this.id });
|
1585
1586
|
break;
|
1586
1587
|
}
|
1587
1588
|
}
|
@@ -2142,6 +2143,34 @@ class AppManager {
|
|
2142
2143
|
};
|
2143
2144
|
callbacks$1.emit("sceneStateChange", this.sceneState);
|
2144
2145
|
};
|
2146
|
+
this.onBoxMove = (payload) => {
|
2147
|
+
this.dispatchInternalEvent(Events.AppMove, payload);
|
2148
|
+
this.store.updateAppState(payload.appId, AppAttributes.Position, {
|
2149
|
+
x: payload.x,
|
2150
|
+
y: payload.y
|
2151
|
+
});
|
2152
|
+
};
|
2153
|
+
this.onBoxResize = (payload) => {
|
2154
|
+
if (payload.width && payload.height) {
|
2155
|
+
this.dispatchInternalEvent(Events.AppResize, payload);
|
2156
|
+
this.store.updateAppState(payload.appId, AppAttributes.Size, {
|
2157
|
+
width: payload.width,
|
2158
|
+
height: payload.height
|
2159
|
+
});
|
2160
|
+
}
|
2161
|
+
};
|
2162
|
+
this.onBoxFocus = (payload) => {
|
2163
|
+
this.windowManger.safeSetAttributes({ focus: payload.appId });
|
2164
|
+
};
|
2165
|
+
this.onBoxClose = (payload) => {
|
2166
|
+
const appProxy = this.appProxies.get(payload.appId);
|
2167
|
+
if (appProxy) {
|
2168
|
+
appProxy.destroy(false, true, true, payload.error);
|
2169
|
+
}
|
2170
|
+
};
|
2171
|
+
this.onBoxStateChange = (payload) => {
|
2172
|
+
this.dispatchInternalEvent(Events.AppBoxStateChange, payload);
|
2173
|
+
};
|
2145
2174
|
this.addAppsChangeListener = () => {
|
2146
2175
|
var _a;
|
2147
2176
|
(_a = this.refresher) == null ? void 0 : _a.add("apps", () => {
|
@@ -2274,43 +2303,6 @@ class AppManager {
|
|
2274
2303
|
}
|
2275
2304
|
}
|
2276
2305
|
};
|
2277
|
-
this.boxEventListener = (eventName, payload) => {
|
2278
|
-
switch (eventName) {
|
2279
|
-
case "move": {
|
2280
|
-
this.dispatchInternalEvent(Events.AppMove, payload);
|
2281
|
-
this.store.updateAppState(payload.appId, AppAttributes.Position, {
|
2282
|
-
x: payload.x,
|
2283
|
-
y: payload.y
|
2284
|
-
});
|
2285
|
-
break;
|
2286
|
-
}
|
2287
|
-
case "focus": {
|
2288
|
-
this.windowManger.safeSetAttributes({ focus: payload.appId });
|
2289
|
-
break;
|
2290
|
-
}
|
2291
|
-
case "resize": {
|
2292
|
-
if (payload.width && payload.height) {
|
2293
|
-
this.dispatchInternalEvent(Events.AppResize, payload);
|
2294
|
-
this.store.updateAppState(payload.appId, AppAttributes.Size, {
|
2295
|
-
width: payload.width,
|
2296
|
-
height: payload.height
|
2297
|
-
});
|
2298
|
-
}
|
2299
|
-
break;
|
2300
|
-
}
|
2301
|
-
case "close": {
|
2302
|
-
const appProxy = this.appProxies.get(payload.appId);
|
2303
|
-
if (appProxy) {
|
2304
|
-
appProxy.destroy(false, true, payload.error);
|
2305
|
-
}
|
2306
|
-
break;
|
2307
|
-
}
|
2308
|
-
case "boxStateChange": {
|
2309
|
-
this.dispatchInternalEvent(Events.AppBoxStateChange, payload);
|
2310
|
-
break;
|
2311
|
-
}
|
2312
|
-
}
|
2313
|
-
};
|
2314
2306
|
this.updateRootDirRemoving = (removing) => {
|
2315
2307
|
this.rootDirRemoving = removing;
|
2316
2308
|
};
|
@@ -2400,7 +2392,11 @@ class AppManager {
|
|
2400
2392
|
var _a, _b, _c, _d, _e2, _f;
|
2401
2393
|
await this.attributesUpdateCallback(this.attributes.apps);
|
2402
2394
|
emitter.emit("updateManagerRect");
|
2403
|
-
|
2395
|
+
boxEmitter.on("move", this.onBoxMove);
|
2396
|
+
boxEmitter.on("resize", this.onBoxResize);
|
2397
|
+
boxEmitter.on("focus", this.onBoxFocus);
|
2398
|
+
boxEmitter.on("close", this.onBoxClose);
|
2399
|
+
boxEmitter.on("boxStateChange", this.onBoxStateChange);
|
2404
2400
|
this.addAppsChangeListener();
|
2405
2401
|
this.addAppCloseListener();
|
2406
2402
|
(_a = this.refresher) == null ? void 0 : _a.add("maximized", () => {
|
@@ -2549,7 +2545,7 @@ class AppManager {
|
|
2549
2545
|
var _a, _b;
|
2550
2546
|
if (appProxy && appProxy.box) {
|
2551
2547
|
const box = appProxy.box;
|
2552
|
-
|
2548
|
+
boxEmitter.emit("move", {
|
2553
2549
|
appId: appProxy.id,
|
2554
2550
|
x: box == null ? void 0 : box.intrinsicX,
|
2555
2551
|
y: box == null ? void 0 : box.intrinsicY
|
@@ -2682,7 +2678,7 @@ class AppManager {
|
|
2682
2678
|
this.displayer.callbacks.off(this.eventName, this.displayerStateListener);
|
2683
2679
|
this.displayer.callbacks.off("onEnableWriteNowChanged", this.displayerWritableListener);
|
2684
2680
|
this.appListeners.removeListeners();
|
2685
|
-
|
2681
|
+
boxEmitter.clearListeners();
|
2686
2682
|
emitter.clearListeners();
|
2687
2683
|
if (this.appProxies.size) {
|
2688
2684
|
this.appProxies.forEach((appProxy) => {
|
@@ -4535,7 +4531,7 @@ class Bt {
|
|
4535
4531
|
return typeof e2 == "string" ? this.boxes.find((t2) => t2.id === e2) : e2;
|
4536
4532
|
}
|
4537
4533
|
}
|
4538
|
-
const createBoxManager = (manager, callbacks2, emitter2, options) => {
|
4534
|
+
const createBoxManager = (manager, callbacks2, emitter2, boxEmitter2, options) => {
|
4539
4535
|
return new BoxManager({
|
4540
4536
|
safeSetAttributes: (attributes) => manager.safeSetAttributes(attributes),
|
4541
4537
|
getMainView: () => manager.mainView,
|
@@ -4557,14 +4553,15 @@ const createBoxManager = (manager, callbacks2, emitter2, options) => {
|
|
4557
4553
|
return (_a = manager.appManager) == null ? void 0 : _a.store.setAppFocus(appId, true);
|
4558
4554
|
},
|
4559
4555
|
callbacks: callbacks2,
|
4560
|
-
emitter: emitter2
|
4556
|
+
emitter: emitter2,
|
4557
|
+
boxEmitter: boxEmitter2
|
4561
4558
|
}, options);
|
4562
4559
|
};
|
4563
4560
|
class BoxManager {
|
4564
4561
|
constructor(context, createTeleBoxManagerConfig) {
|
4565
4562
|
this.context = context;
|
4566
4563
|
this.createTeleBoxManagerConfig = createTeleBoxManagerConfig;
|
4567
|
-
const { emitter: emitter2, callbacks: callbacks2 } = context;
|
4564
|
+
const { emitter: emitter2, callbacks: callbacks2, boxEmitter: boxEmitter2 } = context;
|
4568
4565
|
this.teleBoxManager = this.setupBoxManager(createTeleBoxManagerConfig);
|
4569
4566
|
this.teleBoxManager._state$.reaction((state) => {
|
4570
4567
|
callbacks2.emit("boxStateChange", state);
|
@@ -4594,14 +4591,14 @@ class BoxManager {
|
|
4594
4591
|
});
|
4595
4592
|
this.teleBoxManager.events.on("removed", (boxes) => {
|
4596
4593
|
boxes.forEach((box) => {
|
4597
|
-
|
4594
|
+
boxEmitter2.emit("close", { appId: box.id });
|
4598
4595
|
});
|
4599
4596
|
});
|
4600
4597
|
this.teleBoxManager.events.on("intrinsic_move", debounce((box) => {
|
4601
|
-
|
4598
|
+
boxEmitter2.emit("move", { appId: box.id, x: box.intrinsicX, y: box.intrinsicY });
|
4602
4599
|
}, 50));
|
4603
4600
|
this.teleBoxManager.events.on("intrinsic_resize", debounce((box) => {
|
4604
|
-
|
4601
|
+
boxEmitter2.emit("resize", {
|
4605
4602
|
appId: box.id,
|
4606
4603
|
width: box.intrinsicWidth,
|
4607
4604
|
height: box.intrinsicHeight
|
@@ -4610,7 +4607,7 @@ class BoxManager {
|
|
4610
4607
|
this.teleBoxManager.events.on("focused", (box) => {
|
4611
4608
|
if (box) {
|
4612
4609
|
if (this.canOperate) {
|
4613
|
-
|
4610
|
+
boxEmitter2.emit("focus", { appId: box.id });
|
4614
4611
|
} else {
|
4615
4612
|
this.teleBoxManager.blurBox(box.id);
|
4616
4613
|
}
|
@@ -4675,7 +4672,7 @@ class BoxManager {
|
|
4675
4672
|
const box = this.teleBoxManager.queryOne({ id: appId });
|
4676
4673
|
if (box) {
|
4677
4674
|
if (box.state === Ke$1.Maximized) {
|
4678
|
-
this.context.
|
4675
|
+
this.context.boxEmitter.emit("resize", {
|
4679
4676
|
appId,
|
4680
4677
|
x: box.x,
|
4681
4678
|
y: box.y,
|
@@ -15077,14 +15074,14 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
15077
15074
|
const _WindowManager = class extends InvisiblePlugin {
|
15078
15075
|
constructor(context) {
|
15079
15076
|
super(context);
|
15080
|
-
this.version = "0.4.
|
15081
|
-
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.26", "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": { "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", "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.
|
15077
|
+
this.version = "0.4.31";
|
15078
|
+
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.26", "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": { "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" } };
|
15082
15079
|
this.emitter = callbacks$1;
|
15083
15080
|
this.viewMode = ViewMode.Broadcaster;
|
15084
15081
|
this.isReplay = isPlayer(this.displayer);
|
15085
15082
|
this.containerSizeRatio = _WindowManager.containerSizeRatio;
|
15086
15083
|
_WindowManager.displayer = context.displayer;
|
15087
|
-
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.26", "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": { "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", "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.
|
15084
|
+
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.26", "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": { "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" } };
|
15088
15085
|
}
|
15089
15086
|
static async mount(params) {
|
15090
15087
|
const room = params.room;
|
@@ -15194,7 +15191,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15194
15191
|
}
|
15195
15192
|
bindContainer(container) {
|
15196
15193
|
var _a, _b, _c, _d, _e2, _f;
|
15197
|
-
if (this.room.phase !== RoomPhase.Connected) {
|
15194
|
+
if (isRoom(this.displayer) && this.room.phase !== RoomPhase.Connected) {
|
15198
15195
|
throw new BindContainerRoomPhaseInvalidError();
|
15199
15196
|
}
|
15200
15197
|
if (_WindowManager.isCreated && _WindowManager.container) {
|
@@ -15208,7 +15205,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15208
15205
|
if (this.boxManager) {
|
15209
15206
|
this.boxManager.destroy();
|
15210
15207
|
}
|
15211
|
-
const boxManager = createBoxManager(this, callbacks$1, emitter, {
|
15208
|
+
const boxManager = createBoxManager(this, callbacks$1, emitter, boxEmitter, {
|
15212
15209
|
collectorContainer: params.collectorContainer,
|
15213
15210
|
collectorStyles: params.collectorStyles,
|
15214
15211
|
prefersColorScheme: params.prefersColorScheme
|