@netless/window-manager 0.4.26 → 0.4.27-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App/AppContext.d.ts +2 -1
- package/dist/App/AppProxy.d.ts +6 -3
- package/dist/AppListener.d.ts +1 -0
- package/dist/AppManager.d.ts +2 -0
- package/dist/InternalEmitter.d.ts +5 -1
- package/dist/Page/PageController.d.ts +5 -0
- package/dist/Page/index.d.ts +2 -0
- package/dist/Utils/Common.d.ts +2 -1
- package/dist/Utils/error.d.ts +3 -0
- package/dist/View/MainView.d.ts +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/index.cjs.js +12 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +210 -53
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +12 -12
- package/dist/index.umd.js.map +1 -1
- package/dist/typings.d.ts +1 -0
- package/docs/advanced.md +17 -0
- package/docs/api.md +8 -0
- package/docs/app-context.md +149 -100
- package/package.json +1 -1
- package/src/App/AppContext.ts +20 -11
- package/src/App/AppProxy.ts +55 -4
- package/src/App/Storage/index.ts +14 -8
- package/src/AppListener.ts +22 -0
- package/src/AppManager.ts +57 -24
- package/src/InternalEmitter.ts +4 -1
- package/src/Page/PageController.ts +6 -0
- package/src/Page/index.ts +18 -0
- package/src/PageState.ts +2 -1
- package/src/Utils/Common.ts +14 -2
- package/src/Utils/RoomHacker.ts +2 -2
- package/src/Utils/error.ts +4 -0
- package/src/View/MainView.ts +7 -3
- package/src/constants.ts +1 -0
- package/src/index.ts +16 -0
- package/src/typings.ts +1 -0
package/dist/index.d.ts
CHANGED
@@ -144,6 +144,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
144
144
|
nextPage(): Promise<boolean>;
|
145
145
|
prevPage(): Promise<boolean>;
|
146
146
|
addPage(params?: AddPageParams): Promise<void>;
|
147
|
+
removePage(index: number): Promise<boolean>;
|
147
148
|
/**
|
148
149
|
* 返回 mainView 的 ScenePath
|
149
150
|
*/
|
package/dist/index.es.js
CHANGED
@@ -36,6 +36,7 @@ var Events = /* @__PURE__ */ ((Events2) => {
|
|
36
36
|
Events2["WindowCreated"] = "WindowCreated";
|
37
37
|
Events2["SetMainViewScenePath"] = "SetMainViewScenePath";
|
38
38
|
Events2["SetMainViewSceneIndex"] = "SetMainViewSceneIndex";
|
39
|
+
Events2["SetAppFocusIndex"] = "SetAppFocusIndex";
|
39
40
|
Events2["SwitchViewsToFreedom"] = "SwitchViewsToFreedom";
|
40
41
|
Events2["MoveCamera"] = "MoveCamera";
|
41
42
|
Events2["MoveCameraToContain"] = "MoveCameraToContain";
|
@@ -369,11 +370,11 @@ const getScenePath = (room, dir, index) => {
|
|
369
370
|
}
|
370
371
|
}
|
371
372
|
};
|
372
|
-
const removeScenes = (room, scenePath) => {
|
373
|
+
const removeScenes = (room, scenePath, index) => {
|
373
374
|
if (room) {
|
374
375
|
const type = room.scenePathType(scenePath);
|
375
376
|
if (type !== ScenePathType.None) {
|
376
|
-
room.removeScenes(scenePath);
|
377
|
+
room.removeScenes(scenePath, index);
|
377
378
|
}
|
378
379
|
}
|
379
380
|
};
|
@@ -427,6 +428,15 @@ const getVersionNumber = (version) => {
|
|
427
428
|
return parseInt(versionString);
|
428
429
|
};
|
429
430
|
const wait = (time2) => new Promise((resolve) => setTimeout(resolve, time2));
|
431
|
+
const isRootDirPage = (scenePath) => {
|
432
|
+
const delimiterCount = scenePath.split("").reduce((prev, cur) => {
|
433
|
+
if (cur === ROOT_DIR) {
|
434
|
+
prev += 1;
|
435
|
+
}
|
436
|
+
return prev;
|
437
|
+
}, 0);
|
438
|
+
return delimiterCount === 1;
|
439
|
+
};
|
430
440
|
class AppListeners {
|
431
441
|
constructor(manager) {
|
432
442
|
this.manager = manager;
|
@@ -475,6 +485,10 @@ class AppListeners {
|
|
475
485
|
this.initMainViewCameraHandler();
|
476
486
|
break;
|
477
487
|
}
|
488
|
+
case Events.SetAppFocusIndex: {
|
489
|
+
this.setAppFocusViewIndexHandler(data.payload);
|
490
|
+
break;
|
491
|
+
}
|
478
492
|
}
|
479
493
|
}
|
480
494
|
};
|
@@ -516,6 +530,16 @@ class AppListeners {
|
|
516
530
|
this.initMainViewCameraHandler = () => {
|
517
531
|
this.manager.mainViewProxy.addCameraReaction();
|
518
532
|
};
|
533
|
+
this.setAppFocusViewIndexHandler = (payload) => {
|
534
|
+
if (payload.type === "main") {
|
535
|
+
this.manager.setSceneIndexWithoutSync(payload.index);
|
536
|
+
} else if (payload.type === "app" && payload.appID) {
|
537
|
+
const app = this.manager.appProxies.get(payload.appID);
|
538
|
+
if (app) {
|
539
|
+
app.setSceneIndexWithoutSync(payload.index);
|
540
|
+
}
|
541
|
+
}
|
542
|
+
};
|
519
543
|
}
|
520
544
|
get boxManager() {
|
521
545
|
return this.manager.boxManager;
|
@@ -533,6 +557,11 @@ class AppCreateError extends Error {
|
|
533
557
|
this.message = "[WindowManager]: app duplicate exists and cannot be created again";
|
534
558
|
}
|
535
559
|
}
|
560
|
+
class AppNotRegisterError extends Error {
|
561
|
+
constructor(kind2) {
|
562
|
+
super(`[WindowManager]: app ${kind2} need register or provide src`);
|
563
|
+
}
|
564
|
+
}
|
536
565
|
class AppManagerNotInitError extends Error {
|
537
566
|
constructor() {
|
538
567
|
super(...arguments);
|
@@ -568,6 +597,12 @@ class BoxManagerNotFoundError extends Error {
|
|
568
597
|
this.message = "[WindowManager]: boxManager not found";
|
569
598
|
}
|
570
599
|
}
|
600
|
+
class BindContainerRoomPhaseInvalidError extends Error {
|
601
|
+
constructor() {
|
602
|
+
super(...arguments);
|
603
|
+
this.message = "[WindowManager]: room phase only Connected can be bindContainer";
|
604
|
+
}
|
605
|
+
}
|
571
606
|
const onObjectByEvent = (event) => {
|
572
607
|
return (object, func) => {
|
573
608
|
if (object === void 0)
|
@@ -652,15 +687,21 @@ class Storage {
|
|
652
687
|
this.id = id2 || null;
|
653
688
|
this._state = {};
|
654
689
|
const rawState = this._getRawState(this._state);
|
655
|
-
if (this.
|
656
|
-
if (
|
657
|
-
if (
|
658
|
-
this.
|
690
|
+
if (this._context.getIsWritable()) {
|
691
|
+
if (this.id === null) {
|
692
|
+
if (context.isAddApp && defaultState) {
|
693
|
+
this.setState(defaultState);
|
694
|
+
}
|
695
|
+
} else {
|
696
|
+
if (rawState === this._state || !isObject(rawState)) {
|
697
|
+
if (!get(this._context.getAttributes(), [STORAGE_NS])) {
|
698
|
+
this._context.updateAttributes([STORAGE_NS], {});
|
699
|
+
}
|
700
|
+
this._context.updateAttributes([STORAGE_NS, this.id], this._state);
|
701
|
+
if (defaultState) {
|
702
|
+
this.setState(defaultState);
|
703
|
+
}
|
659
704
|
}
|
660
|
-
this._context.updateAttributes([STORAGE_NS, this.id], this._state);
|
661
|
-
}
|
662
|
-
if (defaultState) {
|
663
|
-
this.setState(defaultState);
|
664
705
|
}
|
665
706
|
}
|
666
707
|
plainObjectKeys(rawState).forEach((key) => {
|
@@ -885,6 +926,16 @@ class AppContext {
|
|
885
926
|
this.getView = () => {
|
886
927
|
return this.appProxy.view;
|
887
928
|
};
|
929
|
+
this.mountView = (dom) => {
|
930
|
+
const view = this.getView();
|
931
|
+
if (view) {
|
932
|
+
view.divElement = dom;
|
933
|
+
setTimeout(() => {
|
934
|
+
var _a;
|
935
|
+
(_a = this.getRoom()) == null ? void 0 : _a.refreshViewSize();
|
936
|
+
}, 1e3);
|
937
|
+
}
|
938
|
+
};
|
888
939
|
this.getInitScenePath = () => {
|
889
940
|
return this.manager.getAppInitPath(this.appId);
|
890
941
|
};
|
@@ -917,16 +968,6 @@ class AppContext {
|
|
917
968
|
this.appProxy.setFullPath(scenePath);
|
918
969
|
(_a = this.getRoom()) == null ? void 0 : _a.setScenePath(scenePath);
|
919
970
|
};
|
920
|
-
this.mountView = (dom) => {
|
921
|
-
const view = this.getView();
|
922
|
-
if (view) {
|
923
|
-
view.divElement = dom;
|
924
|
-
setTimeout(() => {
|
925
|
-
var _a;
|
926
|
-
(_a = this.getRoom()) == null ? void 0 : _a.refreshViewSize();
|
927
|
-
}, 1e3);
|
928
|
-
}
|
929
|
-
};
|
930
971
|
this.getAppOptions = () => {
|
931
972
|
return typeof this.appOptions === "function" ? this.appOptions() : this.appOptions;
|
932
973
|
};
|
@@ -979,6 +1020,14 @@ class AppContext {
|
|
979
1020
|
putScenes(this.manager.room, scenePath, [scene || {}]);
|
980
1021
|
}
|
981
1022
|
};
|
1023
|
+
this.removePage = async (index) => {
|
1024
|
+
if (index < 0 || index >= this.pageState.length) {
|
1025
|
+
console.warn(`[WindowManager]: page index ${index} out of range`);
|
1026
|
+
return false;
|
1027
|
+
}
|
1028
|
+
this.appProxy.removeSceneByIndex(index);
|
1029
|
+
return true;
|
1030
|
+
};
|
982
1031
|
this.emitter = appProxy.appEmitter;
|
983
1032
|
this.isAddApp = appProxy.isAddApp;
|
984
1033
|
}
|
@@ -1203,6 +1252,21 @@ const log = (...args) => {
|
|
1203
1252
|
console.log(`[WindowManager]:`, ...args);
|
1204
1253
|
}
|
1205
1254
|
};
|
1255
|
+
const calculateNextIndex = (index, pageState) => {
|
1256
|
+
let nextIndex = 0;
|
1257
|
+
if (index === 0) {
|
1258
|
+
return index + 1;
|
1259
|
+
}
|
1260
|
+
if (pageState.index !== 0 && index !== 0) {
|
1261
|
+
const maxIndex = pageState.length - 1;
|
1262
|
+
if (index === maxIndex) {
|
1263
|
+
nextIndex = maxIndex - 1;
|
1264
|
+
} else if (index > 0 && index < maxIndex) {
|
1265
|
+
nextIndex = index + 1;
|
1266
|
+
}
|
1267
|
+
}
|
1268
|
+
return nextIndex;
|
1269
|
+
};
|
1206
1270
|
class AppProxy {
|
1207
1271
|
constructor(params, manager, appId, isAddApp) {
|
1208
1272
|
var _a;
|
@@ -1277,9 +1341,9 @@ class AppProxy {
|
|
1277
1341
|
setViewFocusScenePath(this.view, fullPath);
|
1278
1342
|
}
|
1279
1343
|
}, 50);
|
1280
|
-
this.notifyPageStateChange = () => {
|
1344
|
+
this.notifyPageStateChange = debounce(() => {
|
1281
1345
|
this.appEmitter.emit("pageStateChange", this.pageState);
|
1282
|
-
};
|
1346
|
+
}, 50);
|
1283
1347
|
this.kind = params.kind;
|
1284
1348
|
this.id = appId;
|
1285
1349
|
this.stateKey = `${this.id}_state`;
|
@@ -1447,6 +1511,23 @@ class AppProxy {
|
|
1447
1511
|
await appProxy.baseInsertApp(true);
|
1448
1512
|
(_a = this.boxManager) == null ? void 0 : _a.updateBoxState(currentAppState);
|
1449
1513
|
}
|
1514
|
+
async onRemoveScene(scenePath) {
|
1515
|
+
if (this.scenePath && scenePath.startsWith(this.scenePath + "/")) {
|
1516
|
+
let nextIndex = this.pageState.index;
|
1517
|
+
let fullPath = this._pageState.getFullPath(nextIndex);
|
1518
|
+
if (!fullPath) {
|
1519
|
+
nextIndex = 0;
|
1520
|
+
fullPath = this._pageState.getFullPath(nextIndex);
|
1521
|
+
}
|
1522
|
+
if (fullPath) {
|
1523
|
+
this.setFullPath(fullPath);
|
1524
|
+
}
|
1525
|
+
this.setViewFocusScenePath();
|
1526
|
+
if (this.view) {
|
1527
|
+
this.view.focusSceneIndex = nextIndex;
|
1528
|
+
}
|
1529
|
+
}
|
1530
|
+
}
|
1450
1531
|
emitAppSceneStateChange(sceneState) {
|
1451
1532
|
this.appEmitter.emit("sceneStateChange", sceneState);
|
1452
1533
|
}
|
@@ -1520,6 +1601,32 @@ class AppProxy {
|
|
1520
1601
|
get pageState() {
|
1521
1602
|
return this._pageState.toObject();
|
1522
1603
|
}
|
1604
|
+
async removeSceneByIndex(index) {
|
1605
|
+
const scenePath = this._pageState.getFullPath(index);
|
1606
|
+
if (scenePath) {
|
1607
|
+
if (this.pageState.length <= 1) {
|
1608
|
+
return false;
|
1609
|
+
}
|
1610
|
+
const nextIndex = calculateNextIndex(index, this.pageState);
|
1611
|
+
this.setSceneIndexWithoutSync(nextIndex);
|
1612
|
+
this.manager.dispatchInternalEvent(Events.SetAppFocusIndex, {
|
1613
|
+
type: "app",
|
1614
|
+
appID: this.id,
|
1615
|
+
index: nextIndex
|
1616
|
+
});
|
1617
|
+
setTimeout(() => {
|
1618
|
+
removeScenes(this.manager.room, scenePath, index);
|
1619
|
+
}, 100);
|
1620
|
+
return true;
|
1621
|
+
} else {
|
1622
|
+
return false;
|
1623
|
+
}
|
1624
|
+
}
|
1625
|
+
setSceneIndexWithoutSync(index) {
|
1626
|
+
if (this.view) {
|
1627
|
+
this.view.focusSceneIndex = index;
|
1628
|
+
}
|
1629
|
+
}
|
1523
1630
|
setSceneIndex(index) {
|
1524
1631
|
if (this.view) {
|
1525
1632
|
this.view.focusSceneIndex = index;
|
@@ -1744,9 +1851,12 @@ class MainViewProxy {
|
|
1744
1851
|
this.rebind();
|
1745
1852
|
} else {
|
1746
1853
|
const mainViewScenePath = this.store.getMainViewScenePath();
|
1747
|
-
|
1748
|
-
|
1749
|
-
|
1854
|
+
this.setFocusScenePath(mainViewScenePath);
|
1855
|
+
}
|
1856
|
+
}
|
1857
|
+
setFocusScenePath(path) {
|
1858
|
+
if (path) {
|
1859
|
+
return setViewFocusScenePath(this.view, path);
|
1750
1860
|
}
|
1751
1861
|
}
|
1752
1862
|
rebind() {
|
@@ -1907,19 +2017,29 @@ class AppManager {
|
|
1907
2017
|
this.sideEffectManager = new SideEffectManager();
|
1908
2018
|
this.sceneState = null;
|
1909
2019
|
this.rootDirRemoving = false;
|
1910
|
-
this.onRemoveScenes = async (
|
1911
|
-
var _a;
|
2020
|
+
this.onRemoveScenes = async (params) => {
|
2021
|
+
var _a, _b;
|
2022
|
+
const { scenePath } = params;
|
1912
2023
|
if (scenePath === ROOT_DIR) {
|
1913
2024
|
await this.onRootDirRemoved();
|
1914
2025
|
this.dispatchInternalEvent(Events.RootDirRemoved);
|
1915
2026
|
return;
|
1916
2027
|
}
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1920
|
-
|
1921
|
-
|
2028
|
+
if (isRootDirPage(scenePath)) {
|
2029
|
+
let nextIndex = this.mainView.focusSceneIndex || 0;
|
2030
|
+
let sceneName = (_a = this.callbacksNode) == null ? void 0 : _a.scenes[nextIndex];
|
2031
|
+
if (!sceneName) {
|
2032
|
+
nextIndex = 0;
|
2033
|
+
sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
|
2034
|
+
}
|
2035
|
+
if (sceneName) {
|
2036
|
+
this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
1922
2037
|
}
|
2038
|
+
await this.setMainViewSceneIndex(nextIndex);
|
2039
|
+
} else {
|
2040
|
+
this.appProxies.forEach((app) => {
|
2041
|
+
app.onRemoveScene(scenePath);
|
2042
|
+
});
|
1923
2043
|
}
|
1924
2044
|
};
|
1925
2045
|
this.onReadonlyChanged = () => {
|
@@ -1954,6 +2074,26 @@ class AppManager {
|
|
1954
2074
|
}
|
1955
2075
|
}
|
1956
2076
|
};
|
2077
|
+
this.removeSceneByIndex = async (index) => {
|
2078
|
+
const nextIndex = calculateNextIndex(index, this.windowManger.pageState);
|
2079
|
+
this.setSceneIndexWithoutSync(nextIndex);
|
2080
|
+
this.dispatchInternalEvent(Events.SetAppFocusIndex, { type: "main", index: nextIndex });
|
2081
|
+
setTimeout(() => {
|
2082
|
+
var _a;
|
2083
|
+
const scene = (_a = this.callbacksNode) == null ? void 0 : _a.scenes[index];
|
2084
|
+
if (scene) {
|
2085
|
+
removeScenes(this.room, `${ROOT_DIR}${scene}`, index);
|
2086
|
+
}
|
2087
|
+
}, 100);
|
2088
|
+
return true;
|
2089
|
+
};
|
2090
|
+
this.setSceneIndexWithoutSync = (index) => {
|
2091
|
+
var _a;
|
2092
|
+
const sceneName = (_a = this.callbacksNode) == null ? void 0 : _a.scenes[index];
|
2093
|
+
if (sceneName) {
|
2094
|
+
this.mainViewProxy.setFocusScenePath(`${ROOT_DIR}${sceneName}`);
|
2095
|
+
}
|
2096
|
+
};
|
1957
2097
|
this.onSceneChange = (node) => {
|
1958
2098
|
this.mainViewScenesLength = node.scenes.length;
|
1959
2099
|
this.updateSceneState(node);
|
@@ -1965,7 +2105,10 @@ class AppManager {
|
|
1965
2105
|
};
|
1966
2106
|
this.updateSceneState = (node) => {
|
1967
2107
|
const currentIndex = this.store.getMainViewSceneIndex() || 0;
|
1968
|
-
|
2108
|
+
let sceneName = node.scenes[currentIndex];
|
2109
|
+
if (!sceneName) {
|
2110
|
+
sceneName = node.scenes[this.mainView.focusSceneIndex || 0];
|
2111
|
+
}
|
1969
2112
|
this.sceneState = {
|
1970
2113
|
scenePath: `${ROOT_DIR}${sceneName}`,
|
1971
2114
|
contextPath: node.path,
|
@@ -2349,10 +2492,11 @@ class AppManager {
|
|
2349
2492
|
emitter.emit("mainViewMounted");
|
2350
2493
|
}
|
2351
2494
|
setMainViewFocusPath(scenePath) {
|
2495
|
+
var _a;
|
2352
2496
|
const focusScenePath = scenePath || this.store.getMainViewScenePath();
|
2353
2497
|
if (focusScenePath) {
|
2354
|
-
|
2355
|
-
return (
|
2498
|
+
setViewFocusScenePath(this.mainView, focusScenePath);
|
2499
|
+
return ((_a = this.mainView) == null ? void 0 : _a.focusScenePath) === focusScenePath;
|
2356
2500
|
}
|
2357
2501
|
}
|
2358
2502
|
resetScenePath(scenePath) {
|
@@ -2452,23 +2596,21 @@ class AppManager {
|
|
2452
2596
|
}
|
2453
2597
|
}
|
2454
2598
|
async setMainViewSceneIndex(index) {
|
2599
|
+
var _a;
|
2455
2600
|
if (this.room) {
|
2456
2601
|
if (this.store.getMainViewSceneIndex() === index)
|
2457
2602
|
return;
|
2458
|
-
const
|
2459
|
-
|
2460
|
-
|
2461
|
-
const
|
2462
|
-
if (
|
2463
|
-
|
2464
|
-
|
2465
|
-
|
2466
|
-
this.safeSetAttributes({ _mainSceneIndex: index });
|
2467
|
-
this.dispatchSetMainViewScenePath(scenePath);
|
2468
|
-
}
|
2469
|
-
} else {
|
2470
|
-
throw new Error(`[WindowManager]: ${sceneDir}: ${index} not valid index`);
|
2603
|
+
const sceneName = (_a = this.callbacksNode) == null ? void 0 : _a.scenes[index];
|
2604
|
+
const scenePath = `${ROOT_DIR}${sceneName}`;
|
2605
|
+
if (sceneName) {
|
2606
|
+
const success = this.setMainViewFocusPath(scenePath);
|
2607
|
+
if (success) {
|
2608
|
+
this.store.setMainViewScenePath(scenePath);
|
2609
|
+
this.safeSetAttributes({ _mainSceneIndex: index });
|
2610
|
+
this.dispatchSetMainViewScenePath(scenePath);
|
2471
2611
|
}
|
2612
|
+
} else {
|
2613
|
+
throw new Error(`[WindowManager]: ${index} not valid index`);
|
2472
2614
|
}
|
2473
2615
|
}
|
2474
2616
|
}
|
@@ -5579,8 +5721,9 @@ class PageStateImpl {
|
|
5579
5721
|
return ((_a = this.manager) == null ? void 0 : _a.mainViewScenesLength) || 0;
|
5580
5722
|
}
|
5581
5723
|
toObject() {
|
5724
|
+
const index = this.index >= this.length ? this.length - 1 : this.index;
|
5582
5725
|
return {
|
5583
|
-
index
|
5726
|
+
index,
|
5584
5727
|
length: this.length
|
5585
5728
|
};
|
5586
5729
|
}
|
@@ -5716,13 +5859,13 @@ const replaceRoomFunction = (room, manager) => {
|
|
5716
5859
|
};
|
5717
5860
|
const delegateRemoveScenes = (room, manager) => {
|
5718
5861
|
const originRemoveScenes = room.removeScenes;
|
5719
|
-
room.removeScenes = (scenePath) => {
|
5862
|
+
room.removeScenes = (scenePath, index) => {
|
5720
5863
|
var _a;
|
5721
5864
|
if (scenePath === ROOT_DIR) {
|
5722
5865
|
(_a = manager.appManager) == null ? void 0 : _a.updateRootDirRemoving(true);
|
5723
5866
|
}
|
5724
5867
|
const result = originRemoveScenes.call(room, scenePath);
|
5725
|
-
emitter.emit("removeScenes", scenePath);
|
5868
|
+
emitter.emit("removeScenes", { scenePath, index });
|
5726
5869
|
return result;
|
5727
5870
|
};
|
5728
5871
|
};
|
@@ -14905,7 +15048,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
14905
15048
|
const _WindowManager = class extends InvisiblePlugin {
|
14906
15049
|
constructor(context) {
|
14907
15050
|
super(context);
|
14908
|
-
this.version = "0.4.
|
15051
|
+
this.version = "0.4.27-canary.0";
|
14909
15052
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "0.2.26", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^0.1.5", "uuid": "^7.0.3", "video.js": ">=7" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.2.9", "@netless/app-media-player": "0.1.0-beta.5", "@rollup/plugin-commonjs": "^20.0.0", "@rollup/plugin-node-resolve": "^13.0.4", "@rollup/plugin-url": "^6.1.0", "@sveltejs/vite-plugin-svelte": "^1.0.0-next.22", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.4", "@types/uuid": "^8.3.1", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "cypress": "^8.7.0", "dotenv": "^10.0.0", "eslint": "^7.32.0", "eslint-config-prettier": "^8.3.0", "eslint-plugin-svelte3": "^3.2.0", "jsdom": "^19.0.0", "less": "^4.1.1", "prettier": "^2.3.2", "prettier-plugin-svelte": "^2.4.0", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-styles": "^3.14.1", "svelte": "^3.42.4", "typescript": "^4.5.5", "vite": "^2.5.3", "vitest": "^0.12.4", "white-web-sdk": "2.16.10" } };
|
14910
15053
|
this.emitter = callbacks$1;
|
14911
15054
|
this.viewMode = ViewMode.Broadcaster;
|
@@ -15022,6 +15165,9 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15022
15165
|
}
|
15023
15166
|
bindContainer(container) {
|
15024
15167
|
var _a, _b, _c, _d, _e2, _f;
|
15168
|
+
if (this.room.phase !== RoomPhase.Connected) {
|
15169
|
+
throw new BindContainerRoomPhaseInvalidError();
|
15170
|
+
}
|
15025
15171
|
if (_WindowManager.isCreated && _WindowManager.container) {
|
15026
15172
|
if (_WindowManager.container.firstChild) {
|
15027
15173
|
container.appendChild(_WindowManager.container.firstChild);
|
@@ -15202,6 +15348,17 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15202
15348
|
}
|
15203
15349
|
}
|
15204
15350
|
}
|
15351
|
+
async removePage(index) {
|
15352
|
+
if (this.appManager) {
|
15353
|
+
if (index < 0 || index >= this.pageState.length) {
|
15354
|
+
console.warn(`[WindowManager]: index ${index} out of range`);
|
15355
|
+
return false;
|
15356
|
+
}
|
15357
|
+
return this.appManager.removeSceneByIndex(index);
|
15358
|
+
} else {
|
15359
|
+
return false;
|
15360
|
+
}
|
15361
|
+
}
|
15205
15362
|
getMainViewScenePath() {
|
15206
15363
|
var _a;
|
15207
15364
|
return (_a = this.appManager) == null ? void 0 : _a.store.getMainViewScenePath();
|
@@ -15553,5 +15710,5 @@ WindowManager.debug = false;
|
|
15553
15710
|
WindowManager.containerSizeRatio = DEFAULT_CONTAINER_RATIO;
|
15554
15711
|
WindowManager.isCreated = false;
|
15555
15712
|
setupBuiltin();
|
15556
|
-
export { BuiltinApps, WindowManager, reconnectRefresher };
|
15713
|
+
export { AppCreateError, AppManagerNotInitError, AppNotRegisterError, BindContainerRoomPhaseInvalidError, BoxManagerNotFoundError, BoxNotCreatedError, BuiltinApps, InvalidScenePath, ParamsInvalidError, WhiteWebSDKInvalidError, WindowManager, calculateNextIndex, reconnectRefresher };
|
15557
15714
|
//# sourceMappingURL=index.es.js.map
|