@netless/window-manager 1.0.0-canary.3 → 1.0.0-canary.32
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/__mocks__/white-web-sdk.ts +10 -1
- package/dist/index.cjs.js +120 -12
- package/dist/index.es.js +2284 -954
- package/dist/index.umd.js +120 -12
- package/dist/{App → src/App}/AppContext.d.ts +12 -8
- package/dist/{App → src/App}/AppPageStateImpl.d.ts +0 -0
- package/dist/{App → src/App}/AppProxy.d.ts +36 -7
- package/dist/{App → src/App}/MagixEvent/index.d.ts +0 -0
- package/dist/{App → src/App}/Storage/StorageEvent.d.ts +0 -0
- package/dist/{App → src/App}/Storage/index.d.ts +0 -0
- package/dist/{App → src/App}/Storage/typings.d.ts +0 -0
- package/dist/{App → src/App}/Storage/utils.d.ts +0 -0
- package/dist/src/App/WhiteboardView.d.ts +27 -0
- package/dist/{App → src/App}/index.d.ts +2 -1
- package/dist/src/App/type.d.ts +21 -0
- package/dist/{AppListener.d.ts → src/AppListener.d.ts} +0 -2
- package/dist/{AppManager.d.ts → src/AppManager.d.ts} +7 -6
- package/dist/{AttributesDelegate.d.ts → src/AttributesDelegate.d.ts} +11 -16
- package/dist/{BoxEmitter.d.ts → src/BoxEmitter.d.ts} +0 -0
- package/dist/{BoxManager.d.ts → src/BoxManager.d.ts} +10 -7
- package/dist/{BuiltinApps.d.ts → src/BuiltinApps.d.ts} +3 -0
- package/dist/{Cursor → src/Cursor}/Cursor.d.ts +0 -0
- package/dist/{Cursor → src/Cursor}/icons.d.ts +0 -0
- package/dist/{Cursor → src/Cursor}/index.d.ts +3 -3
- package/dist/{Helper.d.ts → src/Helper.d.ts} +4 -8
- package/dist/{InternalEmitter.d.ts → src/InternalEmitter.d.ts} +3 -4
- package/dist/{Page → src/Page}/PageController.d.ts +1 -0
- package/dist/{Page → src/Page}/index.d.ts +0 -0
- package/dist/{PageState.d.ts → src/PageState.d.ts} +0 -0
- package/dist/{ReconnectRefresher.d.ts → src/ReconnectRefresher.d.ts} +1 -1
- package/dist/{RedoUndo.d.ts → src/RedoUndo.d.ts} +0 -0
- package/dist/{Register → src/Register}/index.d.ts +0 -0
- package/dist/{Register → src/Register}/loader.d.ts +0 -0
- package/dist/{Register → src/Register}/storage.d.ts +0 -0
- package/dist/{Utils → src/Utils}/AppCreateQueue.d.ts +0 -0
- package/dist/{Utils → src/Utils}/Common.d.ts +1 -0
- package/dist/{Utils → src/Utils}/Reactive.d.ts +0 -0
- package/dist/{Utils → src/Utils}/RoomHacker.d.ts +0 -0
- package/dist/{Utils → src/Utils}/error.d.ts +0 -0
- package/dist/{Utils → src/Utils}/log.d.ts +0 -0
- package/dist/src/View/CameraSynchronizer.d.ts +18 -0
- package/dist/{View → src/View}/MainView.d.ts +18 -7
- package/dist/{View → src/View}/ViewManager.d.ts +0 -0
- package/dist/src/View/ViewSync.d.ts +24 -0
- package/dist/{callback.d.ts → src/callback.d.ts} +5 -0
- package/dist/{constants.d.ts → src/constants.d.ts} +8 -5
- package/dist/src/image.d.ts +19 -0
- package/dist/{index.d.ts → src/index.d.ts} +40 -14
- package/dist/src/shim.d.ts +11 -0
- package/dist/{typings.d.ts → src/typings.d.ts} +8 -2
- package/dist/style.css +1 -1
- package/docs/app-context.md +157 -25
- package/docs/mirgrate-to-1.0.md +28 -0
- package/package.json +12 -7
- package/playwright.config.ts +29 -0
- package/pnpm-lock.yaml +517 -35
- package/src/App/AppContext.ts +50 -28
- package/src/App/AppProxy.ts +266 -80
- package/src/App/{WhiteBoardView.ts → WhiteboardView.ts} +38 -7
- package/src/App/index.ts +2 -1
- package/src/App/type.ts +22 -0
- package/src/AppListener.ts +5 -21
- package/src/AppManager.ts +56 -43
- package/src/AttributesDelegate.ts +19 -19
- package/src/BoxManager.ts +60 -40
- package/src/BuiltinApps.ts +5 -0
- package/src/Cursor/Cursor.ts +7 -3
- package/src/Cursor/index.ts +7 -8
- package/src/Helper.ts +25 -7
- package/src/InternalEmitter.ts +3 -4
- package/src/Page/PageController.ts +1 -0
- package/src/PageState.ts +1 -1
- package/src/ReconnectRefresher.ts +7 -2
- package/src/Utils/Common.ts +9 -0
- package/src/Utils/Reactive.ts +27 -26
- package/src/Utils/RoomHacker.ts +3 -0
- package/src/View/CameraSynchronizer.ts +37 -34
- package/src/View/MainView.ts +108 -81
- package/src/View/ViewSync.ts +110 -0
- package/src/callback.ts +1 -0
- package/src/constants.ts +6 -3
- package/src/index.ts +141 -57
- package/src/style.css +3 -46
- package/src/typings.ts +8 -2
- package/vite.config.js +5 -3
- package/dist/App/WhiteBoardView.d.ts +0 -18
- package/dist/View/CameraSynchronizer.d.ts +0 -17
package/dist/index.es.js
CHANGED
@@ -19,12 +19,12 @@ 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,
|
23
|
-
import { ScenePathType, UpdateEventKind, listenUpdated, unlistenUpdated, reaction, WhiteVersion, autorun,
|
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, 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
|
-
import { Val,
|
27
|
-
import { ResizeObserver as ResizeObserver$
|
26
|
+
import { Val, combine, ValManager, withReadonlyValueEnhancer, withValueEnhancer, derive } from "value-enhancer";
|
27
|
+
import { ResizeObserver as ResizeObserver$3 } from "@juggle/resize-observer";
|
28
28
|
import p$1 from "video.js";
|
29
29
|
var Events = /* @__PURE__ */ ((Events2) => {
|
30
30
|
Events2["AppMove"] = "AppMove";
|
@@ -33,18 +33,16 @@ 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";
|
40
39
|
Events2["SetAppFocusIndex"] = "SetAppFocusIndex";
|
41
40
|
Events2["SwitchViewsToFreedom"] = "SwitchViewsToFreedom";
|
42
|
-
Events2["MoveCamera"] = "MoveCamera";
|
43
|
-
Events2["MoveCameraToContain"] = "MoveCameraToContain";
|
44
41
|
Events2["CursorMove"] = "CursorMove";
|
45
42
|
Events2["RootDirRemoved"] = "RootDirRemoved";
|
46
43
|
Events2["Refresh"] = "Refresh";
|
47
44
|
Events2["InitMainViewCamera"] = "InitMainViewCamera";
|
45
|
+
Events2["InvokeAttributesUpdateCallback"] = "InvokeAttributesUpdateCallback";
|
48
46
|
return Events2;
|
49
47
|
})(Events || {});
|
50
48
|
const MagixEventName = "__WindowManger";
|
@@ -54,6 +52,11 @@ var AppAttributes = /* @__PURE__ */ ((AppAttributes2) => {
|
|
54
52
|
AppAttributes2["Position"] = "position";
|
55
53
|
AppAttributes2["SceneIndex"] = "SceneIndex";
|
56
54
|
AppAttributes2["ZIndex"] = "zIndex";
|
55
|
+
AppAttributes2["Visible"] = "visible";
|
56
|
+
AppAttributes2["Ratio"] = "ratio";
|
57
|
+
AppAttributes2["StageRatio"] = "stageRatio";
|
58
|
+
AppAttributes2["Draggable"] = "draggable";
|
59
|
+
AppAttributes2["Resizable"] = "resizable";
|
57
60
|
return AppAttributes2;
|
58
61
|
})(AppAttributes || {});
|
59
62
|
var AppEvents = /* @__PURE__ */ ((AppEvents2) => {
|
@@ -350,11 +353,19 @@ const genAppId = async (kind2) => {
|
|
350
353
|
return `${kind2}-${v4().replace("-", "").slice(0, 8)}`;
|
351
354
|
};
|
352
355
|
const setViewFocusScenePath = (view, focusScenePath) => {
|
356
|
+
if (view.didRelease) {
|
357
|
+
return;
|
358
|
+
}
|
353
359
|
if (view.focusScenePath !== focusScenePath) {
|
354
360
|
view.focusScenePath = focusScenePath;
|
355
361
|
return view;
|
356
362
|
}
|
357
363
|
};
|
364
|
+
const releaseView = (view) => {
|
365
|
+
if (!view.didRelease) {
|
366
|
+
view.release();
|
367
|
+
}
|
368
|
+
};
|
358
369
|
const setScenePath = (room, scenePath) => {
|
359
370
|
if (room && room.isWritable) {
|
360
371
|
if (room.state.sceneState.scenePath !== scenePath) {
|
@@ -464,14 +475,6 @@ class AppListeners {
|
|
464
475
|
this.setMainViewScenePathHandler(data.payload);
|
465
476
|
break;
|
466
477
|
}
|
467
|
-
case Events.MoveCamera: {
|
468
|
-
this.moveCameraHandler(data.payload);
|
469
|
-
break;
|
470
|
-
}
|
471
|
-
case Events.MoveCameraToContain: {
|
472
|
-
this.moveCameraToContainHandler(data.payload);
|
473
|
-
break;
|
474
|
-
}
|
475
478
|
case Events.CursorMove: {
|
476
479
|
this.cursorMoveHandler(data.payload);
|
477
480
|
break;
|
@@ -492,6 +495,10 @@ class AppListeners {
|
|
492
495
|
this.setAppFocusViewIndexHandler(data.payload);
|
493
496
|
break;
|
494
497
|
}
|
498
|
+
case Events.InvokeAttributesUpdateCallback: {
|
499
|
+
this.manager.attributesUpdateCallback(this.manager.attributes.apps);
|
500
|
+
break;
|
501
|
+
}
|
495
502
|
}
|
496
503
|
}
|
497
504
|
};
|
@@ -511,14 +518,6 @@ class AppListeners {
|
|
511
518
|
setViewFocusScenePath(this.manager.mainView, nextScenePath);
|
512
519
|
callbacks$1.emit("mainViewScenePathChange", nextScenePath);
|
513
520
|
};
|
514
|
-
this.moveCameraHandler = (payload) => {
|
515
|
-
if (isEqual(omit(payload, ["animationMode"]), __spreadValues({}, this.manager.mainView.camera)))
|
516
|
-
return;
|
517
|
-
this.manager.mainView.moveCamera(payload);
|
518
|
-
};
|
519
|
-
this.moveCameraToContainHandler = (payload) => {
|
520
|
-
this.manager.mainView.moveCameraToContain(payload);
|
521
|
-
};
|
522
521
|
this.cursorMoveHandler = (payload) => {
|
523
522
|
emitter.emit("cursorMove", payload);
|
524
523
|
};
|
@@ -893,10 +892,11 @@ class Storage {
|
|
893
892
|
}
|
894
893
|
}
|
895
894
|
class WhiteBoardView {
|
896
|
-
constructor(appContext, appProxy,
|
895
|
+
constructor(view, appContext, appProxy, ensureSize) {
|
896
|
+
this.view = view;
|
897
897
|
this.appContext = appContext;
|
898
898
|
this.appProxy = appProxy;
|
899
|
-
this.
|
899
|
+
this.ensureSize = ensureSize;
|
900
900
|
this.nextPage = async () => {
|
901
901
|
const nextIndex = this.pageState.index + 1;
|
902
902
|
return this.jumpPage(nextIndex);
|
@@ -939,24 +939,48 @@ class WhiteBoardView {
|
|
939
939
|
return this.appProxy.removeSceneByIndex(needRemoveIndex);
|
940
940
|
};
|
941
941
|
const pageState$ = new Val(appProxy.pageState);
|
942
|
+
const baseRect$ = new Val(appProxy.size$.value);
|
943
|
+
const pickCamera = (camera) => pick(camera, ["centerX", "centerY", "scale"]);
|
944
|
+
const camera$ = new Val(pickCamera(this.view.camera));
|
945
|
+
this.baseRect$ = baseRect$;
|
942
946
|
this.pageState$ = pageState$;
|
943
|
-
|
944
|
-
|
945
|
-
|
947
|
+
this.baseCamera$ = camera$;
|
948
|
+
this.appProxy.sideEffectManager.add(() => [
|
949
|
+
appProxy.appEmitter.on("pageStateChange", (pageState) => pageState$.setValue(pageState)),
|
950
|
+
appProxy.camera$.subscribe((camera) => {
|
951
|
+
if (camera) {
|
952
|
+
camera$.setValue(pickCamera(camera));
|
953
|
+
}
|
954
|
+
}),
|
955
|
+
appProxy.size$.subscribe((size2) => {
|
956
|
+
if (size2) {
|
957
|
+
baseRect$.setValue(pick(size2, ["width", "height"]));
|
958
|
+
}
|
959
|
+
})
|
960
|
+
]);
|
961
|
+
view.disableCameraTransform = true;
|
946
962
|
}
|
947
963
|
get pageState() {
|
948
964
|
return this.pageState$.value;
|
949
965
|
}
|
950
|
-
|
951
|
-
this.
|
966
|
+
moveCamera(camera) {
|
967
|
+
this.appProxy.moveCamera(camera);
|
968
|
+
}
|
969
|
+
setBaseRect(rect) {
|
970
|
+
this.appProxy.updateSize(rect.width, rect.height);
|
952
971
|
}
|
953
972
|
}
|
954
|
-
const
|
973
|
+
const log = (...args) => {
|
974
|
+
if (WindowManager.debug) {
|
975
|
+
console.log(`[WindowManager]:`, ...args);
|
976
|
+
}
|
977
|
+
};
|
978
|
+
const setupWrapper = (root, target) => {
|
955
979
|
const playground = document.createElement("div");
|
956
980
|
playground.className = "netless-window-manager-playground";
|
957
981
|
const mainViewElement = document.createElement("div");
|
958
982
|
mainViewElement.className = "netless-window-manager-main-view";
|
959
|
-
|
983
|
+
target.appendChild(mainViewElement);
|
960
984
|
root.appendChild(playground);
|
961
985
|
return { playground, mainViewElement };
|
962
986
|
};
|
@@ -978,13 +1002,25 @@ const serializeRoomMembers = (members) => {
|
|
978
1002
|
var _a;
|
979
1003
|
return __spreadValues({
|
980
1004
|
uid: ((_a = member.payload) == null ? void 0 : _a.uid) || ""
|
981
|
-
}, member);
|
1005
|
+
}, toJS(member));
|
982
1006
|
});
|
983
1007
|
};
|
1008
|
+
const createInvisiblePlugin = async (room) => {
|
1009
|
+
try {
|
1010
|
+
const manager = await room.createInvisiblePlugin(WindowManager, {});
|
1011
|
+
return manager;
|
1012
|
+
} catch (error) {
|
1013
|
+
if (error.message === `invisible plugin "WindowManager" exits`) {
|
1014
|
+
await wait(200);
|
1015
|
+
return room.getInvisiblePlugin(WindowManager.kind);
|
1016
|
+
} else {
|
1017
|
+
log("createInvisiblePlugin failed", error);
|
1018
|
+
}
|
1019
|
+
}
|
1020
|
+
};
|
984
1021
|
class AppContext {
|
985
|
-
constructor(manager,
|
1022
|
+
constructor(manager, appId, appProxy, appOptions) {
|
986
1023
|
this.manager = manager;
|
987
|
-
this.boxManager = boxManager;
|
988
1024
|
this.appId = appId;
|
989
1025
|
this.appProxy = appProxy;
|
990
1026
|
this.appOptions = appOptions;
|
@@ -1012,8 +1048,7 @@ class AppContext {
|
|
1012
1048
|
return appAttr == null ? void 0 : appAttr.options["scenes"];
|
1013
1049
|
}
|
1014
1050
|
};
|
1015
|
-
this.createWhiteBoardView = (
|
1016
|
-
var _a;
|
1051
|
+
this.createWhiteBoardView = (params) => {
|
1017
1052
|
if (this.whiteBoardView) {
|
1018
1053
|
return this.whiteBoardView;
|
1019
1054
|
}
|
@@ -1021,21 +1056,39 @@ class AppContext {
|
|
1021
1056
|
if (!view) {
|
1022
1057
|
view = this.appProxy.createAppDir();
|
1023
1058
|
}
|
1059
|
+
if (params) {
|
1060
|
+
if (isBoolean(params.syncCamera)) {
|
1061
|
+
this.appProxy.syncCamera$.setValue(params.syncCamera);
|
1062
|
+
}
|
1063
|
+
}
|
1024
1064
|
const viewWrapper = document.createElement("div");
|
1065
|
+
this._viewWrapper = viewWrapper;
|
1025
1066
|
viewWrapper.className = "window-manager-view-wrapper";
|
1026
|
-
|
1027
|
-
const removeViewWrapper = () => {
|
1028
|
-
var _a2;
|
1029
|
-
(_a2 = this.box.$content.parentElement) == null ? void 0 : _a2.removeChild(viewWrapper);
|
1030
|
-
};
|
1067
|
+
this.box.$main.appendChild(viewWrapper);
|
1031
1068
|
view.divElement = viewWrapper;
|
1069
|
+
this.appProxy.fireMemberStateChange();
|
1032
1070
|
if (this.isAddApp) {
|
1033
|
-
this.
|
1034
|
-
}
|
1035
|
-
this.whiteBoardView = new WhiteBoardView(this, this.appProxy,
|
1071
|
+
this.ensurePageSize(params == null ? void 0 : params.size);
|
1072
|
+
}
|
1073
|
+
this.whiteBoardView = new WhiteBoardView(view, this, this.appProxy, this.ensurePageSize);
|
1074
|
+
this.appProxy.sideEffectManager.add(() => [
|
1075
|
+
this.box._stageRect$.subscribe((rect) => {
|
1076
|
+
viewWrapper.style.left = `${rect.x}px`;
|
1077
|
+
viewWrapper.style.top = `${rect.y}px`;
|
1078
|
+
viewWrapper.style.width = `${rect.width}px`;
|
1079
|
+
viewWrapper.style.height = `${rect.height}px`;
|
1080
|
+
}),
|
1081
|
+
() => {
|
1082
|
+
return () => {
|
1083
|
+
this.whiteBoardView = void 0;
|
1084
|
+
};
|
1085
|
+
}
|
1086
|
+
]);
|
1087
|
+
this.appProxy.whiteBoardViewCreated$.setValue(true);
|
1036
1088
|
return this.whiteBoardView;
|
1037
1089
|
};
|
1038
|
-
this.
|
1090
|
+
this.ensurePageSize = (size2) => {
|
1091
|
+
var _a;
|
1039
1092
|
if (!isNumber(size2))
|
1040
1093
|
return;
|
1041
1094
|
if (!this.appProxy.scenePath)
|
@@ -1046,14 +1099,11 @@ class AppContext {
|
|
1046
1099
|
throw Error(`[WindowManager]: size ${size2} muse be in range [1, ${MAX_PAGE_SIZE}]`);
|
1047
1100
|
}
|
1048
1101
|
const needInsert = size2 - this.appProxy.pageState.length;
|
1049
|
-
const
|
1050
|
-
|
1051
|
-
return { name: `${startPageNumber + index2 + 1}` };
|
1052
|
-
});
|
1053
|
-
putScenes(this.room, this.appProxy.scenePath, scenes);
|
1102
|
+
const scenes = new Array(needInsert).fill({});
|
1103
|
+
(_a = this.room) == null ? void 0 : _a.putScenes(this.appProxy.scenePath, scenes);
|
1054
1104
|
};
|
1055
1105
|
this.getInitScenePath = () => {
|
1056
|
-
return this.
|
1106
|
+
return this.appProxy.scenePath;
|
1057
1107
|
};
|
1058
1108
|
this.setAttributes = (attributes) => {
|
1059
1109
|
this.manager.safeSetAttributes({ [this.appId]: attributes });
|
@@ -1097,14 +1147,17 @@ class AppContext {
|
|
1097
1147
|
get displayer() {
|
1098
1148
|
return this.manager.displayer;
|
1099
1149
|
}
|
1150
|
+
get destroyed() {
|
1151
|
+
return this.appProxy.status === "destroyed";
|
1152
|
+
}
|
1100
1153
|
get view() {
|
1101
1154
|
return this.appProxy.view;
|
1102
1155
|
}
|
1103
1156
|
get isWritable() {
|
1104
|
-
return this.manager.canOperate;
|
1157
|
+
return this.manager.canOperate && !this.destroyed;
|
1105
1158
|
}
|
1106
1159
|
get box() {
|
1107
|
-
const box = this.
|
1160
|
+
const box = this.appProxy.box$.value;
|
1108
1161
|
if (box) {
|
1109
1162
|
return box;
|
1110
1163
|
} else {
|
@@ -1115,9 +1168,9 @@ class AppContext {
|
|
1115
1168
|
return this.manager.room;
|
1116
1169
|
}
|
1117
1170
|
get members() {
|
1118
|
-
return this.manager.members;
|
1171
|
+
return this.manager.members$.value;
|
1119
1172
|
}
|
1120
|
-
get
|
1173
|
+
get currentMember() {
|
1121
1174
|
const self2 = findMemberByUid(this.room, this.manager.uid);
|
1122
1175
|
if (!self2) {
|
1123
1176
|
throw new Error(`Member ${this.manager.uid} not found.`);
|
@@ -1186,6 +1239,151 @@ class AppPageStateImpl {
|
|
1186
1239
|
(_a = this.sceneNode) == null ? void 0 : _a.dispose();
|
1187
1240
|
}
|
1188
1241
|
}
|
1242
|
+
class CameraSynchronizer {
|
1243
|
+
constructor(saveCamera) {
|
1244
|
+
this.saveCamera = saveCamera;
|
1245
|
+
this.setRect = (rect) => {
|
1246
|
+
this.rect = rect;
|
1247
|
+
if (this.remoteCamera && this.remoteSize) {
|
1248
|
+
this.onRemoteUpdate(this.remoteCamera, this.remoteSize);
|
1249
|
+
}
|
1250
|
+
};
|
1251
|
+
this.onRemoteUpdate = throttle((camera, size2) => {
|
1252
|
+
this.remoteCamera = camera;
|
1253
|
+
this.remoteSize = size2;
|
1254
|
+
if (this.remoteSize && this.rect) {
|
1255
|
+
const wScale = this.rect.width / size2.width;
|
1256
|
+
const hScale = this.rect.height / size2.height;
|
1257
|
+
const nextScale = camera.scale * Math.min(wScale, hScale);
|
1258
|
+
const config = {
|
1259
|
+
scale: nextScale,
|
1260
|
+
animationMode: AnimationMode.Continuous
|
1261
|
+
};
|
1262
|
+
if (camera.centerX !== null) {
|
1263
|
+
config.centerX = camera.centerX;
|
1264
|
+
}
|
1265
|
+
if (camera.centerY !== null) {
|
1266
|
+
config.centerY = camera.centerY;
|
1267
|
+
}
|
1268
|
+
this.moveCamera(config);
|
1269
|
+
}
|
1270
|
+
}, 10);
|
1271
|
+
}
|
1272
|
+
setView(view) {
|
1273
|
+
this.view = view;
|
1274
|
+
}
|
1275
|
+
onRemoteSizeUpdate(size2) {
|
1276
|
+
this.remoteSize = size2;
|
1277
|
+
const needMoveCamera = !isEqual(pick(this.rect, ["width", "height"]), pick(size2, ["width", "height"]));
|
1278
|
+
if (this.rect && this.remoteCamera && needMoveCamera) {
|
1279
|
+
const scale2 = this.rect.width / size2.width;
|
1280
|
+
const nextScale = this.remoteCamera.scale * scale2;
|
1281
|
+
this.moveCamera({
|
1282
|
+
scale: nextScale
|
1283
|
+
});
|
1284
|
+
}
|
1285
|
+
}
|
1286
|
+
onLocalCameraUpdate(camera) {
|
1287
|
+
this.saveCamera(camera);
|
1288
|
+
this.remoteCamera = camera;
|
1289
|
+
}
|
1290
|
+
moveCamera(camera) {
|
1291
|
+
var _a;
|
1292
|
+
(_a = this.view) == null ? void 0 : _a.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: AnimationMode.Continuous }));
|
1293
|
+
}
|
1294
|
+
}
|
1295
|
+
class ViewSync {
|
1296
|
+
constructor(context) {
|
1297
|
+
this.context = context;
|
1298
|
+
this.sem = new SideEffectManager();
|
1299
|
+
this.bindView = (view) => {
|
1300
|
+
if (!view)
|
1301
|
+
return;
|
1302
|
+
this.synchronizer.setView(view);
|
1303
|
+
this.sem.flush("view");
|
1304
|
+
this.sem.add(() => {
|
1305
|
+
view.callbacks.on("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
|
1306
|
+
return () => view.callbacks.off("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
|
1307
|
+
}, "view");
|
1308
|
+
};
|
1309
|
+
this.onCameraUpdatedByDevice = (camera) => {
|
1310
|
+
if (!camera)
|
1311
|
+
return;
|
1312
|
+
this.synchronizer.onLocalCameraUpdate(__spreadProps(__spreadValues({}, camera), { id: this.context.uid }));
|
1313
|
+
const stage = this.context.stageRect$.value;
|
1314
|
+
if (stage) {
|
1315
|
+
const size2 = { width: stage.width, height: stage.height, id: this.context.uid };
|
1316
|
+
if (!isEqual(size2, this.context.size$.value)) {
|
1317
|
+
this.context.storeSize(size2);
|
1318
|
+
}
|
1319
|
+
}
|
1320
|
+
};
|
1321
|
+
this.synchronizer = new CameraSynchronizer((camera) => {
|
1322
|
+
this.context.camera$.setValue(camera, true);
|
1323
|
+
const notStoreCamera = this.context.viewMode$ && this.context.viewMode$.value === ViewMode.Freedom;
|
1324
|
+
if (notStoreCamera) {
|
1325
|
+
return;
|
1326
|
+
} else {
|
1327
|
+
this.context.storeCamera(camera);
|
1328
|
+
}
|
1329
|
+
});
|
1330
|
+
this.bindView(this.context.view$.value);
|
1331
|
+
this.sem.add(() => [
|
1332
|
+
this.context.view$.subscribe((view) => {
|
1333
|
+
const currentCamera = this.context.camera$.value;
|
1334
|
+
if (currentCamera && this.context.size$.value) {
|
1335
|
+
view == null ? void 0 : view.moveCamera({
|
1336
|
+
scale: 1,
|
1337
|
+
animationMode: AnimationMode.Immediately
|
1338
|
+
});
|
1339
|
+
this.synchronizer.onRemoteUpdate(currentCamera, this.context.size$.value);
|
1340
|
+
}
|
1341
|
+
this.bindView(view);
|
1342
|
+
}),
|
1343
|
+
this.context.camera$.subscribe((camera, skipUpdate) => {
|
1344
|
+
const size2 = this.context.size$.value;
|
1345
|
+
if (camera && size2 && !skipUpdate) {
|
1346
|
+
this.synchronizer.onRemoteUpdate(camera, size2);
|
1347
|
+
}
|
1348
|
+
}),
|
1349
|
+
this.context.size$.subscribe((size2) => {
|
1350
|
+
if (size2) {
|
1351
|
+
this.synchronizer.onRemoteSizeUpdate(size2);
|
1352
|
+
}
|
1353
|
+
}),
|
1354
|
+
this.context.stageRect$.subscribe((rect) => {
|
1355
|
+
if (rect) {
|
1356
|
+
this.synchronizer.setRect(rect);
|
1357
|
+
}
|
1358
|
+
})
|
1359
|
+
]);
|
1360
|
+
const camera$size$ = combine([this.context.camera$, this.context.size$]);
|
1361
|
+
camera$size$.reaction(([camera, size2]) => {
|
1362
|
+
if (camera && size2) {
|
1363
|
+
this.synchronizer.onRemoteUpdate(camera, size2);
|
1364
|
+
camera$size$.destroy();
|
1365
|
+
}
|
1366
|
+
});
|
1367
|
+
}
|
1368
|
+
destroy() {
|
1369
|
+
this.sem.flushAll();
|
1370
|
+
}
|
1371
|
+
}
|
1372
|
+
const boxEmitter = new Emittery();
|
1373
|
+
const calculateNextIndex = (index2, pageState) => {
|
1374
|
+
let nextIndex = 0;
|
1375
|
+
const maxIndex = pageState.length - 1;
|
1376
|
+
if (index2 === pageState.index) {
|
1377
|
+
if (index2 === maxIndex) {
|
1378
|
+
nextIndex = index2 - 1;
|
1379
|
+
} else {
|
1380
|
+
nextIndex = pageState.index + 1;
|
1381
|
+
}
|
1382
|
+
} else {
|
1383
|
+
nextIndex = pageState.index;
|
1384
|
+
}
|
1385
|
+
return nextIndex;
|
1386
|
+
};
|
1189
1387
|
var Fields = /* @__PURE__ */ ((Fields2) => {
|
1190
1388
|
Fields2["Apps"] = "apps";
|
1191
1389
|
Fields2["Focus"] = "focus";
|
@@ -1199,6 +1397,8 @@ var Fields = /* @__PURE__ */ ((Fields2) => {
|
|
1199
1397
|
Fields2["CursorState"] = "cursorState";
|
1200
1398
|
Fields2["FullPath"] = "fullPath";
|
1201
1399
|
Fields2["Registered"] = "registered";
|
1400
|
+
Fields2["Camera"] = "camera";
|
1401
|
+
Fields2["Size"] = "size";
|
1202
1402
|
return Fields2;
|
1203
1403
|
})(Fields || {});
|
1204
1404
|
class AttributesDelegate {
|
@@ -1246,7 +1446,7 @@ class AttributesDelegate {
|
|
1246
1446
|
attrNames.push("scenes");
|
1247
1447
|
}
|
1248
1448
|
const options = pick(params.options, attrNames);
|
1249
|
-
const attrs = { kind: params.kind, options, isDynamicPPT };
|
1449
|
+
const attrs = { kind: params.kind, options, isDynamicPPT, setup: false };
|
1250
1450
|
if (typeof params.src === "string") {
|
1251
1451
|
attrs.src = params.src;
|
1252
1452
|
}
|
@@ -1263,6 +1463,9 @@ class AttributesDelegate {
|
|
1263
1463
|
this.context.safeUpdateAttributes(["apps", appId, "state", stateName], state);
|
1264
1464
|
}
|
1265
1465
|
}
|
1466
|
+
updateAppAttributes(appId, key, value) {
|
1467
|
+
this.context.safeUpdateAttributes(["apps", appId, key], value);
|
1468
|
+
}
|
1266
1469
|
cleanAppAttributes(id2) {
|
1267
1470
|
this.context.safeUpdateAttributes(["apps", id2], void 0);
|
1268
1471
|
this.context.safeSetAttributes({ [id2]: void 0 });
|
@@ -1354,26 +1557,6 @@ const store = new AttributesDelegate({
|
|
1354
1557
|
throw new Error("safeUpdateAttributes not implemented");
|
1355
1558
|
}
|
1356
1559
|
});
|
1357
|
-
const log = (...args) => {
|
1358
|
-
if (WindowManager.debug) {
|
1359
|
-
console.log(`[WindowManager]:`, ...args);
|
1360
|
-
}
|
1361
|
-
};
|
1362
|
-
const calculateNextIndex = (index2, pageState) => {
|
1363
|
-
let nextIndex = 0;
|
1364
|
-
const maxIndex = pageState.length - 1;
|
1365
|
-
if (index2 === pageState.index) {
|
1366
|
-
if (index2 === maxIndex) {
|
1367
|
-
nextIndex = index2 - 1;
|
1368
|
-
} else {
|
1369
|
-
nextIndex = pageState.index + 1;
|
1370
|
-
}
|
1371
|
-
} else {
|
1372
|
-
nextIndex = pageState.index;
|
1373
|
-
}
|
1374
|
-
return nextIndex;
|
1375
|
-
};
|
1376
|
-
const boxEmitter = new Emittery();
|
1377
1560
|
class AppProxy {
|
1378
1561
|
constructor(params, manager, appId, isAddApp) {
|
1379
1562
|
var _a;
|
@@ -1383,65 +1566,100 @@ class AppProxy {
|
|
1383
1566
|
this.appProxies = this.manager.appProxies;
|
1384
1567
|
this.viewManager = this.manager.viewManager;
|
1385
1568
|
this.store = this.manager.store;
|
1569
|
+
this.uid = this.manager.uid;
|
1386
1570
|
this.status = "normal";
|
1387
1571
|
this.sideEffectManager = new SideEffectManager();
|
1572
|
+
this.valManager = new ValManager();
|
1573
|
+
this.fullPath$ = this.valManager.attach(new Val(void 0));
|
1574
|
+
this.camera$ = this.valManager.attach(new Val(void 0));
|
1575
|
+
this.size$ = this.valManager.attach(new Val(void 0));
|
1576
|
+
this.box$ = this.valManager.attach(new Val(void 0));
|
1577
|
+
this.view$ = this.valManager.attach(new Val(void 0));
|
1578
|
+
this.syncCamera$ = this.valManager.attach(new Val(true));
|
1579
|
+
this.whiteBoardViewCreated$ = this.valManager.attach(new Val(false));
|
1580
|
+
this.fireMemberStateChange = () => {
|
1581
|
+
if (this.manager.room) {
|
1582
|
+
this.onMemberStateChange(this.manager.room.state.memberState);
|
1583
|
+
}
|
1584
|
+
};
|
1585
|
+
this.onMemberStateChange = (memberState) => {
|
1586
|
+
var _a2, _b;
|
1587
|
+
const needPointerEventsNone = memberState.currentApplianceName === "clicker";
|
1588
|
+
if (needPointerEventsNone) {
|
1589
|
+
if ((_a2 = this.appContext) == null ? void 0 : _a2._viewWrapper) {
|
1590
|
+
this.appContext._viewWrapper.style.pointerEvents = "none";
|
1591
|
+
}
|
1592
|
+
} else {
|
1593
|
+
if ((_b = this.appContext) == null ? void 0 : _b._viewWrapper) {
|
1594
|
+
this.appContext._viewWrapper.style.pointerEvents = "auto";
|
1595
|
+
}
|
1596
|
+
}
|
1597
|
+
};
|
1598
|
+
this.computedInitialRect = (boxRect) => {
|
1599
|
+
var _a2;
|
1600
|
+
const managerRect = (_a2 = this.manager.boxManager) == null ? void 0 : _a2.stageRect;
|
1601
|
+
if (managerRect) {
|
1602
|
+
const { width, height } = managerRect;
|
1603
|
+
const boxRatio = boxRect.height / boxRect.width;
|
1604
|
+
if (height < 480) {
|
1605
|
+
return {
|
1606
|
+
width: 480 / boxRatio,
|
1607
|
+
height: 480
|
1608
|
+
};
|
1609
|
+
} else {
|
1610
|
+
return {
|
1611
|
+
width: width * 0.65,
|
1612
|
+
height: height * 0.65
|
1613
|
+
};
|
1614
|
+
}
|
1615
|
+
}
|
1616
|
+
};
|
1388
1617
|
this.getAppInitState = (id2) => {
|
1389
1618
|
var _a2, _b;
|
1390
1619
|
const attrs = this.store.getAppState(id2);
|
1391
1620
|
if (!attrs)
|
1392
1621
|
return;
|
1393
|
-
const position = attrs == null ? void 0 : attrs[AppAttributes.Position];
|
1394
1622
|
const focus = this.store.focus;
|
1395
|
-
const size2 = attrs == null ? void 0 : attrs[AppAttributes.Size];
|
1396
|
-
const sceneIndex = attrs == null ? void 0 : attrs[AppAttributes.SceneIndex];
|
1397
1623
|
const maximized = (_a2 = this.attributes) == null ? void 0 : _a2["maximized"];
|
1398
1624
|
const minimized = (_b = this.attributes) == null ? void 0 : _b["minimized"];
|
1399
|
-
|
1400
|
-
|
1401
|
-
if (position) {
|
1402
|
-
payload = __spreadProps(__spreadValues({}, payload), { id: id2, x: position.x, y: position.y });
|
1403
|
-
}
|
1625
|
+
let payload = { maximized, minimized, id: id2 };
|
1626
|
+
const state = omitBy(attrs, isUndefined);
|
1404
1627
|
if (focus === id2) {
|
1405
1628
|
payload = __spreadProps(__spreadValues({}, payload), { focus: true });
|
1406
1629
|
}
|
1407
|
-
|
1408
|
-
payload = __spreadProps(__spreadValues({}, payload), { width: size2.width, height: size2.height });
|
1409
|
-
}
|
1410
|
-
if (sceneIndex) {
|
1411
|
-
payload = __spreadProps(__spreadValues({}, payload), { sceneIndex });
|
1412
|
-
}
|
1413
|
-
return payload;
|
1630
|
+
return Object.assign(payload, state);
|
1414
1631
|
};
|
1415
1632
|
this.appAttributesUpdateListener = (appId2) => {
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1633
|
+
this.sideEffectManager.add(() => [
|
1634
|
+
this.manager.refresher.add(appId2, () => {
|
1635
|
+
return autorun(() => {
|
1636
|
+
const attrs = this.manager.attributes[appId2];
|
1637
|
+
if (attrs) {
|
1638
|
+
this.appEmitter.emit("attributesUpdate", attrs);
|
1639
|
+
}
|
1640
|
+
});
|
1641
|
+
}),
|
1642
|
+
this.manager.refresher.add(this.stateKey, () => {
|
1643
|
+
return autorun(() => {
|
1644
|
+
var _a2, _b, _c;
|
1645
|
+
const appState = (_a2 = this.appAttributes) == null ? void 0 : _a2.state;
|
1646
|
+
if ((appState == null ? void 0 : appState.zIndex) > 0 && appState.zIndex !== ((_b = this.box) == null ? void 0 : _b.zIndex)) {
|
1647
|
+
(_c = this.boxManager) == null ? void 0 : _c.setZIndex(appId2, appState.zIndex);
|
1648
|
+
}
|
1649
|
+
});
|
1650
|
+
}),
|
1651
|
+
this.manager.refresher.add(`${appId2}-fullPath`, () => {
|
1652
|
+
return autorun(() => {
|
1653
|
+
var _a2;
|
1654
|
+
const fullPath = (_a2 = this.appAttributes) == null ? void 0 : _a2.fullPath;
|
1655
|
+
this.setFocusScenePathHandler(fullPath);
|
1656
|
+
if (this.fullPath$.value !== fullPath) {
|
1657
|
+
this.notifyPageStateChange();
|
1658
|
+
this.fullPath$.setValue(fullPath);
|
1659
|
+
}
|
1660
|
+
});
|
1661
|
+
})
|
1662
|
+
]);
|
1445
1663
|
};
|
1446
1664
|
this.setFocusScenePathHandler = debounce((fullPath) => {
|
1447
1665
|
var _a2;
|
@@ -1454,6 +1672,62 @@ class AppProxy {
|
|
1454
1672
|
this.appEmitter.emit("pageStateChange", this.pageState);
|
1455
1673
|
}
|
1456
1674
|
}, 50);
|
1675
|
+
this.storeCamera = (camera) => {
|
1676
|
+
this.store.updateAppAttributes(this.id, Fields.Camera, camera);
|
1677
|
+
};
|
1678
|
+
this.storeSize = (size2) => {
|
1679
|
+
this.store.updateAppAttributes(this.id, Fields.Size, size2);
|
1680
|
+
};
|
1681
|
+
this.updateSize = (width, height) => {
|
1682
|
+
const iSize = {
|
1683
|
+
id: this.manager.uid,
|
1684
|
+
width,
|
1685
|
+
height
|
1686
|
+
};
|
1687
|
+
this.store.updateAppAttributes(this.id, Fields.Size, iSize);
|
1688
|
+
this.size$.setValue(iSize);
|
1689
|
+
};
|
1690
|
+
this.moveCamera = (camera) => {
|
1691
|
+
if (!this.camera$.value) {
|
1692
|
+
return;
|
1693
|
+
}
|
1694
|
+
const nextCamera = __spreadProps(__spreadValues(__spreadValues({}, this.camera$.value), camera), { id: this.uid });
|
1695
|
+
this.storeCamera(nextCamera);
|
1696
|
+
this.camera$.setValue(nextCamera);
|
1697
|
+
};
|
1698
|
+
this.addCameraReaction = () => {
|
1699
|
+
this.sideEffectManager.add(() => this.manager.refresher.add(`${this.id}-camera`, () => reaction(() => {
|
1700
|
+
var _a2;
|
1701
|
+
return (_a2 = this.appAttributes) == null ? void 0 : _a2.camera;
|
1702
|
+
}, (camera) => {
|
1703
|
+
if (camera) {
|
1704
|
+
const rawCamera = toJS(camera);
|
1705
|
+
if (!isEqual(rawCamera, this.camera$.value)) {
|
1706
|
+
this.camera$.setValue(rawCamera);
|
1707
|
+
}
|
1708
|
+
}
|
1709
|
+
})), "camera");
|
1710
|
+
};
|
1711
|
+
this.addSizeReaction = () => {
|
1712
|
+
this.sideEffectManager.add(() => this.manager.refresher.add(`${this.id}-size`, () => reaction(() => {
|
1713
|
+
var _a2;
|
1714
|
+
return (_a2 = this.appAttributes) == null ? void 0 : _a2.size;
|
1715
|
+
}, (size2) => {
|
1716
|
+
if (size2) {
|
1717
|
+
const rawSize = toJS(size2);
|
1718
|
+
if (!isEqual(rawSize, this.size$.value)) {
|
1719
|
+
this.size$.setValue(rawSize);
|
1720
|
+
}
|
1721
|
+
}
|
1722
|
+
})), "size");
|
1723
|
+
};
|
1724
|
+
this.onFocus = () => {
|
1725
|
+
this.setScenePath();
|
1726
|
+
};
|
1727
|
+
this.setupDone = () => {
|
1728
|
+
this.store.updateAppAttributes(this.id, "setup", true);
|
1729
|
+
this.manager.dispatchInternalEvent(Events.InvokeAttributesUpdateCallback);
|
1730
|
+
};
|
1457
1731
|
this.kind = params.kind;
|
1458
1732
|
this.id = appId;
|
1459
1733
|
this.appScenePath = `/${this.id}-app-dir`;
|
@@ -1475,14 +1749,71 @@ class AppProxy {
|
|
1475
1749
|
view: this.view,
|
1476
1750
|
notifyPageStateChange: this.notifyPageStateChange
|
1477
1751
|
});
|
1478
|
-
this.sideEffectManager.add(() =>
|
1479
|
-
|
1480
|
-
|
1481
|
-
this.
|
1482
|
-
|
1752
|
+
this.sideEffectManager.add(() => () => this._pageState.destroy());
|
1753
|
+
this.camera$.setValue(toJS(this.appAttributes.camera));
|
1754
|
+
this.size$.setValue(toJS(this.appAttributes.size));
|
1755
|
+
this.addCameraReaction();
|
1756
|
+
this.addSizeReaction();
|
1757
|
+
this.sideEffectManager.add(() => emitter.on("memberStateChange", this.onMemberStateChange));
|
1758
|
+
this.sideEffectManager.add(() => [
|
1759
|
+
this.syncCamera$.reaction((syncCamera) => {
|
1760
|
+
if (!syncCamera) {
|
1761
|
+
if (this.viewSync) {
|
1762
|
+
this.viewSync.destroy();
|
1763
|
+
this.viewSync = void 0;
|
1764
|
+
this.sideEffectManager.flush("camera");
|
1765
|
+
this.sideEffectManager.flush("size");
|
1766
|
+
}
|
1767
|
+
}
|
1768
|
+
}),
|
1769
|
+
this.whiteBoardViewCreated$.reaction((created) => {
|
1770
|
+
if (created && this.box) {
|
1771
|
+
if (!this.syncCamera$.value)
|
1772
|
+
return;
|
1773
|
+
combine([this.box$, this.view$]).subscribe(([box, view]) => {
|
1774
|
+
if (box && view) {
|
1775
|
+
if (!this.camera$.value) {
|
1776
|
+
this.storeCamera({
|
1777
|
+
centerX: null,
|
1778
|
+
centerY: null,
|
1779
|
+
scale: 1,
|
1780
|
+
id: this.uid
|
1781
|
+
});
|
1782
|
+
this.camera$.setValue(toJS(this.appAttributes.camera));
|
1783
|
+
}
|
1784
|
+
if (!this.size$.value && box.stageRect) {
|
1785
|
+
const initialRect = this.computedInitialRect(box.stageRect);
|
1786
|
+
const width = (initialRect == null ? void 0 : initialRect.width) || box.stageRect.width;
|
1787
|
+
const height = (initialRect == null ? void 0 : initialRect.height) || box.stageRect.height;
|
1788
|
+
this.storeSize({
|
1789
|
+
id: this.uid,
|
1790
|
+
width,
|
1791
|
+
height
|
1792
|
+
});
|
1793
|
+
this.size$.setValue(toJS(this.appAttributes.size));
|
1794
|
+
}
|
1795
|
+
this.viewSync = new ViewSync({
|
1796
|
+
uid: this.uid,
|
1797
|
+
view$: this.view$,
|
1798
|
+
camera$: this.camera$,
|
1799
|
+
size$: this.size$,
|
1800
|
+
stageRect$: box._stageRect$,
|
1801
|
+
storeCamera: this.storeCamera,
|
1802
|
+
storeSize: this.storeSize
|
1803
|
+
});
|
1804
|
+
this.sideEffectManager.add(() => () => {
|
1805
|
+
var _a2;
|
1806
|
+
return (_a2 = this.viewSync) == null ? void 0 : _a2.destroy();
|
1807
|
+
});
|
1808
|
+
this.whiteBoardViewCreated$.destroy();
|
1809
|
+
}
|
1810
|
+
});
|
1811
|
+
}
|
1812
|
+
}),
|
1813
|
+
this.manager.members$.reaction((members) => {
|
1483
1814
|
this.appEmitter.emit("roomMembersChange", members);
|
1484
|
-
})
|
1485
|
-
|
1815
|
+
})
|
1816
|
+
]);
|
1486
1817
|
}
|
1487
1818
|
createAppDir() {
|
1488
1819
|
const scenePath = this.scenePath || this.appScenePath;
|
@@ -1510,7 +1841,7 @@ class AppProxy {
|
|
1510
1841
|
}
|
1511
1842
|
}
|
1512
1843
|
get view() {
|
1513
|
-
return this.
|
1844
|
+
return this.view$.value;
|
1514
1845
|
}
|
1515
1846
|
get viewIndex() {
|
1516
1847
|
var _a;
|
@@ -1540,7 +1871,7 @@ class AppProxy {
|
|
1540
1871
|
return fullPath;
|
1541
1872
|
}
|
1542
1873
|
setFullPath(path) {
|
1543
|
-
this.
|
1874
|
+
this.store.updateAppAttributes(this.id, Fields.FullPath, path);
|
1544
1875
|
}
|
1545
1876
|
async baseInsertApp(skipUpdate = false) {
|
1546
1877
|
var _a;
|
@@ -1562,8 +1893,7 @@ class AppProxy {
|
|
1562
1893
|
};
|
1563
1894
|
}
|
1564
1895
|
get box() {
|
1565
|
-
|
1566
|
-
return (_a = this.boxManager) == null ? void 0 : _a.getBox(this.id);
|
1896
|
+
return this.box$.value;
|
1567
1897
|
}
|
1568
1898
|
async setupApp(appId, skipUpdate, app, options, appOptions) {
|
1569
1899
|
var _a;
|
@@ -1571,7 +1901,7 @@ class AppProxy {
|
|
1571
1901
|
if (!this.boxManager) {
|
1572
1902
|
throw new BoxManagerNotFoundError();
|
1573
1903
|
}
|
1574
|
-
const context = new AppContext(this.manager,
|
1904
|
+
const context = new AppContext(this.manager, appId, this, appOptions);
|
1575
1905
|
this.appContext = context;
|
1576
1906
|
try {
|
1577
1907
|
emitter.once(`${appId}${Events.WindowCreated}`).then(async () => {
|
@@ -1589,17 +1919,29 @@ class AppProxy {
|
|
1589
1919
|
this.appResult = result;
|
1590
1920
|
appRegister.notifyApp(this.kind, "created", { appId, result });
|
1591
1921
|
this.fixMobileSize();
|
1922
|
+
if (this.isAddApp) {
|
1923
|
+
this.setupDone();
|
1924
|
+
}
|
1592
1925
|
}, SETUP_APP_DELAY);
|
1593
1926
|
});
|
1594
|
-
(_a = this.boxManager) == null ? void 0 : _a.createBox({
|
1927
|
+
const box = (_a = this.boxManager) == null ? void 0 : _a.createBox({
|
1595
1928
|
appId,
|
1596
1929
|
app,
|
1597
1930
|
options,
|
1598
1931
|
canOperate: this.manager.canOperate,
|
1599
1932
|
smartPosition: this.isAddApp
|
1600
1933
|
});
|
1934
|
+
const registerParams = appRegister.registered.get(this.kind);
|
1935
|
+
if (registerParams == null ? void 0 : registerParams.contentStyles) {
|
1936
|
+
box == null ? void 0 : box.mountUserStyles(registerParams.contentStyles);
|
1937
|
+
}
|
1938
|
+
this.box$.setValue(box);
|
1601
1939
|
if (this.isAddApp && this.box) {
|
1602
1940
|
this.store.updateAppState(appId, AppAttributes.ZIndex, this.box.zIndex);
|
1941
|
+
this.store.updateAppState(appId, AppAttributes.Size, {
|
1942
|
+
width: this.box.intrinsicWidth,
|
1943
|
+
height: this.box.intrinsicHeight
|
1944
|
+
});
|
1603
1945
|
this.boxManager.focusBox({ appId }, false);
|
1604
1946
|
}
|
1605
1947
|
} catch (error) {
|
@@ -1611,12 +1953,14 @@ class AppProxy {
|
|
1611
1953
|
var _a, _b;
|
1612
1954
|
const box = (_a = this.boxManager) == null ? void 0 : _a.getBox(this.id);
|
1613
1955
|
if (box) {
|
1614
|
-
(
|
1615
|
-
|
1616
|
-
|
1617
|
-
|
1618
|
-
|
1619
|
-
|
1956
|
+
if (!box.minimized) {
|
1957
|
+
(_b = this.boxManager) == null ? void 0 : _b.resizeBox({
|
1958
|
+
appId: this.id,
|
1959
|
+
width: box.intrinsicWidth + 1e-3,
|
1960
|
+
height: box.intrinsicHeight + 1e-3,
|
1961
|
+
skipUpdate: true
|
1962
|
+
});
|
1963
|
+
}
|
1620
1964
|
}
|
1621
1965
|
}
|
1622
1966
|
async onSeek(time2) {
|
@@ -1718,6 +2062,8 @@ class AppProxy {
|
|
1718
2062
|
}
|
1719
2063
|
}
|
1720
2064
|
setViewFocusScenePath() {
|
2065
|
+
if (this.status === "destroyed")
|
2066
|
+
return;
|
1721
2067
|
const fullPath = this.getFullScenePath();
|
1722
2068
|
if (fullPath && this.view) {
|
1723
2069
|
setViewFocusScenePath(this.view, fullPath);
|
@@ -1726,6 +2072,7 @@ class AppProxy {
|
|
1726
2072
|
}
|
1727
2073
|
createView() {
|
1728
2074
|
const view = this.viewManager.createView(this.id);
|
2075
|
+
this.view$.setValue(view);
|
1729
2076
|
this.setViewFocusScenePath();
|
1730
2077
|
return view;
|
1731
2078
|
}
|
@@ -1761,21 +2108,24 @@ class AppProxy {
|
|
1761
2108
|
const fullPath = this._pageState.getFullPath(index2);
|
1762
2109
|
if (fullPath) {
|
1763
2110
|
this.setFullPath(fullPath);
|
2111
|
+
setScenePath(this.manager.room, fullPath);
|
1764
2112
|
}
|
1765
2113
|
}
|
1766
2114
|
}
|
1767
2115
|
async destroy(needCloseBox, cleanAttrs, skipUpdate, error) {
|
1768
|
-
var _a
|
2116
|
+
var _a;
|
1769
2117
|
if (this.status === "destroyed")
|
1770
2118
|
return;
|
1771
2119
|
this.status = "destroyed";
|
1772
2120
|
try {
|
1773
2121
|
await appRegister.notifyApp(this.kind, "destroy", { appId: this.id });
|
2122
|
+
callbacks$1.emit("appClose", { appId: this.id, kind: this.kind, error });
|
1774
2123
|
await this.appEmitter.emit("destroy", { error });
|
1775
2124
|
} catch (error2) {
|
1776
2125
|
console.error("[WindowManager]: notifyApp error", error2.message, error2.stack);
|
1777
2126
|
}
|
1778
2127
|
this.appEmitter.clearListeners();
|
2128
|
+
this.sideEffectManager.flushAll();
|
1779
2129
|
emitter.emit(`destroy-${this.id}`, { error });
|
1780
2130
|
if (needCloseBox) {
|
1781
2131
|
(_a = this.boxManager) == null ? void 0 : _a.closeBox(this.id, skipUpdate);
|
@@ -1789,11 +2139,7 @@ class AppProxy {
|
|
1789
2139
|
this.appProxies.delete(this.id);
|
1790
2140
|
this.viewManager.destroyView(this.id);
|
1791
2141
|
this.manager.appStatus.delete(this.id);
|
1792
|
-
|
1793
|
-
(_c = this.manager.refresher) == null ? void 0 : _c.remove(this.stateKey);
|
1794
|
-
(_d = this.manager.refresher) == null ? void 0 : _d.remove(`${this.id}-fullPath`);
|
1795
|
-
this._prevFullPath = void 0;
|
1796
|
-
this.sideEffectManager.flushAll();
|
2142
|
+
this.valManager.destroy();
|
1797
2143
|
}
|
1798
2144
|
close() {
|
1799
2145
|
return this.destroy(true, true, false);
|
@@ -1849,102 +2195,84 @@ const setDefaultCameraBound = (view) => {
|
|
1849
2195
|
minContentMode: () => 0.1
|
1850
2196
|
});
|
1851
2197
|
};
|
1852
|
-
class CameraSynchronizer {
|
1853
|
-
constructor(saveCamera) {
|
1854
|
-
this.saveCamera = saveCamera;
|
1855
|
-
this.onRemoteUpdate = throttle((camera, size2) => {
|
1856
|
-
this.remoteCamera = camera;
|
1857
|
-
this.remoteSize = size2;
|
1858
|
-
if (this.remoteSize && this.rect) {
|
1859
|
-
let scale2;
|
1860
|
-
if (size2.width < size2.height) {
|
1861
|
-
scale2 = this.rect.width / size2.width;
|
1862
|
-
} else {
|
1863
|
-
scale2 = this.rect.height / size2.height;
|
1864
|
-
}
|
1865
|
-
const nextScale = camera.scale * scale2;
|
1866
|
-
const moveCamera = () => {
|
1867
|
-
var _a;
|
1868
|
-
return (_a = this.view) == null ? void 0 : _a.moveCamera({
|
1869
|
-
centerX: camera.centerX,
|
1870
|
-
centerY: camera.centerY,
|
1871
|
-
scale: nextScale,
|
1872
|
-
animationMode: AnimationMode.Immediately
|
1873
|
-
});
|
1874
|
-
};
|
1875
|
-
delay(moveCamera, 10);
|
1876
|
-
}
|
1877
|
-
}, 50);
|
1878
|
-
}
|
1879
|
-
setRect(rect) {
|
1880
|
-
this.rect = rect;
|
1881
|
-
if (this.remoteCamera && this.remoteSize) {
|
1882
|
-
this.onRemoteUpdate(this.remoteCamera, this.remoteSize);
|
1883
|
-
}
|
1884
|
-
}
|
1885
|
-
setView(view) {
|
1886
|
-
this.view = view;
|
1887
|
-
}
|
1888
|
-
onLocalCameraUpdate(camera) {
|
1889
|
-
this.saveCamera(camera);
|
1890
|
-
}
|
1891
|
-
onLocalSizeUpdate(size2) {
|
1892
|
-
if (this.rect && this.view) {
|
1893
|
-
const scale2 = this.rect.width / size2.width;
|
1894
|
-
const nextScale = this.view.camera.scale * scale2;
|
1895
|
-
this.view.moveCamera({
|
1896
|
-
scale: nextScale,
|
1897
|
-
animationMode: AnimationMode.Immediately
|
1898
|
-
});
|
1899
|
-
}
|
1900
|
-
}
|
1901
|
-
}
|
1902
2198
|
class MainViewProxy {
|
1903
2199
|
constructor(manager) {
|
1904
|
-
var _a;
|
1905
2200
|
this.manager = manager;
|
1906
2201
|
this.started = false;
|
1907
2202
|
this.mainViewIsAddListener = false;
|
1908
2203
|
this.store = this.manager.store;
|
1909
2204
|
this.sideEffectManager = new SideEffectManager();
|
1910
|
-
this.
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
1914
|
-
|
1915
|
-
|
2205
|
+
this.camera$ = new Val(void 0);
|
2206
|
+
this.size$ = new Val(void 0);
|
2207
|
+
this.view$ = new Val(void 0);
|
2208
|
+
this.createViewSync = () => {
|
2209
|
+
var _a;
|
2210
|
+
if (this.manager.boxManager && !this.viewSync) {
|
2211
|
+
this.viewSync = new ViewSync({
|
2212
|
+
uid: this.manager.uid,
|
2213
|
+
view$: this.view$,
|
2214
|
+
camera$: this.camera$,
|
2215
|
+
size$: this.size$,
|
2216
|
+
stageRect$: (_a = this.manager.boxManager) == null ? void 0 : _a.stageRect$,
|
2217
|
+
viewMode$: this.manager.windowManger.viewMode$,
|
2218
|
+
storeCamera: this.storeCamera,
|
2219
|
+
storeSize: this.storeSize
|
1916
2220
|
});
|
1917
|
-
}
|
2221
|
+
}
|
2222
|
+
};
|
2223
|
+
this.startListenWritableChange = () => {
|
2224
|
+
this.sideEffectManager.add(() => emitter.on("writableChange", (isWritable) => {
|
2225
|
+
if (isWritable) {
|
2226
|
+
this.ensureCameraAndSize();
|
2227
|
+
}
|
2228
|
+
}));
|
1918
2229
|
};
|
1919
2230
|
this.addCameraReaction = () => {
|
1920
|
-
|
1921
|
-
|
2231
|
+
this.manager.refresher.add(Fields.MainViewCamera, this.cameraReaction);
|
2232
|
+
this.manager.refresher.add(Fields.MainViewSize, this.sizeReaction);
|
2233
|
+
};
|
2234
|
+
this.storeCurrentCamera = () => {
|
2235
|
+
const iCamera = this.view.camera;
|
2236
|
+
this.storeCamera(__spreadValues({
|
2237
|
+
id: this.manager.uid
|
2238
|
+
}, iCamera));
|
2239
|
+
};
|
2240
|
+
this.storeCurrentSize = () => {
|
2241
|
+
var _a;
|
2242
|
+
const rect = (_a = this.manager.boxManager) == null ? void 0 : _a.stageRect;
|
2243
|
+
if (rect) {
|
2244
|
+
this.storeSize({
|
2245
|
+
id: this.manager.uid,
|
2246
|
+
width: rect.width,
|
2247
|
+
height: rect.height
|
2248
|
+
});
|
2249
|
+
}
|
2250
|
+
};
|
2251
|
+
this.storeCamera = (camera) => {
|
2252
|
+
this.store.setMainViewCamera(camera);
|
2253
|
+
};
|
2254
|
+
this.storeSize = (size2) => {
|
2255
|
+
this.store.setMainViewSize(size2);
|
1922
2256
|
};
|
1923
2257
|
this.cameraReaction = () => {
|
1924
2258
|
return reaction(() => this.mainViewCamera, (camera) => {
|
1925
|
-
if (camera
|
1926
|
-
|
2259
|
+
if (camera) {
|
2260
|
+
const rawCamera = toJS(camera);
|
2261
|
+
if (!isEqual(rawCamera, this.camera$.value)) {
|
2262
|
+
this.camera$.setValue(rawCamera);
|
2263
|
+
}
|
1927
2264
|
}
|
1928
2265
|
}, { fireImmediately: true });
|
1929
2266
|
};
|
1930
|
-
this.
|
1931
|
-
|
1932
|
-
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
this.setCameraAndSize();
|
1940
|
-
}
|
1941
|
-
};
|
1942
|
-
this.onCameraUpdatedByDevice = (camera) => {
|
1943
|
-
this.synchronizer.onLocalCameraUpdate(camera);
|
1944
|
-
const size2 = this.getStageSize();
|
1945
|
-
if (size2 && !isEqual(size2, this.mainViewSize)) {
|
1946
|
-
this.setMainViewSize(size2);
|
1947
|
-
}
|
2267
|
+
this.sizeReaction = () => {
|
2268
|
+
return reaction(() => this.mainViewSize, (size2) => {
|
2269
|
+
if (size2) {
|
2270
|
+
const rawSize = toJS(size2);
|
2271
|
+
if (!isEqual(rawSize, this.size$.value)) {
|
2272
|
+
this.size$.setValue(rawSize);
|
2273
|
+
}
|
2274
|
+
}
|
2275
|
+
}, { fireImmediately: true });
|
1948
2276
|
};
|
1949
2277
|
this.mainViewClickListener = () => {
|
1950
2278
|
this.mainViewClickHandler();
|
@@ -1955,40 +2283,43 @@ class MainViewProxy {
|
|
1955
2283
|
this.onCameraOrSizeUpdated = () => {
|
1956
2284
|
callbacks$1.emit("cameraStateChange", this.cameraState);
|
1957
2285
|
};
|
1958
|
-
this.synchronizer = new CameraSynchronizer((camera) => this.store.setMainViewCamera(__spreadProps(__spreadValues({}, camera), { id: this.manager.uid })));
|
1959
2286
|
this.mainView = this.createMainView();
|
1960
|
-
this.moveCameraSizeByAttributes();
|
1961
2287
|
emitter.once("mainViewMounted").then(() => {
|
1962
2288
|
this.addMainViewListener();
|
1963
2289
|
this.start();
|
1964
2290
|
this.ensureCameraAndSize();
|
1965
2291
|
this.startListenWritableChange();
|
1966
2292
|
});
|
1967
|
-
this.sideEffectManager.add(() =>
|
1968
|
-
|
1969
|
-
|
1970
|
-
|
1971
|
-
|
1972
|
-
|
1973
|
-
|
2293
|
+
this.sideEffectManager.add(() => [
|
2294
|
+
emitter.on("startReconnect", () => {
|
2295
|
+
releaseView(this.mainView);
|
2296
|
+
})
|
2297
|
+
]);
|
2298
|
+
this.createViewSync();
|
2299
|
+
this.sideEffectManager.add(() => emitter.on("focusedChange", ({ focused }) => {
|
2300
|
+
if (focused === void 0) {
|
2301
|
+
const scenePath = this.store.getMainViewScenePath();
|
2302
|
+
if (scenePath) {
|
2303
|
+
setScenePath(this.manager.room, scenePath);
|
1974
2304
|
}
|
1975
|
-
}
|
1976
|
-
});
|
1977
|
-
const rect = (_a = this.manager.boxManager) == null ? void 0 : _a.stageRect;
|
1978
|
-
if (rect) {
|
1979
|
-
this.synchronizer.setRect(rect);
|
1980
|
-
}
|
1981
|
-
this.sideEffectManager.add(() => {
|
1982
|
-
return emitter.on("playgroundSizeChange", (rect2) => {
|
1983
|
-
this.synchronizer.setRect(rect2);
|
1984
|
-
this.synchronizer.onLocalSizeUpdate(rect2);
|
1985
|
-
});
|
1986
|
-
});
|
2305
|
+
}
|
2306
|
+
}));
|
1987
2307
|
}
|
1988
2308
|
ensureCameraAndSize() {
|
2309
|
+
var _a;
|
1989
2310
|
if (!this.mainViewCamera || !this.mainViewSize) {
|
1990
2311
|
this.manager.dispatchInternalEvent(Events.InitMainViewCamera);
|
1991
|
-
this.
|
2312
|
+
this.storeCamera(__spreadValues({
|
2313
|
+
id: this.manager.uid
|
2314
|
+
}, this.view.camera));
|
2315
|
+
const stageRect = (_a = this.manager.boxManager) == null ? void 0 : _a.stageRect;
|
2316
|
+
if (stageRect && !this.mainViewSize) {
|
2317
|
+
this.storeSize({
|
2318
|
+
id: this.manager.uid,
|
2319
|
+
width: stageRect.width,
|
2320
|
+
height: stageRect.height
|
2321
|
+
});
|
2322
|
+
}
|
1992
2323
|
}
|
1993
2324
|
}
|
1994
2325
|
get mainViewCamera() {
|
@@ -2000,25 +2331,13 @@ class MainViewProxy {
|
|
2000
2331
|
get didRelease() {
|
2001
2332
|
return get(this.view, ["didRelease"]);
|
2002
2333
|
}
|
2003
|
-
moveCameraSizeByAttributes() {
|
2004
|
-
this.synchronizer.onRemoteUpdate(this.mainViewCamera, this.mainViewSize);
|
2005
|
-
}
|
2006
2334
|
start() {
|
2007
2335
|
if (this.started)
|
2008
2336
|
return;
|
2009
|
-
this.sizeChangeHandler(this.mainViewSize);
|
2010
2337
|
this.addCameraListener();
|
2011
2338
|
this.addCameraReaction();
|
2012
2339
|
this.started = true;
|
2013
2340
|
}
|
2014
|
-
setCameraAndSize() {
|
2015
|
-
const stageSize = this.getStageSize();
|
2016
|
-
if (stageSize) {
|
2017
|
-
const camera = __spreadProps(__spreadValues({}, this.mainView.camera), { id: this.manager.uid });
|
2018
|
-
const size2 = __spreadProps(__spreadValues({}, stageSize), { id: this.manager.uid });
|
2019
|
-
this.store.setMainViewCameraAndSize(camera, size2);
|
2020
|
-
}
|
2021
|
-
}
|
2022
2341
|
get view() {
|
2023
2342
|
return this.mainView;
|
2024
2343
|
}
|
@@ -2031,7 +2350,7 @@ class MainViewProxy {
|
|
2031
2350
|
if (mainViewScenePath) {
|
2032
2351
|
setViewFocusScenePath(mainView, mainViewScenePath);
|
2033
2352
|
}
|
2034
|
-
this.
|
2353
|
+
this.view$.setValue(mainView);
|
2035
2354
|
return mainView;
|
2036
2355
|
}
|
2037
2356
|
onReconnect() {
|
@@ -2050,24 +2369,17 @@ class MainViewProxy {
|
|
2050
2369
|
rebind() {
|
2051
2370
|
const divElement = this.mainView.divElement;
|
2052
2371
|
const disableCameraTransform = this.mainView.disableCameraTransform;
|
2372
|
+
const camera = __spreadValues({}, this.mainView.camera);
|
2053
2373
|
this.stop();
|
2054
|
-
|
2055
|
-
this.mainView.release();
|
2056
|
-
}
|
2374
|
+
releaseView(this.mainView);
|
2057
2375
|
this.removeMainViewListener();
|
2058
2376
|
this.mainView = this.createMainView();
|
2059
2377
|
this.mainView.disableCameraTransform = disableCameraTransform;
|
2060
2378
|
this.mainView.divElement = divElement;
|
2379
|
+
this.mainView.moveCamera(__spreadProps(__spreadValues({}, camera), { animationMode: AnimationMode.Immediately }));
|
2061
2380
|
this.addMainViewListener();
|
2062
2381
|
this.start();
|
2063
2382
|
}
|
2064
|
-
getStageSize() {
|
2065
|
-
var _a;
|
2066
|
-
const stage = (_a = this.manager.boxManager) == null ? void 0 : _a.stageRect;
|
2067
|
-
if (stage) {
|
2068
|
-
return { width: stage.width, height: stage.height };
|
2069
|
-
}
|
2070
|
-
}
|
2071
2383
|
addMainViewListener() {
|
2072
2384
|
if (this.mainViewIsAddListener)
|
2073
2385
|
return;
|
@@ -2092,23 +2404,23 @@ class MainViewProxy {
|
|
2092
2404
|
(_a = this.manager.boxManager) == null ? void 0 : _a.blurAllBox();
|
2093
2405
|
}
|
2094
2406
|
addCameraListener() {
|
2095
|
-
this.view.callbacks.on("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
|
2096
2407
|
this.view.callbacks.on("onCameraUpdated", this.onCameraOrSizeUpdated);
|
2097
2408
|
this.view.callbacks.on("onSizeUpdated", this.onCameraOrSizeUpdated);
|
2098
2409
|
}
|
2099
2410
|
removeCameraListener() {
|
2100
|
-
this.view.callbacks.off("onCameraUpdatedByDevice", this.onCameraUpdatedByDevice);
|
2101
2411
|
this.view.callbacks.off("onCameraUpdated", this.onCameraOrSizeUpdated);
|
2102
2412
|
this.view.callbacks.off("onSizeUpdated", this.onCameraOrSizeUpdated);
|
2103
2413
|
}
|
2104
2414
|
stop() {
|
2105
|
-
var _a, _b;
|
2106
2415
|
this.removeCameraListener();
|
2107
|
-
|
2108
|
-
|
2416
|
+
this.manager.refresher.remove(Fields.MainViewCamera);
|
2417
|
+
this.manager.refresher.remove(Fields.MainViewSize);
|
2109
2418
|
this.started = false;
|
2110
2419
|
}
|
2111
2420
|
destroy() {
|
2421
|
+
this.camera$.destroy();
|
2422
|
+
this.size$.destroy();
|
2423
|
+
this.view$.destroy();
|
2112
2424
|
this.removeMainViewListener();
|
2113
2425
|
this.stop();
|
2114
2426
|
this.sideEffectManager.flushAll();
|
@@ -2183,6 +2495,9 @@ class AppManager {
|
|
2183
2495
|
this.mainViewScenesLength = 0;
|
2184
2496
|
this.callbacksNode = null;
|
2185
2497
|
this.appCreateQueue = new AppCreateQueue();
|
2498
|
+
this.sceneIndex$ = new Val(void 0);
|
2499
|
+
this.focused$ = new Val(void 0);
|
2500
|
+
this.members$ = new Val([]);
|
2186
2501
|
this.sideEffectManager = new SideEffectManager();
|
2187
2502
|
this.sceneState = null;
|
2188
2503
|
this.rootDirRemoving = false;
|
@@ -2202,7 +2517,7 @@ class AppManager {
|
|
2202
2517
|
sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
|
2203
2518
|
}
|
2204
2519
|
if (sceneName) {
|
2205
|
-
this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
2520
|
+
await this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
2206
2521
|
}
|
2207
2522
|
await this.setMainViewSceneIndex(nextIndex);
|
2208
2523
|
} else {
|
@@ -2334,8 +2649,7 @@ class AppManager {
|
|
2334
2649
|
this.dispatchInternalEvent(Events.AppBoxStateChange, payload);
|
2335
2650
|
};
|
2336
2651
|
this.addAppsChangeListener = () => {
|
2337
|
-
|
2338
|
-
(_a = this.refresher) == null ? void 0 : _a.add("apps", () => {
|
2652
|
+
this.refresher.add("apps", () => {
|
2339
2653
|
return safeListenPropsUpdated(() => this.attributes.apps, () => {
|
2340
2654
|
this.attributesUpdateCallback(this.attributes.apps);
|
2341
2655
|
});
|
@@ -2350,26 +2664,27 @@ class AppManager {
|
|
2350
2664
|
});
|
2351
2665
|
};
|
2352
2666
|
this.onMainViewIndexChange = (index2) => {
|
2353
|
-
if (index2 !== void 0 && this.
|
2667
|
+
if (index2 !== void 0 && this.sceneIndex$.value !== index2) {
|
2354
2668
|
callbacks$1.emit("mainViewSceneIndexChange", index2);
|
2355
2669
|
emitter.emit("changePageState");
|
2356
2670
|
if (this.callbacksNode) {
|
2357
2671
|
this.updateSceneState(this.callbacksNode);
|
2358
2672
|
}
|
2359
|
-
this.
|
2673
|
+
this.sceneIndex$.setValue(index2);
|
2360
2674
|
}
|
2361
2675
|
};
|
2362
2676
|
this.onFocusChange = (focused) => {
|
2363
2677
|
var _a;
|
2364
|
-
if (this.
|
2678
|
+
if (this.focused$.value !== focused) {
|
2365
2679
|
callbacks$1.emit("focusedChange", focused);
|
2366
|
-
emitter.emit("focusedChange", { focused, prev: this.
|
2367
|
-
this.
|
2680
|
+
emitter.emit("focusedChange", { focused, prev: this.focused$.value });
|
2681
|
+
this.focused$.setValue(focused);
|
2368
2682
|
if (focused !== void 0) {
|
2369
2683
|
(_a = this.boxManager) == null ? void 0 : _a.focusBox({ appId: focused });
|
2370
2684
|
setTimeout(() => {
|
2371
2685
|
const appProxy = this.appProxies.get(focused);
|
2372
2686
|
if (appProxy) {
|
2687
|
+
appProxy.onFocus();
|
2373
2688
|
appRegister.notifyApp(appProxy.kind, "focus", { appId: focused });
|
2374
2689
|
}
|
2375
2690
|
}, 0);
|
@@ -2411,7 +2726,7 @@ class AppManager {
|
|
2411
2726
|
}
|
2412
2727
|
};
|
2413
2728
|
this.closeAll = async () => {
|
2414
|
-
for (const [
|
2729
|
+
for (const [_, appProxy] of this.appProxies.entries()) {
|
2415
2730
|
await appProxy.destroy(true, false, true);
|
2416
2731
|
}
|
2417
2732
|
};
|
@@ -2430,14 +2745,17 @@ class AppManager {
|
|
2430
2745
|
appProxy.appEmitter.emit("roomStateChange", state);
|
2431
2746
|
});
|
2432
2747
|
if (state.roomMembers) {
|
2433
|
-
|
2748
|
+
this.members$.setValue(serializeRoomMembers(state.roomMembers));
|
2434
2749
|
}
|
2435
2750
|
emitter.emit("observerIdChange", this.displayer.observerId);
|
2751
|
+
if (state.memberState) {
|
2752
|
+
emitter.emit("memberStateChange", toJS(state.memberState));
|
2753
|
+
}
|
2436
2754
|
};
|
2437
2755
|
this.displayerWritableListener = (isReadonly) => {
|
2438
2756
|
var _a, _b;
|
2439
2757
|
const isWritable = !isReadonly;
|
2440
|
-
const isManualWritable = this.windowManger.readonly === void 0 || this.windowManger.readonly
|
2758
|
+
const isManualWritable = this.windowManger.readonly === void 0 || !this.windowManger.readonly;
|
2441
2759
|
if (this.windowManger.readonly === void 0) {
|
2442
2760
|
(_a = this.boxManager) == null ? void 0 : _a.setReadonly(isReadonly);
|
2443
2761
|
} else {
|
@@ -2446,13 +2764,10 @@ class AppManager {
|
|
2446
2764
|
this.appProxies.forEach((appProxy) => {
|
2447
2765
|
appProxy.emitAppIsWritableChange();
|
2448
2766
|
});
|
2449
|
-
if (isWritable
|
2450
|
-
this.mainView.disableCameraTransform = false;
|
2767
|
+
if (isWritable) {
|
2451
2768
|
if (this.room && this.room.disableSerialization === true) {
|
2452
2769
|
this.room.disableSerialization = false;
|
2453
2770
|
}
|
2454
|
-
} else {
|
2455
|
-
this.mainView.disableCameraTransform = true;
|
2456
2771
|
}
|
2457
2772
|
emitter.emit("writableChange", isWritable);
|
2458
2773
|
};
|
@@ -2508,9 +2823,10 @@ class AppManager {
|
|
2508
2823
|
appRegister.setSyncRegisterApp((payload) => {
|
2509
2824
|
this.safeUpdateAttributes([Fields.Registered, payload.kind], payload);
|
2510
2825
|
});
|
2826
|
+
this.members$.setValue(serializeRoomMembers(this.displayer.state.roomMembers));
|
2511
2827
|
}
|
2512
2828
|
async onRootDirRemoved(needClose = true) {
|
2513
|
-
this.setMainViewScenePath(INIT_DIR);
|
2829
|
+
await this.setMainViewScenePath(INIT_DIR);
|
2514
2830
|
this.createRootDirScenesCallback();
|
2515
2831
|
for (const [id2, appProxy] of this.appProxies.entries()) {
|
2516
2832
|
if (appProxy.view) {
|
@@ -2518,7 +2834,7 @@ class AppManager {
|
|
2518
2834
|
}
|
2519
2835
|
}
|
2520
2836
|
this.mainViewProxy.rebind();
|
2521
|
-
emitter.emit("rootDirRemoved");
|
2837
|
+
await emitter.emit("rootDirRemoved");
|
2522
2838
|
this.updateRootDirRemoving(false);
|
2523
2839
|
}
|
2524
2840
|
get eventName() {
|
@@ -2545,9 +2861,6 @@ class AppManager {
|
|
2545
2861
|
var _a;
|
2546
2862
|
return ((_a = this.room) == null ? void 0 : _a.uid) || "";
|
2547
2863
|
}
|
2548
|
-
get members() {
|
2549
|
-
return serializeRoomMembers(this.displayer.state.roomMembers);
|
2550
|
-
}
|
2551
2864
|
getMainViewSceneDir() {
|
2552
2865
|
const scenePath = this.store.getMainViewScenePath();
|
2553
2866
|
if (scenePath) {
|
@@ -2557,7 +2870,7 @@ class AppManager {
|
|
2557
2870
|
}
|
2558
2871
|
}
|
2559
2872
|
async onCreated() {
|
2560
|
-
var _a
|
2873
|
+
var _a;
|
2561
2874
|
await this.attributesUpdateCallback(this.attributes.apps);
|
2562
2875
|
emitter.emit("updateManagerRect");
|
2563
2876
|
boxEmitter.on("move", this.onBoxMove);
|
@@ -2567,32 +2880,32 @@ class AppManager {
|
|
2567
2880
|
boxEmitter.on("boxStateChange", this.onBoxStateChange);
|
2568
2881
|
this.addAppsChangeListener();
|
2569
2882
|
this.addAppCloseListener();
|
2570
|
-
|
2883
|
+
this.refresher.add("maximized", () => {
|
2571
2884
|
return autorun(() => {
|
2572
2885
|
var _a2;
|
2573
2886
|
const maximized = this.attributes.maximized;
|
2574
2887
|
(_a2 = this.boxManager) == null ? void 0 : _a2.setMaximized(Boolean(maximized));
|
2575
2888
|
});
|
2576
2889
|
});
|
2577
|
-
|
2890
|
+
this.refresher.add("minimized", () => {
|
2578
2891
|
return autorun(() => {
|
2579
2892
|
const minimized = this.attributes.minimized;
|
2580
2893
|
this.onMinimized(minimized);
|
2581
2894
|
});
|
2582
2895
|
});
|
2583
|
-
|
2896
|
+
this.refresher.add("mainViewIndex", () => {
|
2584
2897
|
return autorun(() => {
|
2585
2898
|
const mainSceneIndex = get(this.attributes, "_mainSceneIndex");
|
2586
2899
|
this.onMainViewIndexChange(mainSceneIndex);
|
2587
2900
|
});
|
2588
2901
|
});
|
2589
|
-
|
2902
|
+
this.refresher.add("focusedChange", () => {
|
2590
2903
|
return autorun(() => {
|
2591
2904
|
const focused = get(this.attributes, "focus");
|
2592
2905
|
this.onFocusChange(focused);
|
2593
2906
|
});
|
2594
2907
|
});
|
2595
|
-
|
2908
|
+
this.refresher.add("registeredChange", () => {
|
2596
2909
|
return autorun(() => {
|
2597
2910
|
const registered = get(this.attributes, Fields.Registered);
|
2598
2911
|
this.onRegisteredChange(registered);
|
@@ -2604,9 +2917,9 @@ class AppManager {
|
|
2604
2917
|
return;
|
2605
2918
|
this.resetScenePath(mainScenePath);
|
2606
2919
|
}
|
2607
|
-
this.displayerWritableListener(!((
|
2920
|
+
this.displayerWritableListener(!((_a = this.room) == null ? void 0 : _a.isWritable));
|
2608
2921
|
this.displayer.callbacks.on("onEnableWriteNowChanged", this.displayerWritableListener);
|
2609
|
-
this.
|
2922
|
+
this.focused$.setValue(this.attributes.focus);
|
2610
2923
|
this.sideEffectManager.add(() => {
|
2611
2924
|
const redoUndo = new RedoUndo({
|
2612
2925
|
mainView: () => this.mainViewProxy.view,
|
@@ -2623,13 +2936,17 @@ class AppManager {
|
|
2623
2936
|
this.appCreateQueue.emitReady();
|
2624
2937
|
}
|
2625
2938
|
const appsWithCreatedAt = appIds.map((appId) => {
|
2626
|
-
|
2627
|
-
|
2628
|
-
|
2629
|
-
|
2939
|
+
if (apps[appId].setup) {
|
2940
|
+
return {
|
2941
|
+
id: appId,
|
2942
|
+
createdAt: apps[appId].createdAt
|
2943
|
+
};
|
2944
|
+
} else {
|
2945
|
+
return {};
|
2946
|
+
}
|
2630
2947
|
});
|
2631
2948
|
for (const { id: id2 } of orderBy(appsWithCreatedAt, "createdAt", "asc")) {
|
2632
|
-
if (!this.appProxies.has(id2) && !this.appStatus.has(id2)) {
|
2949
|
+
if (id2 && !this.appProxies.has(id2) && !this.appStatus.has(id2)) {
|
2633
2950
|
const app = apps[id2];
|
2634
2951
|
try {
|
2635
2952
|
const appAttributes = this.attributes[id2];
|
@@ -2657,6 +2974,7 @@ class AppManager {
|
|
2657
2974
|
}
|
2658
2975
|
setBoxManager(boxManager) {
|
2659
2976
|
this.boxManager = boxManager;
|
2977
|
+
this.mainViewProxy.createViewSync();
|
2660
2978
|
}
|
2661
2979
|
resetMaximized() {
|
2662
2980
|
var _a;
|
@@ -2669,11 +2987,13 @@ class AppManager {
|
|
2669
2987
|
bindMainView(divElement, disableCameraTransform) {
|
2670
2988
|
const mainView = this.mainViewProxy.view;
|
2671
2989
|
mainView.disableCameraTransform = disableCameraTransform;
|
2672
|
-
|
2990
|
+
wait(30).then(() => {
|
2991
|
+
mainView.divElement = divElement;
|
2992
|
+
emitter.emit("mainViewMounted");
|
2993
|
+
});
|
2673
2994
|
if (!mainView.focusScenePath) {
|
2674
2995
|
this.setMainViewFocusPath();
|
2675
2996
|
}
|
2676
|
-
emitter.emit("mainViewMounted");
|
2677
2997
|
}
|
2678
2998
|
setMainViewFocusPath(scenePath) {
|
2679
2999
|
var _a;
|
@@ -2824,6 +3144,7 @@ class AppManager {
|
|
2824
3144
|
}
|
2825
3145
|
}
|
2826
3146
|
async onReconnected() {
|
3147
|
+
this.attributesUpdateCallback(this.attributes.apps);
|
2827
3148
|
const appProxies = Array.from(this.appProxies.values());
|
2828
3149
|
const reconnected = appProxies.map((appProxy) => {
|
2829
3150
|
return appProxy.onReconnected();
|
@@ -2855,8 +3176,9 @@ class AppManager {
|
|
2855
3176
|
}
|
2856
3177
|
callbacks$1.clearListeners();
|
2857
3178
|
this.sideEffectManager.flushAll();
|
2858
|
-
this.
|
2859
|
-
this.
|
3179
|
+
this.sceneIndex$.destroy();
|
3180
|
+
this.focused$.destroy();
|
3181
|
+
this.members$.destroy();
|
2860
3182
|
}
|
2861
3183
|
}
|
2862
3184
|
/*! *****************************************************************************
|
@@ -3020,7 +3342,7 @@ var startLoop = function() {
|
|
3020
3342
|
if (!isProcessing)
|
3021
3343
|
onNextFrame(processFrame);
|
3022
3344
|
};
|
3023
|
-
var clamp$
|
3345
|
+
var clamp$2 = function(min, max) {
|
3024
3346
|
return function(v2) {
|
3025
3347
|
return Math.max(Math.min(v2, max), min);
|
3026
3348
|
};
|
@@ -3038,7 +3360,7 @@ var number = {
|
|
3038
3360
|
return v2;
|
3039
3361
|
}
|
3040
3362
|
};
|
3041
|
-
var alpha = __assign(__assign({}, number), { transform: clamp$
|
3363
|
+
var alpha = __assign(__assign({}, number), { transform: clamp$2(0, 1) });
|
3042
3364
|
var scale = __assign(__assign({}, number), { default: 1 });
|
3043
3365
|
var createUnitType = function(unit) {
|
3044
3366
|
return {
|
@@ -3062,7 +3384,7 @@ var progressPercentage = __assign(__assign({}, percent), { parse: function(v2) {
|
|
3062
3384
|
var getValueFromFunctionString = function(value) {
|
3063
3385
|
return value.substring(value.indexOf("(") + 1, value.lastIndexOf(")"));
|
3064
3386
|
};
|
3065
|
-
var clampRgbUnit = clamp$
|
3387
|
+
var clampRgbUnit = clamp$2(0, 255);
|
3066
3388
|
var isRgba = function(v2) {
|
3067
3389
|
return v2.red !== void 0;
|
3068
3390
|
};
|
@@ -3701,190 +4023,423 @@ var shallowequal = function shallowEqual(objA, objB, compare, compareContext) {
|
|
3701
4023
|
}
|
3702
4024
|
return true;
|
3703
4025
|
};
|
3704
|
-
var
|
3705
|
-
|
3706
|
-
|
3707
|
-
|
3708
|
-
|
3709
|
-
|
3710
|
-
|
3711
|
-
|
3712
|
-
|
3713
|
-
|
3714
|
-
|
3715
|
-
return
|
3716
|
-
}
|
3717
|
-
|
3718
|
-
|
3719
|
-
|
3720
|
-
|
3721
|
-
|
3722
|
-
|
3723
|
-
|
3724
|
-
|
3725
|
-
|
4026
|
+
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-boxColor, #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-boxContainerBackground, #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-boxStageBackground, #fff);\n boxShadow: 0px 0px 16px rgba(0, 0, 0, 0.08);\n boxShadow: var(--tele-boxStageShadow, 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-boxFooterColor, #191919);\n background-color: #fff;\n background-color: var(--tele-boxFooterBackground, #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-boxColor, #e9e9e9);\n}\n.telebox-color-scheme-dark .telebox-content {\n background-color: #25282e;\n background-color: var(--tele-boxContainerBackground, #25282e);\n}\n.telebox-color-scheme-dark .telebox-box-stage {\n background-color: #272a30;\n background-color: var(--tele-boxStageBackground, #272a30);\n boxShadow: 0px 0px 16px rgba(0, 0, 0, 0.24);\n boxShadow: var(--tele-boxStageShadow, 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-boxFooterColor, #e9e9e9);\n background-color: #383b42;\n background-color: var(--tele-boxFooterBackground, #383b42);\n}')();
|
4027
|
+
var TELE_BOX_COLOR_SCHEME = /* @__PURE__ */ ((TELE_BOX_COLOR_SCHEME2) => {
|
4028
|
+
TELE_BOX_COLOR_SCHEME2["Light"] = "light";
|
4029
|
+
TELE_BOX_COLOR_SCHEME2["Dark"] = "dark";
|
4030
|
+
TELE_BOX_COLOR_SCHEME2["Auto"] = "auto";
|
4031
|
+
return TELE_BOX_COLOR_SCHEME2;
|
4032
|
+
})(TELE_BOX_COLOR_SCHEME || {});
|
4033
|
+
var TELE_BOX_STATE = /* @__PURE__ */ ((TELE_BOX_STATE2) => {
|
4034
|
+
TELE_BOX_STATE2["Normal"] = "normal";
|
4035
|
+
TELE_BOX_STATE2["Minimized"] = "minimized";
|
4036
|
+
TELE_BOX_STATE2["Maximized"] = "maximized";
|
4037
|
+
return TELE_BOX_STATE2;
|
4038
|
+
})(TELE_BOX_STATE || {});
|
4039
|
+
var TELE_BOX_EVENT = /* @__PURE__ */ ((TELE_BOX_EVENT2) => {
|
4040
|
+
TELE_BOX_EVENT2["DarkMode"] = "dark_mode";
|
4041
|
+
TELE_BOX_EVENT2["PrefersColorScheme"] = "prefers_color_scheme";
|
4042
|
+
TELE_BOX_EVENT2["Close"] = "close";
|
4043
|
+
TELE_BOX_EVENT2["Focus"] = "focus";
|
4044
|
+
TELE_BOX_EVENT2["Blur"] = "blur";
|
4045
|
+
TELE_BOX_EVENT2["IntrinsicMove"] = "intrinsic_move";
|
4046
|
+
TELE_BOX_EVENT2["IntrinsicResize"] = "intrinsic_resize";
|
4047
|
+
TELE_BOX_EVENT2["ZIndex"] = "z_index";
|
4048
|
+
TELE_BOX_EVENT2["State"] = "state";
|
4049
|
+
TELE_BOX_EVENT2["Minimized"] = "minimized";
|
4050
|
+
TELE_BOX_EVENT2["Maximized"] = "maximized";
|
4051
|
+
TELE_BOX_EVENT2["Readonly"] = "readonly";
|
4052
|
+
TELE_BOX_EVENT2["Destroyed"] = "destroyed";
|
4053
|
+
return TELE_BOX_EVENT2;
|
4054
|
+
})(TELE_BOX_EVENT || {});
|
4055
|
+
var TELE_BOX_DELEGATE_EVENT = /* @__PURE__ */ ((TELE_BOX_DELEGATE_EVENT2) => {
|
4056
|
+
TELE_BOX_DELEGATE_EVENT2["Close"] = "close";
|
4057
|
+
TELE_BOX_DELEGATE_EVENT2["Maximize"] = "maximize";
|
4058
|
+
TELE_BOX_DELEGATE_EVENT2["Minimize"] = "minimize";
|
4059
|
+
return TELE_BOX_DELEGATE_EVENT2;
|
4060
|
+
})(TELE_BOX_DELEGATE_EVENT || {});
|
4061
|
+
var TELE_BOX_RESIZE_HANDLE = /* @__PURE__ */ ((TELE_BOX_RESIZE_HANDLE2) => {
|
4062
|
+
TELE_BOX_RESIZE_HANDLE2["North"] = "n";
|
4063
|
+
TELE_BOX_RESIZE_HANDLE2["South"] = "s";
|
4064
|
+
TELE_BOX_RESIZE_HANDLE2["West"] = "w";
|
4065
|
+
TELE_BOX_RESIZE_HANDLE2["East"] = "e";
|
4066
|
+
TELE_BOX_RESIZE_HANDLE2["NorthWest"] = "nw";
|
4067
|
+
TELE_BOX_RESIZE_HANDLE2["NorthEast"] = "ne";
|
4068
|
+
TELE_BOX_RESIZE_HANDLE2["SouthEast"] = "se";
|
4069
|
+
TELE_BOX_RESIZE_HANDLE2["SouthWest"] = "sw";
|
4070
|
+
return TELE_BOX_RESIZE_HANDLE2;
|
4071
|
+
})(TELE_BOX_RESIZE_HANDLE || {});
|
4072
|
+
const TeleBoxDragHandleType = "dh";
|
4073
|
+
function clamp$1(value, min, max) {
|
4074
|
+
return Math.min(Math.max(value, min), max);
|
3726
4075
|
}
|
3727
|
-
function
|
3728
|
-
|
4076
|
+
function preventEvent$1(ev) {
|
4077
|
+
ev.stopPropagation();
|
4078
|
+
if (ev.cancelable) {
|
4079
|
+
ev.preventDefault();
|
4080
|
+
}
|
3729
4081
|
}
|
3730
|
-
|
3731
|
-
|
4082
|
+
let defaultBoxCount = 1;
|
4083
|
+
function getBoxDefaultName() {
|
4084
|
+
return `New Box ${defaultBoxCount++}`;
|
3732
4085
|
}
|
3733
|
-
class
|
3734
|
-
constructor({
|
3735
|
-
|
3736
|
-
|
3737
|
-
|
3738
|
-
|
3739
|
-
|
3740
|
-
|
3741
|
-
|
4086
|
+
class DefaultTitleBar {
|
4087
|
+
constructor({
|
4088
|
+
readonly$,
|
4089
|
+
state$,
|
4090
|
+
title$,
|
4091
|
+
buttons,
|
4092
|
+
onEvent,
|
4093
|
+
onDragStart,
|
4094
|
+
namespace = "telebox"
|
4095
|
+
}) {
|
4096
|
+
this.sideEffect = new SideEffectManager();
|
4097
|
+
this.lastTitleBarClick = {
|
4098
|
+
timestamp: 0,
|
4099
|
+
clientX: -100,
|
4100
|
+
clientY: -100
|
4101
|
+
};
|
4102
|
+
this.handleTitleBarClick = (ev) => {
|
4103
|
+
var _a;
|
4104
|
+
if (!ev.isPrimary || this.readonly$.value) {
|
3742
4105
|
return;
|
3743
|
-
|
3744
|
-
|
3745
|
-
i3 - this.lastTitleBarClick.timestamp <= 500 ? Math.abs(e3.clientX - this.lastTitleBarClick.clientX) <= 5 && Math.abs(e3.clientY - this.lastTitleBarClick.clientY) <= 5 && this.onEvent && this.onEvent({ type: B$2.Maximize }) : this.onDragStart && this.onDragStart(e3), this.lastTitleBarClick.timestamp = i3, this.lastTitleBarClick.clientX = e3.clientX, this.lastTitleBarClick.clientY = e3.clientY;
|
3746
|
-
}, this.lastTitleBarTouch = { timestamp: 0, clientX: -100, clientY: -100 }, this.handleTitleBarTouch = (e3) => {
|
3747
|
-
var t3;
|
3748
|
-
if (this.readonly$.value)
|
4106
|
+
}
|
4107
|
+
if (ev.button !== 0) {
|
3749
4108
|
return;
|
3750
|
-
|
4109
|
+
}
|
4110
|
+
if ((_a = ev.target.dataset) == null ? void 0 : _a.teleTitleBarNoDblClick) {
|
3751
4111
|
return;
|
3752
|
-
|
3753
|
-
|
3754
|
-
|
3755
|
-
|
4112
|
+
}
|
4113
|
+
preventEvent$1(ev);
|
4114
|
+
const now = Date.now();
|
4115
|
+
if (now - this.lastTitleBarClick.timestamp <= 500) {
|
4116
|
+
if (Math.abs(ev.clientX - this.lastTitleBarClick.clientX) <= 5 && Math.abs(ev.clientY - this.lastTitleBarClick.clientY) <= 5) {
|
4117
|
+
if (this.onEvent) {
|
4118
|
+
this.onEvent({ type: TELE_BOX_DELEGATE_EVENT.Maximize });
|
4119
|
+
}
|
4120
|
+
}
|
4121
|
+
} else if (this.onDragStart) {
|
4122
|
+
this.onDragStart(ev);
|
4123
|
+
}
|
4124
|
+
this.lastTitleBarClick.timestamp = now;
|
4125
|
+
this.lastTitleBarClick.clientX = ev.clientX;
|
4126
|
+
this.lastTitleBarClick.clientY = ev.clientY;
|
4127
|
+
};
|
4128
|
+
this.readonly$ = readonly$;
|
4129
|
+
this.state$ = state$;
|
4130
|
+
this.title$ = title$;
|
4131
|
+
this.onEvent = onEvent;
|
4132
|
+
this.onDragStart = onDragStart;
|
4133
|
+
this.namespace = namespace;
|
4134
|
+
this.buttons = buttons || [
|
4135
|
+
{
|
4136
|
+
type: TELE_BOX_DELEGATE_EVENT.Minimize,
|
4137
|
+
iconClassName: this.wrapClassName("titlebar-icon-minimize")
|
4138
|
+
},
|
4139
|
+
{
|
4140
|
+
type: TELE_BOX_DELEGATE_EVENT.Maximize,
|
4141
|
+
iconClassName: this.wrapClassName("titlebar-icon-maximize"),
|
4142
|
+
isActive: (state) => state === TELE_BOX_STATE.Maximized
|
4143
|
+
},
|
4144
|
+
{
|
4145
|
+
type: TELE_BOX_DELEGATE_EVENT.Close,
|
4146
|
+
iconClassName: this.wrapClassName("titlebar-icon-close")
|
4147
|
+
}
|
4148
|
+
];
|
4149
|
+
this.$dragArea = this.renderDragArea();
|
3756
4150
|
}
|
3757
4151
|
render() {
|
3758
4152
|
if (!this.$titleBar) {
|
3759
|
-
this.$titleBar = document.createElement("div")
|
3760
|
-
|
3761
|
-
|
3762
|
-
|
3763
|
-
|
3764
|
-
const
|
3765
|
-
|
3766
|
-
|
3767
|
-
|
3768
|
-
|
3769
|
-
|
3770
|
-
|
3771
|
-
|
3772
|
-
|
3773
|
-
|
4153
|
+
this.$titleBar = document.createElement("div");
|
4154
|
+
this.$titleBar.className = this.wrapClassName("titlebar");
|
4155
|
+
const $titleArea = document.createElement("div");
|
4156
|
+
$titleArea.className = this.wrapClassName("title-area");
|
4157
|
+
$titleArea.dataset.teleBoxHandle = TeleBoxDragHandleType;
|
4158
|
+
const $title = document.createElement("h1");
|
4159
|
+
$title.className = this.wrapClassName("title");
|
4160
|
+
$title.dataset.teleBoxHandle = TeleBoxDragHandleType;
|
4161
|
+
$titleArea.appendChild($title);
|
4162
|
+
$titleArea.appendChild(this.$dragArea);
|
4163
|
+
const $buttonsContainer = document.createElement("div");
|
4164
|
+
$buttonsContainer.className = this.wrapClassName("titlebar-btns");
|
4165
|
+
this.buttons.forEach(({ iconClassName }, i2) => {
|
4166
|
+
const teleTitleBarBtnIndex = String(i2);
|
4167
|
+
const $btn = document.createElement("button");
|
4168
|
+
$btn.className = `${this.wrapClassName("titlebar-btn")} ${iconClassName}`;
|
4169
|
+
$btn.dataset.teleTitleBarBtnIndex = teleTitleBarBtnIndex;
|
4170
|
+
$btn.dataset.teleTitleBarNoDblClick = "true";
|
4171
|
+
$buttonsContainer.appendChild($btn);
|
4172
|
+
});
|
4173
|
+
this.sideEffect.addDisposer(this.title$.subscribe((title) => {
|
4174
|
+
$title.textContent = title;
|
4175
|
+
$title.title = title;
|
4176
|
+
}), "render-title");
|
4177
|
+
this.sideEffect.addDisposer(this.state$.subscribe((state) => {
|
4178
|
+
this.buttons.forEach((btn, i2) => {
|
4179
|
+
var _a;
|
4180
|
+
if (btn.isActive) {
|
4181
|
+
(_a = $buttonsContainer.children[i2]) == null ? void 0 : _a.classList.toggle("is-active", btn.isActive(state));
|
4182
|
+
}
|
3774
4183
|
});
|
3775
|
-
}), "render-state-btns")
|
3776
|
-
|
3777
|
-
|
4184
|
+
}), "render-state-btns");
|
4185
|
+
this.sideEffect.addEventListener($buttonsContainer, "click", (ev) => {
|
4186
|
+
var _a;
|
4187
|
+
if (this.readonly$.value) {
|
3778
4188
|
return;
|
3779
|
-
const i3 = e3.target, s2 = Number((t3 = i3.dataset) == null ? void 0 : t3.teleTitleBarBtnIndex);
|
3780
|
-
if (!Number.isNaN(s2) && s2 < this.buttons.length) {
|
3781
|
-
k$1(e3);
|
3782
|
-
const t4 = this.buttons[s2];
|
3783
|
-
this.onEvent && this.onEvent({ type: t4.type, value: t4.value });
|
3784
4189
|
}
|
3785
|
-
|
4190
|
+
const target = ev.target;
|
4191
|
+
const teleTitleBarBtnIndex = Number((_a = target.dataset) == null ? void 0 : _a.teleTitleBarBtnIndex);
|
4192
|
+
if (!Number.isNaN(teleTitleBarBtnIndex) && teleTitleBarBtnIndex < this.buttons.length) {
|
4193
|
+
preventEvent$1(ev);
|
4194
|
+
const btn = this.buttons[teleTitleBarBtnIndex];
|
4195
|
+
if (this.onEvent) {
|
4196
|
+
this.onEvent({
|
4197
|
+
type: btn.type,
|
4198
|
+
value: btn.value
|
4199
|
+
});
|
4200
|
+
}
|
4201
|
+
}
|
4202
|
+
}, {}, "render-btns-container-click");
|
4203
|
+
this.$titleBar.appendChild($titleArea);
|
4204
|
+
this.$titleBar.appendChild($buttonsContainer);
|
3786
4205
|
}
|
3787
4206
|
return this.$titleBar;
|
3788
4207
|
}
|
3789
4208
|
renderDragArea() {
|
3790
|
-
const
|
3791
|
-
|
4209
|
+
const $dragArea = document.createElement("div");
|
4210
|
+
$dragArea.className = this.wrapClassName("drag-area");
|
4211
|
+
$dragArea.dataset.teleBoxHandle = TeleBoxDragHandleType;
|
4212
|
+
this.sideEffect.addEventListener($dragArea, "pointerdown", this.handleTitleBarClick);
|
4213
|
+
return $dragArea;
|
3792
4214
|
}
|
3793
4215
|
dragHandle() {
|
3794
4216
|
return this.$titleBar;
|
3795
4217
|
}
|
3796
|
-
wrapClassName(
|
3797
|
-
return `${this.namespace}-${
|
4218
|
+
wrapClassName(className) {
|
4219
|
+
return `${this.namespace}-${className}`;
|
3798
4220
|
}
|
3799
4221
|
destroy() {
|
3800
|
-
this.sideEffect.flushAll()
|
3801
|
-
|
3802
|
-
|
3803
|
-
|
3804
|
-
|
3805
|
-
|
3806
|
-
if (t3 <= 0 || e3.width <= 0 || e3.height <= 0)
|
3807
|
-
return e3;
|
3808
|
-
const i3 = e3.width * t3;
|
3809
|
-
if (i3 === e3.height)
|
3810
|
-
return e3;
|
3811
|
-
if (i3 < e3.height)
|
3812
|
-
return { x: 0, y: (e3.height - i3) / 2, width: e3.width, height: i3 };
|
3813
|
-
const s3 = e3.height / t3;
|
3814
|
-
return { x: (e3.width - s3) / 2, y: 0, width: s3, height: e3.height };
|
3815
|
-
}, { compare: shallowequal }), this._sideEffect.addDisposer(combine([a2, s2]).subscribe(([e3, t3]) => {
|
3816
|
-
var i3;
|
3817
|
-
e3 && t3 ? e3.appendChild(this.render()) : ((i3 = this.$boxStage) == null ? void 0 : i3.parentNode) && this.$boxStage.remove();
|
3818
|
-
}));
|
4222
|
+
this.sideEffect.flushAll();
|
4223
|
+
if (this.$titleBar) {
|
4224
|
+
this.$titleBar = void 0;
|
4225
|
+
this.onDragStart = void 0;
|
4226
|
+
this.onEvent = void 0;
|
4227
|
+
}
|
3819
4228
|
}
|
3820
|
-
|
3821
|
-
|
3822
|
-
|
3823
|
-
|
3824
|
-
e2.className = this.wrapClassName("box-stage-container");
|
3825
|
-
const t2 = document.createElement("div");
|
3826
|
-
t2.className = this.wrapClassName("box-stage-mask");
|
3827
|
-
const i2 = document.createElement("div");
|
3828
|
-
i2.className = this.wrapClassName("box-stage-mask");
|
3829
|
-
const s2 = document.createElement("div");
|
3830
|
-
s2.className = this.wrapClassName("box-stage-frame");
|
3831
|
-
const [a2, o2, r2, n2] = ["M0 8V0h8v2H2v6H0Z", "M8 8V0H0v2h6v6h2Z", "M0 0v8h8V6H2V0H0Z", "M8 0v8H0V6h6V0h2Z"].map((e3, t3) => {
|
3832
|
-
const i3 = document.createElementNS("http://www.w3.org/2000/svg", "svg");
|
3833
|
-
i3.setAttribute("viewBox", "0 0 8 8"), i3.setAttribute("class", `${this.wrapClassName("box-stage-frame-corner")} is-${t3}`);
|
3834
|
-
const s3 = document.createElementNS("http://www.w3.org/2000/svg", "path");
|
3835
|
-
return s3.setAttribute("d", e3), s3.setAttribute("fill", "#3381FF"), i3.appendChild(s3), i3;
|
3836
|
-
});
|
3837
|
-
return s2.appendChild(a2), s2.appendChild(r2), s2.appendChild(o2), s2.appendChild(n2), e2.appendChild(t2), e2.appendChild(s2), e2.appendChild(i2), this._sideEffect.addDisposer(this.highlightStage$.subscribe((t3) => {
|
3838
|
-
e2.classList.toggle("is-active", t3);
|
3839
|
-
})), this._sideEffect.addDisposer(combine([this.highlightStage$, this.stageRect$]).subscribe(([s3, a3]) => {
|
3840
|
-
s3 && (a3.x > 0 ? (e2.style.flexDirection = "row", t2.style.width = `${a3.x}px`, t2.style.height = "", i2.style.width = `${a3.x}px`, i2.style.height = "") : a3.y > 0 && (e2.style.flexDirection = "column", t2.style.width = "", t2.style.height = `${a3.y}px`, i2.style.width = "", i2.style.height = `${a3.y}px`));
|
3841
|
-
})), this.$boxStage = e2, e2;
|
4229
|
+
}
|
4230
|
+
function calcStageRect([rootRect, ratio]) {
|
4231
|
+
if (ratio <= 0 || rootRect.width <= 0 || rootRect.height <= 0) {
|
4232
|
+
return rootRect;
|
3842
4233
|
}
|
3843
|
-
|
3844
|
-
|
4234
|
+
const preferredHeight = rootRect.width * ratio;
|
4235
|
+
if (preferredHeight === rootRect.height) {
|
4236
|
+
return rootRect;
|
3845
4237
|
}
|
3846
|
-
|
3847
|
-
return
|
3848
|
-
|
3849
|
-
|
3850
|
-
|
3851
|
-
|
3852
|
-
|
3853
|
-
|
3854
|
-
|
3855
|
-
|
3856
|
-
|
3857
|
-
|
3858
|
-
|
3859
|
-
|
3860
|
-
|
3861
|
-
|
4238
|
+
if (preferredHeight < rootRect.height) {
|
4239
|
+
return {
|
4240
|
+
x: 0,
|
4241
|
+
y: (rootRect.height - preferredHeight) / 2,
|
4242
|
+
width: rootRect.width,
|
4243
|
+
height: preferredHeight
|
4244
|
+
};
|
4245
|
+
}
|
4246
|
+
const preferredWidth = rootRect.height / ratio;
|
4247
|
+
return {
|
4248
|
+
x: (rootRect.width - preferredWidth) / 2,
|
4249
|
+
y: 0,
|
4250
|
+
width: preferredWidth,
|
4251
|
+
height: rootRect.height
|
4252
|
+
};
|
4253
|
+
}
|
4254
|
+
const ResizeObserver$1$1 = window.ResizeObserver || ResizeObserver$3;
|
4255
|
+
class TeleBox {
|
4256
|
+
constructor({
|
4257
|
+
id: id2 = genUID(),
|
4258
|
+
title = getBoxDefaultName(),
|
4259
|
+
namespace = "telebox",
|
4260
|
+
visible = true,
|
4261
|
+
width = 0.5,
|
4262
|
+
height = 0.5,
|
4263
|
+
minWidth = 0,
|
4264
|
+
minHeight = 0,
|
4265
|
+
x: x2 = 0.1,
|
4266
|
+
y: y2 = 0.1,
|
4267
|
+
resizable = true,
|
4268
|
+
draggable = true,
|
4269
|
+
boxRatio = -1,
|
4270
|
+
focus = false,
|
4271
|
+
zIndex = 100,
|
4272
|
+
stageRatio = null,
|
4273
|
+
enableShadowDOM = true,
|
4274
|
+
titleBar,
|
4275
|
+
content,
|
4276
|
+
stage,
|
4277
|
+
footer,
|
4278
|
+
styles: styles2,
|
4279
|
+
userStyles,
|
4280
|
+
bodyStyle = null,
|
4281
|
+
stageStyle = null,
|
4282
|
+
darkMode$,
|
4283
|
+
fence$,
|
4284
|
+
minimized$,
|
4285
|
+
maximized$,
|
4286
|
+
readonly$,
|
4287
|
+
root,
|
4288
|
+
rootRect$,
|
4289
|
+
managerStageRect$,
|
4290
|
+
managerStageRatio$,
|
4291
|
+
defaultBoxBodyStyle$,
|
4292
|
+
defaultBoxStageStyle$,
|
4293
|
+
collectorRect$
|
4294
|
+
}) {
|
4295
|
+
this.events = new Emittery();
|
4296
|
+
this._delegateEvents = new Emittery();
|
4297
|
+
this.handleTrackStart = (ev) => {
|
4298
|
+
var _a;
|
4299
|
+
return (_a = this._handleTrackStart) == null ? void 0 : _a.call(this, ev);
|
4300
|
+
};
|
4301
|
+
this._sideEffect = new SideEffectManager();
|
4302
|
+
this.id = id2;
|
4303
|
+
this.namespace = namespace;
|
4304
|
+
this.enableShadowDOM = enableShadowDOM;
|
4305
|
+
const valManager = new ValManager();
|
4306
|
+
this._sideEffect.addDisposer(() => valManager.destroy());
|
4307
|
+
const title$ = new Val(title);
|
4308
|
+
const visible$ = new Val(visible);
|
4309
|
+
const resizable$ = new Val(resizable);
|
4310
|
+
const draggable$ = new Val(draggable);
|
4311
|
+
const boxRatio$ = new Val(boxRatio);
|
4312
|
+
const zIndex$ = new Val(zIndex);
|
4313
|
+
const focus$ = new Val(focus);
|
4314
|
+
const state$ = combine([minimized$, maximized$], ([minimized, maximized]) => minimized ? TELE_BOX_STATE.Minimized : maximized ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal);
|
4315
|
+
const minSize$ = new Val({
|
4316
|
+
width: clamp$1(minWidth, 0, 1),
|
4317
|
+
height: clamp$1(minHeight, 0, 1)
|
4318
|
+
}, { compare: shallowequal });
|
4319
|
+
const pxMinSize$ = combine([minSize$, managerStageRect$], ([minSize, managerStageRect]) => ({
|
4320
|
+
width: minSize.width * managerStageRect.width,
|
4321
|
+
height: minSize.height * managerStageRect.height
|
4322
|
+
}), { compare: shallowequal });
|
4323
|
+
const intrinsicSize$ = new Val({ width, height }, { compare: shallowequal });
|
4324
|
+
this._sideEffect.addDisposer(minSize$.reaction((minSize, skipUpdate) => {
|
4325
|
+
intrinsicSize$.setValue({
|
4326
|
+
width: Math.max(width, minSize.width),
|
4327
|
+
height: Math.max(height, minSize.height)
|
4328
|
+
}, skipUpdate);
|
3862
4329
|
}));
|
3863
|
-
const
|
3864
|
-
|
3865
|
-
|
3866
|
-
|
3867
|
-
|
3868
|
-
|
3869
|
-
|
3870
|
-
|
3871
|
-
},
|
3872
|
-
|
3873
|
-
|
3874
|
-
|
3875
|
-
|
3876
|
-
|
3877
|
-
|
3878
|
-
|
4330
|
+
const intrinsicCoord$ = new Val({ x: x2, y: y2 }, { compare: shallowequal });
|
4331
|
+
const pxIntrinsicSize$ = combine([intrinsicSize$, managerStageRect$], ([size2, managerStageRect]) => ({
|
4332
|
+
width: managerStageRect.width * size2.width,
|
4333
|
+
height: managerStageRect.height * size2.height
|
4334
|
+
}), { compare: shallowequal });
|
4335
|
+
const pxIntrinsicCoord$ = combine([intrinsicCoord$, managerStageRect$], ([intrinsicCoord, managerStageRect]) => ({
|
4336
|
+
x: intrinsicCoord.x * managerStageRect.width,
|
4337
|
+
y: intrinsicCoord.y * managerStageRect.height
|
4338
|
+
}), { compare: shallowequal });
|
4339
|
+
const bodyStyle$ = new Val(bodyStyle);
|
4340
|
+
const stageStyle$ = new Val(stageStyle);
|
4341
|
+
const contentRoot$ = new Val(null);
|
4342
|
+
const bodyRect$ = new Val(managerStageRect$.value, {
|
4343
|
+
compare: shallowequal
|
4344
|
+
});
|
4345
|
+
const stageRatio$ = new Val(stageRatio);
|
4346
|
+
const finalStageRatio$ = combine([stageRatio$, managerStageRatio$], ([stageRatio2, managerStageRatio]) => stageRatio2 != null ? stageRatio2 : managerStageRatio);
|
4347
|
+
const stageRect$ = combine([bodyRect$, finalStageRatio$], calcStageRect, { compare: shallowequal });
|
4348
|
+
const propsValConfig = {
|
4349
|
+
darkMode: darkMode$,
|
4350
|
+
fence: fence$,
|
4351
|
+
minimized: minimized$,
|
4352
|
+
maximized: maximized$,
|
4353
|
+
readonly: readonly$,
|
4354
|
+
rootRect: rootRect$,
|
4355
|
+
managerStageRect: managerStageRect$,
|
4356
|
+
managerStageRatio: managerStageRatio$,
|
4357
|
+
defaultBoxBodyStyle: defaultBoxBodyStyle$,
|
4358
|
+
defaultBoxStageStyle: defaultBoxStageStyle$,
|
4359
|
+
collectorRect: collectorRect$
|
4360
|
+
};
|
4361
|
+
withReadonlyValueEnhancer(this, propsValConfig);
|
4362
|
+
const myReadonlyValConfig = {
|
4363
|
+
zIndex: zIndex$,
|
4364
|
+
focus: focus$,
|
4365
|
+
state: state$,
|
4366
|
+
minSize: minSize$,
|
4367
|
+
pxMinSize: pxMinSize$,
|
4368
|
+
intrinsicSize: intrinsicSize$,
|
4369
|
+
intrinsicCoord: intrinsicCoord$,
|
4370
|
+
pxIntrinsicSize: pxIntrinsicSize$,
|
4371
|
+
pxIntrinsicCoord: pxIntrinsicCoord$,
|
4372
|
+
bodyRect: bodyRect$,
|
4373
|
+
stageRect: stageRect$
|
4374
|
+
};
|
4375
|
+
withReadonlyValueEnhancer(this, myReadonlyValConfig, valManager);
|
4376
|
+
const valConfig = {
|
4377
|
+
title: title$,
|
4378
|
+
visible: visible$,
|
4379
|
+
resizable: resizable$,
|
4380
|
+
draggable: draggable$,
|
4381
|
+
boxRatio: boxRatio$,
|
4382
|
+
stageRatio: stageRatio$,
|
4383
|
+
bodyStyle: bodyStyle$,
|
4384
|
+
stageStyle: stageStyle$
|
4385
|
+
};
|
4386
|
+
withValueEnhancer(this, valConfig, valManager);
|
4387
|
+
this.titleBar = titleBar || new DefaultTitleBar({
|
4388
|
+
readonly$,
|
4389
|
+
state$,
|
4390
|
+
title$,
|
4391
|
+
namespace: this.namespace,
|
4392
|
+
onDragStart: (event) => {
|
4393
|
+
var _a;
|
4394
|
+
return (_a = this._handleTrackStart) == null ? void 0 : _a.call(this, event);
|
4395
|
+
},
|
4396
|
+
onEvent: (event) => this._delegateEvents.emit(event.type)
|
4397
|
+
});
|
4398
|
+
this._sideEffect.addDisposer(boxRatio$.subscribe((boxRatio2) => {
|
4399
|
+
if (boxRatio2 > 0) {
|
4400
|
+
this.transform(pxIntrinsicCoord$.value.x, pxIntrinsicCoord$.value.y, pxIntrinsicSize$.value.width, pxIntrinsicSize$.value.height);
|
4401
|
+
}
|
4402
|
+
}));
|
4403
|
+
this._sideEffect.addDisposer(fence$.subscribe((fence) => {
|
4404
|
+
if (fence) {
|
4405
|
+
this.move(pxIntrinsicCoord$.value.x, pxIntrinsicCoord$.value.y);
|
4406
|
+
}
|
4407
|
+
}));
|
4408
|
+
this.$box = this._render();
|
4409
|
+
contentRoot$.setValue(this.$content.parentElement);
|
4410
|
+
content && this.mountContent(content);
|
4411
|
+
stage && this.mountStage(stage);
|
4412
|
+
footer && this.mountFooter(footer);
|
4413
|
+
styles2 && this.mountStyles(styles2);
|
4414
|
+
userStyles && this.mountUserStyles(userStyles);
|
4415
|
+
root.appendChild(this.$box);
|
4416
|
+
const watchValEvent = (val, event) => {
|
4417
|
+
this._sideEffect.addDisposer(val.reaction((v2, skipUpdate) => {
|
4418
|
+
if (!skipUpdate) {
|
4419
|
+
this.events.emit(event, v2);
|
4420
|
+
}
|
3879
4421
|
}));
|
3880
4422
|
};
|
3881
|
-
|
3882
|
-
|
3883
|
-
|
3884
|
-
|
3885
|
-
|
3886
|
-
|
3887
|
-
|
4423
|
+
watchValEvent(darkMode$, TELE_BOX_EVENT.DarkMode);
|
4424
|
+
watchValEvent(readonly$, TELE_BOX_EVENT.Readonly);
|
4425
|
+
watchValEvent(zIndex$, TELE_BOX_EVENT.ZIndex);
|
4426
|
+
watchValEvent(minimized$, TELE_BOX_EVENT.Minimized);
|
4427
|
+
watchValEvent(maximized$, TELE_BOX_EVENT.Maximized);
|
4428
|
+
watchValEvent(state$, TELE_BOX_EVENT.State);
|
4429
|
+
watchValEvent(intrinsicSize$, TELE_BOX_EVENT.IntrinsicResize);
|
4430
|
+
watchValEvent(intrinsicCoord$, TELE_BOX_EVENT.IntrinsicMove);
|
4431
|
+
this._sideEffect.addDisposer([
|
4432
|
+
visible$.reaction((visible2, skipUpdate) => {
|
4433
|
+
if (!skipUpdate && !visible2) {
|
4434
|
+
this.events.emit(TELE_BOX_EVENT.Close);
|
4435
|
+
}
|
4436
|
+
}),
|
4437
|
+
focus$.reaction((focus2, skipUpdate) => {
|
4438
|
+
if (!skipUpdate) {
|
4439
|
+
this.events.emit(focus2 ? TELE_BOX_EVENT.Focus : TELE_BOX_EVENT.Blur);
|
4440
|
+
}
|
4441
|
+
})
|
4442
|
+
]);
|
3888
4443
|
}
|
3889
4444
|
get minWidth() {
|
3890
4445
|
return this._minSize$.value.width;
|
@@ -3892,14 +4447,17 @@ class Y$3 {
|
|
3892
4447
|
get minHeight() {
|
3893
4448
|
return this._minSize$.value.height;
|
3894
4449
|
}
|
3895
|
-
setMinWidth(
|
3896
|
-
this._minSize$.setValue({ width:
|
4450
|
+
setMinWidth(minWidth, skipUpdate = false) {
|
4451
|
+
this._minSize$.setValue({ width: minWidth, height: this.minHeight }, skipUpdate);
|
3897
4452
|
}
|
3898
|
-
setMinHeight(
|
3899
|
-
this._minSize$.setValue({ width: this.minWidth, height:
|
4453
|
+
setMinHeight(minHeight, skipUpdate = false) {
|
4454
|
+
this._minSize$.setValue({ width: this.minWidth, height: minHeight }, skipUpdate);
|
3900
4455
|
}
|
3901
|
-
resize(
|
3902
|
-
this._intrinsicSize$.setValue({
|
4456
|
+
resize(width, height, skipUpdate = false) {
|
4457
|
+
this._intrinsicSize$.setValue({
|
4458
|
+
width: Math.max(width, this.minWidth),
|
4459
|
+
height: Math.max(height, this.minHeight)
|
4460
|
+
}, skipUpdate);
|
3903
4461
|
}
|
3904
4462
|
get intrinsicX() {
|
3905
4463
|
return this._intrinsicCoord$.value.x;
|
@@ -3913,361 +4471,865 @@ class Y$3 {
|
|
3913
4471
|
get intrinsicHeight() {
|
3914
4472
|
return this._intrinsicSize$.value.height;
|
3915
4473
|
}
|
3916
|
-
move(
|
3917
|
-
let
|
3918
|
-
|
3919
|
-
|
3920
|
-
|
3921
|
-
|
3922
|
-
|
3923
|
-
|
3924
|
-
}
|
3925
|
-
|
4474
|
+
move(x2, y2, skipUpdate = false) {
|
4475
|
+
let safeX;
|
4476
|
+
let safeY;
|
4477
|
+
const managerStageRect = this.managerStageRect;
|
4478
|
+
const pxIntrinsicSize = this.pxIntrinsicSize;
|
4479
|
+
if (this.fence) {
|
4480
|
+
safeX = clamp$1(x2, 0, managerStageRect.width - pxIntrinsicSize.width);
|
4481
|
+
safeY = clamp$1(y2, 0, managerStageRect.height - pxIntrinsicSize.height);
|
4482
|
+
} else {
|
4483
|
+
safeX = clamp$1(x2, -(pxIntrinsicSize.width - 120), 0 + managerStageRect.width - 20);
|
4484
|
+
safeY = clamp$1(y2, 0, 0 + managerStageRect.height - 20);
|
4485
|
+
}
|
4486
|
+
this._intrinsicCoord$.setValue({
|
4487
|
+
x: safeX / managerStageRect.width,
|
4488
|
+
y: safeY / managerStageRect.height
|
4489
|
+
}, skipUpdate);
|
4490
|
+
}
|
4491
|
+
transform(x2, y2, width, height, skipUpdate = false) {
|
4492
|
+
const managerStageRect = this.managerStageRect;
|
4493
|
+
width = Math.max(width, this.pxMinSize.width);
|
4494
|
+
height = Math.max(height, this.pxMinSize.height);
|
4495
|
+
if (this.boxRatio > 0) {
|
4496
|
+
const newHeight = this.boxRatio * width;
|
4497
|
+
if (y2 !== this.pxIntrinsicCoord.y) {
|
4498
|
+
y2 -= newHeight - height;
|
4499
|
+
}
|
4500
|
+
height = newHeight;
|
4501
|
+
}
|
4502
|
+
if (y2 < 0) {
|
4503
|
+
y2 = 0;
|
4504
|
+
height = this.pxIntrinsicSize.height;
|
4505
|
+
}
|
4506
|
+
this.move(x2, y2, skipUpdate);
|
4507
|
+
this._intrinsicSize$.setValue({
|
4508
|
+
width: width / managerStageRect.width,
|
4509
|
+
height: height / managerStageRect.height
|
4510
|
+
}, skipUpdate);
|
4511
|
+
}
|
4512
|
+
mountContent(content) {
|
4513
|
+
var _a;
|
4514
|
+
(_a = this.$authorContent) == null ? void 0 : _a.remove();
|
4515
|
+
this.$authorContent = content;
|
4516
|
+
this.$content.appendChild(content);
|
3926
4517
|
}
|
3927
|
-
|
3928
|
-
|
3929
|
-
|
3930
|
-
|
3931
|
-
t2 !== this.pxIntrinsicCoord.y && (t2 -= e3 - s2), s2 = e3;
|
4518
|
+
unmountContent() {
|
4519
|
+
if (this.$authorContent) {
|
4520
|
+
this.$authorContent.remove();
|
4521
|
+
this.$authorContent = void 0;
|
3932
4522
|
}
|
3933
|
-
t2 < r2.y && (t2 = r2.y, s2 = this.pxIntrinsicSize.height), this.move(e2, t2, a2), this._intrinsicSize$.setValue({ width: i2 / o2.width, height: s2 / o2.height }, a2);
|
3934
4523
|
}
|
3935
|
-
|
3936
|
-
|
4524
|
+
mountStage(stage) {
|
4525
|
+
var _a;
|
4526
|
+
(_a = this.$authorStage) == null ? void 0 : _a.remove();
|
4527
|
+
this.$authorStage = stage;
|
4528
|
+
if (!this.$stage) {
|
4529
|
+
this.$stage = this._renderStage();
|
4530
|
+
}
|
4531
|
+
this.$stage.appendChild(stage);
|
4532
|
+
if (!this.$stage.parentElement) {
|
4533
|
+
this.$body.appendChild(this.$stage);
|
4534
|
+
}
|
3937
4535
|
}
|
3938
|
-
|
3939
|
-
|
4536
|
+
unmountStage() {
|
4537
|
+
var _a;
|
4538
|
+
if (this.$authorStage) {
|
4539
|
+
this.$authorStage.remove();
|
4540
|
+
this.$authorStage = void 0;
|
4541
|
+
}
|
4542
|
+
(_a = this.$stage) == null ? void 0 : _a.remove();
|
3940
4543
|
}
|
3941
|
-
mountFooter(
|
3942
|
-
|
4544
|
+
mountFooter(footer) {
|
4545
|
+
var _a;
|
4546
|
+
(_a = this.$authorFooter) == null ? void 0 : _a.remove();
|
4547
|
+
this.$authorFooter = footer;
|
4548
|
+
this.$footer.appendChild(footer);
|
3943
4549
|
}
|
3944
4550
|
unmountFooter() {
|
3945
|
-
this
|
3946
|
-
|
3947
|
-
|
3948
|
-
|
4551
|
+
if (this.$authorFooter) {
|
4552
|
+
this.$authorFooter.remove();
|
4553
|
+
this.$authorFooter = void 0;
|
4554
|
+
}
|
3949
4555
|
}
|
3950
|
-
mountStyles(
|
3951
|
-
|
3952
|
-
typeof e2 == "string" ? (t2 = document.createElement("style"), t2.textContent = e2) : t2 = e2, this._$userStyles$.setValue(t2);
|
4556
|
+
mountStyles(styles2) {
|
4557
|
+
this.$styles.textContent = styles2;
|
3953
4558
|
}
|
3954
4559
|
unmountStyles() {
|
3955
|
-
this.
|
4560
|
+
this.$styles.textContent = "";
|
3956
4561
|
}
|
3957
|
-
|
3958
|
-
this.
|
4562
|
+
mountUserStyles(styles2) {
|
4563
|
+
this.$userStyles.textContent = styles2;
|
3959
4564
|
}
|
3960
|
-
|
3961
|
-
|
4565
|
+
unmountUserStyles() {
|
4566
|
+
this.$userStyles.textContent = "";
|
4567
|
+
}
|
4568
|
+
_render() {
|
4569
|
+
if (this.$box) {
|
3962
4570
|
return this.$box;
|
3963
|
-
|
3964
|
-
const
|
3965
|
-
|
3966
|
-
|
3967
|
-
|
4571
|
+
}
|
4572
|
+
const bindBoxStates = (el, disposerID) => {
|
4573
|
+
return this._sideEffect.addDisposer([
|
4574
|
+
this._readonly$.subscribe((readonly) => el.classList.toggle(this.wrapClassName("readonly"), readonly)),
|
4575
|
+
this._draggable$.subscribe((draggable) => el.classList.toggle(this.wrapClassName("no-drag"), !draggable)),
|
4576
|
+
this._resizable$.subscribe((resizable) => el.classList.toggle(this.wrapClassName("no-resize"), !resizable)),
|
4577
|
+
this._focus$.subscribe((focus) => el.classList.toggle(this.wrapClassName("blur"), !focus)),
|
4578
|
+
this._darkMode$.subscribe((darkMode) => {
|
4579
|
+
el.classList.toggle(this.wrapClassName("color-scheme-dark"), darkMode);
|
4580
|
+
el.classList.toggle(this.wrapClassName("color-scheme-light"), !darkMode);
|
4581
|
+
})
|
4582
|
+
], disposerID);
|
4583
|
+
};
|
4584
|
+
this.$box = document.createElement("div");
|
4585
|
+
this.$box.classList.add(this.wrapClassName("box"));
|
4586
|
+
bindBoxStates(this.$box, "bind-box-state");
|
4587
|
+
this._sideEffect.add(() => {
|
4588
|
+
const minimizedClassName = this.wrapClassName("minimized");
|
4589
|
+
const maximizedClassName = this.wrapClassName("maximized");
|
4590
|
+
const MAXIMIZED_TIMER_ID = "box-maximized-timer";
|
4591
|
+
return this._state$.subscribe((state) => {
|
4592
|
+
this.$box.classList.toggle(minimizedClassName, state === TELE_BOX_STATE.Minimized);
|
4593
|
+
if (state === TELE_BOX_STATE.Maximized) {
|
4594
|
+
this._sideEffect.flush(MAXIMIZED_TIMER_ID);
|
4595
|
+
this.$box.classList.toggle(maximizedClassName, true);
|
4596
|
+
} else {
|
4597
|
+
this._sideEffect.setTimeout(() => {
|
4598
|
+
this.$box.classList.toggle(maximizedClassName, false);
|
4599
|
+
}, 0, MAXIMIZED_TIMER_ID);
|
4600
|
+
}
|
3968
4601
|
});
|
3969
4602
|
});
|
3970
|
-
|
3971
|
-
|
3972
|
-
return this._state$.subscribe((s3) => {
|
3973
|
-
this.$box.classList.toggle(e3, s3 === C$3.Minimized), s3 === C$3.Maximized ? (this._sideEffect.flush(i3), this.$box.classList.toggle(t3, true)) : this._sideEffect.setTimeout(() => {
|
3974
|
-
this.$box.classList.toggle(t3, false);
|
3975
|
-
}, 0, i3);
|
3976
|
-
});
|
3977
|
-
}), this._sideEffect.addDisposer(this._visible$.subscribe((e3) => {
|
3978
|
-
this.$box.style.display = e3 ? "block" : "none";
|
3979
|
-
})), this._sideEffect.addDisposer(this._zIndex$.subscribe((e3) => {
|
3980
|
-
this.$box.style.zIndex = String(e3);
|
3981
|
-
})), this.$box.dataset.teleBoxID = this.id;
|
3982
|
-
const t2 = index(this.$box), i2 = combine([this._maximized$, this._minimized$, this._pxIntrinsicSize$, this._pxIntrinsicCoord$, this._collectorRect$], ([e3, t3, i3, s3, a3]) => {
|
3983
|
-
const o3 = e3 ? { x: 0, y: 0, width: "100%", height: "100%", scaleX: 1, scaleY: 1 } : { x: s3.x, y: s3.y, width: i3.width + "px", height: i3.height + "px", scaleX: 1, scaleY: 1 };
|
3984
|
-
if (t3 && a3) {
|
3985
|
-
const { width: t4, height: s4 } = e3 ? this.rootRect : i3;
|
3986
|
-
o3.x = a3.x - t4 / 2 + a3.width / 2, o3.y = a3.y - s4 / 2 + a3.height / 2, o3.scaleX = a3.width / t4, o3.scaleY = a3.height / s4;
|
3987
|
-
}
|
3988
|
-
return o3;
|
3989
|
-
}, { compare: shallowequal }), s2 = i2.value;
|
3990
|
-
this.$box.style.width = s2.width, this.$box.style.height = s2.height, this.$box.style.transform = `translate(${s2.x - 10}px,${s2.y - 10}px)`, this._sideEffect.addDisposer(i2.subscribe((e3) => {
|
3991
|
-
t2.set(e3);
|
4603
|
+
this._sideEffect.addDisposer(this._visible$.subscribe((visible) => {
|
4604
|
+
this.$box.style.display = visible ? "block" : "none";
|
3992
4605
|
}));
|
3993
|
-
|
3994
|
-
|
3995
|
-
|
3996
|
-
|
3997
|
-
const
|
3998
|
-
|
3999
|
-
|
4000
|
-
|
4001
|
-
|
4002
|
-
|
4003
|
-
|
4004
|
-
|
4005
|
-
|
4006
|
-
|
4007
|
-
|
4008
|
-
|
4009
|
-
|
4010
|
-
|
4011
|
-
|
4012
|
-
|
4013
|
-
|
4014
|
-
|
4606
|
+
this._sideEffect.addDisposer(this._zIndex$.subscribe((zIndex) => {
|
4607
|
+
this.$box.style.zIndex = String(zIndex);
|
4608
|
+
}));
|
4609
|
+
this.$box.dataset.teleBoxID = this.id;
|
4610
|
+
const boxStyler = index(this.$box);
|
4611
|
+
const boxStyles$ = combine([
|
4612
|
+
this._maximized$,
|
4613
|
+
this._minimized$,
|
4614
|
+
this._pxIntrinsicSize$,
|
4615
|
+
this._pxIntrinsicCoord$,
|
4616
|
+
this._collectorRect$,
|
4617
|
+
this._rootRect$,
|
4618
|
+
this._managerStageRect$
|
4619
|
+
], ([
|
4620
|
+
maximized,
|
4621
|
+
minimized,
|
4622
|
+
pxIntrinsicSize,
|
4623
|
+
pxIntrinsicCoord,
|
4624
|
+
collectorRect,
|
4625
|
+
rootRect,
|
4626
|
+
managerStageRect
|
4627
|
+
]) => {
|
4628
|
+
const styles2 = maximized ? {
|
4629
|
+
x: -managerStageRect.x,
|
4630
|
+
y: -managerStageRect.y,
|
4631
|
+
width: rootRect.width,
|
4632
|
+
height: rootRect.height,
|
4633
|
+
scaleX: 1,
|
4634
|
+
scaleY: 1
|
4635
|
+
} : {
|
4636
|
+
x: pxIntrinsicCoord.x,
|
4637
|
+
y: pxIntrinsicCoord.y,
|
4638
|
+
width: pxIntrinsicSize.width,
|
4639
|
+
height: pxIntrinsicSize.height,
|
4640
|
+
scaleX: 1,
|
4641
|
+
scaleY: 1
|
4642
|
+
};
|
4643
|
+
if (minimized && collectorRect) {
|
4644
|
+
const { width: boxWidth, height: boxHeight } = maximized ? this.rootRect : pxIntrinsicSize;
|
4645
|
+
styles2.x = collectorRect.x - boxWidth / 2 + collectorRect.width / 2 - managerStageRect.x;
|
4646
|
+
styles2.y = collectorRect.y - boxHeight / 2 + collectorRect.height / 2 - managerStageRect.y;
|
4647
|
+
styles2.scaleX = collectorRect.width / boxWidth;
|
4648
|
+
styles2.scaleY = collectorRect.height / boxHeight;
|
4649
|
+
}
|
4650
|
+
return styles2;
|
4651
|
+
}, { compare: shallowequal });
|
4652
|
+
const boxStyles = boxStyles$.value;
|
4653
|
+
this.$box.style.width = boxStyles.width + "px";
|
4654
|
+
this.$box.style.height = boxStyles.height + "px";
|
4655
|
+
this.$box.style.transform = `translate(${boxStyles.x - 10}px,${boxStyles.y - 10}px)`;
|
4656
|
+
this._sideEffect.addDisposer(boxStyles$.subscribe((styles2) => {
|
4657
|
+
boxStyler.set(styles2);
|
4658
|
+
}));
|
4659
|
+
const $boxMain = document.createElement("div");
|
4660
|
+
$boxMain.className = this.wrapClassName("box-main");
|
4661
|
+
this.$box.appendChild($boxMain);
|
4662
|
+
const $titleBar = document.createElement("div");
|
4663
|
+
$titleBar.className = this.wrapClassName("titlebar-wrap");
|
4664
|
+
$titleBar.appendChild(this.titleBar.render());
|
4665
|
+
this.$titleBar = $titleBar;
|
4666
|
+
const $body = document.createElement("div");
|
4667
|
+
$body.className = this.wrapClassName("body-wrap");
|
4668
|
+
this.$body = $body;
|
4669
|
+
const $styles = document.createElement("style");
|
4670
|
+
this.$styles = $styles;
|
4671
|
+
$body.appendChild($styles);
|
4672
|
+
const $userStyles = document.createElement("style");
|
4673
|
+
this.$userStyles = $userStyles;
|
4674
|
+
$body.appendChild($userStyles);
|
4675
|
+
const $content = document.createElement("div");
|
4676
|
+
$content.className = this.wrapClassName("content") + " tele-fancy-scrollbar";
|
4677
|
+
this.$content = $content;
|
4678
|
+
this._sideEffect.addDisposer(combine([this._bodyStyle$, this._defaultBoxBodyStyle$], ([bodyStyle, defaultBoxBodyStyle]) => bodyStyle != null ? bodyStyle : defaultBoxBodyStyle).subscribe((style2) => $content.style.cssText = style2 || ""));
|
4679
|
+
$body.appendChild($content);
|
4680
|
+
const $footer = document.createElement("div");
|
4681
|
+
$footer.className = this.wrapClassName("footer-wrap");
|
4682
|
+
this.$footer = $footer;
|
4683
|
+
$boxMain.appendChild($titleBar);
|
4684
|
+
const $main = document.createElement("div");
|
4685
|
+
$main.className = this.wrapClassName("main");
|
4686
|
+
this.$main = $main;
|
4687
|
+
$boxMain.appendChild($main);
|
4688
|
+
const $quarantineOuter = document.createElement("div");
|
4689
|
+
$quarantineOuter.className = this.wrapClassName("quarantine-outer");
|
4690
|
+
$main.appendChild($quarantineOuter);
|
4691
|
+
const $quarantine = document.createElement("div");
|
4692
|
+
$quarantine.className = this.wrapClassName("quarantine");
|
4693
|
+
$quarantine.appendChild($body);
|
4694
|
+
$quarantine.appendChild($footer);
|
4695
|
+
if (this.enableShadowDOM) {
|
4696
|
+
bindBoxStates($quarantine, "bind-quarantine-state");
|
4697
|
+
const $shadowStyle = document.createElement("style");
|
4698
|
+
$shadowStyle.textContent = shadowStyles;
|
4699
|
+
$quarantine.insertBefore($shadowStyle, $quarantine.firstChild);
|
4700
|
+
const shadow = $quarantineOuter.attachShadow({ mode: "open" });
|
4701
|
+
shadow.appendChild($quarantine);
|
4702
|
+
} else {
|
4703
|
+
$quarantineOuter.appendChild($quarantine);
|
4704
|
+
}
|
4705
|
+
this._renderResizeHandlers();
|
4706
|
+
const updateBodyRect = () => {
|
4707
|
+
const rect = $body.getBoundingClientRect();
|
4708
|
+
this._bodyRect$.setValue({
|
4709
|
+
x: 0,
|
4710
|
+
y: 0,
|
4711
|
+
width: rect.width,
|
4712
|
+
height: rect.height
|
4015
4713
|
});
|
4016
|
-
}
|
4017
|
-
|
4018
|
-
|
4019
|
-
|
4020
|
-
|
4021
|
-
|
4714
|
+
};
|
4715
|
+
this._sideEffect.add(() => {
|
4716
|
+
const observer = new ResizeObserver$1$1(() => {
|
4717
|
+
if (!this.minimized) {
|
4718
|
+
updateBodyRect();
|
4719
|
+
}
|
4022
4720
|
});
|
4023
|
-
|
4721
|
+
observer.observe($body);
|
4722
|
+
return () => observer.disconnect();
|
4723
|
+
});
|
4724
|
+
this._sideEffect.addDisposer(this._minimized$.reaction((minimized) => {
|
4725
|
+
if (!minimized) {
|
4726
|
+
this._sideEffect.setTimeout(updateBodyRect, 400, "minimized-content-rect-fix");
|
4727
|
+
}
|
4728
|
+
}));
|
4729
|
+
return this.$box;
|
4730
|
+
}
|
4731
|
+
_renderStage() {
|
4732
|
+
const $stage = document.createElement("div");
|
4733
|
+
$stage.className = this.wrapClassName("box-stage");
|
4734
|
+
const updateStageRect = (stageRect) => {
|
4735
|
+
$stage.style.top = stageRect.y + "px";
|
4736
|
+
$stage.style.left = stageRect.x + "px";
|
4737
|
+
$stage.style.width = stageRect.width + "px";
|
4738
|
+
$stage.style.height = stageRect.height + "px";
|
4739
|
+
};
|
4740
|
+
this._sideEffect.addDisposer([
|
4741
|
+
combine([this._stageStyle$, this._defaultBoxStageStyle$], ([stageStyle, defaultBoxStageStyle]) => stageStyle != null ? stageStyle : defaultBoxStageStyle).subscribe((styles2) => {
|
4742
|
+
$stage.style.cssText = styles2 || "";
|
4743
|
+
updateStageRect(this._stageRect$.value);
|
4744
|
+
}),
|
4745
|
+
this._stageRect$.subscribe(updateStageRect)
|
4746
|
+
], "box-stage-styles");
|
4747
|
+
return $stage;
|
4024
4748
|
}
|
4025
4749
|
_renderResizeHandlers() {
|
4026
|
-
const
|
4027
|
-
|
4028
|
-
|
4029
|
-
|
4030
|
-
|
4031
|
-
|
4032
|
-
|
4033
|
-
|
4034
|
-
|
4750
|
+
const $resizeHandles = document.createElement("div");
|
4751
|
+
$resizeHandles.className = this.wrapClassName("resize-handles");
|
4752
|
+
Object.values(TELE_BOX_RESIZE_HANDLE).forEach((handleType) => {
|
4753
|
+
const $handle = document.createElement("div");
|
4754
|
+
$handle.className = this.wrapClassName(handleType) + " " + this.wrapClassName("resize-handle");
|
4755
|
+
$handle.dataset.teleBoxHandle = handleType;
|
4756
|
+
$resizeHandles.appendChild($handle);
|
4757
|
+
});
|
4758
|
+
this.$box.appendChild($resizeHandles);
|
4759
|
+
const TRACKING_DISPOSER_ID = "handle-tracking-listener";
|
4760
|
+
const transformingClassName = this.wrapClassName("transforming");
|
4761
|
+
let $trackMask;
|
4762
|
+
let trackStartX = 0;
|
4763
|
+
let trackStartY = 0;
|
4764
|
+
let trackStartWidth = 0;
|
4765
|
+
let trackStartHeight = 0;
|
4766
|
+
let trackStartPageX = 0;
|
4767
|
+
let trackStartPageY = 0;
|
4768
|
+
let trackingHandle;
|
4769
|
+
const handleTracking = (ev) => {
|
4770
|
+
if (!ev.isPrimary || this.state !== TELE_BOX_STATE.Normal) {
|
4035
4771
|
return;
|
4036
|
-
|
4037
|
-
|
4038
|
-
|
4039
|
-
|
4040
|
-
|
4041
|
-
|
4042
|
-
|
4043
|
-
|
4772
|
+
}
|
4773
|
+
preventEvent$1(ev);
|
4774
|
+
let { pageX, pageY } = ev;
|
4775
|
+
if (pageY < 0) {
|
4776
|
+
pageY = 0;
|
4777
|
+
}
|
4778
|
+
const offsetX = pageX - trackStartPageX;
|
4779
|
+
const offsetY = pageY - trackStartPageY;
|
4780
|
+
let { x: newX, y: newY } = this.pxIntrinsicCoord;
|
4781
|
+
let { width: newWidth, height: newHeight } = this.pxIntrinsicSize;
|
4782
|
+
switch (trackingHandle) {
|
4783
|
+
case TELE_BOX_RESIZE_HANDLE.North: {
|
4784
|
+
newY = trackStartY + offsetY;
|
4785
|
+
newHeight = trackStartHeight - offsetY;
|
4044
4786
|
break;
|
4045
|
-
|
4046
|
-
|
4787
|
+
}
|
4788
|
+
case TELE_BOX_RESIZE_HANDLE.South: {
|
4789
|
+
newHeight = trackStartHeight + offsetY;
|
4047
4790
|
break;
|
4048
|
-
|
4049
|
-
|
4791
|
+
}
|
4792
|
+
case TELE_BOX_RESIZE_HANDLE.West: {
|
4793
|
+
newX = trackStartX + offsetX;
|
4794
|
+
newWidth = trackStartWidth - offsetX;
|
4050
4795
|
break;
|
4051
|
-
|
4052
|
-
|
4796
|
+
}
|
4797
|
+
case TELE_BOX_RESIZE_HANDLE.East: {
|
4798
|
+
newWidth = trackStartWidth + offsetX;
|
4053
4799
|
break;
|
4054
|
-
|
4055
|
-
|
4800
|
+
}
|
4801
|
+
case TELE_BOX_RESIZE_HANDLE.NorthWest: {
|
4802
|
+
newX = trackStartX + offsetX;
|
4803
|
+
newY = trackStartY + offsetY;
|
4804
|
+
newWidth = trackStartWidth - offsetX;
|
4805
|
+
newHeight = trackStartHeight - offsetY;
|
4056
4806
|
break;
|
4057
|
-
|
4058
|
-
|
4807
|
+
}
|
4808
|
+
case TELE_BOX_RESIZE_HANDLE.NorthEast: {
|
4809
|
+
newY = trackStartY + offsetY;
|
4810
|
+
newWidth = trackStartWidth + offsetX;
|
4811
|
+
newHeight = trackStartHeight - offsetY;
|
4059
4812
|
break;
|
4060
|
-
|
4061
|
-
|
4813
|
+
}
|
4814
|
+
case TELE_BOX_RESIZE_HANDLE.SouthEast: {
|
4815
|
+
newWidth = trackStartWidth + offsetX;
|
4816
|
+
newHeight = trackStartHeight + offsetY;
|
4062
4817
|
break;
|
4063
|
-
|
4064
|
-
|
4818
|
+
}
|
4819
|
+
case TELE_BOX_RESIZE_HANDLE.SouthWest: {
|
4820
|
+
newX = trackStartX + offsetX;
|
4821
|
+
newWidth = trackStartWidth - offsetX;
|
4822
|
+
newHeight = trackStartHeight + offsetY;
|
4065
4823
|
break;
|
4066
|
-
|
4067
|
-
|
4068
|
-
|
4069
|
-
|
4070
|
-
|
4071
|
-
|
4072
|
-
|
4073
|
-
|
4074
|
-
|
4824
|
+
}
|
4825
|
+
default: {
|
4826
|
+
this.move(trackStartX + offsetX, trackStartY + offsetY);
|
4827
|
+
return;
|
4828
|
+
}
|
4829
|
+
}
|
4830
|
+
this.transform(newX, newY, newWidth, newHeight);
|
4831
|
+
};
|
4832
|
+
const handleTrackEnd = (ev) => {
|
4833
|
+
if (!ev.isPrimary) {
|
4075
4834
|
return;
|
4076
|
-
|
4835
|
+
}
|
4836
|
+
trackingHandle = void 0;
|
4837
|
+
if (!$trackMask) {
|
4077
4838
|
return;
|
4078
|
-
|
4839
|
+
}
|
4840
|
+
preventEvent$1(ev);
|
4841
|
+
this.$box.classList.toggle(transformingClassName, false);
|
4842
|
+
this._sideEffect.flush(TRACKING_DISPOSER_ID);
|
4843
|
+
$trackMask.remove();
|
4844
|
+
};
|
4845
|
+
const handleTrackStart = (ev) => {
|
4846
|
+
var _a;
|
4847
|
+
if (!ev.isPrimary || this.readonly) {
|
4848
|
+
return;
|
4849
|
+
}
|
4850
|
+
if (ev.button != null && ev.button !== 0) {
|
4851
|
+
return;
|
4852
|
+
}
|
4853
|
+
if (!this.draggable || trackingHandle || this.state !== TELE_BOX_STATE.Normal) {
|
4079
4854
|
return;
|
4080
|
-
|
4081
|
-
|
4082
|
-
|
4083
|
-
|
4084
|
-
|
4085
|
-
|
4086
|
-
|
4855
|
+
}
|
4856
|
+
const target = ev.target;
|
4857
|
+
if ((_a = target.dataset) == null ? void 0 : _a.teleBoxHandle) {
|
4858
|
+
preventEvent$1(ev);
|
4859
|
+
({ x: trackStartX, y: trackStartY } = this.pxIntrinsicCoord);
|
4860
|
+
({ width: trackStartWidth, height: trackStartHeight } = this.pxIntrinsicSize);
|
4861
|
+
({ pageX: trackStartPageX, pageY: trackStartPageY } = ev);
|
4862
|
+
trackingHandle = target.dataset.teleBoxHandle;
|
4863
|
+
if (!$trackMask) {
|
4864
|
+
$trackMask = document.createElement("div");
|
4865
|
+
}
|
4866
|
+
const cursor = trackingHandle ? this.wrapClassName(`cursor-${trackingHandle}`) : "";
|
4867
|
+
$trackMask.className = this.wrapClassName(`track-mask${cursor ? ` ${cursor}` : ""}`);
|
4868
|
+
this.$box.appendChild($trackMask);
|
4869
|
+
this.$box.classList.add(transformingClassName);
|
4870
|
+
this._sideEffect.add(() => {
|
4871
|
+
window.addEventListener("pointermove", handleTracking, {
|
4872
|
+
passive: false
|
4873
|
+
});
|
4874
|
+
window.addEventListener("pointerup", handleTrackEnd, {
|
4875
|
+
passive: false
|
4876
|
+
});
|
4877
|
+
window.addEventListener("pointercancel", handleTrackEnd, {
|
4878
|
+
passive: false
|
4879
|
+
});
|
4880
|
+
return () => {
|
4881
|
+
window.removeEventListener("pointermove", handleTracking);
|
4882
|
+
window.removeEventListener("pointerup", handleTrackEnd);
|
4883
|
+
window.removeEventListener("pointercancel", handleTrackEnd);
|
4884
|
+
};
|
4885
|
+
}, TRACKING_DISPOSER_ID);
|
4087
4886
|
}
|
4088
4887
|
};
|
4089
|
-
this._handleTrackStart =
|
4888
|
+
this._handleTrackStart = handleTrackStart;
|
4889
|
+
this._sideEffect.addEventListener($resizeHandles, "pointerdown", handleTrackStart, {}, "box-resizeHandles-pointerdown");
|
4090
4890
|
}
|
4091
4891
|
async destroy() {
|
4092
|
-
this.$box.remove()
|
4093
|
-
|
4094
|
-
|
4095
|
-
|
4096
|
-
|
4097
|
-
|
4098
|
-
|
4099
|
-
|
4100
|
-
|
4101
|
-
|
4102
|
-
|
4103
|
-
|
4104
|
-
|
4105
|
-
|
4106
|
-
|
4107
|
-
|
4108
|
-
|
4109
|
-
|
4110
|
-
|
4111
|
-
|
4112
|
-
|
4113
|
-
|
4114
|
-
|
4115
|
-
|
4116
|
-
|
4117
|
-
|
4118
|
-
|
4119
|
-
|
4120
|
-
|
4121
|
-
|
4122
|
-
|
4123
|
-
|
4124
|
-
|
4125
|
-
|
4126
|
-
|
4127
|
-
|
4128
|
-
|
4892
|
+
this.$box.remove();
|
4893
|
+
this._sideEffect.flushAll();
|
4894
|
+
this._sideEffect.flushAll();
|
4895
|
+
await this.events.emit(TELE_BOX_EVENT.Destroyed);
|
4896
|
+
this.events.clearListeners();
|
4897
|
+
this._delegateEvents.clearListeners();
|
4898
|
+
}
|
4899
|
+
wrapClassName(className) {
|
4900
|
+
return `${this.namespace}-${className}`;
|
4901
|
+
}
|
4902
|
+
}
|
4903
|
+
var collectorSVG = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K";
|
4904
|
+
class TeleBoxCollector {
|
4905
|
+
constructor({
|
4906
|
+
minimized$,
|
4907
|
+
readonly$,
|
4908
|
+
darkMode$,
|
4909
|
+
namespace = "telebox",
|
4910
|
+
styles: styles2 = {},
|
4911
|
+
root,
|
4912
|
+
onClick
|
4913
|
+
}) {
|
4914
|
+
this._sideEffect = new SideEffectManager();
|
4915
|
+
this.namespace = namespace;
|
4916
|
+
const valManager = new ValManager();
|
4917
|
+
this._sideEffect.addDisposer(() => valManager.destroy());
|
4918
|
+
const rect$ = new Val(void 0);
|
4919
|
+
const visible$ = derive(minimized$);
|
4920
|
+
const styles$ = new Val(styles2);
|
4921
|
+
const el$ = new Val(document.createElement("button"));
|
4922
|
+
const valConfig = {
|
4923
|
+
styles: styles$,
|
4924
|
+
$collector: el$
|
4925
|
+
};
|
4926
|
+
withValueEnhancer(this, valConfig, valManager);
|
4927
|
+
const myReadonlyValConfig = {
|
4928
|
+
rect: rect$,
|
4929
|
+
visible: visible$
|
4930
|
+
};
|
4931
|
+
withReadonlyValueEnhancer(this, myReadonlyValConfig, valManager);
|
4932
|
+
el$.value.className = this.wrapClassName("collector");
|
4933
|
+
el$.value.style.backgroundImage = `url('${collectorSVG}')`;
|
4934
|
+
this._sideEffect.addDisposer(el$.subscribe(($collector) => {
|
4935
|
+
this._sideEffect.add(() => {
|
4936
|
+
root.appendChild($collector);
|
4937
|
+
return () => $collector.remove();
|
4938
|
+
}, "telebox-collector-mount");
|
4939
|
+
this._sideEffect.addEventListener($collector, "click", () => {
|
4940
|
+
if (!readonly$.value) {
|
4941
|
+
onClick == null ? void 0 : onClick();
|
4942
|
+
}
|
4943
|
+
}, {}, "telebox-collector-click");
|
4944
|
+
this._sideEffect.addDisposer([
|
4945
|
+
visible$.subscribe((visible) => {
|
4946
|
+
$collector.classList.toggle(this.wrapClassName("collector-visible"), visible);
|
4947
|
+
}),
|
4948
|
+
readonly$.subscribe((readonly) => {
|
4949
|
+
$collector.classList.toggle(this.wrapClassName("collector-readonly"), readonly);
|
4950
|
+
}),
|
4951
|
+
darkMode$.subscribe((darkMode) => {
|
4952
|
+
$collector.classList.toggle(this.wrapClassName("color-scheme-dark"), darkMode);
|
4953
|
+
$collector.classList.toggle(this.wrapClassName("color-scheme-light"), !darkMode);
|
4954
|
+
}),
|
4955
|
+
styles$.subscribe((styles22) => {
|
4956
|
+
Object.keys(styles22).forEach((key) => {
|
4957
|
+
const value = styles22[key];
|
4958
|
+
if (value != null) {
|
4959
|
+
$collector.style[key] = value;
|
4960
|
+
}
|
4961
|
+
});
|
4962
|
+
}),
|
4963
|
+
minimized$.subscribe((minimized) => {
|
4964
|
+
if (minimized) {
|
4965
|
+
const { x: x2, y: y2, width, height } = $collector.getBoundingClientRect();
|
4966
|
+
const rootRect = root.getBoundingClientRect();
|
4967
|
+
rect$.setValue({
|
4968
|
+
x: x2 - rootRect.x,
|
4969
|
+
y: y2 - rootRect.y,
|
4970
|
+
width,
|
4971
|
+
height
|
4972
|
+
});
|
4973
|
+
}
|
4974
|
+
})
|
4975
|
+
], "telebox-collector-el");
|
4129
4976
|
}));
|
4130
4977
|
}
|
4131
4978
|
destroy() {
|
4132
4979
|
this._sideEffect.flushAll();
|
4133
4980
|
}
|
4134
|
-
wrapClassName(
|
4135
|
-
return `${this.namespace}-${
|
4981
|
+
wrapClassName(className) {
|
4982
|
+
return `${this.namespace}-${className}`;
|
4136
4983
|
}
|
4137
4984
|
}
|
4138
|
-
|
4139
|
-
|
4140
|
-
|
4141
|
-
|
4142
|
-
|
4143
|
-
|
4144
|
-
|
4985
|
+
var TELE_BOX_MANAGER_EVENT = /* @__PURE__ */ ((TELE_BOX_MANAGER_EVENT2) => {
|
4986
|
+
TELE_BOX_MANAGER_EVENT2["Focused"] = "focused";
|
4987
|
+
TELE_BOX_MANAGER_EVENT2["Blurred"] = "blurred";
|
4988
|
+
TELE_BOX_MANAGER_EVENT2["Created"] = "created";
|
4989
|
+
TELE_BOX_MANAGER_EVENT2["Removed"] = "removed";
|
4990
|
+
TELE_BOX_MANAGER_EVENT2["State"] = "state";
|
4991
|
+
TELE_BOX_MANAGER_EVENT2["Maximized"] = "maximized";
|
4992
|
+
TELE_BOX_MANAGER_EVENT2["Minimized"] = "minimized";
|
4993
|
+
TELE_BOX_MANAGER_EVENT2["IntrinsicMove"] = "intrinsic_move";
|
4994
|
+
TELE_BOX_MANAGER_EVENT2["IntrinsicResize"] = "intrinsic_resize";
|
4995
|
+
TELE_BOX_MANAGER_EVENT2["ZIndex"] = "z_index";
|
4996
|
+
TELE_BOX_MANAGER_EVENT2["PrefersColorScheme"] = "prefers_color_scheme";
|
4997
|
+
TELE_BOX_MANAGER_EVENT2["DarkMode"] = "dark_mode";
|
4998
|
+
return TELE_BOX_MANAGER_EVENT2;
|
4999
|
+
})(TELE_BOX_MANAGER_EVENT || {});
|
5000
|
+
class MaxTitleBar extends DefaultTitleBar {
|
5001
|
+
constructor(config) {
|
5002
|
+
super(config);
|
5003
|
+
this.boxes$ = config.boxes$;
|
5004
|
+
this.rootRect$ = config.rootRect$;
|
5005
|
+
this.darkMode$ = config.darkMode$;
|
5006
|
+
config.root.appendChild(this.render());
|
4145
5007
|
}
|
4146
|
-
focusBox(
|
4147
|
-
var
|
4148
|
-
if (
|
4149
|
-
|
4150
|
-
|
4151
|
-
|
4152
|
-
|
4153
|
-
|
5008
|
+
focusBox(box) {
|
5009
|
+
var _a;
|
5010
|
+
if (this.focusedBox && this.focusedBox === box) {
|
5011
|
+
return;
|
5012
|
+
}
|
5013
|
+
if (this.$titles && this.state$.value === TELE_BOX_STATE.Maximized) {
|
5014
|
+
const { children: children2 } = this.$titles.firstElementChild;
|
5015
|
+
for (let i2 = children2.length - 1; i2 >= 0; i2 -= 1) {
|
5016
|
+
const $tab = children2[i2];
|
5017
|
+
const id2 = (_a = $tab.dataset) == null ? void 0 : _a.teleBoxID;
|
5018
|
+
if (id2) {
|
5019
|
+
if (box && id2 === box.id) {
|
5020
|
+
$tab.classList.toggle(this.wrapClassName("titles-tab-focus"), true);
|
5021
|
+
} else if (this.focusedBox && id2 === this.focusedBox.id) {
|
5022
|
+
$tab.classList.toggle(this.wrapClassName("titles-tab-focus"), false);
|
5023
|
+
}
|
4154
5024
|
}
|
4155
5025
|
}
|
4156
|
-
this.focusedBox = e2;
|
4157
5026
|
}
|
5027
|
+
this.focusedBox = box;
|
4158
5028
|
}
|
4159
5029
|
render() {
|
4160
|
-
if (this.$titleBar)
|
5030
|
+
if (this.$titleBar) {
|
4161
5031
|
return this.$titleBar;
|
4162
|
-
|
4163
|
-
|
4164
|
-
|
4165
|
-
|
4166
|
-
|
4167
|
-
|
4168
|
-
|
4169
|
-
|
4170
|
-
|
4171
|
-
|
4172
|
-
|
4173
|
-
|
5032
|
+
}
|
5033
|
+
const $titleBar = super.render();
|
5034
|
+
$titleBar.classList.add(this.wrapClassName("max-titlebar"));
|
5035
|
+
this.sideEffect.addDisposer([
|
5036
|
+
this.state$.subscribe((state) => {
|
5037
|
+
$titleBar.classList.toggle(this.wrapClassName("max-titlebar-maximized"), state === TELE_BOX_STATE.Maximized);
|
5038
|
+
}),
|
5039
|
+
this.readonly$.subscribe((readonly) => {
|
5040
|
+
$titleBar.classList.toggle(this.wrapClassName("readonly"), readonly);
|
5041
|
+
}),
|
5042
|
+
combine([this.state$, this.boxes$]).subscribe(([state, titles]) => {
|
5043
|
+
if (state === TELE_BOX_STATE.Maximized) {
|
5044
|
+
$titleBar.classList.toggle(this.wrapClassName("max-titlebar-single-title"), titles.length === 1);
|
5045
|
+
if (titles.length !== 1) {
|
5046
|
+
$titleBar.replaceChild(this.renderTitles(), $titleBar.firstElementChild);
|
5047
|
+
}
|
5048
|
+
}
|
5049
|
+
})
|
5050
|
+
], "max-render");
|
5051
|
+
const $titlesArea = document.createElement("div");
|
5052
|
+
$titlesArea.classList.add(this.wrapClassName("titles-area"));
|
5053
|
+
$titleBar.insertBefore($titlesArea, $titleBar.firstElementChild);
|
5054
|
+
return $titleBar;
|
4174
5055
|
}
|
4175
5056
|
destroy() {
|
4176
|
-
super.destroy()
|
5057
|
+
super.destroy();
|
5058
|
+
this.$titles = void 0;
|
5059
|
+
this.focusedBox = void 0;
|
4177
5060
|
}
|
4178
5061
|
renderTitles() {
|
4179
|
-
this.$titles = document.createElement("div")
|
4180
|
-
|
5062
|
+
this.$titles = document.createElement("div");
|
5063
|
+
this.$titles.className = this.wrapClassName("titles");
|
5064
|
+
this.sideEffect.addEventListener(this.$titles, "wheel", (ev) => {
|
5065
|
+
ev.currentTarget.scrollBy({
|
5066
|
+
left: ev.deltaY > 0 ? 250 : -250,
|
5067
|
+
behavior: "smooth"
|
5068
|
+
});
|
4181
5069
|
}, { passive: false }, "max-render-wheel-titles");
|
4182
|
-
const
|
4183
|
-
|
4184
|
-
|
4185
|
-
|
4186
|
-
|
5070
|
+
const $content = document.createElement("div");
|
5071
|
+
$content.className = this.wrapClassName("titles-content");
|
5072
|
+
this.$titles.appendChild($content);
|
5073
|
+
const disposers = this.boxes$.value.map((box) => {
|
5074
|
+
const $tab = document.createElement("button");
|
5075
|
+
$tab.className = this.wrapClassName("titles-tab");
|
5076
|
+
$tab.textContent = box.title;
|
5077
|
+
$tab.dataset.teleBoxID = box.id;
|
5078
|
+
$tab.dataset.teleTitleBarNoDblClick = "true";
|
5079
|
+
if (this.focusedBox && box.id === this.focusedBox.id) {
|
5080
|
+
$tab.classList.add(this.wrapClassName("titles-tab-focus"));
|
5081
|
+
}
|
5082
|
+
$content.appendChild($tab);
|
5083
|
+
return box._title$.reaction((title) => $tab.textContent = title);
|
4187
5084
|
});
|
4188
|
-
|
5085
|
+
this.sideEffect.addDisposer(() => disposers.forEach((disposer) => disposer()), "max-render-tab-titles");
|
5086
|
+
return this.$titles;
|
4189
5087
|
}
|
4190
5088
|
}
|
4191
|
-
const
|
4192
|
-
class
|
4193
|
-
constructor({
|
4194
|
-
|
4195
|
-
|
4196
|
-
|
4197
|
-
|
4198
|
-
|
5089
|
+
const ResizeObserver$2 = window.ResizeObserver || ResizeObserver$3;
|
5090
|
+
class TeleBoxManager {
|
5091
|
+
constructor({
|
5092
|
+
root = null,
|
5093
|
+
fullscreen = false,
|
5094
|
+
prefersColorScheme = TELE_BOX_COLOR_SCHEME.Light,
|
5095
|
+
minimized = false,
|
5096
|
+
maximized = false,
|
5097
|
+
fence = true,
|
5098
|
+
collector,
|
5099
|
+
namespace = "telebox",
|
5100
|
+
readonly = false,
|
5101
|
+
stageRatio = -1,
|
5102
|
+
containerStyle = "",
|
5103
|
+
stageStyle = "",
|
5104
|
+
defaultBoxBodyStyle = null,
|
5105
|
+
defaultBoxStageStyle = null,
|
5106
|
+
theme = {}
|
5107
|
+
} = {}) {
|
5108
|
+
this.events = new Emittery();
|
5109
|
+
this._sideEffect = new SideEffectManager();
|
5110
|
+
this.namespace = namespace;
|
5111
|
+
const valManager = new ValManager();
|
5112
|
+
this._sideEffect.addDisposer(() => valManager.destroy());
|
5113
|
+
const root$ = new Val(root);
|
5114
|
+
const readonly$ = new Val(readonly);
|
5115
|
+
const fence$ = new Val(fence);
|
5116
|
+
const containerStyle$ = new Val(containerStyle);
|
5117
|
+
const stageStyle$ = new Val(stageStyle);
|
5118
|
+
const stageRatio$ = new Val(stageRatio);
|
5119
|
+
const defaultBoxBodyStyle$ = new Val(defaultBoxBodyStyle);
|
5120
|
+
const defaultBoxStageStyle$ = new Val(defaultBoxStageStyle);
|
5121
|
+
const fullscreen$ = new Val(fullscreen);
|
5122
|
+
const input_minimized$ = new Val(minimized);
|
5123
|
+
const input_maximized$ = new Val(maximized);
|
5124
|
+
const maximized$ = combine([input_maximized$, fullscreen$], ([maximized2, fullscreen2]) => fullscreen2 ? true : maximized2);
|
5125
|
+
const minimized$ = combine([input_minimized$, fullscreen$], ([minimized2, fullscreen2]) => fullscreen2 ? false : minimized2);
|
5126
|
+
this.setMaximized = (maximized2, skipUpdate) => input_maximized$.setValue(maximized2, skipUpdate);
|
5127
|
+
this.setMinimized = (minimized2, skipUpdate) => input_minimized$.setValue(minimized2, skipUpdate);
|
5128
|
+
const rootRect$ = new Val({
|
5129
|
+
x: 0,
|
5130
|
+
y: 0,
|
5131
|
+
width: window.innerWidth,
|
5132
|
+
height: window.innerHeight
|
5133
|
+
}, { compare: shallowequal });
|
5134
|
+
this._sideEffect.addDisposer(root$.subscribe((root2) => {
|
4199
5135
|
this._sideEffect.add(() => {
|
4200
|
-
if (!
|
4201
|
-
return () =>
|
4202
|
-
|
4203
|
-
const
|
4204
|
-
const
|
4205
|
-
|
5136
|
+
if (!root2) {
|
5137
|
+
return () => void 0;
|
5138
|
+
}
|
5139
|
+
const observer = new ResizeObserver$2(() => {
|
5140
|
+
const rect = root2.getBoundingClientRect();
|
5141
|
+
rootRect$.setValue({
|
5142
|
+
x: 0,
|
5143
|
+
y: 0,
|
5144
|
+
width: rect.width,
|
5145
|
+
height: rect.height
|
5146
|
+
});
|
4206
5147
|
});
|
4207
|
-
|
5148
|
+
observer.observe(root2);
|
5149
|
+
return () => observer.disconnect();
|
4208
5150
|
}, "calc-root-rect");
|
4209
|
-
})), this.boxes$ = new Val([]), this.topBox$ = new Val(void 0), this._sideEffect.addDisposer(this.boxes$.subscribe((e3) => {
|
4210
|
-
if (e3.length > 0) {
|
4211
|
-
const t3 = e3.reduce((e4, t4) => e4.zIndex > t4.zIndex ? e4 : t4);
|
4212
|
-
this.topBox$.setValue(t3);
|
4213
|
-
} else
|
4214
|
-
this.topBox$.setValue(void 0);
|
4215
5151
|
}));
|
4216
|
-
const
|
4217
|
-
|
4218
|
-
|
4219
|
-
|
4220
|
-
|
4221
|
-
|
5152
|
+
const stageRect$ = combine([rootRect$, stageRatio$], calcStageRect, {
|
5153
|
+
compare: shallowequal
|
5154
|
+
});
|
5155
|
+
this.boxes$ = new Val([]);
|
5156
|
+
this.topBox$ = new Val(void 0);
|
5157
|
+
this._sideEffect.addDisposer(this.boxes$.subscribe((boxes) => {
|
5158
|
+
if (boxes.length > 0) {
|
5159
|
+
const topBox = boxes.reduce((topBox2, box) => topBox2.zIndex > box.zIndex ? topBox2 : box);
|
5160
|
+
this.topBox$.setValue(topBox);
|
5161
|
+
} else {
|
5162
|
+
this.topBox$.setValue(void 0);
|
5163
|
+
}
|
4222
5164
|
}));
|
4223
|
-
const
|
4224
|
-
|
4225
|
-
|
5165
|
+
const prefersDarkMatch = window.matchMedia("(prefers-color-scheme: dark)");
|
5166
|
+
const prefersDark$ = new Val(false);
|
5167
|
+
if (prefersDarkMatch) {
|
5168
|
+
prefersDark$.setValue(prefersDarkMatch.matches);
|
5169
|
+
this._sideEffect.add(() => {
|
5170
|
+
const handler = (evt) => {
|
5171
|
+
prefersDark$.setValue(evt.matches);
|
5172
|
+
};
|
5173
|
+
prefersDarkMatch.addEventListener("change", handler);
|
5174
|
+
return () => prefersDarkMatch.removeEventListener("change", handler);
|
5175
|
+
});
|
5176
|
+
}
|
5177
|
+
const prefersColorScheme$ = new Val(prefersColorScheme);
|
5178
|
+
this._sideEffect.addDisposer(prefersColorScheme$.reaction((prefersColorScheme2, skipUpdate) => {
|
5179
|
+
if (!skipUpdate) {
|
5180
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.PrefersColorScheme, prefersColorScheme2);
|
5181
|
+
}
|
4226
5182
|
}));
|
4227
|
-
const
|
4228
|
-
|
4229
|
-
const
|
4230
|
-
|
4231
|
-
|
4232
|
-
|
4233
|
-
|
4234
|
-
|
4235
|
-
|
4236
|
-
|
5183
|
+
const darkMode$ = combine([prefersDark$, prefersColorScheme$], ([prefersDark, prefersColorScheme2]) => prefersColorScheme2 === "auto" ? prefersDark : prefersColorScheme2 === "dark");
|
5184
|
+
const state$ = combine([minimized$, maximized$], ([minimized2, maximized2]) => minimized2 ? TELE_BOX_STATE.Minimized : maximized2 ? TELE_BOX_STATE.Maximized : TELE_BOX_STATE.Normal);
|
5185
|
+
const readonlyValConfig = {
|
5186
|
+
darkMode: darkMode$,
|
5187
|
+
state: state$,
|
5188
|
+
root: root$,
|
5189
|
+
rootRect: rootRect$,
|
5190
|
+
stageRect: stageRect$,
|
5191
|
+
minimized: minimized$,
|
5192
|
+
maximized: maximized$
|
5193
|
+
};
|
5194
|
+
withReadonlyValueEnhancer(this, readonlyValConfig, valManager);
|
5195
|
+
const valConfig = {
|
5196
|
+
fullscreen: fullscreen$,
|
5197
|
+
prefersColorScheme: prefersColorScheme$,
|
5198
|
+
readonly: readonly$,
|
5199
|
+
fence: fence$,
|
5200
|
+
stageRatio: stageRatio$,
|
5201
|
+
containerStyle: containerStyle$,
|
5202
|
+
stageStyle: stageStyle$,
|
5203
|
+
defaultBoxBodyStyle: defaultBoxBodyStyle$,
|
5204
|
+
defaultBoxStageStyle: defaultBoxStageStyle$
|
5205
|
+
};
|
5206
|
+
withValueEnhancer(this, valConfig, valManager);
|
5207
|
+
const closeBtnClassName = this.wrapClassName("titlebar-icon-close");
|
5208
|
+
const checkFocusBox = (ev) => {
|
5209
|
+
var _a;
|
5210
|
+
if (!ev.isPrimary || readonly$.value) {
|
4237
5211
|
return;
|
4238
|
-
|
4239
|
-
|
4240
|
-
|
4241
|
-
|
5212
|
+
}
|
5213
|
+
const target = ev.target;
|
5214
|
+
if (!target.tagName) {
|
5215
|
+
return;
|
5216
|
+
}
|
5217
|
+
for (let el = target; el; el = el.parentElement) {
|
5218
|
+
if (el.classList && el.classList.contains(closeBtnClassName)) {
|
5219
|
+
return;
|
5220
|
+
}
|
5221
|
+
const id2 = (_a = el.dataset) == null ? void 0 : _a.teleBoxID;
|
5222
|
+
if (id2) {
|
5223
|
+
const box = this.getBox(id2);
|
5224
|
+
if (box) {
|
5225
|
+
this.focusBox(box);
|
5226
|
+
this.makeBoxTop(box);
|
4242
5227
|
return;
|
4243
|
-
const e4 = (t3 = s3.dataset) == null ? void 0 : t3.teleBoxID;
|
4244
|
-
if (e4) {
|
4245
|
-
const t4 = this.getBox(e4);
|
4246
|
-
if (t4)
|
4247
|
-
return this.focusBox(t4), void this.makeBoxTop(t4);
|
4248
5228
|
}
|
4249
5229
|
}
|
5230
|
+
}
|
4250
5231
|
};
|
4251
|
-
this._sideEffect.addEventListener(window, "
|
4252
|
-
|
4253
|
-
|
4254
|
-
|
4255
|
-
|
4256
|
-
|
4257
|
-
|
4258
|
-
|
4259
|
-
|
4260
|
-
|
4261
|
-
|
4262
|
-
|
4263
|
-
|
4264
|
-
|
4265
|
-
|
4266
|
-
|
4267
|
-
|
4268
|
-
|
4269
|
-
|
4270
|
-
|
5232
|
+
this._sideEffect.addEventListener(window, "pointerdown", checkFocusBox, true);
|
5233
|
+
this.$container = document.createElement("div");
|
5234
|
+
this.$container.className = this.wrapClassName("manager-container");
|
5235
|
+
this.setTheme(theme);
|
5236
|
+
this.$stage = document.createElement("div");
|
5237
|
+
this.$stage.className = this.wrapClassName("manager-stage");
|
5238
|
+
this.$container.appendChild(this.$stage);
|
5239
|
+
this._sideEffect.addDisposer([
|
5240
|
+
darkMode$.subscribe((darkMode) => {
|
5241
|
+
this.$container.classList.toggle(this.wrapClassName("color-scheme-dark"), darkMode);
|
5242
|
+
this.$container.classList.toggle(this.wrapClassName("color-scheme-light"), !darkMode);
|
5243
|
+
}),
|
5244
|
+
fullscreen$.subscribe((fullscreen2) => {
|
5245
|
+
this.$container.classList.toggle(this.wrapClassName("is-fullscreen"), Boolean(fullscreen2));
|
5246
|
+
}),
|
5247
|
+
combine([this.boxes$, fullscreen$], ([boxes, fullscreen2]) => fullscreen2 === "no-titlebar" || fullscreen2 === true && boxes.length <= 1).subscribe((hideSingleTabTitlebar) => {
|
5248
|
+
this.$container.classList.toggle(this.wrapClassName("hide-fullscreen-titlebar"), hideSingleTabTitlebar);
|
5249
|
+
}),
|
5250
|
+
maximized$.subscribe((maximized2) => {
|
5251
|
+
this.$container.classList.toggle(this.wrapClassName("is-maximized"), maximized2);
|
5252
|
+
}),
|
5253
|
+
minimized$.subscribe((minimized2) => {
|
5254
|
+
this.$container.classList.toggle(this.wrapClassName("is-minimized"), minimized2);
|
5255
|
+
}),
|
5256
|
+
containerStyle$.subscribe((containerStyle2) => {
|
5257
|
+
this.$container.style.cssText = containerStyle2;
|
5258
|
+
}),
|
5259
|
+
stageStyle$.subscribe((stageStyle2) => {
|
5260
|
+
this.$stage.style.cssText = stageStyle2;
|
5261
|
+
this.$stage.style.width = stageRect$.value.width + "px";
|
5262
|
+
this.$stage.style.height = stageRect$.value.height + "px";
|
5263
|
+
}),
|
5264
|
+
stageRect$.subscribe((stageRect) => {
|
5265
|
+
this.$stage.style.width = stageRect.width + "px";
|
5266
|
+
this.$stage.style.height = stageRect.height + "px";
|
5267
|
+
}),
|
5268
|
+
root$.subscribe((root2) => {
|
5269
|
+
if (root2) {
|
5270
|
+
root2.appendChild(this.$container);
|
5271
|
+
} else if (this.$container.parentElement) {
|
5272
|
+
this.$container.remove();
|
5273
|
+
}
|
5274
|
+
})
|
5275
|
+
]);
|
5276
|
+
this.collector = collector != null ? collector : new TeleBoxCollector({
|
5277
|
+
minimized$,
|
5278
|
+
readonly$,
|
5279
|
+
darkMode$,
|
5280
|
+
namespace,
|
5281
|
+
root: this.$container,
|
5282
|
+
onClick: () => input_minimized$.setValue(false)
|
5283
|
+
});
|
5284
|
+
this.titleBar = new MaxTitleBar({
|
5285
|
+
namespace: this.namespace,
|
5286
|
+
title$: derive(this.topBox$, (topBox) => (topBox == null ? void 0 : topBox.title) || ""),
|
5287
|
+
boxes$: this.boxes$,
|
5288
|
+
darkMode$,
|
5289
|
+
readonly$,
|
5290
|
+
state$,
|
5291
|
+
rootRect$,
|
5292
|
+
root: this.$container,
|
5293
|
+
onEvent: (event) => {
|
5294
|
+
switch (event.type) {
|
5295
|
+
case TELE_BOX_DELEGATE_EVENT.Maximize: {
|
5296
|
+
this.setMaximized(!maximized$.value);
|
5297
|
+
break;
|
5298
|
+
}
|
5299
|
+
case TELE_BOX_DELEGATE_EVENT.Minimize: {
|
5300
|
+
this.setMinimized(true);
|
5301
|
+
break;
|
5302
|
+
}
|
5303
|
+
case TELE_BOX_EVENT.Close: {
|
5304
|
+
this.removeTopBox();
|
5305
|
+
this.focusTopBox();
|
5306
|
+
break;
|
5307
|
+
}
|
5308
|
+
}
|
5309
|
+
}
|
5310
|
+
});
|
5311
|
+
this._sideEffect.addDisposer([
|
5312
|
+
state$.reaction((state, skipUpdate) => {
|
5313
|
+
if (!skipUpdate) {
|
5314
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.State, state);
|
5315
|
+
}
|
5316
|
+
}),
|
5317
|
+
maximized$.reaction((maximized2, skipUpdate) => {
|
5318
|
+
if (!skipUpdate) {
|
5319
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.Maximized, maximized2);
|
5320
|
+
}
|
5321
|
+
}),
|
5322
|
+
minimized$.reaction((minimized2, skipUpdate) => {
|
5323
|
+
if (!skipUpdate) {
|
5324
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.Minimized, minimized2);
|
5325
|
+
}
|
5326
|
+
}),
|
5327
|
+
darkMode$.reaction((darkMode, skipUpdate) => {
|
5328
|
+
if (!skipUpdate) {
|
5329
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.DarkMode, darkMode);
|
5330
|
+
}
|
5331
|
+
})
|
5332
|
+
]);
|
4271
5333
|
}
|
4272
5334
|
get boxes() {
|
4273
5335
|
return this.boxes$.value;
|
@@ -4275,149 +5337,311 @@ class F$3 {
|
|
4275
5337
|
get topBox() {
|
4276
5338
|
return this.topBox$.value;
|
4277
5339
|
}
|
4278
|
-
setState(
|
4279
|
-
switch (
|
4280
|
-
case
|
4281
|
-
this.setMinimized(false,
|
5340
|
+
setState(state, skipUpdate = false) {
|
5341
|
+
switch (state) {
|
5342
|
+
case TELE_BOX_STATE.Maximized: {
|
5343
|
+
this.setMinimized(false, skipUpdate);
|
5344
|
+
this.setMaximized(true, skipUpdate);
|
5345
|
+
break;
|
5346
|
+
}
|
5347
|
+
case TELE_BOX_STATE.Minimized: {
|
5348
|
+
this.setMinimized(true, skipUpdate);
|
5349
|
+
this.setMaximized(false, skipUpdate);
|
4282
5350
|
break;
|
4283
|
-
|
4284
|
-
|
5351
|
+
}
|
5352
|
+
default: {
|
5353
|
+
this.setMinimized(false, skipUpdate);
|
5354
|
+
this.setMaximized(false, skipUpdate);
|
4285
5355
|
break;
|
4286
|
-
|
4287
|
-
this.setMinimized(false, t2), this.setMaximized(false, t2);
|
5356
|
+
}
|
4288
5357
|
}
|
4289
5358
|
return this;
|
4290
5359
|
}
|
4291
|
-
create(
|
4292
|
-
const
|
4293
|
-
|
4294
|
-
|
4295
|
-
this.
|
4296
|
-
|
4297
|
-
this.
|
4298
|
-
|
4299
|
-
|
4300
|
-
|
4301
|
-
|
4302
|
-
|
4303
|
-
|
4304
|
-
|
4305
|
-
|
4306
|
-
|
4307
|
-
|
4308
|
-
|
4309
|
-
|
4310
|
-
|
4311
|
-
|
4312
|
-
|
4313
|
-
|
4314
|
-
|
4315
|
-
|
4316
|
-
|
4317
|
-
|
4318
|
-
|
4319
|
-
|
4320
|
-
|
4321
|
-
|
5360
|
+
create(config = {}, smartPosition = true) {
|
5361
|
+
const box = new TeleBox(__spreadProps(__spreadValues(__spreadValues({
|
5362
|
+
zIndex: this.topBox ? this.topBox.zIndex + 1 : 100
|
5363
|
+
}, config), smartPosition ? this.smartPosition(config) : {}), {
|
5364
|
+
namespace: this.namespace,
|
5365
|
+
root: this.$stage,
|
5366
|
+
darkMode$: this._darkMode$,
|
5367
|
+
maximized$: this._maximized$,
|
5368
|
+
minimized$: this._minimized$,
|
5369
|
+
fence$: this._fence$,
|
5370
|
+
rootRect$: this._rootRect$,
|
5371
|
+
managerStageRect$: this._stageRect$,
|
5372
|
+
managerStageRatio$: this._stageRatio$,
|
5373
|
+
readonly$: this._readonly$,
|
5374
|
+
collectorRect$: this.collector._rect$,
|
5375
|
+
defaultBoxBodyStyle$: this._defaultBoxBodyStyle$,
|
5376
|
+
defaultBoxStageStyle$: this._defaultBoxStageStyle$
|
5377
|
+
}));
|
5378
|
+
if (box.focus) {
|
5379
|
+
this.focusBox(box);
|
5380
|
+
if (smartPosition) {
|
5381
|
+
this.makeBoxTop(box);
|
5382
|
+
}
|
5383
|
+
}
|
5384
|
+
this.boxes$.setValue([...this.boxes, box]);
|
5385
|
+
this._sideEffect.addDisposer([
|
5386
|
+
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Maximize, () => {
|
5387
|
+
this.setMaximized(!this.maximized);
|
5388
|
+
}),
|
5389
|
+
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Minimize, () => {
|
5390
|
+
this.setMinimized(true);
|
5391
|
+
}),
|
5392
|
+
box._delegateEvents.on(TELE_BOX_DELEGATE_EVENT.Close, () => {
|
5393
|
+
this.remove(box);
|
5394
|
+
this.focusTopBox();
|
5395
|
+
}),
|
5396
|
+
box._intrinsicCoord$.reaction((_, skipUpdate) => {
|
5397
|
+
if (!skipUpdate) {
|
5398
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.IntrinsicMove, box);
|
5399
|
+
}
|
5400
|
+
}),
|
5401
|
+
box._intrinsicSize$.reaction((_, skipUpdate) => {
|
5402
|
+
if (!skipUpdate) {
|
5403
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.IntrinsicResize, box);
|
5404
|
+
}
|
5405
|
+
}),
|
5406
|
+
box._zIndex$.reaction((_, skipUpdate) => {
|
5407
|
+
if (this.boxes.length > 0) {
|
5408
|
+
const topBox = this.boxes.reduce((topBox2, box2) => topBox2.zIndex > box2.zIndex ? topBox2 : box2);
|
5409
|
+
this.topBox$.setValue(topBox);
|
5410
|
+
}
|
5411
|
+
if (!skipUpdate) {
|
5412
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.ZIndex, box);
|
5413
|
+
}
|
5414
|
+
})
|
5415
|
+
]);
|
5416
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.Created, box);
|
5417
|
+
return box;
|
5418
|
+
}
|
5419
|
+
query(config) {
|
5420
|
+
return config ? this.boxes.filter(this.teleBoxMatcher(config)) : [...this.boxes];
|
5421
|
+
}
|
5422
|
+
queryOne(config) {
|
5423
|
+
return config ? this.boxes.find(this.teleBoxMatcher(config)) : this.boxes[0];
|
5424
|
+
}
|
5425
|
+
update(boxID, config, skipUpdate = false) {
|
5426
|
+
const box = this.boxes.find((box2) => box2.id === boxID);
|
5427
|
+
if (box) {
|
5428
|
+
return this.updateBox(box, config, skipUpdate);
|
5429
|
+
}
|
4322
5430
|
}
|
4323
|
-
updateAll(
|
4324
|
-
this.boxes.forEach((
|
4325
|
-
this.updateBox(
|
5431
|
+
updateAll(config, skipUpdate = false) {
|
5432
|
+
this.boxes.forEach((box) => {
|
5433
|
+
this.updateBox(box, config, skipUpdate);
|
4326
5434
|
});
|
4327
5435
|
}
|
4328
|
-
remove(
|
4329
|
-
const
|
4330
|
-
if (
|
4331
|
-
const
|
4332
|
-
|
5436
|
+
remove(boxOrID, skipUpdate = false) {
|
5437
|
+
const index2 = this.getBoxIndex(boxOrID);
|
5438
|
+
if (index2 >= 0) {
|
5439
|
+
const boxes = this.boxes.slice();
|
5440
|
+
const deletedBoxes = boxes.splice(index2, 1);
|
5441
|
+
this.boxes$.setValue(boxes);
|
5442
|
+
deletedBoxes.forEach((box) => box.destroy());
|
5443
|
+
if (!skipUpdate) {
|
5444
|
+
if (this.boxes.length <= 0) {
|
5445
|
+
this.setMaximized(false);
|
5446
|
+
this.setMinimized(false);
|
5447
|
+
}
|
5448
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.Removed, deletedBoxes);
|
5449
|
+
}
|
5450
|
+
return deletedBoxes[0];
|
4333
5451
|
}
|
5452
|
+
return;
|
4334
5453
|
}
|
4335
5454
|
removeTopBox() {
|
4336
|
-
if (this.topBox)
|
5455
|
+
if (this.topBox) {
|
4337
5456
|
return this.remove(this.topBox);
|
5457
|
+
}
|
5458
|
+
return;
|
5459
|
+
}
|
5460
|
+
removeAll(skipUpdate = false) {
|
5461
|
+
const deletedBoxes = this.boxes$.value;
|
5462
|
+
this.boxes$.setValue([]);
|
5463
|
+
deletedBoxes.forEach((box) => box.destroy());
|
5464
|
+
if (!skipUpdate) {
|
5465
|
+
if (this.boxes.length <= 0) {
|
5466
|
+
this.setMaximized(false);
|
5467
|
+
this.setMinimized(false);
|
5468
|
+
}
|
5469
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.Removed, deletedBoxes);
|
5470
|
+
}
|
5471
|
+
return deletedBoxes;
|
4338
5472
|
}
|
4339
|
-
|
4340
|
-
|
4341
|
-
|
5473
|
+
setTheme(theme) {
|
5474
|
+
Object.keys(theme).forEach((key) => {
|
5475
|
+
var _a;
|
5476
|
+
this.$container.style.setProperty(`--tele-${key}`, (_a = theme[key]) != null ? _a : null);
|
5477
|
+
});
|
4342
5478
|
}
|
4343
|
-
mount(
|
4344
|
-
this._root$.setValue(
|
5479
|
+
mount(root) {
|
5480
|
+
this._root$.setValue(root);
|
4345
5481
|
}
|
4346
5482
|
unmount() {
|
4347
5483
|
this._root$.setValue(null);
|
4348
5484
|
}
|
4349
|
-
destroy(
|
4350
|
-
this.events.clearListeners()
|
5485
|
+
destroy(skipUpdate = false) {
|
5486
|
+
this.events.clearListeners();
|
5487
|
+
this._sideEffect.flushAll();
|
5488
|
+
this.removeAll(skipUpdate);
|
5489
|
+
this.collector.destroy();
|
5490
|
+
this.titleBar.destroy();
|
4351
5491
|
}
|
4352
|
-
wrapClassName(
|
4353
|
-
return `${this.namespace}-${
|
5492
|
+
wrapClassName(className) {
|
5493
|
+
return `${this.namespace}-${className}`;
|
4354
5494
|
}
|
4355
|
-
focusBox(
|
4356
|
-
const
|
4357
|
-
|
4358
|
-
|
4359
|
-
|
4360
|
-
|
4361
|
-
|
4362
|
-
|
4363
|
-
|
5495
|
+
focusBox(boxOrID, skipUpdate = false) {
|
5496
|
+
const targetBox = this.getBox(boxOrID);
|
5497
|
+
if (targetBox) {
|
5498
|
+
this.boxes.forEach((box) => {
|
5499
|
+
if (targetBox === box) {
|
5500
|
+
let focusChanged = false;
|
5501
|
+
if (!targetBox.focus) {
|
5502
|
+
focusChanged = true;
|
5503
|
+
targetBox._focus$.setValue(true, skipUpdate);
|
5504
|
+
}
|
5505
|
+
if (focusChanged && !skipUpdate) {
|
5506
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.Focused, targetBox);
|
5507
|
+
}
|
5508
|
+
} else if (box.focus) {
|
5509
|
+
this.blurBox(box, skipUpdate);
|
5510
|
+
}
|
5511
|
+
});
|
5512
|
+
this.titleBar.focusBox(targetBox);
|
5513
|
+
}
|
4364
5514
|
}
|
4365
5515
|
focusTopBox() {
|
4366
|
-
if (this.topBox && !this.topBox.focus)
|
5516
|
+
if (this.topBox && !this.topBox.focus) {
|
4367
5517
|
return this.focusBox(this.topBox);
|
5518
|
+
}
|
4368
5519
|
}
|
4369
|
-
blurBox(
|
4370
|
-
const
|
4371
|
-
|
4372
|
-
|
4373
|
-
|
4374
|
-
|
4375
|
-
|
4376
|
-
|
5520
|
+
blurBox(boxOrID, skipUpdate = false) {
|
5521
|
+
const targetBox = this.getBox(boxOrID);
|
5522
|
+
if (targetBox) {
|
5523
|
+
if (targetBox.focus) {
|
5524
|
+
targetBox._focus$.setValue(false, skipUpdate);
|
5525
|
+
if (!skipUpdate) {
|
5526
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.Blurred, targetBox);
|
5527
|
+
}
|
5528
|
+
}
|
5529
|
+
if (this.titleBar.focusedBox === targetBox) {
|
5530
|
+
this.titleBar.focusBox();
|
5531
|
+
}
|
5532
|
+
}
|
4377
5533
|
}
|
4378
|
-
|
4379
|
-
|
4380
|
-
|
5534
|
+
blurAll(skipUpdate = false) {
|
5535
|
+
this.boxes.forEach((box) => {
|
5536
|
+
if (box.focus) {
|
5537
|
+
box._focus$.setValue(false, skipUpdate);
|
5538
|
+
if (!skipUpdate) {
|
5539
|
+
this.events.emit(TELE_BOX_MANAGER_EVENT.Blurred, box);
|
5540
|
+
}
|
5541
|
+
}
|
5542
|
+
});
|
5543
|
+
if (this.titleBar.focusedBox) {
|
5544
|
+
this.titleBar.focusBox();
|
5545
|
+
}
|
4381
5546
|
}
|
4382
|
-
|
4383
|
-
|
4384
|
-
|
5547
|
+
teleBoxMatcher(config) {
|
5548
|
+
const keys = Object.keys(config);
|
5549
|
+
return (box) => keys.every((key) => config[key] === box[key]);
|
4385
5550
|
}
|
4386
|
-
|
4387
|
-
|
4388
|
-
|
4389
|
-
|
4390
|
-
|
4391
|
-
|
4392
|
-
|
4393
|
-
|
5551
|
+
updateBox(box, config, skipUpdate = false) {
|
5552
|
+
var _a, _b, _c, _d, _e, _f;
|
5553
|
+
if (config.x != null || config.y != null) {
|
5554
|
+
box._intrinsicCoord$.setValue({
|
5555
|
+
x: (_a = config.x) != null ? _a : box.intrinsicX,
|
5556
|
+
y: (_b = config.y) != null ? _b : box.intrinsicY
|
5557
|
+
}, skipUpdate);
|
5558
|
+
}
|
5559
|
+
if (config.width != null || config.height != null) {
|
5560
|
+
box._intrinsicSize$.setValue({
|
5561
|
+
width: (_c = config.width) != null ? _c : box.intrinsicWidth,
|
5562
|
+
height: (_d = config.height) != null ? _d : box.intrinsicHeight
|
5563
|
+
}, skipUpdate);
|
5564
|
+
}
|
5565
|
+
if (config.title != null) {
|
5566
|
+
box._title$.setValue(config.title);
|
5567
|
+
}
|
5568
|
+
if (config.visible != null) {
|
5569
|
+
box._visible$.setValue(config.visible, skipUpdate);
|
5570
|
+
}
|
5571
|
+
if (config.resizable != null) {
|
5572
|
+
box._resizable$.setValue(config.resizable, skipUpdate);
|
5573
|
+
}
|
5574
|
+
if (config.draggable != null) {
|
5575
|
+
box._draggable$.setValue(config.draggable, skipUpdate);
|
5576
|
+
}
|
5577
|
+
if (config.boxRatio != null) {
|
5578
|
+
box._boxRatio$.setValue(config.boxRatio, skipUpdate);
|
5579
|
+
}
|
5580
|
+
if (config.zIndex != null) {
|
5581
|
+
box._zIndex$.setValue(config.zIndex, skipUpdate);
|
5582
|
+
}
|
5583
|
+
if (config.stageRatio !== void 0) {
|
5584
|
+
box.setStageRatio(config.stageRatio, skipUpdate);
|
5585
|
+
}
|
5586
|
+
if (config.content != null) {
|
5587
|
+
box.mountContent(config.content);
|
5588
|
+
}
|
5589
|
+
if (config.footer != null) {
|
5590
|
+
box.mountFooter(config.footer);
|
5591
|
+
}
|
5592
|
+
if (config.minHeight != null || config.minWidth != null) {
|
5593
|
+
box._minSize$.setValue({
|
5594
|
+
width: (_e = config.minWidth) != null ? _e : box.minWidth,
|
5595
|
+
height: (_f = config.minHeight) != null ? _f : box.minHeight
|
5596
|
+
}, skipUpdate);
|
5597
|
+
}
|
5598
|
+
}
|
5599
|
+
smartPosition(rect) {
|
5600
|
+
let { x: x2, y: y2 } = rect;
|
5601
|
+
const { width = 0.5, height = 0.5 } = rect;
|
5602
|
+
const stageRect = this.stageRect;
|
5603
|
+
const topBox = this.topBox;
|
5604
|
+
if (x2 == null) {
|
5605
|
+
let pxX = 20;
|
5606
|
+
if (topBox) {
|
5607
|
+
const pxPreferredX = topBox.pxIntrinsicCoord.x + 20;
|
5608
|
+
const pxIntrinsicWidth = width * stageRect.width;
|
5609
|
+
if (pxPreferredX + pxIntrinsicWidth <= stageRect.width) {
|
5610
|
+
pxX = pxPreferredX;
|
5611
|
+
}
|
4394
5612
|
}
|
4395
|
-
|
5613
|
+
x2 = pxX / stageRect.width;
|
4396
5614
|
}
|
4397
|
-
if (
|
4398
|
-
let
|
4399
|
-
if (
|
4400
|
-
const
|
4401
|
-
|
5615
|
+
if (y2 == null) {
|
5616
|
+
let pxY = 20;
|
5617
|
+
if (topBox) {
|
5618
|
+
const pxPreferredY = topBox.pxIntrinsicCoord.y + 20;
|
5619
|
+
const pxIntrinsicHeight = height * stageRect.height;
|
5620
|
+
if (pxPreferredY + pxIntrinsicHeight <= stageRect.height) {
|
5621
|
+
pxY = pxPreferredY;
|
5622
|
+
}
|
4402
5623
|
}
|
4403
|
-
|
5624
|
+
y2 = pxY / stageRect.height;
|
4404
5625
|
}
|
4405
|
-
return { x:
|
5626
|
+
return { x: x2, y: y2, width, height };
|
4406
5627
|
}
|
4407
|
-
makeBoxTop(
|
4408
|
-
|
5628
|
+
makeBoxTop(box, skipUpdate = false) {
|
5629
|
+
if (this.topBox) {
|
5630
|
+
if (box !== this.topBox) {
|
5631
|
+
box._zIndex$.setValue(this.topBox.zIndex + 1, skipUpdate);
|
5632
|
+
}
|
5633
|
+
}
|
4409
5634
|
}
|
4410
|
-
getBoxIndex(
|
4411
|
-
return typeof
|
5635
|
+
getBoxIndex(boxOrID) {
|
5636
|
+
return typeof boxOrID === "string" ? this.boxes.findIndex((box) => box.id === boxOrID) : this.boxes.findIndex((box) => box === boxOrID);
|
4412
5637
|
}
|
4413
|
-
getBox(
|
4414
|
-
return typeof
|
5638
|
+
getBox(boxOrID) {
|
5639
|
+
return typeof boxOrID === "string" ? this.boxes.find((box) => box.id === boxOrID) : boxOrID;
|
4415
5640
|
}
|
4416
5641
|
}
|
4417
5642
|
const createBoxManager = (manager, callbacks2, emitter2, boxEmitter2, options) => {
|
4418
5643
|
return new BoxManager({
|
4419
5644
|
safeSetAttributes: (attributes) => manager.safeSetAttributes(attributes),
|
4420
|
-
getMainView: () => manager.mainView,
|
4421
5645
|
updateAppState: (...args) => {
|
4422
5646
|
var _a;
|
4423
5647
|
return (_a = manager.appManager) == null ? void 0 : _a.store.updateAppState(...args);
|
@@ -4447,17 +5671,17 @@ class BoxManager {
|
|
4447
5671
|
const { emitter: emitter2, callbacks: callbacks2, boxEmitter: boxEmitter2 } = context;
|
4448
5672
|
this.teleBoxManager = this.setupBoxManager(createTeleBoxManagerConfig);
|
4449
5673
|
this.sideEffectManager.add(() => [
|
4450
|
-
this.teleBoxManager.
|
5674
|
+
this.teleBoxManager.onValChanged("state", (state) => {
|
4451
5675
|
callbacks2.emit("boxStateChange", state);
|
4452
5676
|
emitter2.emit("boxStateChange", state);
|
4453
5677
|
}),
|
4454
|
-
this.teleBoxManager.
|
5678
|
+
this.teleBoxManager.onValChanged("darkMode", (darkMode) => {
|
4455
5679
|
callbacks2.emit("darkModeChange", darkMode);
|
4456
5680
|
}),
|
4457
|
-
this.teleBoxManager.
|
5681
|
+
this.teleBoxManager.onValChanged("prefersColorScheme", (colorScheme) => {
|
4458
5682
|
callbacks2.emit("prefersColorSchemeChange", colorScheme);
|
4459
5683
|
}),
|
4460
|
-
this.teleBoxManager.
|
5684
|
+
this.teleBoxManager.onValChanged("minimized", (minimized, skipUpdate) => {
|
4461
5685
|
if (skipUpdate) {
|
4462
5686
|
return;
|
4463
5687
|
}
|
@@ -4473,7 +5697,7 @@ class BoxManager {
|
|
4473
5697
|
}
|
4474
5698
|
}
|
4475
5699
|
}),
|
4476
|
-
this.teleBoxManager.
|
5700
|
+
this.teleBoxManager.onValChanged("maximized", (maximized, skipUpdate) => {
|
4477
5701
|
if (skipUpdate) {
|
4478
5702
|
return;
|
4479
5703
|
}
|
@@ -4485,7 +5709,11 @@ class BoxManager {
|
|
4485
5709
|
});
|
4486
5710
|
}),
|
4487
5711
|
this.teleBoxManager.events.on("intrinsic_move", debounce((box) => {
|
4488
|
-
boxEmitter2.emit("move", {
|
5712
|
+
boxEmitter2.emit("move", {
|
5713
|
+
appId: box.id,
|
5714
|
+
x: box.intrinsicX,
|
5715
|
+
y: box.intrinsicY
|
5716
|
+
});
|
4489
5717
|
}, 50)),
|
4490
5718
|
this.teleBoxManager.events.on("intrinsic_resize", debounce((box) => {
|
4491
5719
|
boxEmitter2.emit("resize", {
|
@@ -4506,21 +5734,11 @@ class BoxManager {
|
|
4506
5734
|
this.teleBoxManager.events.on("z_index", (box) => {
|
4507
5735
|
this.context.updateAppState(box.id, AppAttributes.ZIndex, box.zIndex);
|
4508
5736
|
}),
|
4509
|
-
this.teleBoxManager._stageRect$.subscribe((stage) => {
|
4510
|
-
emitter2.emit("playgroundSizeChange", stage);
|
4511
|
-
this.context.notifyContainerRectUpdate(stage);
|
4512
|
-
}),
|
4513
|
-
emitter2.on("writableChange", (isWritable) => {
|
4514
|
-
this.teleBoxManager.setHighlightStage(isWritable);
|
4515
|
-
}),
|
4516
5737
|
emitter2.on("containerSizeRatioUpdate", (ratio) => {
|
4517
5738
|
this.teleBoxManager._stageRatio$.setValue(ratio);
|
4518
5739
|
})
|
4519
5740
|
]);
|
4520
5741
|
}
|
4521
|
-
get mainView() {
|
4522
|
-
return this.context.getMainView();
|
4523
|
-
}
|
4524
5742
|
get canOperate() {
|
4525
5743
|
return this.context.canOperate();
|
4526
5744
|
}
|
@@ -4545,11 +5763,14 @@ class BoxManager {
|
|
4545
5763
|
get stageRect() {
|
4546
5764
|
return this.teleBoxManager.stageRect;
|
4547
5765
|
}
|
5766
|
+
get stageRect$() {
|
5767
|
+
return this.teleBoxManager._stageRect$;
|
5768
|
+
}
|
4548
5769
|
createBox(params) {
|
4549
5770
|
var _a, _b, _c;
|
4550
5771
|
if (!this.teleBoxManager)
|
4551
5772
|
return;
|
4552
|
-
let { minwidth = MIN_WIDTH, minheight = MIN_HEIGHT } = (_a = params.app.config) != null ? _a : {};
|
5773
|
+
let { minwidth = MIN_WIDTH, minheight = MIN_HEIGHT, enableShadowDOM = true } = (_a = params.app.config) != null ? _a : {};
|
4553
5774
|
const { width, height } = (_b = params.app.config) != null ? _b : {};
|
4554
5775
|
const title = ((_c = params.options) == null ? void 0 : _c.title) || params.appId;
|
4555
5776
|
const rect = this.teleBoxManager.rootRect;
|
@@ -4565,10 +5786,12 @@ class BoxManager {
|
|
4565
5786
|
minHeight: minheight,
|
4566
5787
|
width,
|
4567
5788
|
height,
|
4568
|
-
id: params.appId
|
5789
|
+
id: params.appId,
|
5790
|
+
enableShadowDOM
|
4569
5791
|
};
|
4570
|
-
this.teleBoxManager.create(createBoxConfig, params.smartPosition);
|
5792
|
+
const box = this.teleBoxManager.create(createBoxConfig, params.smartPosition);
|
4571
5793
|
this.context.emitter.emit(`${params.appId}${Events.WindowCreated}`);
|
5794
|
+
return box;
|
4572
5795
|
}
|
4573
5796
|
setupBoxManager(createTeleBoxManagerConfig) {
|
4574
5797
|
const root = WindowManager.playground;
|
@@ -4578,7 +5801,16 @@ class BoxManager {
|
|
4578
5801
|
fence: false,
|
4579
5802
|
prefersColorScheme: createTeleBoxManagerConfig == null ? void 0 : createTeleBoxManagerConfig.prefersColorScheme
|
4580
5803
|
};
|
4581
|
-
|
5804
|
+
if (createTeleBoxManagerConfig == null ? void 0 : createTeleBoxManagerConfig.containerStyle) {
|
5805
|
+
initManagerState.containerStyle = createTeleBoxManagerConfig.containerStyle;
|
5806
|
+
}
|
5807
|
+
if (createTeleBoxManagerConfig == null ? void 0 : createTeleBoxManagerConfig.stageStyle) {
|
5808
|
+
initManagerState.stageStyle = createTeleBoxManagerConfig.stageStyle;
|
5809
|
+
}
|
5810
|
+
if (createTeleBoxManagerConfig == null ? void 0 : createTeleBoxManagerConfig.fullscreen) {
|
5811
|
+
initManagerState.fullscreen = createTeleBoxManagerConfig.fullscreen;
|
5812
|
+
}
|
5813
|
+
const manager = new TeleBoxManager(initManagerState);
|
4582
5814
|
if (this.teleBoxManager) {
|
4583
5815
|
this.teleBoxManager.destroy();
|
4584
5816
|
}
|
@@ -4614,13 +5846,15 @@ class BoxManager {
|
|
4614
5846
|
return;
|
4615
5847
|
const box = this.getBox(state.id);
|
4616
5848
|
if (box) {
|
4617
|
-
|
4618
|
-
|
4619
|
-
|
4620
|
-
|
4621
|
-
|
4622
|
-
|
4623
|
-
|
5849
|
+
if (state.size) {
|
5850
|
+
box._intrinsicSize$.setValue(state.size, true);
|
5851
|
+
}
|
5852
|
+
if (state.position) {
|
5853
|
+
box._intrinsicCoord$.setValue(state.position, true);
|
5854
|
+
}
|
5855
|
+
if (state.zIndex) {
|
5856
|
+
box._zIndex$.setValue(state.zIndex, true);
|
5857
|
+
}
|
4624
5858
|
setTimeout(() => {
|
4625
5859
|
if (state.focus) {
|
4626
5860
|
this.teleBoxManager.focusBox(box.id, true);
|
@@ -4636,13 +5870,19 @@ class BoxManager {
|
|
4636
5870
|
}
|
4637
5871
|
}
|
4638
5872
|
moveBox({ appId, x: x2, y: y2 }) {
|
4639
|
-
this.
|
5873
|
+
const box = this.getBox(appId);
|
5874
|
+
if (box) {
|
5875
|
+
box._intrinsicCoord$.setValue({ x: x2, y: y2 }, true);
|
5876
|
+
}
|
4640
5877
|
}
|
4641
5878
|
focusBox({ appId }, skipUpdate = true) {
|
4642
5879
|
this.teleBoxManager.focusBox(appId, skipUpdate);
|
4643
5880
|
}
|
4644
5881
|
resizeBox({ appId, width, height, skipUpdate }) {
|
4645
|
-
this.
|
5882
|
+
const box = this.getBox(appId);
|
5883
|
+
if (box) {
|
5884
|
+
box._intrinsicSize$.setValue({ width, height }, skipUpdate);
|
5885
|
+
}
|
4646
5886
|
}
|
4647
5887
|
setBoxMinSize(params) {
|
4648
5888
|
this.teleBoxManager.update(params.appId, {
|
@@ -5280,16 +6520,16 @@ class Cursor {
|
|
5280
6520
|
this.cursorManager = cursorManager;
|
5281
6521
|
this.wrapper = wrapper;
|
5282
6522
|
this.move = (position) => {
|
5283
|
-
var _a;
|
6523
|
+
var _a, _b;
|
5284
6524
|
if (position.type === "main") {
|
5285
|
-
const rect = this.
|
6525
|
+
const rect = (_a = this.manager.boxManager) == null ? void 0 : _a.stageRect;
|
5286
6526
|
if (this.component && rect) {
|
5287
6527
|
this.autoHidden();
|
5288
6528
|
this.moveCursor(position, rect, this.manager.mainView);
|
5289
6529
|
}
|
5290
6530
|
} else {
|
5291
6531
|
const focusView = this.cursorManager.focusView;
|
5292
|
-
const viewRect = (
|
6532
|
+
const viewRect = (_b = focusView == null ? void 0 : focusView.divElement) == null ? void 0 : _b.getBoundingClientRect();
|
5293
6533
|
const viewCamera = focusView == null ? void 0 : focusView.camera;
|
5294
6534
|
if (focusView && viewRect && viewCamera && this.component) {
|
5295
6535
|
this.autoHidden();
|
@@ -5312,11 +6552,14 @@ class Cursor {
|
|
5312
6552
|
let translateX = point.x - 2;
|
5313
6553
|
let translateY = point.y - 18;
|
5314
6554
|
if (type === "app") {
|
5315
|
-
const wrapperRect = this.cursorManager.
|
6555
|
+
const wrapperRect = this.cursorManager.playgroundRect;
|
5316
6556
|
if (wrapperRect) {
|
5317
6557
|
translateX = translateX + rect.x - wrapperRect.x;
|
5318
6558
|
translateY = translateY + rect.y - wrapperRect.y;
|
5319
6559
|
}
|
6560
|
+
} else {
|
6561
|
+
translateX = translateX + rect.x;
|
6562
|
+
translateY = translateY + rect.y;
|
5320
6563
|
}
|
5321
6564
|
if (point.x < 0 || point.x > rect.width || point.y < 0 || point.y > rect.height) {
|
5322
6565
|
(_a = this.component) == null ? void 0 : _a.$set({ visible: false, x: translateX, y: translateY });
|
@@ -5486,7 +6729,7 @@ class CursorManager {
|
|
5486
6729
|
return;
|
5487
6730
|
}
|
5488
6731
|
this.updateCursor(this.getType(event), event.clientX, event.clientY);
|
5489
|
-
},
|
6732
|
+
}, 48);
|
5490
6733
|
this.getPoint = (view, clientX, clientY) => {
|
5491
6734
|
var _a2;
|
5492
6735
|
const rect = (_a2 = view == null ? void 0 : view.divElement) == null ? void 0 : _a2.getBoundingClientRect();
|
@@ -5547,7 +6790,7 @@ class CursorManager {
|
|
5547
6790
|
wrapper.removeEventListener("pointerleave", this.mouseLeaveListener);
|
5548
6791
|
};
|
5549
6792
|
});
|
5550
|
-
this.
|
6793
|
+
this.updateContainerRect();
|
5551
6794
|
}
|
5552
6795
|
setMainViewDivElement(div) {
|
5553
6796
|
this.mainViewElement = div;
|
@@ -5577,8 +6820,8 @@ class CursorManager {
|
|
5577
6820
|
}
|
5578
6821
|
updateContainerRect() {
|
5579
6822
|
var _a, _b;
|
5580
|
-
this.
|
5581
|
-
this.
|
6823
|
+
this.wrapperRect = (_a = this.manager.boxManager) == null ? void 0 : _a.stageRect;
|
6824
|
+
this.playgroundRect = (_b = WindowManager.playground) == null ? void 0 : _b.getBoundingClientRect();
|
5582
6825
|
}
|
5583
6826
|
deleteCursor(uid) {
|
5584
6827
|
this.store.cleanCursor(uid);
|
@@ -5632,18 +6875,22 @@ class ReconnectRefresher {
|
|
5632
6875
|
this.reactors = /* @__PURE__ */ new Map();
|
5633
6876
|
this.disposers = /* @__PURE__ */ new Map();
|
5634
6877
|
this.onPhaseChanged = (phase) => {
|
5635
|
-
var _a;
|
6878
|
+
var _a, _b;
|
5636
6879
|
if (phase === RoomPhase.Reconnecting) {
|
5637
6880
|
this.ctx.emitter.emit("startReconnect");
|
5638
6881
|
}
|
5639
6882
|
if (phase === RoomPhase.Connected && this.phase === RoomPhase.Reconnecting) {
|
5640
|
-
(_a = this.room) == null ? void 0 : _a.
|
6883
|
+
if ((_a = this.room) == null ? void 0 : _a.isWritable) {
|
6884
|
+
(_b = this.room) == null ? void 0 : _b.dispatchMagixEvent(EnsureReconnectEvent, {});
|
6885
|
+
} else {
|
6886
|
+
this.onReconnected();
|
6887
|
+
}
|
5641
6888
|
}
|
5642
6889
|
this.phase = phase;
|
5643
6890
|
};
|
5644
6891
|
this.onReconnected = debounce(() => {
|
5645
6892
|
this._onReconnected();
|
5646
|
-
},
|
6893
|
+
}, 1e3);
|
5647
6894
|
this._onReconnected = () => {
|
5648
6895
|
log("onReconnected refresh reactors");
|
5649
6896
|
this.releaseDisposers();
|
@@ -5691,6 +6938,7 @@ class ReconnectRefresher {
|
|
5691
6938
|
this.reactors.set(id2, func);
|
5692
6939
|
this.disposers.set(id2, func());
|
5693
6940
|
}
|
6941
|
+
return () => this.remove(id2);
|
5694
6942
|
}
|
5695
6943
|
remove(id2) {
|
5696
6944
|
if (this.reactors.has(id2)) {
|
@@ -5762,6 +7010,9 @@ const replaceRoomFunction = (room, manager) => {
|
|
5762
7010
|
room.lockImage = (...args) => manager.lockImage(...args);
|
5763
7011
|
room.lockImages = (...args) => manager.lockImages(...args);
|
5764
7012
|
delegateRemoveScenes(room, manager);
|
7013
|
+
if (!room.dynamicPpt.slideStateAdapter.pptHandler) {
|
7014
|
+
room.dynamicPpt.slideStateAdapter.pptHandler = manager.createPPTHandler();
|
7015
|
+
}
|
5765
7016
|
}
|
5766
7017
|
};
|
5767
7018
|
const delegateRemoveScenes = (room, manager) => {
|
@@ -15309,6 +16560,10 @@ const BuiltinApps = {
|
|
15309
16560
|
DocsViewer: NetlessAppDocsViewer.kind,
|
15310
16561
|
MediaPlayer: K.kind
|
15311
16562
|
};
|
16563
|
+
const BuiltinAppsMap = {
|
16564
|
+
[BuiltinApps.DocsViewer]: NetlessAppDocsViewer,
|
16565
|
+
[BuiltinApps.MediaPlayer]: K
|
16566
|
+
};
|
15312
16567
|
var videoJs = "";
|
15313
16568
|
var style$1 = "";
|
15314
16569
|
var style = "";
|
@@ -15316,20 +16571,20 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
15316
16571
|
const _WindowManager = class extends InvisiblePlugin {
|
15317
16572
|
constructor(context) {
|
15318
16573
|
super(context);
|
15319
|
-
this.version = "1.0.0-canary.
|
15320
|
-
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.
|
16574
|
+
this.version = "1.0.0-canary.32";
|
16575
|
+
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.29", "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" } };
|
15321
16576
|
this.emitter = callbacks$1;
|
15322
16577
|
this.viewMode = ViewMode.Broadcaster;
|
16578
|
+
this.viewMode$ = new Val(ViewMode.Broadcaster);
|
15323
16579
|
this.isReplay = isPlayer(this.displayer);
|
15324
16580
|
this.containerSizeRatio = _WindowManager.containerSizeRatio;
|
15325
16581
|
_WindowManager.displayer = context.displayer;
|
15326
|
-
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.
|
16582
|
+
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.29", "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" } };
|
15327
16583
|
}
|
15328
16584
|
static async mount(params) {
|
15329
16585
|
var _a;
|
15330
16586
|
const room = params.room;
|
15331
16587
|
_WindowManager.container = params.container;
|
15332
|
-
const containerSizeRatio = params.containerSizeRatio;
|
15333
16588
|
const debug = params.debug;
|
15334
16589
|
const cursor = params.cursor;
|
15335
16590
|
_WindowManager.params = params;
|
@@ -15366,21 +16621,22 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15366
16621
|
if (!manager) {
|
15367
16622
|
throw new Error("[WindowManager]: create manager failed");
|
15368
16623
|
}
|
15369
|
-
if (containerSizeRatio) {
|
15370
|
-
_WindowManager.containerSizeRatio = containerSizeRatio;
|
16624
|
+
if (params.containerSizeRatio) {
|
16625
|
+
_WindowManager.containerSizeRatio = params.containerSizeRatio;
|
15371
16626
|
}
|
16627
|
+
manager.containerSizeRatio = _WindowManager.containerSizeRatio;
|
15372
16628
|
await manager.ensureAttributes();
|
15373
16629
|
manager.appManager = new AppManager(manager);
|
15374
16630
|
manager._pageState = new PageStateImpl(manager.appManager);
|
15375
16631
|
manager.cursorManager = new CursorManager(manager.appManager, Boolean(cursor), params.applianceIcons);
|
15376
|
-
if (containerSizeRatio) {
|
15377
|
-
manager.containerSizeRatio = containerSizeRatio;
|
15378
|
-
}
|
15379
16632
|
manager.boxManager = createBoxManager(manager, callbacks$1, emitter, boxEmitter, {
|
15380
16633
|
collectorContainer: params.collectorContainer,
|
15381
16634
|
collectorStyles: params.collectorStyles,
|
15382
16635
|
prefersColorScheme: params.prefersColorScheme,
|
15383
|
-
stageRatio:
|
16636
|
+
stageRatio: _WindowManager.containerSizeRatio,
|
16637
|
+
containerStyle: params.containerStyle,
|
16638
|
+
stageStyle: params.stageStyle,
|
16639
|
+
fullscreen: params.fullscreen
|
15384
16640
|
});
|
15385
16641
|
(_a = manager.appManager) == null ? void 0 : _a.setBoxManager(manager.boxManager);
|
15386
16642
|
if (params.container) {
|
@@ -15407,22 +16663,22 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15407
16663
|
} catch (error) {
|
15408
16664
|
throw new Error("[WindowManger]: room must be switched to be writable");
|
15409
16665
|
}
|
15410
|
-
manager = await
|
15411
|
-
manager.ensureAttributes();
|
16666
|
+
manager = await createInvisiblePlugin(room);
|
16667
|
+
manager == null ? void 0 : manager.ensureAttributes();
|
15412
16668
|
await wait(500);
|
15413
16669
|
await room.setWritable(false);
|
15414
16670
|
} else {
|
15415
|
-
manager = await
|
16671
|
+
manager = await createInvisiblePlugin(room);
|
15416
16672
|
}
|
15417
16673
|
}
|
15418
16674
|
}
|
15419
16675
|
return manager;
|
15420
16676
|
}
|
15421
|
-
static initContainer(container, overwriteStyles) {
|
16677
|
+
static initContainer(container, target, overwriteStyles) {
|
15422
16678
|
if (!_WindowManager.container) {
|
15423
16679
|
_WindowManager.container = container;
|
15424
16680
|
}
|
15425
|
-
const { playground, mainViewElement } = setupWrapper(container);
|
16681
|
+
const { playground, mainViewElement } = setupWrapper(container, target);
|
15426
16682
|
_WindowManager.playground = playground;
|
15427
16683
|
if (overwriteStyles) {
|
15428
16684
|
const style2 = document.createElement("style");
|
@@ -15435,7 +16691,7 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15435
16691
|
return appRegister.registered;
|
15436
16692
|
}
|
15437
16693
|
bindContainer(container) {
|
15438
|
-
var _a, _b, _c, _d, _e;
|
16694
|
+
var _a, _b, _c, _d, _e, _f;
|
15439
16695
|
if (isRoom(this.displayer) && this.room.phase !== RoomPhase.Connected) {
|
15440
16696
|
throw new BindContainerRoomPhaseInvalidError();
|
15441
16697
|
}
|
@@ -15444,23 +16700,24 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15444
16700
|
container.appendChild(_WindowManager.container.firstChild);
|
15445
16701
|
}
|
15446
16702
|
} else {
|
15447
|
-
|
16703
|
+
const teleboxContainer = (_a = this.boxManager) == null ? void 0 : _a.teleBoxManager.$stage;
|
16704
|
+
if (_WindowManager.params && teleboxContainer) {
|
15448
16705
|
const params = _WindowManager.params;
|
15449
|
-
const mainViewElement = _WindowManager.initContainer(container, params.overwriteStyles);
|
16706
|
+
const mainViewElement = _WindowManager.initContainer(container, teleboxContainer, params.overwriteStyles);
|
15450
16707
|
if (this.boxManager && _WindowManager.playground) {
|
15451
16708
|
this.boxManager.setRoot(_WindowManager.playground);
|
15452
16709
|
}
|
15453
16710
|
this.bindMainView(mainViewElement, params.disableCameraTransform);
|
15454
16711
|
if (_WindowManager.playground) {
|
15455
|
-
(
|
16712
|
+
(_b = this.cursorManager) == null ? void 0 : _b.setupWrapper(_WindowManager.playground);
|
15456
16713
|
}
|
15457
16714
|
}
|
15458
16715
|
}
|
15459
16716
|
emitter.emit("updateManagerRect");
|
15460
|
-
(
|
15461
|
-
(
|
15462
|
-
(
|
15463
|
-
(
|
16717
|
+
(_c = this.appManager) == null ? void 0 : _c.refresh();
|
16718
|
+
(_d = this.appManager) == null ? void 0 : _d.resetMaximized();
|
16719
|
+
(_e = this.appManager) == null ? void 0 : _e.resetMinimized();
|
16720
|
+
(_f = this.appManager) == null ? void 0 : _f.displayerWritableListener(!this.room.isWritable);
|
15464
16721
|
_WindowManager.container = container;
|
15465
16722
|
}
|
15466
16723
|
bindCollectorContainer(container) {
|
@@ -15600,6 +16857,17 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15600
16857
|
return false;
|
15601
16858
|
}
|
15602
16859
|
}
|
16860
|
+
async jumpPage(index2) {
|
16861
|
+
if (!this.appManager) {
|
16862
|
+
return false;
|
16863
|
+
}
|
16864
|
+
if (index2 < 0 || index2 >= this.pageState.length) {
|
16865
|
+
console.warn(`[WindowManager]: index ${index2} out of range`);
|
16866
|
+
return false;
|
16867
|
+
}
|
16868
|
+
await this.appManager.setMainViewSceneIndex(index2);
|
16869
|
+
return true;
|
16870
|
+
}
|
15603
16871
|
async addPage(params) {
|
15604
16872
|
if (this.appManager) {
|
15605
16873
|
const after = params == null ? void 0 : params.after;
|
@@ -15650,17 +16918,20 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15650
16918
|
addEmitterOnceListener(`destroy-${kind2}`, listener);
|
15651
16919
|
}
|
15652
16920
|
setViewMode(mode) {
|
15653
|
-
var _a
|
16921
|
+
var _a;
|
16922
|
+
log("setViewMode", mode);
|
16923
|
+
const mainViewProxy = (_a = this.appManager) == null ? void 0 : _a.mainViewProxy;
|
15654
16924
|
if (mode === ViewMode.Broadcaster) {
|
15655
16925
|
if (this.canOperate) {
|
15656
|
-
|
16926
|
+
mainViewProxy == null ? void 0 : mainViewProxy.storeCurrentCamera();
|
15657
16927
|
}
|
15658
|
-
|
16928
|
+
mainViewProxy == null ? void 0 : mainViewProxy.start();
|
15659
16929
|
}
|
15660
16930
|
if (mode === ViewMode.Freedom) {
|
15661
|
-
|
16931
|
+
mainViewProxy == null ? void 0 : mainViewProxy.stop();
|
15662
16932
|
}
|
15663
16933
|
this.viewMode = mode;
|
16934
|
+
this.viewMode$.setValue(mode);
|
15664
16935
|
}
|
15665
16936
|
setBoxState(boxState) {
|
15666
16937
|
if (!this.canOperate)
|
@@ -15705,6 +16976,20 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15705
16976
|
throw new AppManagerNotInitError();
|
15706
16977
|
}
|
15707
16978
|
}
|
16979
|
+
get baseCamera$() {
|
16980
|
+
if (this.appManager) {
|
16981
|
+
return this.appManager.mainViewProxy.camera$;
|
16982
|
+
} else {
|
16983
|
+
throw new AppManagerNotInitError();
|
16984
|
+
}
|
16985
|
+
}
|
16986
|
+
get baseSize$() {
|
16987
|
+
if (this.appManager) {
|
16988
|
+
return this.appManager.mainViewProxy.size$;
|
16989
|
+
} else {
|
16990
|
+
throw new AppManagerNotInitError();
|
16991
|
+
}
|
16992
|
+
}
|
15708
16993
|
get cameraState() {
|
15709
16994
|
if (this.appManager) {
|
15710
16995
|
return this.appManager.mainViewProxy.cameraState;
|
@@ -15736,6 +17021,14 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15736
17021
|
throw new AppManagerNotInitError();
|
15737
17022
|
}
|
15738
17023
|
}
|
17024
|
+
get fullscreen() {
|
17025
|
+
var _a;
|
17026
|
+
if (this.appManager) {
|
17027
|
+
return (_a = this.appManager.boxManager) == null ? void 0 : _a.teleBoxManager.fullscreen;
|
17028
|
+
} else {
|
17029
|
+
throw new AppManagerNotInitError();
|
17030
|
+
}
|
17031
|
+
}
|
15739
17032
|
get focused() {
|
15740
17033
|
return this.attributes.focus;
|
15741
17034
|
}
|
@@ -15798,26 +17091,31 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15798
17091
|
return (_a = this.appManager) == null ? void 0 : _a.closeApp(appId);
|
15799
17092
|
}
|
15800
17093
|
moveCamera(camera) {
|
15801
|
-
var _a;
|
15802
|
-
const pureCamera = omit(camera, ["animationMode"]);
|
15803
17094
|
const mainViewCamera = __spreadValues({}, this.mainView.camera);
|
15804
|
-
|
17095
|
+
const nextCamera = __spreadValues(__spreadValues({}, mainViewCamera), camera);
|
17096
|
+
if (isEqual(nextCamera, mainViewCamera))
|
15805
17097
|
return;
|
15806
|
-
this.
|
15807
|
-
|
15808
|
-
|
15809
|
-
|
15810
|
-
|
15811
|
-
}, 500);
|
17098
|
+
if (!this.appManager)
|
17099
|
+
return;
|
17100
|
+
this.appManager.mainViewProxy.storeCamera(__spreadValues({
|
17101
|
+
id: this.appManager.uid
|
17102
|
+
}, nextCamera));
|
15812
17103
|
}
|
15813
17104
|
moveCameraToContain(rectangle) {
|
15814
|
-
|
15815
|
-
|
15816
|
-
|
15817
|
-
|
15818
|
-
|
15819
|
-
|
15820
|
-
|
17105
|
+
if (!this.appManager)
|
17106
|
+
return;
|
17107
|
+
const mainViewSize = this.appManager.mainViewProxy.size$.value;
|
17108
|
+
if (mainViewSize) {
|
17109
|
+
const wScale = mainViewSize.width / rectangle.width;
|
17110
|
+
const hScale = mainViewSize.height / rectangle.height;
|
17111
|
+
const nextScale = Math.min(wScale, hScale);
|
17112
|
+
this.appManager.mainViewProxy.storeCamera({
|
17113
|
+
id: this.appManager.uid,
|
17114
|
+
scale: nextScale,
|
17115
|
+
centerX: rectangle.originX,
|
17116
|
+
centerY: rectangle.originY
|
17117
|
+
});
|
17118
|
+
}
|
15821
17119
|
}
|
15822
17120
|
convertToPointInWorld(point) {
|
15823
17121
|
return this.mainView.convertToPointInWorld(point);
|
@@ -15874,6 +17172,10 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15874
17172
|
var _a, _b;
|
15875
17173
|
(_b = (_a = this.appManager) == null ? void 0 : _a.boxManager) == null ? void 0 : _b.setPrefersColorScheme(scheme);
|
15876
17174
|
}
|
17175
|
+
setFullscreen(fullscreen) {
|
17176
|
+
var _a, _b;
|
17177
|
+
(_b = (_a = this.appManager) == null ? void 0 : _a.boxManager) == null ? void 0 : _b.teleBoxManager.setFullscreen(fullscreen);
|
17178
|
+
}
|
15877
17179
|
cleanCurrentScene() {
|
15878
17180
|
var _a;
|
15879
17181
|
(_a = this.focusedView) == null ? void 0 : _a.cleanCurrentScene();
|
@@ -15928,12 +17230,12 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15928
17230
|
(_a = this.appManager) == null ? void 0 : _a.dispatchInternalEvent(Events.Refresh);
|
15929
17231
|
}
|
15930
17232
|
_refresh() {
|
15931
|
-
var _a, _b
|
17233
|
+
var _a, _b;
|
15932
17234
|
(_a = this.appManager) == null ? void 0 : _a.mainViewProxy.rebind();
|
15933
17235
|
if (_WindowManager.container) {
|
15934
17236
|
this.bindContainer(_WindowManager.container);
|
15935
17237
|
}
|
15936
|
-
(
|
17238
|
+
(_b = this.appManager) == null ? void 0 : _b.refresher.refresh();
|
15937
17239
|
}
|
15938
17240
|
setContainerSizeRatio(ratio) {
|
15939
17241
|
if (!isNumber(ratio)) {
|
@@ -15943,6 +17245,34 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15943
17245
|
this.containerSizeRatio = ratio;
|
15944
17246
|
emitter.emit("containerSizeRatioUpdate", ratio);
|
15945
17247
|
}
|
17248
|
+
setContainerStyle(style2) {
|
17249
|
+
var _a;
|
17250
|
+
(_a = this.boxManager) == null ? void 0 : _a.teleBoxManager.setContainerStyle(style2);
|
17251
|
+
}
|
17252
|
+
setStageStyle(style2) {
|
17253
|
+
var _a;
|
17254
|
+
(_a = this.boxManager) == null ? void 0 : _a.teleBoxManager.setStageStyle(style2);
|
17255
|
+
}
|
17256
|
+
createPPTHandler() {
|
17257
|
+
return {
|
17258
|
+
onPageJumpTo: (_pptUUID, index2) => {
|
17259
|
+
var _a, _b, _c, _d;
|
17260
|
+
(_d = (_c = (_b = (_a = this.appManager) == null ? void 0 : _a.focusApp) == null ? void 0 : _b.appContext) == null ? void 0 : _c.whiteBoardView) == null ? void 0 : _d.jumpPage(index2);
|
17261
|
+
},
|
17262
|
+
onPageToNext: () => {
|
17263
|
+
var _a, _b, _c, _d;
|
17264
|
+
if (this.focused) {
|
17265
|
+
(_d = (_c = (_b = (_a = this.appManager) == null ? void 0 : _a.focusApp) == null ? void 0 : _b.appContext) == null ? void 0 : _c.whiteBoardView) == null ? void 0 : _d.nextPage();
|
17266
|
+
}
|
17267
|
+
},
|
17268
|
+
onPageToPrev: () => {
|
17269
|
+
var _a, _b, _c, _d;
|
17270
|
+
if (this.focused) {
|
17271
|
+
(_d = (_c = (_b = (_a = this.appManager) == null ? void 0 : _a.focusApp) == null ? void 0 : _b.appContext) == null ? void 0 : _c.whiteBoardView) == null ? void 0 : _d.prevPage();
|
17272
|
+
}
|
17273
|
+
}
|
17274
|
+
};
|
17275
|
+
}
|
15946
17276
|
isDynamicPPT(scenes) {
|
15947
17277
|
var _a, _b;
|
15948
17278
|
const sceneSrc = (_b = (_a = scenes[0]) == null ? void 0 : _a.ppt) == null ? void 0 : _b.src;
|
@@ -15977,4 +17307,4 @@ WindowManager.debug = false;
|
|
15977
17307
|
WindowManager.containerSizeRatio = DEFAULT_CONTAINER_RATIO;
|
15978
17308
|
WindowManager.isCreated = false;
|
15979
17309
|
setupBuiltin();
|
15980
|
-
export { AppCreateError, AppManagerNotInitError, AppNotRegisterError, BindContainerRoomPhaseInvalidError, BoxManagerNotFoundError, BoxNotCreatedError, BuiltinApps, InvalidScenePath, ParamsInvalidError, WhiteWebSDKInvalidError, WindowManager, calculateNextIndex, reconnectRefresher };
|
17310
|
+
export { AppCreateError, AppManagerNotInitError, AppNotRegisterError, BindContainerRoomPhaseInvalidError, BoxManagerNotFoundError, BoxNotCreatedError, BuiltinApps, BuiltinAppsMap, InvalidScenePath, ParamsInvalidError, WhiteWebSDKInvalidError, WindowManager, calculateNextIndex, reconnectRefresher };
|