@netless/window-manager 1.0.0-canary.4 → 1.0.0-canary.7
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/App/AppContext.d.ts +1 -0
- package/dist/InternalEmitter.d.ts +2 -0
- package/dist/View/CameraSynchronizer.d.ts +2 -2
- package/dist/index.cjs.js +9 -9
- package/dist/index.es.js +62 -27
- package/dist/index.umd.js +9 -9
- package/package.json +2 -2
- package/pnpm-lock.yaml +4 -4
- package/src/App/AppContext.ts +3 -0
- package/src/App/AppProxy.ts +29 -3
- package/src/App/AppViewSync.ts +6 -7
- package/src/AppManager.ts +6 -3
- package/src/InternalEmitter.ts +2 -0
- package/src/View/CameraSynchronizer.ts +2 -3
package/dist/index.es.js
CHANGED
@@ -1033,11 +1033,13 @@ class AppContext {
|
|
1033
1033
|
view = this.appProxy.createAppDir();
|
1034
1034
|
}
|
1035
1035
|
const viewWrapper = document.createElement("div");
|
1036
|
+
this._viewWrapper = viewWrapper;
|
1036
1037
|
viewWrapper.className = "window-manager-view-wrapper";
|
1037
1038
|
(_a = this.box.$content.parentElement) == null ? void 0 : _a.appendChild(viewWrapper);
|
1038
1039
|
const removeViewWrapper = () => {
|
1039
1040
|
var _a2;
|
1040
1041
|
(_a2 = this.box.$content.parentElement) == null ? void 0 : _a2.removeChild(viewWrapper);
|
1042
|
+
this._viewWrapper = void 0;
|
1041
1043
|
};
|
1042
1044
|
view.divElement = viewWrapper;
|
1043
1045
|
if (this.isAddApp) {
|
@@ -1232,7 +1234,6 @@ class CameraSynchronizer {
|
|
1232
1234
|
scale2 = this.rect.height / size2.height;
|
1233
1235
|
}
|
1234
1236
|
const nextScale = this.view.camera.scale / scale2;
|
1235
|
-
console.log("onLocalSizeUpdate", nextScale.toFixed(3), scale2.toFixed(3));
|
1236
1237
|
this.view.moveCamera({
|
1237
1238
|
scale: nextScale,
|
1238
1239
|
animationMode: AnimationMode.Immediately
|
@@ -1298,14 +1299,12 @@ class AppViewSync {
|
|
1298
1299
|
this.synchronizer.setRect(rect);
|
1299
1300
|
}
|
1300
1301
|
}));
|
1301
|
-
if (!this.appProxy.size$.value) {
|
1302
|
-
this.appProxy.storeSize({
|
1303
|
-
id: this.appProxy.uid,
|
1304
|
-
width: box.contentStageRect.width,
|
1305
|
-
height: box.contentStageRect.height
|
1306
|
-
});
|
1307
|
-
}
|
1308
1302
|
}
|
1303
|
+
this.sem.add(() => combine([this.appProxy.camera$, this.appProxy.size$]).subscribe(([camera, size2]) => {
|
1304
|
+
if (camera && size2) {
|
1305
|
+
this.synchronizer.onRemoteUpdate(camera, size2);
|
1306
|
+
}
|
1307
|
+
}));
|
1309
1308
|
}
|
1310
1309
|
destroy() {
|
1311
1310
|
this.sem.flushAll();
|
@@ -1654,12 +1653,45 @@ class AppProxy {
|
|
1654
1653
|
});
|
1655
1654
|
});
|
1656
1655
|
combine([this.box$, this.view$]).subscribe(([box, view]) => {
|
1656
|
+
var _a2, _b;
|
1657
1657
|
if (box && view) {
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1658
|
+
if (!this.camera$.value) {
|
1659
|
+
this.storeCamera({
|
1660
|
+
centerX: 0,
|
1661
|
+
centerY: 0,
|
1662
|
+
scale: 1,
|
1663
|
+
id: this.uid
|
1664
|
+
});
|
1665
|
+
this.camera$.setValue(toJS(this.appAttributes.camera));
|
1666
|
+
}
|
1667
|
+
if (!this.size$.value && box.contentStageRect) {
|
1668
|
+
this.storeSize({
|
1669
|
+
id: this.uid,
|
1670
|
+
width: (_a2 = box.contentStageRect) == null ? void 0 : _a2.width,
|
1671
|
+
height: (_b = box.contentStageRect) == null ? void 0 : _b.height
|
1672
|
+
});
|
1673
|
+
this.size$.setValue(toJS(this.appAttributes.size));
|
1674
|
+
}
|
1675
|
+
this.appViewSync = new AppViewSync(this);
|
1676
|
+
this.sideEffectManager.add(() => () => {
|
1677
|
+
var _a3;
|
1678
|
+
return (_a3 = this.appViewSync) == null ? void 0 : _a3.destroy();
|
1679
|
+
});
|
1661
1680
|
}
|
1662
1681
|
});
|
1682
|
+
this.sideEffectManager.add(() => emitter.on("memberStateChange", (memberState) => {
|
1683
|
+
var _a2, _b;
|
1684
|
+
const needPointerEventsNone = memberState.currentApplianceName === "clicker";
|
1685
|
+
if (needPointerEventsNone) {
|
1686
|
+
if ((_a2 = this.appContext) == null ? void 0 : _a2._viewWrapper) {
|
1687
|
+
this.appContext._viewWrapper.style.pointerEvents = "none";
|
1688
|
+
}
|
1689
|
+
} else {
|
1690
|
+
if ((_b = this.appContext) == null ? void 0 : _b._viewWrapper) {
|
1691
|
+
this.appContext._viewWrapper.style.pointerEvents = "auto";
|
1692
|
+
}
|
1693
|
+
}
|
1694
|
+
}));
|
1663
1695
|
}
|
1664
1696
|
createAppDir() {
|
1665
1697
|
const scenePath = this.scenePath || this.appScenePath;
|
@@ -2556,6 +2588,9 @@ class AppManager {
|
|
2556
2588
|
emitter.emit("roomMembersChange", this.members);
|
2557
2589
|
}
|
2558
2590
|
emitter.emit("observerIdChange", this.displayer.observerId);
|
2591
|
+
if (state.memberState) {
|
2592
|
+
emitter.emit("memberStateChange", toJS(state.memberState));
|
2593
|
+
}
|
2559
2594
|
};
|
2560
2595
|
this.displayerWritableListener = (isReadonly) => {
|
2561
2596
|
var _a, _b;
|
@@ -3983,10 +4018,10 @@ class Y$3 {
|
|
3983
4018
|
this._sideEffect.addDisposer(re2.reaction((e3, t3) => {
|
3984
4019
|
le2.setValue({ width: Math.max(a2, e3.width), height: Math.max(n2, e3.height) }, t3);
|
3985
4020
|
}));
|
3986
|
-
const de2 = new Val({ x: l2, y: $ }, { compare: shallowequal }), ce2 = combine([le2, O2], ([e3, t3]) => ({ width: t3.width * e3.width, height: t3.height * e3.height }), { compare: shallowequal }), me2 = combine([de2, O2], ([e3, t3]) => ({ x: e3.x * t3.width + t3.x, y: e3.y * t3.height + t3.y }), { compare: shallowequal }), ue2 = new Val(R2), ge2 = combine([ue2, F2], ([e3, t3]) => e3 != null ? e3 : t3),
|
4021
|
+
const de2 = new Val({ x: l2, y: $ }, { compare: shallowequal }), ce2 = combine([le2, O2], ([e3, t3]) => ({ width: t3.width * e3.width, height: t3.height * e3.height }), { compare: shallowequal }), me2 = combine([de2, O2], ([e3, t3]) => ({ x: e3.x * t3.width + t3.x, y: e3.y * t3.height + t3.y }), { compare: shallowequal }), ue2 = new Val(R2), ge2 = combine([ue2, F2], ([e3, t3]) => e3 != null ? e3 : t3), pe2 = new Val(null), xe2 = new Val(P2.value, { compare: shallowequal }), fe2 = new Val(_2), $e2 = new A$2({ namespace: i2, root$: pe2, rootRect$: xe2, ratio$: combine([fe2, j2], ([e3, t3]) => e3 != null ? e3 : t3), highlightStage$: ge2 });
|
3987
4022
|
this._sideEffect.addDisposer(() => $e2.destroy());
|
3988
4023
|
withReadonlyValueEnhancer(this, { darkMode: D2, fence: T2, minimized: V2, maximized: W2, readonly: Y2, rootRect: P2, managerStageRect: O2, collectorRect: Z2 });
|
3989
|
-
const be2 = { zIndex: ee2, focus: te2, $userContent: ie2, $userStage: se2, $userFooter: ae2, $userStyles: ne2, state: oe2, minSize: re2, pxMinSize: he2, intrinsicSize: le2, intrinsicCoord: de2, pxIntrinsicSize: ce2, pxIntrinsicCoord: me2, highlightStage: ge2, boxHighlightStage: ue2, contentRect:
|
4024
|
+
const be2 = { zIndex: ee2, focus: te2, $userContent: ie2, $userStage: se2, $userFooter: ae2, $userStyles: ne2, state: oe2, minSize: re2, pxMinSize: he2, intrinsicSize: le2, intrinsicCoord: de2, pxIntrinsicSize: ce2, pxIntrinsicCoord: me2, highlightStage: ge2, boxHighlightStage: ue2, contentRect: xe2, contentStageRect: $e2.stageRect$ };
|
3990
4025
|
withReadonlyValueEnhancer(this, be2, G2);
|
3991
4026
|
withValueEnhancer(this, { title: J2, visible: q2, resizable: Q2, draggable: K2, ratio: U2, stageRatio: fe2 }, G2), this.titleBar = B2 || new H$3({ readonly$: Y2, state$: oe2, title$: J2, namespace: this.namespace, onDragStart: (e3) => {
|
3992
4027
|
var t3;
|
@@ -3995,7 +4030,7 @@ class Y$3 {
|
|
3995
4030
|
e3 > 0 && this.transform(me2.value.x, me2.value.y, ce2.value.width, ce2.value.height, true);
|
3996
4031
|
})), this._sideEffect.addDisposer(T2.subscribe((e3) => {
|
3997
4032
|
e3 && this.move(me2.value.x, me2.value.y, true);
|
3998
|
-
})), this.$box = this.render(),
|
4033
|
+
})), this.$box = this.render(), pe2.setValue(this.$content.parentElement);
|
3999
4034
|
const ve2 = (e3, t3) => {
|
4000
4035
|
this._sideEffect.addDisposer(e3.reaction((e4, i3) => {
|
4001
4036
|
i3 || this.events.emit(t3, e4);
|
@@ -4129,7 +4164,7 @@ class Y$3 {
|
|
4129
4164
|
r2.className = this.wrapClassName("content") + " tele-fancy-scrollbar", this.$content = r2, this._sideEffect.add(() => {
|
4130
4165
|
const e3 = new W$3(() => {
|
4131
4166
|
const e4 = r2.getBoundingClientRect();
|
4132
|
-
this._contentRect$.setValue({ x:
|
4167
|
+
this._contentRect$.setValue({ x: 0, y: 0, width: e4.width, height: e4.height });
|
4133
4168
|
});
|
4134
4169
|
return e3.observe(r2), () => e3.disconnect();
|
4135
4170
|
}), this._sideEffect.add(() => {
|
@@ -4181,13 +4216,13 @@ class Y$3 {
|
|
4181
4216
|
let { pageX: t3, pageY: i3 } = R$3(e3);
|
4182
4217
|
i3 < this.rootRect.y && (i3 = this.rootRect.y);
|
4183
4218
|
const s3 = t3 - l2, c2 = i3 - d2;
|
4184
|
-
let { x: m3, y: u3 } = this.pxIntrinsicCoord, { width: g2, height:
|
4219
|
+
let { x: m3, y: u3 } = this.pxIntrinsicCoord, { width: g2, height: p2 } = this.pxIntrinsicSize;
|
4185
4220
|
switch (a2) {
|
4186
4221
|
case N$3.North:
|
4187
|
-
u3 = o2 + c2,
|
4222
|
+
u3 = o2 + c2, p2 = h - c2;
|
4188
4223
|
break;
|
4189
4224
|
case N$3.South:
|
4190
|
-
|
4225
|
+
p2 = h + c2;
|
4191
4226
|
break;
|
4192
4227
|
case N$3.West:
|
4193
4228
|
m3 = n2 + s3, g2 = r2 - s3;
|
@@ -4196,21 +4231,21 @@ class Y$3 {
|
|
4196
4231
|
g2 = r2 + s3;
|
4197
4232
|
break;
|
4198
4233
|
case N$3.NorthWest:
|
4199
|
-
m3 = n2 + s3, u3 = o2 + c2, g2 = r2 - s3,
|
4234
|
+
m3 = n2 + s3, u3 = o2 + c2, g2 = r2 - s3, p2 = h - c2;
|
4200
4235
|
break;
|
4201
4236
|
case N$3.NorthEast:
|
4202
|
-
u3 = o2 + c2, g2 = r2 + s3,
|
4237
|
+
u3 = o2 + c2, g2 = r2 + s3, p2 = h - c2;
|
4203
4238
|
break;
|
4204
4239
|
case N$3.SouthEast:
|
4205
|
-
g2 = r2 + s3,
|
4240
|
+
g2 = r2 + s3, p2 = h + c2;
|
4206
4241
|
break;
|
4207
4242
|
case N$3.SouthWest:
|
4208
|
-
m3 = n2 + s3, g2 = r2 - s3,
|
4243
|
+
m3 = n2 + s3, g2 = r2 - s3, p2 = h + c2;
|
4209
4244
|
break;
|
4210
4245
|
default:
|
4211
4246
|
return void this.move(n2 + s3, o2 + c2);
|
4212
4247
|
}
|
4213
|
-
this.transform(m3, u3, g2,
|
4248
|
+
this.transform(m3, u3, g2, p2);
|
4214
4249
|
}, m2 = (e3) => {
|
4215
4250
|
a2 = void 0, s2 && (k$1(e3), this.$box.classList.toggle(i2, false), this._sideEffect.flush(t2), s2.remove());
|
4216
4251
|
}, u2 = (e3) => {
|
@@ -4346,7 +4381,7 @@ class F$3 {
|
|
4346
4381
|
};
|
4347
4382
|
const t3 = new Z$3(() => {
|
4348
4383
|
const t4 = e3.getBoundingClientRect();
|
4349
|
-
I2.setValue({ x:
|
4384
|
+
I2.setValue({ x: 0, y: 0, width: t4.width, height: t4.height });
|
4350
4385
|
});
|
4351
4386
|
return t3.observe(e3), () => t3.disconnect();
|
4352
4387
|
}, "calc-root-rect");
|
@@ -15462,14 +15497,14 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
15462
15497
|
const _WindowManager = class extends InvisiblePlugin {
|
15463
15498
|
constructor(context) {
|
15464
15499
|
super(context);
|
15465
|
-
this.version = "1.0.0-canary.
|
15466
|
-
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.
|
15500
|
+
this.version = "1.0.0-canary.7";
|
15501
|
+
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.14", "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.2.1", "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" } };
|
15467
15502
|
this.emitter = callbacks$1;
|
15468
15503
|
this.viewMode = ViewMode.Broadcaster;
|
15469
15504
|
this.isReplay = isPlayer(this.displayer);
|
15470
15505
|
this.containerSizeRatio = _WindowManager.containerSizeRatio;
|
15471
15506
|
_WindowManager.displayer = context.displayer;
|
15472
|
-
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.
|
15507
|
+
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.14", "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.2.1", "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" } };
|
15473
15508
|
}
|
15474
15509
|
static async mount(params) {
|
15475
15510
|
var _a;
|