@netless/window-manager 1.0.7-beta.3 → 1.0.7-beta.4
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.d.ts +170 -166
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +21 -6
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/App/AppProxy.ts +4 -4
- package/src/AppManager.ts +7 -4
- package/src/AttributesDelegate.ts +4 -2
- package/src/BoxManager.ts +10 -5
- package/src/Utils/extendClass.ts +10 -0
- package/src/index.ts +6 -5
package/package.json
CHANGED
package/src/App/AppProxy.ts
CHANGED
|
@@ -27,7 +27,8 @@ import { WindowManager } from "../index";
|
|
|
27
27
|
import type { SceneState, View, SceneDefinition } from "white-web-sdk";
|
|
28
28
|
import type { AppManager } from "../AppManager";
|
|
29
29
|
import type { NetlessApp } from "../typings";
|
|
30
|
-
import { TELE_BOX_STATE
|
|
30
|
+
import { TELE_BOX_STATE } from "@netless/telebox-insider";
|
|
31
|
+
import type { ReadonlyTeleBox, TeleBoxState } from "@netless/telebox-insider";
|
|
31
32
|
import type { PageRemoveService, PageState } from "../Page";
|
|
32
33
|
import { calculateNextIndex } from "../Page";
|
|
33
34
|
import { boxEmitter } from "../BoxEmitter";
|
|
@@ -217,7 +218,7 @@ export class AppProxy implements PageRemoveService {
|
|
|
217
218
|
options,
|
|
218
219
|
canOperate: this.manager.canOperate,
|
|
219
220
|
smartPosition: this.isAddApp,
|
|
220
|
-
boxStatus
|
|
221
|
+
boxStatus,
|
|
221
222
|
});
|
|
222
223
|
if (this.isAddApp && this.box) {
|
|
223
224
|
if (boxStatus) {
|
|
@@ -309,8 +310,7 @@ export class AppProxy implements PageRemoveService {
|
|
|
309
310
|
const maximized = this.attributes?.["maximized"];
|
|
310
311
|
const minimized = this.attributes?.["minimized"];
|
|
311
312
|
const boxStatus = this.store.getBoxStatus(id) ?? undefined;
|
|
312
|
-
const lastNotMinimizedBoxStatus =
|
|
313
|
-
this.store.getLastNotMinimizedBoxStatus(id) ?? undefined;
|
|
313
|
+
const lastNotMinimizedBoxStatus = this.store.getLastNotMinimizedBoxStatus(id) ?? undefined;
|
|
314
314
|
const zIndex = attrs?.zIndex;
|
|
315
315
|
let payload = { maximized, minimized, zIndex } as AppInitState;
|
|
316
316
|
if (position) {
|
package/src/AppManager.ts
CHANGED
|
@@ -7,9 +7,10 @@ import { autorun, isPlayer, isRoom, ScenePathType, UpdateEventKind } from "white
|
|
|
7
7
|
import { boxEmitter } from "./BoxEmitter";
|
|
8
8
|
import { calculateNextIndex } from "./Page";
|
|
9
9
|
import { callbacks } from "./callback";
|
|
10
|
-
import { debounce, get,
|
|
10
|
+
import { debounce, get, isInteger, orderBy } from "lodash";
|
|
11
11
|
import { internalEmitter } from "./InternalEmitter";
|
|
12
|
-
import {
|
|
12
|
+
import { createAttributesDelegate, Fields } from "./AttributesDelegate";
|
|
13
|
+
import type { AttributesDelegate } from "./AttributesDelegate";
|
|
13
14
|
import { log } from "./Utils/log";
|
|
14
15
|
import { MainViewProxy } from "./View/MainView";
|
|
15
16
|
import { safeListenPropsUpdated } from "./Utils/Reactive";
|
|
@@ -434,7 +435,7 @@ export class AppManager {
|
|
|
434
435
|
|
|
435
436
|
private onBoxBlurred = (payload: BoxBlurredPayload) => {
|
|
436
437
|
const focus = this.attributes.focus;
|
|
437
|
-
if (focus === payload.appId) {
|
|
438
|
+
if (focus === payload.appId) {
|
|
438
439
|
this.windowManger.safeSetAttributes({ focus: undefined });
|
|
439
440
|
callbacks.emit("onBoxBlurred", payload);
|
|
440
441
|
}
|
|
@@ -466,7 +467,9 @@ export class AppManager {
|
|
|
466
467
|
return safeListenPropsUpdated(
|
|
467
468
|
() => this.attributes.lastNotMinimizedBoxesStatus,
|
|
468
469
|
() => {
|
|
469
|
-
this.boxManager?.setLastNotMinimizedBoxesStatus(
|
|
470
|
+
this.boxManager?.setLastNotMinimizedBoxesStatus(
|
|
471
|
+
this.attributes.lastNotMinimizedBoxesStatus
|
|
472
|
+
);
|
|
470
473
|
}
|
|
471
474
|
);
|
|
472
475
|
});
|
|
@@ -4,8 +4,10 @@ import { setViewFocusScenePath } from "./Utils/Common";
|
|
|
4
4
|
import type { AddAppParams, AppSyncAttributes } from "./index";
|
|
5
5
|
import type { Camera, Size, View } from "white-web-sdk";
|
|
6
6
|
import type { Cursor } from "./Cursor/Cursor";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
7
|
+
import { getExtendClass } from "./Utils/extendClass";
|
|
8
|
+
import type { TELE_BOX_STATE } from "@netless/telebox-insider";
|
|
9
|
+
import type { ExtendClass } from "./Utils/extendClass";
|
|
10
|
+
import type { NotMinimizedBoxState, TeleBoxState } from "@netless/telebox-insider";
|
|
9
11
|
|
|
10
12
|
export enum Fields {
|
|
11
13
|
Apps = "apps",
|
package/src/BoxManager.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AppAttributes, Events, MIN_HEIGHT, MIN_WIDTH } from "./constants";
|
|
2
2
|
import { debounce } from "lodash";
|
|
3
|
-
import { TELE_BOX_STATE
|
|
3
|
+
import { TELE_BOX_STATE } from "@netless/telebox-insider";
|
|
4
4
|
import { WindowManager } from "./index";
|
|
5
5
|
import type { BoxEmitterType } from "./BoxEmitter";
|
|
6
6
|
import type { AddAppOptions, AppInitState } from "./index";
|
|
@@ -20,7 +20,7 @@ import type { NetlessApp } from "./typings";
|
|
|
20
20
|
import type { View } from "white-web-sdk";
|
|
21
21
|
import type { CallbacksType } from "./callback";
|
|
22
22
|
import type { EmitterType } from "./InternalEmitter";
|
|
23
|
-
import { getExtendClass } from "./Utils/extendClass";
|
|
23
|
+
import { getExtendClass, TeleBoxManager, TeleBoxCollector } from "./Utils/extendClass";
|
|
24
24
|
|
|
25
25
|
export { TELE_BOX_STATE };
|
|
26
26
|
|
|
@@ -298,7 +298,10 @@ export class BoxManager {
|
|
|
298
298
|
}
|
|
299
299
|
|
|
300
300
|
public setLastNotMinimizedBoxesStatus(status?: Record<string, NotMinimizedBoxState>): void {
|
|
301
|
-
this.teleBoxManager.setLastNotMinimizedBoxesStatus(
|
|
301
|
+
this.teleBoxManager.setLastNotMinimizedBoxesStatus(
|
|
302
|
+
new Map(Object.entries(status ?? {})),
|
|
303
|
+
true
|
|
304
|
+
);
|
|
302
305
|
}
|
|
303
306
|
|
|
304
307
|
public setLastNotMinimizedBoxStatus(appId: string, status?: NotMinimizedBoxState): void {
|
|
@@ -323,7 +326,8 @@ export class BoxManager {
|
|
|
323
326
|
useBoxesStatus: createTeleBoxManagerConfig?.useBoxesStatus || false,
|
|
324
327
|
};
|
|
325
328
|
|
|
326
|
-
const
|
|
329
|
+
const TeleBoxManagerClass = getExtendClass(TeleBoxManager, WindowManager.extendClass);
|
|
330
|
+
const manager = new TeleBoxManagerClass(initManagerState);
|
|
327
331
|
if (this.teleBoxManager) {
|
|
328
332
|
this.teleBoxManager.destroy();
|
|
329
333
|
}
|
|
@@ -336,7 +340,8 @@ export class BoxManager {
|
|
|
336
340
|
}
|
|
337
341
|
|
|
338
342
|
public setCollectorContainer(container: HTMLElement) {
|
|
339
|
-
const
|
|
343
|
+
const TeleBoxCollectorClass = getExtendClass(TeleBoxCollector, WindowManager.extendClass);
|
|
344
|
+
const collector = new TeleBoxCollectorClass({
|
|
340
345
|
styles: this.createTeleBoxManagerConfig?.collectorStyles,
|
|
341
346
|
}).mount(container);
|
|
342
347
|
this.teleBoxManager.setCollector(collector);
|
package/src/Utils/extendClass.ts
CHANGED
|
@@ -3,12 +3,14 @@ import { AppManager } from "../AppManager";
|
|
|
3
3
|
import { AttributesDelegate } from "../AttributesDelegate";
|
|
4
4
|
import { BoxManager } from "../BoxManager";
|
|
5
5
|
import { CursorManager } from "../Cursor";
|
|
6
|
+
import { TeleBoxManager, TeleBoxCollector } from "@netless/telebox-insider";
|
|
6
7
|
|
|
7
8
|
export { AppManager } from "../AppManager";
|
|
8
9
|
export { AppContext, AppProxy } from "../App";
|
|
9
10
|
export { BoxManager } from "../BoxManager";
|
|
10
11
|
export { AttributesDelegate } from "../AttributesDelegate";
|
|
11
12
|
export { CursorManager } from "../Cursor";
|
|
13
|
+
export { TeleBoxManager, TeleBoxCollector } from "@netless/telebox-insider";
|
|
12
14
|
|
|
13
15
|
export type ExtendClassAble =
|
|
14
16
|
| typeof AppManager
|
|
@@ -17,6 +19,8 @@ export type ExtendClassAble =
|
|
|
17
19
|
| typeof BoxManager
|
|
18
20
|
| typeof AttributesDelegate
|
|
19
21
|
| typeof CursorManager
|
|
22
|
+
| typeof TeleBoxManager
|
|
23
|
+
| typeof TeleBoxCollector;
|
|
20
24
|
|
|
21
25
|
export type ExtendClass = {
|
|
22
26
|
AppManager?: typeof AppManager;
|
|
@@ -25,6 +29,8 @@ export type ExtendClass = {
|
|
|
25
29
|
CursorManager?: typeof CursorManager;
|
|
26
30
|
AppProxy?: typeof AppProxy;
|
|
27
31
|
AppContext?: typeof AppContext;
|
|
32
|
+
TeleBoxManager?: typeof TeleBoxManager;
|
|
33
|
+
TeleBoxCollector?: typeof TeleBoxCollector;
|
|
28
34
|
};
|
|
29
35
|
export function getExtendClass<T extends ExtendClassAble>(
|
|
30
36
|
baseClass: T,
|
|
@@ -43,6 +49,10 @@ export function getExtendClass<T extends ExtendClassAble>(
|
|
|
43
49
|
return (extendClass?.AppProxy || AppProxy) as T;
|
|
44
50
|
case "AppContext":
|
|
45
51
|
return (extendClass?.AppContext || AppContext) as T;
|
|
52
|
+
case "TeleBoxManager":
|
|
53
|
+
return (extendClass?.TeleBoxManager || TeleBoxManager) as T;
|
|
54
|
+
case "TeleBoxCollector":
|
|
55
|
+
return (extendClass?.TeleBoxCollector || TeleBoxCollector) as T;
|
|
46
56
|
default:
|
|
47
57
|
return baseClass;
|
|
48
58
|
}
|
package/src/index.ts
CHANGED
|
@@ -28,9 +28,10 @@ import {
|
|
|
28
28
|
putScenes,
|
|
29
29
|
wait,
|
|
30
30
|
} from "./Utils/Common";
|
|
31
|
-
import {
|
|
31
|
+
import type { BoxManager } from "./BoxManager";
|
|
32
|
+
import type { TELE_BOX_STATE } from "./BoxManager";
|
|
32
33
|
import * as Errors from "./Utils/error";
|
|
33
|
-
import { Apps, Position } from "./AttributesDelegate";
|
|
34
|
+
import type { Apps, Position } from "./AttributesDelegate";
|
|
34
35
|
import type {
|
|
35
36
|
Displayer,
|
|
36
37
|
SceneDefinition,
|
|
@@ -54,7 +55,7 @@ import type {
|
|
|
54
55
|
TeleBoxColorScheme,
|
|
55
56
|
TeleBoxState,
|
|
56
57
|
} from "@netless/telebox-insider";
|
|
57
|
-
import { AppProxy } from "./App";
|
|
58
|
+
import type { AppProxy } from "./App";
|
|
58
59
|
import type { PublicEvent } from "./callback";
|
|
59
60
|
import type Emittery from "emittery";
|
|
60
61
|
import type { PageController, AddPageParams, PageState } from "./Page";
|
|
@@ -63,7 +64,8 @@ import { IframeBridge } from "./View/IframeBridge";
|
|
|
63
64
|
import { setOptions } from "@netless/app-media-player";
|
|
64
65
|
import type { ExtendPluginInstance } from "./ExtendPluginManager";
|
|
65
66
|
import { ExtendPluginManager } from "./ExtendPluginManager";
|
|
66
|
-
import {
|
|
67
|
+
import { getExtendClass } from "./Utils/extendClass";
|
|
68
|
+
import type { ExtendClass } from "./Utils/extendClass";
|
|
67
69
|
|
|
68
70
|
export * from "./utils/extendClass";
|
|
69
71
|
|
|
@@ -395,7 +397,6 @@ export class WindowManager
|
|
|
395
397
|
if (this.appManager) {
|
|
396
398
|
this.appManager.useBoxesStatus = params.useBoxesStatus || false;
|
|
397
399
|
this.appManager.setBoxManager(boxManager);
|
|
398
|
-
|
|
399
400
|
}
|
|
400
401
|
this.bindMainView(mainViewElement, params.disableCameraTransform);
|
|
401
402
|
if (WindowManager.wrapper) {
|