@netless/window-manager 1.0.0-canary.11 → 1.0.0-canary.14
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/AppProxy.d.ts +4 -3
- package/dist/App/WhiteboardView.d.ts +2 -1
- package/dist/AppManager.d.ts +2 -2
- package/dist/index.cjs.js +10 -10
- package/dist/index.es.js +64 -47
- package/dist/index.umd.js +10 -10
- package/package.json +3 -3
- package/pnpm-lock.yaml +6 -10
- package/src/App/AppProxy.ts +8 -3
- package/src/App/WhiteboardView.ts +11 -1
- package/src/AppManager.ts +10 -8
- package/src/BoxManager.ts +11 -7
- package/src/PageState.ts +1 -1
- package/src/View/CameraSynchronizer.ts +3 -2
- package/src/index.ts +7 -8
package/dist/index.es.js
CHANGED
@@ -950,6 +950,14 @@ class WhiteBoardView {
|
|
950
950
|
appProxy.appEmitter.on("pageStateChange", (pageState) => {
|
951
951
|
pageState$.setValue(pageState);
|
952
952
|
});
|
953
|
+
const camera$ = new Val(this.view.camera);
|
954
|
+
this.camera$ = camera$;
|
955
|
+
appProxy.camera$.subscribe((camera) => {
|
956
|
+
if (camera) {
|
957
|
+
camera$.setValue(camera, true);
|
958
|
+
}
|
959
|
+
});
|
960
|
+
view.disableCameraTransform = true;
|
953
961
|
}
|
954
962
|
get pageState() {
|
955
963
|
return this.pageState$.value;
|
@@ -962,6 +970,7 @@ class WhiteBoardView {
|
|
962
970
|
}
|
963
971
|
destroy() {
|
964
972
|
this.pageState$.destroy();
|
973
|
+
this.camera$.destroy();
|
965
974
|
this.removeViewWrapper();
|
966
975
|
}
|
967
976
|
}
|
@@ -1212,7 +1221,7 @@ class CameraSynchronizer {
|
|
1212
1221
|
if (this.remoteCamera && this.remoteSize) {
|
1213
1222
|
this.onRemoteUpdate(this.remoteCamera, this.remoteSize);
|
1214
1223
|
}
|
1215
|
-
},
|
1224
|
+
}, 10);
|
1216
1225
|
this.onRemoteUpdate = throttle((camera, size2) => {
|
1217
1226
|
this.remoteCamera = camera;
|
1218
1227
|
this.remoteSize = size2;
|
@@ -1233,9 +1242,10 @@ class CameraSynchronizer {
|
|
1233
1242
|
animationMode: AnimationMode.Immediately
|
1234
1243
|
});
|
1235
1244
|
};
|
1245
|
+
moveCamera();
|
1236
1246
|
delay(moveCamera, 50);
|
1237
1247
|
}
|
1238
|
-
},
|
1248
|
+
}, 10);
|
1239
1249
|
}
|
1240
1250
|
setView(view) {
|
1241
1251
|
this.view = view;
|
@@ -1682,6 +1692,9 @@ class AppProxy {
|
|
1682
1692
|
}
|
1683
1693
|
})), "size");
|
1684
1694
|
};
|
1695
|
+
this.onFocus = () => {
|
1696
|
+
this.setScenePath();
|
1697
|
+
};
|
1685
1698
|
this.kind = params.kind;
|
1686
1699
|
this.id = appId;
|
1687
1700
|
this.appScenePath = `/${this.id}-app-dir`;
|
@@ -2020,6 +2033,7 @@ class AppProxy {
|
|
2020
2033
|
const fullPath = this._pageState.getFullPath(index2);
|
2021
2034
|
if (fullPath) {
|
2022
2035
|
this.setFullPath(fullPath);
|
2036
|
+
setScenePath(this.manager.room, fullPath);
|
2023
2037
|
}
|
2024
2038
|
}
|
2025
2039
|
}
|
@@ -2393,7 +2407,7 @@ class AppManager {
|
|
2393
2407
|
sceneName = (_b = this.callbacksNode) == null ? void 0 : _b.scenes[nextIndex];
|
2394
2408
|
}
|
2395
2409
|
if (sceneName) {
|
2396
|
-
this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
2410
|
+
await this.setMainViewScenePath(`${ROOT_DIR}${sceneName}`);
|
2397
2411
|
}
|
2398
2412
|
await this.setMainViewSceneIndex(nextIndex);
|
2399
2413
|
} else {
|
@@ -2561,6 +2575,7 @@ class AppManager {
|
|
2561
2575
|
setTimeout(() => {
|
2562
2576
|
const appProxy = this.appProxies.get(focused);
|
2563
2577
|
if (appProxy) {
|
2578
|
+
appProxy.onFocus();
|
2564
2579
|
appRegister.notifyApp(appProxy.kind, "focus", { appId: focused });
|
2565
2580
|
}
|
2566
2581
|
}, 0);
|
@@ -2611,6 +2626,7 @@ class AppManager {
|
|
2611
2626
|
if (sceneState) {
|
2612
2627
|
const scenePath = sceneState.scenePath;
|
2613
2628
|
this.appProxies.forEach((appProxy) => {
|
2629
|
+
console.log("scenePath", scenePath, appProxy.scenePath);
|
2614
2630
|
if (appProxy.scenePath && scenePath.startsWith(appProxy.scenePath)) {
|
2615
2631
|
appProxy.emitAppSceneStateChange(sceneState);
|
2616
2632
|
appProxy.setFullPath(scenePath);
|
@@ -2631,7 +2647,7 @@ class AppManager {
|
|
2631
2647
|
this.displayerWritableListener = (isReadonly) => {
|
2632
2648
|
var _a, _b;
|
2633
2649
|
const isWritable = !isReadonly;
|
2634
|
-
const isManualWritable = this.windowManger.readonly === void 0 || this.windowManger.readonly
|
2650
|
+
const isManualWritable = this.windowManger.readonly === void 0 || !this.windowManger.readonly;
|
2635
2651
|
if (this.windowManger.readonly === void 0) {
|
2636
2652
|
(_a = this.boxManager) == null ? void 0 : _a.setReadonly(isReadonly);
|
2637
2653
|
} else {
|
@@ -2640,7 +2656,7 @@ class AppManager {
|
|
2640
2656
|
this.appProxies.forEach((appProxy) => {
|
2641
2657
|
appProxy.emitAppIsWritableChange();
|
2642
2658
|
});
|
2643
|
-
if (isWritable
|
2659
|
+
if (isWritable) {
|
2644
2660
|
if (this.room && this.room.disableSerialization === true) {
|
2645
2661
|
this.room.disableSerialization = false;
|
2646
2662
|
}
|
@@ -2701,7 +2717,7 @@ class AppManager {
|
|
2701
2717
|
});
|
2702
2718
|
}
|
2703
2719
|
async onRootDirRemoved(needClose = true) {
|
2704
|
-
this.setMainViewScenePath(INIT_DIR);
|
2720
|
+
await this.setMainViewScenePath(INIT_DIR);
|
2705
2721
|
this.createRootDirScenesCallback();
|
2706
2722
|
for (const [id2, appProxy] of this.appProxies.entries()) {
|
2707
2723
|
if (appProxy.view) {
|
@@ -2709,7 +2725,7 @@ class AppManager {
|
|
2709
2725
|
}
|
2710
2726
|
}
|
2711
2727
|
this.mainViewProxy.rebind();
|
2712
|
-
emitter.emit("rootDirRemoved");
|
2728
|
+
await emitter.emit("rootDirRemoved");
|
2713
2729
|
this.updateRootDirRemoving(false);
|
2714
2730
|
}
|
2715
2731
|
get eventName() {
|
@@ -4309,33 +4325,33 @@ class Y$3 {
|
|
4309
4325
|
}
|
4310
4326
|
var X$3, P$3;
|
4311
4327
|
class O$3 {
|
4312
|
-
constructor({ minimized$: e2, readonly$: t2, darkMode$: i2,
|
4313
|
-
this._sideEffect = new SideEffectManager(), this.namespace =
|
4314
|
-
const
|
4315
|
-
this._sideEffect.addDisposer(() =>
|
4316
|
-
const
|
4317
|
-
withValueEnhancer(this, { styles:
|
4318
|
-
withReadonlyValueEnhancer(this, { root:
|
4319
|
-
withReadonlyValueEnhancer(this, { rect:
|
4320
|
-
this._sideEffect.addEventListener(
|
4328
|
+
constructor({ minimized$: e2, readonly$: t2, darkMode$: i2, namespace: s2 = "telebox", styles: a2 = {}, root$: n2 }) {
|
4329
|
+
this._sideEffect = new SideEffectManager(), this.namespace = s2;
|
4330
|
+
const o2 = new ValManager();
|
4331
|
+
this._sideEffect.addDisposer(() => o2.destroy());
|
4332
|
+
const r2 = new Val(void 0), h = derive(e2), l2 = new Val(a2), d2 = new Val(document.createElement("button"));
|
4333
|
+
withValueEnhancer(this, { styles: l2, $collector: d2 }, o2);
|
4334
|
+
withReadonlyValueEnhancer(this, { root: n2 });
|
4335
|
+
withReadonlyValueEnhancer(this, { rect: r2, visible: h }, o2), d2.value.className = this.wrapClassName("collector"), d2.value.style.backgroundImage = "url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxOCAxNiI+CiAgICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgICAgIDxwYXRoIHN0cm9rZT0iIzdCODhBMCIgc3Ryb2tlLXdpZHRoPSIxLjQiIGQ9Ik0uNyAxLjJoMTYuNnYxMy42SC43eiIgLz4KICAgICAgICA8cGF0aCBmaWxsPSIjN0I4OEEwIiBkPSJNNCA1LjVoNnYxLjRINHpNNCA5LjVoMTB2MS40SDR6IiAvPgogICAgPC9nPgo8L3N2Zz4K')", this._sideEffect.addDisposer(d2.subscribe((s3) => {
|
4336
|
+
this._sideEffect.addEventListener(s3, "click", () => {
|
4321
4337
|
t2.value || e2.setValue(false);
|
4322
|
-
}, {}, "telebox-collector-click"), this._sideEffect.addDisposer([
|
4323
|
-
|
4338
|
+
}, {}, "telebox-collector-click"), this._sideEffect.addDisposer([h.subscribe((e3) => {
|
4339
|
+
s3.classList.toggle(this.wrapClassName("collector-visible"), e3);
|
4324
4340
|
}), t2.subscribe((e3) => {
|
4325
|
-
|
4341
|
+
s3.classList.toggle(this.wrapClassName("collector-readonly"), e3);
|
4326
4342
|
}), i2.subscribe((e3) => {
|
4327
|
-
|
4328
|
-
}),
|
4343
|
+
s3.classList.toggle(this.wrapClassName("color-scheme-dark"), e3), s3.classList.toggle(this.wrapClassName("color-scheme-light"), !e3);
|
4344
|
+
}), l2.subscribe((e3) => {
|
4329
4345
|
Object.keys(e3).forEach((t3) => {
|
4330
4346
|
const i3 = e3[t3];
|
4331
|
-
i3 != null && (
|
4347
|
+
i3 != null && (s3.style[t3] = i3);
|
4332
4348
|
});
|
4333
|
-
}),
|
4334
|
-
e3 && e3.appendChild(
|
4335
|
-
}), combine([e2,
|
4336
|
-
if (e3 &&
|
4337
|
-
const { x: e4, y:
|
4338
|
-
|
4349
|
+
}), n2.subscribe((e3) => {
|
4350
|
+
e3 && e3.appendChild(s3);
|
4351
|
+
}), combine([e2, n2]).subscribe(([e3, t3]) => {
|
4352
|
+
if (e3 && t3) {
|
4353
|
+
const { x: e4, y: i3, width: a3, height: n3 } = s3.getBoundingClientRect(), o3 = t3.getBoundingClientRect();
|
4354
|
+
r2.setValue({ x: e4 - o3.x, y: i3 - o3.y, width: a3, height: n3 });
|
4339
4355
|
}
|
4340
4356
|
})], "telebox-collector-el");
|
4341
4357
|
}));
|
@@ -4437,7 +4453,7 @@ class F$3 {
|
|
4437
4453
|
t3 || this.events.emit(X$3.PrefersColorScheme, e3);
|
4438
4454
|
}));
|
4439
4455
|
const L2 = combine([R2, D2], ([e3, t3]) => t3 === "auto" ? e3 : t3 === "dark"), T2 = combine([z2, B2], ([e3, t3]) => e3 ? C$3.Minimized : t3 ? C$3.Maximized : C$3.Normal);
|
4440
|
-
this.collector = n2 != null ? n2 : new O$3({ minimized$: z2, readonly$: y2, darkMode$: L2, namespace: o2, root$: w2
|
4456
|
+
this.collector = n2 != null ? n2 : new O$3({ minimized$: z2, readonly$: y2, darkMode$: L2, namespace: o2, root$: w2 });
|
4441
4457
|
const V2 = new A$2({ namespace: o2, rootRect$: I2, ratio$: S2, root$: w2, highlightStage$: combine([M2, B2, z2], ([e3, t3, i3]) => e3 && (i3 || !t3)) });
|
4442
4458
|
this._sideEffect.addDisposer(() => V2.destroy());
|
4443
4459
|
const H2 = { darkMode: L2, state: T2, root: w2, rootRect: I2, stageRect: V2.stageRect$ };
|
@@ -4658,17 +4674,17 @@ class BoxManager {
|
|
4658
4674
|
const { emitter: emitter2, callbacks: callbacks2, boxEmitter: boxEmitter2 } = context;
|
4659
4675
|
this.teleBoxManager = this.setupBoxManager(createTeleBoxManagerConfig);
|
4660
4676
|
this.sideEffectManager.add(() => [
|
4661
|
-
this.teleBoxManager.
|
4677
|
+
this.teleBoxManager.onValChanged("state", (state) => {
|
4662
4678
|
callbacks2.emit("boxStateChange", state);
|
4663
4679
|
emitter2.emit("boxStateChange", state);
|
4664
4680
|
}),
|
4665
|
-
this.teleBoxManager.
|
4681
|
+
this.teleBoxManager.onValChanged("darkMode", (darkMode) => {
|
4666
4682
|
callbacks2.emit("darkModeChange", darkMode);
|
4667
4683
|
}),
|
4668
|
-
this.teleBoxManager.
|
4684
|
+
this.teleBoxManager.onValChanged("prefersColorScheme", (colorScheme) => {
|
4669
4685
|
callbacks2.emit("prefersColorSchemeChange", colorScheme);
|
4670
4686
|
}),
|
4671
|
-
this.teleBoxManager.
|
4687
|
+
this.teleBoxManager.onValChanged("minimized", (minimized, skipUpdate) => {
|
4672
4688
|
if (skipUpdate) {
|
4673
4689
|
return;
|
4674
4690
|
}
|
@@ -4684,7 +4700,7 @@ class BoxManager {
|
|
4684
4700
|
}
|
4685
4701
|
}
|
4686
4702
|
}),
|
4687
|
-
this.teleBoxManager.
|
4703
|
+
this.teleBoxManager.onValChanged("maximized", (maximized, skipUpdate) => {
|
4688
4704
|
if (skipUpdate) {
|
4689
4705
|
return;
|
4690
4706
|
}
|
@@ -4696,7 +4712,11 @@ class BoxManager {
|
|
4696
4712
|
});
|
4697
4713
|
}),
|
4698
4714
|
this.teleBoxManager.events.on("intrinsic_move", debounce((box) => {
|
4699
|
-
boxEmitter2.emit("move", {
|
4715
|
+
boxEmitter2.emit("move", {
|
4716
|
+
appId: box.id,
|
4717
|
+
x: box.intrinsicX,
|
4718
|
+
y: box.intrinsicY
|
4719
|
+
});
|
4700
4720
|
}, 50)),
|
4701
4721
|
this.teleBoxManager.events.on("intrinsic_resize", debounce((box) => {
|
4702
4722
|
boxEmitter2.emit("resize", {
|
@@ -15527,20 +15547,19 @@ const reconnectRefresher = new ReconnectRefresher({ emitter });
|
|
15527
15547
|
const _WindowManager = class extends InvisiblePlugin {
|
15528
15548
|
constructor(context) {
|
15529
15549
|
super(context);
|
15530
|
-
this.version = "1.0.0-canary.
|
15531
|
-
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.
|
15550
|
+
this.version = "1.0.0-canary.14";
|
15551
|
+
this.dependencies = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.16", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "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", "@vitest/ui": "^0.14.1", "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.14.1", "white-web-sdk": "2.16.10" } };
|
15532
15552
|
this.emitter = callbacks$1;
|
15533
15553
|
this.viewMode = ViewMode.Broadcaster;
|
15534
15554
|
this.isReplay = isPlayer(this.displayer);
|
15535
15555
|
this.containerSizeRatio = _WindowManager.containerSizeRatio;
|
15536
15556
|
_WindowManager.displayer = context.displayer;
|
15537
|
-
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.
|
15557
|
+
window.NETLESS_DEPS = { "dependencies": { "@juggle/resize-observer": "^3.3.1", "@netless/telebox-insider": "1.0.0-alpha.16", "emittery": "^0.9.2", "lodash": "^4.17.21", "p-retry": "^4.6.1", "side-effect-manager": "^1.1.0", "uuid": "^7.0.3", "value-enhancer": "^1.3.0", "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", "@vitest/ui": "^0.14.1", "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.14.1", "white-web-sdk": "2.16.10" } };
|
15538
15558
|
}
|
15539
15559
|
static async mount(params) {
|
15540
15560
|
var _a;
|
15541
15561
|
const room = params.room;
|
15542
15562
|
_WindowManager.container = params.container;
|
15543
|
-
const containerSizeRatio = params.containerSizeRatio;
|
15544
15563
|
const debug = params.debug;
|
15545
15564
|
const cursor = params.cursor;
|
15546
15565
|
_WindowManager.params = params;
|
@@ -15577,21 +15596,19 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
15577
15596
|
if (!manager) {
|
15578
15597
|
throw new Error("[WindowManager]: create manager failed");
|
15579
15598
|
}
|
15580
|
-
if (containerSizeRatio) {
|
15581
|
-
_WindowManager.containerSizeRatio = containerSizeRatio;
|
15599
|
+
if (params.containerSizeRatio) {
|
15600
|
+
_WindowManager.containerSizeRatio = params.containerSizeRatio;
|
15582
15601
|
}
|
15602
|
+
manager.containerSizeRatio = _WindowManager.containerSizeRatio;
|
15583
15603
|
await manager.ensureAttributes();
|
15584
15604
|
manager.appManager = new AppManager(manager);
|
15585
15605
|
manager._pageState = new PageStateImpl(manager.appManager);
|
15586
15606
|
manager.cursorManager = new CursorManager(manager.appManager, Boolean(cursor), params.applianceIcons);
|
15587
|
-
if (containerSizeRatio) {
|
15588
|
-
manager.containerSizeRatio = containerSizeRatio;
|
15589
|
-
}
|
15590
15607
|
manager.boxManager = createBoxManager(manager, callbacks$1, emitter, boxEmitter, {
|
15591
15608
|
collectorContainer: params.collectorContainer,
|
15592
15609
|
collectorStyles: params.collectorStyles,
|
15593
15610
|
prefersColorScheme: params.prefersColorScheme,
|
15594
|
-
stageRatio: containerSizeRatio,
|
15611
|
+
stageRatio: _WindowManager.containerSizeRatio,
|
15595
15612
|
highlightStage: params.highlightStage
|
15596
15613
|
});
|
15597
15614
|
(_a = manager.appManager) == null ? void 0 : _a.setBoxManager(manager.boxManager);
|
@@ -16151,12 +16168,12 @@ const _WindowManager = class extends InvisiblePlugin {
|
|
16151
16168
|
(_a = this.appManager) == null ? void 0 : _a.dispatchInternalEvent(Events.Refresh);
|
16152
16169
|
}
|
16153
16170
|
_refresh() {
|
16154
|
-
var _a, _b
|
16171
|
+
var _a, _b;
|
16155
16172
|
(_a = this.appManager) == null ? void 0 : _a.mainViewProxy.rebind();
|
16156
16173
|
if (_WindowManager.container) {
|
16157
16174
|
this.bindContainer(_WindowManager.container);
|
16158
16175
|
}
|
16159
|
-
(
|
16176
|
+
(_b = this.appManager) == null ? void 0 : _b.refresher.refresh();
|
16160
16177
|
}
|
16161
16178
|
setContainerSizeRatio(ratio) {
|
16162
16179
|
if (!isNumber(ratio)) {
|