@netless/window-manager 0.4.59 → 0.4.61-beta.0

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.
@@ -14,7 +14,8 @@ export declare enum Fields {
14
14
  Position = "position",
15
15
  CursorState = "cursorState",
16
16
  FullPath = "fullPath",
17
- Registered = "registered"
17
+ Registered = "registered",
18
+ IframeBridge = "iframeBridge"
18
19
  }
19
20
  export declare type Apps = {
20
21
  [key: string]: AppSyncAttributes;
@@ -70,6 +71,8 @@ export declare class AttributesDelegate {
70
71
  getCursorState(uid: string): any;
71
72
  cleanCursor(uid: string): void;
72
73
  setMainViewFocusPath(mainView: View): void;
74
+ getIframeBridge(): any;
75
+ setIframeBridge(data: any): void;
73
76
  }
74
77
  export declare type MainViewSize = {
75
78
  id: string;
@@ -0,0 +1,146 @@
1
+ import type { Displayer } from "white-web-sdk";
2
+ import type { AppManager } from "../AppManager";
3
+ import type { WindowManager } from "../index";
4
+ import Emittery from "emittery";
5
+ import { AnimationMode } from "white-web-sdk";
6
+ export declare enum IframeEvents {
7
+ Init = "Init",
8
+ AttributesUpdate = "AttributesUpdate",
9
+ SetAttributes = "SetAttributes",
10
+ RegisterMagixEvent = "RegisterMagixEvent",
11
+ RemoveMagixEvent = "RemoveMagixEvent",
12
+ RemoveAllMagixEvent = "RemoveAllMagixEvent",
13
+ RoomStateChanged = "RoomStateChanged",
14
+ DispatchMagixEvent = "DispatchMagixEvent",
15
+ ReciveMagixEvent = "ReciveMagixEvent",
16
+ NextPage = "NextPage",
17
+ PrevPage = "PrevPage",
18
+ SDKCreate = "SDKCreate",
19
+ OnCreate = "OnCreate",
20
+ SetPage = "SetPage",
21
+ GetAttributes = "GetAttributes",
22
+ Ready = "Ready",
23
+ Destory = "Destory",
24
+ StartCreate = "StartCreate",
25
+ WrapperDidUpdate = "WrapperDidUpdate",
26
+ DispayIframe = "DispayIframe",
27
+ HideIframe = "HideIframe",
28
+ GetRootRect = "GetRootRect",
29
+ ReplayRootRect = "ReplayRootRect",
30
+ PageTo = "PageTo"
31
+ }
32
+ export declare enum DomEvents {
33
+ WrapperDidMount = "WrapperDidMount",
34
+ IframeLoad = "IframeLoad"
35
+ }
36
+ export declare type IframeBridgeAttributes = {
37
+ readonly url: string;
38
+ readonly width: number;
39
+ readonly height: number;
40
+ readonly displaySceneDir: string;
41
+ readonly lastEvent?: {
42
+ name: string;
43
+ payload: any;
44
+ };
45
+ readonly useClicker?: boolean;
46
+ readonly useSelector?: boolean;
47
+ };
48
+ export declare type IframeBridgeEvents = {
49
+ created: undefined;
50
+ [IframeEvents.Ready]: undefined;
51
+ [IframeEvents.StartCreate]: undefined;
52
+ [IframeEvents.OnCreate]: IframeBridge;
53
+ [IframeEvents.Destory]: undefined;
54
+ [IframeEvents.GetRootRect]: undefined;
55
+ [IframeEvents.ReplayRootRect]: DOMRect;
56
+ [DomEvents.WrapperDidMount]: undefined;
57
+ [IframeEvents.WrapperDidUpdate]: undefined;
58
+ [DomEvents.IframeLoad]: Event;
59
+ [IframeEvents.HideIframe]: undefined;
60
+ [IframeEvents.DispayIframe]: undefined;
61
+ };
62
+ export declare type IframeSize = {
63
+ readonly width: number;
64
+ readonly height: number;
65
+ };
66
+ declare type BaseOption = {
67
+ readonly url: string;
68
+ readonly width: number;
69
+ readonly height: number;
70
+ readonly displaySceneDir: string;
71
+ };
72
+ export declare type InsertOptions = {
73
+ readonly useClicker?: boolean;
74
+ readonly useSelector?: boolean;
75
+ } & BaseOption;
76
+ export declare type OnCreateInsertOption = {
77
+ readonly displayer: Displayer;
78
+ } & BaseOption;
79
+ /**
80
+ * {@link https://github.com/netless-io/netless-iframe-bridge @netless/iframe-bridge}
81
+ */
82
+ export declare class IframeBridge {
83
+ readonly manager: WindowManager;
84
+ readonly appManager: AppManager;
85
+ static readonly kind = "IframeBridge";
86
+ static readonly hiddenClass = "netless-iframe-brdige-hidden";
87
+ static emitter: Emittery<IframeBridgeEvents>;
88
+ private static displayer;
89
+ private static alreadyCreate;
90
+ displayer: Displayer;
91
+ iframe: HTMLIFrameElement;
92
+ private readonly magixEventMap;
93
+ private cssList;
94
+ private allowAppliances;
95
+ private bridgeDisposer;
96
+ private rootRect;
97
+ private sideEffectManager;
98
+ constructor(manager: WindowManager, appManager: AppManager);
99
+ static onCreate(plugin: IframeBridge): void;
100
+ insert(options: InsertOptions): this;
101
+ private getComputedIframeStyle;
102
+ destroy(): void;
103
+ private getIframe;
104
+ setIframeSize(params: IframeSize): void;
105
+ get attributes(): Partial<IframeBridgeAttributes>;
106
+ setAttributes(data: Partial<IframeBridgeAttributes>): void;
107
+ private _createIframe;
108
+ scaleIframeToFit(animationMode?: AnimationMode): void;
109
+ get isReplay(): boolean;
110
+ private handleSetPage;
111
+ private execListenIframe;
112
+ private src_url_equal_anchor?;
113
+ private listenIframe;
114
+ private onPhaseChangedListener;
115
+ private listenDisplayerState;
116
+ private computedStyleAndIframeDisplay;
117
+ private listenDisplayerCallbacks;
118
+ private get callbackName();
119
+ private stateChangeListener;
120
+ private computedStyle;
121
+ private computedIframeDisplay;
122
+ computedZindex(): void;
123
+ private updateStyle;
124
+ private get iframeOrigin();
125
+ private messageListener;
126
+ private handleSDKCreate;
127
+ private handleDispatchMagixEvent;
128
+ private handleSetAttributes;
129
+ private handleRegisterMagixEvent;
130
+ private handleRemoveMagixEvent;
131
+ private handleNextPage;
132
+ private handlePrevPage;
133
+ private handlePageTo;
134
+ private handleRemoveAllMagixEvent;
135
+ private handleGetAttributes;
136
+ postMessage(message: any): void;
137
+ dispatchMagixEvent(event: string, payload: any): void;
138
+ private get currentIndex();
139
+ private get currentPage();
140
+ private get totalPage();
141
+ private get readonly();
142
+ get inDisplaySceneDir(): boolean;
143
+ private isClicker;
144
+ private get isDisableInput();
145
+ }
146
+ export {};
@@ -43,7 +43,9 @@ export declare class MainViewProxy {
43
43
  setMainViewSize: import("lodash").DebouncedFunc<(size: any) => void>;
44
44
  private addCameraListener;
45
45
  private removeCameraListener;
46
+ private _syncMainViewTimer;
46
47
  private onCameraOrSizeUpdated;
48
+ private syncMainView;
47
49
  moveCameraToContian(size: Size): void;
48
50
  moveCamera(camera: Camera): void;
49
51
  stop(): void;
package/dist/index.d.ts CHANGED
@@ -15,6 +15,8 @@ import type { AppProxy } from "./App";
15
15
  import type { PublicEvent } from "./callback";
16
16
  import type Emittery from "emittery";
17
17
  import type { PageController, AddPageParams, PageState } from "./Page";
18
+ import { IframeBridge } from "./View/IframeBridge";
19
+ export * from "./View/IframeBridge";
18
20
  export declare type WindowMangerAttributes = {
19
21
  modelValue?: string;
20
22
  boxState: TELE_BOX_STATE;
@@ -123,7 +125,7 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
123
125
  /**
124
126
  * 注册插件
125
127
  */
126
- static register<AppOptions = any, SetupResult = any, Attributes = any>(params: RegisterParams<AppOptions, SetupResult, Attributes>): Promise<void>;
128
+ static register(params: RegisterParams<any, any, any>): Promise<void>;
127
129
  /**
128
130
  * 注销插件
129
131
  */
@@ -246,6 +248,8 @@ export declare class WindowManager extends InvisiblePlugin<WindowMangerAttribute
246
248
  setContainerSizeRatio(ratio: number): void;
247
249
  private isDynamicPPT;
248
250
  private ensureAttributes;
251
+ private _iframeBridge?;
252
+ getIframeBridge(): IframeBridge;
249
253
  }
250
254
  export * from "./typings";
251
255
  export { BuiltinApps } from "./BuiltinApps";