@netless/window-manager 1.0.0-canary.28 → 1.0.0-canary.30
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.cjs.js +49 -22
- package/dist/index.es.js +42 -27
- package/dist/index.umd.js +49 -22
- package/dist/src/App/AppProxy.d.ts +1 -0
- package/dist/src/AppManager.d.ts +2 -1
- package/dist/src/Helper.d.ts +1 -7
- package/dist/src/InternalEmitter.d.ts +0 -2
- package/dist/src/View/CameraSynchronizer.d.ts +1 -0
- package/dist/src/constants.d.ts +2 -1
- package/dist/src/index.d.ts +2 -0
- package/dist/style.css +1 -1
- package/package.json +2 -2
- package/pnpm-lock.yaml +4 -4
- package/src/App/AppContext.ts +2 -2
- package/src/App/AppProxy.ts +11 -6
- package/src/AppListener.ts +4 -0
- package/src/AppManager.ts +16 -11
- package/src/AttributesDelegate.ts +1 -1
- package/src/Helper.ts +2 -2
- package/src/InternalEmitter.ts +0 -2
- package/src/View/CameraSynchronizer.ts +6 -3
- package/src/View/ViewSync.ts +1 -1
- package/src/constants.ts +1 -0
- package/src/index.ts +2 -0
package/dist/index.es.js
CHANGED
@@ -20,7 +20,7 @@ var __spreadProps = (a2, b2) => __defProps(a2, __getOwnPropDescs(b2));
|
|
20
20
|
import pRetry from "p-retry";
|
21
21
|
import Emittery from "emittery";
|
22
22
|
import { debounce, isObject, has, get, size as size$1, mapValues, noop as noop$1, pick, isBoolean, isNumber, throttle, isEqual, omitBy, isUndefined, isInteger, orderBy, isEmpty, omit, isFunction, isNull } from "lodash";
|
23
|
-
import { ScenePathType, UpdateEventKind, listenUpdated, unlistenUpdated, reaction, WhiteVersion, autorun,
|
23
|
+
import { ScenePathType, UpdateEventKind, listenUpdated, unlistenUpdated, reaction, toJS, WhiteVersion, autorun, 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";
|
26
26
|
import { Val, combine, ValManager, withReadonlyValueEnhancer, withValueEnhancer, derive } from "value-enhancer";
|
@@ -42,6 +42,7 @@ var Events = /* @__PURE__ */ ((Events2) => {
|
|
42
42
|
Events2["RootDirRemoved"] = "RootDirRemoved";
|
43
43
|
Events2["Refresh"] = "Refresh";
|
44
44
|
Events2["InitMainViewCamera"] = "InitMainViewCamera";
|
45
|
+
Events2["InvokeAttributesUpdateCallback"] = "InvokeAttributesUpdateCallback";
|
45
46
|
return Events2;
|
46
47
|
})(Events || {});
|
47
48
|
const MagixEventName = "__WindowManger";
|
@@ -494,6 +495,10 @@ class AppListeners {
|
|
494
495
|
this.setAppFocusViewIndexHandler(data.payload);
|
495
496
|
break;
|
496
497
|
}
|
498
|
+
case Events.InvokeAttributesUpdateCallback: {
|
499
|
+
this.manager.attributesUpdateCallback(this.manager.attributes.apps);
|
500
|
+
break;
|
501
|
+
}
|
497
502
|
}
|
498
503
|
}
|
499
504
|
};
|
@@ -997,7 +1002,7 @@ const serializeRoomMembers = (members) => {
|
|
997
1002
|
var _a;
|
998
1003
|
return __spreadValues({
|
999
1004
|
uid: ((_a = member.payload) == null ? void 0 : _a.uid) || ""
|
1000
|
-
}, member);
|
1005
|
+
}, toJS(member));
|
1001
1006
|
});
|
1002
1007
|
};
|
1003
1008
|
const createInvisiblePlugin = async (room) => {
|
@@ -1163,7 +1168,7 @@ class AppContext {
|
|
1163
1168
|
return this.manager.room;
|
1164
1169
|
}
|
1165
1170
|
get members() {
|
1166
|
-
return this.manager.members;
|
1171
|
+
return this.manager.members$.value;
|
1167
1172
|
}
|
1168
1173
|
get currentMember() {
|
1169
1174
|
const self2 = findMemberByUid(this.room, this.manager.uid);
|
@@ -1244,7 +1249,6 @@ class CameraSynchronizer {
|
|
1244
1249
|
}
|
1245
1250
|
};
|
1246
1251
|
this.onRemoteUpdate = throttle((camera, size2) => {
|
1247
|
-
var _a;
|
1248
1252
|
this.remoteCamera = camera;
|
1249
1253
|
this.remoteSize = size2;
|
1250
1254
|
if (this.remoteSize && this.rect) {
|
@@ -1261,7 +1265,7 @@ class CameraSynchronizer {
|
|
1261
1265
|
if (camera.centerY !== null) {
|
1262
1266
|
config.centerY = camera.centerY;
|
1263
1267
|
}
|
1264
|
-
|
1268
|
+
this.moveCamera(config);
|
1265
1269
|
}
|
1266
1270
|
}, 10);
|
1267
1271
|
}
|
@@ -1269,15 +1273,13 @@ class CameraSynchronizer {
|
|
1269
1273
|
this.view = view;
|
1270
1274
|
}
|
1271
1275
|
onRemoteSizeUpdate(size2) {
|
1272
|
-
var _a;
|
1273
1276
|
this.remoteSize = size2;
|
1274
1277
|
const needMoveCamera = !isEqual(pick(this.rect, ["width", "height"]), pick(size2, ["width", "height"]));
|
1275
1278
|
if (this.rect && this.remoteCamera && needMoveCamera) {
|
1276
1279
|
const scale2 = this.rect.width / size2.width;
|
1277
1280
|
const nextScale = this.remoteCamera.scale * scale2;
|
1278
|
-
|
1279
|
-
scale: nextScale
|
1280
|
-
animationMode: AnimationMode.Continuous
|
1281
|
+
this.moveCamera({
|
1282
|
+
scale: nextScale
|
1281
1283
|
});
|
1282
1284
|
}
|
1283
1285
|
}
|
@@ -1285,6 +1287,10 @@ class CameraSynchronizer {
|
|
1285
1287
|
this.saveCamera(camera);
|
1286
1288
|
this.remoteCamera = camera;
|
1287
1289
|
}
|
1290
|
+
moveCamera(camera) {
|
1291
|
+
var _a;
|
1292
|
+
(_a = this.view) == null ? void 0 : _a.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: AnimationMode.Continuous }));
|
1293
|
+
}
|
1288
1294
|
}
|
1289
1295
|
class ViewSync {
|
1290
1296
|
constructor(context) {
|
@@ -1440,7 +1446,7 @@ class AttributesDelegate {
|
|
1440
1446
|
attrNames.push("scenes");
|
1441
1447
|
}
|
1442
1448
|
const options = pick(params.options, attrNames);
|
1443
|
-
const attrs = { kind: params.kind, options, isDynamicPPT };
|
1449
|
+
const attrs = { kind: params.kind, options, isDynamicPPT, setup: false };
|
1444
1450
|
if (typeof params.src === "string") {
|
1445
1451
|
attrs.src = params.src;
|
1446
1452
|
}
|
@@ -1718,6 +1724,10 @@ class AppProxy {
|
|
1718
1724
|
this.onFocus = () => {
|
1719
1725
|
this.setScenePath();
|
1720
1726
|
};
|
1727
|
+
this.setupDone = () => {
|
1728
|
+
this.store.updateAppAttributes(this.id, "setup", true);
|
1729
|
+
this.manager.dispatchInternalEvent(Events.InvokeAttributesUpdateCallback);
|
1730
|
+
};
|
1721
1731
|
this.kind = params.kind;
|
1722
1732
|
this.id = appId;
|
1723
1733
|
this.appScenePath = `/${this.id}-app-dir`;
|
@@ -1740,9 +1750,6 @@ class AppProxy {
|
|
1740
1750
|
notifyPageStateChange: this.notifyPageStateChange
|
1741
1751
|
});
|
1742
1752
|
this.sideEffectManager.add(() => () => this._pageState.destroy());
|
1743
|
-
this.sideEffectManager.add(() => emitter.on("roomMembersChange", (members) => {
|
1744
|
-
this.appEmitter.emit("roomMembersChange", members);
|
1745
|
-
}));
|
1746
1753
|
this.camera$.setValue(toJS(this.appAttributes.camera));
|
1747
1754
|
this.size$.setValue(toJS(this.appAttributes.size));
|
1748
1755
|
this.addCameraReaction();
|
@@ -1802,6 +1809,9 @@ class AppProxy {
|
|
1802
1809
|
}
|
1803
1810
|
});
|
1804
1811
|
}
|
1812
|
+
}),
|
1813
|
+
this.manager.members$.reaction((members) => {
|
1814
|
+
this.appEmitter.emit("roomMembersChange", members);
|
1805
1815
|
})
|
1806
1816
|
]);
|
1807
1817
|
}
|
@@ -1909,6 +1919,7 @@ class AppProxy {
|
|
1909
1919
|
this.appResult = result;
|
1910
1920
|
appRegister.notifyApp(this.kind, "created", { appId, result });
|
1911
1921
|
this.fixMobileSize();
|
1922
|
+
this.setupDone();
|
1912
1923
|
}, SETUP_APP_DELAY);
|
1913
1924
|
});
|
1914
1925
|
const box = (_a = this.boxManager) == null ? void 0 : _a.createBox({
|
@@ -2484,6 +2495,7 @@ class AppManager {
|
|
2484
2495
|
this.appCreateQueue = new AppCreateQueue();
|
2485
2496
|
this.sceneIndex$ = new Val(void 0);
|
2486
2497
|
this.focused$ = new Val(void 0);
|
2498
|
+
this.members$ = new Val([]);
|
2487
2499
|
this.sideEffectManager = new SideEffectManager();
|
2488
2500
|
this.sceneState = null;
|
2489
2501
|
this.rootDirRemoving = false;
|
@@ -2731,7 +2743,7 @@ class AppManager {
|
|
2731
2743
|
appProxy.appEmitter.emit("roomStateChange", state);
|
2732
2744
|
});
|
2733
2745
|
if (state.roomMembers) {
|
2734
|
-
|
2746
|
+
this.members$.setValue(serializeRoomMembers(state.roomMembers));
|
2735
2747
|
}
|
2736
2748
|
emitter.emit("observerIdChange", this.displayer.observerId);
|
2737
2749
|
if (state.memberState) {
|
@@ -2809,6 +2821,7 @@ class AppManager {
|
|
2809
2821
|
appRegister.setSyncRegisterApp((payload) => {
|
2810
2822
|
this.safeUpdateAttributes([Fields.Registered, payload.kind], payload);
|
2811
2823
|
});
|
2824
|
+
this.members$.setValue(serializeRoomMembers(this.displayer.state.roomMembers));
|
2812
2825
|
}
|
2813
2826
|
async onRootDirRemoved(needClose = true) {
|
2814
2827
|
await this.setMainViewScenePath(INIT_DIR);
|
@@ -2846,9 +2859,6 @@ class AppManager {
|
|
2846
2859
|
var _a;
|
2847
2860
|
return ((_a = this.room) == null ? void 0 : _a.uid) || "";
|
2848
2861
|
}
|
2849
|
-
get members() {
|
2850
|
-
return serializeRoomMembers(this.displayer.state.roomMembers);
|
2851
|
-
}
|
2852
2862
|
getMainViewSceneDir() {
|
2853
2863
|
const scenePath = this.store.getMainViewScenePath();
|
2854
2864
|
if (scenePath) {
|
@@ -2924,13 +2934,17 @@ class AppManager {
|
|
2924
2934
|
this.appCreateQueue.emitReady();
|
2925
2935
|
}
|
2926
2936
|
const appsWithCreatedAt = appIds.map((appId) => {
|
2927
|
-
|
2928
|
-
|
2929
|
-
|
2930
|
-
|
2937
|
+
if (apps[appId].setup) {
|
2938
|
+
return {
|
2939
|
+
id: appId,
|
2940
|
+
createdAt: apps[appId].createdAt
|
2941
|
+
};
|
2942
|
+
} else {
|
2943
|
+
return {};
|
2944
|
+
}
|
2931
2945
|
});
|
2932
2946
|
for (const { id: id2 } of orderBy(appsWithCreatedAt, "createdAt", "asc")) {
|
2933
|
-
if (!this.appProxies.has(id2) && !this.appStatus.has(id2)) {
|
2947
|
+
if (id2 && !this.appProxies.has(id2) && !this.appStatus.has(id2)) {
|
2934
2948
|
const app = apps[id2];
|
2935
2949
|
try {
|
2936
2950
|
const appAttributes = this.attributes[id2];
|
@@ -2973,11 +2987,11 @@ class AppManager {
|
|
2973
2987
|
mainView.disableCameraTransform = disableCameraTransform;
|
2974
2988
|
wait(30).then(() => {
|
2975
2989
|
mainView.divElement = divElement;
|
2990
|
+
emitter.emit("mainViewMounted");
|
2976
2991
|
});
|
2977
2992
|
if (!mainView.focusScenePath) {
|
2978
2993
|
this.setMainViewFocusPath();
|
2979
2994
|
}
|
2980
|
-
emitter.emit("mainViewMounted");
|
2981
2995
|
}
|
2982
2996
|
setMainViewFocusPath(scenePath) {
|
2983
2997
|
var _a;
|
@@ -3162,6 +3176,7 @@ class AppManager {
|
|
3162
3176
|
this.sideEffectManager.flushAll();
|
3163
3177
|
this.sceneIndex$.destroy();
|
3164
3178
|
this.focused$.destroy();
|
3179
|
+
this.members$.destroy();
|
3165
3180
|
}
|
3166
3181
|
}
|
3167
3182
|
/*! *****************************************************************************
|
@@ -4006,7 +4021,7 @@ var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
|
|
4006
4021
|
}
|
4007
4022
|
return true;
|
4008
4023
|
};
|
4009
|
-
var shadowStyles = /* @__PURE__ */ (() => '.telebox-quarantine {\n all: initial;\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n
|
4024
|
+
var shadowStyles = /* @__PURE__ */ (() => '.tele-fancy-scrollbar {\n overscroll-behavior: contain;\n overflow: auto;\n overflow-y: scroll;\n overflow-y: overlay;\n -webkit-overflow-scrolling: touch;\n -ms-overflow-style: -ms-autohiding-scrollbar;\n scrollbar-width: auto;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar {\n height: 8px;\n width: 8px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-track {\n background-color: transparent;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n background-color: transparent;\n border-radius: 4px;\n transition: background-color 0.4s;\n}\n.tele-fancy-scrollbar:hover::-webkit-scrollbar-thumb {\n background-color: rgba(68, 78, 96, 0.1);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:hover {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:active {\n background-color: rgba(68, 78, 96, 0.2);\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:vertical {\n min-height: 50px;\n}\n.tele-fancy-scrollbar::-webkit-scrollbar-thumb:horizontal {\n min-width: 50px;\n}\n.telebox-quarantine {\n all: initial;\n position: relative;\n width: 100%;\n height: 100%;\n display: flex;\n flex-direction: column;\n}\n.telebox-body-wrap {\n color: #191919;\n color: var(--tele-box-color, #191919);\n flex: 1;\n width: 100%;\n overflow: hidden;\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n}\n.telebox-content {\n width: 100%;\n height: 100%;\n position: relative;\n background-color: #f9f9f9;\n background-color: var(--tele-manager-container-background, #f9f9f9);\n}\n.telebox-box-stage {\n position: absolute;\n z-index: 1;\n overflow: hidden;\n background-color: #fff;\n background-color: var(--tele-manager-stage-background, #fff);\n box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.08);\n box-shadow: var(--tele-manager-stage-shadow, 0px 0px 16px rgba(0, 0, 0, 0.08));\n}\n.telebox-footer-wrap {\n flex-shrink: 0;\n display: flex;\n flex-direction: column;\n color: #191919;\n color: var(--tele-box-footer-color, #191919);\n background-color: #fff;\n background-color: var(--tele-box-footer-background, #fff);\n}\n.telebox-footer-wrap::before {\n content: "";\n display: block;\n flex: 1;\n}\n.telebox-color-scheme-dark {\n color-scheme: dark;\n}\n.telebox-color-scheme-dark .telebox-body-wrap {\n color: #e9e9e9;\n color: var(--tele-box-color-dark, #e9e9e9);\n}\n.telebox-color-scheme-dark .telebox-content {\n background-color: #25282e;\n background-color: var(--tele-manager-container-background-dark, #25282e);\n}\n.telebox-color-scheme-dark .telebox-box-stage {\n background-color: #272a30;\n background-color: var(--tele-manager-stage-background-dark, #272a30);\n box-shadow: 0px 0px 16px rgba(0, 0, 0, 0.24);\n box-shadow: var(--tele-manager-stage-shadow-dark, 0px 0px 16px rgba(0, 0, 0, 0.24));\n}\n.telebox-color-scheme-dark .telebox-footer-wrap {\n color: #e9e9e9;\n color: var(--tele-box-footer-color-dark, #e9e9e9);\n background-color: #383b42;\n background-color: var(--tele-box-footer-background-dark, #383b42);\n}')();
|
4010
4025
|
var TELE_BOX_COLOR_SCHEME = /* @__PURE__ */ ((TELE_BOX_COLOR_SCHEME2) => {
|
4011
4026
|
TELE_BOX_COLOR_SCHEME2["Light"] = "light";
|
4012
4027
|
TELE_BOX_COLOR_SCHEME2["Dark"] = "dark";
|
@@ -16532,15 +16547,15 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
16532
16547
|
const _WindowManager = class extends InvisiblePlugin {
|
16533
16548
|
constructor(context) {
|
16534
16549
|
super(context);
|
16535
|
-
this.version = "1.0.0-canary.
|
16536
|
-
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.
|
16550
|
+
this.version = "1.0.0-canary.30";
|
16551
|
+
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.27", "emittery": "^0.11.0", "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", "@playwright/test": "^1.23.0", "@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/node": "^18.0.0", "@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", "vite-plugin-dts": "^1.2.0", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
|
16537
16552
|
this.emitter = callbacks$1;
|
16538
16553
|
this.viewMode = ViewMode.Broadcaster;
|
16539
16554
|
this.viewMode$ = new Val(ViewMode.Broadcaster);
|
16540
16555
|
this.isReplay = isPlayer(this.displayer);
|
16541
16556
|
this.containerSizeRatio = _WindowManager.containerSizeRatio;
|
16542
16557
|
_WindowManager.displayer = context.displayer;
|
16543
|
-
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.
|
16558
|
+
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.27", "emittery": "^0.11.0", "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", "@playwright/test": "^1.23.0", "@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/node": "^18.0.0", "@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", "vite-plugin-dts": "^1.2.0", "vitest": "^0.14.1", "white-web-sdk": "2.16.10" } };
|
16544
16559
|
}
|
16545
16560
|
static async mount(params) {
|
16546
16561
|
var _a;
|