@netless/window-manager 0.4.30 → 0.4.31
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 +4 -0
- package/dist/AppManager.d.ts +5 -1
- package/dist/BoxEmitter.d.ts +34 -0
- package/dist/BoxManager.d.ts +3 -1
- package/dist/InternalEmitter.d.ts +0 -18
- package/dist/Utils/AppCreateQueue.d.ts +2 -3
- package/dist/index.cjs.js +12 -12
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +51 -54
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +12 -12
- package/dist/index.umd.js.map +1 -1
- package/package.json +3 -2
- package/pnpm-lock.yaml +66 -36
- package/src/App/AppProxy.ts +2 -1
- package/src/AppManager.ts +67 -59
- package/src/BoxEmitter.ts +19 -0
- package/src/BoxManager.ts +10 -6
- package/src/InternalEmitter.ts +0 -4
- package/src/Utils/AppCreateQueue.ts +2 -3
- package/src/index.ts +3 -2
- package/dist/ScenePath/index.d.ts +0 -12
- package/src/ScenePath/index.ts +0 -47
package/src/index.ts
CHANGED
@@ -60,6 +60,7 @@ import type { AppProxy } from "./App";
|
|
60
60
|
import type { PublicEvent } from "./callback";
|
61
61
|
import type Emittery from "emittery";
|
62
62
|
import type { PageController, AddPageParams, PageState } from "./Page";
|
63
|
+
import { boxEmitter } from "./BoxEmitter";
|
63
64
|
|
64
65
|
export type WindowMangerAttributes = {
|
65
66
|
modelValue?: string;
|
@@ -320,7 +321,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
320
321
|
}
|
321
322
|
|
322
323
|
public bindContainer(container: HTMLElement) {
|
323
|
-
if (this.room.phase !== RoomPhase.Connected) {
|
324
|
+
if (isRoom(this.displayer) && this.room.phase !== RoomPhase.Connected) {
|
324
325
|
throw new BindContainerRoomPhaseInvalidError();
|
325
326
|
}
|
326
327
|
if (WindowManager.isCreated && WindowManager.container) {
|
@@ -339,7 +340,7 @@ export class WindowManager extends InvisiblePlugin<WindowMangerAttributes> imple
|
|
339
340
|
if (this.boxManager) {
|
340
341
|
this.boxManager.destroy();
|
341
342
|
}
|
342
|
-
const boxManager = createBoxManager(this, callbacks, emitter, {
|
343
|
+
const boxManager = createBoxManager(this, callbacks, emitter, boxEmitter, {
|
343
344
|
collectorContainer: params.collectorContainer,
|
344
345
|
collectorStyles: params.collectorStyles,
|
345
346
|
prefersColorScheme: params.prefersColorScheme,
|
@@ -1,12 +0,0 @@
|
|
1
|
-
import type { ScenesCallbacks, ScenesCallbacksNode } from "white-web-sdk";
|
2
|
-
import type { AppManager } from "../AppManager";
|
3
|
-
export declare class ScenesCallbackManager {
|
4
|
-
private manager;
|
5
|
-
private nodes;
|
6
|
-
constructor(manager: AppManager);
|
7
|
-
createNode(path: string, callbacks?: Partial<ScenesCallbacks>): ScenesCallbacksNode | null;
|
8
|
-
getScenes(path: string): readonly string[] | undefined;
|
9
|
-
getScenesOnce(path: string): readonly string[] | undefined;
|
10
|
-
removeNode(path: string): void;
|
11
|
-
destroy(): void;
|
12
|
-
}
|
package/src/ScenePath/index.ts
DELETED
@@ -1,47 +0,0 @@
|
|
1
|
-
import type { ScenesCallbacks, ScenesCallbacksNode } from "white-web-sdk";
|
2
|
-
import type { AppManager } from "../AppManager";
|
3
|
-
|
4
|
-
export class ScenesCallbackManager {
|
5
|
-
|
6
|
-
private nodes: Map<string, ScenesCallbacksNode> = new Map();
|
7
|
-
|
8
|
-
constructor(private manager: AppManager) {}
|
9
|
-
|
10
|
-
public createNode(path: string, callbacks?: Partial<ScenesCallbacks>): ScenesCallbacksNode | null {
|
11
|
-
const node = this.manager.displayer.createScenesCallback(path, callbacks);
|
12
|
-
if (node) {
|
13
|
-
this.nodes.set(path, node);
|
14
|
-
}
|
15
|
-
return node;
|
16
|
-
}
|
17
|
-
|
18
|
-
public getScenes(path: string) {
|
19
|
-
const node = this.nodes.get(path);
|
20
|
-
return node?.scenes;
|
21
|
-
}
|
22
|
-
|
23
|
-
public getScenesOnce(path: string) {
|
24
|
-
let node = this.nodes.get(path);
|
25
|
-
if (!node) {
|
26
|
-
const created = this.createNode(path);
|
27
|
-
if (created) {
|
28
|
-
node = created;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
const scenes = node?.scenes;
|
32
|
-
this.removeNode(path);
|
33
|
-
return scenes;
|
34
|
-
}
|
35
|
-
|
36
|
-
public removeNode(path: string) {
|
37
|
-
const node = this.nodes.get(path);
|
38
|
-
if (node) {
|
39
|
-
node.dispose();
|
40
|
-
this.nodes.delete(path);
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
|
-
public destroy(): void {
|
45
|
-
this.nodes.forEach(node => node.dispose());
|
46
|
-
}
|
47
|
-
}
|