@netless/window-manager 0.4.22 → 0.4.23
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/CHANGELOG.md +5 -1
- package/dist/AttributesDelegate.d.ts +9 -6
- package/dist/InternalEmitter.d.ts +1 -0
- package/dist/View/MainView.d.ts +2 -0
- package/dist/index.es.js +28 -7
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +10 -10
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/AppManager.ts +1 -0
- package/src/AttributesDelegate.ts +14 -2
- package/src/InternalEmitter.ts +1 -0
- package/src/View/MainView.ts +25 -8
package/CHANGELOG.md
CHANGED
@@ -31,6 +31,12 @@ export declare type StoreContext = {
|
|
31
31
|
safeUpdateAttributes: (keys: string[], value: any) => void;
|
32
32
|
safeSetAttributes: (attributes: any) => void;
|
33
33
|
};
|
34
|
+
export declare type ICamera = Camera & {
|
35
|
+
id: string;
|
36
|
+
};
|
37
|
+
export declare type ISize = Size & {
|
38
|
+
id: string;
|
39
|
+
};
|
34
40
|
export declare class AttributesDelegate {
|
35
41
|
private context;
|
36
42
|
constructor(context: StoreContext);
|
@@ -55,12 +61,9 @@ export declare class AttributesDelegate {
|
|
55
61
|
setMainViewSceneIndex(index: number): void;
|
56
62
|
getMainViewCamera(): MainViewCamera;
|
57
63
|
getMainViewSize(): MainViewSize;
|
58
|
-
setMainViewCamera(camera:
|
59
|
-
|
60
|
-
|
61
|
-
setMainViewSize(size: (Size & {
|
62
|
-
id: string;
|
63
|
-
}) | undefined): void;
|
64
|
+
setMainViewCamera(camera: ICamera): void;
|
65
|
+
setMainViewSize(size: ISize): void;
|
66
|
+
setMainViewCameraAndSize(camera: ICamera, size: ISize): void;
|
64
67
|
setAppFocus: (appId: string, focus: boolean) => void;
|
65
68
|
updateCursor(uid: string, position: Position): void;
|
66
69
|
updateCursorState(uid: string, cursorState: string | undefined): void;
|
@@ -39,6 +39,7 @@ export declare type EmitterEvent = {
|
|
39
39
|
rootDirRemoved: undefined;
|
40
40
|
setReadonly: boolean;
|
41
41
|
changePageState: undefined;
|
42
|
+
writableChange: boolean;
|
42
43
|
};
|
43
44
|
export declare type EmitterType = Emittery<EmitterEvent>;
|
44
45
|
export declare const emitter: EmitterType;
|
package/dist/View/MainView.d.ts
CHANGED
@@ -9,6 +9,8 @@ export declare class MainViewProxy {
|
|
9
9
|
private store;
|
10
10
|
private sideEffectManager;
|
11
11
|
constructor(manager: AppManager);
|
12
|
+
private startListenWritableChange;
|
13
|
+
ensureCameraAndSize(): void;
|
12
14
|
private get mainViewCamera();
|
13
15
|
private get mainViewSize();
|
14
16
|
private moveCameraSizeByAttributes;
|
package/dist/index.es.js
CHANGED
@@ -1153,6 +1153,12 @@ class AttributesDelegate {
|
|
1153
1153
|
setMainViewSize(size2) {
|
1154
1154
|
this.context.safeSetAttributes({ ["mainViewSize"]: __spreadValues({}, size2) });
|
1155
1155
|
}
|
1156
|
+
setMainViewCameraAndSize(camera, size2) {
|
1157
|
+
this.context.safeSetAttributes({
|
1158
|
+
["mainViewCamera"]: __spreadValues({}, camera),
|
1159
|
+
["mainViewSize"]: __spreadValues({}, size2)
|
1160
|
+
});
|
1161
|
+
}
|
1156
1162
|
updateCursor(uid, position) {
|
1157
1163
|
if (!get(this.attributes, ["cursors"])) {
|
1158
1164
|
this.context.safeUpdateAttributes(["cursors"], {});
|
@@ -1611,6 +1617,15 @@ class MainViewProxy {
|
|
1611
1617
|
this.mainViewIsAddListener = false;
|
1612
1618
|
this.store = this.manager.store;
|
1613
1619
|
this.sideEffectManager = new SideEffectManager();
|
1620
|
+
this.startListenWritableChange = () => {
|
1621
|
+
this.sideEffectManager.add(() => {
|
1622
|
+
return emitter.on("writableChange", (isWritable) => {
|
1623
|
+
if (isWritable) {
|
1624
|
+
this.ensureCameraAndSize();
|
1625
|
+
}
|
1626
|
+
});
|
1627
|
+
});
|
1628
|
+
};
|
1614
1629
|
this.addCameraReaction = () => {
|
1615
1630
|
var _a;
|
1616
1631
|
(_a = this.manager.refresher) == null ? void 0 : _a.add(Fields.MainViewCamera, this.cameraReaction);
|
@@ -1649,10 +1664,8 @@ class MainViewProxy {
|
|
1649
1664
|
emitter.once("mainViewMounted").then(() => {
|
1650
1665
|
this.addMainViewListener();
|
1651
1666
|
this.start();
|
1652
|
-
|
1653
|
-
|
1654
|
-
this.setCameraAndSize();
|
1655
|
-
}
|
1667
|
+
this.ensureCameraAndSize();
|
1668
|
+
this.startListenWritableChange();
|
1656
1669
|
});
|
1657
1670
|
const playgroundSizeChangeListener = () => {
|
1658
1671
|
this.sizeChangeHandler(this.mainViewSize);
|
@@ -1662,6 +1675,12 @@ class MainViewProxy {
|
|
1662
1675
|
return () => emitter.off("playgroundSizeChange", playgroundSizeChangeListener);
|
1663
1676
|
});
|
1664
1677
|
}
|
1678
|
+
ensureCameraAndSize() {
|
1679
|
+
if (!this.mainViewCamera || !this.mainViewSize) {
|
1680
|
+
this.manager.dispatchInternalEvent(Events.InitMainViewCamera);
|
1681
|
+
this.setCameraAndSize();
|
1682
|
+
}
|
1683
|
+
}
|
1665
1684
|
get mainViewCamera() {
|
1666
1685
|
return this.store.getMainViewCamera();
|
1667
1686
|
}
|
@@ -1681,8 +1700,9 @@ class MainViewProxy {
|
|
1681
1700
|
this.started = true;
|
1682
1701
|
}
|
1683
1702
|
setCameraAndSize() {
|
1684
|
-
|
1685
|
-
|
1703
|
+
const camera = __spreadProps(__spreadValues({}, this.mainView.camera), { id: this.manager.uid });
|
1704
|
+
const size2 = __spreadProps(__spreadValues({}, this.mainView.size), { id: this.manager.uid });
|
1705
|
+
this.store.setMainViewCameraAndSize(camera, size2);
|
1686
1706
|
}
|
1687
1707
|
get view() {
|
1688
1708
|
return this.mainView;
|
@@ -2050,6 +2070,7 @@ class AppManager {
|
|
2050
2070
|
} else {
|
2051
2071
|
this.mainView.disableCameraTransform = true;
|
2052
2072
|
}
|
2073
|
+
emitter.emit("writableChange", isWritable);
|
2053
2074
|
};
|
2054
2075
|
this.updateSceneIndex = () => {
|
2055
2076
|
const scenePath = this.store.getMainViewScenePath();
|
@@ -14847,7 +14868,7 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
14847
14868
|
const _WindowManager = class extends InvisiblePlugin {
|
14848
14869
|
constructor(context) {
|
14849
14870
|
super(context);
|
14850
|
-
this.version = "0.4.
|
14871
|
+
this.version = "0.4.23";
|
14851
14872
|
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/jest": "^27.4.1", "@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", "jest": "^27.5.1", "jest-canvas-mock": "^2.3.1", "jest-fetch-mock": "^3.0.3", "jest-transform-stub": "^2.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", "svelte-jester": "^2.3.2", "ts-jest": "^27.1.4", "typescript": "^4.5.5", "vite": "^2.5.3", "white-web-sdk": "2.16.10" } };
|
14852
14873
|
this.emitter = callbacks$1;
|
14853
14874
|
this.viewMode = ViewMode.Broadcaster;
|