@netless/window-manager 1.0.0-canary.55 → 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 +28 -10
- package/dist/index.es.js +28 -10
- package/dist/index.umd.js +28 -10
- 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 +19 -1
- 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) {
|
@@ -2521,7 +2518,12 @@ class ScrollMode {
|
|
2521
2518
|
});
|
2522
2519
|
this.updateScroll(scrollTop$.value);
|
2523
2520
|
this.sideEffect.push(this.scrollState$.subscribe((state) => callbacks.emit("scrollStateChange", state)));
|
2524
|
-
this.
|
2521
|
+
this.sideEffect.push(valueEnhancer.combine([this._size$, this._scale$]).subscribe(([size, scale2]) => {
|
2522
|
+
if (size.height > 0 && scale2 > 0) {
|
2523
|
+
this.initScroll();
|
2524
|
+
this.sideEffect.flush("initScroll");
|
2525
|
+
}
|
2526
|
+
}), "initScroll");
|
2525
2527
|
}
|
2526
2528
|
setRoot(root) {
|
2527
2529
|
this._root$.setValue(root);
|
@@ -2554,6 +2556,15 @@ class ScrollMode {
|
|
2554
2556
|
}
|
2555
2557
|
dispose() {
|
2556
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();
|
2557
2568
|
}
|
2558
2569
|
}
|
2559
2570
|
class AppManager {
|
@@ -2901,11 +2912,15 @@ class AppManager {
|
|
2901
2912
|
this.members$.setValue(serializeRoomMembers(this.displayer.state.roomMembers));
|
2902
2913
|
emitter.on("mainViewMounted", () => {
|
2903
2914
|
this.windowManger.viewMode$.subscribe((viewMode) => {
|
2915
|
+
var _a2;
|
2904
2916
|
const playground = this.windowManger.playground$.value;
|
2905
2917
|
if (viewMode === "scroll" && playground) {
|
2906
2918
|
const scrollMode = new ScrollMode(this);
|
2907
2919
|
this.scrollMode = scrollMode;
|
2908
2920
|
scrollMode.setRoot(playground);
|
2921
|
+
} else {
|
2922
|
+
(_a2 = this.scrollMode) == null ? void 0 : _a2.dispose();
|
2923
|
+
this.scrollMode = void 0;
|
2909
2924
|
}
|
2910
2925
|
});
|
2911
2926
|
});
|
@@ -3257,6 +3272,7 @@ class AppManager {
|
|
3257
3272
|
});
|
3258
3273
|
}
|
3259
3274
|
destroy() {
|
3275
|
+
var _a;
|
3260
3276
|
this.displayer.callbacks.off(this.eventName, this.displayerStateListener);
|
3261
3277
|
this.displayer.callbacks.off("onEnableWriteNowChanged", this.displayerWritableListener);
|
3262
3278
|
this.appListeners.removeListeners();
|
@@ -3272,6 +3288,7 @@ class AppManager {
|
|
3272
3288
|
this.sceneIndex$.destroy();
|
3273
3289
|
this.focused$.destroy();
|
3274
3290
|
this.members$.destroy();
|
3291
|
+
(_a = this.scrollMode) == null ? void 0 : _a.dispose();
|
3275
3292
|
}
|
3276
3293
|
}
|
3277
3294
|
/*! *****************************************************************************
|
@@ -11643,10 +11660,9 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
11643
11660
|
const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
|
11644
11661
|
constructor(context) {
|
11645
11662
|
super(context);
|
11646
|
-
this.version = "1.0.0-canary.
|
11663
|
+
this.version = "1.0.0-canary.57";
|
11647
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" } };
|
11648
11665
|
this.emitter = callbacks;
|
11649
|
-
this.viewMode = whiteWebSdk.ViewMode.Broadcaster;
|
11650
11666
|
this.viewMode$ = new valueEnhancer.Val(whiteWebSdk.ViewMode.Broadcaster);
|
11651
11667
|
this.playground$ = new valueEnhancer.Val(void 0);
|
11652
11668
|
this.isReplay = whiteWebSdk.isPlayer(this.displayer);
|
@@ -12032,7 +12048,6 @@ const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
|
|
12032
12048
|
if (mode === whiteWebSdk.ViewMode.Freedom || mode === "scroll") {
|
12033
12049
|
mainViewProxy == null ? void 0 : mainViewProxy.stop();
|
12034
12050
|
}
|
12035
|
-
this.viewMode = mode;
|
12036
12051
|
this.viewMode$.setValue(mode);
|
12037
12052
|
}
|
12038
12053
|
setBoxState(boxState) {
|
@@ -12115,6 +12130,9 @@ const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
|
|
12115
12130
|
var _a, _b;
|
12116
12131
|
return Boolean((_b = (_a = this.appManager) == null ? void 0 : _a.boxManager) == null ? void 0 : _b.darkMode);
|
12117
12132
|
}
|
12133
|
+
get viewMode() {
|
12134
|
+
return this.viewMode$.value;
|
12135
|
+
}
|
12118
12136
|
get prefersColorScheme() {
|
12119
12137
|
var _a;
|
12120
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) {
|
@@ -2514,7 +2511,12 @@ class ScrollMode {
|
|
2514
2511
|
});
|
2515
2512
|
this.updateScroll(scrollTop$.value);
|
2516
2513
|
this.sideEffect.push(this.scrollState$.subscribe((state) => callbacks.emit("scrollStateChange", state)));
|
2517
|
-
this.
|
2514
|
+
this.sideEffect.push(combine([this._size$, this._scale$]).subscribe(([size, scale2]) => {
|
2515
|
+
if (size.height > 0 && scale2 > 0) {
|
2516
|
+
this.initScroll();
|
2517
|
+
this.sideEffect.flush("initScroll");
|
2518
|
+
}
|
2519
|
+
}), "initScroll");
|
2518
2520
|
}
|
2519
2521
|
setRoot(root) {
|
2520
2522
|
this._root$.setValue(root);
|
@@ -2547,6 +2549,15 @@ class ScrollMode {
|
|
2547
2549
|
}
|
2548
2550
|
dispose() {
|
2549
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();
|
2550
2561
|
}
|
2551
2562
|
}
|
2552
2563
|
class AppManager {
|
@@ -2894,11 +2905,15 @@ class AppManager {
|
|
2894
2905
|
this.members$.setValue(serializeRoomMembers(this.displayer.state.roomMembers));
|
2895
2906
|
emitter.on("mainViewMounted", () => {
|
2896
2907
|
this.windowManger.viewMode$.subscribe((viewMode) => {
|
2908
|
+
var _a2;
|
2897
2909
|
const playground = this.windowManger.playground$.value;
|
2898
2910
|
if (viewMode === "scroll" && playground) {
|
2899
2911
|
const scrollMode = new ScrollMode(this);
|
2900
2912
|
this.scrollMode = scrollMode;
|
2901
2913
|
scrollMode.setRoot(playground);
|
2914
|
+
} else {
|
2915
|
+
(_a2 = this.scrollMode) == null ? void 0 : _a2.dispose();
|
2916
|
+
this.scrollMode = void 0;
|
2902
2917
|
}
|
2903
2918
|
});
|
2904
2919
|
});
|
@@ -3250,6 +3265,7 @@ class AppManager {
|
|
3250
3265
|
});
|
3251
3266
|
}
|
3252
3267
|
destroy() {
|
3268
|
+
var _a;
|
3253
3269
|
this.displayer.callbacks.off(this.eventName, this.displayerStateListener);
|
3254
3270
|
this.displayer.callbacks.off("onEnableWriteNowChanged", this.displayerWritableListener);
|
3255
3271
|
this.appListeners.removeListeners();
|
@@ -3265,6 +3281,7 @@ class AppManager {
|
|
3265
3281
|
this.sceneIndex$.destroy();
|
3266
3282
|
this.focused$.destroy();
|
3267
3283
|
this.members$.destroy();
|
3284
|
+
(_a = this.scrollMode) == null ? void 0 : _a.dispose();
|
3268
3285
|
}
|
3269
3286
|
}
|
3270
3287
|
/*! *****************************************************************************
|
@@ -11636,10 +11653,9 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
11636
11653
|
const _WindowManager = class extends InvisiblePlugin {
|
11637
11654
|
constructor(context) {
|
11638
11655
|
super(context);
|
11639
|
-
this.version = "1.0.0-canary.
|
11656
|
+
this.version = "1.0.0-canary.57";
|
11640
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" } };
|
11641
11658
|
this.emitter = callbacks;
|
11642
|
-
this.viewMode = ViewMode.Broadcaster;
|
11643
11659
|
this.viewMode$ = new Val(ViewMode.Broadcaster);
|
11644
11660
|
this.playground$ = new Val(void 0);
|
11645
11661
|
this.isReplay = isPlayer(this.displayer);
|
@@ -12025,7 +12041,6 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
12025
12041
|
if (mode === ViewMode.Freedom || mode === "scroll") {
|
12026
12042
|
mainViewProxy == null ? void 0 : mainViewProxy.stop();
|
12027
12043
|
}
|
12028
|
-
this.viewMode = mode;
|
12029
12044
|
this.viewMode$.setValue(mode);
|
12030
12045
|
}
|
12031
12046
|
setBoxState(boxState) {
|
@@ -12108,6 +12123,9 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
12108
12123
|
var _a, _b;
|
12109
12124
|
return Boolean((_b = (_a = this.appManager) == null ? void 0 : _a.boxManager) == null ? void 0 : _b.darkMode);
|
12110
12125
|
}
|
12126
|
+
get viewMode() {
|
12127
|
+
return this.viewMode$.value;
|
12128
|
+
}
|
12111
12129
|
get prefersColorScheme() {
|
12112
12130
|
var _a;
|
12113
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) {
|
@@ -2514,7 +2511,12 @@ var __objRest = (source, exclude) => {
|
|
2514
2511
|
});
|
2515
2512
|
this.updateScroll(scrollTop$.value);
|
2516
2513
|
this.sideEffect.push(this.scrollState$.subscribe((state) => callbacks.emit("scrollStateChange", state)));
|
2517
|
-
this.
|
2514
|
+
this.sideEffect.push(valueEnhancer.combine([this._size$, this._scale$]).subscribe(([size, scale2]) => {
|
2515
|
+
if (size.height > 0 && scale2 > 0) {
|
2516
|
+
this.initScroll();
|
2517
|
+
this.sideEffect.flush("initScroll");
|
2518
|
+
}
|
2519
|
+
}), "initScroll");
|
2518
2520
|
}
|
2519
2521
|
setRoot(root) {
|
2520
2522
|
this._root$.setValue(root);
|
@@ -2547,6 +2549,15 @@ var __objRest = (source, exclude) => {
|
|
2547
2549
|
}
|
2548
2550
|
dispose() {
|
2549
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();
|
2550
2561
|
}
|
2551
2562
|
}
|
2552
2563
|
class AppManager {
|
@@ -2894,11 +2905,15 @@ var __objRest = (source, exclude) => {
|
|
2894
2905
|
this.members$.setValue(serializeRoomMembers(this.displayer.state.roomMembers));
|
2895
2906
|
emitter.on("mainViewMounted", () => {
|
2896
2907
|
this.windowManger.viewMode$.subscribe((viewMode) => {
|
2908
|
+
var _a2;
|
2897
2909
|
const playground = this.windowManger.playground$.value;
|
2898
2910
|
if (viewMode === "scroll" && playground) {
|
2899
2911
|
const scrollMode = new ScrollMode(this);
|
2900
2912
|
this.scrollMode = scrollMode;
|
2901
2913
|
scrollMode.setRoot(playground);
|
2914
|
+
} else {
|
2915
|
+
(_a2 = this.scrollMode) == null ? void 0 : _a2.dispose();
|
2916
|
+
this.scrollMode = void 0;
|
2902
2917
|
}
|
2903
2918
|
});
|
2904
2919
|
});
|
@@ -3250,6 +3265,7 @@ var __objRest = (source, exclude) => {
|
|
3250
3265
|
});
|
3251
3266
|
}
|
3252
3267
|
destroy() {
|
3268
|
+
var _a;
|
3253
3269
|
this.displayer.callbacks.off(this.eventName, this.displayerStateListener);
|
3254
3270
|
this.displayer.callbacks.off("onEnableWriteNowChanged", this.displayerWritableListener);
|
3255
3271
|
this.appListeners.removeListeners();
|
@@ -3265,6 +3281,7 @@ var __objRest = (source, exclude) => {
|
|
3265
3281
|
this.sceneIndex$.destroy();
|
3266
3282
|
this.focused$.destroy();
|
3267
3283
|
this.members$.destroy();
|
3284
|
+
(_a = this.scrollMode) == null ? void 0 : _a.dispose();
|
3268
3285
|
}
|
3269
3286
|
}
|
3270
3287
|
/*! *****************************************************************************
|
@@ -11636,10 +11653,9 @@ var __objRest = (source, exclude) => {
|
|
11636
11653
|
const _WindowManager = class extends whiteWebSdk.InvisiblePlugin {
|
11637
11654
|
constructor(context) {
|
11638
11655
|
super(context);
|
11639
|
-
this.version = "1.0.0-canary.
|
11656
|
+
this.version = "1.0.0-canary.57";
|
11640
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" } };
|
11641
11658
|
this.emitter = callbacks;
|
11642
|
-
this.viewMode = whiteWebSdk.ViewMode.Broadcaster;
|
11643
11659
|
this.viewMode$ = new valueEnhancer.Val(whiteWebSdk.ViewMode.Broadcaster);
|
11644
11660
|
this.playground$ = new valueEnhancer.Val(void 0);
|
11645
11661
|
this.isReplay = whiteWebSdk.isPlayer(this.displayer);
|
@@ -12025,7 +12041,6 @@ var __objRest = (source, exclude) => {
|
|
12025
12041
|
if (mode === whiteWebSdk.ViewMode.Freedom || mode === "scroll") {
|
12026
12042
|
mainViewProxy == null ? void 0 : mainViewProxy.stop();
|
12027
12043
|
}
|
12028
|
-
this.viewMode = mode;
|
12029
12044
|
this.viewMode$.setValue(mode);
|
12030
12045
|
}
|
12031
12046
|
setBoxState(boxState) {
|
@@ -12108,6 +12123,9 @@ var __objRest = (source, exclude) => {
|
|
12108
12123
|
var _a, _b;
|
12109
12124
|
return Boolean((_b = (_a = this.appManager) == null ? void 0 : _a.boxManager) == null ? void 0 : _b.darkMode);
|
12110
12125
|
}
|
12126
|
+
get viewMode() {
|
12127
|
+
return this.viewMode$.value;
|
12128
|
+
}
|
12111
12129
|
get prefersColorScheme() {
|
12112
12130
|
var _a;
|
12113
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
@@ -149,7 +149,16 @@ export class ScrollMode {
|
|
149
149
|
this.sideEffect.push(
|
150
150
|
this.scrollState$.subscribe(state => callbacks.emit("scrollStateChange", state))
|
151
151
|
);
|
152
|
-
|
152
|
+
|
153
|
+
this.sideEffect.push(
|
154
|
+
combine([this._size$, this._scale$]).subscribe(([size, scale]) => {
|
155
|
+
if (size.height > 0 && scale > 0) {
|
156
|
+
this.initScroll();
|
157
|
+
this.sideEffect.flush("initScroll");
|
158
|
+
}
|
159
|
+
}),
|
160
|
+
"initScroll"
|
161
|
+
);
|
153
162
|
}
|
154
163
|
|
155
164
|
private initScroll = (): void => {
|
@@ -192,6 +201,15 @@ export class ScrollMode {
|
|
192
201
|
|
193
202
|
public dispose(): void {
|
194
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();
|
195
213
|
}
|
196
214
|
|
197
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;
|