@netless/window-manager 1.0.0-canary.56 → 1.0.0-canary.57
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +22 -9
- package/dist/index.es.js +22 -9
- package/dist/index.umd.js +22 -9
- package/dist/src/App/AppContext.d.ts +6 -8
- package/dist/src/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/App/AppContext.ts +5 -11
- package/src/AppManager.ts +4 -0
- package/src/View/ScrollMode.ts +9 -0
- package/src/index.ts +4 -2
package/dist/index.cjs.js
CHANGED
@@ -963,6 +963,9 @@ class AppContext {
|
|
963
963
|
get destroyed() {
|
964
964
|
return this.appProxy.status === "destroyed";
|
965
965
|
}
|
966
|
+
get attributes() {
|
967
|
+
return this.appProxy.attributes;
|
968
|
+
}
|
966
969
|
get view() {
|
967
970
|
return this.appProxy.view;
|
968
971
|
}
|
@@ -1000,12 +1003,6 @@ class AppContext {
|
|
1000
1003
|
uid: this.manager.uid
|
1001
1004
|
}, self);
|
1002
1005
|
}
|
1003
|
-
get storage() {
|
1004
|
-
if (!this._storage) {
|
1005
|
-
this._storage = this.createStorage(this.appId, this.getAttributes());
|
1006
|
-
}
|
1007
|
-
return this._storage;
|
1008
|
-
}
|
1009
1006
|
}
|
1010
1007
|
class AppPageStateImpl {
|
1011
1008
|
constructor(params) {
|
@@ -2559,6 +2556,15 @@ class ScrollMode {
|
|
2559
2556
|
}
|
2560
2557
|
dispose() {
|
2561
2558
|
this.sideEffect.flushAll();
|
2559
|
+
this.scrollStorage.disconnect();
|
2560
|
+
this._root$.destroy();
|
2561
|
+
this._scale$.destroy();
|
2562
|
+
this._scrollTop$.destroy();
|
2563
|
+
this._whiteboard$.destroy();
|
2564
|
+
this.scrollState$.destroy();
|
2565
|
+
this._page$.destroy();
|
2566
|
+
this._size$.destroy();
|
2567
|
+
this._mainView$.destroy();
|
2562
2568
|
}
|
2563
2569
|
}
|
2564
2570
|
class AppManager {
|
@@ -2906,11 +2912,15 @@ class AppManager {
|
|
2906
2912
|
this.members$.setValue(serializeRoomMembers(this.displayer.state.roomMembers));
|
2907
2913
|
emitter.on("mainViewMounted", () => {
|
2908
2914
|
this.windowManger.viewMode$.subscribe((viewMode) => {
|
2915
|
+
var _a2;
|
2909
2916
|
const playground = this.windowManger.playground$.value;
|
2910
2917
|
if (viewMode === "scroll" && playground) {
|
2911
2918
|
const scrollMode = new ScrollMode(this);
|
2912
2919
|
this.scrollMode = scrollMode;
|
2913
2920
|
scrollMode.setRoot(playground);
|
2921
|
+
} else {
|
2922
|
+
(_a2 = this.scrollMode) == null ? void 0 : _a2.dispose();
|
2923
|
+
this.scrollMode = void 0;
|
2914
2924
|
}
|
2915
2925
|
});
|
2916
2926
|
});
|
@@ -3262,6 +3272,7 @@ class AppManager {
|
|
3262
3272
|
});
|
3263
3273
|
}
|
3264
3274
|
destroy() {
|
3275
|
+
var _a;
|
3265
3276
|
this.displayer.callbacks.off(this.eventName, this.displayerStateListener);
|
3266
3277
|
this.displayer.callbacks.off("onEnableWriteNowChanged", this.displayerWritableListener);
|
3267
3278
|
this.appListeners.removeListeners();
|
@@ -3277,6 +3288,7 @@ class AppManager {
|
|
3277
3288
|
this.sceneIndex$.destroy();
|
3278
3289
|
this.focused$.destroy();
|
3279
3290
|
this.members$.destroy();
|
3291
|
+
(_a = this.scrollMode) == null ? void 0 : _a.dispose();
|
3280
3292
|
}
|
3281
3293
|
}
|
3282
3294
|
/*! *****************************************************************************
|
@@ -11648,10 +11660,9 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
11648
11660
|
const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
|
11649
11661
|
constructor(context) {
|
11650
11662
|
super(context);
|
11651
|
-
this.version = "1.0.0-canary.
|
11663
|
+
this.version = "1.0.0-canary.57";
|
11652
11664
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.3.3", "@netless/app-plyr": "0.2.2", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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.3", "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.1", "vitest": "^0.18.0", "white-web-sdk": "^2.16.35" } };
|
11653
11665
|
this.emitter = callbacks;
|
11654
|
-
this.viewMode = whiteWebSdk.ViewMode.Broadcaster;
|
11655
11666
|
this.viewMode$ = new valueEnhancer.Val(whiteWebSdk.ViewMode.Broadcaster);
|
11656
11667
|
this.playground$ = new valueEnhancer.Val(void 0);
|
11657
11668
|
this.isReplay = whiteWebSdk.isPlayer(this.displayer);
|
@@ -12037,7 +12048,6 @@ const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
|
|
12037
12048
|
if (mode === whiteWebSdk.ViewMode.Freedom || mode === "scroll") {
|
12038
12049
|
mainViewProxy == null ? void 0 : mainViewProxy.stop();
|
12039
12050
|
}
|
12040
|
-
this.viewMode = mode;
|
12041
12051
|
this.viewMode$.setValue(mode);
|
12042
12052
|
}
|
12043
12053
|
setBoxState(boxState) {
|
@@ -12120,6 +12130,9 @@ const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
|
|
12120
12130
|
var _a, _b;
|
12121
12131
|
return Boolean((_b = (_a = this.appManager) == null ? void 0 : _a.boxManager) == null ? void 0 : _b.darkMode);
|
12122
12132
|
}
|
12133
|
+
get viewMode() {
|
12134
|
+
return this.viewMode$.value;
|
12135
|
+
}
|
12123
12136
|
get prefersColorScheme() {
|
12124
12137
|
var _a;
|
12125
12138
|
if (this.appManager) {
|
package/dist/index.es.js
CHANGED
@@ -956,6 +956,9 @@ class AppContext {
|
|
956
956
|
get destroyed() {
|
957
957
|
return this.appProxy.status === "destroyed";
|
958
958
|
}
|
959
|
+
get attributes() {
|
960
|
+
return this.appProxy.attributes;
|
961
|
+
}
|
959
962
|
get view() {
|
960
963
|
return this.appProxy.view;
|
961
964
|
}
|
@@ -993,12 +996,6 @@ class AppContext {
|
|
993
996
|
uid: this.manager.uid
|
994
997
|
}, self);
|
995
998
|
}
|
996
|
-
get storage() {
|
997
|
-
if (!this._storage) {
|
998
|
-
this._storage = this.createStorage(this.appId, this.getAttributes());
|
999
|
-
}
|
1000
|
-
return this._storage;
|
1001
|
-
}
|
1002
999
|
}
|
1003
1000
|
class AppPageStateImpl {
|
1004
1001
|
constructor(params) {
|
@@ -2552,6 +2549,15 @@ class ScrollMode {
|
|
2552
2549
|
}
|
2553
2550
|
dispose() {
|
2554
2551
|
this.sideEffect.flushAll();
|
2552
|
+
this.scrollStorage.disconnect();
|
2553
|
+
this._root$.destroy();
|
2554
|
+
this._scale$.destroy();
|
2555
|
+
this._scrollTop$.destroy();
|
2556
|
+
this._whiteboard$.destroy();
|
2557
|
+
this.scrollState$.destroy();
|
2558
|
+
this._page$.destroy();
|
2559
|
+
this._size$.destroy();
|
2560
|
+
this._mainView$.destroy();
|
2555
2561
|
}
|
2556
2562
|
}
|
2557
2563
|
class AppManager {
|
@@ -2899,11 +2905,15 @@ class AppManager {
|
|
2899
2905
|
this.members$.setValue(serializeRoomMembers(this.displayer.state.roomMembers));
|
2900
2906
|
emitter.on("mainViewMounted", () => {
|
2901
2907
|
this.windowManger.viewMode$.subscribe((viewMode) => {
|
2908
|
+
var _a2;
|
2902
2909
|
const playground = this.windowManger.playground$.value;
|
2903
2910
|
if (viewMode === "scroll" && playground) {
|
2904
2911
|
const scrollMode = new ScrollMode(this);
|
2905
2912
|
this.scrollMode = scrollMode;
|
2906
2913
|
scrollMode.setRoot(playground);
|
2914
|
+
} else {
|
2915
|
+
(_a2 = this.scrollMode) == null ? void 0 : _a2.dispose();
|
2916
|
+
this.scrollMode = void 0;
|
2907
2917
|
}
|
2908
2918
|
});
|
2909
2919
|
});
|
@@ -3255,6 +3265,7 @@ class AppManager {
|
|
3255
3265
|
});
|
3256
3266
|
}
|
3257
3267
|
destroy() {
|
3268
|
+
var _a;
|
3258
3269
|
this.displayer.callbacks.off(this.eventName, this.displayerStateListener);
|
3259
3270
|
this.displayer.callbacks.off("onEnableWriteNowChanged", this.displayerWritableListener);
|
3260
3271
|
this.appListeners.removeListeners();
|
@@ -3270,6 +3281,7 @@ class AppManager {
|
|
3270
3281
|
this.sceneIndex$.destroy();
|
3271
3282
|
this.focused$.destroy();
|
3272
3283
|
this.members$.destroy();
|
3284
|
+
(_a = this.scrollMode) == null ? void 0 : _a.dispose();
|
3273
3285
|
}
|
3274
3286
|
}
|
3275
3287
|
/*! *****************************************************************************
|
@@ -11641,10 +11653,9 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
11641
11653
|
const _WindowManager = class extends InvisiblePlugin {
|
11642
11654
|
constructor(context) {
|
11643
11655
|
super(context);
|
11644
|
-
this.version = "1.0.0-canary.
|
11656
|
+
this.version = "1.0.0-canary.57";
|
11645
11657
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.3.3", "@netless/app-plyr": "0.2.2", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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.3", "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.1", "vitest": "^0.18.0", "white-web-sdk": "^2.16.35" } };
|
11646
11658
|
this.emitter = callbacks;
|
11647
|
-
this.viewMode = ViewMode.Broadcaster;
|
11648
11659
|
this.viewMode$ = new Val(ViewMode.Broadcaster);
|
11649
11660
|
this.playground$ = new Val(void 0);
|
11650
11661
|
this.isReplay = isPlayer(this.displayer);
|
@@ -12030,7 +12041,6 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
12030
12041
|
if (mode === ViewMode.Freedom || mode === "scroll") {
|
12031
12042
|
mainViewProxy == null ? void 0 : mainViewProxy.stop();
|
12032
12043
|
}
|
12033
|
-
this.viewMode = mode;
|
12034
12044
|
this.viewMode$.setValue(mode);
|
12035
12045
|
}
|
12036
12046
|
setBoxState(boxState) {
|
@@ -12113,6 +12123,9 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
12113
12123
|
var _a, _b;
|
12114
12124
|
return Boolean((_b = (_a = this.appManager) == null ? void 0 : _a.boxManager) == null ? void 0 : _b.darkMode);
|
12115
12125
|
}
|
12126
|
+
get viewMode() {
|
12127
|
+
return this.viewMode$.value;
|
12128
|
+
}
|
12116
12129
|
get prefersColorScheme() {
|
12117
12130
|
var _a;
|
12118
12131
|
if (this.appManager) {
|
package/dist/index.umd.js
CHANGED
@@ -956,6 +956,9 @@ var __objRest = (source, exclude) => {
|
|
956
956
|
get destroyed() {
|
957
957
|
return this.appProxy.status === "destroyed";
|
958
958
|
}
|
959
|
+
get attributes() {
|
960
|
+
return this.appProxy.attributes;
|
961
|
+
}
|
959
962
|
get view() {
|
960
963
|
return this.appProxy.view;
|
961
964
|
}
|
@@ -993,12 +996,6 @@ var __objRest = (source, exclude) => {
|
|
993
996
|
uid: this.manager.uid
|
994
997
|
}, self2);
|
995
998
|
}
|
996
|
-
get storage() {
|
997
|
-
if (!this._storage) {
|
998
|
-
this._storage = this.createStorage(this.appId, this.getAttributes());
|
999
|
-
}
|
1000
|
-
return this._storage;
|
1001
|
-
}
|
1002
999
|
}
|
1003
1000
|
class AppPageStateImpl {
|
1004
1001
|
constructor(params) {
|
@@ -2552,6 +2549,15 @@ var __objRest = (source, exclude) => {
|
|
2552
2549
|
}
|
2553
2550
|
dispose() {
|
2554
2551
|
this.sideEffect.flushAll();
|
2552
|
+
this.scrollStorage.disconnect();
|
2553
|
+
this._root$.destroy();
|
2554
|
+
this._scale$.destroy();
|
2555
|
+
this._scrollTop$.destroy();
|
2556
|
+
this._whiteboard$.destroy();
|
2557
|
+
this.scrollState$.destroy();
|
2558
|
+
this._page$.destroy();
|
2559
|
+
this._size$.destroy();
|
2560
|
+
this._mainView$.destroy();
|
2555
2561
|
}
|
2556
2562
|
}
|
2557
2563
|
class AppManager {
|
@@ -2899,11 +2905,15 @@ var __objRest = (source, exclude) => {
|
|
2899
2905
|
this.members$.setValue(serializeRoomMembers(this.displayer.state.roomMembers));
|
2900
2906
|
emitter.on("mainViewMounted", () => {
|
2901
2907
|
this.windowManger.viewMode$.subscribe((viewMode) => {
|
2908
|
+
var _a2;
|
2902
2909
|
const playground = this.windowManger.playground$.value;
|
2903
2910
|
if (viewMode === "scroll" && playground) {
|
2904
2911
|
const scrollMode = new ScrollMode(this);
|
2905
2912
|
this.scrollMode = scrollMode;
|
2906
2913
|
scrollMode.setRoot(playground);
|
2914
|
+
} else {
|
2915
|
+
(_a2 = this.scrollMode) == null ? void 0 : _a2.dispose();
|
2916
|
+
this.scrollMode = void 0;
|
2907
2917
|
}
|
2908
2918
|
});
|
2909
2919
|
});
|
@@ -3255,6 +3265,7 @@ var __objRest = (source, exclude) => {
|
|
3255
3265
|
});
|
3256
3266
|
}
|
3257
3267
|
destroy() {
|
3268
|
+
var _a;
|
3258
3269
|
this.displayer.callbacks.off(this.eventName, this.displayerStateListener);
|
3259
3270
|
this.displayer.callbacks.off("onEnableWriteNowChanged", this.displayerWritableListener);
|
3260
3271
|
this.appListeners.removeListeners();
|
@@ -3270,6 +3281,7 @@ var __objRest = (source, exclude) => {
|
|
3270
3281
|
this.sceneIndex$.destroy();
|
3271
3282
|
this.focused$.destroy();
|
3272
3283
|
this.members$.destroy();
|
3284
|
+
(_a = this.scrollMode) == null ? void 0 : _a.dispose();
|
3273
3285
|
}
|
3274
3286
|
}
|
3275
3287
|
/*! *****************************************************************************
|
@@ -11641,10 +11653,9 @@ var __objRest = (source, exclude) => {
|
|
11641
11653
|
const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
|
11642
11654
|
constructor(context) {
|
11643
11655
|
super(context);
|
11644
|
-
this.version = "1.0.0-canary.
|
11656
|
+
this.version = "1.0.0-canary.57";
|
11645
11657
|
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/synced-store": "^2.0.7", "@netless/telebox-insider": "1.0.0-alpha.37", "emittery": "^0.11.0", "lodash": "^4.17.21", "p-retry": "^4.6.2", "side-effect-manager": "^1.2.1", "uuid": "^7.0.3", "value-enhancer": "^1.3.2" }, "peerDependencies": { "white-web-sdk": "^2.16.0" }, "devDependencies": { "@netless/app-docs-viewer": "^0.3.3", "@netless/app-plyr": "0.2.2", "@playwright/test": "^1.23.2", "@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.49", "@tsconfig/svelte": "^2.0.1", "@types/debug": "^4.1.7", "@types/lodash": "^4.14.182", "@types/lodash-es": "^4.17.6", "@types/node": "^18.0.3", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^4.30.0", "@typescript-eslint/parser": "^4.30.0", "@vitest/ui": "^0.14.2", "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.3", "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.1", "vitest": "^0.18.0", "white-web-sdk": "^2.16.35" } };
|
11646
11658
|
this.emitter = callbacks;
|
11647
|
-
this.viewMode = whiteWebSdk.ViewMode.Broadcaster;
|
11648
11659
|
this.viewMode$ = new valueEnhancer.Val(whiteWebSdk.ViewMode.Broadcaster);
|
11649
11660
|
this.playground$ = new valueEnhancer.Val(void 0);
|
11650
11661
|
this.isReplay = whiteWebSdk.isPlayer(this.displayer);
|
@@ -12030,7 +12041,6 @@ var __objRest = (source, exclude) => {
|
|
12030
12041
|
if (mode === whiteWebSdk.ViewMode.Freedom || mode === "scroll") {
|
12031
12042
|
mainViewProxy == null ? void 0 : mainViewProxy.stop();
|
12032
12043
|
}
|
12033
|
-
this.viewMode = mode;
|
12034
12044
|
this.viewMode$.setValue(mode);
|
12035
12045
|
}
|
12036
12046
|
setBoxState(boxState) {
|
@@ -12113,6 +12123,9 @@ var __objRest = (source, exclude) => {
|
|
12113
12123
|
var _a, _b;
|
12114
12124
|
return Boolean((_b = (_a = this.appManager) == null ? void 0 : _a.boxManager) == null ? void 0 : _b.darkMode);
|
12115
12125
|
}
|
12126
|
+
get viewMode() {
|
12127
|
+
return this.viewMode$.value;
|
12128
|
+
}
|
12116
12129
|
get prefersColorScheme() {
|
12117
12130
|
var _a;
|
12118
12131
|
if (this.appManager) {
|
@@ -37,6 +37,7 @@ export declare class AppContext<TAttributes extends Record<string, any> = any, T
|
|
37
37
|
constructor(manager: AppManager, appId: string, appProxy: AppProxy, appOptions?: TAppOptions | (() => TAppOptions) | undefined);
|
38
38
|
get displayer(): import("white-web-sdk").Displayer<import("white-web-sdk").DisplayerCallbacks>;
|
39
39
|
get destroyed(): boolean;
|
40
|
+
get attributes(): TAttributes;
|
40
41
|
/** @deprecated Use context.storage.state instead. */
|
41
42
|
getAttributes: () => TAttributes | undefined;
|
42
43
|
getScenes: () => SceneDefinition[] | undefined;
|
@@ -60,15 +61,12 @@ export declare class AppContext<TAttributes extends Record<string, any> = any, T
|
|
60
61
|
setScenePath: (scenePath: string) => Promise<void>;
|
61
62
|
/** Get the local App options. */
|
62
63
|
getAppOptions: () => TAppOptions | undefined;
|
63
|
-
private _storage?;
|
64
|
-
/** Main Storage for attributes. */
|
65
|
-
get storage(): Storage<TAttributes>;
|
66
64
|
/**
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
65
|
+
* Create separated storages for flexible state management.
|
66
|
+
* @param namespace Namespace for the storage. Storages of the same namespace share the same data.
|
67
|
+
* @param defaultState Default state for initial storage creation.
|
68
|
+
* @returns
|
69
|
+
*/
|
72
70
|
createStorage: <TState extends Record<string, any>>(namespace: string, defaultState?: TState | undefined) => Storage<TState>;
|
73
71
|
/** Dispatch events to other clients (and self). */
|
74
72
|
dispatchMagixEvent: MagixEventDispatcher<TMagixEventPayloads>;
|
package/dist/src/index.d.ts
CHANGED
@@ -128,7 +128,6 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
128
128
|
emitter: Emittery<PublicEvent>;
|
129
129
|
appManager?: AppManager;
|
130
130
|
cursorManager?: CursorManager;
|
131
|
-
viewMode: ManagerViewMode;
|
132
131
|
viewMode$: Val<ManagerViewMode, any>;
|
133
132
|
playground$: Val<HTMLElement | undefined, any>;
|
134
133
|
isReplay: boolean;
|
@@ -215,6 +214,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
|
|
215
214
|
get apps(): Apps | undefined;
|
216
215
|
get boxState(): TeleBoxState | undefined;
|
217
216
|
get darkMode(): boolean;
|
217
|
+
get viewMode(): ManagerViewMode;
|
218
218
|
get prefersColorScheme(): TeleBoxColorScheme | undefined;
|
219
219
|
get fullscreen(): TeleBoxFullscreen | undefined;
|
220
220
|
get focused(): string | undefined;
|
package/package.json
CHANGED
package/src/App/AppContext.ts
CHANGED
@@ -75,6 +75,10 @@ export class AppContext<TAttributes extends Record<string, any> = any, TMagixEve
|
|
75
75
|
return this.appProxy.status === "destroyed";
|
76
76
|
}
|
77
77
|
|
78
|
+
public get attributes(): TAttributes {
|
79
|
+
return this.appProxy.attributes;
|
80
|
+
}
|
81
|
+
|
78
82
|
/** @deprecated Use context.storage.state instead. */
|
79
83
|
public getAttributes = (): TAttributes | undefined => {
|
80
84
|
return this.appProxy.attributes;
|
@@ -220,17 +224,7 @@ export class AppContext<TAttributes extends Record<string, any> = any, TMagixEve
|
|
220
224
|
: this.appOptions;
|
221
225
|
};
|
222
226
|
|
223
|
-
|
224
|
-
|
225
|
-
/** Main Storage for attributes. */
|
226
|
-
public get storage(): Storage<TAttributes> {
|
227
|
-
if (!this._storage) {
|
228
|
-
this._storage = this.createStorage(this.appId, this.getAttributes());
|
229
|
-
}
|
230
|
-
return this._storage;
|
231
|
-
}
|
232
|
-
|
233
|
-
/**
|
227
|
+
/**
|
234
228
|
* Create separated storages for flexible state management.
|
235
229
|
* @param namespace Namespace for the storage. Storages of the same namespace share the same data.
|
236
230
|
* @param defaultState Default state for initial storage creation.
|
package/src/AppManager.ts
CHANGED
@@ -136,6 +136,9 @@ export class AppManager {
|
|
136
136
|
const scrollMode = new ScrollMode(this);
|
137
137
|
this.scrollMode = scrollMode;
|
138
138
|
scrollMode.setRoot(playground);
|
139
|
+
} else {
|
140
|
+
this.scrollMode?.dispose();
|
141
|
+
this.scrollMode = undefined;
|
139
142
|
}
|
140
143
|
});
|
141
144
|
});
|
@@ -873,5 +876,6 @@ export class AppManager {
|
|
873
876
|
this.sceneIndex$.destroy();
|
874
877
|
this.focused$.destroy();
|
875
878
|
this.members$.destroy();
|
879
|
+
this.scrollMode?.dispose();
|
876
880
|
}
|
877
881
|
}
|
package/src/View/ScrollMode.ts
CHANGED
@@ -201,6 +201,15 @@ export class ScrollMode {
|
|
201
201
|
|
202
202
|
public dispose(): void {
|
203
203
|
this.sideEffect.flushAll();
|
204
|
+
this.scrollStorage.disconnect();
|
205
|
+
this._root$.destroy();
|
206
|
+
this._scale$.destroy();
|
207
|
+
this._scrollTop$.destroy();
|
208
|
+
this._whiteboard$.destroy();
|
209
|
+
this.scrollState$.destroy();
|
210
|
+
this._page$.destroy();
|
211
|
+
this._size$.destroy();
|
212
|
+
this._mainView$.destroy();
|
204
213
|
}
|
205
214
|
|
206
215
|
private getWhiteboardElement = (root: HTMLElement | null): HTMLElement | null => {
|
package/src/index.ts
CHANGED
@@ -185,7 +185,6 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
|
|
185
185
|
public emitter: Emittery<PublicEvent> = callbacks;
|
186
186
|
public appManager?: AppManager;
|
187
187
|
public cursorManager?: CursorManager;
|
188
|
-
public viewMode: ManagerViewMode = ViewMode.Broadcaster;
|
189
188
|
public viewMode$ = new Val<ManagerViewMode>(ViewMode.Broadcaster);
|
190
189
|
public playground$ = new Val<HTMLElement | undefined>(undefined);
|
191
190
|
public isReplay = isPlayer(this.displayer);
|
@@ -638,7 +637,6 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
|
|
638
637
|
if (mode === ViewMode.Freedom || mode === "scroll") {
|
639
638
|
mainViewProxy?.stop();
|
640
639
|
}
|
641
|
-
this.viewMode = mode;
|
642
640
|
this.viewMode$.setValue(mode);
|
643
641
|
}
|
644
642
|
|
@@ -727,6 +725,10 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes, any>
|
|
727
725
|
return Boolean(this.appManager?.boxManager?.darkMode);
|
728
726
|
}
|
729
727
|
|
728
|
+
public get viewMode() {
|
729
|
+
return this.viewMode$.value;
|
730
|
+
}
|
731
|
+
|
730
732
|
public get prefersColorScheme(): TeleBoxColorScheme | undefined {
|
731
733
|
if (this.appManager) {
|
732
734
|
return this.appManager.boxManager?.prefersColorScheme;
|