@netless/window-manager 1.0.0-canary.20 → 1.0.0-canary.23
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 +5 -1
- package/dist/App/AppProxy.d.ts +5 -2
- package/dist/App/index.d.ts +1 -0
- package/dist/App/type.d.ts +21 -0
- package/dist/BoxManager.d.ts +4 -3
- package/dist/Cursor/index.d.ts +0 -1
- package/dist/InternalEmitter.d.ts +1 -2
- package/dist/Utils/Reactive.d.ts +0 -2
- package/dist/View/CameraSynchronizer.d.ts +1 -1
- package/dist/constants.d.ts +0 -1
- package/dist/index.cjs.js +12 -12
- package/dist/index.es.js +164 -205
- package/dist/index.umd.js +12 -12
- package/docs/app-context.md +89 -3
- package/package.json +1 -1
- package/src/App/AppContext.ts +14 -3
- package/src/App/AppProxy.ts +88 -132
- package/src/App/index.ts +1 -0
- package/src/App/type.ts +22 -0
- package/src/AppManager.ts +5 -1
- package/src/BoxManager.ts +8 -7
- package/src/Cursor/index.ts +0 -2
- package/src/InternalEmitter.ts +1 -2
- package/src/ReconnectRefresher.ts +5 -1
- package/src/Utils/Reactive.ts +0 -16
- package/src/View/CameraSynchronizer.ts +17 -26
- package/src/View/ViewSync.ts +6 -12
- package/src/constants.ts +0 -1
package/dist/index.es.js
CHANGED
@@ -19,7 +19,7 @@ var __spreadValues = (a2, b2) => {
|
|
19
19
|
var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
|
20
20
|
import pRetry from "p-retry";
|
21
21
|
import Emittery from "emittery";
|
22
|
-
import { debounce, isEqual, omit, isObject, has, get, size as size$1, mapValues, noop as noop$1, pick, isNumber, throttle,
|
22
|
+
import { debounce, isEqual, omit, isObject, has, get, size as size$1, mapValues, noop as noop$1, pick, isBoolean, isNumber, throttle, omitBy, isUndefined, isInteger, orderBy, isEmpty, isFunction, isNull } from "lodash";
|
23
23
|
import { ScenePathType, UpdateEventKind, listenUpdated, unlistenUpdated, reaction, WhiteVersion, autorun, toJS, listenDisposed, unlistenDisposed, AnimationMode, ViewMode, isPlayer, isRoom, ApplianceNames, RoomPhase, InvisiblePlugin } from "white-web-sdk";
|
24
24
|
import { v4 } from "uuid";
|
25
25
|
import { genUID, SideEffectManager } from "side-effect-manager";
|
@@ -33,7 +33,6 @@ var Events = /* @__PURE__ */ ((Events2) => {
|
|
33
33
|
Events2["AppBoxStateChange"] = "AppBoxStateChange";
|
34
34
|
Events2["GetAttributes"] = "GetAttributes";
|
35
35
|
Events2["UpdateWindowManagerWrapper"] = "UpdateWindowManagerWrapper";
|
36
|
-
Events2["InitReplay"] = "InitReplay";
|
37
36
|
Events2["WindowCreated"] = "WindowCreated";
|
38
37
|
Events2["SetMainViewScenePath"] = "SetMainViewScenePath";
|
39
38
|
Events2["SetMainViewSceneIndex"] = "SetMainViewSceneIndex";
|
@@ -661,16 +660,6 @@ const safeListenPropsUpdated = (getProps, callback, onDestroyed) => {
|
|
661
660
|
};
|
662
661
|
const onObjectRemoved = onObjectByEvent(UpdateEventKind.Removed);
|
663
662
|
onObjectByEvent(UpdateEventKind.Inserted);
|
664
|
-
const createValSync = (expr, Val2, isAddApp) => {
|
665
|
-
let skipUpdate = false;
|
666
|
-
return reaction(expr, (val) => {
|
667
|
-
if (isAddApp && !skipUpdate) {
|
668
|
-
skipUpdate = true;
|
669
|
-
} else {
|
670
|
-
Val2.setValue(val);
|
671
|
-
}
|
672
|
-
}, { fireImmediately: true });
|
673
|
-
};
|
674
663
|
const plainObjectKeys = Object.keys;
|
675
664
|
function isRef(e2) {
|
676
665
|
return Boolean(has(e2, "__isRef"));
|
@@ -1043,7 +1032,7 @@ class AppContext {
|
|
1043
1032
|
return appAttr == null ? void 0 : appAttr.options["scenes"];
|
1044
1033
|
}
|
1045
1034
|
};
|
1046
|
-
this.createWhiteBoardView = (
|
1035
|
+
this.createWhiteBoardView = (params) => {
|
1047
1036
|
var _a;
|
1048
1037
|
if (this.whiteBoardView) {
|
1049
1038
|
return this.whiteBoardView;
|
@@ -1052,6 +1041,11 @@ class AppContext {
|
|
1052
1041
|
if (!view) {
|
1053
1042
|
view = this.appProxy.createAppDir();
|
1054
1043
|
}
|
1044
|
+
if (params) {
|
1045
|
+
if (isBoolean(params.syncCamera)) {
|
1046
|
+
this.appProxy.syncCamera$.setValue(params.syncCamera);
|
1047
|
+
}
|
1048
|
+
}
|
1055
1049
|
const viewWrapper = document.createElement("div");
|
1056
1050
|
this._viewWrapper = viewWrapper;
|
1057
1051
|
viewWrapper.className = "window-manager-view-wrapper";
|
@@ -1059,7 +1053,7 @@ class AppContext {
|
|
1059
1053
|
view.divElement = viewWrapper;
|
1060
1054
|
this.appProxy.fireMemberStateChange();
|
1061
1055
|
if (this.isAddApp) {
|
1062
|
-
this.ensurePageSize(
|
1056
|
+
this.ensurePageSize(params == null ? void 0 : params.size);
|
1063
1057
|
}
|
1064
1058
|
this.whiteBoardView = new WhiteBoardView(view, this, this.appProxy, this.ensurePageSize);
|
1065
1059
|
this.appProxy.sideEffectManager.add(() => {
|
@@ -1067,6 +1061,7 @@ class AppContext {
|
|
1067
1061
|
this.whiteBoardView = void 0;
|
1068
1062
|
};
|
1069
1063
|
});
|
1064
|
+
this.appProxy.whiteBoardViewCreated$.setValue(true);
|
1070
1065
|
return this.whiteBoardView;
|
1071
1066
|
};
|
1072
1067
|
this.ensurePageSize = (size2) => {
|
@@ -1224,13 +1219,14 @@ class AppPageStateImpl {
|
|
1224
1219
|
class CameraSynchronizer {
|
1225
1220
|
constructor(saveCamera) {
|
1226
1221
|
this.saveCamera = saveCamera;
|
1227
|
-
this.setRect =
|
1222
|
+
this.setRect = (rect) => {
|
1228
1223
|
this.rect = rect;
|
1229
1224
|
if (this.remoteCamera && this.remoteSize) {
|
1230
1225
|
this.onRemoteUpdate(this.remoteCamera, this.remoteSize);
|
1231
1226
|
}
|
1232
|
-
}
|
1227
|
+
};
|
1233
1228
|
this.onRemoteUpdate = throttle((camera, size2) => {
|
1229
|
+
var _a;
|
1234
1230
|
this.remoteCamera = camera;
|
1235
1231
|
this.remoteSize = size2;
|
1236
1232
|
if (this.remoteSize && this.rect) {
|
@@ -1241,22 +1237,17 @@ class CameraSynchronizer {
|
|
1241
1237
|
scale2 = this.rect.height / size2.height;
|
1242
1238
|
}
|
1243
1239
|
const nextScale = camera.scale * scale2;
|
1244
|
-
const
|
1245
|
-
|
1246
|
-
|
1247
|
-
scale: nextScale,
|
1248
|
-
animationMode: AnimationMode.Immediately
|
1249
|
-
};
|
1250
|
-
if (camera.centerX !== null) {
|
1251
|
-
config.centerX = camera.centerX;
|
1252
|
-
}
|
1253
|
-
if (camera.centerY !== null) {
|
1254
|
-
config.centerY = camera.centerY;
|
1255
|
-
}
|
1256
|
-
(_a = this.view) == null ? void 0 : _a.moveCamera(config);
|
1240
|
+
const config = {
|
1241
|
+
scale: nextScale,
|
1242
|
+
animationMode: AnimationMode.Immediately
|
1257
1243
|
};
|
1258
|
-
|
1259
|
-
|
1244
|
+
if (camera.centerX !== null) {
|
1245
|
+
config.centerX = camera.centerX;
|
1246
|
+
}
|
1247
|
+
if (camera.centerY !== null) {
|
1248
|
+
config.centerY = camera.centerY;
|
1249
|
+
}
|
1250
|
+
(_a = this.view) == null ? void 0 : _a.moveCamera(config);
|
1260
1251
|
}
|
1261
1252
|
}, 10);
|
1262
1253
|
}
|
@@ -1264,20 +1255,16 @@ class CameraSynchronizer {
|
|
1264
1255
|
this.view = view;
|
1265
1256
|
}
|
1266
1257
|
onRemoteSizeUpdate(size2) {
|
1258
|
+
var _a;
|
1267
1259
|
this.remoteSize = size2;
|
1268
1260
|
const needMoveCamera = !isEqual(pick(this.rect, ["width", "height"]), pick(size2, ["width", "height"]));
|
1269
1261
|
if (this.rect && this.remoteCamera && needMoveCamera) {
|
1270
1262
|
const scale2 = this.rect.width / size2.width;
|
1271
1263
|
const nextScale = this.remoteCamera.scale * scale2;
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
animationMode: AnimationMode.Immediately
|
1277
|
-
});
|
1278
|
-
};
|
1279
|
-
moveCamera();
|
1280
|
-
delay(moveCamera, 50);
|
1264
|
+
(_a = this.view) == null ? void 0 : _a.moveCamera({
|
1265
|
+
scale: nextScale,
|
1266
|
+
animationMode: AnimationMode.Immediately
|
1267
|
+
});
|
1281
1268
|
}
|
1282
1269
|
}
|
1283
1270
|
onLocalCameraUpdate(camera) {
|
@@ -1302,7 +1289,7 @@ class ViewSync {
|
|
1302
1289
|
this.onCameraUpdatedByDevice = (camera) => {
|
1303
1290
|
if (!camera)
|
1304
1291
|
return;
|
1305
|
-
this.synchronizer.onLocalCameraUpdate(
|
1292
|
+
this.synchronizer.onLocalCameraUpdate(__spreadProps(__spreadValues({}, camera), { id: this.context.uid }));
|
1306
1293
|
const stage = this.context.stageRect$.value;
|
1307
1294
|
if (stage) {
|
1308
1295
|
const size2 = { width: stage.width, height: stage.height, id: this.context.uid };
|
@@ -1321,33 +1308,35 @@ class ViewSync {
|
|
1321
1308
|
}
|
1322
1309
|
});
|
1323
1310
|
this.bindView(this.context.view$.value);
|
1324
|
-
this.sem.add(() =>
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1338
|
-
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1311
|
+
this.sem.add(() => [
|
1312
|
+
this.context.view$.subscribe((view) => {
|
1313
|
+
const currentCamera = this.context.camera$.value;
|
1314
|
+
if (currentCamera && this.context.size$.value) {
|
1315
|
+
view == null ? void 0 : view.moveCamera({
|
1316
|
+
scale: 1,
|
1317
|
+
animationMode: AnimationMode.Immediately
|
1318
|
+
});
|
1319
|
+
this.synchronizer.onRemoteUpdate(currentCamera, this.context.size$.value);
|
1320
|
+
}
|
1321
|
+
this.bindView(view);
|
1322
|
+
}),
|
1323
|
+
this.context.camera$.subscribe((camera, skipUpdate) => {
|
1324
|
+
const size2 = this.context.size$.value;
|
1325
|
+
if (camera && size2 && !skipUpdate) {
|
1326
|
+
this.synchronizer.onRemoteUpdate(camera, size2);
|
1327
|
+
}
|
1328
|
+
}),
|
1329
|
+
this.context.size$.subscribe((size2) => {
|
1330
|
+
if (size2) {
|
1331
|
+
this.synchronizer.onRemoteSizeUpdate(size2);
|
1332
|
+
}
|
1333
|
+
}),
|
1334
|
+
this.context.stageRect$.reaction((rect) => {
|
1335
|
+
if (rect) {
|
1336
|
+
this.synchronizer.setRect(rect);
|
1337
|
+
}
|
1338
|
+
})
|
1339
|
+
]);
|
1351
1340
|
const camera$size$ = combine([this.context.camera$, this.context.size$]);
|
1352
1341
|
camera$size$.reaction(([camera, size2]) => {
|
1353
1342
|
if (camera && size2) {
|
@@ -1571,6 +1560,8 @@ class AppProxy {
|
|
1571
1560
|
this.size$ = this.valManager.attach(new Val(void 0));
|
1572
1561
|
this.box$ = this.valManager.attach(new Val(void 0));
|
1573
1562
|
this.view$ = this.valManager.attach(new Val(void 0));
|
1563
|
+
this.syncCamera$ = this.valManager.attach(new Val(true));
|
1564
|
+
this.whiteBoardViewCreated$ = this.valManager.attach(new Val(false));
|
1574
1565
|
this.fireMemberStateChange = () => {
|
1575
1566
|
if (this.manager.room) {
|
1576
1567
|
this.onMemberStateChange(this.manager.room.state.memberState);
|
@@ -1613,57 +1604,47 @@ class AppProxy {
|
|
1613
1604
|
const attrs = this.store.getAppState(id2);
|
1614
1605
|
if (!attrs)
|
1615
1606
|
return;
|
1616
|
-
const position = attrs == null ? void 0 : attrs[AppAttributes.Position];
|
1617
1607
|
const focus = this.store.focus;
|
1618
|
-
const size2 = attrs == null ? void 0 : attrs[AppAttributes.Size];
|
1619
|
-
const sceneIndex = attrs == null ? void 0 : attrs[AppAttributes.SceneIndex];
|
1620
1608
|
const maximized = (_a2 = this.attributes) == null ? void 0 : _a2["maximized"];
|
1621
1609
|
const minimized = (_b = this.attributes) == null ? void 0 : _b["minimized"];
|
1622
|
-
|
1623
|
-
|
1624
|
-
if (position) {
|
1625
|
-
payload = __spreadProps(__spreadValues({}, payload), { id: id2, x: position.x, y: position.y });
|
1626
|
-
}
|
1610
|
+
let payload = { maximized, minimized, id: id2 };
|
1611
|
+
const state = omitBy(attrs, isUndefined);
|
1627
1612
|
if (focus === id2) {
|
1628
1613
|
payload = __spreadProps(__spreadValues({}, payload), { focus: true });
|
1629
1614
|
}
|
1630
|
-
|
1631
|
-
payload = __spreadProps(__spreadValues({}, payload), { width: size2.width, height: size2.height });
|
1632
|
-
}
|
1633
|
-
if (sceneIndex) {
|
1634
|
-
payload = __spreadProps(__spreadValues({}, payload), { sceneIndex });
|
1635
|
-
}
|
1636
|
-
return payload;
|
1615
|
+
return Object.assign(payload, state);
|
1637
1616
|
};
|
1638
1617
|
this.appAttributesUpdateListener = (appId2) => {
|
1639
|
-
this.
|
1640
|
-
|
1641
|
-
|
1642
|
-
|
1643
|
-
|
1644
|
-
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1649
|
-
|
1650
|
-
|
1651
|
-
|
1652
|
-
(
|
1653
|
-
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1657
|
-
|
1658
|
-
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
this.
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1618
|
+
this.sideEffectManager.add(() => [
|
1619
|
+
this.manager.refresher.add(appId2, () => {
|
1620
|
+
return autorun(() => {
|
1621
|
+
const attrs = this.manager.attributes[appId2];
|
1622
|
+
if (attrs) {
|
1623
|
+
this.appEmitter.emit("attributesUpdate", attrs);
|
1624
|
+
}
|
1625
|
+
});
|
1626
|
+
}),
|
1627
|
+
this.manager.refresher.add(this.stateKey, () => {
|
1628
|
+
return autorun(() => {
|
1629
|
+
var _a2, _b, _c;
|
1630
|
+
const appState = (_a2 = this.appAttributes) == null ? void 0 : _a2.state;
|
1631
|
+
if ((appState == null ? void 0 : appState.zIndex) > 0 && appState.zIndex !== ((_b = this.box) == null ? void 0 : _b.zIndex)) {
|
1632
|
+
(_c = this.boxManager) == null ? void 0 : _c.setZIndex(appId2, appState.zIndex);
|
1633
|
+
}
|
1634
|
+
});
|
1635
|
+
}),
|
1636
|
+
this.manager.refresher.add(`${appId2}-fullPath`, () => {
|
1637
|
+
return autorun(() => {
|
1638
|
+
var _a2;
|
1639
|
+
const fullPath = (_a2 = this.appAttributes) == null ? void 0 : _a2.fullPath;
|
1640
|
+
this.setFocusScenePathHandler(fullPath);
|
1641
|
+
if (this.fullPath$.value !== fullPath) {
|
1642
|
+
this.notifyPageStateChange();
|
1643
|
+
this.fullPath$.setValue(fullPath);
|
1644
|
+
}
|
1645
|
+
});
|
1646
|
+
})
|
1647
|
+
]);
|
1667
1648
|
};
|
1668
1649
|
this.setFocusScenePathHandler = debounce((fullPath) => {
|
1669
1650
|
var _a2;
|
@@ -1757,86 +1738,63 @@ class AppProxy {
|
|
1757
1738
|
this.size$.setValue(toJS(this.appAttributes.size));
|
1758
1739
|
this.addCameraReaction();
|
1759
1740
|
this.addSizeReaction();
|
1760
|
-
this.sideEffectManager.add(() =>
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
1766
|
-
|
1767
|
-
|
1768
|
-
|
1769
|
-
|
1770
|
-
}
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1741
|
+
this.sideEffectManager.add(() => emitter.on("memberStateChange", this.onMemberStateChange));
|
1742
|
+
this.sideEffectManager.add(() => [
|
1743
|
+
this.syncCamera$.reaction((syncCamera) => {
|
1744
|
+
if (!syncCamera) {
|
1745
|
+
if (this.viewSync) {
|
1746
|
+
this.viewSync.destroy();
|
1747
|
+
this.viewSync = void 0;
|
1748
|
+
this.sideEffectManager.flush("camera");
|
1749
|
+
this.sideEffectManager.flush("size");
|
1750
|
+
}
|
1751
|
+
}
|
1752
|
+
}),
|
1753
|
+
this.whiteBoardViewCreated$.reaction((created) => {
|
1754
|
+
if (created && this.box) {
|
1755
|
+
if (!this.syncCamera$.value)
|
1756
|
+
return;
|
1757
|
+
combine([this.box$, this.view$]).subscribe(([box, view]) => {
|
1758
|
+
if (box && view) {
|
1759
|
+
if (!this.camera$.value) {
|
1760
|
+
this.storeCamera({
|
1761
|
+
centerX: null,
|
1762
|
+
centerY: null,
|
1763
|
+
scale: 1,
|
1764
|
+
id: this.uid
|
1765
|
+
});
|
1766
|
+
this.camera$.setValue(toJS(this.appAttributes.camera));
|
1767
|
+
}
|
1768
|
+
if (!this.size$.value && box.contentStageRect) {
|
1769
|
+
const initialRect = this.computedInitialRect(box.contentStageRect);
|
1770
|
+
const width = (initialRect == null ? void 0 : initialRect.width) || box.contentStageRect.width;
|
1771
|
+
const height = (initialRect == null ? void 0 : initialRect.height) || box.contentStageRect.height;
|
1772
|
+
this.storeSize({
|
1773
|
+
id: this.uid,
|
1774
|
+
width,
|
1775
|
+
height
|
1776
|
+
});
|
1777
|
+
this.size$.setValue(toJS(this.appAttributes.size));
|
1778
|
+
}
|
1779
|
+
this.viewSync = new ViewSync({
|
1780
|
+
uid: this.uid,
|
1781
|
+
view$: this.view$,
|
1782
|
+
camera$: this.camera$,
|
1783
|
+
size$: this.size$,
|
1784
|
+
stageRect$: box._contentStageRect$,
|
1785
|
+
storeCamera: this.storeCamera,
|
1786
|
+
storeSize: this.storeSize
|
1787
|
+
});
|
1788
|
+
this.sideEffectManager.add(() => () => {
|
1789
|
+
var _a2;
|
1790
|
+
return (_a2 = this.viewSync) == null ? void 0 : _a2.destroy();
|
1791
|
+
});
|
1792
|
+
this.whiteBoardViewCreated$.destroy();
|
1793
|
+
}
|
1779
1794
|
});
|
1780
|
-
this.size$.setValue(toJS(this.appAttributes.size));
|
1781
1795
|
}
|
1782
|
-
|
1783
|
-
|
1784
|
-
view$: this.view$,
|
1785
|
-
camera$: this.camera$,
|
1786
|
-
size$: this.size$,
|
1787
|
-
stageRect$: box._contentStageRect$,
|
1788
|
-
storeCamera: this.storeCamera,
|
1789
|
-
storeSize: this.storeSize
|
1790
|
-
});
|
1791
|
-
this.sideEffectManager.add(() => () => {
|
1792
|
-
var _a2;
|
1793
|
-
return (_a2 = this.viewSync) == null ? void 0 : _a2.destroy();
|
1794
|
-
});
|
1795
|
-
}
|
1796
|
-
}));
|
1797
|
-
this.sideEffectManager.add(() => emitter.on("memberStateChange", this.onMemberStateChange));
|
1798
|
-
this.box$.subscribe((box) => {
|
1799
|
-
if (!box)
|
1800
|
-
return;
|
1801
|
-
this.sideEffectManager.add(() => [
|
1802
|
-
createValSync(() => {
|
1803
|
-
var _a2;
|
1804
|
-
return (_a2 = this.appAttributes) == null ? void 0 : _a2.state.visible;
|
1805
|
-
}, box._visible$, this.isAddApp),
|
1806
|
-
createValSync(() => {
|
1807
|
-
var _a2;
|
1808
|
-
return (_a2 = this.appAttributes) == null ? void 0 : _a2.state.ratio;
|
1809
|
-
}, box._ratio$, this.isAddApp),
|
1810
|
-
createValSync(() => {
|
1811
|
-
var _a2;
|
1812
|
-
return (_a2 = this.appAttributes) == null ? void 0 : _a2.state.stageRatio;
|
1813
|
-
}, box._stageRatio$, this.isAddApp),
|
1814
|
-
createValSync(() => {
|
1815
|
-
var _a2;
|
1816
|
-
return (_a2 = this.appAttributes) == null ? void 0 : _a2.state.draggable;
|
1817
|
-
}, box._draggable$, this.isAddApp),
|
1818
|
-
createValSync(() => {
|
1819
|
-
var _a2;
|
1820
|
-
return (_a2 = this.appAttributes) == null ? void 0 : _a2.state.resizable;
|
1821
|
-
}, box._resizable$, this.isAddApp),
|
1822
|
-
box._visible$.subscribe((visible) => {
|
1823
|
-
this.store.updateAppState(this.id, AppAttributes.Visible, visible);
|
1824
|
-
}),
|
1825
|
-
box._ratio$.subscribe((ratio) => {
|
1826
|
-
this.store.updateAppState(this.id, AppAttributes.Ratio, ratio);
|
1827
|
-
}),
|
1828
|
-
box._stageRatio$.subscribe((stageRatio) => {
|
1829
|
-
this.store.updateAppState(this.id, AppAttributes.StageRatio, stageRatio);
|
1830
|
-
}),
|
1831
|
-
box._draggable$.subscribe((draggable) => {
|
1832
|
-
this.store.updateAppState(this.id, AppAttributes.Draggable, draggable);
|
1833
|
-
}),
|
1834
|
-
box._resizable$.subscribe((resizable) => {
|
1835
|
-
console.log("resizable change", resizable);
|
1836
|
-
this.store.updateAppState(this.id, AppAttributes.Resizable, resizable);
|
1837
|
-
})
|
1838
|
-
]);
|
1839
|
-
});
|
1796
|
+
})
|
1797
|
+
]);
|
1840
1798
|
}
|
1841
1799
|
createAppDir() {
|
1842
1800
|
const scenePath = this.scenePath || this.appScenePath;
|
@@ -2148,11 +2106,6 @@ class AppProxy {
|
|
2148
2106
|
this.appProxies.delete(this.id);
|
2149
2107
|
this.viewManager.destroyView(this.id);
|
2150
2108
|
this.manager.appStatus.delete(this.id);
|
2151
|
-
this.manager.refresher.remove(this.id);
|
2152
|
-
this.manager.refresher.remove(this.stateKey);
|
2153
|
-
this.manager.refresher.remove(`${this.id}-fullPath`);
|
2154
|
-
this.manager.refresher.remove(`${this.id}-camera`);
|
2155
|
-
this.manager.refresher.remove(`${this.id}-size`);
|
2156
2109
|
this.valManager.destroy();
|
2157
2110
|
}
|
2158
2111
|
close() {
|
@@ -2997,7 +2950,9 @@ class AppManager {
|
|
2997
2950
|
bindMainView(divElement, disableCameraTransform) {
|
2998
2951
|
const mainView = this.mainViewProxy.view;
|
2999
2952
|
mainView.disableCameraTransform = disableCameraTransform;
|
3000
|
-
|
2953
|
+
wait(30).then(() => {
|
2954
|
+
mainView.divElement = divElement;
|
2955
|
+
});
|
3001
2956
|
if (!mainView.focusScenePath) {
|
3002
2957
|
this.setMainViewFocusPath();
|
3003
2958
|
}
|
@@ -4970,15 +4925,16 @@ class BoxManager {
|
|
4970
4925
|
return this.teleBoxManager.topBox;
|
4971
4926
|
}
|
4972
4927
|
updateBoxState(state) {
|
4928
|
+
var _a, _b, _c, _d;
|
4973
4929
|
if (!state)
|
4974
4930
|
return;
|
4975
4931
|
const box = this.getBox(state.id);
|
4976
4932
|
if (box) {
|
4977
4933
|
this.teleBoxManager.update(box.id, {
|
4978
|
-
x: state.x,
|
4979
|
-
y: state.y,
|
4980
|
-
width: state.width || 0.5,
|
4981
|
-
height: state.height || 0.5,
|
4934
|
+
x: (_a = state.position) == null ? void 0 : _a.x,
|
4935
|
+
y: (_b = state.position) == null ? void 0 : _b.y,
|
4936
|
+
width: ((_c = state.size) == null ? void 0 : _c.width) || 0.5,
|
4937
|
+
height: ((_d = state.size) == null ? void 0 : _d.height) || 0.5,
|
4982
4938
|
zIndex: state.zIndex
|
4983
4939
|
}, true);
|
4984
4940
|
setTimeout(() => {
|
@@ -5936,9 +5892,8 @@ class CursorManager {
|
|
5936
5892
|
}
|
5937
5893
|
}
|
5938
5894
|
updateContainerRect() {
|
5939
|
-
var _a
|
5940
|
-
this.
|
5941
|
-
this.wrapperRect = (_b = WindowManager.playground) == null ? void 0 : _b.getBoundingClientRect();
|
5895
|
+
var _a;
|
5896
|
+
this.wrapperRect = (_a = WindowManager.playground) == null ? void 0 : _a.getBoundingClientRect();
|
5942
5897
|
}
|
5943
5898
|
deleteCursor(uid) {
|
5944
5899
|
this.store.cleanCursor(uid);
|
@@ -5992,12 +5947,16 @@ class ReconnectRefresher {
|
|
5992
5947
|
this.reactors = /* @__PURE__ */ new Map();
|
5993
5948
|
this.disposers = /* @__PURE__ */ new Map();
|
5994
5949
|
this.onPhaseChanged = (phase) => {
|
5995
|
-
var _a;
|
5950
|
+
var _a, _b;
|
5996
5951
|
if (phase === RoomPhase.Reconnecting) {
|
5997
5952
|
this.ctx.emitter.emit("startReconnect");
|
5998
5953
|
}
|
5999
5954
|
if (phase === RoomPhase.Connected && this.phase === RoomPhase.Reconnecting) {
|
6000
|
-
(_a = this.room) == null ? void 0 : _a.
|
5955
|
+
if ((_a = this.room) == null ? void 0 : _a.isWritable) {
|
5956
|
+
(_b = this.room) == null ? void 0 : _b.dispatchMagixEvent(EnsureReconnectEvent, {});
|
5957
|
+
} else {
|
5958
|
+
this.onReconnected();
|
5959
|
+
}
|
6001
5960
|
}
|
6002
5961
|
this.phase = phase;
|
6003
5962
|
};
|
@@ -15680,7 +15639,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
15680
15639
|
const _WindowManager = class extends InvisiblePlugin {
|
15681
15640
|
constructor(context) {
|
15682
15641
|
super(context);
|
15683
|
-
this.version = "1.0.0-canary.
|
15642
|
+
this.version = "1.0.0-canary.23";
|
15684
15643
|
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" } };
|
15685
15644
|
this.emitter = callbacks$1;
|
15686
15645
|
this.viewMode = ViewMode.Broadcaster;
|