@netless/window-manager 1.0.0-canary.42 → 1.0.0-canary.45
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 +12884 -115
- package/dist/index.es.js +2775 -3584
- package/dist/index.umd.js +12892 -127
- package/dist/src/index.d.ts +6 -4
- package/dist/style.css +795 -1
- package/docs/mirgrate-to-1.0.md +34 -5
- package/package.json +3 -3
- package/pnpm-lock.yaml +8 -8
- package/src/index.ts +29 -22
- package/vite.config.js +5 -4
package/docs/mirgrate-to-1.0.md
CHANGED
@@ -18,18 +18,31 @@
|
|
18
18
|
|
19
19
|
```html
|
20
20
|
<div class="netless-window-manager-playground">
|
21
|
-
<div class="
|
21
|
+
<div class="telebox-manager-container">
|
22
|
+
<div class="telebox-manager-stage">
|
23
|
+
<div class="netless-window-manager-main-view"></div>
|
24
|
+
</div>
|
25
|
+
</div>
|
22
26
|
</div>
|
23
27
|
```
|
24
28
|
|
25
29
|
|
26
30
|
### `WindowManager.mount()` 迁移
|
27
31
|
|
28
|
-
|
32
|
+
废弃: `chessboard` 属性
|
29
33
|
|
30
|
-
添加: `containerStyle` 配置
|
31
|
-
|
32
|
-
添加: `
|
34
|
+
- 添加: `containerStyle` 配置
|
35
|
+
- 配置 `telebox-manager-container` 的样式
|
36
|
+
- 添加: `stageStyle` 配置**
|
37
|
+
- 配置 `telebox-manager-stage` 的样式
|
38
|
+
- 添加: `defaultBoxBodyStyle` 配置
|
39
|
+
- 配置应用窗口默认 `body` 的样式
|
40
|
+
- 添加: `defaultBoxStageStyle` 配置
|
41
|
+
- 配置应用窗口默认 `stage` 也就是内容区域的样式
|
42
|
+
- 添加: `fullscreen` 配置
|
43
|
+
- 控制应用是否以全屏模式进入
|
44
|
+
- 添加: `theme` 配置
|
45
|
+
- 配置默认的颜色变量
|
33
46
|
|
34
47
|
### `manager.setContainerSizeRatio()` 行为修改
|
35
48
|
|
@@ -37,3 +50,19 @@
|
|
37
50
|
|
38
51
|
1.0 之后重复修改 `containerSizeRatio` 不会导致内容一致缩小
|
39
52
|
|
53
|
+
### baseSize
|
54
|
+
|
55
|
+
`baseSize` 主白板会去匹配内容到此大小
|
56
|
+
|
57
|
+
添加: `manager.baseSize` 属性\
|
58
|
+
添加: `manager.setBaseSize()` 方法\
|
59
|
+
添加: `baseSizeChange` 回调
|
60
|
+
|
61
|
+
### baseCamera
|
62
|
+
|
63
|
+
主白板的 `camera` 会根据 `baseSize` 的值和 `baseCamera` 的值计算一个最终值
|
64
|
+
|
65
|
+
添加: `manager.baseSize` 属性\
|
66
|
+
添加: `baseCamera` 回调
|
67
|
+
|
68
|
+
修改 `baseCamera` 依旧通过 `manager.moveCamera` 来实现
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@netless/window-manager",
|
3
|
-
"version": "1.0.0-canary.
|
3
|
+
"version": "1.0.0-canary.45",
|
4
4
|
"description": "",
|
5
5
|
"main": "dist/index.cjs.js",
|
6
6
|
"module": "dist/index.es.js",
|
@@ -25,7 +25,7 @@
|
|
25
25
|
},
|
26
26
|
"dependencies": {
|
27
27
|
"@juggle/resize-observer": "^3.3.1",
|
28
|
-
"@netless/telebox-insider": "1.0.0-alpha.
|
28
|
+
"@netless/telebox-insider": "1.0.0-alpha.35",
|
29
29
|
"emittery": "^0.11.0",
|
30
30
|
"lodash": "^4.17.21",
|
31
31
|
"p-retry": "^4.6.2",
|
@@ -34,7 +34,7 @@
|
|
34
34
|
"value-enhancer": "^1.3.2"
|
35
35
|
},
|
36
36
|
"devDependencies": {
|
37
|
-
"@netless/app-docs-viewer": "^0.3.
|
37
|
+
"@netless/app-docs-viewer": "^0.3.2",
|
38
38
|
"@netless/app-plyr": "0.2.0",
|
39
39
|
"@playwright/test": "^1.23.2",
|
40
40
|
"@rollup/plugin-commonjs": "^20.0.0",
|
package/pnpm-lock.yaml
CHANGED
@@ -2,9 +2,9 @@ lockfileVersion: 5.4
|
|
2
2
|
|
3
3
|
specifiers:
|
4
4
|
'@juggle/resize-observer': ^3.3.1
|
5
|
-
'@netless/app-docs-viewer': ^0.3.
|
5
|
+
'@netless/app-docs-viewer': ^0.3.2
|
6
6
|
'@netless/app-plyr': 0.2.0
|
7
|
-
'@netless/telebox-insider': 1.0.0-alpha.
|
7
|
+
'@netless/telebox-insider': 1.0.0-alpha.35
|
8
8
|
'@playwright/test': ^1.23.2
|
9
9
|
'@rollup/plugin-commonjs': ^20.0.0
|
10
10
|
'@rollup/plugin-node-resolve': ^13.0.4
|
@@ -45,7 +45,7 @@ specifiers:
|
|
45
45
|
|
46
46
|
dependencies:
|
47
47
|
'@juggle/resize-observer': 3.3.1
|
48
|
-
'@netless/telebox-insider': 1.0.0-alpha.
|
48
|
+
'@netless/telebox-insider': 1.0.0-alpha.35
|
49
49
|
emittery: 0.11.0
|
50
50
|
lodash: 4.17.21
|
51
51
|
p-retry: 4.6.2
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
value-enhancer: 1.3.2
|
55
55
|
|
56
56
|
devDependencies:
|
57
|
-
'@netless/app-docs-viewer': 0.3.
|
57
|
+
'@netless/app-docs-viewer': 0.3.2
|
58
58
|
'@netless/app-plyr': 0.2.0
|
59
59
|
'@playwright/test': 1.23.2
|
60
60
|
'@rollup/plugin-commonjs': 20.0.0
|
@@ -231,8 +231,8 @@ packages:
|
|
231
231
|
resolution: {integrity: sha512-6Wci+Tp3CgPt/B9B0a3J4s3yMgLNSku6w5TV6mN+61C71UqsRBv2FUibBf3tPGlNxebgPHMEUzKpb1ggE8KCKw==}
|
232
232
|
dev: true
|
233
233
|
|
234
|
-
/@netless/app-docs-viewer/0.3.
|
235
|
-
resolution: {integrity: sha512-
|
234
|
+
/@netless/app-docs-viewer/0.3.2:
|
235
|
+
resolution: {integrity: sha512-3gO8/AblCYQlu5kEnvI6+qJBu0VycSnIyVXfP6xu5obHHfF5aa+JGnDJ1/wZ+8DpvaydhWTuKvv+oVtuXDG0gg==}
|
236
236
|
dependencies:
|
237
237
|
remitter: 0.2.6
|
238
238
|
value-enhancer: 1.3.2
|
@@ -247,8 +247,8 @@ packages:
|
|
247
247
|
resolution: {integrity: sha512-7NzsJrba0R/mq/l10SkIZQwbrNVJyPxZYrjK6xL3Ts732iWAVuS2UB0u3s6iGeUVcqV39A679yva8APWRl4M0A==}
|
248
248
|
dev: true
|
249
249
|
|
250
|
-
/@netless/telebox-insider/1.0.0-alpha.
|
251
|
-
resolution: {integrity: sha512-
|
250
|
+
/@netless/telebox-insider/1.0.0-alpha.35:
|
251
|
+
resolution: {integrity: sha512-uX/PUEoG/+CoaigeoWH+U07io93n+T89VjJDl5FRnd3gc/QfYf3ASSDQ9+7GjbOBUDUFwYHqVIxEhU67mGXCbw==}
|
252
252
|
dependencies:
|
253
253
|
'@juggle/resize-observer': 3.3.1
|
254
254
|
'@types/shallowequal': 1.1.1
|
package/src/index.ts
CHANGED
@@ -135,18 +135,18 @@ export type MountParams = {
|
|
135
135
|
container?: HTMLElement;
|
136
136
|
/** 白板高宽比例, 默认为 9 / 16 */
|
137
137
|
containerSizeRatio?: number;
|
138
|
-
/** @deprecated */
|
139
|
-
chessboard?: boolean;
|
140
138
|
collectorContainer?: HTMLElement;
|
141
139
|
collectorStyles?: Partial<CSSStyleDeclaration>;
|
142
140
|
overwriteStyles?: string;
|
143
|
-
containerStyle?: string;
|
144
|
-
stageStyle?: string;
|
145
141
|
cursor?: boolean;
|
146
142
|
debug?: boolean;
|
147
143
|
disableCameraTransform?: boolean;
|
148
144
|
prefersColorScheme?: TeleBoxColorScheme;
|
145
|
+
/** @deprecated */
|
146
|
+
chessboard?: boolean;
|
149
147
|
applianceIcons?: ApplianceIcons;
|
148
|
+
containerStyle?: string;
|
149
|
+
stageStyle?: string;
|
150
150
|
fullscreen?: TeleBoxFullscreen;
|
151
151
|
/** Custom `style` attribute value for content area of all boxes. Can be overwritten by box. */
|
152
152
|
defaultBoxBodyStyle?: string | null;
|
@@ -185,6 +185,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
185
185
|
private static params?: MountParams;
|
186
186
|
|
187
187
|
private cameraUpdating = 0;
|
188
|
+
private nextCamera: Camera | null = null;
|
188
189
|
|
189
190
|
public containerSizeRatio = WindowManager.containerSizeRatio;
|
190
191
|
|
@@ -261,6 +262,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
261
262
|
containerStyle: params.containerStyle,
|
262
263
|
stageStyle: params.stageStyle,
|
263
264
|
fullscreen: params.fullscreen,
|
265
|
+
theme: params.theme,
|
264
266
|
});
|
265
267
|
manager.appManager?.setBoxManager(manager.boxManager);
|
266
268
|
if (params.container) {
|
@@ -833,27 +835,32 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
833
835
|
this.mainView.moveCamera(camera);
|
834
836
|
}
|
835
837
|
this.appManager.dispatchInternalEvent(Events.MoveCamera, camera);
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
this.mainView.callbacks.off("onCameraUpdated", onCameraUpdated);
|
842
|
-
clearTimeout(this.cameraUpdating);
|
843
|
-
this.cameraUpdating = 0;
|
844
|
-
if (!this.appManager) return;
|
845
|
-
this.appManager.mainViewProxy.storeCamera({
|
846
|
-
id: this.appManager.uid,
|
847
|
-
...nextCamera
|
848
|
-
});
|
849
|
-
}, 50);
|
850
|
-
}
|
851
|
-
this.mainView.callbacks.off("onCameraUpdated", onCameraUpdated);
|
852
|
-
this.mainView.callbacks.on("onCameraUpdated", onCameraUpdated);
|
853
|
-
|
838
|
+
this.mainView.callbacks.off("onCameraUpdated", this.onCameraUpdated);
|
839
|
+
clearTimeout(this.cameraUpdating);
|
840
|
+
this.cameraUpdating = 0;
|
841
|
+
this.mainView.callbacks.on("onCameraUpdated", this.onCameraUpdated);
|
842
|
+
this.nextCamera = nextCamera;
|
854
843
|
}
|
855
844
|
};
|
856
845
|
|
846
|
+
private onCameraUpdated = () => {
|
847
|
+
if (this.cameraUpdating) {
|
848
|
+
clearTimeout(this.cameraUpdating);
|
849
|
+
this.cameraUpdating = 0;
|
850
|
+
}
|
851
|
+
this.cameraUpdating = setTimeout(() => {
|
852
|
+
this.mainView.callbacks.off("onCameraUpdated", this.onCameraUpdated);
|
853
|
+
clearTimeout(this.cameraUpdating);
|
854
|
+
this.cameraUpdating = 0;
|
855
|
+
if (!this.appManager || !this.nextCamera) return;
|
856
|
+
this.appManager.mainViewProxy.storeCamera({
|
857
|
+
id: this.appManager.uid,
|
858
|
+
...this.nextCamera
|
859
|
+
});
|
860
|
+
this.nextCamera = null;
|
861
|
+
}, 50);
|
862
|
+
}
|
863
|
+
|
857
864
|
public convertToPointInWorld(point: Point): Point {
|
858
865
|
return this.mainView.convertToPointInWorld(point);
|
859
866
|
}
|
package/vite.config.js
CHANGED
@@ -5,8 +5,8 @@ import { svelte } from "@sveltejs/vite-plugin-svelte";
|
|
5
5
|
import { dependencies, peerDependencies, version, devDependencies } from "./package.json"
|
6
6
|
import { omit } from "lodash";
|
7
7
|
|
8
|
-
export default defineConfig((
|
9
|
-
const isProd = mode === "production";
|
8
|
+
export default defineConfig(() => {
|
9
|
+
// const isProd = mode === "production";
|
10
10
|
|
11
11
|
return {
|
12
12
|
test: {
|
@@ -40,7 +40,8 @@ export default defineConfig(({ mode }) => {
|
|
40
40
|
entry: path.resolve(__dirname, "src/index.ts"),
|
41
41
|
formats: ["es", "umd", "cjs"],
|
42
42
|
name: "WindowManager",
|
43
|
-
fileName: "index"
|
43
|
+
fileName: "index",
|
44
|
+
|
44
45
|
},
|
45
46
|
outDir: "dist",
|
46
47
|
rollupOptions: {
|
@@ -49,7 +50,7 @@ export default defineConfig(({ mode }) => {
|
|
49
50
|
...peerDependencies,
|
50
51
|
}),
|
51
52
|
},
|
52
|
-
minify:
|
53
|
+
minify: false
|
53
54
|
},
|
54
55
|
};
|
55
56
|
})
|